: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: 100vw;  height: 100vh;
    width: 100dvw; height: 100dvh;   /* fill the whole device — no letterbox bars */
    max-width: 100vw;
    max-height: 100vh;
    background: #87ceeb;
    overflow: hidden;
    border-radius: 0;
}

#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%;
    object-fit: cover;                 /* fill the screen uniformly (no squish, no stretch) */
    object-position: center center;    /* balanced crop: keeps the plane (top) AND ground/trucks */
    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);
}

/* JUMP — bottom-right (lowered 20%: bottom 15% => button ~85% down) */
#right-controls {
    position: absolute;
    right: clamp(14px, 2vw, 34px);
    bottom: 15%;
    z-index: 14;
    display: flex;
    align-items: flex-end;   /* bottom-align JUMP with GAS */
    pointer-events: none;
}
#right-controls.hidden { display: none; }

/* Top-right gauge cluster: gauge with the nitro packs UNDER it (5% lower from top) */
#gauge-cluster {
    position: absolute;
    top: 12%;
    right: clamp(14px, 2vw, 34px);
    z-index: 14;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(5px, 0.9vh, 9px);
    pointer-events: none;
}
#gauge-cluster.hidden { display: none; }
#gauge-cluster #nitro-charges { margin-top: 0; }

.hud-buttons {
    display: flex;
    gap: clamp(5px, 0.7vw, 10px);
    align-items: center;
    pointer-events: auto;
}

/* HUD utility buttons — CSS gold circles with a white icon (SVG background). */
.hud-btn {
    width: clamp(34px, 4.2vw, 50px);
    height: clamp(34px, 4.2vw, 50px);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    cursor: pointer;
    padding: 0;
    opacity: 0.45;                 /* dim when not in use */
    transition: opacity 0.15s, transform 0.12s;
    box-shadow: 0 3px 6px rgba(0,0,0,0.35), inset 0 2px 0 rgba(255,255,255,0.5);
    -webkit-tap-highlight-color: transparent;
    font-size: 0; color: transparent;
    background-repeat: no-repeat, no-repeat;
    background-position: center, center;
    background-size: 48%, cover;
}
.hud-btn:hover  { opacity: 1; transform: scale(1.08); }
.hud-btn:active { opacity: 1; transform: scale(0.94); }
.hud-btn-stop  { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="5" y="5" width="14" height="14" rx="2" fill="white"/></svg>'), linear-gradient(180deg,#ffd64a,#f6a417); }
.hud-btn-pause { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 5 L19 12 L7 19 Z" fill="white"/></svg>'), linear-gradient(180deg,#ffd64a,#f6a417); }
.hud-btn-sound { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 10 H7 L12 5 V19 L7 14 H3 Z" fill="white"/><path d="M15 9 Q18 12 15 15" fill="none" stroke="white" stroke-width="2"/></svg>'), linear-gradient(180deg,#ffd64a,#f6a417); }
.hud-btn-fs    { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 9 V4 H9 M15 4 H20 V9 M20 15 V20 H15 M9 20 H4 V15" fill="none" stroke="white" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg>'), linear-gradient(180deg,#ffd64a,#f6a417); }

/* === 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: center;
    flex-wrap: wrap;
}

/* === Mario-style coin counter beside timer === */
.coin-counter {
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.7vw, 10px);
    padding: 0;
    background: none;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}
.coin-img {
    width: clamp(40px, 5.2vw, 66px);
    height: auto;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
}
.coin-mult {
    font-size: clamp(20px, 2.6vw, 36px);
    color: #fff;
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    margin: 0 1px;
    /* crisp dark outline so it reads on light themes (snow/desert) too */
    text-shadow:
        -1.5px -1.5px 0 rgba(20,12,0,0.9), 1.5px -1.5px 0 rgba(20,12,0,0.9),
        -1.5px 1.5px 0 rgba(20,12,0,0.9), 1.5px 1.5px 0 rgba(20,12,0,0.9),
        0 2px 5px rgba(0,0,0,0.6);
}
.coin-num {
    font-size: clamp(26px, 3.4vw, 48px);
    font-weight: 900;
    color: #ff9d2e;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    /* dark outline + drop so the gold number shows on every map theme */
    text-shadow:
        -2px -2px 0 rgba(20,12,0,0.92), 2px -2px 0 rgba(20,12,0,0.92),
        -2px 2px 0 rgba(20,12,0,0.92), 2px 2px 0 rgba(20,12,0,0.92),
        0 3px 7px rgba(0,0,0,0.7);
    letter-spacing: 0.5px;
    min-width: 1.2ch;
    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: fixed;   /* fill the WHOLE device (escape the 16:9 letterbox) */
    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(16px, 3vh, 30px);
    padding: clamp(11px, 1.8vh, 16px) clamp(28px, 5.5vw, 48px);
    font-family: 'Impact', 'Bebas Neue', 'Arial Black', sans-serif;
    font-size: clamp(18px, 2.8vw, 32px);
    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 */
    /* Glossy candy RED */
    background:
        linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 42%),
        linear-gradient(135deg, #ff5a4d 0%, #e01e1e 52%, #b00d0d 100%);
    color: #fff;
    border: 5px solid #fff;
    border-radius: 22px;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    /* drop shadow removed per request — keep only a subtle inset bevel for shape */
    box-shadow:
        inset 0 5px 0 rgba(255,255,255,0.45),
        inset 0 -7px 0 rgba(0,0,0,0.28);
    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;
    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(4px) scale(0.97);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.3);
}
@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%; }
}

/* === Splash logo-loop background video === */
.splash-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}
#splash-stage-spinner .splash-start-button { z-index: 2; }

/* 34% dark overlay over the splash video */
.splash-video-dim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.34);
    z-index: 1;
    pointer-events: none;
}
/* Logo + Let's Play stacked above the dimmed video */
.splash-logo-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(14px, 3.2vh, 34px);
    padding: 0 16px;
}
.splash-logo {
    width: clamp(280px, 46vw, 560px);
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

/* === Intro video screen (plays after "Let's Play") === */
.intro-video-screen {
    position: fixed;   /* fill the WHOLE device */
    inset: 0;
    z-index: 60;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.intro-video-screen.hidden { display: none; }
.intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;          /* fill from center out — no black bars */
    object-position: center center;
    background: #000;
}
/* PLAY NOW button on the intro video — fades in 7s in (toggled via .show) */
.intro-play-wrap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: clamp(20px, 7vh, 64px);
    display: flex;
    justify-content: center;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.9s ease;
}
.intro-play-wrap.show {
    opacity: 1;
    pointer-events: auto;
}
/* reuse the glossy + shimmer splash button; neutralise margin + shrink ~50% */
.intro-play-wrap .splash-start-button { margin-top: 0; }
#intro-play-btn {
    font-size: clamp(9px, 1.4vw, 16px);
    padding: clamp(6px, 0.9vh, 8px) clamp(14px, 2.75vw, 24px);
    border-width: 3px;
    border-radius: 13px;
    letter-spacing: 2px;
    text-indent: 2px;
}

/* === Premium TOP DRIVERS board (welcome screen) === */
.mini-board {
    background: linear-gradient(180deg, rgba(22,18,52,0.88), rgba(9,12,24,0.94));
    border: 1px solid rgba(255,214,10,0.22);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 10px 34px rgba(0,0,0,0.5);
    padding: 14px 14px 10px;
}
#welcome-leaderboard h3 { margin-top: 4px; }
#welcome-leaderboard .leaderboard-row { padding: 8px 10px; border-radius: 8px; }
/* silver / bronze accents */
#welcome-leaderboard .leaderboard-row:nth-of-type(2) .lb-rank { color: #d3dbe6; }
#welcome-leaderboard .leaderboard-row:nth-of-type(3) .lb-rank { color: #e0a96d; }
/* #1 — larger, gold, premium */
#welcome-leaderboard .leaderboard-row:first-of-type {
    grid-template-columns: 42px 1fr auto;
    background: linear-gradient(90deg, rgba(255,214,10,0.20), rgba(255,214,10,0.04));
    border: 1px solid rgba(255,214,10,0.45);
    box-shadow: 0 0 22px rgba(255,214,10,0.22);
    padding: 12px 12px;
    margin-bottom: 6px;
}
#welcome-leaderboard .leaderboard-row:first-of-type .lb-rank {
    font-size: clamp(20px, 2.6vw, 30px);
    color: #ffd60a;
    text-shadow: 0 0 14px rgba(255,214,10,0.75);
}
#welcome-leaderboard .leaderboard-row:first-of-type .lb-name {
    font-size: clamp(15px, 1.8vw, 20px);
    font-weight: 800;
    color: #fff;
}
#welcome-leaderboard .leaderboard-row:first-of-type .lb-score {
    font-size: clamp(15px, 1.8vw, 20px);
    color: #ffe27a;
}
@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: 100vh;
    overflow-y: auto;
    animation: coin-bounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe 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: grid;
    grid-template-columns: auto auto;
    grid-template-areas:
        "icon num"
        "icon label";
    align-items: center;
    justify-items: center;
    column-gap: clamp(8px, 1.8vw, 18px);
    row-gap: 0;
    min-width: clamp(150px, 36vw, 250px);
    padding: clamp(8px, 1.6vh, 16px) clamp(16px, 3vw, 30px);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(18, 24, 48, 0.92), rgba(8, 12, 28, 0.92));
}
.celeb-panel-img  { grid-area: icon; }
.celeb-panel-icon { grid-area: icon; }
.celeb-panel-num  { grid-area: num; }
.celeb-panel-label { grid-area: label; }
.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: 20px 0 4px;
}
.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: 'Plus Jakarta Sans', 'Arial Black', system-ui, sans-serif;
    font-size: clamp(70px, 20vw, 280px); font-weight: 800; letter-spacing: 1px; 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: 1.5px #7a0014;
    filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.3));
}
#omg-burst .omg-sub {
    position: relative;
    font-family: 'Plus Jakarta Sans', 'Arial Black', system-ui, sans-serif;
    font-size: clamp(22px, 6vw, 64px); font-weight: 800; letter-spacing: 1px;
    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); } }

/* End-modal = TOP DRIVERS standings. Flex column so the list scrolls and the
   PLAY AGAIN + EXIT GAME buttons are ALWAYS visible (no overlap, no off-screen). */
#end-modal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 92vh;
    padding-bottom: clamp(14px, 3vh, 22px);
}
#end-modal #end-title { flex: 0 0 auto; margin-bottom: 2px; }
#end-modal #end-subtitle { flex: 0 0 auto; margin-bottom: 8px; }
#end-modal #leaderboard-table {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}
#end-modal #restart-btn {
    flex: 0 0 auto;
    width: 100%;
    margin: 12px 0 10px;
    padding: 14px 24px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
#end-modal #exit-game-btn {
    flex: 0 0 auto;
    display: block;
    width: auto;
    margin: 0 auto;
    padding: 9px 22px;
    border: 1.5px solid rgba(239,68,68,0.7);
    border-radius: 12px;
    color: #ff6b6b;
    background: rgba(239,68,68,0.08);
}
#end-modal #exit-game-btn:hover { background: rgba(239,68,68,0.18); color: #fff; }
/* Landscape phones are short — tighten the header so the list + buttons fit. */
@media (max-height: 520px) {
    #end-modal #end-title { font-size: clamp(20px, 5vh, 30px); }
    #end-modal #end-subtitle { font-size: clamp(11px, 2.6vh, 14px); }
    #end-modal .modal-content { max-height: 96vh; padding-top: clamp(12px, 3vh, 20px); }
}

/* 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;
    left: clamp(14px, 2vw, 34px);
    bottom: 15%;                 /* GAS lowered 20% — mirrors the JUMP button */
    display: flex;
    align-items: flex-end;       /* bottom-align GAS with JUMP */
    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 — CSS red circle, thick yellow border, narrow caps. 0.5 opacity idle. */
.touch-jump {
    width: clamp(76px, 12vw, 124px) !important;
    height: clamp(76px, 12vw, 124px) !important;
    border-radius: 50% !important;
    background: #ee1c25 !important;
    border: clamp(5px, 0.9vw, 9px) solid #ffd60a !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.45) !important;
    color: #fff;
    font-family: 'Arial Narrow', 'Roboto Condensed', 'Oswald', 'Impact', sans-serif;
    font-weight: 900;
    font-stretch: condensed;
    letter-spacing: 1px;
    font-size: clamp(17px, 2.6vw, 30px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    touch-action: none;   /* allow holding GAS + JUMP + nitro simultaneously (multitouch) */
    opacity: 0.5;
    transition: opacity .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.touch-jump:hover { opacity: 1; transform: translateY(-1px); }
.touch-jump:active,
.touch-jump.pressed { opacity: 1; transform: translateY(2px) scale(0.96); background: #d4141c !important; }

/* GAS — grey CIRCLE (mirrors JUMP), black "GAS" + black stroke. Left side, ~65% down. */
.touch-gas {
    width: clamp(87px, 14vw, 143px) !important;    /* GAS 15% larger */
    height: clamp(87px, 14vw, 143px) !important;
    border-radius: 50% !important;
    background: linear-gradient(180deg, #e8e8e8 0%, #b2b2b2 100%) !important;
    border: clamp(5px, 0.9vw, 9px) solid #111 !important;   /* same thickness as JUMP */
    touch-action: none;   /* allow holding GAS + JUMP + nitro simultaneously (multitouch) */
    box-shadow: 0 6px 14px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.6) !important;
    color: #111;
    font-family: 'Arial Narrow', 'Roboto Condensed', 'Oswald', 'Impact', sans-serif;
    font-weight: 900;                   /* same weight as JUMP */
    font-stretch: condensed;
    letter-spacing: 1px;
    font-size: clamp(18px, 2.6vw, 30px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0.5;                       /* same transparency as JUMP */
    transition: opacity .15s, transform 0.06s ease, filter 0.06s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.touch-gas:hover { opacity: 1; }
.touch-gas:active,
.touch-gas.pressed {
    opacity: 1;
    transform: translateY(3px) scale(0.97);
    filter: brightness(0.88);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 2px 5px rgba(0,0,0,0.35) !important;
}

/* 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(85px, 12vw, 128px);    /* 15% smaller, top-right corner */
    height: clamp(85px, 12vw, 128px);
    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;
}
/* New needle art (78x229) with its hub near the bottom. Position so the hub sits
   at the gauge center; pivot about the hub. JS sets transform: rotate(...). */
.nitro-gauge-needle {
    inset: auto;
    left: 42.2%;
    top: 9%;
    width: 15.7%;
    height: auto;
    transform-origin: 50% 88%;
    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; }
}

/* ============================================================
   Celebration (play-again) screen — shrink to fit SHORT screens.
   On wide+short landscape phones the vw-based sizes hit their big
   maxima while height is tiny, clipping the trophy top and the
   "play again?" prompt. These height-based overrides scale it all
   down (and the container scrolls as a final safety net).
   ============================================================ */
@media (max-height: 620px) {
    .celebration-content { gap: clamp(3px, 1vh, 8px); padding: 6px 14px; }
    .celeb-trophy { font-size: clamp(30px, 7vh, 52px); margin-bottom: -2px; }
    .celeb-banner-row { gap: 8px; }
    .celeb-name-pill { font-size: clamp(13px, 4.2vh, 20px); padding: 4px 13px; }
    .celeb-achievement { font-size: clamp(12px, 3.6vh, 18px); }
    .celebration-place { font-size: clamp(19px, 6.4vh, 34px); margin: 0; }
    .celeb-panels { gap: clamp(10px, 2vw, 16px); margin: 0; }
    .celeb-panel { min-width: clamp(92px, 26vw, 150px); padding: 6px 14px; border-radius: 16px; gap: 0; }
    .celeb-panel-img { width: clamp(28px, 6vh, 44px); }
    .celeb-panel-icon { font-size: clamp(26px, 6vh, 42px); }
    .celeb-panel-num { font-size: clamp(28px, 9vh, 52px); }
    .celeb-panel-label { font-size: clamp(11px, 3vh, 16px); letter-spacing: 1.5px; }
    .celebration-buttons { gap: 12px; margin: 20px 0 2px; }
    .celeb-btn { padding: 8px 26px !important; font-size: clamp(15px, 4.6vh, 22px) !important; min-width: 96px !important; border-width: 3px; }
    .celebration-prompt { margin-top: 4px !important; }
}
@media (max-height: 460px) {
    .celebration-content { gap: 3px; padding: 4px 12px; }
    .celeb-trophy { font-size: clamp(24px, 8vh, 40px); margin-bottom: -4px; }
    .celeb-name-pill { font-size: clamp(12px, 5vh, 17px); padding: 3px 11px; }
    .celeb-achievement { font-size: clamp(11px, 4.4vh, 15px); }
    .celebration-place { font-size: clamp(17px, 8vh, 28px); }
    .celeb-panel { padding: 5px 12px; min-width: clamp(84px, 24vw, 132px); }
    .celeb-panel-num { font-size: clamp(24px, 11vh, 42px); }
    .celeb-panel-img { width: clamp(24px, 7vh, 38px); }
    .celeb-panel-icon { font-size: clamp(22px, 7vh, 36px); }
    .celeb-panel-label { font-size: clamp(10px, 3.4vh, 14px); letter-spacing: 1px; }
    .celeb-btn { padding: 7px 22px !important; font-size: clamp(14px, 5vh, 19px) !important; min-width: 86px !important; }
}


/* === MOBILE / touch: shrink the controls (desktop sizes are intentionally bigger) === */
@media (hover: none) and (pointer: coarse) {
    .touch-gas {                                      /* GAS 15% larger than JUMP */
        width: clamp(69px, 15vw, 106px) !important;
        height: clamp(69px, 15vw, 106px) !important;
        font-size: clamp(15px, 3.2vw, 22px);
    }
    #touch-controls { left: 12px; }
    .touch-jump {
        width: clamp(60px, 13vw, 92px) !important;   /* JUMP a bit smaller */
        height: clamp(60px, 13vw, 92px) !important;
        font-size: clamp(14px, 3vw, 20px);
    }
    .nitro-gauge {                                    /* gauge 15% smaller */
        width: clamp(51px, 11vw, 78px);
        height: clamp(51px, 11vw, 78px);
    }
    .hud-btn { width: clamp(30px, 6vw, 42px); height: clamp(30px, 6vw, 42px); }
    #right-controls { right: 12px; }
    #gauge-cluster { right: 12px; top: 10%; gap: clamp(4px, 0.8vh, 8px); }
    .nitro-charge { width: clamp(7px, 1.6vw, 11px); height: clamp(12px, 2.6vw, 18px); }
}

/* === Version label on the splash (under Let's Play) === */
.splash-version {
    position: relative;
    z-index: 2;
    margin-top: 10px;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: clamp(11px, 1.4vw, 14px);
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.8);
    text-shadow: 0 1px 3px rgba(0,0,0,0.65);
}

/* === In-app updater (banner + progress + What's New) === */
.update-banner {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
    z-index: 200; display: flex; align-items: center; gap: 10px; max-width: 94vw;
    background: linear-gradient(180deg, #1b2348, #0c1124);
    border: 1px solid rgba(255,214,10,0.5); border-radius: 14px;
    padding: 9px 10px 9px 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.55);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif; color: #fff;
}
.update-banner.hidden, .update-progress.hidden { display: none; }
.update-banner-text { font-size: clamp(12px, 1.5vw, 15px); font-weight: 600; white-space: nowrap; }
.update-banner-text b { color: #ffd60a; }
.upd-btn { border: none; border-radius: 999px; font-weight: 800; cursor: pointer; padding: 8px 16px; font-size: clamp(12px, 1.4vw, 15px); font-family: inherit; }
.upd-ghost { background: rgba(255,255,255,0.14); color: #fff; }
.upd-go { background: linear-gradient(180deg, #ffd64a, #f6a417); color: #1b1205; }
.upd-x { background: none; border: none; color: rgba(255,255,255,0.55); font-size: 16px; cursor: pointer; padding: 2px 6px; }
.update-progress {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
    z-index: 201; width: min(360px, 90vw);
    background: linear-gradient(180deg, #1b2348, #0c1124);
    border: 1px solid rgba(255,214,10,0.5); border-radius: 14px; padding: 14px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.55); color: #fff; text-align: center;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.upd-prog-track { height: 10px; background: rgba(255,255,255,0.14); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
#upd-prog-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #ffd60a, #ff8800); transition: width 0.15s; }
#upd-prog-label { font-size: 13px; font-weight: 600; }
.whatsnew-list { text-align: left; max-height: 50vh; overflow-y: auto; margin: 10px 0 16px; }
.wn-entry { margin-bottom: 14px; }
.wn-ver { font-weight: 800; color: var(--neon-gold); font-size: 15px; }
.wn-date { color: rgba(255,255,255,0.5); font-weight: 600; font-size: 12px; margin-left: 6px; }
.whatsnew-list ul { margin: 6px 0 0; padding-left: 20px; }
.whatsnew-list li { font-size: 14px; color: rgba(255,255,255,0.85); line-height: 1.5; margin-bottom: 4px; }

/* ===== Prominent auto update prompt (main-screen modal) ===== */
.update-modal {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(5,7,16,0.8); backdrop-filter: blur(5px);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.update-modal.hidden { display: none; }
.update-modal-card {
    width: min(440px, 94vw); max-height: 90vh; overflow-y: auto; text-align: center;
    background: linear-gradient(180deg, #1b2348, #0c1124);
    border: 1px solid rgba(255,214,10,0.55); border-radius: 22px;
    padding: clamp(20px,4vh,32px) clamp(18px,4vw,28px); color: #fff;
    box-shadow: 0 26px 70px rgba(0,0,0,0.65);
}
.update-modal-emoji { font-size: clamp(40px,9vw,58px); line-height: 1; }
.update-modal-title { font-weight: 800; font-size: clamp(22px,4.6vw,32px); margin: 8px 0 4px; }
.update-modal-sub { font-size: clamp(13px,1.9vw,16px); color: rgba(255,255,255,0.82); margin: 0 0 6px; }
.update-modal-sub b { color: #ffd60a; }
.update-modal-go { width: 100%; margin-top: 8px; }
.update-modal .update-progress {
    position: static; transform: none; width: 100%; left: auto; bottom: auto;
    margin: 8px 0 4px; padding: 12px 14px;
}

/* === "See you next time" goodbye screen === */
.goodbye-content {
    text-align: center;
    display: flex; flex-direction: column; align-items: center;
    gap: clamp(8px, 2.2vh, 20px);
    padding: 20px;
    animation: coin-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.goodbye-logo { width: clamp(220px, 40vw, 420px); height: auto; filter: drop-shadow(0 8px 22px rgba(0,0,0,0.5)); }
.goodbye-msg {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: clamp(22px, 4vw, 42px); font-weight: 800; color: #fff;
    text-shadow: 0 3px 12px rgba(0,0,0,0.5); margin: 0;
}
.goodbye-countdown {
    font-family: 'Impact', 'Arial Black', sans-serif; font-weight: 900;
    font-size: clamp(38px, 8vw, 86px); line-height: 1;
    background: linear-gradient(180deg, #fff3b0, #ffd60a 50%, #ff9d12);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.goodbye-keep {
    background: transparent; border: none; color: var(--neon-cyan, #00f3ff);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: clamp(14px, 1.8vw, 20px); font-weight: 700; cursor: pointer;
    text-decoration: underline; padding: 8px 14px;
}
.goodbye-keep:hover { color: #fff; }

/* ============ Winner's Photo: capture (pose) ============ */
.pose-content {
    text-align: center; display: flex; flex-direction: column;
    align-items: center; gap: clamp(10px, 2.2vh, 22px); padding: 16px;
    max-height: 96vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.pose-heading {
    font-family: 'Plus Jakarta Sans', 'Nunito', system-ui, sans-serif;
    font-weight: 800; font-size: clamp(22px, 4.4vw, 42px); color: #fff;
    margin: 0; letter-spacing: .5px; text-shadow: 0 3px 16px rgba(0,0,0,.6);
}
.pose-camera-wrap {
    position: relative;
    width: clamp(150px, 34vh, 300px);
    height: clamp(150px, 34vh, 300px);
    aspect-ratio: 1 / 1;        /* guarantee a perfect circle, never an ellipse */
    flex: 0 0 auto;             /* don't let the column flex squash it vertically */
    border-radius: 50%; overflow: hidden;
    border: 6px solid #ffd60a; background: #0a0a12;
    box-shadow: 0 0 0 4px rgba(0,0,0,.4), 0 12px 40px rgba(0,0,0,.6), 0 0 50px rgba(255,214,10,.35);
}
.pose-video, .pose-photo {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; transform: scaleX(-1);   /* mirror like a selfie */
}
.pose-video.hidden, .pose-photo.hidden { display: none; }
.pose-countdown {
    position: absolute; inset: 0; display: flex; align-items: center;
    justify-content: center; pointer-events: none;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 800;
    font-size: clamp(70px, 16vw, 140px); color: rgba(255,255,255,.94);
    text-shadow: 0 4px 24px rgba(0,0,0,.7);
}
.pose-countdown.tick { animation: poseTick .92s ease-out; }
@keyframes poseTick {
    0%   { transform: scale(1.7); opacity: 0; }
    28%  { opacity: 1; }
    100% { transform: scale(1); opacity: .94; }
}
.pose-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.pose-flash.fire { animation: poseFlash .5s ease-out; }
@keyframes poseFlash { 0% { opacity: 0; } 12% { opacity: .95; } 100% { opacity: 0; } }
.pose-driver-label {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 800;
    font-size: clamp(18px, 3.2vw, 30px); color: #ffd60a; margin: 0;
}
.pose-driver-label.hidden { display: none; }
/* After capture: keep this photo or retake */
.pose-confirm { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 2px; }
.pose-confirm.hidden { display: none; }
.pose-hint { font-size: clamp(12px, 1.7vw, 16px); color: rgba(255,255,255,.7); margin: 0; }

/* ============ Winner's Photo: end-game slam-in reveal ============ */
/* Photo reveal (race end, before scoreboard) — full-bleed, photo + text fit */
#photo-reveal-screen.modal-overlay {
    position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
    z-index: 60; padding: clamp(8px, 2.5vh, 24px);
}
.reveal-content {
    text-align: center; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: clamp(10px, 2.5vh, 24px);
    width: 100%; height: 100%;
}
.reveal-photo {
    width: clamp(120px, 50vh, 280px); height: clamp(120px, 50vh, 280px);
    flex: 0 0 auto;
    border-radius: 50%; object-fit: cover; border: 6px solid #ffd60a;
    transform: scaleX(-1);
    box-shadow: 0 0 0 4px rgba(0,0,0,.4), 0 16px 50px rgba(0,0,0,.65), 0 0 55px rgba(255,214,10,.5);
}
.reveal-photo.slam { animation: revealSlam .72s cubic-bezier(.2,1.3,.35,1) both; }
@keyframes revealSlam {
    0%   { transform: scaleX(-1) scale(3.4) rotate(-260deg); opacity: 0; filter: blur(9px); }
    60%  { transform: scaleX(-1) scale(.84) rotate(14deg); opacity: 1; filter: blur(0); }
    78%  { transform: scaleX(-1) scale(1.1) rotate(-6deg); }
    100% { transform: scaleX(-1) scale(1) rotate(0); }
}
.reveal-photo.pulse { animation: revealPulse .85s ease-in-out infinite; }
@keyframes revealPulse {
    0%, 100% { transform: scaleX(-1) scale(1);
        box-shadow: 0 0 0 5px rgba(0,0,0,.4), 0 16px 50px rgba(0,0,0,.65), 0 0 50px rgba(255,214,10,.45); }
    50%      { transform: scaleX(-1) scale(1.07);
        box-shadow: 0 0 0 5px rgba(0,0,0,.4), 0 16px 62px rgba(0,0,0,.7), 0 0 95px rgba(255,214,10,.9); }
}
.reveal-text {
    font-family: 'Luckiest Guy', 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 400;
    font-size: clamp(20px, 4.4vw, 46px); color: #fff; margin: 0; opacity: 0;
    letter-spacing: 1px; line-height: 1.05; max-width: 94vw; flex: 0 0 auto;
    -webkit-text-stroke: 2px #21314a; text-shadow: 0 4px 0 #21314a, 0 6px 12px rgba(0,0,0,.5);
}
.reveal-name { color: #ffd60a; -webkit-text-fill-color: #ffd60a; }
.reveal-text.slam-down { animation: textSlamDown .55s cubic-bezier(.2,1.3,.35,1) both; }
@keyframes textSlamDown {
    0%   { transform: translateY(-64px) scale(1.4); opacity: 0; }
    60%  { transform: translateY(7px) scale(.96); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
.reveal-content.morph-out { animation: revealMorphOut .55s ease-in forwards; }
@keyframes revealMorphOut {
    0%   { transform: scale(1) rotate(0); opacity: 1; filter: blur(0); }
    100% { transform: scale(.18) rotate(200deg); opacity: 0; filter: blur(13px); }
}

/* ============ Exit Game send-off (photo + Good Job + motivation) ============ */
/* Exit Game send-off — full-bleed, photo + text fit landscape (no letterbox) */
#exit-photo-screen.modal-overlay {
    position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
    z-index: 60; padding: clamp(10px, 3vh, 28px);
}
.exit-photo-content {
    display: flex; flex-direction: row; flex-wrap: wrap;
    align-items: center; justify-content: center; gap: clamp(16px, 4vw, 52px);
    width: 100%; height: 100%; text-align: center;
    opacity: 0; transition: opacity 1.1s ease;
}
.exit-photo-content.show { opacity: 1; }
.exit-photo-img {
    width: auto; height: auto; max-height: 82vh; max-width: 46vw;
    border-radius: 26px; object-fit: cover; border: 6px solid #ffd60a;
    transform: scaleX(-1);
    box-shadow: 0 0 0 4px rgba(0,0,0,.4), 0 16px 50px rgba(0,0,0,.65), 0 0 60px rgba(255,214,10,.5);
}
.exit-photo-text {
    font-family: 'Luckiest Guy', 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 400;
    font-size: clamp(28px, 6.5vw, 74px); color: #fff; margin: 0; line-height: 1.05;
    letter-spacing: 1px; max-width: 48vw;
    -webkit-text-stroke: 2px #21314a; text-shadow: 0 4px 0 #21314a, 0 7px 12px rgba(0,0,0,.5);
}
.exit-name { display: block; color: #ffd60a; -webkit-text-fill-color: #ffd60a; }

/* ---- Camera-failed state on the pose screen ---- */
.pose-error.hidden { display: none; }
.pose-error {
    display: flex; flex-direction: column; align-items: center;
    gap: clamp(8px, 1.6vh, 14px); margin-top: clamp(6px, 1.6vh, 14px);
}
.pose-error-msg {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 800;
    font-size: clamp(18px, 3vw, 26px); color: #fff; margin: 0;
}
.pose-error-sub { font-size: clamp(12px, 1.7vw, 16px); color: rgba(255,255,255,.72); margin: 0; }
.pose-error-btns { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 4px; }
.pose-error-btns .big-btn.hidden { display: none; }
.pose-update-btn { font-size: clamp(15px, 2.2vw, 20px); }
.pose-secondary {
    background: rgba(255,255,255,0.12) !important;
    color: #fff !important; border: 1.5px solid rgba(255,255,255,0.3) !important;
    box-shadow: none !important;
}
.pose-secondary:hover { background: rgba(255,255,255,0.2) !important; }

/* ---- Step-by-step "how to enable the camera" guide ---- */
.pose-steps.hidden { display: none; }
.pose-steps {
    display: flex; flex-direction: column; gap: clamp(7px, 1.4vh, 11px);
    width: min(560px, 92vw); text-align: left;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,214,10,0.35);
    border-radius: 14px; padding: clamp(12px, 2vh, 18px) clamp(14px, 3vw, 20px);
    margin-top: 4px;
}
.pose-step { display: flex; align-items: flex-start; gap: 10px; }
.pose-step-n {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(180deg, #ffd64a, #f6a417); color: #1b1205;
    font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.pose-step-t { font-size: clamp(12px, 1.6vw, 15px); color: rgba(255,255,255,0.9); line-height: 1.45; }
.pose-step-t b { color: #ffd60a; font-weight: 800; }
.pose-path {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 2px 0 2px 32px; padding: 9px 12px;
    background: rgba(0,0,0,0.3); border-radius: 10px;
    font-size: clamp(11px, 1.5vw, 14px); font-weight: 700; color: #fff;
}
.pose-path-arrow { color: rgba(255,214,10,0.8); font-weight: 800; }
.pose-path-allow { color: #5dff9b; }

/* ---- Driver photo beside the "PICK YOUR MAP, NAME" heading ---- */
.map-title-row {
    display: flex; align-items: center; justify-content: center;
    gap: clamp(10px, 2vw, 18px);
}
.map-driver-photo {
    width: clamp(52px, 11vw, 80px); height: clamp(52px, 11vw, 80px);
    border-radius: 50%; object-fit: cover; border: 3px solid #ffd60a;
    transform: scaleX(-1); flex: 0 0 auto;
    box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 22px rgba(255,214,10,.4);
}
.map-driver-photo.hidden { display: none; }
.map-footer-links {
    display: flex; align-items: center; justify-content: center;
    gap: clamp(14px, 4vw, 36px); flex-wrap: wrap; margin-top: 11px;
}
.map-footer-links .text-btn { margin: 0; }
.update-modal-required { font-size: clamp(11px,1.6vw,13px); color: rgba(255,255,255,0.55); margin: 10px 0 0; }

/* ============ Redesigned Map Select — full-screen arena ============ */
#map-modal.modal-overlay,
#duration-modal.modal-overlay {
    position: fixed;                  /* escape the 16:9 game-container letterbox */
    inset: 0;
    width: 100vw; height: 100vh; height: 100dvh;
    z-index: 60;
    background-color: #6e441f;
    background-image: url('assets/map-bg.webp?v=63');
    background-size: cover;            /* fill the whole screen, overscan, no black bars */
    background-position: center center;
    background-repeat: no-repeat;
    padding: 0; align-items: stretch; justify-content: stretch;
}
.mapselect {
    position: relative;   /* anchor the driver photo to the left edge */
    width: 100%; height: 100%; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center;
    padding: clamp(8px, 2vh, 20px) clamp(8px, 2vw, 26px);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.ms-header { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 2vw, 22px); flex-wrap: wrap; }
.ms-photo {
    position: absolute; left: 17px; top: clamp(8px, 2.5vh, 26px);   /* 17px from the screen's left edge */
    z-index: 3;
    flex: 0 0 auto; width: clamp(74px, 12.5vh, 124px); height: clamp(74px, 12.5vh, 124px);
    border-radius: 50%; border: 3px solid #ffd60a; background: #0a0a12; overflow: hidden;
    cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 0 26px rgba(255,214,10,.7);
}
.ms-photo-img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.ms-photo-img.hidden { display: none; }
.ms-photo-fallback { font-size: clamp(22px, 4vw, 38px); }
.ms-title {
    margin: 13px 0 0; text-align: center; line-height: 0.98;
    font-family: 'Luckiest Guy', 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 400;
    letter-spacing: 1px; font-size: clamp(24px, 5.6vw, 54px); color: #fff;
    -webkit-text-stroke: 2px #21314a;
    text-shadow: 0 4px 0 #21314a, 0 7px 10px rgba(0,0,0,.4);
}
.ms-name {
    cursor: pointer;
    /* IDENTICAL to "PICK YOUR MAP," — explicit (not inherited) so the font/weight/
       outline/colour always match exactly */
    font-family: 'Luckiest Guy', 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 400;
    letter-spacing: 1px;
    color: #fff;
    -webkit-text-fill-color: #fff;
    -webkit-text-stroke: 2px #21314a;
    text-shadow: 0 4px 0 #21314a, 0 7px 10px rgba(0,0,0,.4);
}
.ms-sub { margin: clamp(2px,1vh,8px) 0 clamp(6px,1.4vh,12px); color: #15233c; font-weight: 800;
    font-size: clamp(12px, 1.8vw, 18px); text-shadow: 0 1px 0 rgba(255,255,255,.45); }

.ms-carousel { position: relative; width: 100%; display: flex; align-items: center; flex: 0 0 auto; }
.ms-cards {
    display: flex; gap: clamp(8px, 1.5vw, 18px);
    overflow-x: auto; overflow-y: visible; scroll-snap-type: x proximity;
    padding: clamp(8px,1.6vh,16px) clamp(34px,5vw,60px);
    margin-top: 20px;   /* push the card selection down 20px */
    width: 100%; align-items: center; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ms-cards::-webkit-scrollbar { display: none; }
.ms-card {
    flex: 0 0 auto; scroll-snap-align: center; box-sizing: border-box;
    height: clamp(150px, 38vh, 262px); width: auto;   /* size by height so cards never overlap START RACE */
    aspect-ratio: 228 / 300;
    border-radius: 18px; border: none;   /* art is edge-to-edge — no CSS border (was doubling the rim) */
    background-size: cover; background-position: center; background-repeat: no-repeat;
    cursor: pointer; position: relative; padding: 0;
    box-shadow: 0 8px 20px rgba(0,0,0,.4); transition: transform .12s ease, box-shadow .2s ease;
}
.ms-card:hover { transform: translateY(-3px); }
.ms-card.selected {
    box-shadow: 0 0 0 4px #ffd60a, 0 0 34px 6px rgba(255,214,10,.85), 0 10px 26px rgba(0,0,0,.45);
}
.ms-check {
    position: absolute; right: 5px; bottom: 5px;
    width: clamp(28px, 4.4vw, 44px); height: clamp(28px, 4.4vw, 44px); border-radius: 50%;
    background: #fff;   /* opaque + larger so it fully covers the baked indicator in the art */
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
}
.ms-card.selected .ms-check { background: #2fd35b; }
.ms-card.selected .ms-check::after { content: '✓'; color: #fff; font-weight: 900; font-size: clamp(16px, 2.6vw, 26px); line-height: 1; }
.ms-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: clamp(34px, 5vw, 48px); height: clamp(34px, 5vw, 48px); border-radius: 50%;
    border: none; background: rgba(0,0,0,.35); color: #fff; font-size: clamp(22px, 3vw, 34px);
    line-height: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ms-arrow-l { left: 2px; } .ms-arrow-r { right: 2px; }
.ms-start {
    flex: 0 0 auto; margin: 0;
    font-family: 'Luckiest Guy', 'Plus Jakarta Sans', system-ui, sans-serif; letter-spacing: 1px;
    font-size: clamp(14px, 2.2vw, 22px); color: #fff;
    padding: clamp(8px,1.4vh,13px) clamp(22px,4.5vw,42px); border-radius: 14px; border: 3px solid #fff;
    background: linear-gradient(180deg, #ff5a4d 0%, #e01e1e 55%, #b00d0d 100%);
    box-shadow: 0 5px 0 #7a0d0d, 0 9px 18px rgba(0,0,0,.4); cursor: pointer;
    text-shadow: 2px 2px 0 rgba(0,0,0,.35); -webkit-tap-highlight-color: transparent;
}
.ms-start:active { transform: translateY(2px); box-shadow: 0 3px 0 #7a0d0d, 0 6px 12px rgba(0,0,0,.4); }

/* Hero: selected card flies to centre, then Start Race / Change Map */
.ms-hero {
    position: absolute; inset: 0; z-index: 6;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: clamp(10px, 2.4vh, 20px); background: rgba(8,10,18,0.55);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.ms-hero.hidden { display: none; }
.ms-hero-card {
    height: clamp(180px, 56vh, 360px); aspect-ratio: 228 / 300; width: auto;
    background-size: cover; background-position: center; background-repeat: no-repeat;
    border-radius: 22px; border: 4px solid #ffd60a; will-change: transform, filter;
    box-shadow: 0 0 0 4px rgba(0,0,0,.3), 0 0 40px 8px rgba(255,214,10,.7), 0 18px 40px rgba(0,0,0,.5);
}
.ms-hero-btns { display: flex; gap: clamp(10px, 2vw, 18px); align-items: center;
    opacity: 0; animation: msBtnsIn .35s ease .42s forwards; }
@keyframes msBtnsIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ms-changemap {
    font-family: 'Luckiest Guy', 'Plus Jakarta Sans', system-ui, sans-serif; letter-spacing: 1px;
    font-size: clamp(13px, 2vw, 20px); color: #21314a;
    padding: clamp(8px,1.4vh,13px) clamp(18px,4vw,36px); border-radius: 14px; border: 3px solid #fff;
    background: linear-gradient(180deg, #ffffff 0%, #d7dee8 100%);
    box-shadow: 0 5px 0 #97a1b3, 0 8px 16px rgba(0,0,0,.35); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ms-changemap:active { transform: translateY(2px); box-shadow: 0 3px 0 #97a1b3, 0 5px 10px rgba(0,0,0,.35); }

/* Time cards (duration screen) — match the map cards but content-styled */
.dur-card, .dur-hero-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: clamp(4px, 1vh, 10px); color: #fff; text-align: center;
}
.dur-emoji { font-size: clamp(34px, 8vh, 76px); line-height: 1; filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
.dur-min {
    font-family: 'Luckiest Guy', 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: clamp(20px, 5vh, 46px); letter-spacing: 1px; color: #fff;
    -webkit-text-stroke: 1.5px #21314a; text-shadow: 0 3px 0 #21314a;
}
.dur-tag {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-weight: 800;
    font-size: clamp(12px, 2.2vh, 20px); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.dur-cards { justify-content: center; }   /* 3 cards centre nicely (no overflow) */
#map-modal .map-footer-links .text-btn { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
/* Small red pill buttons (Change Name / Change My Photo) */
.ms-pill {
    border: 2px solid #fff; border-radius: 999px;
    background: linear-gradient(180deg, #ff5a4d 0%, #e01e1e 55%, #b00d0d 100%);
    color: #fff; font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 500; font-size: clamp(11px, 1.5vw, 14px); letter-spacing: .3px;
    padding: 6px 16px; cursor: pointer; -webkit-tap-highlight-color: transparent;
    box-shadow: 0 3px 8px rgba(0,0,0,.35);
}
.ms-pill:active { transform: translateY(1px); }


/* ================= Galaxy-Defender-style polish (web) ================= */

/* --- Map picker: centre the cards when they fit, stagger them in --- */
/* "safe center" keeps the left-most card reachable once the row overflows;
   plain "center" would clip it on narrow screens. */
#map-picker.ms-cards { justify-content: center; justify-content: safe center; }

.ms-card { opacity: 0; transform: scale(.42) rotate(-7deg); }
.ms-card.in { animation: mtCardPop .5s cubic-bezier(.18,1.5,.4,1) both; }
@keyframes mtCardPop {
    0%   { opacity: 0; transform: scale(.42) rotate(-7deg); }
    70%  { opacity: 1; transform: scale(1.07) rotate(2deg); }
    100% { opacity: 1; transform: none; }
}
/* the pop is fill-mode:both, so JS swaps .in for .shown once it ends —
   otherwise the held final keyframe would beat every :hover transform */
.ms-card.shown { opacity: 1; transform: none; }
.ms-card.shown:hover, .ms-card.shown:focus-visible {
    transform: scale(1.085) translateY(-9px); outline: none; z-index: 4;
    box-shadow: 0 0 0 4px rgba(255,214,10,.55), 0 20px 40px rgba(0,0,0,.55);
    filter: brightness(1.07) saturate(1.08);
}
.ms-card.shown.selected:hover, .ms-card.shown.selected:focus-visible {
    box-shadow: 0 0 0 4px #ffd60a, 0 0 40px 8px rgba(255,214,10,.9), 0 20px 40px rgba(0,0,0,.5);
}
.ms-card.shown { transition: transform .2s cubic-bezier(.2,1.2,.3,1), box-shadow .22s ease, filter .2s ease; }

/* --- Exit Game / Sound pinned to the screen corners, as on the GD home --- */
.mt-corner {
    position: absolute; z-index: 14;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.mt-corner-l { left:  calc(16px + env(safe-area-inset-left, 0px)); }
.mt-corner-r { right: calc(16px + env(safe-area-inset-right, 0px)); }
.mt-cornerbtn {
    background: rgba(8,12,24,.5); color: #f2f6ff;
    border: 2px solid rgba(255,255,255,.3); border-radius: 999px;
    padding: 9px 17px; font-weight: 800; font-size: clamp(11px, 1.5vw, 13.5px);
    letter-spacing: .02em; cursor: pointer;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
    transition: transform .14s ease, background .18s ease, border-color .18s ease;
}
.mt-cornerbtn:hover { transform: scale(1.07); background: rgba(8,12,24,.72); border-color: rgba(255,255,255,.6); }
.mt-cornerbtn:active { transform: scale(.95); }
#map-exit-btn.mt-cornerbtn { border-color: rgba(255,124,124,.62); color: #ffc9c9; }

/* --- Staged arrival, same curves as the Galaxy Defender pilot screen --- */
@keyframes mtRise {
    0%   { opacity: 0; transform: translateY(22px) scale(.96); }
    100% { opacity: 1; transform: none; }
}
@keyframes mtCircleIn {
    0%   { opacity: 0; transform: scale(.66); filter: brightness(1.7) blur(7px); }
    55%  { opacity: 1; transform: scale(1.05); filter: brightness(1.15) blur(0); }
    100% { opacity: 1; transform: scale(1);   filter: none; }
}
.mt-in        { animation: mtRise .58s cubic-bezier(.2,1.3,.35,1) var(--d, 0s) both; }
.mt-in-circle { animation: mtCircleIn .9s cubic-bezier(.2,1.2,.3,1) var(--d, 0s) both; }

/* --- Winner's-photo buttons: chunky arcade slabs, not flat rectangles --- */
#pose-confirm { gap: 14px; margin-top: 12px; }
#pose-accept.big-btn {
    font-family: 'Luckiest Guy', 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 400; letter-spacing: 1px;
    font-size: clamp(19px, 4.4vw, 25px); padding: 15px 34px 12px;
    border: none; border-radius: 20px; color: #fff; cursor: pointer;
    background: linear-gradient(160deg, #ffb02e, #ff5f6d);
    box-shadow: 0 8px 0 #a8341f, 0 14px 30px rgba(255,120,80,.45);
    text-shadow: 0 2px 0 rgba(0,0,0,.28);
    transform: none;
    animation: mtAcceptPulse 1.35s ease-in-out infinite;
    transition: transform .12s ease, filter .12s ease;
}
@keyframes mtAcceptPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.055); } }
#pose-accept.big-btn:hover  { filter: brightness(1.1); animation-play-state: paused; transform: scale(1.07); }
#pose-accept.big-btn:active { transform: translateY(4px) scale(1.02); box-shadow: 0 4px 0 #a8341f, 0 8px 16px rgba(255,120,80,.4); }
/* the pulse must not fight the staged arrival — it starts once the rise ends */
#pose-accept.big-btn.mt-in { animation: mtRise .58s cubic-bezier(.2,1.3,.35,1) var(--d, 0s) both; }

#pose-again.text-btn {
    color: #ffd60a; font-weight: 800; font-size: clamp(13px, 1.9vw, 15px);
    letter-spacing: .02em; text-decoration: none; padding: 6px 10px; border-radius: 999px;
    transition: transform .14s ease, color .18s ease, background .18s ease;
}
#pose-again.text-btn:hover { color: #fff; background: rgba(255,255,255,.1); transform: scale(1.06); }
#pose-again.text-btn:active { transform: scale(.95); }

@media (prefers-reduced-motion: reduce) {
    .ms-card, .ms-card.in, .mt-in, .mt-in-circle, #pose-accept.big-btn {
        animation: none !important; opacity: 1; transform: none;
    }
}


/* --- Map screen: centre the heading + cards as one group --- */
/* "safe center" again: if the group ever grows taller than the viewport,
   plain centring would push the heading off the top with no way to scroll to it. */
.mapselect { justify-content: center; justify-content: safe center; }

/* --- Change Photo folded into the top-left driver photo --- */
.ms-photo { transition: transform .16s ease, box-shadow .2s ease; }
.ms-photo:hover, .ms-photo:focus-visible {
    transform: scale(1.07); outline: none;
    box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 0 34px rgba(255,214,10,.95);
}
.ms-photo-edit {
    position: absolute; inset: 0; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: rgba(6,10,22,.6); color: #fff;
    opacity: 0; transition: opacity .2s ease;
    pointer-events: none;   /* the button underneath owns the click */
}
.ms-photo:hover .ms-photo-edit, .ms-photo:focus-visible .ms-photo-edit { opacity: 1; }
.ms-photo-edit svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.ms-photo-edit-t {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-weight: 800; font-size: 10px; letter-spacing: .12em;
}
/* touch has no hover, so show a permanent hint instead of hiding the affordance */
@media (hover: none) {
    .ms-photo-edit { opacity: 1; background: rgba(6,10,22,.22); }
    .ms-photo-edit-t { display: none; }
}
