
        /* ----- Settings bar (mode + difficulty) ----- */
        .settings-bar {
            display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center;
            margin-bottom: 0.6rem; max-width: 540px;
        }
        .setting-group {
            display: flex; align-items: center; gap: 0.3rem;
            background: rgba(15, 12, 25, 0.55);
            border: 1px solid rgba(122, 252, 255, 0.22);
            border-radius: 30px; padding: 0.25rem 0.4rem;
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
        }
        .setting-label {
            font-family: 'Orbitron', monospace;
            font-size: 0.52rem;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: rgba(122, 252, 255, 0.85);
            padding-left: 0.45rem;
        }
        .setting-btn {
            padding: 0.32rem 0.7rem; border: none; border-radius: 20px;
            font-family: inherit; font-size: 0.7rem; font-weight: 700;
            cursor: pointer; background: transparent; color: #cfe9f0;
            transition: all 0.18s;
            letter-spacing: 0.04em;
        }
        .setting-btn.active {
            background: linear-gradient(135deg, #7afcff, #00b3c4);
            color: #03161a;
            box-shadow: 0 2px 14px rgba(0, 179, 196, 0.45);
        }
        .setting-btn:hover:not(.active):not(:disabled) {
            background: rgba(122, 252, 255, 0.15);
        }
        .setting-btn:disabled { opacity: 0.4; cursor: not-allowed; }

        /* ----- Canvas container + overlays ----- */
        .game-container {
            position: relative;
            width: fit-content;
            max-width: 100%;
            margin: 0;
            border-radius: 18px;
            overflow: hidden;
            box-shadow:
                0 24px 70px rgba(0, 0, 0, 0.55),
                0 0 0 1px rgba(122, 252, 255, 0.18) inset,
                0 0 80px rgba(122, 252, 255, 0.08) inset;
        }
        #pongCanvas {
            display: block;
            border-radius: 18px;
            touch-action: none;
            cursor: pointer;
            background: #06060d;
        }

        /* HUD bar: pause + scoreboard */
        .game-hud { position: absolute; inset: 0; pointer-events: none; }
        .hud-top {
            position: absolute; top: 10px; left: 10px; right: 10px;
            display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
        }
        .hud-score-box {
            pointer-events: none;
            background: rgba(8, 6, 14, 0.55);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border: 1px solid rgba(122, 252, 255, 0.22);
            color: #fff;
            border-radius: 16px;
            padding: 7px 14px;
            font-family: 'Orbitron', monospace;
            display: flex;
            align-items: center;
            gap: 14px;
        }
        .hud-side {
            display: flex; flex-direction: column; align-items: center;
            min-width: 36px;
        }
        .hud-side-label {
            font-size: 0.5rem;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.55);
        }
        .hud-side-score {
            font-size: 1.5rem;
            font-weight: 800;
            line-height: 1.1;
            text-shadow: 0 0 12px currentColor;
        }
        .hud-side-l .hud-side-score { color: #7afcff; }
        .hud-side-r .hud-side-score { color: #ff79e8; }
        .hud-side-l .hud-side-label { color: rgba(122, 252, 255, 0.75); }
        .hud-side-r .hud-side-label { color: rgba(255, 121, 232, 0.75); }
        .hud-dash {
            color: rgba(255, 255, 255, 0.3);
            font-size: 0.9rem;
            font-weight: 700;
        }
        .hud-pause-btn {
            pointer-events: auto;
            width: 44px; height: 44px;
            border-radius: 12px;
            background: rgba(8, 6, 14, 0.55);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border: 1px solid rgba(122, 252, 255, 0.22);
            color: #fff;
            font-size: 1.2rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.15s, background 0.15s;
        }
        .hud-pause-btn:hover { background: rgba(8, 6, 14, 0.8); transform: scale(1.05); }
        .hud-pause-btn[hidden] { display: none; }

        /* Power-up bubble (between rallies) */
        .powerup-bubble {
            position: absolute;
            left: 50%;
            top: 60%;
            transform: translate(-50%, -50%);
            pointer-events: auto;
            cursor: pointer;
            background: rgba(8, 6, 14, 0.78);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border: 1px solid rgba(252, 214, 99, 0.45);
            color: #fcd663;
            font-family: 'Orbitron', monospace;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            padding: 10px 18px;
            border-radius: 99px;
            box-shadow: 0 6px 24px rgba(252, 214, 99, 0.35), 0 0 0 4px rgba(252, 214, 99, 0.08);
            animation: powerupPulse 1.4s ease-in-out infinite;
            display: flex;
            align-items: center;
            gap: 8px;
            z-index: 4;
        }
        .powerup-bubble:hover { transform: translate(-50%, -50%) scale(1.05); }
        .powerup-bubble.hidden { display: none; }
        .powerup-bubble .icon { font-size: 1.1rem; }
        @keyframes powerupPulse {
            0%, 100% { box-shadow: 0 6px 24px rgba(252, 214, 99, 0.35), 0 0 0 4px rgba(252, 214, 99, 0.08); }
            50% { box-shadow: 0 6px 30px rgba(252, 214, 99, 0.55), 0 0 0 7px rgba(252, 214, 99, 0.15); }
        }

        /* Active powerup chip on the side */
        .powerup-active {
            position: absolute;
            left: 50%;
            top: 60px;
            transform: translateX(-50%);
            pointer-events: none;
            background: rgba(252, 214, 99, 0.18);
            border: 1px solid rgba(252, 214, 99, 0.55);
            color: #fcd663;
            font-family: 'Orbitron', monospace;
            font-size: 0.6rem;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            padding: 5px 12px;
            border-radius: 99px;
            display: none;
            align-items: center;
            gap: 6px;
            z-index: 3;
        }
        .powerup-active.visible { display: inline-flex; }

        /* Start / pause / gameover overlays.
           CONFINED to the board (position:absolute inside .game-main) on desktop
           so the side rail (mode + difficulty) stays clickable behind them — the
           player can launch a new game at a different difficulty without the
           overlay burying the selectors. Mobile flips them back to full-screen
           fixed (see @media below). The container has NO backdrop-filter, so a
           fixed overlay is not trapped to it. */
        .overlay {
            position: absolute;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            background: linear-gradient(180deg, rgba(6, 6, 13, 0.55), rgba(6, 6, 13, 0.78));
            text-align: center;
            color: #fff;
            font-family: 'Orbitron', monospace;
            padding: 24px;
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            border-radius: 18px;
            overflow-y: auto;
            z-index: 20;
        }
        .overlay.active { display: flex; }
        .overlay .overlay-box,
        .overlay > div { margin: auto; }
        .overlay-box {
            background: rgba(10, 8, 18, 0.78);
            border: 1px solid rgba(122, 252, 255, 0.22);
            border-radius: 22px;
            padding: 28px 28px 24px;
            min-width: 260px;
            max-width: 380px;
            box-shadow:
                0 20px 60px rgba(0, 0, 0, 0.55),
                0 0 60px rgba(122, 252, 255, 0.06) inset;
        }
        .overlay-title {
            font-size: 1.6rem;
            font-weight: 900;
            letter-spacing: 0.05em;
            margin: 0 0 6px;
            color: #7afcff;
            text-shadow: 0 0 18px rgba(122, 252, 255, 0.45);
        }
        .overlay-title.victory { color: #fcd663; text-shadow: 0 0 18px rgba(252, 214, 99, 0.5); }
        .overlay-title.defeat { color: #ff79e8; text-shadow: 0 0 18px rgba(255, 121, 232, 0.5); }
        .overlay-sub {
            margin: 0 0 18px;
            color: rgba(255, 255, 255, 0.75);
            font-family: -apple-system, sans-serif;
            font-size: 0.9rem;
            line-height: 1.5;
        }
        .overlay-btn-row {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            justify-content: center;
        }
        .overlay-btn {
            padding: 11px 20px;
            border-radius: 99px;
            border: 0;
            cursor: pointer;
            font-family: 'Orbitron', monospace;
            font-size: 0.78rem;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            transition: transform 0.15s, box-shadow 0.15s;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }
        .overlay-btn-primary {
            background: linear-gradient(135deg, #7afcff, #00b3c4);
            color: #03161a;
        }
        .overlay-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0, 179, 196, 0.45); }
        .overlay-btn-ghost {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.22);
            color: #fff;
        }
        .overlay-btn-ghost:hover { background: rgba(255, 255, 255, 0.13); }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
            margin: 12px 0 18px;
        }
        .stats-grid.three { grid-template-columns: repeat(3, 1fr); }
        .stat-cell {
            padding: 10px 6px;
            background: rgba(122, 252, 255, 0.04);
            border: 1px solid rgba(122, 252, 255, 0.16);
            border-radius: 10px;
        }
        .stat-cell-label {
            font-size: 0.55rem;
            letter-spacing: 0.14em;
            color: rgba(255, 255, 255, 0.55);
            margin-bottom: 4px;
        }
        .stat-cell-value {
            font-size: 1.1rem;
            font-weight: 800;
            color: #7afcff;
        }
        .stat-cell-value.gold { color: #fcd663; }
        .stat-cell-value.magenta { color: #ff79e8; }

        /* Start CTA (idle pulse) */
        .start-cta {
            background: linear-gradient(135deg, #7afcff, #00b3c4);
            color: #03161a;
            padding: 16px 38px;
            border-radius: 99px;
            font-family: 'Orbitron', monospace;
            font-weight: 800;
            font-size: 1.05rem;
            letter-spacing: 0.16em;
            text-transform: uppercase;
            box-shadow: 0 14px 36px rgba(0, 179, 196, 0.45);
            animation: startPulse 1.6s ease-in-out infinite;
            cursor: pointer;
            border: none;
        }
        @keyframes startPulse {
            0%, 100% { transform: scale(1); box-shadow: 0 14px 36px rgba(0, 179, 196, 0.45); }
            50% { transform: scale(1.05); box-shadow: 0 18px 44px rgba(0, 179, 196, 0.7); }
        }
        .start-sub {
            display: block;
            margin-top: 14px;
            font-size: 0.84rem;
            color: rgba(255, 255, 255, 0.78);
            font-weight: 500;
            letter-spacing: 0.06em;
            font-family: -apple-system, sans-serif;
        }

        /* Countdown big number */
        .countdown {
            font-size: 5rem;
            font-weight: 900;
            color: #7afcff;
            text-shadow: 0 0 30px rgba(122, 252, 255, 0.65);
            animation: countdownPulse 1s ease-out;
        }
        @keyframes countdownPulse {
            0% { transform: scale(0.6); opacity: 0; }
            40% { transform: scale(1.3); opacity: 1; }
            100% { transform: scale(1); opacity: 0.95; }
        }

        /* Help + history panels */
        .help-toggle, .history-toggle {
            display: block; margin: 0.7rem auto 0; padding: 0.4rem 1.1rem;
            background: none; border: 1px solid rgba(122, 252, 255, 0.32);
            color: #cfe9f0; border-radius: 20px;
            font-family: 'Orbitron', monospace; font-size: 0.66rem;
            cursor: pointer; letter-spacing: 0.12em; text-transform: uppercase;
        }
        .help-toggle:hover, .history-toggle:hover { background: rgba(122, 252, 255, 0.08); }
        .help-panel, .history-panel {
            display: none; max-width: 540px; margin: 0.8rem auto 0; padding: 1rem 1.2rem;
            background: rgba(10, 8, 18, 0.62);
            border: 1px solid rgba(122, 252, 255, 0.22);
            border-radius: 14px;
            color: #cfe9f0;
            font-family: -apple-system, sans-serif;
            font-size: 0.86rem; line-height: 1.55;
        }
        .help-panel.active, .history-panel.active { display: block; }
        .help-panel h3 {
            margin: 0 0 6px;
            font-family: 'Orbitron', monospace;
            font-size: 0.85rem;
            color: #7afcff;
            letter-spacing: 0.06em;
        }
        .help-panel ul { margin: 0 0 10px; padding-left: 20px; }
        .help-panel li { margin: 3px 0; }
        .help-panel strong { color: #fcd663; }
        .history-title {
            font-family: 'Orbitron', monospace; font-size: 0.66rem;
            text-transform: uppercase; letter-spacing: 0.1em;
            color: #7afcff; text-align: center; margin-bottom: 8px;
        }
        .history-item {
            display: flex; justify-content: space-between; align-items: center;
            padding: 6px 12px; background: rgba(122, 252, 255, 0.05);
            border: 1px solid rgba(122, 252, 255, 0.12);
            border-radius: 8px;
            font-size: 0.78rem; margin-bottom: 4px;
        }
        .history-score { font-family: 'Orbitron', monospace; font-weight: 700; color: #fcd663; }
        .history-meta { color: rgba(207, 233, 240, 0.7); font-size: 0.72rem; }
        .history-empty { text-align: center; color: rgba(207, 233, 240, 0.45); font-size: 0.84rem; padding: 12px; }

        /* Best per difficulty mini-table on game over */
        .bests-row {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            margin: 10px 0 14px;
        }
        .best-cell {
            background: rgba(122, 252, 255, 0.04);
            border: 1px solid rgba(122, 252, 255, 0.14);
            border-radius: 8px;
            padding: 6px 4px;
        }
        .best-cell .best-label {
            font-size: 0.5rem;
            letter-spacing: 0.12em;
            color: rgba(255, 255, 255, 0.5);
            margin-bottom: 2px;
            text-transform: uppercase;
        }
        .best-cell .best-val {
            font-family: 'Orbitron', monospace;
            font-size: 0.78rem;
            font-weight: 800;
            color: #7afcff;
        }
        .best-cell.active { border-color: rgba(252, 214, 99, 0.55); background: rgba(252, 214, 99, 0.08); }
        .best-cell.active .best-val { color: #fcd663; }

        /* Pause icon */
        .pause-icon::before { content: '⏸'; }
        .play-icon::before { content: '▶'; }

        /* ----- Pong theme variables (used by shared games.css) ----- */
        body.game-page {
            --t-bg: #06060d;
            --t-bg-grad: radial-gradient(ellipse at 50% -10%, #0e0c20 0%, #06060d 70%);
            --t-text: #cfe9f0;
            --t-text-muted: rgba(207, 233, 240, 0.78);
            --t-primary: #7afcff;
            --t-primary-mid: #00d8ed;
            --t-primary-dark: #00b3c4;
            --t-card-bg: rgba(10, 8, 18, 0.6);
            --t-card-border: rgba(122, 252, 255, 0.22);
            --t-btn-grad: linear-gradient(135deg, #7afcff, #00b3c4);
        }
        body.game-page .game-name,
        body.game-page .score-value {
            color: #7afcff !important;
            -webkit-text-fill-color: #7afcff !important;
            background: none !important;
            text-shadow: 0 0 14px rgba(122, 252, 255, 0.5);
        }

        /* ============================================================
           DESKTOP BOARD + SIDE RAIL (2026-06-03)
           The wide 5:3 board grows to fill the viewport HEIGHT; the rail
           consumes the leftover horizontal space with setup/stats/recent
           games + how-to-play. Overlays are confined to the board (above)
           so the rail stays clickable — previously the full-screen start &
           game-over overlays buried the mode/difficulty selectors, so you
           could never start a new game at a different difficulty.
           ============================================================ */
        .game-layout {
            display: flex; gap: 22px; align-items: flex-start;
            justify-content: center; width: 100%;
            max-width: 1400px; margin: 0 auto; padding: 0 18px;
        }
        .game-main {
            position: relative; display: flex; flex-direction: column;
            align-items: center; min-width: 0; max-width: 100%;
        }
        .game-rail {
            width: 340px; flex-shrink: 0;
            display: flex; flex-direction: column; gap: 14px;
        }
        .rail-card {
            background: rgba(10, 8, 18, 0.6);
            border: 1px solid rgba(122, 252, 255, 0.22);
            border-radius: 16px; padding: 14px 16px;
            backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
        }
        .rail-card-title {
            font-family: 'Orbitron', monospace; font-size: 0.6rem;
            text-transform: uppercase; letter-spacing: 0.14em;
            color: #7afcff; margin-bottom: 10px;
        }
        /* Settings stack full-width in the rail */
        .game-rail .settings-bar {
            flex-direction: column; align-items: stretch;
            gap: 10px; margin: 0; max-width: none;
        }
        .game-rail .setting-group { justify-content: space-between; }
        /* Recent games + help live in the rail */
        .game-rail .history-toggle, .game-rail .help-toggle {
            display: block; width: 100%; margin: 0; text-align: left;
        }
        .game-rail .history-panel, .game-rail .help-panel {
            max-width: none; margin: 10px 0 0; background: none;
            border: none; padding: 0;
        }

        /* In-overlay mode/difficulty re-pick — MOBILE only (desktop uses the
           always-visible rail). Lets the end / start screens launch a new run
           at a different difficulty without hunting for a panel. */
        .overlay-settings { display: none; }

        @media (max-width: 899px) {
            .game-layout { flex-direction: column; align-items: center; gap: 14px; padding: 0 12px; }
            .game-rail { width: 100%; max-width: 540px; }
            .game-rail .settings-bar { flex-direction: row; flex-wrap: wrap; justify-content: center; }
            .game-rail .setting-group { justify-content: center; }
            /* Mobile: overlays go full-screen (no rail beside the board to
               preserve), so the start / end screens get the whole viewport. */
            .overlay { position: fixed; border-radius: 0; z-index: 10000; }
            .overlay-settings {
                display: flex; flex-wrap: wrap; gap: 8px;
                justify-content: center; margin: 4px 0 14px;
            }
        }
