/* ════════════════════════════════════════════════════
   SELF-HOSTED FONTS
   Files live in /vortmaster/fonts/ (and in fonts/ for itch.io ZIP)
   Download from: https://fonts.google.com/download?family=Quicksand
                  https://fonts.google.com/download?family=Playfair+Display
   ════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Quicksand';
    src: url('fonts/quicksand-v37-latin-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Quicksand';
    src: url('fonts/quicksand-v37-latin-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Quicksand';
    src: url('fonts/quicksand-v37-latin-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/playfair-display-v40-latin-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/playfair-display-v40-latin-900.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/playfair-display-v40-latin-700italic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}



/* ════════════════════════════════════════════════════
   VIEWPORT LOCK — prevent horizontal scroll at all sizes
   (itch.io iframe, narrow desktop, mobile portrait/landscape)
   ════════════════════════════════════════════════════ */

html, body {
    overflow-x: hidden;
}

/* ════════════════════════════════════════════════════
           THEME SYSTEM — edit per-theme values here freely
           ════════════════════════════════════════════════════ */

        /* ══════════════════════════════════════════════════
           DESIGN SYSTEM — single source of truth
           ══════════════════════════════════════════════════ */

        :root {
            /* ── Typography scale ── */
            --fs-xs:   0.68rem;
            --fs-sm:   0.80rem;
            --fs-base: 0.90rem;
            --fs-lg:   1.05rem;
            --fs-xl:   1.30rem;
            --fs-2xl:  1.70rem;

            /* ── Spacing scale (8px grid) ── */
            --sp-xs:  4px;
            --sp-sm:  8px;
            --sp-md:  12px;
            --sp-lg:  16px;
            --sp-xl:  20px;
            --sp-2xl: 28px;

            /* ── Brand colors ── */
            --brand-primary:      #7ab3a2;
            --brand-primary-dark: #5a9e8e;
            --brand-primary-glow: rgba(122,179,162,0.35);
            --brand-gold:         #c8a96e;
            --brand-gold-light:   #f5e8c0;

            /* ── Semantic colors ── */
            --color-success:      #3e7e57;
            --color-success-bg:   #d5f5e3;
            --color-destructive:  #d84040;
            --color-destructive-bg: #ffebeb;
            --color-destructive-border: #f5c0c0;
            --color-warning:      #b8860b;
            --color-warning-bg:   #fff8e1;

            /* ── Button hierarchy ── */
            --btn-primary-bg:     #7ab3a2;
            --btn-primary-color:  #ffffff;
            --btn-secondary-bg:   transparent;
            --btn-secondary-color: var(--text-muted);
            --btn-secondary-border: var(--tile-border);
            --btn-destructive-bg: #ffebeb;
            --btn-destructive-color: #d84040;
            --btn-destructive-border: #f5c0c0;

            /* ── Line heights ── */
            --lh-tight:  1.3;
            --lh-base:   1.5;
            --lh-loose:  1.7;

            /* ── Border radius scale ── */
            --radius-sm:  8px;
            --radius-md:  12px;
            --radius-lg:  16px;
            --radius-xl:  20px;
            --radius-2xl: 28px;
        }

        /* DEFAULT — Cotton Candy Pastels (original) */
        :root,
        [data-theme="default"] {
            --bg-color: #E8F5E9;
            --page-bg: #D6E8E3;
            --container-bg: #FFFFFF;
            --accent-blue: #E3F2FD;
            --accent-pink: #FFEBEE;
            --text-main: #4a4a4a;
            --text-muted: #888888;
            --tile-bg: #ffffff;
            --tile-border: #cccccc;
            --tile-text: #555555;
            --success-green: #d5f5e3;
            --error-red: #ffcdd2;
            --header-color: #7ab3a2;
            --status-bg: #E3F2FD;
            --status-text: #5c8cae;
            --shadow-outer: 10px 10px 20px rgba(0,0,0,0.05), -10px -10px 20px rgba(255,255,255,0.8);
            --shadow-inner: inset 4px 4px 8px rgba(0,0,0,0.04), inset -4px -4px 8px rgba(255,255,255,0.9);
            --footer-btn-bg: #E8F5E9;
            --input-bg: #fbfbfb;
            --found-bg: #d5f5e3;
            --found-color: #3e7e57;
            --settings-bg: #fdfdfd;
            --iron: #7d7d7d; --copper: #b87333; --bronze: #cd7f32;
            --silver: #C0C0C0; --gold: #FFD700; --platinum: #E5E4E2;
            --btn-raise:   0 4px 0 rgba(0,0,0,0.10);
            --btn-pressed: 0 1px 0 rgba(0,0,0,0.08);
        }

        /* DARK MODE — Deep charcoal with electric accents */
        [data-theme="dark"] {
            --bg-color: #121318;
            --page-bg: #0f1117;
            --container-bg: #1e2028;
            --accent-blue: #1a2a3a;
            --accent-pink: #2a1a22;
            --text-main: #e8e8f0;
            --text-muted: #7a7a9a;
            --tile-bg: #2a2d38;
            --tile-border: #3a3d50;
            --tile-text: #d0d0e8;
            --success-green: #0d2a1a;
            --error-red: #2a0d10;
            --header-color: #6ecfbb;
            --status-bg: #1a2a3a;
            --status-text: #6ecfbb;
            --shadow-outer: 6px 6px 16px rgba(0,0,0,0.5), -4px -4px 12px rgba(255,255,255,0.03);
            --shadow-inner: inset 3px 3px 7px rgba(0,0,0,0.4), inset -3px -3px 7px rgba(255,255,255,0.04);
            --footer-btn-bg: #2a2d38;
            --input-bg: #252830;
            --found-bg: #0d2a1a;
            --found-color: #4ecf80;
            --settings-bg: #252830;
            --iron: #9d9dbd; --copper: #d09050; --bronze: #e09050;
            --silver: #d0d0e8; --gold: #ffd700; --platinum: #a0f0e8;
            --btn-raise:   0 4px 0 rgba(0,0,0,0.50);
            --btn-pressed: 0 1px 0 rgba(0,0,0,0.50);
        }

        /* NIGHT LIGHT — Warm amber tones, blue-light filtered */
        [data-theme="nightlight"] {
            --bg-color: #2d2010;
            --page-bg: #251810;
            --container-bg: #3a2a18;
            --accent-blue: #3a2e1a;
            --accent-pink: #3d2018;
            --text-main: #f0d8a0;
            --text-muted: #a08858;
            --tile-bg: #4a3820;
            --tile-border: #6a5030;
            --tile-text: #f0d0a0;
            --success-green: #1a2a10;
            --error-red: #2a1008;
            --header-color: #e8a050;
            --status-bg: #3a2e1a;
            --status-text: #e8a050;
            --shadow-outer: 6px 6px 16px rgba(0,0,0,0.5), -4px -4px 12px rgba(255,220,150,0.04);
            --shadow-inner: inset 3px 3px 7px rgba(0,0,0,0.35), inset -3px -3px 7px rgba(255,220,150,0.05);
            --footer-btn-bg: #4a3820;
            --input-bg: #3a2e1a;
            --found-bg: #1a3010;
            --found-color: #90d060;
            --settings-bg: #3a2e1a;
            --iron: #c0a080; --copper: #e0a860; --bronze: #d09840;
            --silver: #d8c898; --gold: #f8d050; --platinum: #f0e0b0;
            --btn-raise:   0 4px 0 rgba(0,0,0,0.40);
            --btn-pressed: 0 1px 0 rgba(0,0,0,0.40);
        }

        /* READING MODE — Soft warm cream, maximum comfort */
        [data-theme="reading"] {
            --bg-color: #f5f0e8;
            --page-bg: #ede5db;
            --container-bg: #fdf8f0;
            --accent-blue: #eae4d8;
            --accent-pink: #f5e8e0;
            --text-main: #3a3028;
            --text-muted: #9a8878;
            --tile-bg: #fdf8f0;
            --tile-border: #d8c8b8;
            --tile-text: #3a3028;
            --success-green: #daf0d8;
            --error-red: #f8ddd8;
            --header-color: #8a6a50;
            --status-bg: #eae4d8;
            --status-text: #6a5840;
            --shadow-outer: 8px 8px 18px rgba(160,140,120,0.15), -8px -8px 18px rgba(255,255,250,0.8);
            --shadow-inner: inset 3px 3px 7px rgba(160,140,120,0.1), inset -3px -3px 7px rgba(255,255,250,0.9);
            --footer-btn-bg: #f5f0e8;
            --input-bg: #fdf8f0;
            --found-bg: #daf0d8;
            --found-color: #3a6a30;
            --settings-bg: #faf5ee;
            --iron: #9a8878; --copper: #b87848; --bronze: #c08040;
            --silver: #a8a898; --gold: #c8a030; --platinum: #b8d8d0;
            --btn-raise:   0 4px 0 rgba(160,140,120,0.22);
            --btn-pressed: 0 1px 0 rgba(160,140,120,0.18);
        }

        body {
            font-family: 'Quicksand', sans-serif;
            background-color: var(--page-bg);
            color: var(--text-main);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            margin: 0;
            padding: var(--sp-xl);
            /* Safe-area insets: respect iPhone notches + Android cutouts */
            padding-top:    max(var(--sp-xl), env(safe-area-inset-top));
            padding-bottom: max(var(--sp-xl), env(safe-area-inset-bottom));
            padding-left:   max(var(--sp-xl), env(safe-area-inset-left));
            padding-right:  max(var(--sp-xl), env(safe-area-inset-right));
            box-sizing: border-box;
            line-height: var(--lh-base);
            font-size: var(--fs-base);
        }

        .game-card {
            background: var(--container-bg);
            padding: 30px;
            border-radius: 32px;
            box-shadow: var(--shadow-outer);
            width: 100%;
            max-width: 640px;
            text-align: center;
            position: relative;
            margin-bottom: 20px;
            transition: opacity 0.18s ease;
        }

        /* ── Screen transition utilities (Stage 1B) ──────────────────────────── */
        /* JS adds/removes these around navigation events (wired in Stage 7).    */
        /* .game-card carries a permanent opacity transition so .vm-fade-out     */
        /* triggers the CSS transition automatically. .vm-fade-in uses a         */
        /* keyframe animation to sidestep the "frame gap" problem: if we toggle  */
        /* a class that sets opacity back to 1, the browser may batch the 0→1   */
        /* change and skip the transition entirely. An animation always plays.   */

        .vm-fade-out {
            opacity: 0 !important;
            pointer-events: none;
        }

        @keyframes vm-fade-in-anim {
            from { opacity: 0; }
            to   { opacity: 1; }
        }

        .vm-fade-in {
            animation: vm-fade-in-anim 0.18s ease forwards;
        }

        .header-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-bottom: 15px;
        }

        /* ── Title treatment ── */
        h1 {
            font-family: 'Playfair Display', Georgia, serif;
            font-size: 2.4rem;
            font-weight: 900;
            margin: 0;
            letter-spacing: 3px;
            line-height: 1;
            /* Default theme gradient */
            background: linear-gradient(135deg, #5a9e8e 0%, #7ab3a2 40%, #a8d8cc 65%, #c8eae4 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            position: relative;
            display: inline-block;
        }

        /* Decorative rule lines either side of title */
        .title-rule {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 4px;
        }
        .title-rule-line {
            flex: 1;
            height: 1px;
            background: linear-gradient(90deg, transparent, var(--header-color), transparent);
            opacity: 0.4;
        }
        .title-subtitle {
            font-family: 'Quicksand', sans-serif;
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 5px;
            text-transform: uppercase;
            color: var(--text-muted);
            opacity: 0.7;
            margin-top: 2px;
        }

        /* ── Rackup Logo — Tile Letters ─────────────────────────────────── */
        .rackup-logo {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            width: 100%;
            padding: 0 28px;
            box-sizing: border-box;
        }
        .rackup-tiles {
            display: flex;
            gap: 8px;
            justify-content: center;
        }
        .rackup-tile {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 44px;
            height: 44px;
            border-radius: 8px;
            font-family: 'Quicksand', sans-serif;
            font-size: 1.4rem;
            font-weight: 700;
            color: #fff;
            letter-spacing: 0;
            box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        }
        .rackup-tile--olive { background: #8B9A46; }
        .rackup-tile--gold  { background: #C8A96E; }
        .rackup-tile--sage  { background: #7AB3A2; }

        .rackup-logo__rule {
            display: none;
        }
        .rackup-logo .title-subtitle {
            margin-top: 2px;
        }

        /* Mobile: smaller tiles */
        @media (max-width: 450px) {
            .rackup-tile {
                width: 38px;
                height: 38px;
                font-size: 1.2rem;
                border-radius: 6px;
            }
            .rackup-tiles {
                gap: 6px;
            }
        }

        /* ── Logo entrance animation ──────────────────────────────────────── */
        /* Triggered by JS adding .rackup-tiles--animating once per session.  */
        /* Without the class, tiles are always fully visible (no side-effect). */
        @keyframes vm-tile-drop {
            0%   { opacity: 0; transform: translateY(-16px) scale(0.85); }
            100% { opacity: 1; transform: translateY(0)     scale(1);    }
        }

        /* Tiles start invisible; animation fills forward to visible */
        .rackup-tiles--animating .rackup-tile {
            opacity: 0;
            animation: vm-tile-drop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
        }

        /* Staggered drop-in — 60ms between each tile */
        .rackup-tiles--animating .rackup-tile:nth-child(1) { animation-delay:   0ms; }
        .rackup-tiles--animating .rackup-tile:nth-child(2) { animation-delay:  60ms; }
        .rackup-tiles--animating .rackup-tile:nth-child(3) { animation-delay: 120ms; }
        .rackup-tiles--animating .rackup-tile:nth-child(4) { animation-delay: 180ms; }
        .rackup-tiles--animating .rackup-tile:nth-child(5) { animation-delay: 240ms; }
        .rackup-tiles--animating .rackup-tile:nth-child(6) { animation-delay: 300ms; }

        /* Reduced motion — snap all tiles in instantly, no stagger */
        @media (prefers-reduced-motion: reduce) {
            .rackup-tiles--animating .rackup-tile {
                animation-duration: 0.01ms;
                animation-delay: 0ms !important;
            }
        }

        /* Per-theme title gradients */
        [data-theme="dark"] h1 {
            background: linear-gradient(135deg, #4ecfbb 0%, #6ef0d8 45%, #a0fff0 70%, #c0fff8 100%);
            -webkit-background-clip: text;
            background-clip: text;
        }
        [data-theme="nightlight"] h1 {
            background: linear-gradient(135deg, #c87820 0%, #e8a050 40%, #f8c878 65%, #fde8b0 100%);
            -webkit-background-clip: text;
            background-clip: text;
        }
        [data-theme="reading"] h1 {
            background: linear-gradient(135deg, #6a4a30 0%, #8a6a50 40%, #b08868 65%, #c8a888 100%);
            -webkit-background-clip: text;
            background-clip: text;
        }

        /* ── Tagline ─────────────────────────────────────────────────────── */
        .mm-tagline {
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text-muted);
            margin-top: 10px;
            letter-spacing: 0.2px;
            padding-top: 10px;
            border-top: 1px solid var(--tile-border);
            width: 100%;
            text-align: center;
            opacity: 0.9;
        }

        /* ── Welcome HUD ─────────────────────────────────────────────────── */
        #welcomeMsg {
            margin-top: 10px;
            width: 100%;
        }

        .welcome-hud {
            display: flex;
            align-items: center;
            width: 100%;
            background: var(--found-bg);
            border: 1.5px solid rgba(122,179,162,0.3);
            border-radius: 12px;
            padding: 8px 0;
            box-shadow: 0 1px 4px rgba(122,179,162,0.12);
            box-sizing: border-box;
        }

        .wh-cell {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            flex: 1;
            gap: 3px;
            padding: 0 6px;
            min-width: 0;
        }

        .wh-val {
            font-size: 0.88rem;
            font-weight: 800;
            color: var(--text-main);
            line-height: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }

        /* Streak value — orange only when active */
        .wh-val--streak-active { color: #d45a18; }

        .wh-lbl {
            font-size: 0.55rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.7px;
            color: var(--text-muted);
            line-height: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* Clickable HUD cells — press flash on tap */
        .wh-cell--link {
            cursor: pointer;
            border-radius: 8px;
            transition: background 0.1s;
        }
        .wh-cell--link:active {
            background: rgba(122, 179, 162, 0.18);
        }

        .wh-sep {
            width: 1px;
            height: 30px;
            background: var(--tile-border);
            flex-shrink: 0;
        }

        /* Dark theme */
        [data-theme="dark"] .welcome-hud {
            background: rgba(78,207,187,0.08);
            border-color: rgba(78,207,187,0.2);
        }
        [data-theme="dark"] .wh-val--streak-active { color: #ff9060; }

        /* Nightlight theme */
        [data-theme="nightlight"] .welcome-hud {
            background: rgba(232,160,80,0.1);
            border-color: rgba(232,160,80,0.28);
        }
        [data-theme="nightlight"] .wh-val--streak-active { color: #ffb060; }

        /* Reading theme */
        [data-theme="reading"] .welcome-hud {
            background: var(--found-bg);
            border-color: rgba(138,106,80,0.22);
        }
        [data-theme="reading"] .wh-val--streak-active { color: #c05818; }

        /* .player-profile removed — name now lives inside #welcomeMsg */

        /* ── Main Menu Cards ─────────────────────────────────────────────── */
        #mainMenu {
            width: 100%;
        }

        .mm-menu {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 12px;
        }

        .mm-section {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-top: 0;
        }

        .mm-btn {
            width: 100%;
            background: var(--container-bg);
            border: 1px solid var(--tile-border);
            border-radius: 6px;
            box-shadow: var(--btn-raise);
            cursor: pointer;
            padding: 0;
            overflow: hidden;
            text-align: left;
            transition: box-shadow 0.08s ease, transform 0.08s ease;
            position: relative;
        }

        .mm-btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--btn-raise);
        }

        .mm-btn:active {
            transform: translateY(2px);
            box-shadow: var(--btn-pressed);
        }

        /* Accent bar — no longer used, kept for safety */
        .mm-accent {
            display: none;
        }

        .mm-inner {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 16px 16px 16px 18px;
        }

        .mm-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            border-radius: 6px;
            font-size: 1.15rem;
            line-height: 1;
            flex-shrink: 0;
            background: var(--tile-border);
            color: #fff;
        }

        /* Per-card icon badge colors */
        .mm-training  .mm-icon { background: #7ab3a2; }
        .mm-quizzes   .mm-icon { background: #c8a96e; }
        .mm-stats     .mm-icon { background: #9b7abf; }
        .mm-settings  .mm-icon { background: #8a9bae; }
        .mm-help-card .mm-icon { background: #e8a44a; }

        .mm-training  .mm-accent { background: #7ab3a2; }
        .mm-quizzes   .mm-accent { background: #c8a96e; }
        .mm-stats     .mm-accent { background: #9b7abf; }
        .mm-settings  .mm-accent { background: #6090d0; }
        .mm-help-card .mm-accent { background: #e8734a; }

        .mm-text {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 3px;
            min-width: 0;
        }

        .mm-title {
            font-size: 1.02rem;
            font-weight: 800;
            color: var(--text-main);
            letter-spacing: 0.2px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .mm-desc {
            font-size: 0.8rem;
            font-weight: 500;
            color: var(--text-muted);
            line-height: 1.45;
        }

        .mm-arrow {
            font-size: 1.2rem;
            color: var(--text-muted);
            opacity: 0.35;
            flex-shrink: 0;
            line-height: 1;
            font-weight: 300;
        }

        .mm-new-badge {
            font-size: 0.58rem;
            font-weight: 800;
            letter-spacing: 0.8px;
            background: #e8734a;
            color: #fff;
            border-radius: 6px;
            padding: 2px 6px;
            text-transform: uppercase;
            align-self: center;
        }

        .mm-util-row {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 6px;
        }

        .mm-util-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
            background: var(--container-bg);
            border: 1px solid var(--tile-border);
            border-radius: 10px;
            box-shadow: var(--btn-raise);
            padding: 8px 16px;
            cursor: pointer;
            font-size: 0.68rem;
            font-weight: 700;
            color: var(--text-muted);
            transition: box-shadow 0.08s ease, transform 0.08s ease, color 0.15s, border-color 0.15s;
        }

        .mm-util-btn:hover  { transform: translateY(-2px); color: var(--brand-primary); border-color: var(--brand-primary); }
        .mm-util-btn:active { transform: translateY(2px);  box-shadow: var(--btn-pressed); }

        /* Touch devices: suppress hover lift so it doesn't stick after tap */
        @media (hover: none) {
            .mm-btn:hover      { transform: none; box-shadow: var(--btn-raise); }
            .mm-util-btn:hover { transform: none; }
        }

        .mm-util-icon { font-size: 1.2rem; line-height: 1; display: flex; align-items: center; justify-content: center; }
        .mm-util-lbl  { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }

        /* ── Primary button upgrades (Training + Daily Quiz) ─────────────────── */
        .mm-training.mm-btn .mm-inner,
        .mm-quizzes.mm-btn  .mm-inner  { padding: 20px 16px 20px 20px; }

        .mm-training.mm-btn .mm-icon,
        .mm-quizzes.mm-btn  .mm-icon   { width: 48px; height: 48px; border-radius: 8px; }

        .mm-training.mm-btn .mm-icon svg,
        .mm-quizzes.mm-btn  .mm-icon svg { width: 26px; height: 26px; }

        .mm-training.mm-btn .mm-title,
        .mm-quizzes.mm-btn  .mm-title  { font-size: 1.18rem; }

        /* ── Footer utility row (#mmFooter) ──────────────────────────────────── */
        #mmFooter { margin-top: 10px; }
        #mmFooter .mm-util-btn { flex: 1; }

        /* Per-button icon accent colours */
        #mmFooter .mm-stats    .mm-util-icon { color: #9b7abf; }
        #mmFooter .mm-settings .mm-util-icon { color: #8a9bae; }
        #mmFooter .mm-help-card .mm-util-icon { color: #e8a44a; }

        /* ── Training page footer (#trainingPageFooter) ───────────────────────── */
        #trainingPageFooter { margin-top: 14px; margin-bottom: 6px; }
        #trainingPageFooter .mm-util-btn { flex: 1; }

        /* Per-button icon accent colours (matches mmFooter) */
        #trainingPageFooter .mm-stats    .mm-util-icon { color: #9b7abf; }
        #trainingPageFooter .mm-settings .mm-util-icon { color: #8a9bae; }
        #trainingPageFooter .mm-help-card .mm-util-icon { color: #e8a44a; }
        .settings-panel {
            background: var(--settings-bg);
            border-radius: 16px;
            padding: 14px 16px;
            margin-bottom: 20px;
            box-shadow: var(--shadow-inner);
            display: grid;
            grid-template-columns: 68px 1fr;
            row-gap: 0;
            column-gap: 12px;
            align-items: start;
        }

        /* Each label cell */
        .sp-label {
            font-size: var(--fs-xs);
            font-weight: 700;
            letter-spacing: 0.8px;
            text-transform: uppercase;
            color: var(--text-muted);
            text-align: right;
            padding: var(--sp-md) 0 10px 0;
            align-self: start;
            white-space: normal;
            word-break: break-word;
            line-height: var(--lh-tight);
        }

        /* Divider between rows — spans both columns */
        .sp-divider {
            grid-column: 1 / -1;
            height: 1px;
            background: linear-gradient(90deg, transparent, var(--tile-border), transparent);
            opacity: 0.5;
            margin: 0;
        }

        /* Controls cell */
        .sp-controls {
            display: flex;
            align-items: flex-start;
            flex-wrap: wrap;
            gap: 6px;
            padding: 8px 0;
            min-width: 0;
            overflow: visible;
        }

        /* ── Segmented control (Length) ─────────────────────────────────── */
        .seg-group {
            display: flex;
            width: 100%;
            border-radius: 4px;
            overflow: hidden;
            box-shadow: var(--shadow-inner);
            border: 1px solid var(--tile-border);
            flex-shrink: 0;
        }

        .seg-group input[type="radio"] { display: none; }

        .seg-group label {
            flex: 1;
            text-align: center;
            padding: 5px 10px;
            font-size: 0.85rem;
            font-weight: 700;
            cursor: pointer;
            background: var(--settings-bg);
            color: var(--text-muted);
            transition: background 0.15s, color 0.15s, box-shadow 0.15s;
            border-right: 1px solid var(--tile-border);
            user-select: none;
            line-height: 1.4;
            white-space: nowrap;
        }

        .seg-group label:last-of-type { border-right: none; }

        .seg-group label:hover {
            background: rgba(122,179,162,0.12);
            color: var(--text-main);
            box-shadow: inset 0 -2px 0 #7ab3a2;
        }

        .seg-group input[type="radio"]:checked + label {
            background: #7ab3a2;
            color: #fff;
        }

        /* ── Pill toggle group (Mode, Game, Level, Vocab) ───────────────── */
        .pill-group {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            min-width: 0;
            width: 100%;
        }

        .pill-group input[type="radio"] { display: none; }

        .pill-group label {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 5px 12px;
            border-radius: 4px;
            font-size: 0.82rem;
            font-weight: 700;
            cursor: pointer;
            border: 1.5px solid var(--tile-border);
            background: var(--settings-bg);
            color: var(--text-muted);
            transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
            user-select: none;
            white-space: nowrap;
            flex: 1;
        }

        .pill-group label:hover {
            border-color: #7ab3a2;
            color: var(--text-main);
        }

        .pill-group input[type="radio"]:checked + label {
            background: #7ab3a2;
            color: #fff;
            border-color: #7ab3a2;
            box-shadow: 0 2px 8px rgba(122,179,162,0.35);
        }

        /* tooltip dotted underline on pill span */
        .pill-group label span[title] {
            cursor: help;
            border-bottom: 1px dotted rgba(255,255,255,0.5);
        }

        .pill-group input[type="radio"]:not(:checked) + label span[title] {
            border-bottom-color: #ccc;
        }

        /* ── Record Stats note ──────────────────────────────────────────── */
        .sp-note {
            font-size: 0.68rem;
            color: var(--text-muted);
            opacity: 0.75;
            margin-top: 2px;
            font-weight: 600;
        }

        /* Hides grid rows without breaking column structure */
        .sp-hidden {
            display: none !important;
        }

        /* ════════════════════════════════════════════════════
           QUIZ SYSTEM
           ════════════════════════════════════════════════════ */

        /* Quiz difficulty row — hidden in non-quiz modes, toggled by JS via sp-hidden */

        /* Quiz status bar override */
        .quiz-status-bar #wordTrackerText {
            background: linear-gradient(135deg, #7ab3a2, #5a9e8e);
            color: #fff;
            font-size: 0.8rem;
            letter-spacing: 0.5px;
        }

        /* Rarity colour coding for found words */
        .found-word.rarity-common   { background: #d5f5e3; color: #2e7d52; }
        .found-word.rarity-uncommon { background: #dce8ff; color: #2952a3; }
        .found-word.rarity-obscure  { background: #f0e6ff; color: #6b21a8; }

        /* Rarity colour coding in solution grid */
        .sol-common   { color: #2e7d52 !important; }
        .sol-uncommon { color: #2952a3 !important; }
        .sol-obscure  { color: #6b21a8 !important; }

        /* Quiz end modal extras */
        .quiz-score-banner {
            background: linear-gradient(135deg, #7ab3a2 0%, #5a9e8e 100%);
            border-radius: 16px;
            padding: 18px;
            margin: 12px 0;
            color: #fff;
        }
        .quiz-score-big {
            font-size: 2.4rem;
            font-weight: 900;
            line-height: 1;
            font-family: 'Playfair Display', serif;
        }
        .quiz-score-sub {
            font-size: 0.78rem;
            font-weight: 700;
            letter-spacing: 1px;
            text-transform: uppercase;
            opacity: 0.85;
            margin-top: 4px;
        }
        .quiz-rarity-breakdown {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            margin: 12px 0;
        }
        .qrb-cell {
            border-radius: 12px;
            padding: 10px 6px;
            text-align: center;
        }
        .qrb-cell.common   { background: #d5f5e3; }
        .qrb-cell.uncommon { background: #dce8ff; }
        .qrb-cell.obscure  { background: #f0e6ff; }
        .qrb-num  { font-size: 1.4rem; font-weight: 900; line-height: 1; }
        .qrb-lbl  { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.75; margin-top: 3px; }
        .qrb-cell.common   .qrb-num { color: #2e7d52; }
        .qrb-cell.uncommon .qrb-num { color: #2952a3; }
        .qrb-cell.obscure  .qrb-num { color: #6b21a8; }

        .btn-quiz-submit {
            width: 100%;
            margin-top: 14px;
            padding: 14px;
            background: linear-gradient(135deg, #7ab3a2, #5a9e8e);
            color: #fff;
            border: none;
            border-radius: 16px;
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            font-family: inherit;
            box-shadow: 0 4px 14px rgba(122,179,162,0.45);
            transition: opacity 0.2s, transform 0.1s;
            letter-spacing: 0.3px;
        }
        .btn-quiz-submit:hover  { opacity: 0.92; }
        .btn-quiz-submit:active { transform: scale(0.98); box-shadow: var(--shadow-inner); }
        .btn-quiz-submit:disabled {
            opacity: 0.5;
            cursor: default;
            background: #ccc;
            box-shadow: none;
        }

        /* Rank reveal pill */
        .rank-pill {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #fff8e1;
            border: 1.5px solid #ffe082;
            border-radius: 20px;
            padding: 6px 16px;
            font-size: 0.9rem;
            font-weight: 700;
            color: #b8860b;
            margin-top: 10px;
        }

        /* Share button */
        .btn-share {
            width: 100%;
            margin-top: 8px;
            padding: 11px;
            background: transparent;
            color: var(--text-muted);
            border: 1.5px solid var(--tile-border);
            border-radius: 14px;
            font-size: 0.88rem;
            font-weight: 700;
            cursor: pointer;
            font-family: inherit;
            transition: border-color 0.15s, color 0.15s;
        }
        .btn-share:hover { border-color: #7ab3a2; color: var(--text-main); }

        /* ── Quiz Selection Screen ──────────────────────────────────────── */
        #quizSelectionPage {
            display: none;
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: var(--page-bg);
            z-index: 200;
            overflow-y: auto;
            box-sizing: border-box;
        }

        .quiz-sel-date {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.82rem;
            font-weight: 700;
            letter-spacing: 0.3px;
            color: #2a6e58;
            background: linear-gradient(135deg, #d4f5e9 0%, #c0eedd 100%);
            border: 1.5px solid #7ab3a2;
            border-radius: 4px;
            padding: 6px 14px;
            margin: 6px 0 16px 0;
        }
        [data-theme="dark"] .quiz-sel-date {
            color: #90e8cc;
            background: linear-gradient(135deg, #0d2a1e 0%, #0a2018 100%);
            border-color: #2a6e58;
        }
        [data-theme="nightlight"] .quiz-sel-date {
            color: #6a4a20;
            background: linear-gradient(135deg, #f5e8d0 0%, #eedfc0 100%);
            border-color: #b08040;
        }

        .quiz-category {
            margin-bottom: 28px;
        }

        .quiz-category-header {
            display: none;
        }

        .quiz-category-icon { font-size: 1.4rem; }

        .quiz-category-title {
            font-size: 1rem;
            font-weight: 800;
            color: var(--text-main);
            letter-spacing: 0.2px;
        }

        .quiz-category-desc {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 600;
            margin-left: auto;
        }

        /* Two-column layout: Explorer left, Scholar right */
        .quiz-diff-columns {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-top: 4px;
        }

        .quiz-diff-col-header {
            font-size: 0.68rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            padding: 6px 10px;
            border-radius: 4px;
            margin-bottom: 8px;
            text-align: center;
        }
        .quiz-diff-col-header.explorer { background: #dce8ff; color: #2952a3; }
        .quiz-diff-col-header.scholar  { background: #f0e6ff; color: #6b21a8; }

        .quiz-diff-col { display: flex; flex-direction: column; gap: 8px; }

        .quiz-card {
            border-radius: 6px;
            padding: 14px;
            cursor: pointer;
            border: 1.5px solid var(--tile-border);
            background: var(--settings-bg);
            box-shadow: var(--btn-raise);
            transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.15s;
            position: relative;
            overflow: hidden;
        }

        .quiz-card:hover {
            transform: translateY(-2px);
            box-shadow: var(--btn-raise);
            border-color: #7ab3a2;
        }

        .quiz-card:active { transform: translateY(2px); box-shadow: var(--btn-pressed); }
        @media (hover: none) {
            .quiz-card:hover { transform: none; box-shadow: var(--btn-raise); }
        }

        /* Completed state */
        .quiz-card.completed {
            border-color: #7ab3a2;
            background: linear-gradient(135deg, rgba(122,179,162,0.08), rgba(122,179,162,0.03));
        }

        .quiz-card.completed::after {
            content: '✓';
            position: absolute;
            top: 10px; right: 12px;
            font-size: 0.8rem;
            font-weight: 900;
            color: #7ab3a2;
        }

        .qcard-top {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
        }

        .qcard-len {
            font-size: 1.3rem;
            font-weight: 900;
            color: var(--text-main);
            line-height: 1;
            font-family: 'Playfair Display', serif;
        }

        .qcard-diff {
            font-size: 0.65rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            padding: 3px 8px;
            border-radius: 4px;
        }

        .qcard-diff.explorer { background: #dce8ff; color: #2952a3; }
        .qcard-diff.scholar  { background: #f0e6ff; color: #6b21a8; }

        .qcard-timer {
            margin-left: auto;
            font-size: 0.7rem;
            font-weight: 700;
            color: var(--text-muted);
        }

        .qcard-status {
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--text-muted);
        }

        .qcard-status.done { color: #7ab3a2; }

        .qcard-score {
            font-size: 1rem;
            font-weight: 800;
            color: #7ab3a2;
        }

        /* Active quiz banner inside game card */
        #quizActiveBanner {
            display: none;
            border-radius: 14px;
            padding: 10px 14px;
            margin-bottom: 12px;
            background: linear-gradient(135deg, #7ab3a2 0%, #5a9e8e 100%);
            color: #fff;
            align-items: center;
            justify-content: space-between;
        }

        .qab-left { display: flex; flex-direction: column; }
        .qab-label {
            font-size: 0.6rem;
            font-weight: 700;
            letter-spacing: 1px;
            text-transform: uppercase;
            opacity: 0.8;
        }
        .qab-detail {
            font-size: 0.9rem;
            font-weight: 800;
            letter-spacing: 0.2px;
        }
        .qab-date {
            font-size: 0.68rem;
            font-weight: 700;
            opacity: 0.75;
        }

        /* Speed quiz countdown */
        #quizCountdown {
            font-size: 1.1rem;
            font-weight: 900;
            font-family: 'Playfair Display', serif;
            letter-spacing: 0.5px;
            padding: 4px 10px;
            background: rgba(255,255,255,0.2);
            border-radius: 8px;
        }
        #quizCountdown.timer-warn {
            background: rgba(220,140,30,0.55);
            animation: timer-pulse-warn 1.8s ease-in-out infinite;
        }

        #quizCountdown.timer-critical,
        #quizCountdown.urgent {
            background: rgba(220,55,35,0.6);
            animation: timer-pulse-crit 0.7s ease-in-out infinite;
        }

        @keyframes timer-pulse-warn {
            0%, 100% { opacity: 1; }
            50%       { opacity: 0.7; }
        }

        @keyframes timer-pulse-crit {
            0%, 100% { transform: scale(1);    opacity: 1; }
            50%       { transform: scale(1.06); opacity: 0.8; }
        }
        #quizHubPage {
            display: none;
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: var(--container-bg);
            z-index: 200;
            overflow-y: auto;
            padding: 20px;
            box-sizing: border-box;
        }

        /* ── Rank submission toast (appears at top of hub after score submit) ── */
        .hub-rank-toast {
            background: var(--brand-primary);
            color: #fff;
            padding: 10px 14px;
            border-radius: 8px;
            font-weight: 700;
            font-size: 0.85rem;
            text-align: center;
            margin-bottom: 12px;
            animation: hubToastIn 0.3s ease;
        }
        .hub-rank-toast.toast-fade-out {
            animation: hubToastOut 0.4s ease forwards;
        }
        @keyframes hubToastIn {
            from { opacity: 0; transform: translateY(-8px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        @keyframes hubToastOut {
            from { opacity: 1; }
            to   { opacity: 0; }
        }

        /* Main tab bar — left-aligned strip */
        .hub-tabs {
            display: flex;
            gap: 0;
            margin: 16px 0 20px 0;
            background: var(--settings-bg);
            border-radius: 12px;
            padding: 4px;
            box-shadow: var(--shadow-inner);
        }
        .hub-tab {
            flex: 1;
            padding: 8px 6px;
            border-radius: 9px;
            border: none;
            background: transparent;
            color: var(--text-muted);
            font-size: 0.78rem;
            font-weight: 700;
            cursor: pointer;
            font-family: inherit;
            transition: all 0.15s;
            text-align: center;
            box-shadow: none;
            white-space: nowrap;
        }
        .hub-tab.active {
            background: #7ab3a2;
            color: #fff;
            box-shadow: 0 2px 8px rgba(122,179,162,0.35);
        }
        .hub-tab:not(.active):hover {
            color: var(--text-main);
            background: var(--tile-border);
        }

        .hub-panel { display: none; }
        .hub-panel.active { display: block; }

        /* Sub-tab row (leaderboard difficulty) — left-aligned, smaller */
        .hub-sub-tabs {
            display: flex;
            gap: 6px;
            margin-bottom: 16px;
        }
        .hub-sub-tab {
            padding: 5px 14px;
            border-radius: 20px;
            border: 1.5px solid var(--tile-border);
            background: transparent;
            color: var(--text-muted);
            font-size: 0.78rem;
            font-weight: 700;
            cursor: pointer;
            font-family: inherit;
            transition: all 0.15s;
            box-shadow: none;
            flex: none;
        }
        .hub-sub-tab.active, .hub-sub-tab:hover {
            background: #7ab3a2;
            color: #fff;
            border-color: #7ab3a2;
        }

        /* Section meta line */
        .hub-meta {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 600;
            margin: 0 0 14px 0;
            line-height: 1.5;
        }

        /* Leaderboard table */
        .lb-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.85rem;
            margin-bottom: 16px;
        }
        .lb-table th {
            text-align: left;
            font-size: 0.65rem;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            color: var(--text-muted);
            padding: 6px 8px;
            border-bottom: 1px solid var(--tile-border);
        }
        .lb-table td {
            padding: 8px 8px;
            border-bottom: 1px solid var(--tile-border);
            font-weight: 600;
            color: var(--text-main);
        }
        .lb-table tr.is-me td { color: #7ab3a2; font-weight: 800; }
        .lb-rank  { font-weight: 900; color: var(--text-muted); width: 28px; }
        .lb-score { font-weight: 800; text-align: right; }

        /* ── Leaderboard Option-A grid ───────────────────────────────────── */
        .lb-grid-wrap {
            margin-bottom: 16px;
        }

        .lb-grid-type-toggle {
            display: flex;
            gap: 6px;
            margin-bottom: 10px;
        }

        .lb-type-btn {
            flex: 1;
            padding: 8px;
            border-radius: 12px;
            border: 1.5px solid var(--tile-border);
            background: var(--settings-bg);
            color: var(--text-muted);
            font-weight: 700;
            font-size: 0.82rem;
            font-family: inherit;
            cursor: pointer;
            transition: all 0.15s;
            text-align: center;
        }
        .lb-type-btn.active {
            background: #7ab3a2;
            border-color: #7ab3a2;
            color: #fff;
        }

        .lb-grid {
            display: grid;
            grid-template-columns: 28px 1fr 1fr;
            gap: 5px;
            align-items: stretch;
        }

        .lb-grid-head {
            font-size: 0.62rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
            padding: 4px 6px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .lb-grid-row-label {
            font-size: 0.75rem;
            font-weight: 800;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 2px 0;
        }

        .lb-grid-cell {
            border-radius: 12px;
            border: 1.5px solid var(--tile-border);
            background: var(--settings-bg);
            padding: 9px 10px;
            cursor: pointer;
            transition: border-color 0.15s, background 0.15s, transform 0.1s;
            min-height: 54px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 2px;
        }
        .lb-grid-cell:hover {
            border-color: #7ab3a2;
            transform: translateY(-1px);
        }
        .lb-grid-cell:active { transform: scale(0.98); }
        .lb-grid-cell.selected {
            border-color: #7ab3a2;
            background: linear-gradient(135deg, rgba(122,179,162,0.12), rgba(122,179,162,0.04));
        }
        .lb-grid-cell.disabled {
            opacity: 0.35;
            cursor: default;
            pointer-events: none;
        }

        .lb-cell-leader {
            font-size: 0.75rem;
            font-weight: 800;
            color: var(--text-main);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .lb-cell-score {
            font-size: 0.68rem;
            font-weight: 700;
            color: #7ab3a2;
        }
        .lb-cell-empty {
            font-size: 0.68rem;
            color: var(--text-muted);
            font-style: italic;
        }

        /* Detail panel below grid */
        .lb-detail-panel {
            border-radius: 14px;
            border: 1.5px solid #7ab3a2;
            padding: 12px;
            margin-top: 4px;
            background: linear-gradient(135deg, rgba(122,179,162,0.07), transparent);
        }
        .lb-detail-header {
            font-size: 0.72rem;
            font-weight: 800;
            color: #7ab3a2;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            margin-bottom: 10px;
        }

        /* History list */
        .hist-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 14px;
            border-radius: 12px;
            background: var(--settings-bg);
            margin-bottom: 8px;
            font-size: 0.85rem;
            font-weight: 600;
        }
        .hist-date  { color: var(--text-muted); font-size: 0.75rem; margin-top: 2px; }
        .hist-score { font-weight: 800; color: #7ab3a2; font-size: 1rem; flex-shrink: 0; margin-left: 10px; }
        .hist-rank  {
            display: inline-block;
            margin-left: 6px;
            font-size: 0.7rem;
            font-weight: 700;
            color: #7ab3a2;
            background: rgba(122,179,162,0.12);
            padding: 1px 6px;
            border-radius: 6px;
        }

        /* ── Scores tab — today's quiz date chip ── */
        .lb-quiz-date-line {
            font-size: 0.72rem;
            font-weight: 700;
            color: #7ab3a2;
            background: rgba(122,179,162,0.12);
            padding: 5px 12px;
            border-radius: 20px;
            display: inline-block;
            margin-bottom: 14px;
        }
        .lb-quiz-date-line:empty { display: none; }

        /* ── History cards (new polished layout) ── */
        .hist-card {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 14px;
            border-radius: 12px;
            background: var(--settings-bg);
            border: 1.5px solid var(--tile-border);
            margin-bottom: 8px;
        }
        .hist-card--today {
            border-color: #7ab3a2;
            background: linear-gradient(135deg, rgba(122,179,162,0.10), rgba(122,179,162,0.03));
        }
        .hist-card-main { flex: 1; min-width: 0; }
        .hist-card-head {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 7px;
        }
        .hist-card-type {
            font-weight: 800;
            font-size: 0.88rem;
            color: var(--text-main);
        }
        .hist-card-date {
            font-size: 0.68rem;
            font-weight: 700;
            color: var(--text-muted);
            white-space: nowrap;
            flex-shrink: 0;
        }
        .hist-card-date--today {
            color: #7ab3a2;
            background: rgba(122,179,162,0.15);
            padding: 2px 8px;
            border-radius: 20px;
            font-size: 0.62rem;
            letter-spacing: 0.5px;
            text-transform: uppercase;
        }
        .hist-card-pills {
            display: flex;
            flex-wrap: wrap;
            gap: 4px;
            margin-bottom: 4px;
        }
        .hist-pill {
            font-size: 0.68rem;
            font-weight: 700;
            color: var(--text-muted);
            background: var(--tile-border);
            padding: 2px 8px;
            border-radius: 20px;
            white-space: nowrap;
        }
        .hist-pill--diff {
            color: #5a9e8e;
            background: rgba(122,179,162,0.15);
        }
        .hist-card-rank { margin-top: 3px; }
        .hist-card-score-col {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            flex-shrink: 0;
        }
        .hist-card-score-num {
            font-weight: 900;
            color: #7ab3a2;
            font-size: 1.35rem;
            line-height: 1;
            font-family: 'Quicksand', sans-serif;
        }
        .hist-card-score-lbl {
            font-size: 0.6rem;
            font-weight: 700;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-top: 2px;
            text-align: right;
        }
        .hub-empty {
            color: var(--text-muted);
            font-size: 0.85rem;
            font-weight: 600;
        }

        /* Rarity stats progress bars */
        .rarity-stat-row { margin-bottom: 16px; }
        .rarity-stat-label {
            display: flex;
            justify-content: space-between;
            font-size: 0.78rem;
            font-weight: 700;
            margin-bottom: 6px;
        }
        .rarity-bar-bg {
            height: 10px;
            border-radius: 6px;
            background: var(--tile-border);
            overflow: hidden;
        }
        .rarity-bar-fill {
            height: 100%;
            border-radius: 6px;
            transition: width 0.6s ease;
        }
        .rarity-bar-fill.common   { background: #4ecb8d; }
        .rarity-bar-fill.uncommon { background: #5b8dee; }
        .rarity-bar-fill.obscure  { background: #a855f7; }

        /* ── Quiz Badge Grid ─────────────────────────────────────────────── */
        .qbadge-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
            margin-top: 4px;
        }

        .qbadge {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            gap: 5px;
            padding: 10px 6px 8px 6px;
            border-radius: 14px;
            cursor: default;
            transition: transform 0.15s;
            position: relative;
        }
        .qbadge:hover { transform: translateY(-2px); }
        .qbadge:hover .qbadge-tooltip { opacity: 1; pointer-events: auto; transform: translateY(0); }

        .qbadge-icon {
            font-size: 1.6rem;
            width: 48px;
            height: 48px;
            border-radius: 13px;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 1;
            /* Earned: replaced per badge via inline style */
        }

        .qbadge-name {
            font-size: 0.6rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            text-align: center;
            line-height: 1.2;
        }

        /* Earned state */
        .qbadge.earned .qbadge-icon {
            box-shadow: 0 3px 10px rgba(0,0,0,0.15);
        }
        .qbadge.earned .qbadge-name { color: var(--text-main); }

        /* Locked state */
        .qbadge.locked .qbadge-icon {
            background: var(--settings-bg) !important;
            border: 2px dashed var(--tile-border) !important;
            filter: grayscale(1);
            opacity: 0.4;
        }
        .qbadge.locked .qbadge-name { color: var(--text-muted); opacity: 0.5; }

        /* Tooltip */
        .qbadge-tooltip {
            position: absolute;
            bottom: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%) translateY(4px);
            white-space: nowrap;
            padding: 6px 10px;
            border-radius: 8px;
            font-size: 0.72rem;
            font-weight: 700;
            color: #fff;
            background: #333;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s, transform 0.2s;
            z-index: 999;
            max-width: 180px;
            white-space: normal;
            text-align: center;
            line-height: 1.3;
        }
        .qbadge-tooltip::after {
            content: '';
            position: absolute;
            top: 100%; left: 50%;
            transform: translateX(-50%);
            border: 5px solid transparent;
            border-top-color: #333;
        }

        /* New-badge flash animation */
        @keyframes badgeEarned {
            0%   { transform: scale(0.6); opacity: 0; }
            60%  { transform: scale(1.15); opacity: 1; }
            100% { transform: scale(1); opacity: 1; }
        }
        .qbadge.just-earned .qbadge-icon {
            animation: badgeEarned 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
        }

        /* ── Quiz history reset modal — must sit above hub page (z:200) ── */
        #quizHubOverlay {
            display: none;
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.35);
            backdrop-filter: blur(4px);
            z-index: 290;
        }
        #quizResetConfirmModal {
            z-index: 300;
        }
        /* ── Nickname prompt modal ──────────────────────────────────────── */
        #nicknameModal .nick-input {
            width: 100%;
            padding: 12px 14px;
            border-radius: 14px;
            border: 1.5px solid var(--tile-border);
            font-family: inherit;
            font-weight: 700;
            font-size: 1rem;
            color: var(--text-main);
            background: var(--input-bg);
            box-shadow: var(--shadow-inner);
            outline: none;
            box-sizing: border-box;
            margin: 12px 0 6px 0;
            text-align: center;
            letter-spacing: 0.3px;
            transition: border-color 0.15s;
        }
        #nicknameModal .nick-input:focus { border-color: #7ab3a2; }
        #nicknameModal {
            z-index: 502; /* must be above .overlay (500) and .modal / #quizModal (501) */
        }
        #nicknameModal .nick-note {
            font-size: 0.75rem;
            color: var(--text-muted);
            font-weight: 600;
            margin: 0 0 18px 0;
        }

        #quizSubHeader {
            display: none;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            background: linear-gradient(135deg, #7ab3a2 0%, #5a9e8e 100%);
            border-radius: 14px;
            padding: 10px 16px;
            margin-bottom: 12px;
        }
        .qsh-left {
            display: flex;
            flex-direction: column;
        }
        .qsh-title {
            font-family: 'Quicksand', sans-serif;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 1.2px;
            text-transform: uppercase;
            color: rgba(255,255,255,0.8);
        }
        .qsh-detail {
            font-size: 0.88rem;
            font-weight: 800;
            color: #fff;
            margin-top: 1px;
            letter-spacing: 0.2px;
        }
        .qsh-date {
            font-size: 0.7rem;
            font-weight: 700;
            color: rgba(255,255,255,0.75);
            letter-spacing: 0.3px;
        }
        .quiz-locked-msg {
            background: var(--settings-bg);
            border: 1.5px solid var(--tile-border);
            border-radius: 16px;
            padding: 20px;
            text-align: center;
            margin: 12px 0;
        }
        .quiz-locked-icon { font-size: 2rem; margin-bottom: 8px; }
        .quiz-locked-title {
            font-weight: 800;
            font-size: 1rem;
            color: var(--text-main);
            margin-bottom: 6px;
        }
        .quiz-locked-sub {
            font-size: 0.82rem;
            color: var(--text-muted);
            font-weight: 600;
            line-height: 1.5;
        }

        /* ── Status bar ─────────────────────────────────────────────────── */
        .status-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin: 16px 0 12px 0;
            padding: 0;
            background: none;
            border-radius: 0;
        }

        /* Left: word-count pill */
        #wordTrackerText {
            display: inline-flex;
            align-items: center;
            font-size: 0.78rem;
            font-weight: 700;
            letter-spacing: 0.4px;
            color: var(--status-text);
            background: var(--status-bg);
            padding: 5px 14px;
            border-radius: 20px;
        }

        /* Right: badge + timer cluster */
        .status-right {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        /* ── Word-building display area ─────────────────────────────────── */
        .display-area {
            min-height: 72px;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            margin-bottom: 4px;
            background: var(--input-bg);
            border-radius: 18px;
            box-shadow: var(--shadow-inner);
            border: 1.5px solid var(--tile-border);
            transition: all 0.3s ease;
            padding: 12px 16px;
        }

        .display-letter {
            font-size: 1.6rem;
            font-weight: 700;
            color: var(--text-main);
            width: 35px;
            height: 44px;
            border-radius: 7px;
            border: 1.5px solid var(--tile-border);
            background: var(--settings-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: border-color 0.15s, background 0.15s;
        }

        .display-letter.active {
            border: 1.5px solid #7ab3a2;
            background: rgba(122,179,162,0.1);
            color: var(--text-main);
            animation: tr-slot-fill 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
        }

        /* Hook Mode Specific Styles */
        .hook-container {
            display: flex;
            align-items: center;
            gap: 12px;
            justify-content: center;
            width: 100%;
        }

        .slot-hook {
            width: 45px;
            height: 50px;
            border: 2px dashed #b0c4de;
            border-radius: 12px;
            background: transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            font-weight: 700;
            color: #555;
            cursor: pointer;
            transition: all 0.15s ease;
        }

        .slot-hook:hover {
            background: rgba(122,179,162,0.12);
            border-color: #7ab3a2;
            border-style: solid;
            transform: scale(1.08);
            box-shadow: 0 4px 12px rgba(122,179,162,0.25);
        }

        .slot-hook.success {
            background: var(--success-green);
            border-color: #3e7e57;
            border-style: solid;
            color: #3e7e57;
            animation: tr-hook-success 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
        }

        .base-word-display {
            display: flex;
            gap: 4px;
            padding: 8px;
            background: var(--accent-blue);
            border-radius: 16px;
            box-shadow: var(--shadow-inner);
        }

        .base-word-display .tile {
            cursor: default;
            box-shadow: 2px 2px 5px rgba(0,0,0,0.05);
            transform: none !important;
            margin: 0;
            width: 40px;
            height: 45px;
        }

        /* Animations */
        .shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; background: var(--error-red); }
        @keyframes shake {
            10%, 90% { transform: translate3d(-1px, 0, 0); }
            20%, 80% { transform: translate3d(2px, 0, 0); }
            30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
            40%, 60% { transform: translate3d(4px, 0, 0); }
        }

        .vm-shake { animation: vm-shake-rack 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
        @keyframes vm-shake-rack {
            0%   { transform: translateX(0); }
            12%  { transform: translateX(-6px); }
            25%  { transform: translateX(6px); }
            37%  { transform: translateX(-5px); }
            50%  { transform: translateX(4px); }
            62%  { transform: translateX(-3px); }
            75%  { transform: translateX(2px); }
            88%  { transform: translateX(-1px); }
            100% { transform: translateX(0); }
        }

        /* ── Correct word particle burst ──────────────────────────────── */
        .vm-particle {
            position: fixed;
            width: 7px;
            height: 7px;
            border-radius: 50%;
            pointer-events: none;
            z-index: 600;
            animation: vm-particle-fly 0.55s ease-out forwards;
        }
        @keyframes vm-particle-fly {
            0%   { transform: translate(-50%, -50%) scale(1.2); opacity: 0.9; }
            60%  { opacity: 0.6; }
            100% { transform: translate(calc(-50% + var(--vm-px)), calc(-50% + var(--vm-py))) scale(0); opacity: 0; }
        }
        .no-animation .vm-particle,
        .reduced-motion .vm-particle { animation: none !important; opacity: 0 !important; }

        .bounce { animation: bounce 0.4s ease; }
        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        @keyframes tileFlip {
            0% { transform: rotateY(0deg); background: #eee; color: transparent; }
            50% { transform: rotateY(90deg); background: #ddd; color: transparent; }
            100% { transform: rotateY(0deg); background: var(--tile-bg); color: var(--text-main); }
        }

        .flipping { animation: tileFlip 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

        /* Reduced motion — fast fade-in instead of flip */
        .reduced-motion .flipping {
            animation: none !important;
            opacity: 1 !important;
            transition: opacity 0.15s ease !important;
        }
        /* No animation — instant appear */
        .no-animation .flipping {
            animation: none !important;
            opacity: 1 !important;
            transition: none !important;
        }
        .no-animation .bounce, .no-animation .shake, .no-animation .vm-shake {
            animation: none !important;
        }
        .reduced-motion .bounce, .reduced-motion .vm-shake {
            animation: none !important;
        }

        /* ══════════════════════════════════════════════════════
           TRAINING MICRO-INTERACTIONS — Phase A + Phase B
           ══════════════════════════════════════════════════ */

        /* ── #1 Tile selecting lift ── (class applied via JS) */
        /* (rules live on .tile.selecting above) */

        /* ── #2 Display slot drop-in ── */
        @keyframes tr-slot-fill {
            0%   { opacity: 0; transform: translateY(-10px) scale(0.9); }
            100% { opacity: 1; transform: translateY(0)    scale(1); }
        }
        .reduced-motion .display-letter.active,
        .no-animation   .display-letter.active { animation: none; }

        /* ── #3 Word tracker counter pulse ── */
        @keyframes tr-counter-pulse {
            0%   { transform: scale(1); }
            45%  { transform: scale(1.13); }
            70%  { transform: scale(0.97); }
            100% { transform: scale(1); }
        }
        #wordTrackerText.tr-updating {
            animation: tr-counter-pulse 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
        }
        .reduced-motion #wordTrackerText.tr-updating,
        .no-animation   #wordTrackerText.tr-updating { animation: none; }

        /* ── #4 Found word entrance ── */
        @keyframes tr-word-in {
            0%   { opacity: 0; transform: scale(0.7) translateY(6px); }
            65%  { transform: scale(1.08); opacity: 1; }
            100% { transform: scale(1)    translateY(0); opacity: 1; }
        }

        /* ── #5 Hook slot success bounce ── */
        @keyframes tr-hook-success {
            0%   { transform: scale(0.65); opacity: 0; }
            55%  { transform: scale(1.12); opacity: 1; }
            80%  { transform: scale(0.97); }
            100% { transform: scale(1); }
        }
        .reduced-motion .slot-hook.success,
        .no-animation   .slot-hook.success { animation: none; }
        @media (hover: none) {
            .slot-hook:hover { transform: none; box-shadow: none; }
        }

        /* ── #6 Feedback message slide-in ── */
        @keyframes tr-feedback-in {
            0%   { opacity: 0; transform: translateY(-7px); }
            100% { opacity: 1; transform: translateY(0); }
        }
        .feedback-msg.tr-feedback-active {
            animation: tr-feedback-in 0.22s ease-out both;
        }
        .reduced-motion .feedback-msg.tr-feedback-active,
        .no-animation   .feedback-msg.tr-feedback-active { animation: none; }

        /* ── #7 Hand cleared glow on display area ── */
        @keyframes tr-clear-glow {
            0%, 100% { border-color: var(--tile-border);  box-shadow: var(--shadow-inner); }
            40%      { border-color: #3e7e57;             box-shadow: var(--shadow-inner), 0 0 18px 5px rgba(62,126,87,0.28); }
        }
        .display-area.tr-cleared {
            animation: tr-clear-glow 0.65s ease-out 3;
        }
        .reduced-motion .display-area.tr-cleared,
        .no-animation   .display-area.tr-cleared { animation: none; }

        /* ── #9 Rack dimming — rules live on .tile-rack.has-tr-selection above ── */
        
        @keyframes modalWin {
            0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
            50% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
            100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
        }
        .win-anim { animation: modalWin 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important; }

        .feedback-msg {
            height: 22px;
            font-size: 0.82rem;
            font-weight: 700;
            margin: 6px 0 12px 0;
            text-align: center;
            transition: opacity 0.3s;
            letter-spacing: 0.2px;
        }

        /* ── Rack area ──────────────────────────────────────────────────── */
        .rack-container {
            width: 100%;
            margin-bottom: 12px;
        }

        .btn-shuffle {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            border: 1.5px solid var(--tile-border);
            background: var(--container-bg);
            box-shadow: var(--shadow-outer);
            cursor: pointer;
            font-size: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s;
            color: #7ab3a2;
            flex-shrink: 0;
        }
        .btn-shuffle:hover { border-color: #7ab3a2; }
        .btn-shuffle:active { transform: translateY(2px); box-shadow: var(--btn-pressed); }

        .tile-rack { display: flex; gap: 8px; flex-wrap: nowrap; justify-content: center; width: 100%; }

        /* ── Gameplay rack trough — active rack only, not end-of-game modal racks ── */
        #tileRack {
            background: var(--accent-blue);
            padding: 8px;
            border-radius: 14px;
            box-shadow: inset 0 3px 8px rgba(0,0,0,0.12);
        }

        .tile {
            flex: 1;
            max-width: 68px;
            height: 58px;
            background: var(--tile-bg);
            box-shadow: 0 4px 0 rgba(0,0,0,0.20), 4px 4px 8px rgba(0,0,0,0.05), -4px -4px 8px #ffffff;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            font-weight: 800;
            cursor: pointer;
            transition: all 0.15s ease;
            user-select: none;
            border: 1px solid var(--tile-border);
            position: relative;
        }
        .tile:active { box-shadow: var(--shadow-inner); transform: scale(0.95); }
        /* #1 — selected tile lifts and glows */
        .tile.selecting {
            transform: translateY(-6px) scale(1.09);
            box-shadow: 0 6px 16px rgba(122,179,162,0.45), inset 0 1px 0 rgba(255,255,255,0.8);
            border-color: #7ab3a2;
            border-width: 1.5px;
            color: #3e7e57;
            border-radius: 6px;
        }
        .tile.used { 
            opacity: 0.3; 
            pointer-events: none; 
            filter: grayscale(1); 
            box-shadow: none;
            border-color: #f0f0f0;
        }
        /* subtle hover glow — pointer devices only */
        .tile:hover:not(.used):not(.selecting) {
            transform: translateY(-2px) scale(1.04);
            box-shadow: 0 4px 12px rgba(122,179,162,0.38),
                        4px 4px 8px rgba(0,0,0,0.05),
                        -4px -4px 8px #ffffff;
            border-color: rgba(122,179,162,0.5);
        }
        @media (hover: none) {
            .tile:hover:not(.used):not(.selecting) { transform: none; box-shadow: 0 4px 0 rgba(0,0,0,0.20), 4px 4px 8px rgba(0,0,0,0.05), -4px -4px 8px #ffffff; border-color: var(--tile-border); }
        }
        /* #9 — dim unselected tiles when any is selected */
        .tile-rack.has-tr-selection .tile:not(.selecting):not(.used) {
            opacity: 0.42;
            transform: scale(0.94);
        }

        /* ── Tile point value badge ──────────────────────────────────── */
        .tile-pts {
            position: absolute;
            bottom: 3px;
            right: 4px;
            font-size: 0.5rem;
            font-weight: 800;
            line-height: 1;
            color: var(--text-muted);
            opacity: 0.6;
            pointer-events: none;
            user-select: none;
        }
        /* Badge inherits tile colour when selected */
        .tile.selecting .tile-pts { color: #3e7e57; opacity: 0.9; }

        /* ── Found words section ────────────────────────────────────────── */
        .found-container {
            margin-top: 18px;
            background: var(--settings-bg);
            border-radius: 16px;
            padding: 14px 16px;
            box-shadow: var(--shadow-inner);
            min-height: 70px;
        }
        .found-label {
            font-size: 0.68rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            color: var(--text-muted);
            margin-bottom: 10px;
        }

        .found-list { display: flex; flex-wrap: wrap; gap: 6px; }

        .found-word {
            background: var(--found-bg);
            color: var(--found-color);
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 0.88rem;
            font-weight: 700;
            letter-spacing: 0.3px;
        }
        /* #4 — new word entrance animation (added via JS) */
        .found-word.tr-word-in {
            animation: tr-word-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
        }
        .reduced-motion .found-word.tr-word-in,
        .no-animation   .found-word.tr-word-in { animation: none; }

        /* ── Action buttons ─────────────────────────────────────────────── */
        .button-group { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
        .row { display: flex; gap: 8px; justify-content: center; }

        /* Give Up lives in its own row — centred, narrower, visually receded */
        .row--giveup { margin-top: 2px; align-items: center; }
        .row--giveup .btn-destructive {
            flex: 0 1 auto;
            min-width: 130px;
            max-width: 200px;
            font-size: 0.8rem;
            padding: 8px 20px;
            opacity: 0.72;
        }
        .row--giveup .btn-destructive:hover  { opacity: 1; }
        .row--giveup .btn-destructive:active { opacity: 1; }

        /* ── Base button ── */
        button {
            flex: 1;
            padding: 11px var(--sp-md);
            border: none;
            border-radius: var(--radius-md);
            font-size: var(--fs-base);
            font-weight: 700;
            cursor: pointer;
            box-shadow: 3px 3px 8px rgba(0,0,0,0.05), -3px -3px 8px rgba(255,255,255,0.7);
            transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.15s, background 0.12s;
            font-family: inherit;
            letter-spacing: 0.2px;
            line-height: var(--lh-tight);
        }
        button:not(:disabled):hover  { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(0,0,0,0.1); }
        button:not(:disabled):active { transform: translateY(2px); box-shadow: var(--btn-pressed); }
        @media (hover: none) {
            button:not(:disabled):hover { transform: none; box-shadow: 3px 3px 8px rgba(0,0,0,0.05), -3px -3px 8px rgba(255,255,255,0.7); }
        }
        .reduced-motion button, .no-animation button { transition: box-shadow 0.1s; }

        /* ── PRIMARY: Submit, Confirm — teal, strong ── */
        .btn-submit {
            background: var(--btn-primary-bg);
            color: var(--btn-primary-color);
            border: none;
            box-shadow: 0 3px 10px var(--brand-primary-glow);
        }
        .btn-submit:hover { background: var(--brand-primary-dark); }
        .btn-submit:active { transform: translateY(2px); box-shadow: var(--btn-pressed); }

        /* ── SECONDARY: Clear — neutral, outlined ── */
        .btn-clear {
            background: var(--btn-secondary-bg);
            color: var(--btn-secondary-color);
            border: 1.5px solid var(--btn-secondary-border);
            box-shadow: none;
        }
        .btn-clear:hover { border-color: var(--brand-primary); color: var(--text-main); }

        /* ── SECONDARY: Shuffle, Refresh — neutral, outlined ── */
        .btn-action {
            background: var(--btn-secondary-bg);
            color: var(--btn-secondary-color);
            border: 1.5px solid var(--btn-secondary-border);
            box-shadow: none;
        }
        .btn-action:hover { border-color: var(--brand-primary); color: var(--text-main); }

        /* ── DESTRUCTIVE: Give Up! — red, clear warning ── */
        .btn-destructive {
            background: var(--btn-destructive-bg);
            color: var(--btn-destructive-color);
            border: 1.5px solid var(--btn-destructive-border);
            box-shadow: none;
            font-weight: 800;
        }
        .btn-destructive:hover {
            background: #ffd5d5;
            border-color: #d84040;
        }

        /* Brave-browser inline give-up confirm (fallback for overlay-blocked browsers) */
        .give-up-inline {
            background: var(--settings-bg);
            border: 1.5px solid var(--btn-destructive-border);
            border-radius: var(--radius-md);
            padding: 12px 14px;
            text-align: center;
        }
        .give-up-inline__msg {
            font-size: 0.82rem;
            color: var(--text-main);
            margin-bottom: 10px;
        }
        .give-up-inline__btns {
            display: flex;
            gap: 8px;
            justify-content: center;
        }
        .give-up-inline__btn-keep,
        .give-up-inline__btn-quit {
            flex: 0 1 auto;
            min-width: 100px;
        }
        .give-up-inline__btn-quit {
            background: var(--btn-destructive-bg);
            color: var(--btn-destructive-color);
            border: 1.5px solid var(--btn-destructive-border);
        }

        /* Stats — warm accent */
        .btn-gold {
            background: #fff8e1;
            color: #b8860b;
            border: 1.5px solid #ffe082;
            box-shadow: none;
        }
        .btn-gold:hover { background: #fff3cd; }

        /* ── Footer ─────────────────────────────────────────────────────── */
        /* ── Free Anagram mode ───────────────────────────────────────────── */
        /* Dynamic display slots — width grows with selection */
        #freeDisplayRow {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 6px;
            min-height: 56px;
            flex-wrap: wrap;
        }
        .free-slot {
            width: 44px;
            height: 52px;
            border-radius: 10px;
            border: 2px solid var(--tile-border);
            background: var(--settings-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.3rem;
            font-weight: 700;
            color: var(--text-main);
            transition: border-color 0.15s, background 0.15s;
        }
        .free-slot.filled {
            border-color: #7ab3a2;
            background: rgba(122,179,162,0.1);
        }
        .free-slot.placeholder {
            opacity: 0.25;
            border-style: dashed;
        }

        /* Found words grouped by length */
        .free-length-group {
            margin-bottom: 10px;
        }
        .free-length-label {
            font-size: 0.6rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            color: var(--text-muted);
            margin-bottom: 4px;
        }
        .free-words-row {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
        }

        /* Blitz countdown banner modifier */
        #quizActiveBanner.blitz-active {
            background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
        }
        #quizTopNav {
            display: none !important; /* hidden on all screen sizes — hamburger menu replaces this */
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
            gap: 6px;
        }
        .quiz-top-nav-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            padding: 7px 6px;
            border-radius: 12px;
            border: 1.5px solid var(--tile-border);
            background: var(--settings-bg);
            color: var(--text-main);
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            font-family: inherit;
            transition: border-color 0.15s, background 0.15s;
            flex: 1;
            box-shadow: none;
        }
        .quiz-top-nav-btn span {
            font-size: 0.58rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            color: var(--text-muted);
        }
        .quiz-top-nav-btn:hover { border-color: #7ab3a2; }
        .quiz-top-nav-btn:active { transform: scale(0.97); }
        .quiz-top-nav-btn.qnav-active {
            background: #7ab3a2;
            border-color: #7ab3a2;
            color: #fff;
        }
        .quiz-top-nav-btn.qnav-active span { color: rgba(255,255,255,0.85); }

        /* ── Global footer nav ──────────────────────────────────────────── */
        .footer-controls {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 0;
            margin-top: 20px;
            padding-top: 16px;
            border-top: 1px solid var(--tile-border);
        }
        .footer-controls button {
            background: transparent;
            color: var(--text-muted);
            font-size: var(--fs-xs);
            font-weight: 700;
            letter-spacing: 0.2px;
            padding: var(--sp-sm) var(--sp-sm);
            border-radius: var(--radius-xl);
            border: 1.5px solid var(--tile-border);
            box-shadow: none;
            flex: 1;
            transition: border-color 0.15s, color 0.15s;
            font-family: inherit;
            cursor: pointer;
            white-space: nowrap;
        }
        .footer-controls button:hover {
            border-color: #7ab3a2;
            color: var(--text-main);
        }
        .footer-controls button:active { transform: scale(0.97); box-shadow: none; }
        .footer-controls button.footer-active {
            border-color: #7ab3a2;
            color: #7ab3a2;
            font-weight: 800;
        }

        .hidden { display: none !important; }

        .overlay {
            display: none;
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(232, 245, 233, 0.4); 
            backdrop-filter: blur(10px);
            z-index: 500;
        }

        .modal {
            display: none;
            position: fixed;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            background: var(--container-bg);
            padding: var(--sp-2xl);
            font-size: var(--fs-base);
            line-height: var(--lh-base);
            border-radius: 32px;
            z-index: 501;
            text-align: center;
            width: 92%;
            max-width: 420px;
            box-shadow: 0 20px 50px rgba(0,0,0,0.1);
            max-height: 90vh;
            overflow-y: auto;
        }
        
        .modal-rack-wrap {
            transform: scale(0.75);
            margin-top: -10px;
            margin-bottom: 5px;
            pointer-events: none; 
        }

        .solution-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            margin: 15px 0 20px 0;
            max-height: 150px;
            overflow-y: auto;
            font-size: 0.9rem;
            padding-right: 5px;
        }
        
        .solution-grid::-webkit-scrollbar { width: 6px; }
        .solution-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

        /* Achievements Styling */
        .trophy-rack {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
            margin: 15px 0;
        }
        .trophy-card {
            background: #fafafa;
            border-radius: 12px;
            padding: 10px;
            width: 70px;
            box-shadow: var(--shadow-inner);
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        /* Trophy icon containers — strongly distinct per tier */
        .trophy-icon {
            font-size: 1.5rem; font-weight: 900; font-style: normal;
            margin-bottom: 5px; display: flex; align-items: center; justify-content: center;
            width: 48px; height: 48px; border-radius: 12px; line-height: 1;
            font-family: 'Quicksand', sans-serif; letter-spacing: -1px;
        }
        /* Copper — warm terracotta */
        .trophy-icon.copper {
            background: linear-gradient(135deg, #f5c9a0, #e8935a);
            border: 2px solid #b86a30;
            color: #7a3a10;
            box-shadow: 0 2px 8px #c97c3a55;
        }
        /* Silver — cool blue-grey with metallic feel */
        .trophy-icon.silver {
            background: linear-gradient(135deg, #dce8f5, #a8c4dc);
            border: 2px solid #6a90b0;
            color: #2e5070;
            box-shadow: 0 2px 8px #6a90b055;
        }
        /* Gold — rich amber, warm and bright */
        .trophy-icon.gold {
            background: linear-gradient(135deg, #fff0a0, #f5c800);
            border: 2px solid #c09000;
            color: #7a5800;
            box-shadow: 0 2px 10px #e8b80088;
        }
        /* Platinum — vivid teal/cyan, completely unlike gold */
        .trophy-icon.platinum {
            background: linear-gradient(135deg, #a0f5ea, #00d4be);
            border: 2px solid #00a090;
            color: #003830;
            box-shadow: 0 0 0 3px #00d4be33, 0 2px 14px #00d4be88;
        }
        .trophy-icon.none {
            background: #f0f0f0;
            border: 2px solid #e0e0e0;
            color: #ccc;
            opacity: 0.4;
        }

        /* ── Length Trophy grid (Settings page) ────────────────────────── */
        .ltrophy-grid {
            display: grid;
            grid-template-columns: repeat(6, minmax(0, 1fr));
            gap: 6px;
            margin: 12px 0 4px;
        }
        .ltrophy-cell {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
            padding: 8px 4px 6px;
            border-radius: 10px;
            background: var(--settings-bg);
            box-shadow: var(--shadow-inner);
            opacity: 0.4;
            transition: opacity 0.2s;
            min-width: 0;
        }
        .ltrophy-cell--earned { opacity: 1; }
        .ltrophy-cell svg { width: 44px; height: 47px; }
        .ltrophy-len {
            font-size: 0.58rem;
            font-weight: 700;
            color: var(--text-muted);
            letter-spacing: 0.2px;
        }
        .ltrophy-tier-lbl {
            font-size: 0.6rem;
            font-weight: 800;
            letter-spacing: 0.2px;
        }
        .ltrophy-avg {
            font-size: 0.56rem;
            color: var(--text-muted);
            text-align: center;
            line-height: 1.3;
        }
        @media (max-width: 380px) {
            .ltrophy-cell svg { width: 36px; height: 39px; }
            .ltrophy-avg { display: none; }
        }

        .badge-rack {
            display: flex;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
            margin: 10px 0 20px 0;
            align-items: flex-start;
        }

        /* Badge chip */
        .badge-chip {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 62px;
            height: 62px;
            border-radius: 16px;
            cursor: default;
            transition: transform 0.15s, box-shadow 0.15s;
            user-select: none;
        }
        .badge-chip:hover { transform: translateY(-3px); }
        .badge-chip:hover .badge-tooltip { opacity: 1; pointer-events: auto; transform: translateY(0); }

        .badge-num {
            font-size: 1.2rem;
            font-weight: 900;
            line-height: 1;
            letter-spacing: -0.5px;
        }
        .badge-sub {
            font-size: 0.55rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            opacity: 0.75;
            margin-top: 2px;
        }

        /* Colorful floating tooltip */
        .badge-tooltip {
            position: absolute;
            bottom: calc(100% + 10px);
            left: 50%;
            transform: translateX(-50%) translateY(6px);
            white-space: nowrap;
            padding: 7px 12px;
            border-radius: 10px;
            font-size: 0.75rem;
            font-weight: 700;
            color: #fff;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s, transform 0.2s;
            z-index: 999;
            box-shadow: 0 4px 14px rgba(0,0,0,0.18);
            max-width: 200px;
            white-space: normal;
            text-align: center;
            line-height: 1.35;
        }
        .badge-tooltip::after {
            content: '';
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            border: 6px solid transparent;
        }

        /* ── Training milestone badges — SVG hexagonal grid ──────────────────── */
        /* Flex layout + fixed badge width: prevents SVGs from stretching to      */
        /* fill grid columns. SVGs also carry explicit width/height attributes    */
        /* as a belt-and-suspenders guarantee.                                    */
        .tbadge-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 12px 8px;
            margin: 6px 0 4px;
        }
        .tbadge {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            position: relative;
            cursor: default;
            transition: transform 0.15s;
            user-select: none;
        }
        .tbadge:hover { transform: translateY(-3px); }
        .tbadge:hover .tbadge-tooltip {
            opacity: 1;
            pointer-events: auto;
            transform: translateX(-50%) translateY(0);
        }
        .tbadge-svg {
            width: 54px;
            height: auto;
            display: block;
            margin: 0 auto;
        }
        .tbadge.earned .tbadge-svg {
            filter: drop-shadow(0 3px 7px rgba(0,0,0,0.22));
        }
        .tbadge.locked { opacity: 0.42; }
        .tbadge-name {
            font-size: 0.52rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            text-align: center;
            color: var(--text-main);
            line-height: 1.2;
        }
        .tbadge-tooltip {
            position: absolute;
            bottom: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%) translateY(4px);
            padding: 7px 11px;
            border-radius: 9px;
            font-size: 0.72rem;
            font-weight: 600;
            color: #fff;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s, transform 0.2s;
            z-index: 999;
            max-width: 200px;
            white-space: normal;
            text-align: center;
            line-height: 1.35;
            box-shadow: 0 4px 14px rgba(0,0,0,0.2);
        }
        .tbadge-tooltip-arrow {
            display: block;
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            border: 5px solid transparent;
        }

        /* Words by Type in Stats — override qrb-cell rounding (quiz modal keeps its own) */
        #sdWordsByType .qrb-cell { border-radius: 0; }

        /* Badge notification toast */
        #badgeToast {
            position: fixed;
            bottom: 30px;
            right: 20px;
            max-width: 280px;
            padding: 14px 18px;
            border-radius: 18px;
            display: flex;
            align-items: center;
            gap: 12px;
            z-index: 9999;
            box-shadow: 0 8px 28px rgba(0,0,0,0.18);
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 0.4s ease, transform 0.4s ease;
            pointer-events: none;
            font-family: inherit;
        }
        #badgeToast.show {
            opacity: 1;
            transform: translateY(0);
        }
        .toast-badge-chip {
            flex-shrink: 0;
            width: 46px;
            height: 46px;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        .toast-badge-num { font-size: 1rem; font-weight: 900; line-height: 1; }
        .toast-badge-sub { font-size: 0.5rem; font-weight: 700; text-transform: uppercase; opacity: 0.8; margin-top: 1px; }
        .toast-text-wrap { flex: 1; }
        .toast-title { font-size: 0.8rem; font-weight: 700; opacity: 0.85; }
        .toast-msg { font-size: 0.9rem; font-weight: 800; margin-top: 2px; }

        #copyright {
            display: none;
        }

        /* Mobile specific fixes */
        @media (max-width: 450px) {
            .settings-panel { grid-template-columns: 58px 1fr; column-gap: 8px; padding: 10px 12px; }
            .sp-label { font-size: 0.6rem; }
            .seg-group label { padding: 5px 7px; font-size: 0.8rem; }
            .pill-group label { padding: 5px 9px; font-size: 0.78rem; }
            .row { flex-direction: column; width: 100%; }
            .tile { flex: 1 !important; max-width: 56px !important; height: 50px !important; font-size: 1.2rem !important; }
        }

        /* Issue 1 fix: "Length" label wraps at 375px — widen column + shrink font */
        @media (max-width: 375px) {
            .settings-panel {
                grid-template-columns: 52px 1fr !important;
            }
            .sp-label { font-size: 0.55rem !important; }
        }

        /* Difficulty badge in status bar */
        .difficulty-badge {
            font-size: 0.72rem;
            font-weight: 700;
            padding: 2px 8px;
            border-radius: 8px;
            letter-spacing: 0.3px;
        }
        .difficulty-badge.beginner     { background: #e8f5e0; color: #3a7a20; }
        .difficulty-badge.intermediate { background: #fff3e0; color: #b05a00; }
        .difficulty-badge.open         { background: #fdecea; color: #a02020; }

        /* Timer display */
        .timer-display {
            font-size: 0.8rem;
            color: var(--text-muted);
            font-weight: 600;
            text-align: right;
            padding: 4px 8px;
            border-radius: 8px;
            background: #f5f5f5;
            display: inline-block;
            margin-top: 4px;
            letter-spacing: 0.5px;
        }

        /* Stats Page (full page overlay) */
        #statsPage {
            display: none;
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: var(--container-bg);
            z-index: 200;
            overflow-y: auto;
            padding: 20px;
            box-sizing: border-box;
        }

        .stats-page-inner {
            max-width: 700px;
            margin: 0 auto;
            padding-bottom: 40px;
        }

        .stats-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 24px;
        }

        .stats-title {
            font-size: 1.6rem;
            font-weight: 700;
            color: #7ab3a2;
            letter-spacing: 2px;
            font-family: 'Playfair Display', Georgia, serif;
        }

        .btn-back {
            background: var(--container-bg);
            border: none;
            border-radius: 12px;
            padding: 10px 16px;
            font-family: inherit;
            font-weight: 700;
            font-size: 0.9rem;
            cursor: pointer;
            color: #666;
            box-shadow: 4px 4px 10px rgba(0,0,0,0.05), -4px -4px 10px #ffffff;
        }
        .btn-back:hover { background: #f5f5f5; }

        /* Stats page sections — flat card layout (no collapsibles) */
        .sd-section {
            background: var(--container-bg);
            border: 1.5px solid var(--tile-border);
            border-radius: 0;
            padding: 18px 20px;
            margin-bottom: 14px;
            box-shadow: var(--shadow-outer);
        }

        .sd-section-heading {
            font-size: 0.72rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 1.8px;
            color: var(--brand-primary);
            margin-bottom: 14px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--tile-border);
        }

        /* Hidden targets — kept for ui.js renderStatsDashboard compatibility */
        .js-targets-hidden {
            display: none !important;
        }

        /* Stats actions row */
        .stats-actions-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 20px;
            gap: 10px;
        }

        /* Keep .stats-section for Settings page which also uses it */
        .stats-section {
            background: var(--container-bg);
            border-radius: 6px;
            padding: 20px;
            margin-bottom: 14px;
            border: 1px solid var(--tile-border);
            box-shadow: 0 1px 4px rgba(0,0,0,0.04);
        }

        .stats-section h3 {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 2px;
            color: var(--text-muted);
            margin: 0 0 14px 0;
            font-weight: 700;
        }

        /* ── Settings page components ─────────────────────────────────────── */

        .settings-desc {
            font-size: 0.82rem;
            color: var(--text-muted);
            margin: -8px 0 12px 0;
            line-height: 1.45;
        }

        .settings-label {
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.6px;
            margin-bottom: 6px;
            display: block;
        }

        .settings-options-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .settings-name-row {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .settings-name-input {
            flex: 1;
            padding: 8px 12px;
            border: 1.5px solid #ddd;
            border-radius: 10px;
            font-size: 0.9rem;
            font-family: inherit;
            background: var(--settings-bg);
            color: var(--text-main);
            outline: none;
            transition: border-color 0.15s;
        }

        .settings-save-btn {
            min-width: 60px;
            padding: 8px 14px;
            font-size: 0.82rem;
        }

        /* ── Background Music radio options ───────────────────────────────── */

        .vm-music-option {
            display: block;
            cursor: pointer;
        }

        .vm-music-option input[type="radio"] {
            display: none;
        }

        .vm-music-label {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 14px;
            border-radius: 12px;
            border: 1.5px solid var(--tile-border);
            background: var(--settings-bg);
            transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
        }

        .vm-music-option input[type="radio"]:checked + .vm-music-label {
            border-color: #7ab3a2;
            background: rgba(122, 179, 162, 0.08);
            box-shadow: 0 2px 8px rgba(122, 179, 162, 0.18);
        }

        .vm-music-icon {
            font-size: 1.3rem;
            flex-shrink: 0;
        }

        .vm-music-text {
            display: flex;
            flex-direction: column;
            gap: 1px;
            min-width: 0;
        }

        .vm-music-name {
            font-size: 0.88rem;
            font-weight: 700;
            color: var(--text-main);
        }

        .vm-music-desc {
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        .vm-music-playing {
            margin-left: auto;
            font-size: 0.75rem;
            color: #7ab3a2;
            font-weight: 700;
            flex-shrink: 0;
        }

        .vm-music-credit {
            font-size: 0.7rem;
            color: var(--text-muted);
            opacity: 0.6;
            margin-top: 8px;
            text-align: right;
        }

        /* ── Volume slider row ─────────────────────────────────────────── */

        .vm-volume-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 10px;
            padding: 8px 14px;
            border-radius: 10px;
            background: var(--settings-bg);
            border: 1px solid var(--tile-border);
        }

        .vm-volume-icon {
            font-size: 1rem;
            flex-shrink: 0;
        }

        .vm-volume-slider {
            flex: 1;
            height: 6px;
            -webkit-appearance: none;
            appearance: none;
            background: var(--tile-border);
            border-radius: 3px;
            outline: none;
            cursor: pointer;
        }

        .vm-volume-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #7ab3a2;
            border: 2px solid #fff;
            box-shadow: 0 1px 4px rgba(0,0,0,0.2);
            cursor: pointer;
        }

        .vm-volume-slider::-moz-range-thumb {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #7ab3a2;
            border: 2px solid #fff;
            box-shadow: 0 1px 4px rgba(0,0,0,0.2);
            cursor: pointer;
        }

        .vm-volume-pct {
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--text-muted);
            min-width: 32px;
            text-align: right;
        }

        /* ── Keyboard Shortcuts grid ──────────────────────────────────── */

        .settings-keys-grid {
            display: grid;
            grid-template-columns: auto 1fr;
            gap: 8px 14px;
            align-items: center;
        }

        .help-key {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 0.78rem;
            font-weight: 700;
            font-family: monospace;
            background: var(--settings-bg);
            color: var(--text-main);
            border: 1.5px solid var(--tile-border);
            box-shadow: 0 1px 2px rgba(0,0,0,0.06);
            text-align: center;
            white-space: nowrap;
        }

        .help-key--hook {
            background: rgba(122, 179, 162, 0.1);
            border-color: #7ab3a2;
            color: #5a9e8e;
        }

        .help-key-desc {
            font-size: 0.82rem;
            color: var(--text-muted);
            line-height: 1.4;
        }

        /* ── Reset All Data section ───────────────────────────────────── */

        .settings-reset-section {
            border: 1.5px solid rgba(220, 80, 60, 0.25);
            background: rgba(220, 80, 60, 0.03);
        }

        .settings-reset-heading {
            color: #c0392b !important;
        }

        .settings-reset-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 10px 20px;
            border-radius: 10px;
            font-size: 0.85rem;
            font-weight: 700;
            background: #e74c3c;
            color: #fff;
            border: none;
            cursor: pointer;
            transition: background 0.15s, box-shadow 0.15s;
        }

        .settings-reset-btn:hover {
            background: #c0392b;
            box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
        }

        /* ── Settings back button wrapper ─────────────────────────────── */

        .settings-back-wrap {
            margin-top: 20px;
            text-align: center;
        }

        .stat-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 10px;
        }

        .stat-label {
            font-size: 0.9rem;
            color: var(--text-main);
            font-weight: 600;
        }

        .stat-value {
            font-size: 1rem;
            font-weight: 700;
            color: #7ab3a2;
        }

        .progress-bar-wrap {
            margin-bottom: 14px;
        }

        .progress-bar-meta {
            display: flex;
            justify-content: space-between;
            font-size: 0.82rem;
            color: var(--text-muted);
            font-weight: 600;
            margin-bottom: 5px;
        }

        .progress-bar-bg {
            background: #efefef;
            border-radius: 8px;
            height: 12px;
            overflow: hidden;
        }

        .progress-bar-fill {
            height: 100%;
            border-radius: 8px;
            background: linear-gradient(90deg, #7ab3a2, #a8d5c8);
            transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .big-stat-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
        }

        .big-stat-card {
            background: #f9f9f9;
            border-radius: 14px;
            padding: 14px 8px;
            text-align: center;
            box-shadow: var(--shadow-inner);
        }

        .big-stat-num {
            font-size: 1.6rem;
            font-weight: 700;
            color: #7ab3a2;
            line-height: 1;
        }

        .big-stat-lbl {
            font-size: 0.72rem;
            color: var(--text-muted);
            font-weight: 600;
            margin-top: 4px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .power-pill {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            background: #fff8e1;
            border-radius: 20px;
            padding: 4px 12px;
            font-size: 0.85rem;
            font-weight: 700;
            color: #b8860b;
            margin: 3px;
        }

        /* Mobile responsiveness for settings */
        @media (max-width: 450px) {
            .sp-controls { gap: 5px; }
            .big-stat-grid { grid-template-columns: repeat(2, 1fr); }
        }

        /* ── Training Filter ─────────────────────────────────────────────── */
        .pf-wrap { margin-bottom: 10px; border-radius: 12px; border: 1.5px solid var(--tile-border); background: var(--card-bg, #fff); overflow: hidden; }
        .pf-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 9px 13px; background: none; border: none; cursor: pointer; font-size: 0.78rem; font-weight: 800; color: var(--text-main); letter-spacing: 0.4px; }
        .pf-toggle:hover { background: rgba(122,179,162,0.08); }
        .pf-toggle-label { display: flex; align-items: center; gap: 6px; }
        .pf-toggle-caret { font-size: 0.9rem; color: var(--text-muted); transition: transform 0.25s; }
        .pf-wrap.pf-open .pf-toggle-caret { transform: rotate(180deg); }
        .pf-body { display: none; padding: 0 12px 12px; }
        .pf-wrap.pf-open .pf-body { display: block; }
        .pf-desc { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 9px; line-height: 1.5; }
        .pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
        .pf-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; border-radius: 9px; border: 1.5px solid var(--tile-border); background: var(--tile-bg, #f9f9f7); cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s; }
        .pf-btn:hover { border-color: #7ab3a2; background: rgba(122,179,162,0.07); }
        .pf-btn.pf-active { border-color: #7ab3a2; background: rgba(122,179,162,0.13); box-shadow: 0 0 0 2px rgba(122,179,162,0.25); }
        .pf-icon { font-size: 1.1rem; line-height: 1; margin-bottom: 2px; }
        .pf-name { font-size: 0.72rem; font-weight: 800; color: var(--text-main); }
        .pf-hint { font-size: 0.58rem; color: var(--text-muted); font-weight: 600; }


        /* ── The Last Vort Logo ── */
        .tlv-logo-wrap {
            text-align: center; margin-bottom: 14px; padding: 14px 0 10px 0;
            border-bottom: 1px solid var(--tile-border);
        }
        .tlv-rule-row {
            display: flex; align-items: center; gap: 8px;
            margin-bottom: 2px;
        }
        .tlv-rule-line {
            flex: 1; height: 1px;
            background: linear-gradient(90deg, transparent, #c8a96e, transparent);
            opacity: 0.6;
        }
        .tlv-diamond {
            font-size: 0.6rem; color: #c8a96e; opacity: 0.8;
        }
        .tlv-subtitle-top {
            font-family: 'Quicksand', sans-serif;
            font-size: 0.65rem; font-weight: 700;
            letter-spacing: 6px; text-transform: uppercase;
            color: #b8956a; opacity: 0.85; margin-bottom: 0px;
        }
        .tlv-title {
            font-family: 'Playfair Display', Georgia, serif;
            font-size: 2rem; font-weight: 900;
            letter-spacing: 4px; line-height: 1.05;
            background: linear-gradient(135deg, #8B6914 0%, #c8a96e 35%, #e8cc8e 60%, #c8a96e 80%, #8B6914 100%);
            -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
            display: inline-block;
        }
        .tlv-subtitle-bot {
            font-family: 'Quicksand', sans-serif;
            font-size: 0.55rem; font-weight: 700;
            letter-spacing: 3px; text-transform: uppercase;
            color: var(--text-muted); opacity: 0.65; margin-top: 2px;
        }
        [data-theme="dark"] .tlv-title {
            background: linear-gradient(135deg, #c8a96e 0%, #f0d090 40%, #ffeaa0 65%, #f0d090 85%, #c8a96e 100%);
            -webkit-background-clip: text; background-clip: text;
        }

/* ── Quiz Mode Picker cards (level 1 of two-level quiz selection) ── */
.quiz-mode-card {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 16px;
    background: var(--tile-bg); border: 1.5px solid var(--tile-border);
    border-radius: 14px; cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.08s ease, transform 0.08s ease;
    box-shadow: var(--btn-raise);
}
.quiz-mode-card:hover  { transform: translateY(-2px); border-color: #7ab3a2; box-shadow: var(--btn-raise); }
.quiz-mode-card:active { transform: translateY(2px);  box-shadow: var(--btn-pressed); }
@media (hover: none) {
    .quiz-mode-card:hover { transform: none; box-shadow: var(--btn-raise); }
}
.qmc-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.qmc-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; }
.qmc-name { font-size: var(--fs-base); font-weight: 800; color: var(--text-main); margin-bottom: 2px; }
.qmc-desc { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; line-height: 1.4; }
.qmc-right { flex-shrink: 0; text-align: right; }
.qmc-cta { font-size: var(--fs-lg); font-weight: 800; color: #7ab3a2; }
.qmc-progress { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.qmc-bar { width: 60px; height: 5px; background: var(--tile-border); border-radius: 3px; overflow: hidden; }
.qmc-bar-fill { height: 100%; background: #7ab3a2; border-radius: 3px; transition: width 0.3s; }

/* ── Quiz Selection Page — outer wrapper + white card ── */
.qsp-outer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: var(--sp-xl);
    box-sizing: border-box;
}
.qsp-card {
    text-align: left;
    padding: 24px 24px 20px;
}
.qsp-logo {
    margin-bottom: 12px;
}
.qsp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.qsp-title {
    font-size: var(--fs-lg);
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.3px;
}
.qsp-title-icon {
    vertical-align: -3px;
    margin-right: 2px;
    color: #7ab3a2;
}
.qsp-title-desc {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0;
    text-transform: none;
    margin-top: 4px;
    line-height: 1.4;
}
.qsp-encouragement {
    text-align: center;
    font-size: 0.88rem;
    font-weight: 700;
    color: #7ab3a2;
    font-style: italic;
    margin: 4px 0 6px;
    line-height: 1.4;
}

/* ── Mode page headers — Training & Scenarios (mirrors .qsp-header/.qsp-title) ── */
.vm-mode-header {
    margin-bottom: 10px;
    margin-top: 2px;
    text-align: left;
}
.vm-mode-header .qsp-title {
    text-align: left;
}
/* Inside settings-panel grid — must span both label + control columns */
.settings-panel .vm-mode-header {
    grid-column: 1 / -1;
}
.qsp-mode-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}
.qsp-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--tile-border);
}

.mm-utils {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
}

.mm-utils .mm-util-btn {
    flex: 1;
}

/* ── Help modal tabs (all screen sizes) ── */
.help-tab-bar {
    display: flex; gap: 6px; margin-bottom: 14px;
}
.help-tab-btn {
    flex: 1; padding: 8px 4px;
    font-size: var(--fs-xs); font-weight: 800;
    border: 1.5px solid var(--tile-border); border-radius: 8px;
    background: var(--tile-bg); color: var(--text-muted);
    cursor: pointer; text-align: center; min-height: 44px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.help-tab-btn.active {
    background: #7ab3a2; border-color: #5a9e8e; color: #fff;
}
.help-tab-panel { display: none; }
.help-tab-panel.active { display: block; }

/* ── Help modal content rows ── */
.help-tab-panel--text {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-main);
}

.help-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
}

.help-row__icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    line-height: 1.4;
}

.help-row__flex1 {
    flex: 1;
    min-width: 0;
}

.help-row__label {
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.help-row__label--teal {
    color: #5a9e8e;
}

.help-row__body {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.help-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--tile-border), transparent);
    opacity: 0.5;
    margin: 2px 0;
}

.help-keys-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    align-items: center;
    margin-top: 8px;
}

/* ── Button utility modifiers ── */
.btn--full { width: 100%; }
.btn--sm { font-size: 0.8rem; padding: 6px 14px; }
.btn--flex { display: inline-flex; align-items: center; gap: 6px; }
.btn--mt-sm { margin-top: var(--sp-sm); }
.btn--mt-md { margin-top: var(--sp-md); }
.btn--mt-lg { margin-top: var(--sp-lg); }
.btn--mt-xl { margin-top: var(--sp-2xl); }
.btn-back--sm { font-size: 0.78rem; padding: 4px 10px; }


/* game-card — consistent padding using spacing scale */
.game-card {
    padding: var(--sp-2xl);
}

/* header-container — consistent bottom margin */
.header-container {
    margin-bottom: var(--sp-lg);
}

/* button-group — consistent spacing */
.button-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    margin-top: var(--sp-sm);
}

/* .row — consistent gap */
.row {
    display: flex;
    gap: var(--sp-sm);
    justify-content: center;
}

/* found-container — consistent top spacing */
.found-container {
    margin-top: var(--sp-lg);
}

/* ════════════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE — max-width: 600px
   ════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    body {
        padding-top: max(68px, calc(48px + env(safe-area-inset-top)));
        justify-content: flex-start;
    }

    .game-card {
        min-height: calc(100svh - max(68px, calc(48px + env(safe-area-inset-top))) - max(20px, env(safe-area-inset-bottom)));
        margin-bottom: 0;
    }

    .qsp-outer {
        /* #quizSelectionPage already carries the 68px header offset.
           Remove .qsp-outer's own top padding so the white card aligns
           with .game-card on Main Menu and Training. */
        padding-top: 0;
    }
}

@media (max-width: 600px) {

    /* ── Global button touch targets ── */
    button, .btn-submit, .btn-back, .btn-action, .btn-destructive {
        min-height: 44px;
    }

} /* end @media (max-width: 600px) */

/* ── Sub-collapsible (inside sections, e.g. Recent Scenarios) ── */
.sd-sub-details { margin-top: 4px; }
.sd-sub-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    padding: 8px 0 4px 0;
    border-top: 1px solid var(--tile-border);
}
.sd-sub-summary::-webkit-details-marker { display: none; }
.sd-sub-caret { font-size: 0.75rem; transition: transform 0.2s; }
.sd-sub-details[open] .sd-sub-caret { transform: rotate(180deg); }
.sd-sub-content { padding-top: 8px; }

/* ── Section divider inside collapsibles ── */
.sd-section-divider {
    height: 1px;
    background: var(--tile-border);
    margin: 16px 0;
    opacity: 0.6;
}

/* ════════════════════════════════════
   GLOBAL STATS CARDS
   ════════════════════════════════════ */

.sd-gs-card {
    border-radius: 18px;
    padding: 16px 18px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}
.sd-gs-card:last-child { margin-bottom: 0; }

.sd-gs-card--training {
    background: linear-gradient(135deg, rgba(122,179,162,0.15) 0%, rgba(122,179,162,0.05) 100%);
    border: 1.5px solid rgba(122,179,162,0.25);
}
.sd-gs-card--streak {
    background: linear-gradient(135deg, rgba(232,115,74,0.15) 0%, rgba(232,115,74,0.05) 100%);
    border: 1.5px solid rgba(232,115,74,0.25);
}

.sd-gs-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.sd-gs-card-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}
.sd-gs-card-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: 'Playfair Display', serif;
}
.sd-gs-card--training  .sd-gs-card-title { color: #4a8e7e; }
.sd-gs-card--streak    .sd-gs-card-title { color: #c85020; }

.sd-gs-card-grid {
    display: flex;
    align-items: center;
    gap: 0;
}
.sd-gs-card-stat {
    flex: 1;
    text-align: center;
}
.sd-gs-card-divider {
    width: 1px;
    height: 44px;
    background: currentColor;
    opacity: 0.12;
    flex-shrink: 0;
    margin: 0 6px;
}
.sd-gs-card-num {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    font-family: 'Playfair Display', serif;
}
.sd-gs-card-num--teal   { color: #7ab3a2; }
.sd-gs-card-num--purple { color: #9b7abf; }
.sd-gs-card-lbl {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sd-gs-streak-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sd-gs-cal {
    display: flex;
    gap: 5px;
}
.sd-gs-dot {
    flex: 1;
    height: 32px;
    border-radius: 8px;
    background: rgba(232,115,74,0.10);
    border: 1.5px solid rgba(232,115,74,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.64rem;
    font-weight: 800;
    color: rgba(200,80,32,0.5);
    transition: background 0.2s;
}
.sd-gs-dot--played {
    background: #e8734a;
    border-color: #e8734a;
    color: #fff;
}
.sd-gs-dot--today {
    outline: 2px solid rgba(232,115,74,0.7);
    outline-offset: 2px;
    font-weight: 900;
    color: #c85020;
}
.sd-gs-dot--played.sd-gs-dot--today {
    background: #c85020;
    border-color: #c85020;
    color: #fff;
    outline-color: #c85020;
}
.sd-gs-streak-lbl {
    font-size: 0.82rem;
    font-weight: 700;
    color: #c85020;
}
.sd-gs-streak-lbl--muted { color: var(--text-muted); font-style: italic; }

[data-theme="dark"] .sd-gs-card--training {
    background: linear-gradient(135deg, rgba(122,179,162,0.12) 0%, rgba(122,179,162,0.04) 100%);
    border-color: rgba(122,179,162,0.20);
}
[data-theme="dark"] .sd-gs-card--streak {
    background: linear-gradient(135deg, rgba(232,115,74,0.12) 0%, rgba(232,115,74,0.04) 100%);
    border-color: rgba(232,115,74,0.20);
}
[data-theme="dark"] .sd-gs-dot {
    background: rgba(232,115,74,0.08);
    border-color: rgba(232,115,74,0.15);
}

/* ════════════════════════════════════
   MILESTONE RING
   ════════════════════════════════════ */


/* ── Base visibility: overlays hidden until JS shows them ── */
/* These must come BEFORE the desktop @media block so the media query overrides win */

#settingsPage {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--container-bg);
    z-index: 201;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

#helpModal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--container-bg);
    z-index: 201;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

/* ── Mobile: push overlay page content below the fixed 48px header ──
   Placed here (after all base rules) so the cascade order is correct.
   The desktop @media below resets padding to 24px for the card layout.   */
@media (max-width: 768px) {
    #statsPage,
    #settingsPage,
    #helpModal,
    #quizHubPage,
    #quizSelectionPage {
        padding-top: max(68px, calc(48px + env(safe-area-inset-top)));
    }

    /* Help content is short — guarantee background covers the full viewport
       even when there is no scroll. dvh = dynamic viewport height (accounts
       for browser chrome on mobile); vh is the fallback for older browsers. */
    #helpModal {
        min-height: 100vh;
        min-height: 100dvh;
    }
}

/* ════════════════════════════════════════════════════════════════════
   DESKTOP FULL-PAGE DESTINATIONS — centered card layout
   Applies to ≥769px only. On mobile these are full-screen views
   (handled above). On desktop they render as centered floating cards
   with white background, border-radius, and shadow — consistent
   across Stats, Settings, Quiz Hub, Help, and the Scenario result.
   No JS inline styles needed. CSS is the single source of truth.
   ════════════════════════════════════════════════════════════════════ */

@media (min-width: 769px) {

    /* On desktop the game card floats centred on the page-bg */
    body {
        padding: 40px 20px;
    }

    .game-card {
        max-width: 640px;
    }

    /* ── Shared card shell — overlays become centred floating modals ── */
    #statsPage,
    #settingsPage,
    #quizHubPage,
    #helpModal {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 96%;
        max-width: 700px;
        max-height: 92vh;
        overflow-y: auto;
        background: var(--container-bg);
        border-radius: 24px;
        padding: 24px 24px 32px 24px;
        box-sizing: border-box;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.14),
                    0 0 0 100vmax rgba(0, 0, 0, 0.45);
        z-index: 501;
        height: auto;
        /* Reset full-screen mobile positioning */
        top: 50%; left: 50%;
        width: 96%; height: auto;
    }

    /* ── Quiz Hub overlay suppressed on desktop ── */
    #quizHubOverlay {
        display: none !important;
    }

    /* Inner content wrapper */
    .stats-page-inner {
        max-width: 100%;
        margin: 0;
        padding-bottom: 20px;
    }

    /* Training filter row — wider on desktop */
    .settings-panel {
        grid-template-columns: 80px 1fr;
    }

    /* Puzzle card width */
    .puzzle-card {
        max-width: 640px;
    }

} /* end @media (min-width: 769px) */



/* ═══════════════════════════════════════════════════════════════════
   SHARED TUTORIAL SYSTEM  (.pt-*)
   Used by both the Training tutorial (tt* IDs) and the Quiz tutorial
   (qt* IDs). The callout and backdrop are position:fixed so they
   cover the full viewport regardless of their DOM parent.
   ═══════════════════════════════════════════════════════════════════ */

/* Backdrop — full-screen dark overlay with elliptical spotlight cutout.
   JS sets --pt-cx/cy (ellipse centre) and --pt-rw/rh (radii) then adds
   .pt-active to trigger the gradient and fade-in. */
.pt-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: all;
    opacity: 0;
    background: rgba(0, 0, 0, 0);
    transition: opacity 0.3s ease;
}
.pt-backdrop.pt-active {
    opacity: 1;
    background: radial-gradient(
        ellipse var(--pt-rw, 80px) var(--pt-rh, 50px)
        at var(--pt-cx, 50%) var(--pt-cy, 50%),
        transparent 99%,
        rgba(0, 0, 0, 0.58) 100%
    );
}

/* Callout card — width + top + left set by JS */
.pt-callout {
    position: fixed;
    z-index: 1001;
    background: var(--container-bg, #ffffff);
    border-radius: 16px;
    padding: 18px 18px 14px;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.10);
}

/* Progress dots */
.pt-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 14px;
}
.pt-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
    flex-shrink: 0;
}
.pt-dot-active {
    background: #7ab3a2;
}

/* Step icon */
.pt-step-icon {
    font-size: 2rem;
    line-height: 1;
    text-align: center;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Step title */
.pt-step-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main, #1a2a20);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

/* Step body */
.pt-step-body {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-muted, #555);
    text-align: center;
    margin-bottom: 16px;
}
.pt-step-body strong {
    color: var(--text-main, #1a2a20);
}

/* Arrow — position:absolute inside the callout; left set by JS */
.pt-arrow {
    position: absolute;
    width: 0;
    height: 0;
}
.pt-arrow-up {
    top: -10px;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--container-bg, #ffffff);
}
.pt-arrow-down {
    bottom: -10px;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--container-bg, #ffffff);
}

/* Button row */
.pt-btn-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.pt-btn-skip {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 2px;
    cursor: pointer;
    font-family: inherit;
    min-height: 0;
    flex-shrink: 0;
}
.pt-btn-next {
    background: #7ab3a2;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 9px 20px;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.3px;
    min-height: 0;
    flex-shrink: 0;
    transition: background 0.15s;
}
.pt-btn-next:hover { background: #5a9a88; }


/* ── Mobile header ── */
.vm-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--btn-primary-bg);
    color: #fff;
    padding: 0 16px;
    height: 48px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 300;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.vm-mobile-header__brand {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 6px;
}

.vm-mobile-header__logo {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ffffff;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vm-mobile-header__arrow {
    font-size: 0.65rem;
    opacity: 0.75;
    vertical-align: middle;
    margin-left: 2px;
    letter-spacing: 0;
}

.vm-mobile-header__page-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.85);
}

/* Hide mobile header on desktop */
@media (min-width: 769px) {
    .vm-mobile-header {
        display: none;
    }
}

/* ════════════════════════════════════════════════════
   TRAINING BOTTOM SHEET
   .ts-bar / .ts-chip  — chip strip inside .settings-panel
   #trainingSheetBackdrop / #trainingSheet  — body-level overlay
   z-index tier: 400 (backdrop) / 401 (sheet)
   — sits above training UI (200) but below .overlay (500)
   ════════════════════════════════════════════════════ */

/* ── Chip bar — spans both columns of .settings-panel grid ── */
.ts-bar {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0 8px;
}

/* ── Individual chip ── */
.ts-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    padding: 7px 9px;
    border-radius: 8px;
    border: 1.5px solid var(--tile-border);
    background: var(--settings-bg);
    cursor: pointer;
    font-family: inherit;
    gap: 3px;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.12s, transform 0.08s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ts-chip:hover {
    border-color: #7ab3a2;
    background: rgba(122, 179, 162, 0.08);
}

.ts-chip:active {
    transform: scale(0.96);
    box-shadow: var(--shadow-inner);
}

/* Small ALL-CAPS category label  e.g. "LEN" */
.ts-chip-cat {
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1;
    opacity: 0.8;
}

/* Value + arrow on same row */
.ts-chip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 3px;
}

/* Current setting value  e.g. "3 letters" */
.ts-chip-val {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ▾ arrow indicator */
.ts-chip-arr {
    font-size: 0.60rem;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.60;
    line-height: 1;
}

/* ── Backdrop ── */
#trainingSheetBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 400;
    opacity: 0;
    transition: opacity 0.22s ease;
}

#trainingSheetBackdrop.ts-backdrop--open {
    opacity: 1;
}

/* ── Bottom sheet ── */
#trainingSheet {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 401;
    background: var(--container-bg);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.16);
    padding: 0 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.26s cubic-bezier(0.34, 1.1, 0.64, 1);
}

#trainingSheet.ts-sheet--open {
    transform: translateY(0);
}

/* ── Drag handle ── */
.ts-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--tile-border);
    margin: 12px auto 16px;
    opacity: 0.5;
}

/* ── Sheet title ── */
.ts-sheet-title {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 6px;
    opacity: 0.75;
}

/* ── Sheet content grid — mirrors .settings-panel 2-col layout ── */
.ts-sheet-grid {
    display: grid;
    grid-template-columns: 58px 1fr;
    column-gap: 12px;
    align-items: start;
}

/* ── Desktop: constrain sheet width to match .game-card (max 640px) ── */
@media (min-width: 601px) {
    #trainingSheet {
        left: 50%;
        right: auto;
        width: min(640px, 96vw);
        transform: translateX(-50%) translateY(100%);
        border-radius: 16px 16px 0 0;
    }
    #trainingSheet.ts-sheet--open {
        transform: translateX(-50%) translateY(0);
    }
}

/* ════════════════════════════════════════════════════
   LOADING SCREEN  (#vmLoadScreen)
   Visible by default (no JS needed to show it).
   Dismissed by window load event adding .vmls--fading.
   ════════════════════════════════════════════════════ */

#vmLoadScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--container-bg, #ffffff);
    opacity: 1;
    transition: opacity 0.55s ease;
    pointer-events: all;
}

#vmLoadScreen.vmls--fading {
    opacity: 0;
    pointer-events: none;
}

.vmls-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    user-select: none;
}

/* ── Brand block ── */
.vmls-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* ── Rackup loading screen — Concept 3 (R↑ monogram badge) ── */
.vmls-monogram {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 22px;
    background: linear-gradient(145deg, #5a9e8e, #7ab3a2);
    box-shadow: 0 6px 24px rgba(90,158,142,0.35);
    animation: vmls-badge-pulse 2s ease-in-out infinite;
}
.vmls-monogram-r {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}
.vmls-monogram-arrow {
    font-size: 1rem;
    font-weight: 800;
    color: rgba(255,255,255,0.8);
    margin-top: -10px;
    line-height: 1;
}
@keyframes vmls-badge-pulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 6px 24px rgba(90,158,142,0.35); }
    50%       { transform: scale(1.04); box-shadow: 0 10px 32px rgba(90,158,142,0.50); }
}

/* ── "RACKUP" wordmark below monogram ── */
.vmls-wordmark {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    color: var(--brand-primary, #7ab3a2);
    text-transform: uppercase;
}

/* ── Three-dot spinner ── */
.vmls-spinner {
    display: flex;
    gap: 7px;
    align-items: center;
}

.vmls-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-primary, #7ab3a2);
    opacity: 0.25;
    animation: vmls-dot-pulse 1.1s ease-in-out calc(var(--vmls-d) * 0.22s) infinite;
}

@keyframes vmls-dot-pulse {
    0%, 100% { opacity: 0.25; transform: scale(1);    }
    45%       { opacity: 1;    transform: scale(1.25); }
}

/* ── Status text ── */
.vmls-msg {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted, #888);
    letter-spacing: 0.04em;
    margin: 0;
}

/* Dark / nightlight theme adjustments */
[data-theme="dark"] #vmLoadScreen,
[data-theme="nightlight"] #vmLoadScreen {
    background: var(--container-bg);
}


/* ════════════════════════════════════════════════════
   SPLASH SCREEN — REMOVED (Session 17)
   Dead code deleted Session 19. #vmSplash does not
   exist in index.html. All vmspl-* rules removed.
   ════════════════════════════════════════════════════ */

/* ── Training tile drag ────────────────────────────────────────────────────── */
.tr-drag-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    width: 48px;
    height: 52px;
    background: var(--tile-bg, #fff);
    border: 2px solid var(--accent, #7ab3a2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--tile-text, #333);
    box-shadow: 0 8px 24px rgba(0,0,0,0.28);
    transform: rotate(-4deg) scale(1.08);
    user-select: none;
}

.tr-drop-active {
    outline: 2px dashed var(--accent, #7ab3a2) !important;
    outline-offset: 3px;
    background: rgba(122, 179, 162, 0.12) !important;
    border-radius: 6px;
}

/* Source tile fades while being dragged */
.tile.pt-dragging,
.display-letter.pt-dragging,
.free-slot.pt-dragging {
    opacity: 0.3;
}

/* ══════════════════════════════════════════════════════════════════════════
   DAILY PUZZLE PAGE — Phase 2
   #dailyPage sits at z-index 1000 — intentionally above .vm-mobile-header
   (z-index 999) so the daily page header is the only chrome visible.
   showMainMenu() hides it; RackupDaily.init() / showDailyPage() reveals it.
   All colors use CSS variables so themes apply automatically.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Page shell ──────────────────────────────────────────────────────────── */
#dailyPage {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--page-bg);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.dp-hdr {
    display: flex;
    align-items: center;
    padding: 12px 16px 10px;
    background: var(--container-bg);
    border-bottom: 1px solid rgba(122, 179, 162, 0.18);
    position: sticky;
    top: 0;
    z-index: 1;
    gap: 8px;
}

.dp-brand {
    font-family: 'Quicksand', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--brand-primary, #7ab3a2);
    white-space: nowrap;
}

.dp-brand-arrow {
    font-size: 9px;
    vertical-align: 1px;
}

.dp-hdr-center {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    opacity: 0.6;
}

.dp-hdr-sep {
    margin: 0 6px;
    opacity: 0.4;
}

.dp-puzzle-num {
    font-size: 11px;
    opacity: 0.6;
}

.dp-menu-btn {
    background: none;
    border: none;
    padding: 6px 4px;
    cursor: pointer;
    color: var(--text-main);
    opacity: 0.55;
    border-radius: 6px;
    line-height: 0;
    transition: opacity 0.15s;
    touch-action: manipulation;
}
.dp-menu-btn:hover { opacity: 1; }

/* ── Today's Puzzle button in main menu ──────────────────────────────────── */
.mm-daily-puzzle {
    border-left: 4px solid var(--brand-primary, #7ab3a2) !important;
}

/* ── Game area ───────────────────────────────────────────────────────────── */
#dpGameArea {
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
}

/* ── Tile rack ───────────────────────────────────────────────────────────── */
.dp-rack-section {
    padding: 24px 0 18px;
}

.dp-rack {
    display: flex;
    justify-content: center;
    gap: 7px;
    flex-wrap: wrap;
}

.dp-tile {
    width: 44px;
    height: 52px;
    background: var(--tile-bg);
    border: 2px solid rgba(122, 179, 162, 0.28);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--tile-text);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: transform 0.08s ease, border-color 0.1s, opacity 0.1s;
    box-shadow: 0 2px 0 rgba(0,0,0,0.10), 0 3px 6px rgba(0,0,0,0.06);
}

.dp-tile:active {
    transform: translateY(2px);
    box-shadow: none;
}

.dp-tile:hover:not(.dp-tile--sel) {
    border-color: var(--brand-primary, #7ab3a2);
    transform: translateY(-2px);
}

/* Selected state: dimmed, slightly sunk — tile's letter is "in the word" */
.dp-tile--sel {
    opacity: 0.28;
    border-color: rgba(122, 179, 162, 0.12);
    box-shadow: none;
    transform: translateY(1px);
    cursor: default;
}

/* ── Word display ────────────────────────────────────────────────────────── */
.dp-word-zone {
    margin-bottom: 10px;
}

.dp-word-display {
    min-height: 56px;
    background: var(--container-bg);
    border: 2px solid rgba(122, 179, 162, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    margin-bottom: 10px;
    transition: border-color 0.15s;
}

.dp-word-text {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--text-main);
}

.dp-word-hint {
    font-size: 0.8rem;
    color: var(--text-main);
    opacity: 0.3;
    font-style: italic;
}

/* Shake on invalid submit */
@keyframes dp-shake {
    0%, 100% { transform: translateX(0); }
    18%  { transform: translateX(-7px); }
    36%  { transform: translateX(7px); }
    54%  { transform: translateX(-4px); }
    72%  { transform: translateX(4px); }
}

.dp-shake {
    animation: dp-shake 0.36s ease;
    border-color: var(--error-red, #ffcdd2) !important;
}

/* ── Action buttons ──────────────────────────────────────────────────────── */
.dp-word-btns {
    display: flex;
    gap: 7px;
}

.dp-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-family: 'Quicksand', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    transition: opacity 0.12s, transform 0.08s;
    white-space: nowrap;
}
.dp-btn:active { transform: scale(0.94); }

.dp-btn--ghost {
    background: var(--container-bg);
    color: var(--text-main);
    border: 1.5px solid rgba(122, 179, 162, 0.25);
}
.dp-btn--ghost:hover { border-color: rgba(122, 179, 162, 0.6); }

.dp-btn--primary {
    background: var(--brand-primary, #7ab3a2);
    color: #fff;
    flex: 1;
    letter-spacing: 0.04em;
}
.dp-btn--primary:hover { opacity: 0.88; }

/* ── Feedback line ───────────────────────────────────────────────────────── */
.dp-feedback {
    min-height: 22px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.22s;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}

.dp-feedback--show  { opacity: 1; }
.dp-feedback--ok    { color: #2e7d4f; }
.dp-feedback--err   { color: #c0392b; }
.dp-feedback--neutral { color: var(--text-main); }

[data-theme="dark"] .dp-feedback--ok  { color: #5cb87a; }
[data-theme="dark"] .dp-feedback--err { color: #e57373; }

/* ── Found words section ─────────────────────────────────────────────────── */
.dp-found-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-main);
    opacity: 0.45;
    padding: 0 2px 8px;
    border-bottom: 1px solid rgba(122, 179, 162, 0.14);
    margin-bottom: 8px;
}

.dp-found-list {
    margin-bottom: 8px;
}

.dp-found-empty {
    text-align: center;
    font-size: 13px;
    color: var(--text-main);
    opacity: 0.25;
    padding: 18px 0;
    font-style: italic;
}

.dp-found-word {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 3px;
    border-bottom: 1px solid rgba(122, 179, 162, 0.07);
}

.dp-fw-text {
    font-family: 'Quicksand', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-main);
}

.dp-fw-pts {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-primary, #7ab3a2);
}

.dp-word--r2 .dp-fw-text { color: #8a6a10; }
.dp-word--r3 .dp-fw-text { color: #6b2580; }

[data-theme="dark"] .dp-word--r2 .dp-fw-text { color: #d4a820; }
[data-theme="dark"] .dp-word--r3 .dp-fw-text { color: #c084fc; }

/* ── Finish button ───────────────────────────────────────────────────────── */
.dp-game-footer {
    padding-top: 20px;
    text-align: center;
}

.dp-finish-btn {
    background: none;
    border: 2px solid rgba(122, 179, 162, 0.3);
    border-radius: 9px;
    padding: 10px 28px;
    font-family: 'Quicksand', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    opacity: 0.55;
    cursor: pointer;
    touch-action: manipulation;
    transition: opacity 0.15s, border-color 0.15s;
}
.dp-finish-btn:hover {
    opacity: 0.9;
    border-color: rgba(122, 179, 162, 0.65);
}

/* ── Result area ─────────────────────────────────────────────────────────── */
#dpResultArea {
    padding: 20px 16px 40px;
}

.dp-result-hero {
    text-align: center;
    padding: 22px 20px;
    background: var(--container-bg);
    border-radius: 16px;
    margin-bottom: 18px;
}

.dp-result-pts {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 3.6rem;
    font-weight: 700;
    color: var(--brand-primary, #7ab3a2);
    line-height: 1;
}

.dp-result-pts-lbl {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-main);
    opacity: 0.45;
    margin-top: 5px;
}

.dp-result-counts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin-bottom: 18px;
}

.dp-result-count { text-align: center; }

.dp-rc-val {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.dp-rc-lbl {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-main);
    opacity: 0.4;
    margin-top: 3px;
}

.dp-result-count-sep {
    width: 1px;
    height: 38px;
    background: rgba(122, 179, 162, 0.2);
}

/* Anchor word reveal */
.dp-anchor-section {
    text-align: center;
    padding: 16px;
    background: var(--container-bg);
    border-radius: 12px;
    border: 2px solid rgba(122, 179, 162, 0.22);
    margin-bottom: 20px;
}

.dp-anchor-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-main);
    opacity: 0.4;
    margin-bottom: 8px;
}

.dp-anchor-word {
    font-family: 'Quicksand', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--brand-primary, #7ab3a2);
}

/* All-words chips */
.dp-all-words-hdr {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-main);
    opacity: 0.4;
    margin-bottom: 10px;
}

.dp-all-words {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 28px;
}

.dp-result-chip {
    font-family: 'Quicksand', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1.5px solid;
    text-transform: uppercase;
}

/* Found */
.dp-rc--found {
    background: rgba(46, 125, 79, 0.1);
    border-color: #2e7d4f;
    color: #2e7d4f;
}
/* Missed */
.dp-rc--missed {
    background: transparent;
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-main);
    opacity: 0.28;
}
/* Anchor word (overrides found/missed, always full opacity) */
.dp-rc--anchor {
    border-color: var(--brand-primary, #7ab3a2) !important;
    color: var(--brand-primary, #7ab3a2) !important;
    background: rgba(122, 179, 162, 0.12) !important;
    opacity: 1 !important;
    font-size: 12px !important;
}
/* Uncommon found */
.dp-rc--r2.dp-rc--found {
    border-color: #8a6a10;
    color: #8a6a10;
    background: rgba(138, 106, 16, 0.1);
}
/* Obscure found */
.dp-rc--r3.dp-rc--found {
    border-color: #6b2580;
    color: #6b2580;
    background: rgba(107, 37, 128, 0.1);
}

[data-theme="dark"] .dp-rc--found        { color: #5cb87a; border-color: #5cb87a; background: rgba(92,184,122,0.12); }
[data-theme="dark"] .dp-rc--missed       { opacity: 0.18; }
[data-theme="dark"] .dp-rc--r2.dp-rc--found { color: #d4a820; border-color: #d4a820; background: rgba(212,168,32,0.12); }
[data-theme="dark"] .dp-rc--r3.dp-rc--found { color: #c084fc; border-color: #c084fc; background: rgba(192,132,252,0.12); }

/* Result footer */
.dp-result-bottom {
    text-align: center;
    padding-top: 8px;
}

.dp-result-cta {
    font-size: 13px;
    color: var(--text-main);
    opacity: 0.45;
    font-style: italic;
}

/* ── Phase 3: Trophy ─────────────────────────────────────────────────────── */
@keyframes dp-trophy-drop {
    0%   { transform: translateY(-50px) scale(0.5); opacity: 0; }
    65%  { transform: translateY(5px) scale(1.1);  opacity: 1; }
    82%  { transform: translateY(-3px) scale(0.96); }
    100% { transform: translateY(0)   scale(1); }
}
@keyframes dp-trophy-pulse {
    0%, 100% { filter: drop-shadow(0 0 3px currentColor); }
    50%       { filter: drop-shadow(0 0 10px currentColor); }
}

.dp-trophy-wrap {
    text-align: center;
    padding: 20px 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dp-trophy-icon {
    font-size: 3rem;
    display: block;
    animation: dp-trophy-drop 0.55s cubic-bezier(0.34,1.56,0.64,1) both,
               dp-trophy-pulse 2.2s ease-in-out 0.55s infinite;
}

.dp-trophy--platinum { color: #7ab3a2; }
.dp-trophy--gold     { color: #c8a020; }
.dp-trophy--silver   { color: #8a9aaa; }
.dp-trophy--bronze   { color: #a06030; }

.dp-trophy-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.55;
    color: var(--text-main);
}

/* ── Phase 3: Rank ───────────────────────────────────────────────────────── */
.dp-rank-wrap {
    text-align: center;
    padding: 6px 0 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    opacity: 0.55;
}

.dp-rank-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-primary, #7ab3a2);
    opacity: 1;
}

/* ── Phase 3: Yesterday banner ───────────────────────────────────────────── */
.dp-yesterday-banner {
    background: var(--container-bg);
    border-bottom: 1px solid rgba(122,179,162,0.18);
    text-align: center;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    opacity: 0.6;
    letter-spacing: 0.02em;
}

/* ── Phase 3: Register prompt ────────────────────────────────────────────── */
.dp-register-prompt {
    margin: 16px 0 4px;
    padding: 14px 16px;
    background: var(--container-bg);
    border-radius: 10px;
    border: 1.5px solid rgba(122,179,162,0.2);
    text-align: center;
}

.dp-register-text {
    font-size: 13px;
    color: var(--text-main);
    opacity: 0.7;
    margin-bottom: 10px;
}

.dp-register-btn {
    width: 100%;
    padding: 10px;
    font-size: 13px;
}
