:root {
    --bg: #07111f;
    --bg-alt: #0c172a;
    --panel: rgba(10, 20, 38, 0.84);
    --panel-strong: rgba(13, 25, 46, 0.96);
    --surface: rgba(10, 20, 38, 0.84);
    --surface-strong: rgba(13, 25, 46, 0.96);
    --line: rgba(255, 255, 255, 0.1);
    --text: #edf3ff;
    --muted: #a7b4cb;
    --accent: #7c5cff;
    --accent-2: #2dd4bf;
    --green: #39ff88;
    --green-dim: rgba(57, 255, 136, .28);
    --purple: #c25bff;
    --purple-dim: rgba(194, 91, 255, .28);
    --gold: #ffd05a;
    --danger: #ff5470;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --panel-width: min(440px, 100vw);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(124, 92, 255, 0.22), transparent 28%),
        radial-gradient(circle at top right, rgba(45, 212, 191, 0.18), transparent 26%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
    font-family: Inter, Arial, sans-serif;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; }
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent 35%, transparent 65%, rgba(255,255,255,0.02));
}
body.menu-open { overflow: hidden; }
.page-shell { width: min(calc(100% - 32px), 1320px); margin: 0 auto; padding: 20px 0 32px; }
.game-topbar, .glass-panel, .side-panel-inner, .text-box, .status-card, .result-popup-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.game-topbar {
    min-height: 80px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
    margin-bottom: 0;
    position: sticky;
    top: 16px;
    z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 28px rgba(124, 92, 255, 0.28); overflow: hidden; }
.brand-mark img { width: 48px; height: 48px; object-fit: contain; display: block; }
.brand-copy { display: flex; flex-direction: column; gap: 4px; }
.brand-copy strong { font-size: 1.05rem; }
.brand-copy small { color: var(--muted); }
.eyebrow { display: inline-flex; color: var(--accent-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 10px; }
.compact-nav, .topbar-actions, .stage-action-row, .button-row { display: flex; gap: 10px; align-items: center; }
.compact-nav a, .nav-jump-menu summary { color: var(--muted); text-decoration: none; font-weight: 700; cursor: pointer; padding: 10px 14px; border-radius: 999px; }
.compact-nav a:hover, .nav-jump-menu summary:hover { background: rgba(255,255,255,0.06); }
.nav-jump-menu { position: relative; }
.nav-jump-list {
    position: absolute;
    right: 0;
    top: 28px;
    min-width: 170px;
    padding: 8px;
    display: grid;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
    z-index: 20;
}
.ghost-button, .primary-button, .segment-button {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    color: var(--text);
    background: rgba(255,255,255,.04);
    font-weight: 600;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.primary-button { background: linear-gradient(135deg, var(--accent), #9d74ff); color: #fff; box-shadow: 0 14px 28px rgba(124, 92, 255, 0.28); }
.ghost-button { border: 1px solid var(--line); background: rgba(255,255,255,0.05); }
.primary-button:hover, .ghost-button:hover, .segment-button:hover { transform: translateY(-2px); }
.game-layout { display: block; padding-top: 24px; }
.board-stage { border-radius: var(--radius-xl); padding: 20px; }
.stage-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.stage-header h1, .side-panel-header h2 { margin: 0; }
.stage-header h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.1; letter-spacing: 0; }
.stage-actions { display: grid; gap: 10px; justify-items: end; }
.mini-stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stat { min-width: 92px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: rgba(255,255,255,.04); }
.mini-stat span { display: block; color: var(--muted); font-size: .75rem; }
.play-surface { display: grid; grid-template-columns: 300px minmax(420px, 1fr) 260px; gap: 18px; align-items: start; }
.controls-shell, .info-column { display: grid; gap: 12px; }
.compact-setup-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; background: rgba(255,255,255,0.04); position: sticky; top: 108px; }
.setup-card-header h2, .status-card h2 { margin: 4px 0 6px; font-size: 1.15rem; }
.setup-card-header p, .hint-line, .text-box p { color: var(--muted); margin: 0; line-height: 1.45; }
.inline-help { display: inline-block; margin-top: 8px; font-size: .85rem; text-decoration: none; }
.field-group { display: grid; gap: 8px; margin-top: 12px; }
.field-group label { font-size: .92rem; color: var(--text); font-weight: 600; }
.segmented-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 6px; border-radius: 18px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); }
.small-segments { grid-template-columns: repeat(5, 1fr); }
.segment-button { color: var(--muted); background: transparent; min-height: 44px; padding: 10px 12px; border-radius: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-segment { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.icon-segment svg { flex: 0 0 auto; }
.segment-button:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.segment-button.is-active { color: #ffffff; background: linear-gradient(135deg, rgba(124, 92, 255, 0.95), rgba(88, 209, 193, 0.88)); box-shadow: 0 12px 24px rgba(61, 91, 196, 0.22); }
.mode-segments .has-sublabel { min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; padding: 7px 9px; line-height: 1.2; border-radius: 14px; }
.seg-label { font-size: .88rem; font-weight: 600; }
.icon-label { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.icon-label svg { flex: 0 0 auto; }
.seg-sublabel { color: var(--muted); font-size: .65rem; font-weight: 400; opacity: .78; line-height: 1.2; }
.game-mode-hint { display: block; color: var(--muted); font-size: .72rem; margin-top: 5px; line-height: 1.3; }
.diff-player-field { margin-top: 8px; }
.diff-field-header { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 5px; }
.diff-field-label { color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.diff-field-meta { color: var(--muted); font-size: .72rem; }
.diff-segmented { display: flex; gap: 4px; }
.diff-opt-wrap { position: relative; flex: 1; }
.diff-opt-wrap .segment-button { width: 100%; min-width: 0; padding: 10px 4px; text-align: center; }
.diff-tooltip {
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    background: var(--surface-strong, #1a1a2e); border: 1px solid var(--line, rgba(255,255,255,.12));
    border-radius: 10px; padding: 8px 12px; font-size: 0.76rem; line-height: 1.45;
    color: var(--text, #e8e6f0); white-space: nowrap; pointer-events: none;
    opacity: 0; transition: opacity .15s; z-index: 200;
}
.diff-opt-wrap:hover .diff-tooltip { opacity: 1; }
.diff-opt-wrap:first-child .diff-tooltip { left: 0; transform: none; }
.diff-opt-wrap:last-child .diff-tooltip { left: auto; right: 0; transform: none; }
.compact-options-stack { display: grid; gap: 12px; }
.player-vs-divider { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin: 2px 0; }
.player-vs-divider::before, .player-vs-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.remote-setup-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 8px; align-items: stretch; }
.remote-create-btn { grid-column: 1; grid-row: 1; width: 100%; }
.remote-join-btn { grid-column: 1; grid-row: 2; width: 100%; }
.code-input-wrapper { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; justify-content: center; }
.code-input-wrapper input { width: 100%; text-align: center; font-size: 1.05rem; letter-spacing: .12em; }
.full-button { width: 100%; margin-top: 12px; }
.danger-button {
    border-color: rgba(255,84,112,.36);
    color: #ffd6de;
    background: rgba(255,84,112,.08);
}
.danger-button:hover,
.danger-button:focus-visible {
    border-color: rgba(255,84,112,.72);
    background: rgba(255,84,112,.15);
}
.deploy-card { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.remote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.remote-grid input, .code-input-wrapper input { min-height: 44px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.05); color: var(--text); padding: 12px 14px; outline: none; }
.board-column { display: grid; gap: 12px; min-width: 0; }
.status-card { border-radius: var(--radius-md); padding: 14px; display: grid; grid-template-columns: 1fr 1.1fr; gap: 18px; align-items: center; background: rgba(255,255,255,0.04); }
.score-panel { display: grid; gap: 8px; }
.score-bar { height: 16px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; display: flex; background: rgba(0,0,0,.28); }
#green-score-bar { background: var(--green); width: 50%; }
#purple-score-bar { background: var(--purple); width: 50%; }
.score-copy { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .88rem; }
.dominion-board-wrap {
    width: 100%;
    aspect-ratio: 1 / 0.92;
    min-height: 500px;
    border-radius: 18px;
    border: 1px solid rgba(163,186,220,.3);
    box-shadow: inset 0 0 0 6px rgba(255,255,255,.018), inset 0 0 0 1px rgba(255,255,255,.05);
    background:
        radial-gradient(circle at 50% 44%, rgba(45,212,191,.08), transparent 46%),
        radial-gradient(circle at 18% 18%, rgba(124,92,255,.12), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.008)),
        rgba(0,0,0,.22);
    overflow: hidden;
    touch-action: manipulation;
}
#dominion-board { width: 100%; height: 100%; display: block; }
.board-border-glow,
.board-border-line { fill: none; pointer-events: none; }
.board-border-glow { stroke: rgba(45,212,191,.28); stroke-width: 10; stroke-linejoin: round; filter: drop-shadow(0 0 10px rgba(45,212,191,.22)); }
.board-border-line { stroke: rgba(237,243,255,.92); stroke-width: 4; stroke-linejoin: round; }
.hex { stroke: rgba(144,169,204,.24); stroke-width: 1.15; transition: opacity .14s ease, stroke .14s ease, filter .14s ease, fill .14s ease; cursor: pointer; }
.hex.neutral { fill: #05080e; }
.hex.green-owned { fill: rgba(57,255,136,.055); stroke: rgba(57,255,136,.3); filter: drop-shadow(0 0 2px rgba(57,255,136,.07)); }
.hex.purple-owned { fill: rgba(194,91,255,.055); stroke: rgba(194,91,255,.3); filter: drop-shadow(0 0 2px rgba(194,91,255,.07)); }
.hex.landing-green { fill: var(--green-dim); stroke: rgba(57,255,136,.8); stroke-dasharray: 4 3; }
.hex.landing-purple { fill: var(--purple-dim); stroke: rgba(194,91,255,.8); stroke-dasharray: 4 3; }
.hex.green-occupied { fill: rgba(57,255,136,.17); stroke: rgba(213,255,231,.92); stroke-width: 1.9; filter: drop-shadow(0 0 8px rgba(57,255,136,.28)); }
.hex.purple-occupied { fill: rgba(194,91,255,.17); stroke: rgba(255,226,255,.92); stroke-width: 1.9; filter: drop-shadow(0 0 8px rgba(194,91,255,.28)); }
.hex.hidden { fill: #080d18; stroke: rgba(255,208,90,.58); stroke-dasharray: 2 5; filter: drop-shadow(0 0 7px rgba(255,208,90,.16)); }
.hex.objective-revealed { fill: rgba(255,208,90,.075); stroke: rgba(255,208,90,.78); stroke-dasharray: 5 4; filter: drop-shadow(0 0 7px rgba(255,208,90,.18)); }
.hex.objective-stabilizing { fill: rgba(255,208,90,.105); stroke-width: 3; }
.hex.objective-stabilizing.stabilizing-green { stroke: rgba(57,255,136,.96); filter: drop-shadow(0 0 9px rgba(57,255,136,.38)); }
.hex.objective-stabilizing.stabilizing-purple { stroke: rgba(194,91,255,.96); filter: drop-shadow(0 0 9px rgba(194,91,255,.38)); }
.hex.objective-contested { fill: rgba(255,84,112,.18); stroke: rgba(255,208,90,.98); stroke-width: 3; stroke-dasharray: 3 3; filter: drop-shadow(0 0 10px rgba(255,84,112,.42)); }
.hex.flag { fill: rgba(255,208,90,.1); stroke: rgba(255,208,90,.94); stroke-width: 4.2; filter: drop-shadow(0 0 11px rgba(255,208,90,.24)); }
.hex.flag.green-owned { fill: rgba(57,255,136,.16); stroke: rgba(57,255,136,.96); }
.hex.flag.purple-owned { fill: rgba(194,91,255,.16); stroke: rgba(194,91,255,.96); }
.hex.flag.recapture-active { stroke-width: 5; stroke-dasharray: 4 3; filter: drop-shadow(0 0 14px rgba(255,208,90,.44)); }
.hex.flag.recapture-contested { stroke-width: 3; stroke: rgba(255,84,112,.95); stroke-dasharray: 2 3; filter: drop-shadow(0 0 12px rgba(255,84,112,.32)); }
.hex.flag.recapturing-green { stroke: rgba(57,255,136,.95); }
.hex.flag.recapturing-purple { stroke: rgba(194,91,255,.95); }
.hex.nexus { stroke-width: 3; filter: drop-shadow(0 0 12px rgba(255,208,90,.24)); }
.hex.nexus.green-owned { fill: rgba(57,255,136,.13); stroke: rgba(57,255,136,.9); }
.hex.nexus.purple-owned { fill: rgba(194,91,255,.13); stroke: rgba(194,91,255,.9); }
.hex.nexus.recapture-active { stroke-dasharray: 5 3; filter: drop-shadow(0 0 14px rgba(255,208,90,.42)); }
.hex.nexus.recapture-contested { stroke: rgba(255,84,112,.96); stroke-dasharray: 2 3; }
.hex.legal { stroke: rgba(255,255,255,.45); stroke-width: 2; filter: none; }
/* Action-type legal move highlights — each type is visually distinct */
.hex.legal-move  { fill: rgba(80,160,255,.07);  stroke: rgba(80,160,255,.88);  stroke-width: 2.4; filter: drop-shadow(0 0 6px rgba(80,160,255,.42)); }
.hex.legal-push  { fill: rgba(255,130,30,.09);  stroke: rgba(255,130,30,.94);  stroke-width: 3.2; filter: drop-shadow(0 0 8px rgba(255,130,30,.56)); }
.hex.legal-nexus { fill: rgba(255,55,95,.1);    stroke: rgba(255,55,95,.96);   stroke-width: 3.6; filter: drop-shadow(0 0 11px rgba(255,55,95,.65)); animation: nexusLegalPulse 1.1s ease-in-out infinite alternate; }
.hex.legal-flag  { fill: rgba(255,208,90,.08);  stroke: rgba(255,208,90,.92);  stroke-width: 2.6; filter: drop-shadow(0 0 7px rgba(255,208,90,.48)); }
.hex.selected { stroke: var(--gold); stroke-width: 4; }
.hex.event-pulse { animation: tilePulse 1.4s ease-out; stroke: #ffffff; stroke-width: 4; filter: drop-shadow(0 0 14px rgba(255,208,90,.68)); }
.hex.last-from { stroke: rgba(255,208,90,.95); stroke-width: 3.2; filter: drop-shadow(0 0 8px rgba(255,208,90,.38)); }
.hex.last-to { stroke: rgba(45,212,191,.95); stroke-width: 4; filter: drop-shadow(0 0 10px rgba(45,212,191,.45)); }
.hex.disconnected { opacity: .58; stroke-dasharray: 4 3; filter: grayscale(.22) brightness(.78); }
.hex.disconnected.neutral { fill: #131c2e; stroke: rgba(144,169,204,.28); }
.hex.disconnected.green-owned { fill: rgba(29,106,69,.42); stroke: rgba(57,255,136,.38); }
.hex.disconnected.purple-owned { fill: rgba(94,45,125,.42); stroke: rgba(194,91,255,.38); }
/* Permanent supply network — thick glowing pipes between connected hexes */
/* Background (shadow/depth) layer — drawn first so fg pipes sit on top */
.supply-pipe-bg { pointer-events: none; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.supply-pipe-bg.green  { stroke: rgba(3,14,9,.88); }
.supply-pipe-bg.purple { stroke: rgba(14,3,26,.88); }
/* Foreground (colored face) layer — stroke-width set via JS proportional to board size */
.supply-pipe { pointer-events: none; fill: none; stroke-linecap: round; stroke-linejoin: round; animation: supplyPipeBreath 3.2s ease-in-out infinite alternate; }
.supply-pipe.green  { stroke: rgba(57,255,136,.78); filter: drop-shadow(0 0 5px rgba(57,255,136,.52)); }
.supply-pipe.purple { stroke: rgba(194,91,255,.78); filter: drop-shadow(0 0 5px rgba(194,91,255,.52)); }
/* Selected-unit supply path — animated dashed highlight */
.supply-path { pointer-events: none; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 9; opacity: .74; animation: supplyFlow 1.6s linear infinite; filter: drop-shadow(0 0 6px currentColor); }
.supply-path.green { stroke: rgba(57,255,136,.78); color: rgba(57,255,136,.78); }
.supply-path.purple { stroke: rgba(194,91,255,.78); color: rgba(194,91,255,.78); }
/* Push preview arrows */
.push-arrow      { pointer-events: none; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.push-arrow-head { pointer-events: none; }
.push-arrow.push-attack-arrow      { stroke: rgba(255,130,30,.92); stroke-width: 2.4; filter: drop-shadow(0 0 5px rgba(255,130,30,.7)); }
.push-arrow-head.push-attack-arrow { fill: rgba(255,130,30,.94); filter: drop-shadow(0 0 5px rgba(255,130,30,.7)); }
.push-arrow.push-retreat-arrow      { stroke: rgba(80,200,255,.82); stroke-width: 1.8; stroke-dasharray: 5 3; filter: drop-shadow(0 0 4px rgba(80,200,255,.5)); }
.push-arrow-head.push-retreat-arrow { fill: rgba(80,200,255,.86); filter: drop-shadow(0 0 4px rgba(80,200,255,.5)); }
/* Elimination indicator (⊗) */
.push-elim-marker { pointer-events: none; fill: rgba(255,50,90,.18); stroke: rgba(255,50,90,.92); stroke-width: 2; animation: elimIndicatorPulse .85s ease-in-out infinite alternate; filter: drop-shadow(0 0 6px rgba(255,50,90,.6)); }
.push-elim-cross  { pointer-events: none; fill: none; stroke: rgba(255,50,90,.96); stroke-width: 2.2; stroke-linecap: round; }
.unit-token { pointer-events: none; filter: drop-shadow(0 8px 9px rgba(0,0,0,.5)); }
.unit-token.supply-warn { filter: drop-shadow(0 0 8px rgba(255,208,90,.34)) drop-shadow(0 7px 8px rgba(0,0,0,.48)); }
.unit-token.supply-critical { animation: supplyPulse 1s ease-in-out infinite alternate; }
.unit-token.linked-unit { filter: drop-shadow(0 0 12px rgba(255,208,90,.58)) drop-shadow(0 8px 9px rgba(0,0,0,.5)); }
.unit-shadow { pointer-events: none; fill: rgba(0,0,0,.38); filter: blur(.3px); }
.unit-faction-ring { pointer-events: none; fill: rgba(255,255,255,.035); stroke-width: 2.8; filter: drop-shadow(0 0 7px currentColor); }
.unit-base { pointer-events: none; fill: rgba(9,17,30,.92); stroke: rgba(229,242,255,.66); stroke-width: 1.6; }
.unit-base-top { pointer-events: none; fill: rgba(255,255,255,.08); stroke: rgba(255,255,255,.28); stroke-width: .8; }
.unit-stem { pointer-events: none; stroke-width: 1.7; }
.unit-faction-fin { pointer-events: none; stroke: rgba(255,255,255,.82); stroke-width: 1.1; filter: drop-shadow(0 0 5px currentColor); }
.unit-core-halo { pointer-events: none; fill: rgba(255,255,255,.08); stroke-width: 1.5; }
.unit-core { pointer-events: none; stroke: rgba(255,255,255,.9); stroke-width: 1.3; }
.unit-highlight { pointer-events: none; fill: none; stroke: rgba(255,255,255,.78); stroke-width: 1.5; stroke-linecap: round; opacity: .78; }
.unit-token.green .unit-stem,
.unit-token.green .unit-core { fill: url(#dominion-pawn-green); }
.unit-token.green .unit-faction-ring,
.unit-token.green .unit-faction-fin { color: rgba(57,255,136,.95); stroke: rgba(57,255,136,.98); fill: rgba(57,255,136,.18); }
.unit-token.green .unit-stem,
.unit-token.green .unit-core-halo { stroke: rgba(218,255,234,.92); }
.unit-token.green .unit-core-halo { fill: rgba(57,255,136,.12); }
.unit-token.purple .unit-stem,
.unit-token.purple .unit-core { fill: url(#dominion-pawn-purple); }
.unit-token.purple .unit-faction-ring,
.unit-token.purple .unit-faction-fin { color: rgba(214,117,255,.98); stroke: rgba(235,176,255,.98); fill: rgba(194,91,255,.24); }
.unit-token.purple .unit-stem,
.unit-token.purple .unit-core-halo { stroke: rgba(255,228,255,.92); }
.unit-token.purple .unit-core-halo { fill: rgba(194,91,255,.12); }
.unit-token.supply-warn .unit-base { stroke: rgba(255,208,90,.92); }
.unit-token.supply-critical .unit-base { stroke: rgba(255,84,112,.98); }
.unit-token.supply-critical .unit-core-halo { stroke: rgba(255,84,112,.85); }
.supply-bar-bg { pointer-events: none; fill: rgba(3,9,18,.88); stroke: rgba(255,255,255,.42); stroke-width: .9; }
.supply-bar-fg { pointer-events: none; fill: #39ff88; filter: drop-shadow(0 0 4px rgba(57,255,136,.38)); }
.unit-token.supply-warn .supply-bar-fg { fill: #ffd05a; }
.unit-token.supply-critical .supply-bar-fg { fill: var(--danger); filter: drop-shadow(0 0 5px rgba(255,84,112,.68)); }
.linked-marker-ring { pointer-events: none; fill: none; stroke: rgba(255,208,90,.96); stroke-width: 2; stroke-dasharray: 3 3; animation: linkedOrbit 1.8s linear infinite; }
.linked-marker-dot { pointer-events: none; fill: #ffd05a; stroke: rgba(3,9,18,.85); stroke-width: 1; }
.nexus-token { pointer-events: none; filter: drop-shadow(0 0 12px rgba(255,255,255,.2)); }
.nexus-shadow { fill: rgba(0,0,0,.38); }
.nexus-halo { fill: rgba(255,255,255,.025); stroke-width: 1.5; stroke-dasharray: 5 4; animation: nexusSpin 7s linear infinite; transform-box: fill-box; transform-origin: center; }
.nexus-token.green .nexus-halo { stroke: rgba(57,255,136,.64); }
.nexus-token.purple .nexus-halo { stroke: rgba(194,91,255,.64); }
.nexus-token.green .nexus-outer { fill: rgba(57,255,136,.22); stroke: #dffff0; }
.nexus-token.purple .nexus-outer { fill: rgba(194,91,255,.22); stroke: #ffe3ff; }
.nexus-outer { stroke-width: 2.6; filter: url(#dominion-soft-glow); }
.nexus-inner { fill: rgba(6,12,22,.76); stroke: rgba(255,255,255,.48); stroke-width: 1.2; }
.nexus-core { fill: url(#dominion-core-gold); stroke: rgba(4,17,26,.75); stroke-width: 1.5; filter: drop-shadow(0 0 7px rgba(255,208,90,.42)); }
.objective-ring { pointer-events: none; fill: rgba(0,0,0,.16); stroke-width: 2; stroke-dasharray: 3 3; filter: drop-shadow(0 0 7px rgba(255,208,90,.18)); }
.objective-ring-hidden { stroke: rgba(255,208,90,.48); }
.objective-ring-revealed { stroke: rgba(255,208,90,.82); }
.objective-ring-stabilizing { stroke: #fff2ba; stroke-dasharray: none; }
.objective-ring-contested { stroke: var(--danger); stroke-dasharray: 2 3; }
.objective-glyph { pointer-events: none; stroke-width: 1.8; filter: drop-shadow(0 2px 5px rgba(0,0,0,.48)); }
.objective-glyph-hidden { fill: rgba(255,208,90,.1); stroke: rgba(255,208,90,.68); }
.objective-glyph-revealed { fill: rgba(255,208,90,.16); stroke: rgba(255,244,189,.92); }
.objective-glyph-stabilizing { fill: rgba(255,208,90,.24); stroke: #fff2ba; }
.objective-glyph-contested { fill: rgba(255,84,112,.26); stroke: #ffd05a; }
.objective-core { pointer-events: none; fill: rgba(255,244,189,.9); filter: drop-shadow(0 0 5px rgba(255,208,90,.42)); }
.objective-core-hidden { fill: rgba(255,208,90,.42); }
.objective-core-contested { fill: var(--danger); }
.objective-scan { pointer-events: none; fill: none; stroke-width: 1; opacity: .72; }
.objective-scan-hidden { stroke: rgba(255,208,90,.36); stroke-dasharray: 1 5; }
.objective-scan-revealed { stroke: rgba(255,208,90,.62); }
.objective-scan-stabilizing { stroke: rgba(255,244,189,.78); }
.objective-scan-contested { stroke: rgba(255,84,112,.86); stroke-dasharray: 2 3; }
.flag-token { pointer-events: none; filter: drop-shadow(0 5px 8px rgba(0,0,0,.48)); }
.flag-base { pointer-events: none; fill: rgba(8,15,28,.84); stroke: rgba(255,208,90,.52); stroke-width: 1.4; }
.flag-base.green-owned { stroke: rgba(57,255,136,.86); }
.flag-base.purple-owned { stroke: rgba(194,91,255,.86); }
.flag-base.neutral { stroke: rgba(255,208,90,.72); }
.flag-socket { pointer-events: none; fill: rgba(255,255,255,.11); stroke-width: 1.2; }
.flag-socket.green-owned { stroke: rgba(57,255,136,.9); }
.flag-socket.purple-owned { stroke: rgba(194,91,255,.9); }
.flag-socket.neutral { stroke: rgba(255,208,90,.86); }
.flag-pole-3d { pointer-events: none; stroke: url(#dominion-metal); stroke-width: 2.5; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(255,255,255,.2)); opacity: .94; }
.flag-wave-shadow { pointer-events: none; fill: rgba(0,0,0,.2); transform: translate(2px, 2px); }
.flag-wave { pointer-events: none; stroke: rgba(255,255,255,.9); stroke-width: 1.25; filter: drop-shadow(0 0 8px currentColor); }
.flag-wave.green-owned { color: rgba(57,255,136,.92); fill: rgba(57,255,136,.86); }
.flag-wave.purple-owned { color: rgba(194,91,255,.92); fill: rgba(194,91,255,.88); }
.flag-wave.neutral { color: rgba(255,208,90,.92); fill: rgba(255,208,90,.86); }
.flag-symbol { pointer-events: none; fill: none; stroke: rgba(4,17,26,.92); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; paint-order: stroke; filter: drop-shadow(0 1px 1px rgba(255,255,255,.22)); }
circle.flag-symbol { fill: rgba(4,17,26,.92); stroke: rgba(255,255,255,.56); stroke-width: 1.2; }
.recapture-ring { pointer-events: none; fill: none; stroke-width: 3; stroke-dasharray: 6 4; filter: drop-shadow(0 0 8px rgba(255,208,90,.32)); }
.recapture-ring.green-owned { stroke: var(--green); }
.recapture-ring.purple-owned { stroke: var(--purple); }
.recapture-ring.neutral { stroke: var(--gold); }
.elimination-effect { pointer-events: none; animation: eliminateFade 1.45s ease-out forwards; filter: drop-shadow(0 0 10px currentColor); }
.elimination-effect.green { color: rgba(57,255,136,.9); }
.elimination-effect.purple { color: rgba(194,91,255,.9); }
.elimination-ring { fill: rgba(255,255,255,.04); stroke: currentColor; stroke-width: 2.8; animation: eliminateRing 1.45s ease-out forwards; }
.elimination-shard { fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; animation: eliminateShard 1.45s ease-out forwards; }
.elimination-core { fill: currentColor; stroke: rgba(255,255,255,.9); stroke-width: 1.2; animation: eliminateCore 1.45s ease-out forwards; }
.unit-label,
.flag-label,
.objective-label,
.recapture-label { pointer-events: none; font-size: 11px; fill: #04111a; font-weight: 900; text-anchor: middle; dominant-baseline: central; }
.flag-label { fill: var(--gold); filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.objective-label { fill: #fff4bd; font-size: 12px; paint-order: stroke; stroke: rgba(3,9,18,.9); stroke-width: 3px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.recapture-label { fill: #fff4bd; font-size: 12px; paint-order: stroke; stroke: rgba(3,9,18,.92); stroke-width: 3px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.deployment-tray {
    width: min(100%, 640px);
    margin: 2px auto 0;
    padding: 12px;
    border: 1px solid rgba(57,255,136,.22);
    border-radius: var(--radius-md);
    background: rgba(57,255,136,.06);
    display: grid;
    gap: 10px;
}
.deployment-tray[hidden] { display: none !important; }
.deployment-tray.is-purple {
    border-color: rgba(194,91,255,.24);
    background: rgba(194,91,255,.07);
}
.deployment-tray-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.deployment-piece-list { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.deployment-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.deployment-actions .ghost-button,
.deployment-actions .primary-button { min-height: 38px; padding: 8px 14px; font-size: .88rem; }
.deployment-piece-button {
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.05);
    display: inline-grid;
    place-items: center;
    cursor: grab;
}
.deployment-piece-button:hover,
.deployment-piece-button.is-active {
    border-color: rgba(45,212,191,.72);
    box-shadow: 0 0 0 2px rgba(45,212,191,.18);
}
.deploy-piece { width: 28px; height: 28px; border-radius: 999px; display: inline-grid; place-items: center; color: #07111f; font-size: .74rem; font-weight: 900; background: var(--green); box-shadow: 0 6px 14px rgba(0,0,0,.24); }
.deployment-piece-button.is-purple .deploy-piece { background: var(--purple); color: #fff; }
.text-box { border-radius: var(--radius-md); padding: 12px; background: rgba(255,255,255,0.04); color: var(--muted); }
.history-list { margin: 8px 0 0; padding-left: 20px; color: var(--muted); max-height: 260px; overflow: auto; }
.history-review-hint { margin: 6px 0 2px; font-size: .8rem; color: var(--accent-2); }
.history-list li.is-reviewable { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; transition: background .12s, color .12s; }
.history-list li.is-reviewable:hover { background: rgba(124,92,255,.12); color: var(--text); }
.history-list li.is-reviewing { background: rgba(124,92,255,.18); color: var(--accent); font-weight: 600; }
.dominion-status-panel { display: grid; gap: 10px; }
.dominion-status-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dominion-status-summary div { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: rgba(255,255,255,.035); min-width: 0; }
.dominion-status-summary span { display: block; color: var(--muted); font-size: .72rem; }
.dominion-status-summary strong { display: block; color: var(--text); font-size: .86rem; overflow-wrap: anywhere; }
.event-toast-stack { position: fixed; left: 50%; top: 84%; transform: translate(-50%, -50%); display: grid; gap: 10px; z-index: 120; pointer-events: none; width: min(520px, calc(100vw - 28px)); }
.event-toast { border: 1px solid rgba(255,255,255,.18); border-left: 4px solid var(--accent-2); border-radius: 16px; padding: 14px 18px; background: rgba(9,18,34,.96); box-shadow: 0 18px 46px rgba(0,0,0,.42), 0 0 24px rgba(45,212,191,.18); color: var(--text); font-size: 1rem; font-weight: 700; text-align: center; animation: toastIn .22s ease-out; transition: opacity .45s ease, transform .45s ease; }
.event-toast.is-fading { opacity: 0; transform: translateY(8px); }
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--panel-width);
    max-width: 100%;
    height: 100vh;
    z-index: 110;
    transform: translateX(100%);
    transition: transform .28s ease;
    padding: 16px;
    background: transparent;
    box-shadow: none;
    border: 0;
}
.side-panel.is-open { transform: translateX(0); }
.side-panel::before { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.46); opacity: 0; pointer-events: none; transition: opacity .28s ease; z-index: -1; }
.side-panel.is-open::before { opacity: 1; pointer-events: auto; }
.side-panel-inner { height: 100%; overflow: auto; padding: 22px; border-radius: 28px; background: var(--surface-strong); border: 1px solid var(--line); box-shadow: var(--shadow); }
.side-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 2; background: var(--surface-strong); padding-bottom: 16px; margin-bottom: 8px; }
.side-panel-header h2 { margin: 0; }
.panel-tabs { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.panel-tab, .tab-button { border: 0; cursor: pointer; padding: 12px 18px; border-radius: 999px; color: var(--text); background: rgba(255,255,255,.05); border: 1px solid var(--line); min-height: 36px; font-weight: 600; }
.panel-tab.is-active, .tab-button.is-active { background: rgba(124,92,255,.16); color: #d8ccff; }
.panel-page { display: none; color: var(--muted); line-height: 1.5; font-size: .9rem; }
.panel-page.is-active { display: block; }
.guide-section { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; margin-bottom: 0; background: transparent; }
.guide-section summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; color: var(--text); font-weight: 600; cursor: pointer; list-style: none; }
.guide-section summary::-webkit-details-marker { display: none; }
.guide-section summary::after { content: "+"; font-size: 1rem; color: var(--muted); }
.guide-section[open] summary::after { content: "\2212"; }
.guide-body { padding: 0 0 12px; color: var(--muted); font-size: .84rem; line-height: 1.6; }
.guide-body h3 { margin: 12px 0 6px; color: var(--text); font-size: .9rem; }
.guide-body ul, .guide-body ol { margin: 0 0 8px; padding-left: 18px; }
.guide-body li { margin-bottom: 4px; }
.guide-visual-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 4px; }
.guide-visual-item { display: grid; grid-template-columns: 48px 1fr; gap: 8px 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: rgba(255,255,255,.035); }
.guide-visual-item strong { color: var(--text); font-size: .88rem; }
.guide-visual-item p { grid-column: 2; margin: -4px 0 0; font-size: .78rem; line-height: 1.45; color: var(--muted); }
.guide-token { grid-row: span 2; width: 40px; height: 40px; display: inline-grid; place-items: center; position: relative; }
.guide-token-pawn::before { content: ""; width: 24px; height: 30px; clip-path: polygon(50% 0, 76% 28%, 68% 100%, 32% 100%, 24% 28%); border: 2px solid rgba(255,255,255,.86); filter: drop-shadow(0 0 7px currentColor); }
.guide-token-pawn.green { color: var(--green); }
.guide-token-pawn.green::before { background: var(--green); }
.guide-token-tile { clip-path: polygon(25% 5%,75% 5%,100% 50%,75% 95%,25% 95%,0 50%); border: 2px solid rgba(57,255,136,.72); background: rgba(57,255,136,.16); box-shadow: 0 0 10px rgba(57,255,136,.16); }
.guide-token-flag { color: var(--purple); }
.guide-token-flag::before { content: ""; position: absolute; inset: 5px 4px 5px 7px; clip-path: polygon(0 0, 90% 8%, 82% 54%, 0 46%); background: var(--purple); border: 2px solid rgba(255,255,255,.78); box-shadow: 0 0 10px rgba(194,91,255,.34); }
.guide-token-flag::after { content: ""; position: absolute; left: 8px; top: 4px; width: 3px; height: 32px; border-radius: 3px; background: rgba(236,243,255,.86); }
.guide-token-nexus { clip-path: polygon(50% 0,90% 28%,80% 78%,50% 100%,20% 78%,10% 28%); background: radial-gradient(circle, #fff8d2 0 18%, rgba(45,212,191,.25) 20% 44%, rgba(255,255,255,.08) 45%); border: 2px solid rgba(45,212,191,.86); box-shadow: 0 0 12px rgba(45,212,191,.26); }
.guide-token-path::before { content: ""; width: 36px; height: 0; border-top: 4px dotted rgba(57,255,136,.82); filter: drop-shadow(0 0 6px rgba(57,255,136,.38)); }
.guide-token-cut { clip-path: polygon(25% 5%,75% 5%,100% 50%,75% 95%,25% 95%,0 50%); border: 2px dashed rgba(255,84,112,.58); background: rgba(255,84,112,.08); filter: brightness(.72); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat-grid div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: rgba(255,255,255,.04); }
.stat-grid span { display: block; font-size: .78rem; color: var(--muted); }
.legal-footer { text-align: center; color: var(--muted); padding: 20px 16px 28px; margin-top: 40px; border-top: 1px solid var(--line); font-size: .78rem; font-weight: 400; }
.legal-footer nav { display: flex; justify-content: center; gap: 16px; margin-bottom: 8px; }
.social-follow { margin-top: 14px; }
.social-follow__title { display: block; margin-bottom: 10px; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.social-follow__links { display: flex; flex-wrap: wrap; gap: 10px; }
.social-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.06); color: #eef3ff; font-size: .84rem; font-weight: 700; text-decoration: none; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.social-link:hover,
.social-link:focus-visible { transform: translateY(-1px); border-color: rgba(138,180,255,.55); background: rgba(138,180,255,.14); text-decoration: none; }
.mobile-screen-toggle { display: none; }

.popup {
    display: none;
    position: fixed;
    inset: 0;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    background: rgba(4,10,20,.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 120;
    overflow: auto;
}
.popup.is-visible {
    display: flex !important;
    position: fixed !important;
    inset: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 2147483647 !important;
}
.result-popup-card {
    position: relative;
    width: min(100%, 460px);
    padding: 28px;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,.12);
    background:
        radial-gradient(circle at top right, rgba(124,92,255,.22), transparent 36%),
        radial-gradient(circle at bottom left, rgba(45,212,191,.14), transparent 34%),
        var(--surface-strong);
    text-align: center;
    overflow: hidden;
}
.result-popup-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 18px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 14px 28px rgba(124,92,255,.28);
}
.result-badge {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(124,92,255,.14);
    border: 1px solid rgba(124,92,255,.24);
    color: #d8ccff;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.result-popup-copy h2 { margin: 10px 0 8px; font-size: clamp(1.7rem,2.4vw,2rem); }
#result-copy { line-height: 1.7; margin: 0; color: var(--muted); font-size: 1.02rem; }
.result-popup-actions { margin-top: 22px; display: flex; justify-content: center; }
.result-popup-actions .primary-button { min-width: 170px; }
.result-popup-card::before,
.result-popup-card::after {
    content: "";
    position: absolute;
    inset: -12%;
    pointer-events: none;
    opacity: 0;
}
.result-popup-card.result-variant-win::before {
    background:
        radial-gradient(circle at 16% 18%, rgba(255,214,102,.95) 0 4px, transparent 5px),
        radial-gradient(circle at 28% 8%,  rgba(255,99,132,.9)   0 3px, transparent 4px),
        radial-gradient(circle at 82% 20%, rgba(45,212,191,.92)  0 4px, transparent 5px),
        radial-gradient(circle at 72% 10%, rgba(124,92,255,.9)   0 3px, transparent 4px),
        linear-gradient(135deg, transparent 47%, rgba(255,255,255,.35) 49%, transparent 51%),
        linear-gradient(225deg, transparent 47%, rgba(255,255,255,.28) 49%, transparent 51%);
    animation: resultConfettiBurst 1100ms ease-out forwards;
}
.result-popup-card.result-variant-win::after {
    background:
        linear-gradient(115deg, transparent 46%, rgba(255,214,102,.42) 49%, transparent 52%),
        linear-gradient(245deg, transparent 46%, rgba(45,212,191,.34)  49%, transparent 52%);
    animation: resultRibbonSweep 1200ms ease-out forwards;
}
.result-popup-card.result-variant-loss::before {
    background:
        radial-gradient(circle at 22% 18%, rgba(148,163,184,.18) 0 7px, transparent 8px),
        radial-gradient(circle at 38% 10%, rgba(148,163,184,.14) 0 9px, transparent 10px),
        radial-gradient(circle at 70% 16%, rgba(148,163,184,.16) 0 7px, transparent 8px),
        radial-gradient(circle at 84% 12%, rgba(148,163,184,.12) 0 9px, transparent 10px);
    animation: resultSoftRain 1400ms ease-out forwards;
}
.result-popup-card.result-variant-loss::after {
    background: linear-gradient(180deg, rgba(15,23,42,.02), rgba(15,23,42,.2));
    animation: resultDimPulse 1000ms ease-out forwards;
}
.result-popup-card.result-variant-draw::before {
    background: radial-gradient(circle at 50% 0%, rgba(255,255,255,.14), transparent 52%);
    animation: resultDrawGlow 900ms ease-out forwards;
}
@keyframes resultConfettiBurst {
    0%   { opacity: 0; transform: translateY(12px) scale(.92); }
    20%  { opacity: 1; }
    100% { opacity: 1; transform: translateY(-18px) scale(1.04); }
}
@keyframes resultRibbonSweep {
    0%   { opacity: 0; transform: scale(.92) rotate(0deg); }
    25%  { opacity: .95; }
    100% { opacity: .55; transform: scale(1.04) rotate(6deg); }
}
@keyframes resultSoftRain {
    0%   { opacity: 0; transform: translateY(-16px); }
    25%  { opacity: .8; }
    100% { opacity: 1; transform: translateY(18px); }
}
@keyframes resultDimPulse {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes resultDrawGlow {
    0%   { opacity: 0; transform: scale(.94); }
    100% { opacity: 1; transform: scale(1.02); }
}

@media (max-width: 1180px) {
    .play-surface { grid-template-columns: 1fr; }
    .side-panel { position: fixed; display: block; transform: translateX(110%); }
    .side-panel.is-open { transform: translateX(0); }
    .info-column { grid-template-columns: repeat(2, 1fr); }
    .compact-setup-card { position: static; top: auto; }
}

@media (max-width: 820px) {
    body { padding-bottom: 176px; }

    .game-topbar {
        position: static;
        top: auto;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 12px;
        padding: 14px 16px;
    }

    .compact-nav { display: none !important; }

    .brand { min-width: 0; }
    .brand-copy { min-width: 0; overflow: hidden; }
    .brand-copy strong,
    .brand-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
    .brand-mark { width: 38px; height: 38px; flex-shrink: 0; }
    .brand-mark img { width: 38px; height: 38px; }

    .topbar-actions {
        width: 100%;
        grid-column: 1 / -1;
    }

    .game-topbar .auth-controls { justify-content: flex-end; }

    .game-topbar .auth-user-chip {
        padding: 4px 6px 4px 4px;
        border: 1px solid var(--line);
        background: rgba(255,255,255,.04);
        gap: 8px;
    }

    .game-topbar .auth-user-copy { align-items: flex-end; }
    .game-topbar .auth-user-label { display: none !important; }
    .game-topbar .auth-user-name { max-width: 24vw; }

    .game-topbar .auth-user-actions .ghost-button,
    .game-topbar .auth-user-actions .auth-link-button {
        height: 30px;
        min-height: 30px;
        padding: 0 10px;
        font-size: .82rem;
    }

    .game-topbar #auth-logged-out .ghost-button,
    .game-topbar #auth-logged-out .primary-button {
        height: 34px;
        min-height: 34px;
        padding: 0 12px;
        font-size: .86rem;
        white-space: nowrap;
    }

    .stage-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
    .stage-actions { width: 100%; }
    .stage-action-row { width: 100%; }
    .stage-inline-ad { display: none !important; }
    .mini-stats-strip { display: none !important; }

    .mobile-screen-toggle {
        position: fixed;
        right: 12px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
        z-index: 38;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 12px 18px;
        border-radius: 999px;
        border: 1px solid var(--line);
        background: linear-gradient(135deg, var(--accent), #9d74ff);
        color: #fff;
        box-shadow: 0 14px 28px rgba(124, 92, 255, .28);
        font: inherit;
        font-weight: 600;
        cursor: pointer;
    }

    body.mobile-pre-game .board-column,
    body.mobile-pre-game .info-column { display: none; }

    body.mobile-in-game .compact-setup-card { display: none; }

    .play-surface { gap: 12px; }
    .dominion-board-wrap { min-height: 390px; aspect-ratio: 1 / 1.08; }
}

@media (max-width: 720px) {
    .page-shell { width: min(calc(100% - 20px), 1320px); padding: 10px 0 26px; }
    .stage-header, .status-card, .score-copy { display: grid; grid-template-columns: 1fr; justify-items: start; }
    .info-column { width: 100%; grid-template-columns: 1fr; }
    .segmented-control { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .small-segments { grid-template-columns: repeat(5, 1fr); }
    .dominion-status-summary { grid-template-columns: 1fr; }
    .event-toast-stack { left: 14px; right: 14px; top: 84%; transform: translateY(-50%); width: auto; }
    .event-toast { font-size: .94rem; padding: 12px 14px; }
}

@keyframes tilePulse {
    0% { opacity: 1; stroke-width: 5; }
    60% { opacity: .96; }
    100% { opacity: 1; }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes supplyPulse {
    from { opacity: .74; }
    to { opacity: 1; filter: drop-shadow(0 0 12px rgba(255,84,112,.62)); }
}

@keyframes supplyFlow {
    to { stroke-dashoffset: -24; }
}

@keyframes linkedOrbit {
    to { stroke-dashoffset: -18; }
}

@keyframes nexusSpin {
    to { transform: rotate(360deg); }
}

@keyframes eliminateFade {
    0% { opacity: 1; }
    72% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes eliminateRing {
    0% { r: 8px; stroke-width: 4; opacity: 1; }
    55% { r: 24px; stroke-width: 2; opacity: .95; }
    100% { r: 31px; stroke-width: .8; opacity: 0; }
}

@keyframes eliminateShard {
    0% { stroke-dasharray: 1 28; opacity: 1; }
    42% { stroke-dasharray: 24 4; opacity: 1; }
    100% { stroke-dasharray: 3 28; opacity: 0; }
}

@keyframes supplyPipeBreath {
    from { opacity: .28; }
    to   { opacity: .54; }
}

@keyframes nexusLegalPulse {
    from { filter: drop-shadow(0 0 7px rgba(255,55,95,.5)); }
    to   { filter: drop-shadow(0 0 16px rgba(255,55,95,.95)); }
}

@keyframes elimIndicatorPulse {
    from { opacity: .7; }
    to   { opacity: 1; filter: drop-shadow(0 0 10px rgba(255,50,90,.85)); }
}

@keyframes eliminateCore {
    0% { r: 3px; opacity: 1; }
    50% { r: 7px; opacity: .85; }
    100% { r: 1px; opacity: 0; }
}

/* ── Piece guide list (replaces box grid) ─────────────────────────── */
.piece-guide-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 9px; }
.piece-guide-list li { display: flex; align-items: center; gap: 10px; font-size: .83rem; color: var(--muted); line-height: 1.45; }
.piece-guide-list li strong { color: var(--text); }
.guide-token-sm { flex: 0 0 28px; width: 28px; height: 28px; }
.guide-token-sm.guide-token-pawn::before { width: 16px; height: 20px; }
.guide-token-sm.guide-token-path::before { width: 24px; }

/* ── Stage inline ad slot ─────────────────────────────────────────── */
.stage-inline-ad { flex: 1 1 260px; min-width: 180px; max-width: 480px; padding: 10px 14px; border-radius: var(--radius-lg); background: rgba(255,255,255,0.03); border: 1px solid var(--line); overflow: hidden; }
.adsense-label { display: inline-block; margin-bottom: 6px; color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }

/* ── Statistics panel ────────────────────────────────────────────── */
.stats-section-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 8px; }
.wld-row { display: flex; gap: 8px; margin-bottom: 4px; }
.wld-cell { flex: 1; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.wld-cell .wld-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.wld-cell .wld-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.wld-cell.wld-win .wld-value { color: #4ade80; }
.wld-cell.wld-loss .wld-value { color: #f87171; }
.wld-cell.wld-draw .wld-value { color: var(--accent-2); }
.wld-cell.wld-pts .wld-value { color: #fbbf24; }
.stats-signin-note { font-size: .82rem; color: var(--muted); padding: 8px 0; margin: 0; }
.stats-signin-note a { color: var(--accent-2); text-decoration: underline; }
.personal-best-row { margin-bottom: 10px; }
.personal-best-row-label { font-size: .78rem; color: var(--muted); margin-bottom: 4px; }

/* ── Leaderboard preview ─────────────────────────────────────────── */
.lb-preview-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.lb-preview-row:last-child { border-bottom: none; }
.lb-rank { font-weight: 700; width: 20px; color: var(--muted); flex-shrink: 0; }
.lb-rank.gold { color: #f59e0b; }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #b45309; }
.lb-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-size: .75rem; color: var(--muted); }
.lb-preview-more { display: block; text-align: right; font-size: .78rem; color: var(--accent-2); margin-top: 8px; text-decoration: none; }
.lb-preview-more:hover { text-decoration: underline; }
.lb-preview-empty { font-size: .82rem; color: var(--muted); padding: 8px 0; margin: 0; }

/* ── About panel cards ───────────────────────────────────────────── */
.panel-card { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; margin-bottom: 14px; }
.panel-card h3 { margin: 0 0 10px; color: var(--text); font-size: .95rem; }
.panel-card p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.6; }
.other-games-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 0; }
.other-game-item { display: flex; flex-direction: column; gap: 2px; }
.other-game-item a { font-weight: 600; color: var(--text); }
.other-game-item a:hover { color: var(--accent-2); }
.other-game-item span { font-size: .8rem; color: var(--muted); }

/* ── Contact block ───────────────────────────────────────────────── */
.panel-contact { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.panel-contact > span { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; color: var(--text); }
.panel-contact p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.6; }
.panel-contact a { color: #8ab4ff; text-decoration: none; }
.panel-contact a:hover { text-decoration: underline; }
.email-image-link { display: inline-flex; align-items: center; margin-top: 8px; border-radius: 12px; }
.email-image { display: block; max-width: min(100%, 365px); height: auto; }

/* ── Social links with SVG icons ─────────────────────────────────── */
.social-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
