:root {
    --neon-cyan: #00f3ff;
    --neon-gold: #ffd60a;
    --neon-pink: #ff5e78;
    --warm-red: #e63946;
    --bg-deep: #0f0a1f;
    --glass-bg: rgba(15, 10, 31, 0.55);
    --glass-border: rgba(255, 255, 255, 0.15);
    /* HUD scales relative to viewport but caps at sensible sizes */
    --hud-scale: clamp(0.7, 1vw, 1.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;            /* fill the *visible* viewport on mobile (URL bar aware) */
    overflow: hidden;
    overscroll-behavior: none; /* kill rubber-band / pull-to-refresh on mobile */
    background: linear-gradient(135deg, #1a0a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
}

body {
    position: fixed;           /* lock the page so iOS can't rubber-band the splash */
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    touch-action: manipulation;
}

#game-container {
    position: relative;
    width: min(100vw, calc(100vh * 16 / 9));
    height: min(100vh, calc(100vw * 9 / 16));
    width: min(100dvw, calc(100dvh * 16 / 9));   /* dvh = visible viewport on mobile */
    height: min(100dvh, calc(100dvw * 9 / 16));
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 16 / 9;
    box-shadow: 0 0 80px rgba(0, 243, 255, 0.2), 0 20px 60px rgba(0,0,0,0.5);
    background: #87ceeb;
    overflow: hidden;
    border-radius: 8px;
}

#game-container:fullscreen,
#game-container:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* === HUD — responsive, always visible === */
#hud {
    position: absolute;
    top: clamp(8px, 1.5%, 20px);
    left: clamp(8px, 1.5%, 20px);
    right: clamp(8px, 1.5%, 20px);
    display: flex;
    justify-content: space-between;
    gap: clamp(6px, 1%, 14px);
    pointer-events: none;
    z-index: 10;
    flex-wrap: wrap;
    align-items: flex-start;
}

.hud-item {
    background: var(--glass-bg);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border: 1.5px solid var(--glass-border);
    padding: clamp(4px, 0.8vw, 10px) clamp(10px, 1.4vw, 20px);
    border-radius: clamp(8px, 1.2vw, 16px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    min-width: clamp(60px, 8vw, 100px);
}

.hud-label {
    font-size: clamp(8px, 0.85vw, 11px);
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
    font-weight: 700;
    text-transform: uppercase;
}

.hud-value {
    font-size: clamp(16px, 2vw, 28px);
    font-weight: 900;
    color: var(--neon-cyan);
    text-shadow: 0 0 12px rgba(0, 243, 255, 0.7), 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
    line-height: 1;
    margin-top: 2px;
}

#nitro-charges {
    display: flex;
    gap: clamp(2px, 0.4vw, 6px);
    margin-top: 4px;
}

.nitro-charge {
    width: clamp(8px, 1vw, 14px);
    height: clamp(14px, 1.8vw, 24px);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: skewX(-15deg);
    transition: all 0.2s;
    border-radius: 2px;
}

.nitro-charge.active {
    background: linear-gradient(180deg, #ffd60a, #ff8800);
    border-color: #fff;
    box-shadow: 0 0 10px var(--neon-gold), inset 0 0 4px rgba(255,255,255,0.5);
}

.hud-buttons {
    display: flex;
    gap: clamp(4px, 0.5vw, 8px);
    pointer-events: auto;
}

.hud-btn {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    color: #fff;
    width: clamp(44px, 4.5vw, 60px);
    height: clamp(44px, 4.5vw, 60px);
    font-size: clamp(24px, 3vw, 38px);
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    text-shadow:
        0 0 8px rgba(0, 0, 0, 0.9),
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 0 2px rgba(255, 255, 255, 0.3);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    padding: 0;
}

.hud-btn:hover {
    transform: scale(1.15);
}
.hud-btn:active {
    transform: scale(0.95);
}

/* === Modals === */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(15,10,31,0.85) 0%, rgba(5,7,15,0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: linear-gradient(145deg, rgba(30, 20, 60, 0.95), rgba(15, 10, 40, 0.95));
    border: 2px solid rgba(255, 214, 10, 0.3);
    padding: clamp(20px, 3vw, 36px) clamp(24px, 4vw, 44px);
    border-radius: 24px;
    max-width: 520px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 214, 10, 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
    max-height: 92vh;
    overflow-y: auto;
}

.modal-content.welcome {
    border-color: rgba(0, 243, 255, 0.4);
    box-shadow: 0 0 80px rgba(0, 243, 255, 0.25);
}

.modal-content h1 {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    letter-spacing: 1px;
    line-height: 1.1;
    margin-bottom: 8px;
    background: linear-gradient(90deg, #ffd60a, #ff5e78, #00f3ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 30px rgba(255, 214, 10, 0.4);
}

.modal-content h2 { font-size: clamp(22px, 2.5vw, 28px); margin-bottom: 12px; }
.modal-content h3 {
    font-size: clamp(13px, 1.4vw, 16px);
    margin: 18px 0 8px;
    letter-spacing: 2px;
    color: var(--neon-gold);
    text-shadow: 0 0 12px rgba(255, 214, 10, 0.5);
}

.modal-content p {
    color: rgba(255, 255, 255, 0.75);
    font-size: clamp(13px, 1.3vw, 16px);
    margin-bottom: 16px;
}

.subtitle { font-size: clamp(13px, 1.4vw, 16px) !important; color: rgba(255,255,255,0.8) !important; }

.title-block { margin-bottom: 20px; }

.name-input-wrap { margin-bottom: 16px; }

#player-name-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: clamp(15px, 1.5vw, 18px);
    text-align: center;
    letter-spacing: 1px;
    border-radius: 12px;
    outline: none;
    font-weight: 700;
    transition: all 0.2s;
}

#player-name-input:focus {
    border-color: var(--neon-cyan);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.3);
}

#player-name-input::placeholder { color: rgba(255,255,255,0.4); font-weight: 500; }

.big-btn {
    width: 100%;
    padding: clamp(12px, 1.6vw, 18px);
    border: none;
    color: white;
    font-size: clamp(16px, 1.8vw, 22px);
    font-weight: 900;
    letter-spacing: 2px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 12px;
    text-transform: uppercase;
    font-family: inherit;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.big-btn.primary {
    background: linear-gradient(90deg, #ff5e78, #ffd60a, #ff8800);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.big-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 32px rgba(255, 94, 120, 0.4);
}

.big-btn:active { transform: translateY(-1px) scale(1.0); }

.text-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: clamp(11px, 1.1vw, 13px);
    cursor: pointer;
    padding: 8px;
    text-decoration: underline;
    font-family: inherit;
    transition: color 0.2s;
}

.text-btn:hover { color: var(--neon-cyan); }

.controls-hint { font-size: clamp(11px, 1.2vw, 14px); color: rgba(255,255,255,0.7); margin-bottom: 12px; }

kbd {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    padding: 3px 8px;
    font-family: monospace;
    font-size: clamp(10px, 1vw, 12px);
    margin: 0 2px;
}

/* === Leaderboard === */
.mini-board, #leaderboard-table {
    margin: 12px 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 10px 12px;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    gap: 12px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: clamp(12px, 1.3vw, 14px);
    align-items: center;
}

.leaderboard-row:last-child { border-bottom: none; }
.lb-rank { color: var(--neon-gold); font-weight: 900; text-align: center; }
.lb-name { text-align: left; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: var(--neon-cyan); font-weight: 700; font-family: monospace; }

.leaderboard-row.current-player { background: rgba(255, 214, 10, 0.15); border-radius: 6px; }
.leaderboard-row.current-player .lb-name { color: var(--neon-gold); }
.empty-board { text-align: center; color: rgba(255,255,255,0.4); font-size: 13px; padding: 10px; }

/* === End screen === */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 16px 0;
}

.stat {
    background: rgba(0,0,0,0.3);
    padding: 12px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label { font-size: 11px; color: rgba(255,255,255,0.5); letter-spacing: 1px; text-transform: uppercase; }
.stat-value {
    font-size: clamp(18px, 2.2vw, 26px);
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255, 214, 10, 0.5);
    margin-top: 4px;
    font-family: 'Courier New', monospace;
}

/* Spinner */
.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255,255,255,0.1);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    margin: 16px auto;
    animation: spin 0.8s linear infinite;
}

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

.hidden { display: none !important; }

/* === HUD opacity baseline (0.9) and dim transition === */
#hud {
    opacity: 0.9;
    transition: opacity 0.6s ease;
}
#hud.dimmed {
    opacity: 0 !important;
}

.hud-left-group {
    display: flex;
    gap: clamp(8px, 1.2vw, 16px);
    align-items: stretch;
}

/* === Mario-style coin counter beside timer === */
.coin-counter {
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.6vw, 10px);
    padding: clamp(6px, 1vw, 12px) clamp(14px, 1.8vw, 24px);
    background: linear-gradient(180deg, rgba(20, 18, 40, 0.7) 0%, rgba(10, 8, 20, 0.85) 100%);
    border: 2px solid rgba(255, 214, 10, 0.55);
    border-radius: clamp(14px, 1.8vw, 22px);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    box-shadow:
        inset 0 1px 0 rgba(255, 214, 10, 0.3),
        0 6px 18px rgba(0, 0, 0, 0.4),
        0 0 14px rgba(255, 214, 10, 0.25);
}
.coin-icon {
    font-size: clamp(28px, 3.5vw, 50px);
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(255, 214, 10, 0.6))
            drop-shadow(0 2px 0 rgba(0, 0, 0, 0.4));
    animation: coin-spin-counter 2.2s linear infinite;
}
@keyframes coin-spin-counter {
    0%, 60%, 100% { transform: rotateY(0deg); }
    70% { transform: rotateY(180deg); }
    80% { transform: rotateY(360deg); }
}
.coin-mult {
    font-size: clamp(18px, 2.4vw, 32px);
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    font-family: Georgia, serif;
    margin: 0 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.coin-num {
    font-size: clamp(26px, 3.4vw, 48px);
    font-weight: 900;
    color: var(--neon-gold);
    font-family: 'Courier New', monospace;
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.6),
        0 0 12px rgba(255, 214, 10, 0.7);
    letter-spacing: 1px;
    min-width: 1.5ch;
    text-align: left;
    transition: transform 0.15s;
}
.coin-counter.bump .coin-num {
    transform: scale(1.3);
}

/* === Bigger lively kid-friendly timer HUD with bevels === */
#timer-display {
    background: linear-gradient(180deg, #fde047 0%, #fbbf24 50%, #d97706 100%);
    border: 3px solid #fff;
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.7),
        inset 0 -2px 0 rgba(0,0,0,0.25),
        0 6px 0 #92400e,
        0 10px 24px rgba(0,0,0,0.4);
    padding: clamp(8px, 1.3vw, 14px) clamp(16px, 2.2vw, 30px) !important;
    border-radius: clamp(14px, 1.8vw, 22px) !important;
    transform: translateY(0);
    transition: transform 0.2s;
}
#timer-display .hud-label {
    color: #78350f !important;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
#timer-display .hud-value {
    color: #78350f !important;
    font-size: clamp(28px, 4vw, 56px) !important;
    text-shadow:
        2px 2px 0 #fff,
        0 4px 0 rgba(146, 64, 14, 0.4),
        0 6px 12px rgba(0,0,0,0.3) !important;
    font-weight: 900;
}

/* === Casino mode: pulse + red when ≤ 60s === */
#timer-display.urgent {
    background: linear-gradient(180deg, #fecaca 0%, #ef4444 50%, #991b1b 100%);
    border-color: #fef2f2;
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.6),
        inset 0 -2px 0 rgba(0,0,0,0.35),
        0 6px 0 #7f1d1d,
        0 0 30px rgba(239, 68, 68, 0.6),
        0 10px 28px rgba(0,0,0,0.5);
    animation: casino-pulse 0.7s ease-in-out infinite;
}
#timer-display.urgent .hud-label,
#timer-display.urgent .hud-value {
    color: #fff !important;
    text-shadow:
        2px 2px 0 #7f1d1d,
        0 4px 0 rgba(0,0,0,0.4),
        0 0 16px rgba(255, 255, 255, 0.6) !important;
}
@keyframes casino-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* === Splash multi-stage sequence === */
.splash-overlay {
    position: absolute;
    inset: 0;
    /* Pixar-y layered depth: warm top spotlight, cool deep vignette, soft color blooms */
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(255, 214, 10, 0.18) 0%, rgba(255, 214, 10, 0) 45%),
        radial-gradient(80% 60% at 18% 22%, rgba(255, 94, 120, 0.20) 0%, rgba(255, 94, 120, 0) 55%),
        radial-gradient(80% 60% at 82% 78%, rgba(0, 200, 255, 0.20) 0%, rgba(0, 200, 255, 0) 55%),
        radial-gradient(circle at 50% 42%, #34216b 0%, #1a1340 45%, #090c18 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    z-index: 50;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
/* Slow rotating premium sheen behind everything for high-production sparkle */
.splash-overlay::before {
    content: '';
    position: absolute;
    inset: -40%;
    background:
        conic-gradient(from 0deg,
            rgba(255,255,255,0) 0deg,
            rgba(255,255,255,0.06) 30deg,
            rgba(255,255,255,0) 70deg,
            rgba(255,214,10,0.05) 140deg,
            rgba(255,255,255,0) 200deg,
            rgba(0,200,255,0.05) 290deg,
            rgba(255,255,255,0) 360deg);
    animation: splash-sheen 14s linear infinite;
    pointer-events: none;
    z-index: 0;
}
@keyframes splash-sheen { to { transform: rotate(360deg); } }
.splash-stage { z-index: 1; }
.splash-overlay.hidden { display: none; }
.splash-stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.splash-stage.hidden { display: none; }

/* Spinner with truck inside */
.spinner-circle {
    position: relative;
    width: clamp(200px, 30vw, 300px);
    height: clamp(200px, 30vw, 300px);
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Soft glowing inner disc — gives the truck a Pixar-y lit stage to sit on */
.spinner-circle::before {
    content: '';
    position: absolute;
    inset: 14%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 38%, rgba(255,255,255,0.22) 0%, rgba(255,214,10,0.12) 35%, rgba(120,80,255,0.10) 70%, rgba(0,0,0,0) 100%);
    box-shadow: inset 0 0 40px rgba(255, 214, 10, 0.25);
    animation: disc-pulse 2.4s ease-in-out infinite;
    z-index: 1;
}
@keyframes disc-pulse {
    0%, 100% { opacity: 0.75; transform: scale(0.97); }
    50%      { opacity: 1;    transform: scale(1.03); }
}
.spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 12px solid rgba(255, 255, 255, 0.08);
    border-top-color: #ffd60a;
    border-right-color: #ff5e78;
    animation: spin 1.1s linear infinite;
    box-shadow:
        0 0 70px rgba(255, 214, 10, 0.45),
        inset 0 0 30px rgba(255, 214, 10, 0.15);
}
/* Second, slower counter-rotating ring for a richer "premium progress" feel */
.spinner-circle::after {
    content: '';
    position: absolute;
    inset: 7%;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.06);
    border-bottom-color: #00f3ff;
    border-left-color: rgba(124, 252, 0, 0.9);
    animation: spin 2.6s linear infinite reverse;
    z-index: 1;
}
.spinner-truck-img {
    width: clamp(150px, 23vw, 230px);
    height: auto;
    position: relative;
    z-index: 2;
    animation: truck-bob 0.7s ease-in-out infinite;
    filter: drop-shadow(0 10px 22px rgba(0,0,0,0.55)) drop-shadow(0 0 18px rgba(255,214,10,0.35));
}
@keyframes truck-bob {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-10px) rotate(3deg); }
}

/* === Loader truck: the IN-GAME red flame truck driving in place ===
   The spr-truck-red.png body (wheels baked in) with two spr-monster-wheel.png
   wheels overlaid on the baked-in wheel spots, spinning continuously. NO bounce
   — just a subtle idle "rev" jitter so it reads as driving in place. Faces right
   like the in-game player truck. Wheel geometry mirrors truck.js: wheels at
   ~24% (rear) / ~76% (front) across the body, vertical center ~74% down, and a
   diameter ~55% of the body height. */
.loader-truck {
    position: relative;
    z-index: 2;
    width: clamp(150px, 23vw, 230px);
    filter: drop-shadow(0 10px 22px rgba(0,0,0,0.55)) drop-shadow(0 0 18px rgba(255,214,10,0.35));
    animation: truck-idle-rev 0.13s steps(2, jump-none) infinite;
}
.loader-truck-body {
    display: block;
    width: 100%;
    height: auto;
}
/* Mount = positions/centres the wheel over the baked-in wheel spot (transform is
   used here for centring); the inner <img> owns the spin transform so the two
   never clash. */
.loader-wheel-mount {
    position: absolute;
    top: 74%;
    width: 33%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.loader-wheel-front { left: 76%; }
.loader-wheel-rear  { left: 24%; }
.loader-wheel {
    display: block;
    width: 100%;
    height: auto;
    animation: spin 0.5s linear infinite;
}
/* Tiny ±1–2px revving jitter — feels alive without the old up/down bounce. */
@keyframes truck-idle-rev {
    0%   { transform: translate(0, 0); }
    50%  { transform: translate(-1px, 1px); }
    100% { transform: translate(1px, 0); }
}
.splash-tap-prompt {
    font-family: 'Impact', 'Bebas Neue', 'Arial Black', sans-serif;
    font-size: clamp(22px, 3.4vw, 36px);
    color: #fff;
    letter-spacing: 4px;
    margin-top: 32px;
    animation: tap-blink 1s ease-in-out infinite;
    text-shadow: 0 2px 6px rgba(0,0,0,0.7);
}
.splash-start-button {
    position: relative;
    margin-top: clamp(28px, 6vh, 52px);
    padding: clamp(18px, 2.6vh, 26px) clamp(44px, 9vw, 72px);
    font-family: 'Impact', 'Bebas Neue', 'Arial Black', sans-serif;
    font-size: clamp(26px, 4.4vw, 46px);
    font-weight: 900;
    /* Short "GO" label: nudge letter-spacing down + add matching left indent so
       the trailing tracking doesn't shove the text off-centre. */
    letter-spacing: 4px;
    text-indent: 4px;
    /* Glossy casino green: bright highlight up top, deep candy green below */
    background:
        linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 42%),
        linear-gradient(135deg, #2de36b 0%, #16a34a 52%, #0e7a37 100%);
    color: #fff;
    border: 5px solid #fff;
    border-radius: 22px;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    box-shadow:
        inset 0 5px 0 rgba(255,255,255,0.5),
        inset 0 -7px 0 rgba(0,0,0,0.28),
        0 14px 0 #0c5a2a,
        0 20px 48px rgba(34, 197, 94, 0.65);
    text-shadow: 3px 3px 0 rgba(0,0,0,0.4), 0 0 18px rgba(255,255,255,0.45);
    animation: btn-bounce 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) infinite,
               btn-glow 1.8s ease-in-out infinite;
    transition: transform 0.08s ease;
    -webkit-tap-highlight-color: transparent;
}
/* Diagonal shimmer sweep that streaks across the button */
.splash-start-button::before {
    content: '';
    position: absolute;
    top: -60%;
    left: -75%;
    width: 50%;
    height: 220%;
    background: linear-gradient(100deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.85) 50%,
        rgba(255,255,255,0) 100%);
    transform: rotate(18deg);
    animation: btn-shimmer 2.6s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;   /* sweep behind the label (contained by isolation:isolate) */
}
.splash-start-button:hover { transform: scale(1.05); }
.splash-start-button:active {
    transform: translateY(8px) scale(0.97);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 5px 0 #0c5a2a, 0 8px 20px rgba(34,197,94,0.5);
}
@keyframes btn-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-6px) scale(1.05); }
}
@keyframes btn-glow {
    0%, 100% { box-shadow:
        inset 0 5px 0 rgba(255,255,255,0.5),
        inset 0 -7px 0 rgba(0,0,0,0.28),
        0 14px 0 #0c5a2a,
        0 20px 48px rgba(34, 197, 94, 0.5); }
    50%      { box-shadow:
        inset 0 5px 0 rgba(255,255,255,0.6),
        inset 0 -7px 0 rgba(0,0,0,0.28),
        0 14px 0 #0c5a2a,
        0 22px 70px rgba(80, 255, 140, 0.95); }
}
@keyframes btn-shimmer {
    0%   { left: -75%; }
    55%  { left: 130%; }
    100% { left: 130%; }
}
@keyframes tap-blink {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Animated word fly-ins */
.anim-word {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0) rotate(-10deg);
    opacity: 0;
    font-family: 'Impact', 'Bebas Neue', 'Arial Black', sans-serif;
    font-weight: 900;
    letter-spacing: 4px;
    -webkit-text-stroke: 3px #fff;
    text-shadow:
        4px 4px 0 rgba(0,0,0,0.5),
        0 0 30px rgba(0, 0, 0, 0.8);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    pointer-events: none;
}
.anim-word.show {
    transform: translate(-50%, -50%) scale(1) rotate(0);
    opacity: 1;
}
.anim-word.hide {
    transform: translate(-50%, -50%) scale(1.6) rotate(8deg);
    opacity: 0;
    transition: all 0.35s ease-out;
}
.w-welcome {
    font-size: clamp(60px, 12vw, 140px);
    color: #ffd60a;
    -webkit-text-stroke-color: #c81e1e;
}
.w-to {
    font-size: clamp(50px, 9vw, 100px);
    color: #06b6d4;
    -webkit-text-stroke-color: #fff;
}
.w-monstertruck {
    font-size: clamp(56px, 11vw, 130px);
    color: #ff5e78;
    -webkit-text-stroke-color: #fff;
}
.w-hilltop {
    font-size: clamp(56px, 11vw, 130px);
    color: #7cfc00;
    -webkit-text-stroke-color: #1a1a1a;
}

/* Final assembled logo */
.anim-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    font-family: 'Impact', 'Bebas Neue', 'Arial Black', sans-serif;
    text-align: center;
    line-height: 0.95;
    letter-spacing: 3px;
    transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}
.anim-logo.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}
.anim-logo.hide {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    transition: all 0.4s ease-out;
}
.logo-line-1 {
    display: block;
    font-size: clamp(48px, 9.5vw, 110px);
    color: #ffd60a;
    -webkit-text-stroke: 3px #c81e1e;
    text-shadow: 4px 4px 0 rgba(0,0,0,0.5), 0 0 40px rgba(255, 214, 10, 0.5);
    margin-bottom: 6px;
}
.logo-line-2 {
    display: block;
    font-size: clamp(40px, 7.5vw, 88px);
    color: #06b6d4;
    -webkit-text-stroke: 3px #1d3557;
    text-shadow: 4px 4px 0 rgba(0,0,0,0.5), 0 0 40px rgba(0, 200, 255, 0.5);
}

/* === Penalty -1 flash (smooth casino-style) === */
.penalty-flash {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 22;
    animation: penalty-pop 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.penalty-coin {
    width: clamp(80px, 11vw, 130px);
    height: clamp(80px, 11vw, 130px);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #ff8a8a 0%, #ef4444 50%, #991b1b 100%);
    border: 5px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Impact', 'Bebas Neue', 'Arial Black', sans-serif;
    font-size: clamp(40px, 6vw, 64px);
    font-weight: 900;
    color: #fff;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.5);
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.4),
        inset 0 -4px 0 rgba(0,0,0,0.3),
        0 0 50px rgba(239, 68, 68, 0.7),
        0 14px 30px rgba(0,0,0,0.5);
    letter-spacing: 1px;
}
@keyframes penalty-pop {
    0%   { transform: translate(-50%, -50%) scale(0.4) rotate(-15deg); opacity: 0; }
    25%  { transform: translate(-50%, -50%) scale(1.15) rotate(5deg);  opacity: 1; }
    55%  { transform: translate(-50%, -50%) scale(1.0)  rotate(-2deg); opacity: 1; }
    100% { transform: translate(-50%, -95%) scale(0.85) rotate(0);     opacity: 0; }
}

/* === Flashy "5x BONUS!" popup === */
.bonus-flash {
    position: absolute;
    top: 32%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    font-family: 'Impact', 'Bebas Neue', 'Anton', 'Oswald', 'Arial Black', sans-serif;
    font-size: clamp(48px, 9vw, 110px);
    font-weight: 900;
    color: #fff;
    text-align: center;
    letter-spacing: 4px;
    background: linear-gradient(180deg, #ffd60a 0%, #ff8800 40%, #ff5e78 80%, #c026d3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow:
        4px 4px 0 rgba(0, 0, 0, 0.4),
        0 0 60px rgba(255, 214, 10, 0.7);
    pointer-events: none;
    z-index: 26;
    animation: bonus-burst 1.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    white-space: nowrap;
    filter: drop-shadow(4px 4px 0 rgba(0,0,0,0.5));
}
@keyframes bonus-burst {
    0%   { transform: translate(-50%, -50%) scale(0.3) rotate(-10deg); opacity: 0; }
    20%  { transform: translate(-50%, -50%) scale(1.3) rotate(3deg);   opacity: 1; }
    40%  { transform: translate(-50%, -50%) scale(1.0) rotate(-2deg);  opacity: 1; }
    60%  { transform: translate(-50%, -50%) scale(1.1) rotate(2deg);   opacity: 1; }
    80%  { transform: translate(-50%, -50%) scale(1.0) rotate(0);      opacity: 1; }
    100% { transform: translate(-50%, -85%) scale(1.0) rotate(0);      opacity: 0; }
}

/* === Map / level picker === */
.map-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.map-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.map-btn:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: var(--neon-cyan, #00f3ff);
    box-shadow: 0 10px 26px rgba(0, 243, 255, 0.25);
}
.map-btn:active { transform: translateY(0) scale(1.0); }
.map-btn.selected {
    border-color: var(--neon-gold, #ffd60a);
    box-shadow: 0 0 0 2px rgba(255, 214, 10, 0.4), 0 8px 22px rgba(255, 214, 10, 0.25);
}
.map-btn .map-emoji { font-size: 1.8em; line-height: 1; flex: 0 0 auto; }
.map-btn .map-label { display: flex; flex-direction: column; min-width: 0; }
.map-btn .map-num {
    font-size: 0.62em; font-weight: 700; letter-spacing: 1px;
    color: var(--neon-gold, #ffd60a); opacity: 0.85;
}
.map-btn .map-name { font-size: clamp(13px, 1.5vw, 17px); font-weight: 800; letter-spacing: 0.4px; }
.map-btn .map-swatch {
    width: 16px; height: 16px; border-radius: 50%; margin-left: auto; flex: 0 0 auto;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

/* === Duration picker on welcome screen === */
.duration-picker {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.duration-btn {
    margin: 0 !important;
    padding: 14px 8px !important;
    font-size: clamp(13px, 1.7vw, 17px) !important;
    line-height: 1.1;
    letter-spacing: 1px !important;
    border-radius: 12px !important;
}
.duration-btn .dbl {
    display: block;
    font-size: 0.65em;
    opacity: 0.85;
    font-weight: 700;
    margin-top: 3px;
    letter-spacing: 0.5px;
}
/* All 3 duration buttons share the same primary yellow/orange gradient */
.duration-btn {
    background: linear-gradient(90deg, #ff5e78, #ffd60a, #ff8800) !important;
    background-size: 200% 100% !important;
    animation: shimmer 3s linear infinite !important;
    color: #fff !important;
    border: none !important;
}
@media (max-width: 540px) {
    .duration-picker { grid-template-columns: 1fr; }
}

/* === Pause overlay with center play button === */
#pause-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    background: rgba(5, 10, 22, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: coin-fade 0.3s ease;
}
.pause-content {
    text-align: center;
    animation: coin-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pause-play-btn {
    width: clamp(140px, 22vw, 220px);
    height: clamp(140px, 22vw, 220px);
    border-radius: 50%;
    border: 6px solid #fff;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 4px 0 rgba(255, 255, 255, 0.4),
        inset 0 -6px 0 rgba(0, 0, 0, 0.3),
        0 12px 0 #14532d,
        0 20px 60px rgba(34, 197, 94, 0.6),
        0 0 80px rgba(255, 255, 255, 0.4);
    transition: transform 0.1s;
    animation: pause-pulse 1.2s ease-in-out infinite;
    font-family: inherit;
    padding: 0;
}
@keyframes pause-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            inset 0 4px 0 rgba(255, 255, 255, 0.4),
            inset 0 -6px 0 rgba(0, 0, 0, 0.3),
            0 12px 0 #14532d,
            0 20px 60px rgba(34, 197, 94, 0.6),
            0 0 60px rgba(255, 255, 255, 0.3);
    }
    50% {
        transform: scale(1.08);
        box-shadow:
            inset 0 4px 0 rgba(255, 255, 255, 0.5),
            inset 0 -6px 0 rgba(0, 0, 0, 0.3),
            0 12px 0 #14532d,
            0 28px 80px rgba(34, 197, 94, 0.85),
            0 0 100px rgba(255, 255, 255, 0.6);
    }
}
.pause-play-btn:hover {
    transform: scale(1.05);
}
.pause-play-btn:active {
    transform: scale(0.95) translateY(4px);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        inset 0 -3px 0 rgba(0, 0, 0, 0.4),
        0 4px 0 #14532d,
        0 8px 20px rgba(34, 197, 94, 0.5);
}
.play-triangle {
    font-size: clamp(64px, 11vw, 110px);
    color: #fff;
    line-height: 1;
    margin-left: 10px; /* optical center for triangle */
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}
.pause-message {
    font-family: 'Impact', 'Bebas Neue', 'Anton', 'Oswald', 'Arial Black', sans-serif;
    font-size: clamp(22px, 3vw, 36px);
    color: #fff;
    font-weight: 900;
    margin-top: 28px;
    letter-spacing: 1px;
    text-shadow:
        3px 3px 0 rgba(0, 0, 0, 0.5),
        0 0 24px rgba(34, 197, 94, 0.5);
    animation: pause-text-bob 1.4s ease-in-out infinite;
}
@keyframes pause-text-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* === Celebration screen (post-game, pre-scoreboard) === */
#celebration-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 28;
    /* dimmed dark-navy blurred game background */
    background: radial-gradient(circle at center, rgba(20, 30, 66, 0.82) 0%, rgba(4, 8, 22, 0.93) 72%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: coin-fade 0.4s ease;
    font-family: 'Plus Jakarta Sans', 'Nunito', 'Segoe UI', system-ui, sans-serif;
}
.celebration-content {
    text-align: center;
    padding: clamp(8px, 2.4vh, 20px) 18px;
    max-width: 660px;
    width: 94%;
    max-height: 96vh;
    animation: coin-bounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(6px, 1.4vh, 14px);
}

/* 1) Trophy — gold, soft glow + pedestal, drops/bounces in */
.celeb-trophy {
    font-size: clamp(46px, 8vh, 84px);
    line-height: 1;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.55)) drop-shadow(0 0 22px rgba(255, 196, 40, 0.75));
    animation: celeb-trophy-drop 0.85s cubic-bezier(0.3, 1.5, 0.5, 1) both 0.05s;
    margin-bottom: -2px;
}
@keyframes celeb-trophy-drop {
    0%   { transform: translateY(-90px) scale(0.4); opacity: 0; }
    60%  { transform: translateY(8px)   scale(1.12); opacity: 1; }
    80%  { transform: translateY(-4px)  scale(0.97); }
    100% { transform: translateY(0)     scale(1); opacity: 1; }
}

/* 2) Name + achievement banner row */
.celeb-banner-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    animation: celeb-banner-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both 0.45s;
}
@keyframes celeb-banner-in {
    0%   { transform: translateY(14px) scale(0.92); opacity: 0; }
    100% { transform: translateY(0)    scale(1);    opacity: 1; }
}
.celeb-name-pill {
    font-weight: 800;
    font-size: clamp(18px, 3vw, 30px);
    letter-spacing: 1px;
    color: #1b1205;
    padding: 6px 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffe27a 0%, #ffd60a 55%, #ffb300 100%);
    box-shadow: 0 3px 0 #b97c00, 0 6px 16px rgba(0,0,0,0.4), 0 0 0 3px rgba(255,255,255,0.35) inset;
    text-shadow: 0 1px 0 rgba(255,255,255,0.45);
    white-space: nowrap;
}
.celeb-achievement {
    font-weight: 800;
    font-size: clamp(16px, 2.6vw, 26px);
    letter-spacing: 0.5px;
    background: linear-gradient(180deg, #ffd86b 0%, #ff9e2c 60%, #ff7a1a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* 3) Big headline — clean heavy sans, white lead + gold ordinal.
   Reveal is GATED in JS on BOTH counts finishing (hidden via .celeb-prereveal). */
.celebration-place {
    font-family: 'Plus Jakarta Sans', 'Nunito', 'Segoe UI', system-ui, sans-serif;
    font-size: clamp(26px, 5vw, 52px);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: 0.5px;
    margin: 2px 0;
}
.celebration-place .celeb-place-lead { color: #ffffff; text-shadow: 0 3px 10px rgba(0,0,0,0.5); }
.celebration-place .celeb-place-ord {
    background: linear-gradient(180deg, #fff3b0 0%, #ffd60a 50%, #ff9d12 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 3px 12px rgba(255,170,20,0.35);
    white-space: nowrap;
}
@keyframes celeb-place-pop {
    0%   { transform: scale(0.4); opacity: 0; }
    55%  { transform: scale(1.14); opacity: 1; }
    78%  { transform: scale(0.96); }
    100% { transform: scale(1); opacity: 1; }
}
.celebration-place.celeb-place-in {
    animation: celeb-place-pop 0.6s cubic-bezier(0.45, 0, 0.15, 1) both;
}
.celebration-quote {
    display: none;
}

/* 4+5) Two stat panels side by side — COINS (left) / SMASHED (right) */
.celeb-panels {
    display: flex;
    gap: clamp(12px, 2.4vw, 22px);
    justify-content: center;
    align-items: stretch;
    flex-wrap: nowrap;
    margin: 2px 0;
}
.celeb-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: clamp(120px, 30vw, 190px);
    padding: clamp(10px, 1.8vh, 18px) clamp(12px, 2.4vw, 24px);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(18, 24, 48, 0.92), rgba(8, 12, 28, 0.92));
}
.celeb-panel-coins {
    box-shadow: 0 0 0 2px rgba(255, 214, 10, 0.85), 0 0 26px rgba(255, 196, 20, 0.55), 0 10px 24px rgba(0,0,0,0.45);
}
.celeb-panel-smash {
    box-shadow: 0 0 0 2px rgba(255, 95, 120, 0.9), 0 0 26px rgba(255, 70, 90, 0.55), 0 10px 24px rgba(0,0,0,0.45);
}
.celeb-panel-img { width: clamp(40px, 7vw, 64px); height: auto; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); animation: celeb-coin-spin 2.4s linear infinite; }
@keyframes celeb-coin-spin { to { transform: rotateY(360deg); } }
.celeb-panel-icon { font-size: clamp(36px, 6vw, 58px); line-height: 1; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); animation: celebrate-bob 1.4s ease-in-out infinite; }
@keyframes celebrate-bob {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-7px) rotate(3deg); }
}
.celeb-panel-num {
    font-family: 'Plus Jakarta Sans', 'Nunito', 'Segoe UI', system-ui, sans-serif;
    font-size: clamp(40px, 8vw, 78px);
    font-weight: 800;
    line-height: 1;
}
.celeb-panel-coins .celeb-panel-num {
    background: linear-gradient(180deg, #fff3b0, #ffd60a 55%, #ff9d12);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.celeb-panel-smash .celeb-panel-num {
    background: linear-gradient(180deg, #ffd9a0, #ff8c1a 55%, #ff3b1a);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.celeb-panel-label {
    font-weight: 800;
    font-size: clamp(13px, 2.2vw, 22px);
    letter-spacing: 2px;
}
.celeb-panel-coins .celeb-panel-label { color: #ffd60a; text-shadow: 0 1px 0 #6b4a00; }
.celeb-panel-smash .celeb-panel-label { color: #ff7a8a; text-shadow: 0 1px 0 #5a0014; }

/* Panels land via JS-staged class (gated sequence), hidden until then */
@keyframes celeb-panel-land {
    0%   { transform: translateY(26px) scale(0.6); opacity: 0; }
    62%  { transform: translateY(-6px) scale(1.08); opacity: 1; }
    82%  { transform: translateY(2px)  scale(0.98); }
    100% { transform: translateY(0)    scale(1); opacity: 1; }
}
.celeb-panel.celeb-panel-in {
    animation: celeb-panel-land 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.celebration-prompt {
    font-size: clamp(11px, 1.3vw, 14px) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 600 !important;
    margin-top: 10px !important;
    margin-bottom: 0 !important;
    letter-spacing: 1.5px;
}
.celebration-buttons {
    margin: 4px 0;
}
.celeb-btn {
    padding: 12px 32px !important;
    font-size: clamp(16px, 2.4vw, 24px) !important;
    min-width: 110px !important;
}
.celebration-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}
.celeb-btn {
    padding: 16px 40px;
    font-size: clamp(20px, 3vw, 30px);
    font-weight: 900;
    font-family: 'Impact', 'Bebas Neue', 'Anton', 'Oswald', 'Arial Black', sans-serif;
    border: 4px solid #fff;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 2px;
    box-shadow: 0 6px 0 rgba(0,0,0,0.3), 0 10px 24px rgba(0,0,0,0.4);
    min-width: 140px;
}
.celeb-yes {
    background: linear-gradient(180deg, #22c55e, #15803d);
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}
.celeb-no {
    background: linear-gradient(180deg, #ef4444, #991b1b);
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}
.celeb-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 rgba(0,0,0,0.3), 0 14px 28px rgba(0,0,0,0.5);
}
.celeb-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.3), 0 4px 10px rgba(0,0,0,0.4);
}

/* ============================================================
   TEMU-casino play-again reveal (gated on smash count finishing)
   JS stages classes: prereveal -> slam-in -> (YES) entice / (NO) settled
   ============================================================ */

/* Hidden + untappable until the smash count completes */
.celeb-prereveal {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.2);
}

/* Big bright takeover -> punchy slam-down -> settle small, with bounce.
   ~5x scale ≈ takes over most of the screen on a button, then slams in. */
@keyframes celeb-btn-slam {
    0%   { transform: scale(5.0);  opacity: 0;  filter: brightness(2.2) saturate(1.6); }
    14%  { transform: scale(4.6);  opacity: 1;  filter: brightness(2.2) saturate(1.6); }
    52%  { transform: scale(4.6);  opacity: 1;  filter: brightness(1.9) saturate(1.5); }
    74%  { transform: scale(0.84); opacity: 1;  filter: brightness(1.25) saturate(1.2); }  /* SLAM past target */
    86%  { transform: scale(1.10); }                                                        /* impact bounce */
    94%  { transform: scale(0.97); }
    100% { transform: scale(1);    opacity: 1;  filter: brightness(1) saturate(1); }
}
.celeb-slam-in {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    z-index: 40;
    animation: celeb-btn-slam 0.85s cubic-bezier(0.45, 0, 0.15, 1) both;
}
.celeb-settled { opacity: 1; pointer-events: auto; }

/* Make YES the loud, glossy, super-bright TEMU casino call-to-action */
.celeb-yes {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 42%),
        linear-gradient(180deg, #5cff7a 0%, #22c55e 48%, #0f9d3a 100%);
    border-color: #fff3b0;
    box-shadow:
        0 6px 0 #0a6b27,
        0 10px 26px rgba(0,0,0,0.45),
        0 0 0 4px rgba(255, 214, 10, 0.85),
        0 0 34px rgba(80, 255, 130, 0.75);
}
.celeb-no {
    /* calmer, secondary — clearly not the primary tap */
    background:
        linear-gradient(180deg, rgba(255,255,255,0.28) 0%, rgba(255,255,255,0) 42%),
        linear-gradient(180deg, #ff7a7a 0%, #ef4444 50%, #b01515 100%);
    box-shadow: 0 6px 0 rgba(0,0,0,0.3), 0 10px 22px rgba(0,0,0,0.4);
}

/* YES continuous enticement: gentle pulse-zoom + a sweeping shimmer/sparkle */
@keyframes celeb-yes-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.11); }
}
@keyframes celeb-yes-glow {
    0%, 100% { box-shadow: 0 6px 0 #0a6b27, 0 10px 26px rgba(0,0,0,0.45), 0 0 0 4px rgba(255,214,10,0.85), 0 0 28px rgba(80,255,130,0.7); }
    50%      { box-shadow: 0 6px 0 #0a6b27, 0 10px 30px rgba(0,0,0,0.5),  0 0 0 5px rgba(255,214,10,1),    0 0 52px rgba(120,255,160,0.95); }
}
.celeb-yes.celeb-entice {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    animation:
        celeb-yes-pulse 1.5s ease-in-out infinite,
        celeb-yes-glow  1.5s ease-in-out infinite;
}
@keyframes celeb-yes-shimmer {
    0%       { left: -75%; }
    60%, 100%{ left: 130%; }
}
.celeb-yes.celeb-entice::after {
    content: '';
    position: absolute;
    top: 0;
    left: -75%;
    width: 55%;
    height: 100%;
    background: linear-gradient(115deg,
        transparent 0%,
        rgba(255,255,255,0.15) 35%,
        rgba(255,255,255,0.9) 50%,
        rgba(255,255,255,0.15) 65%,
        transparent 100%);
    transform: skewX(-18deg);
    pointer-events: none;
    animation: celeb-yes-shimmer 2.3s ease-in-out infinite;
}

/* Prompt slams in last (smaller takeover than the buttons) */
@keyframes celeb-prompt-slam {
    0%       { transform: scale(2.6); opacity: 0; }
    55%      { transform: scale(2.6); opacity: 0.9; }
    78%      { transform: scale(0.9); opacity: 1; }
    100%     { transform: scale(1);   opacity: 1; }
}
.celebration-prompt.celeb-prompt-in {
    animation: celeb-prompt-slam 0.7s cubic-bezier(0.45, 0, 0.15, 1) both;
}
@media (prefers-reduced-motion: reduce) {
    .celeb-slam-in, .celeb-yes.celeb-entice, .celebration-prompt.celeb-prompt-in,
    .celeb-trophy, .celeb-banner-row, .celeb-panel.celeb-panel-in,
    .celebration-place.celeb-place-in, .celeb-panel-img, .celeb-panel-icon {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
    .celeb-yes.celeb-entice::after { display: none; }
}

/* === Get Ready / Set / Go countdown === */
#start-countdown {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    background: radial-gradient(circle at center, rgba(0, 80, 160, 0.4), rgba(0, 0, 0, 0.7) 70%);
    pointer-events: none;
    animation: coin-fade 0.2s ease;
}
.start-countdown-text {
    font-family: 'Impact', 'Bebas Neue', 'Anton', 'Oswald', 'Arial Black', sans-serif;
    font-size: clamp(60px, 13vw, 160px);
    font-weight: 900;
    color: #fff;
    text-shadow:
        4px 4px 0 #1e3a8a,
        8px 8px 0 #ef4444,
        0 0 40px rgba(255, 255, 255, 0.5);
    letter-spacing: 4px;
    animation: count-pop 0.6s ease;
}
.start-countdown-text.go {
    background: linear-gradient(180deg, #22c55e 0%, #15803d 50%, #ffd60a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow:
        4px 4px 0 rgba(0,0,0,0.4),
        0 0 60px rgba(34, 197, 94, 0.6);
    font-size: clamp(80px, 18vw, 220px);
}

/* === COIN ROUND interlude overlay === */
#coin-round {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(255, 214, 10, 0.30), rgba(0, 0, 0, 0.82) 72%);
    animation: coin-fade 0.25s ease, casino-strobe 0.45s steps(1) infinite;
}
@keyframes coin-fade { from { opacity: 0; } to { opacity: 1; } }
/* Strobing casino color flashes around the edges */
@keyframes casino-strobe {
    0%   { box-shadow: inset 0 0 260px 90px rgba(255, 214, 10, 0.55); }
    25%  { box-shadow: inset 0 0 260px 90px rgba(255, 94, 120, 0.55); }
    50%  { box-shadow: inset 0 0 260px 90px rgba(0, 243, 255, 0.55); }
    75%  { box-shadow: inset 0 0 260px 90px rgba(124, 252, 0, 0.55); }
    100% { box-shadow: inset 0 0 260px 90px rgba(255, 214, 10, 0.55); }
}
/* Spinning starburst rays behind the text */
#coin-round::before {
    content: '';
    position: absolute;
    width: 240vmax; height: 240vmax;
    background: repeating-conic-gradient(from 0deg, rgba(255, 214, 10, 0.16) 0deg 9deg, transparent 9deg 18deg);
    animation: rays-spin 9s linear infinite;
    pointer-events: none;
}
@keyframes rays-spin { to { transform: rotate(360deg); } }

.coin-round-content {
    position: relative;
    text-align: center;
    animation: coin-bounce 0.5s cubic-bezier(.2, 1.7, .4, 1);
}
@keyframes coin-bounce {
    0% { transform: scale(0.3) rotate(-8deg); opacity: 0; }
    55% { transform: scale(1.25) rotate(3deg); opacity: 1; }
    78% { transform: scale(0.95) rotate(-2deg); }
    100% { transform: scale(1) rotate(0); }
}
.coin-round-title {
    font-family: 'Impact', 'Bebas Neue', 'Anton', 'Oswald', 'Arial Black', sans-serif;
    font-size: clamp(70px, 15vw, 180px);
    font-weight: 900;
    letter-spacing: 4px;
    line-height: 0.92;
    color: #ffd60a;
    text-shadow:
        3px 3px 0 #b8001f, 6px 6px 0 #7a0014,
        0 0 40px rgba(255, 214, 10, 0.9), 0 0 80px rgba(255, 94, 120, 0.7);
    animation: title-throb 0.3s ease-in-out infinite alternate, title-hue 1.1s linear infinite;
}
@keyframes title-throb {
    from { transform: scale(1) rotate(-1.5deg); }
    to   { transform: scale(1.12) rotate(1.5deg); }
}
@keyframes title-hue {
    to { filter: hue-rotate(360deg) drop-shadow(0 0 16px rgba(255, 255, 255, 0.6)); }
}
.coin-round-title small {
    display: block;
    font-size: 0.42em;
    color: #fff;
    letter-spacing: 8px;
    animation: cr-blink 0.4s steps(1) infinite;
}
@keyframes cr-blink { 50% { opacity: 0.2; } }
.coin-round-emoji {
    font-size: clamp(48px, 9vw, 100px);
    margin: 8px 0;
    animation: spin 0.8s linear infinite;
    filter: drop-shadow(0 0 18px rgba(255, 214, 10, 0.9));
}
.coin-round-countdown {
    font-family: 'Impact', 'Bebas Neue', 'Anton', 'Oswald', 'Arial Black', sans-serif;
    font-size: clamp(190px, 44vw, 540px);
    font-weight: 900;
    line-height: 1;
    opacity: 0.4;                          /* matches the final-time countdown */
    background: linear-gradient(180deg, #fff3b0 0%, #ffd60a 50%, #ff8800 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: count-pop 0.45s cubic-bezier(.2, 1.8, .4, 1);
}
@keyframes count-pop {
    0% { transform: scale(0.2); }
    55% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* (legacy .celeb-coins counter styles removed — replaced by .celeb-panels above) */

/* O.M.G! plane-hit burst — TEMU casino, in-your-face, ~1.3s */
#omg-burst {
    position: absolute; inset: 0; z-index: 60;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    pointer-events: none; gap: 8px; overflow: hidden;
}
#omg-burst.hidden { display: none; }
#omg-burst::before {
    content: ''; position: absolute; width: 160vmax; height: 160vmax;
    background: repeating-conic-gradient(from 0deg, rgba(255, 214, 10, 0.22) 0deg 12deg, rgba(255, 90, 20, 0) 12deg 24deg);
}
#omg-burst.omg-go::before { animation: omg-rays 1.3s linear both; }
#omg-burst .omg-text {
    position: relative;
    font-family: 'Impact', 'Bebas Neue', 'Anton', 'Arial Black', sans-serif;
    font-size: clamp(80px, 22vw, 320px); font-weight: 900; letter-spacing: 4px; line-height: 1;
    background: linear-gradient(180deg, #fff3b0, #ffd60a 45%, #ff4d00);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 3px #7a0014;
    filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
}
#omg-burst .omg-sub {
    position: relative;
    font-family: 'Impact', 'Bebas Neue', 'Anton', 'Arial Black', sans-serif;
    font-size: clamp(22px, 6vw, 70px); font-weight: 900; letter-spacing: 3px;
    color: #00f3ff; text-shadow: 2px 2px 0 #003b52, 0 0 22px rgba(0, 243, 255, 0.8);
}
#omg-burst.omg-go .omg-text { animation: omg-pop 1.3s cubic-bezier(.2, 1.7, .4, 1) both; }
#omg-burst.omg-go .omg-sub { animation: omg-sub 1.3s ease both; }
@keyframes omg-pop {
    0% { transform: scale(0.2) rotate(-12deg); opacity: 0; }
    18% { transform: scale(1.25) rotate(6deg); opacity: 1; }
    32% { transform: scale(0.95) rotate(-3deg); }
    46% { transform: scale(1.1) rotate(2deg); }
    60% { transform: scale(1) rotate(0deg); }
    85% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.15); opacity: 0; }
}
@keyframes omg-sub {
    0%, 15% { opacity: 0; transform: translateY(20px) scale(0.6); }
    30% { opacity: 1; transform: translateY(0) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes omg-rays { from { transform: rotate(0deg); } to { transform: rotate(120deg); } }

/* Sticky play-again button on end-modal so users never scroll for it */
#end-modal .modal-content {
    padding-bottom: 0;
}
#end-modal #restart-btn {
    position: sticky;
    bottom: 0;
    margin: 16px -40px -36px;
    width: calc(100% + 80px);
    padding: 18px 24px;
    border-radius: 0;
    z-index: 5;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.4);
}
@media (max-width: 540px) {
    #end-modal #restart-btn {
        margin: 16px -24px -20px;
        width: calc(100% + 48px);
    }
}

/* v3 specific */
.version-tag {
    margin-top: 16px;
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    letter-spacing: 2px;
}

/* ============================================================
   Mobile touch controls — big thumb-friendly buttons
   ============================================================ */
#touch-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 24px 28px;
    pointer-events: none;
    z-index: 15;
}

.touch-btn {
    pointer-events: auto;
    touch-action: none;
    width: clamp(80px, 14vw, 130px);
    height: clamp(80px, 14vw, 130px);
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.7);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.08s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.touch-btn:active {
    transform: scale(0.92);
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}
.touch-icon {
    font-size: clamp(28px, 5vw, 44px);
    line-height: 1;
}
.touch-label {
    font-size: clamp(11px, 1.4vw, 15px);
    font-weight: 900;
    letter-spacing: 2px;
    margin-top: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
/* JUMP stays as a circular friendly button */
.touch-jump {
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.6), rgba(0, 100, 220, 0.6));
    border-color: rgba(150, 220, 255, 0.85);
}

/* GAS is now a real metallic gas pedal coming from the bottom of the screen */
.touch-gas {
    width: clamp(72px, 10vw, 110px) !important;
    height: clamp(110px, 16vw, 170px) !important;
    border-radius: 14px 14px 6px 6px !important;
    background: linear-gradient(180deg, #cfcfcf 0%, #9a9a9a 45%, #6e6e6e 100%) !important;
    border: 3px solid #2a2a2a !important;
    box-shadow:
        inset 0 4px 0 rgba(255,255,255,0.45),
        inset 0 -6px 0 rgba(0,0,0,0.35),
        0 10px 0 #2a2a2a,
        0 14px 24px rgba(0,0,0,0.5) !important;
    position: relative;
    overflow: hidden;
    transform-origin: bottom center;
    transition: transform 0.08s ease;
}
.touch-gas:active,
.touch-gas.pressed {
    /* Strong, obvious depress: sink down, tilt forward, darken, collapse the 3D riser */
    transform: translateY(12px) rotate(-10deg) scale(0.94);
    background: linear-gradient(180deg, #8a8a8a 0%, #5a5a5a 45%, #383838 100%) !important;
    filter: brightness(0.72);
    box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.16),
        inset 0 -2px 0 rgba(0,0,0,0.5),
        0 1px 0 #2a2a2a,
        0 2px 6px rgba(0,0,0,0.55) !important;
}
/* Hide the default icon/label spans inside the pedal — we use ::before/::after for pedal lines */
.touch-gas .touch-icon { display: none; }
.touch-gas .touch-label {
    position: absolute;
    bottom: 6px;
    left: 0; right: 0;
    text-align: center;
    color: #1a1a1a;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
    font-weight: 900;
    letter-spacing: 2px;
    font-size: clamp(11px, 1.3vw, 14px);
}
/* Vertical grooves on the pedal face */
.touch-gas::before {
    content: '';
    position: absolute;
    top: 14%;
    left: 18%;
    right: 18%;
    height: 56%;
    background:
        repeating-linear-gradient(
            90deg,
            #4a4a4a 0px,
            #4a4a4a 3px,
            transparent 3px,
            transparent 11px
        );
    border-radius: 4px;
    opacity: 0.7;
}

/* Show on touch devices automatically while playing */
@media (hover: none) and (pointer: coarse) {
    #touch-controls:not(.hidden) {
        display: flex !important;
    }
}
/* Show the on-screen controls on desktop too (so the gas pedal is visible/usable) */
@media (hover: hover) and (pointer: fine) {
    #touch-controls:not(.hidden) {
        display: flex !important;
    }
}

/* === NITRO GAUGE — speedometer dial + needle, sits above the JUMP button === */
/* Right-aligned column: gauge on top, JUMP below it (small gap). The column
   replaces the lone JUMP button on the right side of #touch-controls. */
.nitro-gauge-col {
    pointer-events: none;            /* children opt back in */
    display: flex;
    flex-direction: column;
    align-items: flex-end;           /* keep both right-aligned */
    gap: 10px;
}
/* The gauge is a square tap-target button. ~78px (operator: "don't make it huge"). */
.nitro-gauge {
    pointer-events: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    width: clamp(72px, 11vw, 88px);
    height: clamp(72px, 11vw, 88px);
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: block;
    -webkit-appearance: none;
    appearance: none;
}
.nitro-gauge:active { transform: scale(0.94); }
/* The group (dial + needle) is what scales/glows for the available-pulse. */
.nitro-gauge-group {
    position: absolute;
    inset: 0;
    display: block;
    border-radius: 50%;
    transform-origin: 50% 50%;
    will-change: transform, filter;
}
.nitro-gauge-dial,
.nitro-gauge-needle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}
/* Needle pivots about the exact image center; angle set inline from game.js. */
.nitro-gauge-needle {
    transform-origin: 50% 50%;
    transform: rotate(-52deg);       /* idle default until JS drives it */
}
/* AVAILABLE PULSE — gentle breathe + soft glow ring while a charge is ready.
   Toggled by the .nitro-ready class on #nitro-gauge-group from game.js. Subtle
   (scale 1.0 -> 1.06) and casino-inviting, never huge. */
.nitro-gauge-group.nitro-ready {
    animation: nitro-breathe 1.15s ease-in-out infinite;
}
.nitro-gauge-group.nitro-ready::after {
    content: '';
    position: absolute;
    inset: -6%;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 0 0 rgba(255, 210, 40, 0.55);
    animation: nitro-ring 1.15s ease-out infinite;
}
@keyframes nitro-breathe {
    0%, 100% { transform: scale(1.0);  filter: drop-shadow(0 0 2px rgba(255,200,30,0.35)); }
    50%      { transform: scale(1.06); filter: drop-shadow(0 0 10px rgba(255,200,30,0.85)); }
}
@keyframes nitro-ring {
    0%   { box-shadow: 0 0 0 0 rgba(255, 210, 40, 0.55); }
    70%  { box-shadow: 0 0 0 14px rgba(255, 210, 40, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 210, 40, 0); }
}
/* Reduced-motion: no breathe/ring, just a static soft glow so it still reads as ready. */
@media (prefers-reduced-motion: reduce) {
    .nitro-gauge-group.nitro-ready {
        animation: none;
        filter: drop-shadow(0 0 6px rgba(255,200,30,0.7));
    }
    .nitro-gauge-group.nitro-ready::after { animation: none; box-shadow: none; }
}

