﻿/* ==========================================================================
   GLASS MEMORY - patches.css (improvement pack)
   Accessibility, focus visibility, reduced-motion, colorblind cues,
   pause overlay + settings modal. Loaded AFTER style.css so it wins.
   ========================================================================== */

/* Visible keyboard focus on everything interactive */
.btn:focus-visible,
.hud-icon-btn:focus-visible,
.stage-card:focus-visible,
.level-card:focus-visible,
.btn-close-modal:focus-visible,
.path-reveal-action-btn:focus-visible,
.neural-oracle-action-btn:focus-visible {
    outline: 3px solid #00f0ff;
    outline-offset: 3px;
    border-radius: 6px;
}

/* Screen-reader-only helper */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Non-color cue: safe-panel legend + striped memorize banner edge.
   (3D panels keep their red glow; this adds a shape/pattern channel.) */
.memorize-badge::after {
    content: " ◆ SAFE = SOLID ◆ ";
    font-size: 0.65em;
    letter-spacing: 0.2em;
    opacity: 0.85;
}

body.colorblind .memorize-badge::after {
    content: " ◆ SAFE = SOLID + STRIPED ◆ ";
}

/* Pause overlay + boot-error overlay (same full-screen treatment) */
#pause-overlay,
#boot-error {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 10, 25, 0.7);
    backdrop-filter: blur(6px);
}

#pause-overlay.hidden,
#boot-error.hidden {
    display: none;
}

#boot-error {
    z-index: 200;
}

.boot-error-detail {
    font-family: monospace;
    font-size: 0.8em;
    max-width: 420px;
    word-break: break-word;
}

.pause-card {
    text-align: center;
    padding: 32px 48px;
}

.pause-card h2 {
    font-family: var(--font-title, sans-serif);
    letter-spacing: 0.3em;
    margin-bottom: 8px;
}

.pause-card p {
    opacity: 0.8;
    margin-bottom: 20px;
}

/* Settings modal rows */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 4px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.settings-row label {
    font-weight: 600;
}

.settings-row small {
    display: block;
    opacity: 0.7;
    font-weight: 400;
}

/* Reduced motion: kill ambient animation, shake, shimmer, scan */
@media (prefers-reduced-motion: reduce) {
    .ambient-orb,
    .cyber-grid-overlay,
    .scanline-overlay,
    .scan-anim-line,
    .reveal-scan-line,
    .radar-pulse-ring,
    .oracle-pulse-ring,
    .btn-shimmer {
        animation: none !important;
    }
}

body.reduce-motion .ambient-orb,
body.reduce-motion .cyber-grid-overlay,
body.reduce-motion .scanline-overlay,
body.reduce-motion .scan-anim-line,
body.reduce-motion .reveal-scan-line,
body.reduce-motion .radar-pulse-ring,
body.reduce-motion .oracle-pulse-ring,
body.reduce-motion .btn-shimmer,
body.reduce-motion .shake-anim,
body.reduce-motion .shake-error,
body.reduce-motion .pulse-pop {
    animation: none !important;
    transition: none !important;
}

/* Account chip + login modal (auth) */
.account-chip {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.account-chip .btn-text {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#login-email,
#login-password,
#signup-email,
#signup-password,
#signup-confirm {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(2, 6, 23, 0.6);
    color: #fff;
    font-size: 1em;
}

#login-email:focus-visible,
#login-password:focus-visible,
#signup-email:focus-visible,
#signup-password:focus-visible,
#signup-confirm:focus-visible {
    outline: 3px solid #00f0ff;
    outline-offset: 2px;
}

/* The sign-in / create-account groups must stack like the modal column:
   label above input, both full width, eye button inside the field. */
#login-fields,
#signup-fields {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

#login-fields label,
#signup-fields label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin: 2px 0 0;
}

#login-password,
#signup-password,
#signup-confirm {
    padding-right: 46px; /* keep text clear of the eye button */
}

.login-error {
    color: #ff5470;
    font-weight: 600;
    margin: 0 0 12px;
}

.login-info {
    color: #4ade80;
    font-weight: 600;
    margin: 0 0 12px;
}

.turnstile-widget {
    display: flex;
    justify-content: center;
    min-height: 0;
}

.turnstile-widget:empty {
    display: none;
}

/* Password visibility toggle (eye) — sits inside the password field. */
.password-wrap {
    position: relative;
    display: block;
}

.password-eye-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    padding: 4px;
    cursor: pointer;
    line-height: 0;
    color: #64748b;
    opacity: 0.85;
    z-index: 2;
}

.password-eye-btn:hover,
.password-eye-btn:focus-visible {
    color: #00f0ff;
    opacity: 1;
    outline: none;
}

.password-eye-btn svg {
    display: block;
}

#login-password {
    padding-right: 44px;
}

/* ---------------------------- ACCOUNT modal (signed-in users) */
.account-profile-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.account-avatar-box {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    border: 2px solid rgba(0, 240, 255, 0.35);
    background: rgba(18, 33, 66, 0.9);
}

.account-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.account-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title, sans-serif);
    font-weight: 800;
    font-size: 34px;
    color: #00f0ff;
}

.account-id-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.account-id-text > span {
    color: #e2e8f0;
    font-weight: 700;
    font-size: 1.05em;
    word-break: break-word;
}

.account-id-text > small {
    color: #94a3b8;
    word-break: break-all;
}

.account-danger-zone {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 84, 112, 0.25);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn.btn-danger {
    background: rgba(255, 84, 112, 0.16);
    border: 1px solid rgba(255, 84, 112, 0.55);
    color: #ff8aa1;
}

.btn.btn-danger:hover:not(:disabled) {
    background: rgba(255, 84, 112, 0.3);
    color: #ffd4dc;
}

.btn.btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Two-question delete confirmation */
.delete-question {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #cbd5e1;
    font-size: 0.92em;
}

.delete-q-number {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title, sans-serif);
    font-weight: 800;
    font-size: 0.85em;
    color: #ff8aa1;
    background: rgba(255, 84, 112, 0.18);
    border: 1px solid rgba(255, 84, 112, 0.45);
}

.delete-check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
    color: #e2e8f0;
    font-weight: 600;
    cursor: pointer;
}

.delete-check-row input[type='checkbox'] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: #ff5470;
    cursor: pointer;
}

.login-note {
    opacity: 0.7;
    font-size: 0.85em;
    margin-top: 14px;
    text-align: center;
}

/* Memorize timer ring: drains as the timer runs out, turns red when urgent. */
.memorize-ring-wrap {
    position: relative;
    width: 92px;
    height: 92px;
}

.memorize-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.memorize-ring-bg {
    fill: none;
    stroke: rgba(0, 240, 255, 0.18);
    stroke-width: 8;
}

.memorize-ring-fg {
    fill: none;
    stroke: #00f0ff;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 0;
}

.memorize-ring-fg.urgent {
    stroke: #ff5470;
}

.memorize-ring-wrap .memorize-timer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.memorize-timer.urgent {
    color: #ff8fa3;
}

/* Close-call flash: full-screen white blink on escapes. */
.close-call-flash {
    position: fixed;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 9990;
}

.close-call-flash.flash {
    animation: closeCallFlash 0.38s ease-out;
}

@keyframes closeCallFlash {
    0% { opacity: 0; }
    12% { opacity: 0.5; }
    100% { opacity: 0; }
}

/* ==========================================================================
   MAIN MENU — structured card + safe centering across devices
   Root cause of the "endless center panel": .screen-overlay centered with
   align-items:center and no overflow, so on viewports shorter than the card
   the top/bottom clipped symmetrically with no way to scroll. Fixed with:
   scrollable overlay + margin:auto child (centers when it fits, scrolls
   from the top when it doesn't) + height-aware compaction.
   ========================================================================== */
.screen-overlay {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 28px 0;
}

.menu-card {
    margin: auto;
    width: min(90%, 540px);
    max-height: none;
}

/* Short viewports (landscape phones, short laptop windows): compact the
   card so it fits without scrolling where possible. */
@media (max-height: 760px) {
    .screen-overlay {
        padding: 16px 0;
    }

    .menu-card {
        padding: 26px 24px;
        border-radius: 22px;
        gap: 0;
    }

    .badge-pill {
        margin-bottom: 12px;
        font-size: 0.65rem;
    }

    .title-container {
        margin-bottom: 6px;
    }

    .game-title {
        font-size: clamp(2rem, 7vh, 2.8rem);
        letter-spacing: 3px;
    }

    .game-subtitle {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }

    .menu-actions {
        gap: 10px;
        max-width: 340px;
    }

    .menu-actions .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .account-chip {
        margin-bottom: 10px;
    }
}

/* Very short viewports (landscape phones ~360-430px tall): go denser.
   Whatever still doesn't fit scrolls — with visible card edges. */
@media (max-height: 500px) {
    .menu-card {
        padding: 18px 18px;
    }

    .game-title {
        font-size: clamp(1.6rem, 6vh, 2rem);
    }

    .game-subtitle {
        display: none;
    }

    .badge-pill {
        margin-bottom: 8px;
    }

    .menu-actions {
        gap: 8px;
    }

    .menu-actions .btn {
        padding: 10px 16px;
        font-size: 0.88rem;
    }
}

/* Narrow portrait phones */
@media (max-width: 480px) {
    .screen-overlay {
        padding: 16px 0;
    }

    .menu-card {
        width: calc(100% - 28px);
        padding: 30px 20px;
        border-radius: 22px;
    }

    .game-title {
        font-size: 2.3rem;
        letter-spacing: 3px;
    }

    .menu-actions {
        max-width: 100%;
    }
}

/* Large desktop: roomier card, capped so it never feels stretched */
@media (min-width: 1200px) and (min-height: 800px) {
    .menu-card {
        max-width: 580px;
        padding: 52px 44px;
    }
}

/* ----------
   RANKINGS panel (menu) � appended by the leaderboard feature.
   Compact, scrollable; two device lanes (mono readouts, no extra lib).
   ---------- */
#leaderboard-modal .modal-content {
    width: min(92vw, 540px);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#leaderboard-modal .board-status {
    font-size: 11px;
    color: #7d93ad;
    min-height: 14px;
    margin-bottom: 6px;
}
#leaderboard-modal .board-status.error { color: #ff8080; }
#leaderboard-modal ol.board-rows {
    list-style: none;
    margin: 0;
    padding: 0 2px;
    overflow-y: auto;
    min-height: 0;
}
#leaderboard-modal ol.board-rows li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 4px;
    font-size: 13px;
    color: #cde3f5;
    border-bottom: 1px solid rgba(148, 210, 255, 0.08);
}
#leaderboard-modal ol.board-rows li:last-child { border-bottom: none; }
#leaderboard-modal .row-rank {
    width: 30px;
    flex: none;
    color: #7d93ad;
    font-variant-numeric: tabular-nums;
}
#leaderboard-modal .row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#leaderboard-modal .row-lvl {
    flex: none;
    color: #8fd6ff;
    font-variant-numeric: tabular-nums;
}
#leaderboard-modal .own-row .row-name,
#leaderboard-modal .own-row .row-lvl { color: #ffd66b; }
#leaderboard-modal .top-1 .row-rank { color: #ffd66b; }
#leaderboard-modal .top-2 .row-rank { color: #dbe6ff; }
#leaderboard-modal .top-3 .row-rank { color: #ffa06b; }
#leaderboard-modal .row-avatar {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
    flex: none;
    background: rgba(148, 210, 255, 0.15);
}
#leaderboard-modal .board-mine {
    margin-top: 8px;
    font-size: 12px;
    color: #9db4c8;
    min-height: 15px;
}
#leaderboard-modal .board-mine .own-line { color: #ffd66b; }

/* ----------
   Legal links (menu footer) � quiet, small, always reachable.
   ---------- */
.legal-links {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 0.06em;
}
.legal-links a {
    color: #6b7f96;
    text-decoration: none;
    border-bottom: 1px dotted rgba(107, 127, 150, 0.6);
    padding-bottom: 1px;
}
.legal-links a:hover,
.legal-links a:focus-visible {
    color: #9fd4ff;
    border-bottom-color: #9fd4ff;
}
.legal-links span {
    color: #3c4a5d;
}

/* ----------
   Legal viewer overlay (#/legal/privacy|terms): renders the standalone
   legal docs inside the app so navigation never reloads the page.
   ---------- */
.legal-viewer {
    position: fixed;
    inset: 0;
    z-index: 65;
    display: flex;
    flex-direction: column;
    background: #060a18;                 /* matches the docs' own backdrop */
    color: #c9d6e6;
    font: 16px/1.65 system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.legal-viewer.hidden {
    display: none;
}
.legal-viewer-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(156, 212, 255, 0.14);
    padding-top: max(14px, env(safe-area-inset-top));
}
.legal-viewer-title {
    font-family: 'Orbitron', var(--font-title, sans-serif);
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 0.95rem;
    color: #9fd4ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.legal-viewer-spacer {
    flex: 1;
}
.legal-viewer-content {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 20px 64px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.legal-viewer-content h1 {
    color: #e8f2ff;
    font-size: 1.55rem;
    letter-spacing: .06em;
    margin: 0 0 12px;
}
.legal-viewer-content h2 {
    color: #9fd4ff;
    font-size: 1.05rem;
    letter-spacing: .05em;
    margin: 28px 0 8px;
}
.legal-viewer-content a {
    color: #6cc2ff;
}
.legal-viewer-content strong {
    color: #e8f2ff;
}
.legal-viewer-loading {
    color: #6b7f96;
    letter-spacing: 0.08em;
}
@media (max-width: 768px) {
    .legal-viewer-bar {
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }
    .legal-viewer-content {
        padding: 20px 16px 48px;
    }
}

/* ==========================================================================
   RESPONSIVE EXTENSION � notch-safe HUD + phone-lane modals
   Adds safe-area insets (notch/home-bar devices) and compacts modals on
   narrow screens without touching the desktop layout.
   ========================================================================== */
@media (max-width: 768px) {
    .hud-top-bar {
        top: max(14px, env(safe-area-inset-top));
        left: max(14px, env(safe-area-inset-left));
        right: max(14px, env(safe-area-inset-right));
    }

    .abilities-hud-group {
        bottom: max(18px, env(safe-area-inset-bottom));
        right: max(18px, env(safe-area-inset-right));
    }

    .modal-content {
        padding: 22px 18px;
        border-radius: 18px;
    }

    .btn-close-modal {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    #leaderboard-modal .modal-content {
        max-height: 92vh;
    }

    #leaderboard-modal ol.board-rows {
        max-height: 42vh;
    }

    .legal-links {
        gap: 6px;
        font-size: 10px;
    }
}

/* Landscape phones: keep HUD from swallowing the sky */
@media (max-height: 500px) and (max-width: 900px) {
    .hud-pill {
        padding: 6px 12px;
        gap: 8px;
    }

    .hud-progress-wrapper {
        width: 56px;
    }
}

/* ==========================================================================
   MEMORIZE/REVEAL BANNERS � phones: compact + side-anchored so the glass
   path stays readable. Portrait phones lose half of the banner to the
   bridge otherwise; the ring must shrink and the block must hug the edge.
   ========================================================================== */
@media (max-width: 900px) {
    .top-notice-overlay {
        top: max(64px, calc(env(safe-area-inset-top) + 58px));
        left: 12px;
        max-width: min(185px, 40vw);
    }

    .memorize-banner-box,
    .reveal-banner-box {
        /* Seconds-only overlay: no box, no chrome — the number floats */
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding: 0;
        border-radius: 0;
    }

    /* All the write-ups go; only the countdown digit remains */
    .memorize-badge,
    .reveal-badge,
    .memorize-subtext,
    .reveal-subtext,
    .scan-anim-line,
    .reveal-scan-line {
        display: none;
    }

    .memorize-ring-wrap .memorize-timer,
    .memorize-timer.reveal-timer {
        font-size: 2rem;
        font-weight: 900;
        color: #fff;
        text-shadow:
            0 0 10px rgba(0, 240, 255, 0.9),
            0 0 30px rgba(0, 240, 255, 0.5),
            0 2px 6px rgba(0, 0, 0, 0.9);
    }

    .counter-display {
        margin: 0;
    }

    .memorize-badge {
        font-size: 0.6rem;
        letter-spacing: 1.2px;
        gap: 4px;
    }

    /* Seconds only: the ring is gone, just the bare countdown number.
       The wrap keeps a small bbox so the number stays where the ring was. */
    .memorize-ring {
        display: none;
    }

    .memorize-ring-wrap {
        width: 40px;
        height: 44px;
    }
}

/* ==========================================================================
   ABILITY BUTTONS (PATH REVEAL / NEURAL ORACLE) � phones: shrink from the
   fixed min-width pills into tight edge chips so they don't crowd gameplay.
   ========================================================================== */
/* Both sizes: the svg-based icon replaces the old glyph, aligned inline.
   Then the bottom-mobile media collapses the ability chips to icon-only. */
.reveal-icon {
    display: inline-flex;
    align-items: center;
}

.path-reveal-action-btn .reveal-icon {
    color: var(--neon-cyan);
}

@media (max-width: 900px) {
    .abilities-hud-group {
        bottom: max(14px, env(safe-area-inset-bottom));
        right: max(12px, env(safe-area-inset-right));
        gap: 8px;
    }

    .path-reveal-action-btn,
    .neural-oracle-action-btn {
        min-width: 0;
        width: 46px;
        height: 46px;
        padding: 0;
        border-radius: 13px;
        justify-content: center;
        align-items: center;
    }

    /* Icon-only mode: every unclassed span (label + hotkey) and the whole
       status row disappear; the svg diagram alone identifies the ability */
    .path-reveal-action-btn .reveal-btn-title > span:not([class]),
    .neural-oracle-action-btn .reveal-btn-title > span:not([class]) {
        display: none;
    }

    .reveal-status-row,
    .reveal-hotkey,
    .status-indicator-dot {
        display: none;
    }

    .path-reveal-action-btn .reveal-btn-title,
    .neural-oracle-action-btn .reveal-btn-title {
        display: flex;
        font-size: 0;   /* kills stray text spacing */
        gap: 0;
    }

    .reveal-icon svg {
        width: 24px;
        height: 24px;
    }

    /* Hide the decorative pulse rings on chips � pure clutter at this size */
    .radar-pulse-ring,
    .oracle-pulse-ring {
        display: none;
    }

    .path-reveal-action-btn .reveal-btn-title,
    .neural-oracle-action-btn .reveal-btn-title {
        font-size: 0.62rem;
        letter-spacing: 1px;
        gap: 5px;
    }

    /* MOBILE: COLLAPSE TO ICON follows below (icon-only chips). */
    .reveal-icon { font-size: 0.85rem; }

    .reveal-hotkey {
        font-size: 0.55rem;
        letter-spacing: 0.5px;
    }

    .reveal-btn-status {
        font-size: 0.55rem;
        letter-spacing: 1px;
    }

    .reveal-status-row {
        margin-top: 2px;
        gap: 4px;
    }

    .status-indicator-dot {
        width: 5px;
        height: 5px;
    }
}

/* ==========================================================================
   ORACLE MODAL - phones: the cipher sheet must fit the viewport; the wide
   desktop sheet overflows and the riddle text reads one word per line.
   ========================================================================== */
@media (max-width: 900px) {
    .oracle-overlay {
        padding: 14px;
    }

    .oracle-box {
        max-width: none;
        width: 100%;
        max-height: 92vh;
        overflow-y: auto;
        padding: 22px 16px 18px;
        border-radius: 16px;
    }

    .btn-close-oracle {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .oracle-pre-badge {
        font-size: 0.6rem;
        letter-spacing: 2px;
    }

    .oracle-title {
        font-size: 1rem;
        letter-spacing: 1.5px;
    }

    .oracle-body {
        margin: 14px 0 12px;
        padding: 14px 16px;
        border-radius: 12px;
    }

    .oracle-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

/* ==========================================================================
   STAGE SELECT - phones: cards stop wrapping mid-word and the UNLOCKED
   badge re-enters its card (it overhung the right edge before).
   ========================================================================== */
@media (max-width: 900px) {
    .stage-cards-container {
        gap: 10px;
    }

    .stage-card {
        padding: 12px 16px;
        gap: 10px;
        align-items: center;
    }

    .stage-icon-box {
        width: 44px;
        height: 44px;
        font-size: 1.05rem;
        border-radius: 12px;
    }

    .stage-info {
        min-width: 0;
        gap: 8px;
    }

    .stage-info h3 {
        font-size: 0.92rem;
        letter-spacing: 1.5px;
        white-space: nowrap;
    }

    .stage-badge {
        margin-left: auto;
        flex-shrink: 0;
        align-self: center;
        padding: 4px 10px;
        font-size: 0.56rem;
        letter-spacing: 0.5px;
        gap: 4px;
        border-radius: 999px;
    }

    .modal-title {
        font-size: 1.45rem;
    }

    .modal-pre-title {
        font-size: 0.58rem;
    }
}

/* ---------------- maintenance overlay (009) ---------------- */
#maintenance-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 10, 30, 0.92);
    backdrop-filter: blur(6px);
}

#maintenance-overlay .maintenance-gear {
    font-size: 2.6rem;
    color: var(--accent-text, #00f0ff);
    animation: gm-maintenance-spin 4s linear infinite;
    opacity: 0.9;
}

@keyframes gm-maintenance-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#maintenance-overlay .maintenance-copy {
    color: var(--text-dim, #9db2c7);
    font-size: 0.92rem;
    line-height: 1.6;
}

#maintenance-overlay .maintenance-since {
    color: var(--text-dim, #9db2c7);
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    min-height: 1em;
}

#maintenance-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2500;
    text-align: center;
    font-size: 0.68rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    padding: 6px 10px;
    color: #facc15;
    background: rgba(20, 16, 4, 0.88);
    border-bottom: 1px solid rgba(250, 204, 21, 0.35);
    pointer-events: none;
}
