/* ============================================================
   全局设计系统 · 卡牌对战项目
   CSS 变量只加不改名；改配色只动 :root。
   ============================================================ */

:root {
    /* 水墨卡局基色 */
    --paper: #e8dfc9;
    --ink: #101713;
    --ink-soft: #19221d;
    --cinnabar: #a13f35;
    --gilt: #c6a15b;
    --jade: #4f9689;
    --mystic-purple: #66506f;
    --ochre: #8a6740;

    /* 阵营色 */
    --north-color: var(--jade);
    --monster-color: var(--mystic-purple);
    --neutral-color: var(--ochre);

    /* 行色 */
    --melee-color: var(--cinnabar);
    --ranged-color: var(--jade);
    --siege-color: var(--gilt);

    /* 主题 */
    --bg: var(--ink);
    --bg-soft: #141d18;
    --surface: var(--ink-soft);
    --surface-2: #202b24;
    --line: rgba(198, 161, 91, 0.28);
    --gold: var(--gilt);
    --gold-bright: #ead39d;
    --gold-dim: #8f7443;
    --text: #f0eadc;
    --text-dim: #aaa99e;
    --danger: var(--cinnabar);
    --ok: var(--jade);

    /* 卡牌与行高 */
    --card-w: 90px;
    --card-h: 126px;
    --row-h: 120px;
    --number-font: "Consolas", "SFMono-Regular", "Roboto Mono", monospace;

    --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    --font-body: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

button { font: inherit; color: inherit; }

/* ============ 背景 ============ */

.backdrop {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 55% at 50% 18%, #241b10 0%, transparent 62%),
        radial-gradient(ellipse 60% 45% at 50% 100%, #170f0a 0%, transparent 70%),
        linear-gradient(180deg, #100c08 0%, #0b0907 60%, #080605 100%);
}

.backdrop__glow {
    position: absolute;
    left: 50%;
    top: 34%;
    width: 720px;
    height: 720px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(201, 162, 39, 0.16) 0%, rgba(201, 162, 39, 0.05) 38%, transparent 68%);
    filter: blur(8px);
}

.backdrop__grain {
    position: absolute;
    inset: 0;
    opacity: 0.28;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    pointer-events: none;
}

.backdrop__vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 85% 75% at 50% 50%, transparent 45%, rgba(0, 0, 0, 0.72) 100%);
    pointer-events: none;
}

.ghost-card {
    position: absolute;
    width: 260px;
    height: 364px;
    border-radius: 14px;
    border: 1px solid rgba(201, 162, 39, 0.22);
    background: linear-gradient(160deg, rgba(58, 107, 139, 0.20), rgba(12, 10, 8, 0.05));
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.55);
    display: grid;
    place-items: center;
    opacity: 0.55;
    filter: blur(1px);
    animation: drift 14s var(--ease) infinite alternate;
}

.ghost-card::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(201, 162, 39, 0.14);
    border-radius: 8px;
}

.ghost-card__mark {
    font-family: var(--font-display);
    font-size: 84px;
    color: rgba(201, 162, 39, 0.16);
}

.ghost-card--left {
    left: -80px;
    top: 50%;
    transform: translateY(-50%) rotate(-14deg);
}

.ghost-card--right {
    right: -80px;
    top: 50%;
    transform: translateY(-50%) rotate(14deg);
    background: linear-gradient(160deg, rgba(107, 58, 58, 0.20), rgba(12, 10, 8, 0.05));
    animation-delay: -7s;
}

@keyframes drift {
    from { translate: 0 -10px; }
    to   { translate: 0 10px; }
}

/* ============ 顶部信息 ============ */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    padding: 20px 32px;
    font-size: 12px;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    pointer-events: none;
}

.topbar__brand { color: var(--gold-dim); }

/* ============ 首页主体 ============ */

.page-home { display: grid; }

.home {
    position: relative;
    z-index: 10;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 80px 24px 96px;
    text-align: center;
}

.home__eyebrow {
    font-size: 13px;
    letter-spacing: 0.55em;
    text-indent: 0.55em;
    color: var(--gold-dim);
    margin-bottom: 22px;
    animation: rise 0.7s var(--ease) both;
}

.home__title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: rise 0.8s var(--ease) 0.06s both;
}

.home__title-cn {
    font-family: var(--font-display);
    font-size: clamp(56px, 8.6vw, 108px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.16em;
    text-indent: 0.16em;
    background: linear-gradient(175deg, #f7e7b6 6%, var(--gold-bright) 34%, var(--gold) 62%, #8a6d1a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 3px 18px rgba(201, 162, 39, 0.28));
}

.home__title-en {
    font-size: 11px;
    letter-spacing: 0.62em;
    text-indent: 0.62em;
    color: rgba(201, 162, 39, 0.5);
}

.home__subtitle {
    margin-top: 24px;
    font-size: 15px;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    animation: rise 0.8s var(--ease) 0.14s both;
}

.home__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 34px 0 38px;
    animation: rise 0.8s var(--ease) 0.2s both;
}

.home__divider span {
    width: 92px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.55));
}

.home__divider span:last-child {
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.55), transparent);
}

.home__divider i {
    width: 6px;
    height: 6px;
    transform: rotate(45deg);
    background: var(--gold);
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.7);
}

.home__actions {
    display: flex;
    align-items: center;
    gap: 18px;
    animation: rise 0.8s var(--ease) 0.26s both;
}

.home__hint {
    margin-top: 30px;
    font-size: 12px;
    letter-spacing: 0.1em;
    color: rgba(156, 143, 123, 0.66);
    animation: rise 0.8s var(--ease) 0.32s both;
}

.footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 22px;
    font-size: 11px;
    letter-spacing: 0.14em;
    color: rgba(156, 143, 123, 0.55);
}

.footer__dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--gold-dim);
    opacity: 0.7;
}

@keyframes rise {
    from { transform: translateY(14px); }
    to   { transform: translateY(0); }
}

/* ============ 按钮 ============ */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 168px;
    height: 52px;
    padding: 0 30px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    cursor: pointer;
    transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
                background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.btn:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 4px;
}

.btn--primary {
    color: #241a05;
    background: linear-gradient(180deg, #e8cc84 0%, var(--gold) 52%, #a8841c 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset,
                0 -1px 0 rgba(0, 0, 0, 0.3) inset,
                0 6px 22px rgba(201, 162, 39, 0.22);
}

.btn--primary::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.38) 48%, transparent 62%);
    transform: translateX(-120%);
    transition: transform 0.6s var(--ease);
    pointer-events: none;
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset,
                0 10px 30px rgba(201, 162, 39, 0.32);
}

.btn--primary:hover::after { transform: translateX(120%); }
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(201, 162, 39, 0.45);
    color: var(--gold-bright);
}

.btn--ghost:hover {
    background: rgba(201, 162, 39, 0.1);
    border-color: var(--gold);
    transform: translateY(-2px);
}

.btn--sm {
    min-width: 132px;
    height: 44px;
    font-size: 14px;
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============ 规则提示条 ============ */

.rule-tip {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 11px 20px;
    background: linear-gradient(180deg, rgba(36, 30, 23, 0.98), rgba(27, 23, 18, 0.96));
    border-bottom: 1px solid rgba(201, 162, 39, 0.3);
    font-size: 13px;
    color: var(--text-dim);
    transform: translateY(-100%);
    transition: transform 0.45s var(--ease);
}

.rule-tip.is-visible { transform: translateY(0); }

.rule-tip__close {
    padding: 2px 6px;
    border: 0;
    background: none;
    color: var(--gold);
    font-size: 12px;
    letter-spacing: 0.06em;
    cursor: pointer;
    border-bottom: 1px solid rgba(201, 162, 39, 0.45);
}

.rule-tip__close:hover { color: var(--gold-bright); }

/* ============ 规则弹窗 ============ */

.modal {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(560px, calc(100vw - 40px));
    padding: 0;
    border: 1px solid rgba(201, 162, 39, 0.32);
    border-radius: 6px;
    background: linear-gradient(180deg, #1e1913 0%, #15110d 100%);
    color: var(--text);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
}

.modal::backdrop {
    background: rgba(5, 4, 3, 0.72);
    backdrop-filter: blur(3px);
}

.modal[open] { animation: modal-in 0.24s var(--ease) both; }

@keyframes modal-in {
    from { transform: translateY(12px) scale(0.985); }
    to   { transform: translateY(0) scale(1); }
}

.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px 16px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.16);
}

.modal__title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--gold-bright);
}

.modal__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--text-dim);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.modal__close:hover { background: rgba(201, 162, 39, 0.1); color: var(--gold-bright); }

.modal__body {
    max-height: min(56vh, 420px);
    overflow-y: auto;
    padding: 8px 26px;
}

.modal__foot {
    display: flex;
    justify-content: flex-end;
    padding: 18px 26px 24px;
}

.rules__item {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(201, 162, 39, 0.08);
}

.rules__item:last-child { border-bottom: 0; }

.rules dt {
    font-size: 13px;
    letter-spacing: 0.14em;
    color: var(--gold);
}

.rules dd {
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--text-dim);
}

/* ============ 轻提示 ============ */

.toast {
    position: fixed;
    left: 50%;
    bottom: 72px;
    z-index: 60;
    padding: 12px 20px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 4px;
    background: rgba(27, 23, 18, 0.96);
    font-size: 13px;
    color: var(--text);
    opacity: 0;
    transform: translate(-50%, 10px);
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ============ 自适应与动效偏好 ============ */

@media (max-width: 760px) {
    .home__actions { flex-direction: column; width: 100%; max-width: 320px; }
    .btn { width: 100%; }
    .footer { flex-wrap: wrap; }
    .ghost-card { display: none; }
}

@media (max-height: 640px) {
    .home { padding-top: 56px; padding-bottom: 64px; }
    .home__divider { margin: 22px 0 26px; }
    .home__hint { margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   选人页
   ============================================================ */

body.page-setup { overflow-y: auto; }

.backdrop__glow--setup {
    top: 42%;
    width: 940px;
    height: 620px;
    opacity: 0.8;
}

.topbar__back {
    color: var(--text-dim);
    text-decoration: none;
    letter-spacing: 0.1em;
    pointer-events: auto;
    transition: color 0.18s var(--ease);
}

.topbar__back:hover { color: var(--gold-bright); }

.steps {
    display: flex;
    gap: 26px;
    list-style: none;
    font-size: 12px;
    letter-spacing: 0.1em;
    color: rgba(156, 143, 123, 0.42);
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step span {
    font-variant-numeric: tabular-nums;
    color: rgba(201, 162, 39, 0.35);
}

.step.is-current { color: var(--text); }
.step.is-current span { color: var(--gold); }

.setup {
    position: relative;
    z-index: 10;
    max-width: 1100px;
    margin: 0 auto;
    padding: 92px 28px 48px;
}

.setup__head { text-align: center; }

.setup__eyebrow {
    font-size: 12px;
    letter-spacing: 0.5em;
    text-indent: 0.5em;
    color: var(--gold-dim);
    margin-bottom: 16px;
}

.setup__title {
    font-family: var(--font-display);
    font-size: clamp(30px, 3.6vw, 40px);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-indent: 0.14em;
    color: var(--text);
}

.setup__lead {
    margin-top: 14px;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.factions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 26px;
    margin-top: 28px;
    align-items: start;
}

.faction {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(30, 25, 19, 0.92), rgba(18, 15, 12, 0.92));
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
                opacity 0.25s var(--ease), filter 0.25s var(--ease), transform 0.25s var(--ease);
}

.faction::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--faction-color), transparent);
    opacity: 0.75;
}

.faction--north { --faction-color: var(--north-color); }
.faction--monster { --faction-color: var(--monster-color); }

.faction:hover { transform: translateY(-4px); }

.faction.is-active {
    border-color: rgba(201, 162, 39, 0.55);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(201, 162, 39, 0.12) inset;
    transform: none;
}

.factions.has-active .faction:not(.is-active) {
    opacity: 0.42;
    filter: saturate(0.45);
    transform: none;
}

.faction__face {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 24px 18px;
    border: 0;
    background: transparent;
    text-align: center;
    cursor: pointer;
    transition: background 0.25s var(--ease);
}

.faction__face:hover { background: rgba(255, 255, 255, 0.02); }

.faction__face:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: -4px;
}

.faction__crest {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(201, 162, 39, 0.32);
    background: radial-gradient(circle at 50% 35%, var(--faction-color), rgba(10, 8, 6, 0.9) 78%);
    font-family: var(--font-display);
    font-size: 24px;
    color: rgba(255, 248, 230, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.faction__name {
    font-family: var(--font-display);
    font-size: 26px;
    letter-spacing: 0.14em;
    text-indent: 0.14em;
    color: var(--text);
}

.faction__passive {
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-dim);
}

.faction__cta {
    margin-top: 6px;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.4);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-indent: 0.2em;
    color: var(--gold);
}

.faction__leaders {
    visibility: hidden;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    border-top: 1px solid transparent;
    transition: max-height 0.45s var(--ease), opacity 0.3s var(--ease),
                border-color 0.3s var(--ease), visibility 0s linear 0.45s;
}

.faction.is-active .faction__leaders {
    visibility: visible;
    max-height: 380px;
    opacity: 1;
    border-top-color: rgba(201, 162, 39, 0.16);
    transition: max-height 0.45s var(--ease), opacity 0.3s var(--ease),
                border-color 0.3s var(--ease), visibility 0s;
}

.faction__leaders-title {
    padding: 16px 20px 0;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--gold-dim);
}

.leaders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding: 10px 16px 16px;
}

.leader {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    padding: 9px 12px 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.02);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease),
                transform 0.18s var(--ease);
}

.leader__portrait {
    width: 38px;
    height: 50px;
    flex: none;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(201, 162, 39, 0.25);
    border-radius: 3px;
}

.leader__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.leader:hover {
    border-color: rgba(201, 162, 39, 0.5);
    background: rgba(201, 162, 39, 0.06);
    transform: translateY(-1px);
}

.leader:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}

.leader.is-selected {
    border-color: var(--gold);
    background: rgba(201, 162, 39, 0.1);
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.18);
}

.leader.is-selected::after {
    content: "";
    position: absolute;
    top: 13px;
    right: 13px;
    width: 9px;
    height: 5px;
    border-left: 1.5px solid var(--gold-bright);
    border-bottom: 1.5px solid var(--gold-bright);
    transform: rotate(-45deg);
}

.leader__name {
    font-size: 14px;
    letter-spacing: 0.06em;
    color: var(--text);
}

.leader__skill {
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--text-dim);
}

.setup__bar {
    position: sticky;
    bottom: 18px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 30px;
    padding: 16px 22px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(24, 20, 16, 0.78);
    backdrop-filter: blur(6px);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.45);
}

.setup__summary {
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.setup__summary.is-ready { color: var(--gold-bright); }

@media (max-width: 900px) {
    .factions { grid-template-columns: 1fr; }
    .steps { display: none; }
    .setup { padding-top: 92px; }
    .setup__bar { flex-direction: column; align-items: stretch; }
    .setup__bar .btn { width: 100%; }
}


/* ============================================================
   构筑页
   ============================================================ */

[hidden] { display: none !important; }

body.page-builder {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.page-builder .topbar {
    position: static;
    flex: none;
}

.builder {
    position: relative;
    z-index: 10;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 14px 28px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.builder__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex: none;
}

.builder__eyebrow {
    font-size: 11px;
    letter-spacing: 0.34em;
    color: var(--gold-dim);
}

.builder__title {
    margin-top: 4px;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--text);
}

.builder__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-dim);
}

.builder__meta b { color: var(--text); font-weight: 500; }

.builder__dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--gold-dim);
}

.counts {
    display: flex;
    align-items: center;
    gap: 20px;
}

.count {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 44px;
}

.count__label {
    font-size: 10.5px;
    letter-spacing: 0.16em;
    color: var(--text-dim);
}

.count__value {
    font-size: 23px;
    line-height: 1;
    color: var(--gold-bright);
    font-variant-numeric: tabular-nums;
}

.count.is-warn .count__value { color: #e06a5a; }

.status {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11.5px;
    letter-spacing: 0.1em;
    white-space: nowrap;
    color: var(--text-dim);
}

.status.is-ok {
    color: #8fce6a;
    border-color: rgba(143, 206, 106, 0.35);
    background: rgba(143, 206, 106, 0.08);
}

.status.is-bad {
    color: #e06a5a;
    border-color: rgba(224, 106, 90, 0.35);
    background: rgba(224, 106, 90, 0.08);
}

.builder__hint {
    flex: none;
    font-size: 11.5px;
    letter-spacing: 0.05em;
    color: rgba(156, 143, 123, 0.7);
}

.builder__cols {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.42fr) minmax(380px, 0.9fr);
    gap: 16px;
}

.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(23, 19, 15, 0.84);
}

.panel__head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 15px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.12);
}

.panel__title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--text);
}

.panel__actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.link-btn {
    padding: 2px 0;
    border: 0;
    border-bottom: 1px solid rgba(201, 162, 39, 0.35);
    background: none;
    font-size: 11.5px;
    letter-spacing: 0.08em;
    color: var(--gold);
    cursor: pointer;
}

.link-btn:hover { color: var(--gold-bright); border-color: var(--gold-bright); }

.tabs { display: flex; gap: 4px; }

.tab {
    padding: 5px 11px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    font-size: 12px;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.15s var(--ease), background 0.15s var(--ease),
                border-color 0.15s var(--ease);
}

.tab:hover { color: var(--text); }

.tab.is-active {
    color: var(--gold-bright);
    border-color: rgba(201, 162, 39, 0.4);
    background: rgba(201, 162, 39, 0.08);
}

.search {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.22);
}

.search__icon { font-size: 14px; color: var(--text-dim); }

.search__input {
    width: 140px;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 12px;
    outline: none;
}

.search__input::placeholder { color: rgba(156, 143, 123, 0.55); }

.pool__grid,
.deck__grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    align-content: start;
    align-items: start;
    grid-auto-rows: max-content;
    padding: 14px;
}

.pool__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
}

.deck__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 8px;
}

.panel__empty {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    font-size: 12px;
    color: var(--text-dim);
}

/* ---------- 卡牌 ---------- */

.ccard {
    position: relative;
    aspect-ratio: 3 / 4;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px 7px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #fff;
    background-size: cover;
    background-position: center;
    text-align: left;
    cursor: pointer;
    transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease),
                border-color 0.16s var(--ease), opacity 0.16s var(--ease);
}

.ccard::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.18), transparent 58%);
    pointer-events: none;
}

.ccard--north { background-color: #1b3346; }
.ccard--monster { background-color: #3a1d1d; }
.ccard--neutral { background-color: #2e2517; }

.ccard--hero { border-color: rgba(240, 213, 138, 0.4); }

.ccard:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: rgba(201, 162, 39, 0.65);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    z-index: 3;
}

.ccard:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}

.ccard.is-full { opacity: 0.5; }
.ccard.is-full:hover { opacity: 0.72; }

.ccard__badge {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    font-size: 9.5px;
    color: #f0e6d2;
    font-variant-numeric: tabular-nums;
}

.ccard__badge.is-full { background: rgba(192, 57, 43, 0.88); }

.ccard__hero {
    position: absolute;
    bottom: 5px;
    left: 5px;
    padding: 1px 4px;
    border: 1px solid rgba(240, 213, 138, 0.6);
    border-radius: 2px;
    font-size: 9px;
    color: var(--gold-bright);
}

.ccard__power {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(8, 6, 4, 0.62);
    font-size: 23px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.ccard__name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3px 4px 4px;
    font-size: 10.5px;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(180deg, transparent, rgba(6, 5, 4, 0.88));
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.ccard__meta {
    display: none;
}

.deck .ccard { padding: 7px 6px; }
.deck .ccard__power { font-size: 19px; }
.deck .ccard__name { font-size: 10.5px; }
.deck .ccard__meta { font-size: 8.5px; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.ccard.shake {
    animation: shake 0.4s;
    border-color: #c0392b;
}

/* ---------- 卡组底部 ---------- */

.deck__alert {
    flex: none;
    margin: 12px 14px 0;
    padding: 10px 12px;
    border: 1px solid rgba(192, 57, 43, 0.45);
    border-radius: 4px;
    background: rgba(192, 57, 43, 0.1);
    font-size: 12px;
    line-height: 1.6;
    color: #f0b3aa;
}

.deck__alert ul { margin: 5px 0 0 16px; }

.deck__foot {
    flex: none;
    padding: 13px 14px 15px;
    border-top: 1px solid rgba(201, 162, 39, 0.12);
}

.deck__foot .btn { width: 100%; }

.deck__note {
    margin-top: 8px;
    font-size: 11.5px;
    text-align: center;
    color: var(--text-dim);
}

.deck__note.is-warn { color: #e06a5a; }

/* ---------- 卡牌预览 ---------- */

.card-preview {
    position: fixed;
    z-index: 80;
    width: 250px;
    padding: 14px 16px;
    border: 1px solid rgba(201, 162, 39, 0.35);
    border-radius: 6px;
    background: rgba(24, 20, 16, 0.98);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.card-preview__head {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.card-preview__power {
    font-size: 26px;
    line-height: 1;
    color: var(--gold-bright);
}

.card-preview__name {
    font-family: var(--font-display);
    font-size: 16px;
    letter-spacing: 0.06em;
    color: var(--text);
}

.card-preview__meta {
    margin-top: 7px;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--gold-dim);
}

.card-preview__text {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-dim);
}

.card-preview__text p + p { margin-top: 6px; }

.card-preview__desc { color: var(--text-dim); }

.card-preview__ability { color: var(--text); }

.card-preview__ability b {
    color: var(--gold-bright);
    font-weight: 600;
}

/* ---------- 构筑页弹窗 ---------- */

.modal--sm { width: min(420px, calc(100vw - 40px)); }

.confirm__text {
    padding: 18px 0;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-dim);
}

.modal--sm .modal__body { padding: 0 26px; }

@media (max-width: 1120px) {
    .builder__cols { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 940px) {
    body.page-builder { overflow-y: auto; }
    .builder { height: auto; padding-top: 20px; }
    .builder__cols { grid-template-columns: 1fr; }
    .pool__grid, .deck__grid { max-height: 420px; }
    .builder__head { flex-direction: column; align-items: flex-start; }
    .counts { width: 100%; justify-content: space-between; }
}

/* ============================================================
   对局页
   ============================================================ */

body.page-game {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

.page-game .game-top {
    position: relative;
    z-index: 20;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 46px;
    padding: 0 20px;
    background: rgba(20, 16, 12, 0.92);
    border-bottom: 1px solid var(--line);
}

.side-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: var(--text-dim);
    padding: 0 8px;
    height: 100%;
    transition: box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.side-info.is-current {
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.08), transparent);
    box-shadow: inset 0 -2px 0 var(--gold);
}

.side-info.is-passed { opacity: 0.55; }

.faction-tag {
    padding: 2px 9px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: var(--neutral-color);
}

.faction-tag.north { background: var(--north-color); }
.faction-tag.monster { background: var(--monster-color); }

.leader-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--gold-dim);
    font-size: 11.5px;
    letter-spacing: 0.04em;
}

.leader-face {
    position: relative;
    z-index: 6;
    width: 90px;
    height: 120px;
    object-fit: contain;
    border: 1px solid rgba(201, 162, 39, 0.28);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
}

.page-game .side-info { overflow: visible; }
body.page-game .board { padding-left: 108px; }

.page-game .board { position: relative; }

.leader-rail {
    position: absolute;
    left: 8px;
    width: 90px;
    height: 120px;
    z-index: 8;
}

.leader-rail--p2 { top: calc(25% - 60px); }
.leader-rail--p1 { bottom: calc(25% - 60px); }

.leader-chip--btn {
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: none;
    cursor: pointer;
}

.leader-chip--btn:hover { border-color: rgba(201, 162, 39, 0.35); color: var(--gold); }
.leader-chip--btn.is-used { opacity: 0.4; cursor: not-allowed; }

.stat { font-size: 11.5px; white-space: nowrap; }
.stat b { color: var(--text); font-weight: 600; font-size: 13px; }

.stat--btn {
    padding: 2px 4px;
    border: 0;
    background: none;
    color: var(--text-dim);
    cursor: pointer;
}

.stat--btn:hover { color: var(--gold-bright); }

.lives { display: flex; gap: 3px; }
.lives .heart { font-size: 15px; color: #c0392b; }
.lives .heart.lost { opacity: 0.18; }

.passed-tag {
    padding: 1px 7px;
    border: 1px solid rgba(224, 106, 90, 0.45);
    border-radius: 999px;
    font-size: 10px;
    color: #e06a5a;
}

.round-chip {
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 0.2em;
    color: var(--gold);
    white-space: nowrap;
}

.thinking-toggle {
    padding: 4px 8px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 4px;
    background: rgba(201, 162, 39, 0.05);
    font-size: 11.5px;
    color: var(--gold);
    cursor: pointer;
}

.thinking-toggle:hover { border-color: var(--gold); color: var(--gold-bright); }
.thinking-toggle__mark { margin-left: 4px; font-size: 10px; }

body.is-busy .thinking-toggle {
    color: var(--gold-bright);
    border-color: var(--gold);
}

body.is-busy .thinking-toggle::after {
    content: "●";
    margin-left: 6px;
    font-size: 8px;
    vertical-align: middle;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 1; }
}

.page-game .weather-bar {
    position: relative;
    z-index: 10;
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 30px;
    padding: 0 22px;
    background: rgba(0, 0, 0, 0.22);
    border-bottom: 1px solid rgba(201, 162, 39, 0.08);
    font-size: 11.5px;
    color: var(--text-dim);
    transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.weather-label { color: var(--gold-dim); letter-spacing: 0.1em; }
.weather-bar.is-active .weather-value { color: #8fc7e8; }

.weather-bar.is-target {
    cursor: pointer;
    background: rgba(120, 200, 120, 0.1);
    box-shadow: inset 0 0 0 1px rgba(120, 200, 120, 0.5);
}

.page-game .board {
    position: relative;
    z-index: 10;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 16px;
}

.half {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lane {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s var(--ease);
}

.lane--melee { box-shadow: inset 3px 0 0 var(--melee-color); }
.lane--ranged { box-shadow: inset 3px 0 0 var(--ranged-color); }
.lane--siege { box-shadow: inset 3px 0 0 var(--siege-color); }

.lane__label {
    width: 22px;
    flex: none;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 2px;
    writing-mode: vertical-lr;
}

.lane__cards {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
}

.lane__total {
    width: 36px;
    flex: none;
    text-align: right;
    font-size: 17px;
    font-weight: 700;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

.lane.is-target {
    cursor: pointer;
    background: rgba(120, 200, 120, 0.1);
    box-shadow: inset 0 0 0 1px rgba(120, 200, 120, 0.55);
}

.lane.is-dim { opacity: 0.38; }

.score-strip {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 26px;
    height: 44px;
}

.score-strip__side {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 11.5px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.score-strip__side b {
    font-size: 26px;
    line-height: 1;
    color: var(--gold-bright);
    font-variant-numeric: tabular-nums;
}

.score-strip__vs {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--gold-dim);
}

.page-game .game-bottom {
    position: relative;
    z-index: 10;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    padding: 0 20px;
    background: rgba(20, 16, 12, 0.92);
    border-top: 1px solid var(--line);
}

.btn--pass {
    min-width: 96px;
    height: 32px;
    padding: 0 18px;
    font-size: 12px;
    letter-spacing: 0.14em;
}

.hand-wrap {
    position: relative;
    z-index: 10;
    flex: none;
    height: 126px;
    padding: 6px 16px 10px;
}

.page-game .hand {
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    padding: 0;
}

.page-game .hand .gcard { height: 108px; }

/* ---------- 对局卡牌 ---------- */

.gcard {
    position: relative;
    aspect-ratio: 3 / 4;
    height: 100%;
    width: auto;
    flex: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 4px;
    color: #fff;
    background-size: cover;
    background-position: center;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease),
                border-color 0.15s var(--ease);
}

.gcard--north { background-color: #1b3346; }
.gcard--monster { background-color: #3a1d1d; }
.gcard--neutral { background-color: #2e2517; }

.gcard--hero { border-color: rgba(240, 213, 138, 0.45); }

.gcard__hero {
    position: absolute;
    top: 3px;
    right: 3px;
    padding: 0 3px;
    border: 1px solid rgba(240, 213, 138, 0.55);
    border-radius: 2px;
    font-size: 6.5px;
    line-height: 1.5;
    color: var(--gold-bright);
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.gcard__power {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 0 4px;
    border-radius: 3px;
    background: rgba(8, 6, 4, 0.62);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.gcard__name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px 3px 3px;
    font-size: 8px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(180deg, transparent, rgba(6, 5, 4, 0.88));
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.gcard--hand {
    cursor: pointer;
    touch-action: none;
    padding: 6px 6px;
}

.gcard--hand.is-dragging { opacity: 0.35; }

.drag-ghost {
    position: fixed;
    z-index: 200;
    width: 80px;
    height: 112px;
    pointer-events: none;
    opacity: 0.94;
    transform: rotate(-3deg);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
}

.gcard--hand .gcard__power { font-size: 20px; }
.gcard--hand .gcard__name { font-size: 9.5px; }

.gcard--hand:hover {
    transform: translateY(-8px);
    border-color: rgba(201, 162, 39, 0.6);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.gcard--hand.is-selected {
    transform: translateY(-12px);
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.35), 0 12px 26px rgba(0, 0, 0, 0.55);
}

.gcard--hand.is-picked {
    transform: translateY(-12px);
    border-color: #e06a5a;
    box-shadow: 0 0 0 2px rgba(224, 106, 90, 0.45), 0 12px 26px rgba(0, 0, 0, 0.55);
}

.gcard--hand.is-picked::after {
    content: "换";
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 0 4px;
    border-radius: 2px;
    background: #c0392b;
    font-size: 7px;
    line-height: 1.6;
    color: #fff;
}

.gcard.is-enter { animation: cardIn 0.26s var(--ease) both; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

body.is-busy .gcard--hand,
body.is-busy .lane,
body.is-busy #weather-bar { cursor: progress; }

/* ---------- 选牌操作条 ---------- */

.playbar {
    position: fixed;
    left: 50%;
    bottom: 128px;
    z-index: 40;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    border: 1px solid rgba(201, 162, 39, 0.4);
    border-radius: 6px;
    background: rgba(24, 20, 16, 0.97);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}

.playbar__label {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

.playbar__actions { display: flex; gap: 8px; }
.playbar__actions .btn { min-width: 0; height: 34px; padding: 0 16px; font-size: 12px; }

/* ---------- 思路面板 ---------- */

.page-game .thinking-panel {
    position: fixed;
    top: 54px;
    right: 14px;
    z-index: 50;
    width: 330px;
    max-height: 60vh;
    display: none;
    flex-direction: column;
    border: 1px solid rgba(201, 162, 39, 0.28);
    border-radius: 6px;
    background: rgba(24, 20, 16, 0.97);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.page-game .thinking-panel.is-open { display: flex; }

.page-game .side-panels {
    position: fixed;
    top: 54px;
    left: 14px;
    z-index: 50;
    width: 300px;
    max-height: calc(100dvh - 110px);
    display: none;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    pointer-events: auto;
}

body.page-game.log-open .side-panels,
body.page-game.panel-open .side-panels { display: flex; }

.page-game .side-panels .thinking-panel {
    position: static;
    width: 100%;
    max-height: none;
}

.page-game .side-panels .thinking-panel__body { max-height: 260px; }

.page-game .log-panel { width: 100%; }

body.page-game.log-open .board,
body.page-game.panel-open .board {
    padding-left: 424px;
    padding-right: 16px;
}

body.page-game.log-open .leader-rail,
body.page-game.panel-open .leader-rail { left: 326px; }

.log-round {
    margin: 8px 0 4px;
    font-size: 10.5px;
    letter-spacing: 0.12em;
    color: var(--gold);
}

.log-entry {
    display: flex;
    gap: 7px;
    padding: 3px 0;
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--text-dim);
    border-bottom: 1px dashed rgba(201, 162, 39, 0.08);
}

.log-entry__side {
    flex: none;
    width: 26px;
    color: var(--gold-dim);
}

.log-entry--p2 .log-entry__side { color: #e06a5a; }

.log-entry__text { min-width: 0; }

.thinking-panel__head {
    flex: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(201, 162, 39, 0.14);
    font-size: 12px;
    letter-spacing: 0.1em;
    color: var(--gold);
    cursor: pointer;
}

.thinking-panel__status {
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.thinking-panel__body {
    display: none;
    padding: 10px 12px 12px;
    max-height: 320px;
    overflow-y: auto;
}

.thinking-panel.is-open .thinking-panel__body { display: block; }

.thinking-line {
    margin-bottom: 7px;
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
}

.thinking-empty {
    font-size: 11.5px;
    line-height: 1.7;
    color: rgba(156, 143, 123, 0.6);
}

/* ---------- 结算遮罩 ---------- */

.game-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    background: rgba(5, 4, 3, 0.78);
    backdrop-filter: blur(3px);
}

.game-overlay__box {
    width: min(420px, calc(100vw - 40px));
    padding: 32px 30px 28px;
    border: 1px solid rgba(201, 162, 39, 0.35);
    border-radius: 8px;
    background: linear-gradient(180deg, #1e1913, #15110d);
    text-align: center;
}

.game-overlay__eyebrow {
    font-size: 11px;
    letter-spacing: 0.3em;
    color: var(--gold-dim);
}

.game-overlay__title {
    margin-top: 10px;
    font-family: var(--font-display);
    font-size: 38px;
    letter-spacing: 0.16em;
    text-indent: 0.16em;
    color: var(--gold-bright);
}

.game-overlay__text {
    margin: 14px 0 22px;
    font-size: 13px;
    color: var(--text-dim);
}

.game-overlay__actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- 特效层 ---------- */

.fx-layer {
    position: fixed;
    inset: 0;
    z-index: 90;
    overflow: hidden;
    pointer-events: none;
}

.fx-drop {
    position: absolute;
    top: -34px;
    width: 2px;
    height: 18px;
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(180, 225, 255, 0), #a8dcff);
    animation: fx-fall 1.3s linear forwards;
}

.fx-snow {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(235, 249, 255, 0.96);
    box-shadow: 0 0 8px rgba(210, 240, 255, 0.8);
    filter: blur(0.2px);
    animation-name: fx-snow-fall;
    animation-timing-function: ease-in;
}

.fx-fog {
    width: 180px;
    height: 120px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 38% 42%, rgba(210, 220, 228, 0.46), transparent 55%),
        radial-gradient(circle at 68% 60%, rgba(165, 181, 195, 0.34), transparent 62%);
    filter: blur(10px);
    animation: fx-fog 3.6s ease-out forwards;
}

@keyframes fx-fall {
    to { transform: translateY(112vh) translateX(var(--dx, 0)); opacity: 0.12; }
}

@keyframes fx-snow-fall {
    0% { transform: translate(0, 0); opacity: 0; }
    12% { opacity: var(--alpha, 0.9); }
    to { transform: translate(var(--dx, 0), 108vh) rotate(240deg); opacity: 0.08; }
}

@keyframes fx-fog {
    from { opacity: 0; transform: translateX(-60px) scale(0.72); }
    30% { opacity: 1; }
    70% { opacity: 0.8; }
    to { opacity: 0; transform: translateX(90px) scale(1.45); }
}

.fx-ember {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffd27a;
    box-shadow: 0 0 12px rgba(255, 125, 35, 1), 0 0 24px rgba(255, 70, 15, 0.65);
    animation: fx-rise 1.15s ease-out forwards;
}

.fx-ember--hot {
    width: 11px;
    height: 11px;
    background: #fff1b8;
    box-shadow: 0 0 16px #ffb347, 0 0 34px rgba(255, 75, 20, 0.9);
}

@keyframes fx-rise {
    0% { opacity: 1; }
    to { transform: translate(var(--dx, 0), -190px) scale(0.15); opacity: 0; }
}

.fx-smoke {
    position: absolute;
    width: 110px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(90, 62, 45, 0.48), transparent 68%);
    filter: blur(9px);
    animation: fx-smoke 1.8s ease-out forwards;
}

@keyframes fx-smoke {
    from { opacity: 0; transform: scale(0.6) translateY(20px); }
    30% { opacity: 1; }
    to { opacity: 0; transform: scale(1.5) translate(var(--dx, 0), -90px); }
}

.fx-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 55%, rgba(255, 150, 70, 0.72), transparent 66%);
    animation: fx-flash 0.8s ease-out forwards;
}

@keyframes fx-flash {
    from { opacity: 1; }
    to { opacity: 0; }
}

.fx-shock {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 120px;
    height: 120px;
    border: 3px solid rgba(255, 176, 80, 0.85);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: fx-shock 0.9s ease-out forwards;
}

.fx-shock--cold {
    border-color: rgba(200, 235, 255, 0.9);
    box-shadow: 0 0 24px rgba(170, 220, 255, 0.7);
}

@keyframes fx-shock {
    to { width: 150vw; height: 150vw; opacity: 0; border-width: 1px; }
}

.fx-mote {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #eaf7ff;
    box-shadow: 0 0 12px #b9e5ff;
    animation: fx-mote 1.2s ease-out forwards;
}

@keyframes fx-mote {
    to { transform: translate(var(--dx, 0), -110px) scale(0.2); opacity: 0; }
}

.fx-life {
    position: fixed;
    z-index: 95;
    font-size: 38px;
    font-weight: 700;
    color: #ff5a4a;
    text-shadow: 0 0 14px rgba(255, 50, 35, 0.9), 0 3px 12px rgba(0, 0, 0, 0.9);
    animation: fx-life 1.15s ease-out forwards;
}

@keyframes fx-life {
    to { transform: translateY(-58px) scale(1.18); opacity: 0; }
}

.fx-heart-loss {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 50%, transparent 22%, rgba(120, 0, 0, 0.12) 48%, rgba(170, 18, 10, 0.76) 100%),
        linear-gradient(180deg, rgba(255, 55, 35, 0.22), transparent 18%, transparent 82%, rgba(255, 55, 35, 0.18));
    animation: fx-heart-loss 1.5s ease-out forwards;
}

@keyframes fx-heart-loss {
    0% { opacity: 0; }
    12% { opacity: 1; }
    32% { opacity: 0.9; }
    100% { opacity: 0; }
}

.fx-heart-burst {
    position: fixed;
    z-index: 96;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 90, 70, 0.95);
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(255, 55, 40, 0.9);
    animation: fx-heart-burst 0.85s ease-out forwards;
}

@keyframes fx-heart-burst {
    to { width: 120px; height: 120px; opacity: 0; border-width: 1px; }
}

.fx-heart-shard {
    position: fixed;
    z-index: 96;
    width: 8px;
    height: 13px;
    background: linear-gradient(180deg, #ff8a72, #a8170e);
    clip-path: polygon(50% 0, 100% 100%, 0 82%);
    animation: fx-heart-shard 1.1s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}

@keyframes fx-heart-shard {
    to {
        transform: translate(var(--tx, 0), var(--ty, 80px)) rotate(var(--rot, 180deg)) scale(0.4);
        opacity: 0;
    }
}

.fx-life-banner {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 97;
    transform: translate(-50%, -50%);
    padding: 12px 30px;
    border-top: 1px solid rgba(255, 118, 94, 0.55);
    border-bottom: 1px solid rgba(255, 118, 94, 0.55);
    background: linear-gradient(90deg, transparent, rgba(45, 8, 5, 0.94) 18%, rgba(45, 8, 5, 0.94) 82%, transparent);
    font-family: var(--font-display);
    font-size: clamp(30px, 4vw, 48px);
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    white-space: nowrap;
    color: #ffb19f;
    text-shadow: 0 0 26px rgba(255, 70, 45, 0.95), 0 4px 18px rgba(0, 0, 0, 0.95);
    animation: fx-life-banner 1.5s ease forwards;
}

@keyframes fx-life-banner {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.82); }
    14% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    26% { transform: translate(-50%, -50%) scale(1); }
    72% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -64%) scale(1); }
}

.lives.is-losing .heart.lost {
    animation: heart-break 1.1s ease;
}

@keyframes heart-break {
    0% { opacity: 1; transform: scale(2.2); color: #ff6a55; }
    35% { opacity: 1; transform: scale(1.5) rotate(-12deg); }
    62% { opacity: 0.9; transform: scale(0.8) rotate(9deg); }
    100% { opacity: 0.18; transform: scale(1); }
}

body.is-hit .board,
body.is-hit .game-bottom {
    animation: board-shake 0.55s ease;
}

@keyframes board-shake {
    0%, 100% { transform: translate(0, 0); }
    18% { transform: translate(-7px, 3px); }
    36% { transform: translate(6px, -4px); }
    54% { transform: translate(-4px, 2px); }
    72% { transform: translate(3px, -1px); }
}

.fx-round {
    position: fixed;
    left: 50%;
    top: 42%;
    z-index: 96;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: clamp(54px, 7vw, 92px);
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    color: var(--gold-bright);
    text-shadow: 0 0 28px rgba(201, 162, 39, 0.75), 0 4px 30px rgba(0, 0, 0, 0.9);
    animation: fx-round 1.6s ease forwards;
}

@keyframes fx-round {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
    22% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    76% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.94); }
}

/* ---------- 换牌条 ---------- */

.mulligan-bar {
    position: fixed;
    left: 50%;
    bottom: 140px;
    z-index: 45;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 9px 16px;
    border: 1px solid rgba(201, 162, 39, 0.4);
    border-radius: 6px;
    background: rgba(24, 20, 16, 0.97);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}

.mulligan-bar__hint {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

.mulligan-bar__hint b {
    color: var(--gold-bright);
    font-weight: 600;
}

/* ---------- 墓地 ---------- */

.grave-group { margin-bottom: 14px; }

.grave-group__title {
    margin-bottom: 4px;
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--gold);
}

.grave-group__names {
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--text-dim);
}

@media (max-width: 900px) {
    body.page-game { overflow-y: auto; height: auto; }
    .page-game .board { min-height: 480px; }

    .page-game .side-panels {
        position: relative;
        top: auto;
        left: auto;
        width: auto;
        margin: 8px 10px 0;
        max-height: none;
        overflow: visible;
        pointer-events: auto;
    }

    .page-game .side-panels .thinking-panel {
        width: auto;
        max-height: 190px;
        flex: none;
    }

    .page-game .side-panels .thinking-panel__body {
        max-height: 135px;
    }

    body.page-game.log-open,
    body.page-game.panel-open { overflow-y: auto; }

    body.page-game.log-open .board,
    body.page-game.panel-open .board {
        padding-left: 108px;
        padding-right: 16px;
    }

    body.page-game.log-open .leader-rail,
    body.page-game.panel-open .leader-rail { left: 8px; }
}

/* ---------- 音效开关（static/sfx.js 注入） ---------- */
.sfx-toggle {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 80;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 17px;
    line-height: 1;
    color: var(--paper);
    background: rgba(16, 23, 19, 0.78);
    border: 1px solid rgba(198, 161, 91, 0.45);
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), inset 0 0 12px rgba(198, 161, 91, 0.12);
    cursor: pointer;
    opacity: 0.72;
    backdrop-filter: blur(4px);
    transition: opacity 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.sfx-toggle:hover,
.sfx-toggle:focus-visible {
    opacity: 1;
    transform: translateY(-1px);
    border-color: rgba(198, 161, 91, 0.9);
    outline: none;
}

.sfx-toggle[aria-pressed="true"] {
    opacity: 0.45;
    color: rgba(232, 223, 201, 0.6);
}

@media (max-width: 720px) {
    .sfx-toggle { right: 12px; bottom: 12px; width: 34px; height: 34px; font-size: 15px; }
}
