:root {
    --game-accent: #f0b429;
    --game-accent-dim: rgba(240, 180, 41, 0.15);
    --game-surface-2: #141c28;
    --game-topbar-h: 3.25rem;
    --game-stats-h: 3.5rem;
    --game-sidebar-w: 17.5rem;
    --game-viewport-toolbar-h: 3rem;
    --font-fa: "Vazirmatn", "Segoe UI", system-ui, sans-serif;
    --game-bg-gradient:
        radial-gradient(ellipse 85% 55% at 100% 0%, rgba(99, 102, 241, 0.14) 0%, transparent 52%),
        radial-gradient(ellipse 70% 45% at 0% 100%, rgba(240, 180, 41, 0.1) 0%, transparent 48%),
        radial-gradient(ellipse 120% 80% at 50% -20%, #1e3a5f 0%, var(--bg) 55%);
    --game-panel-shadow: 0 10px 32px rgba(0, 0, 0, 0.32);
    --game-ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
}

html[data-theme="light"] {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --border: #d8e0ec;
    --text: #1a2332;
    --muted: #5c6b82;
    --game-surface-2: #eef2f8;
    --game-accent: #c9920a;
    --game-accent-dim: rgba(201, 146, 10, 0.12);
    --game-bg-gradient:
        radial-gradient(ellipse 85% 55% at 100% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 52%),
        radial-gradient(ellipse 70% 45% at 0% 100%, rgba(240, 180, 41, 0.12) 0%, transparent 48%),
        radial-gradient(ellipse 120% 80% at 50% -20%, #dce8f8 0%, var(--bg) 55%);
    --game-panel-shadow: 0 10px 28px rgba(26, 35, 50, 0.1);
}

@media (prefers-color-scheme: light) {
    html[data-theme="system"] {
        --bg: #f4f6fa;
        --surface: #ffffff;
        --border: #d8e0ec;
        --text: #1a2332;
        --muted: #5c6b82;
        --game-surface-2: #eef2f8;
        --game-accent: #c9920a;
        --game-accent-dim: rgba(201, 146, 10, 0.12);
        --game-bg-gradient:
            radial-gradient(ellipse 85% 55% at 100% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 52%),
            radial-gradient(ellipse 70% 45% at 0% 100%, rgba(240, 180, 41, 0.12) 0%, transparent 48%),
            radial-gradient(ellipse 120% 80% at 50% -20%, #dce8f8 0%, var(--bg) 55%);
        --game-panel-shadow: 0 10px 28px rgba(26, 35, 50, 0.1);
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.game-body,
body.login-body {
    font-family: var(--font-fa);
    margin: 0;
    min-height: 100dvh;
    background: var(--game-bg-gradient);
}

/* —— Login (game shell, no nav) —— */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow-x: clip;
    min-height: 100dvh;
}

.login-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

.login-card {
    width: 100%;
    margin-bottom: 0;
    padding: 2rem 1.75rem 1.85rem;
    border-color: color-mix(in srgb, var(--game-accent) 28%, var(--border));
}

.login-brand { text-align: center; margin-bottom: 1.75rem; }
.login-brand h1 {
    margin: 0.5rem 0 0.25rem;
    font-size: 1.55rem;
    letter-spacing: -0.02em;
}
.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.55rem;
    background: linear-gradient(145deg, var(--game-accent-dim), color-mix(in srgb, var(--game-accent) 25%, transparent));
    color: var(--game-accent);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(240, 180, 41, 0.2);
}

.login-form .field { max-width: none; }
.login-form .field input {
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login-form .field input:focus {
    border-color: color-mix(in srgb, var(--game-accent) 55%, var(--border));
    box-shadow: 0 0 0 3px var(--game-accent-dim);
}
.btn-block { width: 100%; text-align: center; margin-top: 0.5rem; }
.login-submit {
    margin-top: 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(240, 180, 41, 0.25);
}
.login-error {
    color: #ff6b6b;
    font-size: 0.875rem;
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.25);
}
.login-hint { font-size: 0.8rem; margin-top: 1.25rem; text-align: center; }

.no-journey-panel {
    max-width: 420px;
    margin: 1rem auto;
    text-align: center;
}

.no-journey-panel .panel-head h2 {
    font-size: 1.2rem;
}

/* —— Game shell —— */
.game-body {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: clip;
}

.game-ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.game-ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(72px);
    opacity: 0.5;
    animation: game-ambient-drift 18s ease-in-out infinite alternate;
}

.game-ambient-orb-a {
    width: min(55vw, 320px);
    height: min(55vw, 320px);
    background: #6366f1;
    top: -8%;
    right: -12%;
}

.game-ambient-orb-b {
    width: min(50vw, 280px);
    height: min(50vw, 280px);
    background: #f0b429;
    bottom: 12%;
    left: -15%;
    animation-delay: -6s;
    opacity: 0.35;
}

.game-ambient-orb-c {
    width: min(40vw, 220px);
    height: min(40vw, 220px);
    background: #38bdf8;
    top: 38%;
    left: 35%;
    animation-delay: -11s;
    opacity: 0.22;
}

@keyframes game-ambient-drift {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(-12px, 16px) scale(1.06); }
}

.game-stats-bar {
    position: sticky;
    top: var(--game-topbar-h);
    z-index: 20;
    min-height: var(--game-stats-h);
    background: color-mix(in srgb, var(--game-surface-2) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid color-mix(in srgb, var(--game-accent) 25%, var(--border));
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.game-viewport-stats.game-stats-bar,
.game-viewport-stats {
    position: relative;
    top: auto;
    z-index: 5;
    min-height: var(--game-stats-h);
    background: color-mix(in srgb, var(--game-surface-2) 92%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid color-mix(in srgb, var(--game-accent) 25%, var(--border));
    border-bottom: none;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
}

.game-viewport-stats .stats-bar-inner {
    max-width: none;
    padding-inline: 1rem;
}

.stats-bar-inner {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    max-width: 960px;
    margin: 0 auto;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.55rem;
    background: color-mix(in srgb, var(--game-accent-dim) 80%, var(--surface));
    border: 1px solid rgba(240, 180, 41, 0.35);
    border-radius: 12px;
    min-width: 0;
    transition: transform 0.2s var(--game-ease-spring), box-shadow 0.2s ease;
}

.stat-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(240, 180, 41, 0.12);
}

.stat-chip-icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: block;
    border-radius: 10px;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: 1.35rem 1.35rem;
    mask-size: 1.35rem 1.35rem;
}

:is(.stat-chip, .game-sidebar-score-item)[data-slug="resources"] .stat-chip-icon {
    background-color: #a5b4fc;
    -webkit-mask-image: url("/images/game/stats/resources.svg");
    mask-image: url("/images/game/stats/resources.svg");
}

:is(.stat-chip, .game-sidebar-score-item)[data-slug="morale"] .stat-chip-icon {
    background-color: #f0b429;
    -webkit-mask-image: url("/images/game/stats/morale.svg");
    mask-image: url("/images/game/stats/morale.svg");
}

:is(.stat-chip, .game-sidebar-score-item)[data-slug="trust"] .stat-chip-icon {
    background-color: #7dd3fc;
    -webkit-mask-image: url("/images/game/stats/trust.svg");
    mask-image: url("/images/game/stats/trust.svg");
}

:is(.stat-chip, .game-sidebar-score-item)[data-slug="health"] .stat-chip-icon {
    background-color: #6ee7a0;
    -webkit-mask-image: url("/images/game/stats/health.svg");
    mask-image: url("/images/game/stats/health.svg");
}

html[data-theme="light"] :is(.stat-chip, .game-sidebar-score-item)[data-slug="resources"] .stat-chip-icon {
    background-color: #6366f1;
}

html[data-theme="light"] :is(.stat-chip, .game-sidebar-score-item)[data-slug="morale"] .stat-chip-icon {
    background-color: #c9920a;
}

html[data-theme="light"] :is(.stat-chip, .game-sidebar-score-item)[data-slug="trust"] .stat-chip-icon {
    background-color: #0284c7;
}

html[data-theme="light"] :is(.stat-chip, .game-sidebar-score-item)[data-slug="health"] .stat-chip-icon {
    background-color: #16a34a;
}

.stat-chip-text {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.stat-chip-name {
    font-size: 0.65rem;
    color: var(--muted);
    display: block;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-chip-critical {
    animation: stat-critical-pulse 1.2s ease-in-out infinite;
    border: 1px solid rgba(239, 68, 68, 0.65);
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
}

.stat-chip-critical .stat-chip-value {
    color: #f87171;
}

.stat-chip-critical .stat-chip-icon {
    filter: saturate(1.4);
}

@keyframes stat-critical-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.answer-card-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.35);
}

.answer-unaffordable {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #f87171;
    font-weight: 600;
}

.game-flash-warn {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.crisis-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.crisis-modal {
    max-width: 28rem;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid rgba(239, 68, 68, 0.45);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.crisis-modal h2 {
    margin: 0 0 1rem;
    color: #f87171;
}

.crisis-event-card {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.crisis-event-card:last-of-type {
    border-bottom: none;
}

.crisis-modal .crisis-event-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    color: var(--text);
}

.crisis-modal .crisis-event-card p {
    margin: 0 0 0.75rem;
    color: var(--muted);
    line-height: 1.55;
}

.crisis-dismiss {
    display: block;
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.8rem 1.25rem;
    border: 1px solid color-mix(in srgb, var(--game-accent) 65%, #b8860b);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    color: #1a1200;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--game-accent) 92%, #fff) 0%,
        var(--game-accent) 48%,
        color-mix(in srgb, var(--game-accent) 78%, #a86f00) 100%
    );
    box-shadow:
        0 6px 22px rgba(240, 180, 41, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition:
        transform 0.2s var(--game-ease-spring),
        box-shadow 0.2s ease,
        filter 0.2s ease,
        border-color 0.2s ease;
}

.crisis-dismiss:hover {
    transform: translateY(-2px);
    border-color: var(--game-accent);
    box-shadow:
        0 10px 28px rgba(240, 180, 41, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    filter: brightness(1.04);
}

.crisis-dismiss:active {
    transform: translateY(0);
    box-shadow: 0 4px 14px rgba(240, 180, 41, 0.28);
}

.crisis-dismiss:focus-visible {
    outline: 2px solid var(--game-accent);
    outline-offset: 3px;
}

html[data-theme="light"] .crisis-dismiss {
    color: #fff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.game-over-panel {
    text-align: center;
    padding: 2rem 1.5rem;
}

.game-over-defeat .game-over-icon {
    color: #f87171;
}

.game-over-defeat h1 {
    color: #f87171;
}

.game-over-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.game-over-lead {
    font-size: 1.05rem;
    margin: 0.75rem 0 1rem;
}

.game-over-stats {
    list-style: none;
    padding: 0;
    margin: 1.5rem auto 0;
    max-width: 16rem;
    text-align: right;
}

.game-over-stats li {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.game-over-stats li.critical strong {
    color: #f87171;
}

.stat-chip-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--game-accent);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

@media (max-width: 380px) {
    .stats-bar-inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.game-main {
    flex: 1;
    padding: 1rem 1rem 0.5rem;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.game-shell .game-viewport-content.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 0.65rem 1rem 0.35rem;
    width: 100%;
}

.game-main:has(.stages-map-panel) {
    max-width: min(960px, 100%);
    padding: 0.65rem 0.75rem 0.5rem;
}

/* —— Game shell (sidebar + viewport) —— */
.game-shell-body {
    overflow-x: clip;
}

.game-shell-body:has(.game-map-canvas) {
    overflow: hidden;
    height: 100dvh;
}

.game-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, var(--game-sidebar-w));
    min-height: 100dvh;
    position: relative;
    z-index: 1;
    width: 100%;
}

.game-shell:has(.game-map-canvas) {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.game-viewport {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    min-width: 0;
}

.game-shell:has(.game-map-canvas) .game-viewport {
    height: 100%;
    min-height: 0;
    max-height: 100dvh;
    overflow: hidden;
}

.game-viewport-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    min-height: var(--game-viewport-toolbar-h);
    padding: 0.45rem 1rem;
    padding-top: calc(0.45rem + env(safe-area-inset-top, 0));
    border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
    background: color-mix(in srgb, var(--game-surface-2) 55%, transparent);
    backdrop-filter: blur(10px);
}

.game-viewport-toolbar-start {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.game-shell a,
.game-shell button,
.game-toolbar-btn,
.game-sidebar a,
.game-sidebar button {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}

body.is-page-loading a,
body.is-page-loading button {
    -webkit-tap-highlight-color: transparent !important;
}

.game-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--game-accent) 28%, var(--border));
    background: color-mix(in srgb, var(--game-accent-dim) 55%, var(--surface));
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s var(--game-ease-spring);
    outline: none;
}

.game-toolbar-btn:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

.game-toolbar-btn:focus-visible {
    outline: 2px solid var(--game-accent);
    outline-offset: 2px;
}

.game-toolbar-btn:hover {
    border-color: var(--game-accent);
    background: var(--game-accent-dim);
    transform: translateY(-1px);
}

.game-toolbar-btn.is-active {
    color: #1a1200;
    background: linear-gradient(180deg, var(--game-accent), color-mix(in srgb, var(--game-accent) 75%, #fff));
    border-color: var(--game-accent);
    box-shadow: 0 3px 12px rgba(240, 180, 41, 0.28);
}

html[data-theme="light"] .game-toolbar-btn.is-active {
    color: #fff;
}

.game-toolbar-btn-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.game-toolbar-svg {
    display: block;
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
}

.game-stage-label {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    direction: rtl;
    max-width: min(52%, 20rem);
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0));
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0));
    background: linear-gradient(180deg, color-mix(in srgb, var(--game-surface-2) 96%, #000), var(--game-surface-2));
    border-inline-start: 1px solid color-mix(in srgb, var(--game-accent) 22%, var(--border));
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.22);
    min-height: 100dvh;
    box-sizing: border-box;
}

.game-shell:has(.game-map-canvas) .game-sidebar {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.game-sidebar-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-decoration: none;
    color: var(--text);
    background: linear-gradient(90deg, var(--text), color-mix(in srgb, var(--game-accent) 75%, var(--text)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html[data-theme="light"] .game-sidebar-title {
    color: var(--text);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

.game-sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.55rem;
    flex-shrink: 0;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.game-sidebar-profile:hover {
    border-color: color-mix(in srgb, var(--game-accent) 45%, var(--border));
    box-shadow: 0 6px 18px rgba(240, 180, 41, 0.1);
}

.game-sidebar-avatar {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    background: linear-gradient(135deg, var(--game-accent) 0%, #d48806 100%);
    color: #1a1200;
}

html[data-theme="light"] .game-sidebar-avatar {
    color: #fff;
}

.game-sidebar-profile-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.game-sidebar-name {
    font-weight: 700;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-sidebar-journey {
    font-size: 0.72rem;
}

.game-sidebar-brand {
    flex-shrink: 0;
}

.game-sidebar-scores {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 0.2rem;
}

.game-sidebar-scores-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    flex-shrink: 0;
}

.game-sidebar-scores-title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--game-accent);
    letter-spacing: 0.04em;
}

.game-sidebar-toggle-details {
    display: none;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid color-mix(in srgb, var(--game-accent) 35%, var(--border));
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
}

.game-sidebar-toggle-chevron {
    width: 0.85rem;
    height: 0.85rem;
    transition: transform 0.2s ease;
}

.game-sidebar.is-details-expanded .game-sidebar-toggle-chevron {
    transform: rotate(180deg);
}

.game-sidebar-scores-primary {
    flex-shrink: 0;
}

.game-sidebar-details {
    flex-shrink: 0;
}

.game-sidebar-open-btn {
    display: none;
}

.game-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 70;
    border: none;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.game-sidebar-backdrop.is-visible {
    display: block;
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.game-sidebar-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
}

.game-sidebar-progress-bar {
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.game-sidebar-scores-subtitle {
    margin: 0.35rem 0 0.2rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.game-sidebar-scores-subtitle:first-of-type {
    margin-top: 0.15rem;
}

.game-sidebar-scores-badge-warn {
    font-size: 0.62rem;
    font-weight: 700;
    color: #ff8a80;
    background: rgba(255, 82, 82, 0.15);
    border-radius: 6px;
    padding: 0.1rem 0.35rem;
}

.game-sidebar-score-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    flex-shrink: 0;
}

.game-sidebar-score-list-compact {
    margin-bottom: 0;
}

.game-sidebar-score-list-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.22rem;
}

.game-sidebar-scores > .game-sidebar-progress-bar {
    flex-shrink: 0;
}

.game-sidebar-score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    padding: 0.3rem 0.45rem;
    border-radius: 10px;
    background: var(--game-accent-dim);
    border: 1px solid rgba(240, 180, 41, 0.2);
}

.game-sidebar-score-name {
    font-size: 0.66rem;
    color: var(--muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-sidebar-score-val {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--game-accent);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.game-sidebar-score-val-text {
    font-size: 0.72rem;
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-sidebar-score-item-stack {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
}

.game-sidebar-score-detail {
    font-size: 0.64rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.game-sidebar-score-item-critical {
    border-color: rgba(255, 82, 82, 0.45);
    background: rgba(255, 82, 82, 0.12);
}

.game-sidebar-score-item-critical .game-sidebar-score-val {
    color: #ff8a80;
}

.game-sidebar-score-list-stats .stat-chip-icon {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 7px;
    -webkit-mask-size: 0.9rem 0.9rem;
    mask-size: 0.9rem 0.9rem;
}

.game-sidebar-score-list-stats .game-sidebar-score-item-stat {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.15rem;
    padding: 0.35rem 0.25rem;
}

.game-sidebar-score-list-stats .game-sidebar-score-name {
    white-space: normal;
    line-height: 1.15;
}

.game-sidebar-score-item-critical .stat-chip-icon {
    filter: saturate(1.4);
}

.game-sidebar-score-item-warn {
    border-color: rgba(255, 152, 0, 0.45);
    background: rgba(255, 152, 0, 0.1);
}

.game-sidebar-score-badge {
    display: inline-block;
    margin-inline-start: 0.35rem;
    font-size: 0.62rem;
    font-weight: 700;
    color: #ffb74d;
}

.game-sidebar-scores-empty,
.game-sidebar-scores-stage {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.5;
}

.game-sidebar-scores-stage {
    margin-top: 0.35rem;
}

.game-sidebar-guest {
    margin: 0;
    font-size: 0.85rem;
}

.game-sidebar-login {
    display: block;
    text-align: center;
    padding: 0.6rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
}

.game-sidebar-footer {
    margin-top: auto;
    padding-top: 0.5rem;
}

.game-sidebar-map-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 3.15rem;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--game-accent) 45%, var(--border));
    background: linear-gradient(165deg, color-mix(in srgb, var(--game-accent-dim) 90%, var(--surface)), var(--surface));
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.22s var(--game-ease-spring), box-shadow 0.22s ease, border-color 0.2s ease;
}

.game-sidebar-map-btn:hover {
    border-color: var(--game-accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(240, 180, 41, 0.18);
}

.game-sidebar-map-btn.is-active {
    color: #1a1200;
    background: linear-gradient(160deg, #f0c14a, var(--game-accent) 55%, #c9920a);
    border-color: var(--game-accent);
    box-shadow: 0 8px 24px rgba(240, 180, 41, 0.35);
}

html[data-theme="light"] .game-sidebar-map-btn.is-active {
    color: #fff;
}

.game-sidebar-map-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.game-viewport-panels {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.game-viewport-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.game-viewport-panel[hidden] {
    display: none !important;
}

.game-panel-map {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.game-home-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.25rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: linear-gradient(165deg, color-mix(in srgb, var(--surface) 92%, rgba(240, 180, 41, 0.05)), var(--surface));
    box-shadow: var(--game-panel-shadow);
}

.game-home-title {
    margin: 0 0 0.65rem;
    font-size: 1.35rem;
}

.game-home-lead {
    margin: 0 0 1.25rem;
    max-width: 28rem;
    line-height: 1.65;
}

.game-home-cta {
    margin-bottom: 0.85rem;
    min-width: min(100%, 16rem);
}

.game-home-hint {
    margin: 0;
    font-size: 0.82rem;
}

/* —— Stage map: pan/zoom image + route pins —— */
.game-map-canvas {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--game-accent) 22%, var(--border));
    background: #0d1824;
    overflow: hidden;
    box-shadow: var(--game-panel-shadow);
    --map-scale: 1;
    --pin-screen-scale: 1;
    -webkit-user-select: none;
    user-select: none;
}

.game-map-canvas img {
    -webkit-user-drag: none;
    user-drag: none;
}

.game-map-viewport {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    background: #142a38;
}

.game-map-viewport.is-dragging {
    cursor: grabbing;
}

.game-map-transform {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.game-map-layer {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.game-map-img {
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
}

.game-map-empty {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 1rem;
    pointer-events: none;
}

.game-map-pins {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.game-map-pin {
    position: absolute;
    left: var(--pin-x);
    top: var(--pin-y);
    width: 0;
    height: 0;
    overflow: visible;
    transform: translate(-50%, -50%) scale(calc((1 / var(--map-scale, 1)) * var(--pin-screen-scale, 1))) translateZ(0);
    z-index: 2;
    pointer-events: none;
    -webkit-font-smoothing: antialiased;
    backface-visibility: hidden;
}

.game-map-pin-callout {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    overflow: visible;
}

.game-map-pin-anchor {
    position: absolute;
    left: 0;
    top: 0;
    width: 0.55rem;
    height: 0.55rem;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--game-accent);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 2;
}

.stage-current.game-map-pin {
    z-index: 6;
}

.stage-complete.game-map-pin,
.stage-locked.game-map-pin {
    z-index: 2;
}

.stage-complete .game-map-pin-anchor {
    width: 0.42rem;
    height: 0.42rem;
    border-width: 1.5px;
    background: rgba(46, 204, 113, 0.95);
}

.stage-locked .game-map-pin-anchor {
    width: 0.45rem;
    height: 0.45rem;
    border-width: 1.5px;
    background: #64748b;
}

.stage-current .game-map-pin-anchor {
    width: 0.7rem;
    height: 0.7rem;
    border-width: 2.5px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 12px rgba(240, 180, 41, 0.45);
}

.game-map-pin-leader {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

.game-map-pin-leader-line {
    stroke: color-mix(in srgb, var(--game-accent) 75%, #fff);
    stroke-width: 2;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    opacity: 0.9;
}

.stage-locked .game-map-pin-leader-line {
    stroke: rgba(148, 163, 184, 0.85);
}

.game-map-pin-card {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(var(--card-dx, 0px), var(--card-dy, 0px)) translate(-50%, -50%);
    pointer-events: auto;
    z-index: 3;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
}

.game-map-controls {
    position: absolute;
    top: 0.75rem;
    inset-inline-start: 0.75rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.game-map-ctrl {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid color-mix(in srgb, var(--game-accent) 35%, var(--border));
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    transition: background 0.2s ease, transform 0.2s ease;
}

.game-map-ctrl:hover {
    background: var(--game-accent-dim);
    border-color: var(--game-accent);
    transform: translateY(-1px);
}

.game-map-hint {
    position: absolute;
    bottom: 0.5rem;
    inset-inline-end: 0.75rem;
    z-index: 10;
    margin: 0;
    font-size: 0.68rem;
    pointer-events: none;
    opacity: 0.75;
}

.game-map-pin-btn {
    --pin-card-w: 6.75rem;
    --pin-card-num-h: 1.2rem;
    --pin-radius: 10px;
    position: relative;
    display: block;
    width: var(--pin-card-w);
    height: calc(var(--pin-card-w) * 9 / 16 + var(--pin-card-num-h));
    padding: 0;
    border: none;
    border-radius: var(--pin-radius);
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s var(--game-ease-spring), filter 0.25s ease, width 0.25s ease;
}

.stage-current .game-map-pin-btn {
    --pin-card-w: 9rem;
    --pin-card-num-h: 1.4rem;
    --pin-radius: 12px;
}

.stage-complete .game-map-pin-btn {
    --pin-card-w: 5rem;
    --pin-card-num-h: 0.95rem;
    --pin-radius: 8px;
    opacity: 0.9;
}

.stage-locked .game-map-pin-btn {
    --pin-card-w: 5.35rem;
    --pin-card-num-h: 1rem;
    --pin-radius: 8px;
    opacity: 0.95;
}

.game-map-pin-btn:hover:not(:disabled) {
    transform: scale(1.05);
    filter: drop-shadow(0 8px 22px rgba(240, 180, 41, 0.35));
}

.stage-current .game-map-pin-btn:hover:not(:disabled) {
    transform: scale(1.04);
}

.stage-complete .game-map-pin-btn:hover:not(:disabled),
.stage-locked .game-map-pin-btn:hover:not(:disabled) {
    transform: scale(1.02);
}

.game-map-pin-btn:disabled {
    cursor: not-allowed;
}

.stage-current .game-map-pin-thumb {
    box-shadow: 0 0 0 2px var(--game-accent), 0 0 18px rgba(240, 180, 41, 0.28);
    animation: game-map-pin-pulse 2.4s ease-in-out infinite;
}

@keyframes game-map-pin-pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--game-accent), 0 0 0 0 rgba(240, 180, 41, 0.4); }
    50% { box-shadow: 0 0 0 2px var(--game-accent), 0 0 0 9px rgba(240, 180, 41, 0); }
}

.game-map-pin-thumb {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    border-radius: var(--pin-radius, 10px);
    overflow: hidden;
    z-index: 1;
    background: var(--game-surface-2);
    border: 2px solid color-mix(in srgb, var(--game-accent) 30%, var(--border));
    box-sizing: border-box;
}

.stage-current .game-map-pin-thumb {
    border-width: 2.5px;
    border-color: var(--game-accent);
}

.stage-complete .game-map-pin-thumb,
.stage-locked .game-map-pin-thumb {
    border-width: 1.5px;
}

.stage-complete .game-map-pin-thumb {
    border-color: rgba(46, 204, 113, 0.85);
}

.stage-locked .game-map-pin-thumb {
    border-color: rgba(139, 156, 176, 0.55);
}

.game-map-pin-cover {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0;
    object-fit: cover;
    border: none;
    background: var(--game-surface-2);
}

.game-map-pin-cover--fallback {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--game-accent) 25%, transparent), transparent 55%),
        linear-gradient(145deg, var(--game-surface-2), var(--border));
}

.stage-locked .game-map-pin-cover,
.stage-locked .game-map-pin-cover--fallback {
    filter: grayscale(0.75) brightness(0.72);
}

.game-map-pin-num {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    height: var(--pin-card-num-h, 1.2rem);
    padding: 0 0.2rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.7rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: #1a1200;
    background: var(--game-accent);
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.28);
    box-shadow: none;
    box-sizing: border-box;
    pointer-events: none;
}

.stage-current .game-map-pin-num {
    font-size: 0.82rem;
}

.stage-complete .game-map-pin-num {
    font-size: 0.6rem;
    color: #fff;
    background: rgba(46, 204, 113, 0.95);
    border-top-color: rgba(0, 0, 0, 0.2);
}

.stage-locked .game-map-pin-num {
    font-size: 0.62rem;
    color: #e2e8f0;
    background: #475569;
    border-top-color: rgba(0, 0, 0, 0.35);
}

.game-map-pin-status {
    position: absolute;
    z-index: 4;
    top: 0.2rem;
    inset-inline-start: 0.2rem;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    pointer-events: none;
}

.stage-current .game-map-pin-status {
    top: 0.28rem;
    inset-inline-start: 0.28rem;
    width: 1.35rem;
    height: 1.35rem;
}

.stage-complete .game-map-pin-status,
.stage-locked .game-map-pin-status {
    top: 0.15rem;
    inset-inline-start: 0.15rem;
    width: 0.95rem;
    height: 0.95rem;
    border-width: 1px;
}

.game-map-pin-status-icon {
    display: block;
    width: 0.72rem;
    height: 0.72rem;
    shape-rendering: geometricPrecision;
    vector-effect: non-scaling-stroke;
}

.stage-current .game-map-pin-status-icon {
    width: 0.85rem;
    height: 0.85rem;
}

.stage-complete .game-map-pin-status-icon,
.stage-locked .game-map-pin-status-icon {
    width: 0.58rem;
    height: 0.58rem;
}

.game-map-pin-status--current {
    background: var(--game-accent);
    color: #1a1200;
    border-color: var(--game-accent);
}

.game-map-pin-status--complete {
    background: rgba(46, 204, 113, 0.95);
    color: #fff;
    border-color: transparent;
}

.game-map-pin-status--locked {
    background: rgba(55, 68, 84, 0.95);
    color: #c5d0dc;
    border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 900px) {
    .game-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        height: 100vh;
        height: 100dvh;
        height: 100svh;
        max-height: 100svh;
        min-height: 0;
        overflow: hidden;
    }

    .game-shell-body:has(.game-map-canvas),
    .game-shell-body {
        height: 100vh;
        height: 100dvh;
        height: 100svh;
        max-height: 100svh;
        overflow: hidden;
    }

    .game-shell:has(.game-map-canvas) {
        height: 100vh;
        height: 100dvh;
        height: 100svh;
        max-height: 100svh;
    }

    .game-viewport {
        order: 1;
        min-height: 0;
        height: 100%;
        max-height: 100%;
        overflow: hidden;
    }

    .game-shell .game-viewport-content.game-main {
        padding: 0.5rem 0.65rem 0.35rem;
        min-height: 0;
    }

    .game-sidebar-open-btn {
        display: inline-flex;
    }

    .game-sidebar {
        --game-mobile-dock-h: 7.25rem;
        order: 2;
        position: fixed;
        z-index: 75;
        inset-inline: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        height: auto;
        max-height: min(78svh, 520px);
        min-height: 0;
        margin: 0;
        padding: 0.55rem 0.65rem;
        padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0));
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0.35rem;
        border-inline-start: none;
        border-top: 1px solid color-mix(in srgb, var(--game-accent) 28%, var(--border));
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.38);
        transform: translateY(calc(100% - var(--game-mobile-dock-h) - env(safe-area-inset-bottom, 0px)));
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        overflow: hidden;
        visibility: visible;
    }

    .game-shell:has(.game-map-canvas) .game-sidebar {
        height: auto;
        max-height: min(78svh, 520px);
    }

    .game-sidebar.is-drawer-open {
        transform: translateY(0);
    }

    .game-sidebar:not(.is-drawer-open) .game-sidebar-scores-head,
    .game-sidebar:not(.is-drawer-open) .game-sidebar-details,
    .game-sidebar:not(.is-drawer-open) .game-sidebar-progress-head,
    .game-sidebar:not(.is-drawer-open) .game-sidebar-progress-bar,
    .game-sidebar:not(.is-drawer-open) .game-sidebar-scores-subtitle--stats {
        display: none;
    }

    .game-sidebar:not(.is-drawer-open) .game-sidebar-scores {
        overflow: hidden;
    }

    .game-shell:has(.game-map-canvas) .game-sidebar:not(.is-drawer-open) {
        cursor: pointer;
    }

    .game-shell:has(.game-map-canvas) .game-sidebar:not(.is-drawer-open) .game-sidebar-profile,
    .game-shell:has(.game-map-canvas) .game-sidebar:not(.is-drawer-open) button {
        cursor: pointer;
    }

    .game-viewport {
        padding-bottom: calc(var(--game-mobile-dock-h) + env(safe-area-inset-bottom, 0px));
    }

    body.is-sidebar-drawer-open {
        overflow: hidden;
    }

    body.is-sidebar-drawer-open .game-shell {
        position: relative;
        z-index: 100;
    }

    .game-sidebar.is-drawer-open {
        z-index: 110;
    }

    .game-sidebar-brand {
        display: none;
    }

    .game-sidebar-profile {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }

    .game-sidebar-scores {
        display: flex;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .game-sidebar-toggle-details {
        display: inline-flex;
    }

    .game-sidebar-details {
        display: none;
    }

    .game-sidebar.is-details-expanded .game-sidebar-details {
        display: block;
    }

    .game-sidebar-score-list-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.35rem;
    }

    .game-sidebar-score-list-stats .game-sidebar-score-item-stat {
        padding: 0.3rem 0.2rem;
    }

    .game-sidebar-score-list-stats .game-sidebar-score-name {
        font-size: 0.58rem;
    }

    .game-sidebar-score-list-stats .game-sidebar-score-val {
        font-size: 0.72rem;
    }

    .game-sidebar-score-list-stats .stat-chip-icon {
        width: 1.35rem;
        height: 1.35rem;
        -webkit-mask-size: 0.82rem 0.82rem;
        mask-size: 0.82rem 0.82rem;
    }

    .game-toolbar-btn {
        width: 2.75rem;
        height: 2.75rem;
        min-width: 44px;
        min-height: 44px;
    }

    .game-viewport-toolbar {
        padding-inline: 0.65rem;
        gap: 0.5rem;
    }

    .game-stage-label {
        max-width: 38%;
        font-size: 0.7rem;
        flex: 1;
        min-width: 0;
        text-align: end;
    }

    .game-map-canvas {
        border-radius: 14px;
    }

    .game-map-hint {
        display: none;
    }

    .game-map-controls {
        bottom: calc(var(--game-mobile-dock-h) + 0.35rem + env(safe-area-inset-bottom, 0px));
    }
}

/* Account/settings: no duplicate sidebar on mobile */
@media (max-width: 900px) {
    .game-page-no-sidebar-scores .game-sidebar {
        display: none;
    }

    .game-page-no-sidebar-scores .game-viewport {
        padding-bottom: 0;
    }

    .game-page-no-sidebar-scores .game-sidebar-open-btn {
        display: none;
    }
}

/* Account/settings: stacked scrollable layout on mobile */
@media (max-width: 900px) {
    .game-shell-body:not(:has(.game-map-canvas)) {
        height: auto;
        max-height: none;
        overflow-x: clip;
        overflow-y: auto;
    }

    .game-shell:not(:has(.game-map-canvas)) {
        grid-template-rows: auto auto;
        height: auto;
        max-height: none;
        min-height: 100svh;
        overflow: visible;
    }

    .game-shell:not(:has(.game-map-canvas)) .game-viewport {
        height: auto;
        max-height: none;
        overflow: visible;
        padding-bottom: 0;
    }

    .game-shell:not(:has(.game-map-canvas)) .game-sidebar {
        position: relative;
        order: 2;
        transform: none;
        visibility: visible;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid color-mix(in srgb, var(--game-accent) 22%, var(--border));
    }

    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-open-btn {
        display: none;
    }

    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-backdrop {
        display: none !important;
    }

    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-details,
    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-scores-head,
    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-progress-head,
    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-progress-bar,
    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-scores-subtitle--stats {
        display: block;
    }

    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-brand {
        display: block;
    }

    .game-shell:not(:has(.game-map-canvas)) .game-sidebar-toggle-details {
        display: inline-flex;
    }
}

@media (max-width: 520px) {
    .game-sidebar-score-list-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game-map-pin-btn {
        --pin-card-w: 5.75rem;
        --pin-card-num-h: 1.1rem;
    }

    .stage-current .game-map-pin-btn {
        --pin-card-w: 7.5rem;
        --pin-card-num-h: 1.25rem;
    }

    .stage-complete .game-map-pin-btn {
        --pin-card-w: 4.35rem;
        --pin-card-num-h: 0.9rem;
    }

    .stage-locked .game-map-pin-btn {
        --pin-card-w: 4.65rem;
        --pin-card-num-h: 0.92rem;
    }

    .game-map-pin-num {
        font-size: 0.65rem;
    }

    .stage-current .game-map-pin-num {
        font-size: 0.75rem;
    }

    .stage-complete .game-map-pin-num,
    .stage-locked .game-map-pin-num {
        font-size: 0.58rem;
    }

    .game-viewport-toolbar-start {
        gap: 0.3rem;
    }

    .game-stage-label {
        display: none;
    }
}

@media (min-width: 901px) {
    .game-sidebar-details {
        display: block;
    }

    .game-sidebar-toggle-details {
        display: none;
    }
}

.game-panel {
    background: linear-gradient(165deg, color-mix(in srgb, var(--surface) 92%, #fff 8%), var(--surface));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--game-panel-shadow);
    position: relative;
}

.game-panel[hidden] { display: none !important; }

.panel-head { margin-bottom: 1rem; }
.panel-head h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

/* —— Out of hours —— */
.closed-body {
    min-height: 100dvh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    font-family: var(--font-fa);
    background: var(--game-bg-gradient);
    color: var(--text);
    direction: rtl;
    position: relative;
    overflow: hidden;
}

.closed-scene {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.closed-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
}

.closed-orb-a {
    width: 280px;
    height: 280px;
    background: #6366f1;
    top: -80px;
    left: -40px;
}

.closed-orb-b {
    width: 320px;
    height: 320px;
    background: #f0b429;
    bottom: -100px;
    right: -60px;
    opacity: 0.25;
}

.closed-card {
    position: relative;
    z-index: 1;
    max-width: 420px;
    width: 100%;
    text-align: center;
    padding: 2.25rem 2rem;
    background: linear-gradient(165deg, var(--game-surface-2), var(--surface));
    border: 1px solid var(--game-accent-dim);
    border-radius: 20px;
    box-shadow: var(--game-panel-shadow);
}

html[data-theme="light"] .closed-orb-a {
    opacity: 0.2;
}

html[data-theme="light"] .closed-orb-b {
    opacity: 0.15;
}

html[data-theme="light"] .closed-window {
    background: var(--game-accent-dim);
    border-color: rgba(201, 146, 10, 0.35);
}

.closed-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.closed-card h1 {
    margin: 0 0 0.75rem;
    font-size: 1.35rem;
}

.closed-lead {
    color: var(--muted);
    margin: 0 0 1.25rem;
    line-height: 1.65;
    font-size: 0.95rem;
}

.closed-window {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: rgba(240, 180, 41, 0.08);
    border: 1px solid rgba(240, 180, 41, 0.35);
    border-radius: 12px;
}

.closed-window-label {
    font-size: 0.75rem;
    color: var(--game-accent);
    letter-spacing: 0.02em;
}

.closed-window-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.closed-hint {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0;
}

/* —— Stages list —— */
.stages-map-panel {
    padding: 1rem 1.1rem 1.15rem;
    border-color: color-mix(in srgb, var(--game-accent) 22%, var(--border));
    background: linear-gradient(
        165deg,
        color-mix(in srgb, var(--surface) 88%, rgba(240, 180, 41, 0.06)),
        var(--surface)
    );
}

.stages-map-panel .panel-head {
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.stages-map-panel .panel-head h2 {
    font-size: 1.35rem;
    background: linear-gradient(90deg, var(--text), color-mix(in srgb, var(--game-accent) 70%, var(--text)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html[data-theme="light"] .stages-map-panel .panel-head h2 {
    color: var(--text);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
}

.stages-map-panel .panel-head .muted {
    font-size: 0.88rem;
    line-height: 1.5;
}

.stages-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stages-grid-item {
    min-width: 0;
    animation: game-card-in 0.5s var(--game-ease-spring) backwards;
}

.stages-grid-item:nth-child(1) { animation-delay: 0.03s; }
.stages-grid-item:nth-child(2) { animation-delay: 0.06s; }
.stages-grid-item:nth-child(3) { animation-delay: 0.09s; }
.stages-grid-item:nth-child(4) { animation-delay: 0.12s; }
.stages-grid-item:nth-child(5) { animation-delay: 0.15s; }
.stages-grid-item:nth-child(n+6) { animation-delay: 0.18s; }

@keyframes game-card-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stage-grid-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    min-height: unset;
    text-decoration: none;
    color: inherit;
    background: linear-gradient(100deg, var(--surface), color-mix(in srgb, var(--game-surface-2) 40%, var(--surface)));
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    transition:
        border-color 0.25s ease,
        transform 0.28s var(--game-ease-spring),
        box-shadow 0.28s ease;
}

a.stage-grid-card:hover {
    border-color: color-mix(in srgb, var(--game-accent) 55%, var(--border));
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 14px 36px rgba(240, 180, 41, 0.16);
}

.stage-current .stage-grid-card {
    border-color: var(--game-accent);
    box-shadow: 0 8px 28px rgba(240, 180, 41, 0.22);
    animation: game-current-pulse 2.8s ease-in-out infinite;
}

@keyframes game-current-pulse {
    0%, 100% { box-shadow: 0 8px 28px rgba(240, 180, 41, 0.2); }
    50% { box-shadow: 0 12px 40px rgba(240, 180, 41, 0.38); }
}

.stage-locked .stage-grid-card-static {
    opacity: 0.58;
}

.stage-complete .stage-grid-card-static {
    border-color: rgba(46, 204, 113, 0.35);
}

.stage-grid-cover {
    position: relative;
    flex: 0 0 auto;
    width: clamp(10rem, 44%, 22rem);
    aspect-ratio: 16 / 9;
    height: auto;
    align-self: center;
    margin: 0.55rem;
    margin-inline-start: 0.55rem;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--game-surface-2), var(--border));
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.stage-grid-cover img {
    width: 100%;
    height: 100%;
    min-height: unset;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.5s var(--game-ease-spring);
}

a.stage-grid-card:hover .stage-grid-cover img {
    transform: scale(1.05);
}

.stage-grid-cover-fallback {
    width: 100%;
    height: 100%;
    min-height: unset;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(240, 180, 41, 0.18), rgba(99, 102, 241, 0.2));
}

.stage-grid-cover-num {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--muted);
    opacity: 0.65;
}

.stage-grid-state-icon {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
}

.stage-current .stage-grid-state-icon {
    background: var(--game-accent);
    color: #1a1200;
    border-color: var(--game-accent);
}

.stage-complete .stage-grid-state-icon {
    background: rgba(46, 204, 113, 0.85);
    color: #fff;
    border-color: transparent;
}

.stage-grid-body {
    padding: 0.9rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.stage-grid-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.stage-grid-level {
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.03em;
}

.stage-grid-tag {
    font-size: 0.62rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: var(--border);
    color: var(--muted);
}

.stage-grid-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stage-grid-cta {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--game-accent);
    font-weight: 600;
    animation: game-cta-nudge 1.6s ease-in-out infinite;
}

@keyframes game-cta-nudge {
    0%, 100% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(-3px); opacity: 0.85; }
}

.stage-grid-state-label {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--muted);
}

@media (min-width: 720px) {
    .stage-grid-cover {
        width: clamp(12rem, 42%, 24rem);
    }

    .stage-grid-title {
        font-size: 1.12rem;
    }
}

@media (max-width: 420px) {
    .stage-grid-cover {
        width: clamp(8.5rem, 38%, 11rem);
        margin: 0.4rem;
        margin-inline-start: 0.4rem;
    }

    .stage-grid-title {
        font-size: 0.95rem;
        -webkit-line-clamp: 2;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-ambient-orb,
    .stage-current .stage-grid-card,
    .stage-grid-cta,
    .stages-grid-item {
        animation: none;
    }

    .stage-grid-cover img,
    a.stage-grid-card,
    .stat-chip,
    .answer-card {
        transition: none;
    }

    .answer-card:hover {
        transform: none;
    }
}

/* legacy path styles (unused) */
.stages-path {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.stages-path-item {
    display: grid;
    grid-template-columns: 2.75rem 1fr;
    gap: 0.85rem;
    padding-bottom: 1.25rem;
    position: relative;
}

.stages-path-item:not(:last-child)::before {
    content: "";
    position: absolute;
    right: 1.35rem;
    top: 2.75rem;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--border), transparent);
}

.stages-path-node {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.65rem;
}

.node-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--border);
    border: 2px solid var(--game-surface-2);
}

.stage-current .node-mark {
    background: var(--game-accent);
    color: #1a1200;
    border-color: var(--game-accent);
}

.stage-complete .node-mark {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.5);
}

.node-pulse {
    animation: node-pulse 2s ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240, 180, 41, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(240, 180, 41, 0); }
}

.stages-path-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.15s, transform 0.15s;
}

a.stages-path-card:hover {
    border-color: var(--game-accent);
    transform: translateY(-2px);
}

.stage-current .stages-path-card {
    border-color: var(--game-accent);
    box-shadow: 0 8px 28px rgba(240, 180, 41, 0.12);
}

.stage-locked .stages-path-card-static {
    opacity: 0.55;
}

.stage-complete .stages-path-card-static {
    border-color: rgba(46, 204, 113, 0.35);
}

.path-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.path-level-num {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.path-tag {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--game-accent-dim);
    color: var(--game-accent);
}

.path-title {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.path-cta {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--game-accent);
}

.path-state-label {
    font-size: 0.8rem;
    color: var(--muted);
}

/* —— Story intro & video player —— */
.level-story .story-header {
    margin-bottom: 1.1rem;
    text-align: center;
}

.level-story .story-header h2 {
    margin: 0.15rem 0 0;
    font-size: 1.35rem;
    line-height: 1.4;
}

.story-player {
    --story-video-max-w: 560px;
    --story-video-max-h: 315px;
    position: relative;
    width: min(100%, var(--story-video-max-w));
    max-width: var(--story-video-max-w);
    margin: 0 auto 1.15rem;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(145deg, #0a0e14 0%, #121a28 50%, #0d1118 100%);
    border: 1px solid rgba(240, 180, 41, 0.28);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 12px 40px rgba(0, 0, 0, 0.45),
        0 0 48px rgba(240, 180, 41, 0.08);
}

html[data-theme="light"] .story-player {
    background: linear-gradient(145deg, #1a2332 0%, #243044 100%);
    border-color: rgba(201, 146, 10, 0.35);
    box-shadow: 0 12px 32px rgba(26, 35, 50, 0.15);
}

.story-player-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    background: rgba(0, 0, 0, 0.55);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
}

.story-player-badge {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: var(--game-accent-dim);
    color: var(--game-accent);
    border: 1px solid rgba(240, 180, 41, 0.35);
}

.story-player-chrome-end {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.story-player-status {
    font-size: 0.72rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    direction: ltr;
    text-align: left;
}

.story-ctrl-btn--icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e8eef7;
    flex-shrink: 0;
}

.story-ctrl-btn--icon:hover {
    background: rgba(240, 180, 41, 0.18);
    border-color: rgba(240, 180, 41, 0.4);
    color: var(--game-accent);
}

.story-ctrl-btn--icon.is-active {
    background: rgba(240, 180, 41, 0.22);
    border-color: rgba(240, 180, 41, 0.5);
    color: var(--game-accent);
}

.story-ctrl-btn--icon .story-ctrl-svg {
    width: 1.15rem;
    height: 1.15rem;
}

.story-player-screen {
    position: relative;
    width: 100%;
    max-width: var(--story-video-max-w);
    max-height: min(var(--story-video-max-h), 50vh);
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    background: #000;
}

.story-video {
    width: 100%;
    height: 100%;
    max-width: var(--story-video-max-w);
    max-height: min(var(--story-video-max-h), 50vh);
    display: block;
    object-fit: contain;
    background: #000;
    cursor: pointer;
}

.story-video::-webkit-media-controls {
    display: none !important;
}

.story-player-tap-play {
    position: absolute;
    inset: 0;
    z-index: 2;
    margin: auto;
    width: 3.5rem;
    height: 3.5rem;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    border: 2px solid rgba(240, 180, 41, 0.5);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease, opacity 0.2s ease;
}

.story-player-tap-play:hover {
    transform: scale(1.06);
    background: rgba(240, 180, 41, 0.25);
}

.story-player-tap-play[hidden] {
    display: none !important;
}

.story-player-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.72);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    direction: ltr;
}

.story-ctrl-btn {
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.story-ctrl-btn:active {
    transform: scale(0.97);
}

.story-ctrl-btn--skip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 2.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e8eef7;
}

#story-btn-back {
    justify-self: start;
}

#story-btn-forward {
    justify-self: end;
}

.story-ctrl-btn--skip:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(240, 180, 41, 0.4);
}

.story-ctrl-skip-sign {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    color: var(--game-accent);
    font-variant-numeric: tabular-nums;
}

.story-ctrl-skip-num {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    direction: ltr;
}

.story-ctrl-skip-suffix {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    margin-inline-start: 0.05rem;
}

.story-ctrl-btn--play {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(160deg, #f0c14a 0%, var(--game-accent) 55%, #c9920a 100%);
    color: #1a1200;
    box-shadow:
        0 4px 18px rgba(240, 180, 41, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

html[data-theme="light"] .story-ctrl-btn--play {
    color: #1a1200;
}

.story-ctrl-btn--play:hover {
    box-shadow:
        0 6px 22px rgba(240, 180, 41, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.story-ctrl-btn--play.is-playing {
    background: linear-gradient(160deg, #5a6a82 0%, #3d4d66 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.story-ctrl-svg {
    width: 1.65rem;
    height: 1.65rem;
    display: block;
}

.story-ctrl-svg[hidden] {
    display: none !important;
}

.story-player-loader {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.story-player-loader::after {
    content: "";
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(240, 180, 41, 0.2);
    border-top-color: var(--game-accent);
    border-radius: 50%;
    animation: story-spin 0.85s linear infinite;
}

.story-player-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
}

@keyframes story-spin {
    to { transform: rotate(360deg); }
}

.story-player-shade {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 1;
    padding: 0.85rem 1rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65) 0%, transparent 100%);
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.story-player-shade.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.story-player-hint {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.story-player-progress-track {
    height: 6px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    cursor: pointer;
    direction: ltr;
}

.story-player-progress-track:focus-visible {
    outline: 2px solid var(--game-accent);
    outline-offset: -2px;
}

.story-player-progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--game-accent), #e8c547);
    transition: width 0.15s linear;
    box-shadow: 0 0 12px rgba(240, 180, 41, 0.55);
}

.story-player--complete .story-player-chrome {
    border-bottom-color: rgba(46, 204, 113, 0.25);
}

.story-player--complete .story-player-badge {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
    border-color: rgba(46, 204, 113, 0.4);
}

.story-player:fullscreen,
.story-player:-webkit-full-screen {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    background: #000;
}

.story-player:fullscreen .story-player-screen,
.story-player:-webkit-full-screen .story-player-screen {
    flex: 1;
    width: 100%;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    min-height: 0;
}

.story-player:fullscreen .story-video,
.story-player:-webkit-full-screen .story-video {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.story-player:fullscreen .story-player-controls,
.story-player:-webkit-full-screen .story-player-controls {
    flex-shrink: 0;
}

.story-narration {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    line-height: 1.75;
    box-shadow: var(--game-panel-shadow);
}

.story-narration--with-video {
    margin-top: -0.25rem;
    border-color: rgba(240, 180, 41, 0.2);
    background: linear-gradient(180deg, var(--surface) 0%, var(--game-surface-2) 100%);
}

.story-narration-label {
    display: block;
    font-size: 0.7rem;
    color: var(--game-accent);
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.story-narration p {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
}

.story-continue-form:not(.is-visible) {
    display: none;
}

.story-continue-form {
    margin-top: 0.75rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.story-continue-form.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.story-continue-btn {
    padding: 0.95rem 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(240, 180, 41, 0.25);
}

@media (max-width: 480px) {
    .story-player {
        --story-video-max-w: 100%;
        --story-video-max-h: 220px;
        border-radius: 14px;
    }

    .story-player-screen,
    .story-video {
        max-height: min(var(--story-video-max-h), 42vh);
    }

    .story-player-hint {
        font-size: 0.75rem;
    }

    .story-player-controls {
        padding: 0.6rem 0.65rem;
        gap: 0.35rem;
    }

    .story-ctrl-btn--skip {
        padding: 0.4rem 0.6rem;
        min-height: 2.25rem;
    }

    .story-ctrl-skip-suffix {
        display: none;
    }

    .story-ctrl-btn--play {
        width: 3rem;
        height: 3rem;
    }

    .story-ctrl-svg {
        width: 1.45rem;
        height: 1.45rem;
    }
}

.stages-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.stage-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.15s, opacity 0.15s;
}

.stage-card.stage-current {
    border-color: var(--game-accent);
    box-shadow: 0 0 0 1px rgba(240, 180, 41, 0.25);
}

.stage-card.stage-locked {
    opacity: 0.55;
}

.stage-card.stage-complete {
    border-color: rgba(46, 204, 113, 0.4);
}

.stage-num {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    background: var(--border);
}

.stage-current .stage-num {
    background: var(--game-accent);
    color: #1a1200;
}

.stage-complete .stage-num {
    background: rgba(46, 204, 113, 0.25);
    color: var(--success);
}

.stage-info { flex: 1; min-width: 0; }
.stage-title { font-weight: 600; margin: 0; }
.stage-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--border);
    color: var(--muted);
}

.stage-current .stage-badge {
    background: var(--game-accent-dim);
    color: var(--game-accent);
}

.stage-complete .stage-badge {
    background: rgba(46, 204, 113, 0.2);
    color: var(--success);
}

.account-dl {
    margin: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.account-dl dt {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.75rem;
}

.account-dl dt:first-child { margin-top: 0; }

.account-dl dd {
    margin: 0.15rem 0 0;
    font-weight: 500;
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.settings-value { margin: 0.35rem 0 0; font-weight: 600; }

/* —— Top navigation —— */
.game-top-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: var(--game-topbar-h);
    padding: 0.35rem 0.75rem;
    padding-top: calc(0.35rem + env(safe-area-inset-top, 0));
    background: color-mix(in srgb, var(--game-surface-2) 92%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid color-mix(in srgb, var(--game-accent) 22%, var(--border));
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.game-top-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.game-top-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 10px;
    background: var(--game-accent-dim);
    color: var(--game-accent);
    font-size: 0.95rem;
}

.game-top-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.game-top-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 12px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s var(--game-ease-spring);
}

.game-top-nav-link:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--border) 45%, transparent);
}

.game-top-nav-link.is-active {
    color: #1a1200;
    background: linear-gradient(180deg, var(--game-accent), color-mix(in srgb, var(--game-accent) 75%, #fff));
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(240, 180, 41, 0.32);
}

html[data-theme="light"] .game-top-nav-link.is-active {
    color: #fff;
}

.game-nav-icon { font-size: 1rem; line-height: 1; }

.game-profile-wrap {
    position: relative;
    flex-shrink: 0;
    margin-inline-start: auto;
}

.game-profile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--game-accent) 35%, var(--border));
    border-radius: 50%;
    background: color-mix(in srgb, var(--game-accent-dim) 70%, var(--surface));
    color: var(--game-accent);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--game-ease-spring);
}

.game-profile-toggle:hover {
    border-color: var(--game-accent);
    background: var(--game-accent-dim);
    transform: scale(1.04);
}

.game-profile-toggle.is-active,
.game-profile-wrap.is-open .game-profile-toggle {
    color: #1a1200;
    background: linear-gradient(160deg, var(--game-accent), color-mix(in srgb, var(--game-accent) 70%, #fff));
    border-color: var(--game-accent);
    box-shadow: 0 4px 14px rgba(240, 180, 41, 0.35);
}

html[data-theme="light"] .game-profile-toggle.is-active,
html[data-theme="light"] .game-profile-wrap.is-open .game-profile-toggle {
    color: #fff;
}

.game-profile-toggle-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.game-profile-menu {
    position: absolute;
    top: calc(100% + 0.45rem);
    inset-inline-end: 0;
    width: min(18.5rem, calc(100vw - 1.5rem));
    padding: 0.85rem;
    background: linear-gradient(165deg, color-mix(in srgb, var(--surface) 94%, #fff 6%), var(--surface));
    border: 1px solid color-mix(in srgb, var(--game-accent) 28%, var(--border));
    border-radius: 16px;
    box-shadow: var(--game-panel-shadow);
    z-index: 40;
}

.game-profile-menu[hidden] {
    display: none !important;
}

.game-profile-menu-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.game-profile-menu-avatar {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--game-accent) 0%, #d48806 100%);
    color: #1a1200;
}

html[data-theme="light"] .game-profile-menu-avatar {
    color: #fff;
}

.game-profile-menu-name {
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.35;
}

.game-profile-menu-sub {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
}

.game-profile-menu-progress {
    margin-bottom: 0.75rem;
}

.game-profile-menu-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    margin-bottom: 0.45rem;
}

.game-profile-menu-stage {
    margin: 0.45rem 0 0;
    font-size: 0.75rem;
    line-height: 1.4;
}

.game-profile-menu-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}

.game-profile-stat {
    padding: 0.45rem 0.55rem;
    background: var(--game-accent-dim);
    border: 1px solid rgba(240, 180, 41, 0.22);
    border-radius: 10px;
    min-width: 0;
}

.game-profile-stat-name {
    display: block;
    font-size: 0.65rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-profile-stat-val {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--game-accent);
    font-variant-numeric: tabular-nums;
}

.game-profile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
}

.game-profile-menu-link {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    text-align: center;
    font-size: 0.85rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.game-profile-menu-link:hover {
    border-color: var(--game-accent);
    background: var(--game-accent-dim);
}

.game-profile-logout-form {
    margin: 0;
}

.game-profile-logout-btn {
    border-radius: 10px;
    font-size: 0.85rem;
    padding: 0.55rem 0.75rem;
}

.game-profile-menu-empty {
    margin: 0 0 0.65rem;
    font-size: 0.85rem;
}

@media (max-width: 420px) {
    .game-top-brand-text {
        display: none;
    }

    .game-top-nav-link span:not(.game-nav-icon) {
        display: none;
    }

    .game-top-nav-link {
        padding: 0.45rem 0.6rem;
    }
}

.stages-list { list-style: none; margin: 0; padding: 0; }

.stats-empty { padding: 0.5rem 1rem; font-size: 0.875rem; }

/* —— Stage map links —— */
.stage-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.stage-card-link:hover {
    border-color: var(--game-accent);
}

.game-flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.game-flash-success {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.4);
}

.game-flash-error {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
    color: #ff8a8a;
}

/* —— Level play —— */
.level-play .level-eyebrow {
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0 0 0.25rem;
}

.level-narrative {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0.5rem 0 0;
}

.level-question {
    background: linear-gradient(165deg, color-mix(in srgb, var(--surface) 90%, rgba(240, 180, 41, 0.05)), var(--surface));
    border: 1px solid color-mix(in srgb, var(--game-accent) 18%, var(--border));
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.level-question h3 {
    margin: 0.5rem 0 0;
    font-size: 1.1rem;
    line-height: 1.5;
}

.level-phase-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    background: var(--game-accent-dim);
    color: var(--game-accent);
}

.level-hint { font-size: 0.85rem; margin-bottom: 1rem; }

.first-pass-recap {
    background: rgba(61, 139, 253, 0.1);
    border: 1px solid rgba(61, 139, 253, 0.3);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.first-pass-recap p { margin: 0.35rem 0 0; }

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.answer-option-form { margin: 0; }

.answer-card {
    width: 100%;
    text-align: right;
    display: block;
    padding: 1rem 1.1rem;
    background: linear-gradient(100deg, var(--surface), color-mix(in srgb, var(--game-surface-2) 35%, var(--surface)));
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    transition:
        border-color 0.22s ease,
        background 0.22s ease,
        transform 0.22s var(--game-ease-spring),
        box-shadow 0.22s ease;
}

.answer-card:hover {
    border-color: color-mix(in srgb, var(--game-accent) 50%, var(--border));
    background: var(--game-accent-dim);
    transform: translateX(-3px);
    box-shadow: 0 6px 18px rgba(240, 180, 41, 0.1);
}

.answer-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 8px;
    background: var(--border);
    font-weight: 700;
    font-size: 0.85rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.answer-text {
    display: inline;
    font-size: 1rem;
    line-height: 1.5;
    vertical-align: middle;
}

.effect-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.effect-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: var(--bg);
}

.effect-up { color: var(--success); }
.effect-down { color: #ff8a8a; }

.effect-delta { font-weight: 700; }

.effect-none {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.level-back {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.level-back a { color: var(--accent); }

.game-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 20, 25, 0.85);
    padding: 2rem;
    text-align: center;
}

.stats-loading { padding: 0.5rem 1rem; font-size: 0.875rem; }

/* —— Account (modern) —— */
.account-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--game-panel-shadow);
}

.account-avatar {
    flex-shrink: 0;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    background: linear-gradient(135deg, var(--game-accent) 0%, #d48806 100%);
    color: #1a1200;
}

html[data-theme="light"] .account-avatar { color: #fff; }

.account-name {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.account-sub {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.account-progress-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
    box-shadow: var(--game-panel-shadow);
}

.account-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 0.65rem;
}

.account-progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.account-progress-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--game-accent), #e8c547);
    border-radius: 999px;
    transition: width 0.35s ease;
}

.account-current-stage {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.account-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.account-stat-card-wide { grid-column: 1 / -1; }

.account-stat-label {
    font-size: 0.72rem;
    color: var(--muted);
}

.account-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--game-accent);
    font-variant-numeric: tabular-nums;
}

.account-stat-value-sm { font-size: 0.95rem; color: var(--text); }

.account-details-panel .panel-head,
.account-stats-panel .panel-head {
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.account-info-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0 0;
}

.account-info-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    padding: 0.9rem 0.15rem;
    border-bottom: 1px solid var(--border);
}

.account-info-list li:last-child {
    border-bottom: none;
    padding-bottom: 0.15rem;
}

.account-info-list li:first-child {
    padding-top: 0.35rem;
}

.account-info-key {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--muted);
    padding-inline-end: 0.5rem;
}

.account-info-val {
    min-width: 0;
    font-weight: 600;
    text-align: end;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding-inline-start: 0.35rem;
}

.account-info-val.mono {
    font-family: ui-monospace, monospace;
    font-size: 0.9rem;
    direction: ltr;
    unicode-bidi: plaintext;
}

.account-asset-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0.15rem 0 0.1rem;
}

.account-asset-chip {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 7rem;
    padding: 0.6rem 0.75rem;
    background: var(--game-accent-dim);
    border: 1px solid rgba(240, 180, 41, 0.25);
    border-radius: 10px;
}

.account-asset-name {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
}

.account-asset-val {
    font-weight: 700;
    color: var(--game-accent);
}

.account-actions {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.account-action-link {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.account-action-link:hover {
    border-color: var(--game-accent);
    background: var(--game-accent-dim);
}

.account-logout-form {
    margin: 0;
}

.account-logout-btn {
    border-radius: 12px;
}

.account-map-link {
    display: block;
    text-align: center;
    margin-top: 1.25rem;
    padding: 0.85rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.panel-sub {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 400;
}

/* —— Settings —— */
.settings-page .settings-form { margin-top: 0.5rem; }

.settings-section {
    border: none;
    margin: 0 0 1.25rem;
    padding: 0;
}

.settings-section legend {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.35rem;
    padding: 0;
}

.settings-hint {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.theme-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 0.5rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.theme-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-option.is-selected,
.theme-option:has(input:checked) {
    border-color: var(--game-accent);
    background: var(--game-accent-dim);
}

.theme-option-icon { font-size: 1.35rem; }
.theme-option-label { font-size: 0.78rem; font-weight: 500; }

.settings-readonly-value {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.settings-save-btn { margin-top: 0.5rem; }
