/* 江湖名录：夜墨 / 宣纸，朱砂标记与清晰的数据层级。 */
:root {
    --font-title: "Songti SC", "Noto Serif SC", "SimSun", serif;
    --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
    --bg-base: #1c201f;
    --bg-grad-1: #1c201f;
    --bg-grad-2: #1c201f;
    --surface: #222824;
    --surface-solid: #1c201f;
    --surface-hover: #2d352f;
    --surface-inset: #252d27;
    --border: #414940;
    --border-strong: #718071;
    --text: #e7e7dd;
    --text-secondary: #adb5ab;
    --text-faint: #9ba697;
    --accent: #e19785;
    --accent-strong: #efb3a4;
    --accent-soft: #352d28;
    --accent-2: #a4c5af;
    --accent-2-soft: #28372d;
    --up: #e19785;
    --down: #9bc6ab;
    --flat: #adb5ab;
    --rank-1: #d0b175;
    --rank-2: #bbc2b7;
    --rank-3: #bd9c7e;
    --leader-surface: #2b322a;
    --versus-left: var(--accent);
    --versus-right: var(--accent-2);
    --glow-accent: none;
    --glow-accent-2: none;
    --shadow-card: none;
    --shadow-pop: 0 12px 36px rgb(0 0 0 / 22%);
    --radius: 4px;
    --radius-sm: 3px;
    --radius-lg: 6px;
    --header-h: 76px;
    --tabbar-h: 60px;
    --content-max: 1120px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast: 0.16s;
    --dur-page: 0.18s;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg-base: #f5f2ea;
    --bg-grad-1: #f5f2ea;
    --bg-grad-2: #f5f2ea;
    --surface: #f9f7f1;
    --surface-solid: #f5f2ea;
    --surface-hover: #eeede3;
    --surface-inset: #eeede4;
    --border: #d5d7cb;
    --border-strong: #919a88;
    --text: #262f2b;
    --text-secondary: #626c60;
    --text-faint: #697261;
    --accent: #a33d30;
    --accent-strong: #8d3227;
    --accent-soft: #efe2d8;
    --accent-2: #3d6e59;
    --accent-2-soft: #e3e9df;
    --up: #a33d30;
    --down: #3d6e59;
    --flat: #626c60;
    --rank-1: #896c2c;
    --rank-2: #657366;
    --rank-3: #8b654a;
    --leader-surface: #eae9de;
    --shadow-pop: 0 12px 36px rgb(38 47 43 / 12%);
    color-scheme: light;
}

/* ==========================================================================
   基础元素
   ========================================================================== */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    /* body 不滚动（滚动容器是 .app-main），避免移动端橡皮筋拖动整个页面 */
    overflow: hidden;
    overscroll-behavior: none;
}

/* standalone（现代 iOS/Android）用动态视口高度，地址栏/工具栏变化时高度随动；
   旧版 iOS（<15）由 App.razor 写入 data-standalone 与 --shell-h 实测高度。 */
:root[data-standalone="1"],
:root[data-standalone="1"] body {
    height: var(--shell-h, 100vh);
}

@supports (height: 100dvh) {
    html, body {
        height: 100dvh;
    }

    :root[data-standalone="1"],
    :root[data-standalone="1"] body {
        height: max(var(--shell-h, 100vh), 100dvh);
    }
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 触屏控件：去掉双击缩放延迟与长按系统呼出（iOS PWA 内更像原生应用） */
button, .nav-tab, .bottom-tab, .brand {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

/* iOS：输入控件字号小于 16px 时聚焦会自动放大页面，PWA 下没有地址栏可回缩 */
@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px;
    }
}

h1, h2, h3, .font-title {
    font-family: var(--font-title);
    letter-spacing: 0.04em;
}

a {
    color: var(--accent-2);
    text-decoration: none;
}

/* 数字等宽，排行榜对齐 */
.num {
    font-variant-numeric: tabular-nums;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* 移动端：隐藏滚动条，保留滚动功能 */
@media screen and (max-width: 768px) {
    * {
        scrollbar-width: none; /* Firefox */
    }

    ::-webkit-scrollbar {
        display: none; /* WebKit / Blink */
    }
}

::selection {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

/* ==========================================================================
   通用语义类（涨跌 / 排名 / 徽章）
   ========================================================================== */

.chg-up { color: var(--up); }
.chg-down { color: var(--down); }
.chg-flat { color: var(--flat); }

.rank-1 { color: var(--rank-1);  }
.rank-2 { color: var(--rank-2); }
.rank-3 { color: var(--rank-3); }

/* 门派用文字辨识，避免分类颜色与涨跌颜色竞争。 */
.mp-badge { color: var(--text-secondary); font-size: 0.8rem; white-space: nowrap; }

button, input, select { font-family: var(--font-body); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 3px;
}

/* 榜单公用列：组件和列头共享尺寸，长名字不挤占数字列。 */
.ranking-columns, .ranking-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 120px 70px 110px 90px 16px;
    align-items: center;
    gap: 16px;
}
.ranking-columns.guild-columns, .ranking-row.guild-row {
    grid-template-columns: 42px minmax(0, 1fr) 110px 90px 16px;
}
.ranking-columns { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-size: 0.75rem; }
.ranking-columns .align-end { text-align: right; }
.ranking-row { width: 100%; padding: 20px 16px; border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.ranking-row:focus-visible { outline-offset: -3px; }

.directory-footer { flex-shrink: 0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 28px; margin-top: 24px; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 0.72rem; letter-spacing: 0.08em; }
.ranking-search-bar { margin-bottom: 14px; }
.filter-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 0 0; font-size: 0.8rem; }
.filter-chips-label { color: var(--text-secondary); }
.filter-feedback { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--text-secondary); font-size: 0.8rem; }
.filter-chip { max-width: 100%; overflow-wrap: anywhere; padding: 5px 10px; background: var(--accent-2-soft); color: var(--accent-2); border-radius: var(--radius-sm); }
.filter-reset { min-height: 44px; padding: 6px 10px; border: 0; background: transparent; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.ui-action { min-height: 44px; padding: 10px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--accent-strong); font: inherit; font-size: 0.85rem; cursor: pointer; }
.ui-action:hover { background: var(--surface-hover); }
.load-more-error { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; padding: 20px 0; color: var(--text-secondary); font-size: 0.85rem; }
@media (max-width: 900px) and (min-width: 768px) {
    .ranking-columns, .ranking-row { grid-template-columns: 32px minmax(0, 1fr) 86px 54px 95px 76px 14px; gap: 10px; }
}
@media (max-width: 767.98px) {
    :root { --header-h: 64px; }
    .ranking-columns { display: none; }
    .ranking-row, .ranking-row.guild-row { grid-template-columns: 28px minmax(0, 1fr) 106px 16px; gap: 8px; padding: 17px 4px; }
    .ranking-row .rank-server { display: none; }
    input, select { font-size: 16px; }
    .directory-footer { font-size: 0.7rem; }
}
@media (max-width: 359.98px) {
    .ranking-row, .ranking-row.guild-row { grid-template-columns: 24px minmax(0, 1fr) 98px 12px; gap: 6px; }
}

/* ==========================================================================
   启动扉页 · 封面：墨色报头 + 竖排书名 + 朱砂「榜」块 + 展卷状态栏
   静态 HTML（非 Blazor 渲染），App.razor 检测到 .app-shell 后收起。
   报头 / 栏宽 / 字号与 F「墨朱」外壳一致，收起时与真实页面自然接力。
   ========================================================================== */

#app-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--wx-bg);
    color: var(--wx-text);
}

/* ---------- 报头 ---------- */

.splash-masthead {
    flex: 0 0 auto;
    padding-top: max(env(safe-area-inset-top, 0px), var(--ios-safe-area-top-fallback, 0px));
    border-bottom: 2px solid var(--wx-red);
    background: var(--wx-masthead);
    color: var(--wx-mast-ink);
    animation: splash-drop 0.34s var(--ease-out) both;
}

.splash-masthead-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    width: min(100%, 1240px);
    height: 64px;
    margin: 0 auto;
    padding: 0 32px;
}

.splash-brand {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 10px;
}

.splash-seal {
    display: grid;
    place-items: center;
    width: 30px;
    height: 34px;
    background: var(--wx-red);
    box-shadow: 0 0 0 1px var(--wx-masthead), 0 0 0 2px var(--wx-red);
    color: var(--wx-masthead);
    font-family: var(--wx-font-brush);
    font-size: 20px;
    line-height: 1;
    transform: rotate(-3deg);
    animation: splash-stamp 0.34s 0.12s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.splash-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.45;
}

.splash-brand-text b {
    color: var(--wx-mast-ink);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.splash-brand-text span {
    color: var(--wx-mast-dim);
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.13em;
}

.splash-masthead-meta {
    margin-left: auto;
    color: var(--wx-mast-dim);
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

/* ---------- 封面主体 ---------- */

.splash-stage {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

/* 12 栏竖线：与 1240px 内容同宽，浅到只作纸面纹理 */
.splash-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(to right, var(--wx-rule) 1px, transparent 1px);
    background-position: center top;
    background-size: calc(min(1240px, 100vw - 64px) / 12) 100%;
    opacity: 0.7;
}

.splash-sheet {
    position: relative;
    display: grid;
    grid-template-columns: minmax(200px, 220px) minmax(320px, 1fr) clamp(220px, 21vw, 300px);
    align-items: center;
    gap: 40px;
    width: min(100% - 64px, 1240px);
    margin: 0 auto;
    padding: 32px 0;
}

/* 竖排书名 */
.splash-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.splash-title {
    display: flex;
    flex-direction: row-reverse;
    gap: 14px;
    margin: 0;
    font-family: var(--wx-font-brush);
    font-size: clamp(120px, 13vw, 180px);
    font-weight: 400;
    line-height: 1.02;
    letter-spacing: 0.02em;
}

.splash-title span {
    display: block;
    writing-mode: vertical-rl;
    text-orientation: upright;
    animation: splash-ink 0.58s var(--ease-out) both;
}

.splash-title span:nth-child(1) {
    animation-delay: 0.04s;
}

.splash-title-en {
    margin-top: 6px;
    writing-mode: vertical-rl;
    text-transform: uppercase;
    color: var(--wx-faint);
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    animation: splash-fade 0.4s 0.16s var(--ease-out) both;
}

/* 说明文案 */
.splash-copy {
    min-width: 0;
    max-width: none;
    padding-top: 8px;
}

.splash-kicker,
.splash-sub,
.splash-motto,
.splash-lead,
.splash-index {
    animation: splash-rise 0.4s var(--ease-out) both;
}

.splash-kicker {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--wx-dim);
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    animation-delay: 0.14s;
}

.splash-kicker::before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--wx-red);
}

.splash-sub {
    margin: 14px 0 0;
    color: var(--wx-dim);
    font-family: var(--wx-font-mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    animation-delay: 0.18s;
}

.splash-motto {
    margin: 16px 0 0;
    padding-left: 10px;
    border-left: 2px solid var(--wx-red);
    color: var(--wx-text);
    font-size: 14px;
    line-height: 1.7;
    letter-spacing: 0.04em;
    animation-delay: 0.2s;
}

.splash-lead {
    max-width: 430px;
    margin: 8px 0 0;
    color: var(--wx-dim);
    font-size: 12px;
    line-height: 1.9;
    letter-spacing: 0.02em;
    animation-delay: 0.24s;
}

.splash-nowrap {
    white-space: nowrap;
}

.splash-index {
    display: flex;
    flex-wrap: wrap;
    margin: 22px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--wx-rule);
    color: var(--wx-faint);
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    animation-delay: 0.26s;
}

.splash-index span + span::before {
    content: "/";
    margin: 0 8px;
    color: var(--wx-red);
}

/* 朱砂「榜」块 */
.splash-block {
    position: relative;
    display: grid;
    place-items: center;
    justify-self: end;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1 / 1;
    background: var(--wx-red);
    box-shadow: 12px 12px 0 var(--wx-text);
    color: var(--wx-bg);
    animation: splash-block 0.44s 0.08s var(--ease-out) both;
}

.splash-block-char {
    font-family: var(--wx-font-brush);
    font-size: clamp(96px, 10vw, 168px);
    line-height: 1;
    transform: translateY(-5px);
}

.splash-block-meta {
    position: absolute;
    top: 10px;
    left: 12px;
    opacity: 0.92;
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.15em;
}

.splash-block-en {
    position: absolute;
    right: 10px;
    bottom: 8px;
    writing-mode: vertical-rl;
    opacity: 0.85;
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.13em;
}

/* ---------- 展卷状态栏 ---------- */

.splash-rail {
    flex: 0 0 auto;
    border-top: 1px solid var(--wx-rule);
    background: var(--wx-bg);
    animation: splash-rise-in 0.4s 0.16s var(--ease-out) both;
}

.splash-rail-inner {
    display: grid;
    grid-template-columns: minmax(260px, auto) minmax(120px, 1fr) auto;
    align-items: center;
    gap: 28px;
    width: min(100%, 1240px);
    min-height: 76px;
    margin: 0 auto;
    padding: 12px 32px calc(12px + env(safe-area-inset-bottom));
}

.splash-status {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.splash-pulse {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    background: var(--wx-red);
    animation: splash-pulse 1.5s ease-in-out infinite;
}

.splash-status-text {
    min-width: 0;
}

.splash-hint {
    margin: 0;
    color: var(--wx-dim);
    font-size: 12px;
    line-height: 1.5;
}

.splash-hint-en {
    display: block;
    margin-top: 2px;
    color: var(--wx-faint);
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.splash-track {
    position: relative;
    height: 2px;
    overflow: hidden;
    background: var(--wx-rule);
}

.splash-track span {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 42%;
    background: var(--wx-red);
    animation: splash-track 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.splash-rail-meta {
    color: var(--wx-faint);
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.splash-retry {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--wx-rule-2);
    border-radius: 0;
    background: transparent;
    color: var(--wx-red-deep);
    font-family: var(--wx-font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    animation: splash-fade 0.24s var(--ease-out) both;
}

.splash-retry:hover {
    border-color: var(--wx-red-deep);
    background: var(--wx-red-deep);
    color: var(--wx-bg);
}

.splash-retry[hidden] {
    display: none;
}

/* 慢网 / 停滞：只改状态，不放大界面变化 */
#app-splash[data-state="slow"] .splash-pulse {
    animation-duration: 2.4s;
}

#app-splash[data-state="stalled"] .splash-pulse {
    opacity: 0.4;
    animation: none;
}

#app-splash[data-state="stalled"] .splash-track span {
    width: 18%;
    opacity: 0.5;
    transform: none;
    animation: none;
}

/* ---------- 动效 ---------- */

@keyframes splash-drop {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes splash-ink {
    from { opacity: 0; clip-path: inset(0 0 100% 0); }
    to { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes splash-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes splash-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes splash-rise-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes splash-stamp {
    from { opacity: 0; transform: rotate(-3deg) scale(1.35); }
    to { opacity: 1; transform: rotate(-3deg) scale(1); }
}

@keyframes splash-block {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes splash-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes splash-track {
    from { transform: translateX(0); }
    to { transform: translateX(140%); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1099px) {
    .splash-sheet {
        grid-template-columns: minmax(120px, 170px) minmax(260px, 1fr) clamp(130px, 18vw, 200px);
        gap: 24px;
    }

    .splash-sub {
        letter-spacing: 0.13em;
    }

    .splash-block {
        max-width: 200px;
        box-shadow: 8px 8px 0 var(--wx-text);
    }

    .splash-block-char {
        font-size: clamp(80px, 12vw, 112px);
    }

    .splash-block-meta {
        top: 8px;
        left: 9px;
    }

    .splash-block-en {
        display: none;
    }

    .splash-title {
        font-size: clamp(96px, 10vw, 120px);
    }
}

@media (max-width: 767.98px) {
    .splash-masthead-inner {
        height: 56px;
        gap: 10px;
        padding: 0 16px;
    }

    .splash-seal {
        width: 28px;
        height: 32px;
        font-size: 18px;
    }

    .splash-brand-text b {
        font-size: 13px;
        letter-spacing: 0.08em;
    }

    .splash-brand-text span,
    .splash-masthead-meta,
    .splash-grid {
        display: none;
    }

    .splash-sheet {
        grid-template-columns: auto 96px minmax(0, 1fr);
        grid-template-areas:
            "title block ."
            "copy copy copy";
        align-items: start;
        gap: 36px 16px;
        width: 100%;
        padding: 24px 16px;
    }

    .splash-title-wrap {
        grid-area: title;
        gap: 10px;
    }

    .splash-title {
        font-size: 76px;
        gap: 10px;
    }

    .splash-title-en {
        display: none;
    }

    .splash-copy {
        grid-area: copy;
        max-width: none;
        padding-top: 0;
    }

    .splash-kicker {
        font-size: 11px;
        letter-spacing: 0.12em;
    }

    .splash-sub {
        display: none;
    }

    .splash-motto {
        margin-top: 10px;
        padding-left: 9px;
        font-size: 13px;
        line-height: 1.7;
    }

    .splash-lead {
        margin-top: 6px;
        font-size: 11px;
        line-height: 1.8;
    }

    .splash-index {
        display: none;
    }

    .splash-block {
        display: grid;
        grid-area: block;
        justify-self: end;
        width: 96px;
        max-width: none;
        margin-top: 8px;
        box-shadow: 6px 6px 0 var(--wx-text);
    }

    .splash-block-char {
        font-size: 56px;
    }

    .splash-block-meta {
        top: 6px;
        left: 7px;
        font-size: 11px;
        letter-spacing: 0.1em;
    }

    .splash-block-en {
        display: none;
    }

    .splash-rail-inner {
        grid-template-columns: 1fr;
        gap: 10px;
        min-height: 0;
        padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    }

    .splash-status {
        flex-wrap: wrap;
    }

    .splash-hint {
        font-size: 11px;
    }

    .splash-hint-en {
        display: none;
    }

    .splash-rail-meta {
        display: none;
    }

    .splash-retry {
        width: 100%;
    }
}

@media (max-height: 560px) {
    .splash-sheet {
        padding-block: 12px;
    }

    .splash-title {
        font-size: 60px;
    }

    .splash-block {
        width: 88px;
    }

    .splash-block-char {
        font-size: 48px;
    }

    .splash-lead,
    .splash-index {
        display: none;
    }

    .splash-rail-inner {
        min-height: 0;
        padding-block: 8px calc(8px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    #app-splash *,
    #app-splash *::before,
    #app-splash *::after {
        animation: none !important;
    }

    /* 静态状态仍然可见：保留一段朱砂进度，而不是停在滑出屏幕的首帧 */
    #app-splash .splash-track span {
        width: 42%;
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   页面切换入场动画
   ========================================================================== */

.page-enter {
    animation: page-in var(--dur-page) var(--ease-out);
}

@keyframes page-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tab 切换方向性入场：索引前进从右滑入，回退从左滑入（由 MainLayout 按切换方向加类） */
.page-enter-from-right {
    animation: page-in-right var(--dur-page) var(--ease-out);
}

.page-enter-from-left {
    animation: page-in-left var(--dur-page) var(--ease-out);
}

@keyframes page-in-right {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes page-in-left {
    from {
        opacity: 0;
        transform: translateX(-24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 卡片错峰入场 */
.card-enter {
    animation: card-in 0.3s var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 30ms);
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   减少动态偏好
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   F「墨朱」设计层 · 第二轮生产实现（新增 token 与被选中方向的基础样式）
   说明：旧 token 保持不动，未迁移页面继续使用旧变量；新页面/外壳使用 --wx-*。
   ========================================================================== */
@font-face {
    font-family: "InkBrush";
    src: url("../fonts/mashanzheng-subset.woff2") format("woff2");
    font-display: swap;
    font-weight: 400;
}
@font-face {
    font-family: "PosterCond";
    src: url("../fonts/zcool-qingke-subset.woff2") format("woff2");
    font-display: swap;
    font-weight: 400;
}

:root {
    --wx-font-brush: "InkBrush", "KaiTi", "STKaiti", "Kaiti SC", serif;
    --wx-font-cond: "PosterCond", "Bahnschrift", "DIN Condensed", "Arial Narrow", sans-serif;
    /* 等宽栈只覆盖拉丁/数字；中文必须显式回退到黑体，否则会落到 SimSun（宋体）——
       9px 的宋体笔画极细，远处看就是一团灰线。 */
    --wx-font-mono: "SF Mono", "Cascadia Mono", "Consolas", "Menlo", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", monospace;
    --wx-bg: #0b0f0c;
    --wx-surface: #101610;
    --wx-surface-2: #161d18;
    --wx-text: #e9e5d8;
    --wx-dim: #a9a69a;
    /* 4.54:1 → 5.93:1。原值只在纯背景上勉强及格，压在 surface-2 卡片上只有 4.04:1。 */
    --wx-faint: #918f82;
    --wx-rule: rgba(233, 229, 216, 0.16);
    --wx-rule-2: rgba(233, 229, 216, 0.5);
    /* 兼作正文色与填充色：4.32:1 的文字对比不够，5.31:1 才同时守住两种用法。 */
    --wx-red: #e85440;
    --wx-red-deep: #efb3a4;
    --wx-jade: #9fc7ad;
    --wx-masthead: #060907;
    --wx-mast-ink: #e9e5d8;
    --wx-mast-dim: #8f8d81;
    --wx-space-1: 4px;
    --wx-space-2: 8px;
    --wx-space-3: 12px;
    --wx-space-4: 16px;
    --wx-space-5: 20px;
    --wx-space-6: 24px;
    --wx-space-8: 32px;
    --wx-space-10: 40px;
}

[data-theme="light"] {
    --wx-bg: #f3efe4;
    --wx-surface: #fffdf7;
    --wx-surface-2: #e9e3d5;
    --wx-text: #101309;
    --wx-dim: #55584e;
    /* 3.70:1 → 5.50:1（压在 surface-2 上仍有 4.94:1）。 */
    --wx-faint: #5f6154;
    --wx-rule: rgba(16, 19, 9, 0.18);
    --wx-rule-2: #101309;
    /* 4.26:1 → 5.25:1，同时保证「纸色文字压在朱砂块上」也有 5.25:1。 */
    --wx-red: #b8301f;
    --wx-red-deep: #a52b1e;
    --wx-jade: #3f6b52;
    --wx-masthead: #101309;
    --wx-mast-ink: #f3efe4;
    --wx-mast-dim: #a9a99b;
}


.wx-brush { font-family: var(--wx-font-brush); font-weight: 400; }
.wx-cond { font-family: var(--wx-font-cond); font-weight: 400; }
.wx-mono { font-family: var(--wx-font-mono); }

/* 外壳：墨色报头 + 新的内容画布（未迁移页面沿用旧组件变量，保持可读） */
.app-main {
    background: var(--wx-bg);
    color: var(--wx-text);
}

/* ==========================================================================
   F「墨朱」旧 token 映射：让未逐页改版的内容自动沿用同一纸面 / 夜墨体系。
   旧类名不动，只换配色、圆角与内容宽度；需要保留旧观感的页面可局部覆盖。
   ========================================================================== */
:root {
    --bg-base: #0b0f0c;
    --bg-grad-1: #0b0f0c;
    --bg-grad-2: #0b0f0c;
    --surface: #101610;
    --surface-solid: #060907;
    --surface-hover: #161d18;
    --surface-inset: #0d120f;
    --border: rgba(233, 229, 216, 0.16);
    --border-strong: rgba(233, 229, 216, 0.5);
    --text: #e9e5d8;
    --text-secondary: #a9a69a;
    --text-faint: #918f82;
    --accent: #e0735f;
    --accent-strong: #efb3a4;
    --accent-soft: #2a1310;
    --accent-2: #9fc7ad;
    --accent-2-soft: #16241c;
    --up: #e0735f;
    --down: #9fc7ad;
    --flat: #a9a69a;
    --rank-1: #e0735f;
    --rank-2: #e9e5d8;
    --rank-3: #a9a69a;
    --leader-surface: rgba(216, 64, 47, 0.08);
    --radius: 0;
    --radius-sm: 0;
    --radius-lg: 0;
    --content-max: 1240px;
}

[data-theme="light"] {
    --bg-base: #f3efe4;
    --bg-grad-1: #f3efe4;
    --bg-grad-2: #f3efe4;
    --surface: #fffdf7;
    --surface-solid: #f3efe4;
    --surface-hover: #e9e3d5;
    --surface-inset: #eee8da;
    --border: rgba(16, 19, 9, 0.18);
    --border-strong: #101309;
    --text: #101309;
    --text-secondary: #55584e;
    --text-faint: #5f6154;
    --accent: #b23123;
    --accent-strong: #a52b1e;
    --accent-soft: #efe0d6;
    --accent-2: #3f6b52;
    --accent-2-soft: #e3e9df;
    --up: #b23123;
    --down: #3f6b52;
    --flat: #55584e;
    --rank-1: #b23123;
    --rank-2: #55584e;
    --rank-3: #5f6154;
    --leader-surface: rgba(184, 48, 31, 0.06);
    --radius: 0;
    --radius-sm: 0;
    --radius-lg: 0;
    --content-max: 1240px;
}