﻿@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@500;700&display=swap');

:root {
    --ui-scale: 1;
    --bg-color: #030308;
    --surface: rgba(10, 10, 25, 0.2);
    --surface-hover: rgba(20, 20, 45, 0.8);
    --border: rgba(0, 243, 255, 0.3);
    --text-main: #E0FCFF;
    --text-muted: #4B7882;
    --neon-cyan: #00F3FF;
    --neon-magenta: #FF00EA;
    --neon-yellow: #FFF100;
    --neon-red: #FF2A2A;
    --neon-green: #00FF88;
    --neon-purple: #8A2BE2;
}

* {
    box-sizing: border-box;
    user-select: none;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
    /* manipulation (not none) at the page level: still blocks double-tap zoom,
       but critically lets the scrollable modals (upgrades / draft / daily) be
       panned by a finger. Gesture-blocking for the play field lives on the
       canvas itself below. touch-action is touch-only, so desktop is unaffected. */
    touch-action: manipulation;
    /* Mobile polish (no-ops on desktop): kill the grey tap flash, the iOS
       long-press callout, and any overscroll bounce that would fight the
       canvas. */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
}

html {
    font-size: calc(16px * var(--ui-scale));
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    /* The play field must never scroll, pan or zoom under a finger. Scoping
       this to the canvas (instead of the whole page) keeps the menu modals
       touch-scrollable. */
    touch-action: none;
}

h1, h2, h3 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
}

h1 {
    font-size: 3.2rem;
    margin-bottom: 0.2rem;
    color: var(--text-main);
    text-shadow: 0 0 15px var(--neon-cyan), 0 0 30px var(--neon-cyan);
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
}

.mono {
    font-family: 'Orbitron', sans-serif;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Match the *visible* viewport on mobile so centred modals sit inside the
       area not covered by the browser's address/tool bars. dvh === vh on
       desktop, so this is a no-op there; older browsers ignore the dvh line and
       fall back to 100%. */
    height: 100dvh;
    pointer-events: none;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* Kept fully hidden (not just visually, but non-interactive) until
   Engine.init() has finished: correct --ui-scale, save data, and click
   handlers are all in place by the time this is ever shown, so the menu
   never flashes at the wrong size or eats a click before it's ready. */
body.booting #ui-layer {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

    #ui-layer::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient( to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.1) );
        background-size: 100% 4px;
        pointer-events: none;
        z-index: 100;
        opacity: 0.25;
    }

#menu-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(3, 3, 10, 0.4) 0%, rgba(0, 0, 0, 0.8) 100%);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    padding: calc(20px * var(--ui-scale));
    overflow: hidden;
}

    #menu-backdrop::before {
        content: '';
        position: absolute;
        inset: -20%;
        background-image: linear-gradient(rgba(0, 243, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
        background-size: calc(46px * var(--ui-scale)) calc(46px * var(--ui-scale));
        -webkit-mask: radial-gradient(circle at 50% 40%, #000 0%, transparent 70%);
        mask: radial-gradient(circle at 50% 40%, #000 0%, transparent 70%);
        animation: menuGridDrift 22s linear infinite;
        pointer-events: none;
    }

@keyframes menuGridDrift {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(calc(46px * var(--ui-scale)), calc(46px * var(--ui-scale)));
    }
}

.screen {
    background: var(--surface);
    border: 2px solid var(--border);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.1), inset 0 0 20px rgba(0, 243, 255, 0.05);
    border-radius: 4px;
    padding: calc(40px * var(--ui-scale));
    max-width: calc(650px * var(--ui-scale));
    width: 100%;
    display: none;
    flex-direction: column;
    text-align: center;
    position: relative;
    overflow: hidden;
}

    .screen::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: calc(4px * var(--ui-scale));
        background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
        box-shadow: 0 0 15px var(--neon-cyan);
    }

    .screen.active {
        display: flex;
        animation: bootUp 0.3s cubic-bezier(0.1, 1, 0.1, 1);
    }

    .screen::-webkit-scrollbar {
        width: 6px;
    }

    .screen::-webkit-scrollbar-thumb {
        background: var(--neon-cyan);
        border-radius: 3px;
    }

@keyframes bootUp {
    0% {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
        filter: blur(5px);
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
        filter: blur(0);
    }
}

.btn {
    background: transparent;
    color: var(--neon-cyan);
    border: 2px solid var(--neon-cyan);
    padding: calc(14px * var(--ui-scale)) calc(24px * var(--ui-scale));
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    clip-path: polygon(15px 0, 100% 0, calc(100% - 15px) 100%, 0 100%);
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.2);
    position: relative;
}

    .btn:hover {
        background: var(--neon-cyan);
        color: #000;
        box-shadow: 0 0 20px var(--neon-cyan), inset 0 0 15px #FFF;
        transform: scale(1.02);
    }

    .btn:active {
        transform: scale(0.98);
    }

    .btn.outline {
        border-color: var(--neon-magenta);
        color: var(--neon-magenta);
        box-shadow: inset 0 0 10px rgba(255, 0, 234, 0.2);
    }

        .btn.outline:hover {
            background: var(--neon-magenta);
            color: #000;
            box-shadow: 0 0 20px var(--neon-magenta), inset 0 0 15px #FFF;
        }

    .btn.arena2-btn {
        border-color: var(--neon-purple);
        color: #C792FF;
        box-shadow: inset 0 0 10px rgba(138, 43, 226, 0.25);
    }

        .btn.arena2-btn:hover {
            background: var(--neon-purple);
            color: #000;
            box-shadow: 0 0 20px var(--neon-purple), inset 0 0 15px #FFF;
        }

    .btn.arena3-btn {
        border-color: #39FF6A;
        color: #9CFFB0;
        box-shadow: inset 0 0 10px rgba(57, 255, 106, 0.25);
    }

        .btn.arena3-btn:hover {
            background: #39FF6A;
            color: #000;
            box-shadow: 0 0 20px #39FF6A, inset 0 0 15px #FFF;
        }

.arena-tier-row {
    display: flex;
    width: 100%;
    gap: calc(10px * var(--ui-scale));
}

    .arena-tier-row .btn {
        width: auto;
        flex: 1 1 0;
        min-width: 0;
    }

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    border-color: var(--text-muted);
    color: var(--text-muted);
    box-shadow: none;
    pointer-events: none;
}

/* One-time attention pulse for the SYSTEM UPGRADES button, driven by the
   first-time "you can permanently upgrade" menu nudge (see UI.maybeShowMenuUpgradeHint). */
.btn.hint-pulse {
    animation: btnHintPulse 1.1s ease-in-out infinite;
}

@keyframes btnHintPulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(255, 241, 0, 0);
        border-color: var(--neon-cyan);
    }
    50% {
        box-shadow: 0 0 18px rgba(255, 241, 0, 0.75), inset 0 0 10px rgba(255, 241, 0, 0.25);
        border-color: var(--neon-yellow);
    }
}

.btn.primary-action {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3), inset 0 0 10px rgba(0, 243, 255, 0.1);
    animation: btnBreath 2s infinite alternate;
    overflow: hidden;
}

    .btn.primary-action::before {
        content: '';
        position: absolute;
        top: 0;
        left: -150%;
        width: 50%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
        transform: skewX(-25deg);
        animation: sweepShine 4s infinite;
    }

@keyframes btnBreath {
    from {
        box-shadow: 0 0 15px rgba(0, 243, 255, 0.3), inset 0 0 10px rgba(0, 243, 255, 0.1);
    }

    to {
        box-shadow: 0 0 25px rgba(0, 243, 255, 0.6), inset 0 0 15px rgba(0, 243, 255, 0.3);
    }
}

@keyframes sweepShine {
    0% {
        left: -150%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

.main-screen {
    max-width: calc(620px * var(--ui-scale));
    max-height: calc(100vh - calc(40px * var(--ui-scale)));
    max-height: calc(100dvh - calc(40px * var(--ui-scale)));
    gap: 0;
    padding: calc(56px * var(--ui-scale)) calc(50px * var(--ui-scale)) calc(44px * var(--ui-scale));
    background: rgba(10, 12, 25, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.05), inset 0 0 20px rgba(0, 243, 255, 0.02);
    /* Phantom-scrollbar fix (see .daily-screen): stay clipped by default and
       only flip to scrollable once UI.refreshMainMenuOverflow() confirms the
       overflow is more than a rounding error, so a near-perfect fit never
       shows a scrollbar it doesn't need. */
    overflow-y: hidden;
}

    .main-screen.has-overflow {
        overflow-y: auto;
    }

    .main-screen .main-brand {
        animation: sectionRise 0.5s ease backwards 0.05s;
    }

    .main-screen .menu-stats {
        animation: sectionRise 0.5s ease backwards 0.18s;
    }

    .main-screen .menu-actions {
        animation: sectionRise 0.5s ease backwards 0.30s;
    }

@keyframes sectionRise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-brand {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(10px * var(--ui-scale));
    padding: calc(34px * var(--ui-scale)) 0 calc(8px * var(--ui-scale));
    margin-bottom: calc(40px * var(--ui-scale));
}


.brand-scan {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(440px * var(--ui-scale));
    height: calc(440px * var(--ui-scale));
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(0,243,255,0.11) 18deg, transparent 50deg, transparent 360deg);
    animation: brandScanSpin 7s linear infinite;
    pointer-events: none;
}

    .brand-scan::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 50%;
        border: 1px solid rgba(0,243,255,0.14);
        -webkit-mask: radial-gradient(circle, transparent 64%, #000 65%);
        mask: radial-gradient(circle, transparent 64%, #000 65%);
    }

@keyframes brandScanSpin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes radarOrbit {
    from {
        transform: rotate(0deg) translateX(calc(118px * var(--ui-scale))) rotate(0deg);
    }

    to {
        transform: rotate(360deg) translateX(calc(118px * var(--ui-scale))) rotate(-360deg);
    }
}

.brand-kicker {
    position: relative;
    z-index: 1;
    color: var(--neon-cyan);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 6px;
    opacity: 0.85;
}

.main-brand h1 {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 4.8rem;
    line-height: 0.9;
    letter-spacing: 6px;
    color: #FFFFFF;
    text-shadow: 0 0 5px #fff, 0 0 15px var(--neon-cyan), 0 0 30px var(--neon-cyan), 0 0 50px var(--neon-cyan);
    animation: neonPulse 2.5s infinite alternate;
}

@keyframes neonPulse {
    0% {
        text-shadow: 0 0 5px #fff, 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan), 0 0 40px var(--neon-cyan);
    }

    100% {
        text-shadow: 0 0 5px #fff, 0 0 15px var(--neon-cyan), 0 0 35px var(--neon-cyan), 0 0 60px var(--neon-cyan), 0 0 80px rgba(0,243,255,0.5);
    }
}

/* --- MAIN MENU ONLY: cyan-to-magenta gradient rule, thicker --- */
.main-screen .brand-rule {
    position: relative;
    z-index: 1;
    width: calc(120px * var(--ui-scale));
    height: calc(4px * var(--ui-scale));
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
    box-shadow: 0 0 14px rgba(0,243,255,0.5), 0 0 14px rgba(255,0,234,0.4);
    border-radius: 2px;
}

.brand-rule {
    position: relative;
    z-index: 1;
    width: calc(64px * var(--ui-scale));
    height: 2px;
    background: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0,243,255,0.6);
}

/* --- MAIN MENU STAT CARDS: styled like reference image --- */
.menu-stats {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: calc(16px * var(--ui-scale));
    border: none;
    background: none;
    margin-bottom: calc(28px * var(--ui-scale));
    padding-bottom: calc(28px * var(--ui-scale));
    border-bottom: 1px solid rgba(0, 243, 255, 0.15);
}

.menu-stat-card {
    min-height: 0;
    padding: calc(14px * var(--ui-scale)) calc(20px * var(--ui-scale)) calc(14px * var(--ui-scale)) calc(18px * var(--ui-scale));
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: calc(6px * var(--ui-scale));
    position: relative;
    flex: 1;
    /* Glassy dark background */
    background: rgba(6, 8, 20, 0.28);
    backdrop-filter: blur(8px);
    /* Left accent bar via border-left */
    border: 1px solid transparent;
    border-left: 4px solid var(--neon-cyan);
    box-shadow: inset 0 0 20px rgba(0, 243, 255, 0.06), 0 0 18px rgba(0, 0, 0, 0.5);
    /* Top shimmer line */
    overflow: hidden;
}

    .menu-stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, var(--neon-cyan), transparent 80%);
        opacity: 0.5;
    }

    /* Shards card: cyan accent */
    .menu-stat-card:first-child {
        border-left-color: var(--neon-cyan);
    }

    /* Best wave card: yellow accent */
    .menu-stat-card.best {
        border-left-color: var(--neon-yellow);
        background: rgba(20, 16, 6, 0.28);
        box-shadow: inset 0 0 20px rgba(255, 241, 0, 0.05), 0 0 18px rgba(0, 0, 0, 0.5);
    }

        .menu-stat-card.best::before {
            background: linear-gradient(90deg, var(--neon-yellow), transparent 80%);
        }

    .menu-stat-card span {
        color: var(--text-muted);
        font-family: 'Orbitron', sans-serif;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 2.5px;
        text-transform: uppercase;
    }

    .menu-stat-card strong {
        color: var(--neon-cyan);
        font-size: 2.1rem;
        line-height: 1;
        font-weight: 900;
        font-family: 'Orbitron', sans-serif;
        text-shadow: 0 0 12px rgba(0, 243, 255, 0.55);
    }

    .menu-stat-card.best strong {
        color: var(--neon-yellow);
        text-shadow: 0 0 12px rgba(255, 241, 0, 0.55);
    }

.menu-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: calc(12px * var(--ui-scale));
}

    .menu-actions .btn {
        font-size: 1.05rem;
        padding: calc(13px * var(--ui-scale)) calc(24px * var(--ui-scale));
    }

        .menu-actions .btn.primary-action {
            font-size: 1.3rem;
            padding: calc(19px * var(--ui-scale)) calc(24px * var(--ui-scale));
            letter-spacing: 3px;
        }

        .menu-actions .btn.outline {
            background: transparent;
            border-color: transparent;
            box-shadow: none;
            color: var(--text-muted);
            font-size: 0.95rem;
            padding: calc(8px * var(--ui-scale)) calc(24px * var(--ui-scale));
        }

            .menu-actions .btn.outline:not(.btn-settings-yellow):hover {
                background: transparent;
                color: var(--neon-magenta);
                box-shadow: none;
                text-shadow: 0 0 10px rgba(255, 0, 234, 0.5);
                transform: scale(1.02);
            }

/* ── Daily Rewards corner badge (main menu) ──────────────────────────────
   Sits in the top-right corner of the main menu panel. Reads as a live,
   "something's waiting for you" object — pulsing ping dot when unclaimed,
   quietly dims once claimed for the day. */
.daily-corner-wrap {
    position: absolute;
    top: calc(16px * var(--ui-scale));
    right: calc(16px * var(--ui-scale));
    z-index: 3;
}

.daily-corner-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale));
    background: rgba(10, 8, 0, 0.45);
    border: 1px solid rgba(255, 241, 0, 0.55);
    box-shadow: 0 0 16px rgba(255, 241, 0, 0.22), inset 0 0 14px rgba(255, 241, 0, 0.06);
    backdrop-filter: blur(8px);
    padding: calc(8px * var(--ui-scale)) calc(14px * var(--ui-scale));
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    animation: dailyCornerBreath 2.4s infinite alternate;
}

    .daily-corner-btn:hover {
        transform: scale(1.04);
        background: rgba(255, 241, 0, 0.14);
        box-shadow: 0 0 26px rgba(255, 241, 0, 0.4), inset 0 0 18px rgba(255, 241, 0, 0.12);
    }

    .daily-corner-btn.claimed {
        border-color: rgba(0, 243, 255, 0.35);
        box-shadow: 0 0 10px rgba(0, 243, 255, 0.12);
        animation: none;
        opacity: 0.7;
    }

        .daily-corner-btn.claimed:hover {
            background: rgba(0, 243, 255, 0.1);
            box-shadow: 0 0 16px rgba(0, 243, 255, 0.22);
        }

@keyframes dailyCornerBreath {
    from {
        box-shadow: 0 0 16px rgba(255, 241, 0, 0.22), inset 0 0 14px rgba(255, 241, 0, 0.06);
    }

    to {
        box-shadow: 0 0 26px rgba(255, 241, 0, 0.42), inset 0 0 18px rgba(255, 241, 0, 0.14);
    }
}

.daily-corner-icon {
    font-size: 1.2rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
    animation: dailyIconSpin 5s linear infinite;
    display: inline-block;
}

@keyframes dailyIconSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.daily-corner-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    max-width: calc(108px * var(--ui-scale));
}

.daily-corner-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--neon-yellow);
    white-space: nowrap;
}

.daily-corner-sub {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    white-space: normal;
    word-break: break-word;
}

.daily-corner-btn.claimed .daily-corner-label,
.daily-corner-btn.claimed .daily-corner-icon {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px var(--neon-cyan);
}

.daily-corner-ping {
    position: absolute;
    top: calc(-3px * var(--ui-scale));
    right: calc(-3px * var(--ui-scale));
    width: calc(7px * var(--ui-scale));
    height: calc(7px * var(--ui-scale));
    border-radius: 50%;
    background: var(--neon-red);
    box-shadow: 0 0 6px var(--neon-red);
    display: none;
}

    .daily-corner-ping.show {
        display: block;
    }

        .daily-corner-ping.show::after {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: 50%;
            background: var(--neon-red);
            animation: dailyPingPulse 1.3s infinite;
        }

@keyframes dailyPingPulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    70% {
        transform: scale(2.4);
        opacity: 0;
    }

    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .daily-corner-wrap {
        top: calc(10px * var(--ui-scale));
        right: calc(10px * var(--ui-scale));
    }

    .daily-corner-btn {
        padding: calc(6px * var(--ui-scale)) calc(10px * var(--ui-scale));
    }

    .daily-corner-text {
        max-width: calc(86px * var(--ui-scale));
    }

    .daily-corner-label, .daily-corner-sub {
        font-size: 0.56rem;
    }
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: calc(20px * var(--ui-scale)) calc(30px * var(--ui-scale));
    display: none;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 5;
}

.pause-button {
    position: absolute;
    top: calc(14px * var(--ui-scale));
    left: calc(14px * var(--ui-scale));
    width: calc(38px * var(--ui-scale));
    height: calc(38px * var(--ui-scale));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(5px * var(--ui-scale));
    border: 1px solid rgba(0, 243, 255, 0.55);
    background: rgba(5, 5, 10, 0.58);
    box-shadow: 0 0 16px rgba(0,243,255,0.22), inset 0 0 14px rgba(0,243,255,0.08);
    backdrop-filter: blur(10px);
    cursor: pointer;
    pointer-events: auto;
    z-index: 6;
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

    .pause-button span {
        width: calc(5px * var(--ui-scale));
        height: calc(17px * var(--ui-scale));
        background: var(--neon-cyan);
        box-shadow: 0 0 10px var(--neon-cyan);
    }

    .pause-button:hover {
        transform: scale(1.06);
        background: rgba(0, 243, 255, 0.16);
        box-shadow: 0 0 22px rgba(0,243,255,0.38), inset 0 0 18px rgba(0,243,255,0.12);
    }

    /* Touch devices only: grow the pause button to a comfortable finger target
       (desktop keeps its compact 38px look). */
    body.touch-device .pause-button {
        width: calc(50px * var(--ui-scale));
        height: calc(50px * var(--ui-scale));
        top: calc(calc(12px * var(--ui-scale)) + env(safe-area-inset-top, 0px));
        left: calc(calc(12px * var(--ui-scale)) + env(safe-area-inset-left, 0px));
    }

        body.touch-device .pause-button span {
            height: calc(22px * var(--ui-scale));
        }

.hud-panel {
    background: rgba(5, 5, 10, 0.5);
    border-left: 4px solid var(--neon-cyan);
    padding: calc(10px * var(--ui-scale)) calc(20px * var(--ui-scale));
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

.hud-stat {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
}

    .hud-stat span {
        color: #FFF;
        font-size: 1.8rem;
        text-shadow: 0 0 10px var(--neon-cyan);
        font-family: 'Orbitron';
        margin-left: calc(10px * var(--ui-scale));
    }

.hud-build-mini {
    margin-top: calc(8px * var(--ui-scale));
    padding-top: calc(6px * var(--ui-scale));
    border-top: 1px solid rgba(255,255,255,0.08);
    max-width: calc(160px * var(--ui-scale));
}

.hud-build-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-right: calc(6px * var(--ui-scale));
}

.hud-build-name {
    font-size: 0.78rem;
    font-family: 'Orbitron';
    font-weight: 700;
    color: var(--build-color, #FFF);
    text-shadow: 0 0 6px var(--build-color, transparent);
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.build-meter {
    display: flex;
    width: 100%;
    height: calc(5px * var(--ui-scale));
    background: rgba(255,255,255,0.08);
    overflow: hidden;
    margin-top: calc(4px * var(--ui-scale));
    border: 1px solid rgba(255,255,255,0.12);
}

.build-meter-seg {
    height: 100%;
    transition: width 0.3s ease;
}

.build-badge {
    margin: calc(6px * var(--ui-scale)) 0 calc(14px * var(--ui-scale));
    padding: calc(10px * var(--ui-scale)) calc(14px * var(--ui-scale));
    background: rgba(5, 5, 10, 0.5);
    border-left: 4px solid var(--build-color, var(--neon-cyan));
    backdrop-filter: blur(6px);
    text-align: left;
}

.build-badge-label {
    font-family: 'Orbitron';
    font-size: 0.66rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 2px;
}

.build-badge-name {
    font-family: 'Orbitron';
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--build-color, #FFF);
    text-shadow: 0 0 10px var(--build-color, transparent);
    letter-spacing: 1px;
    margin: calc(2px * var(--ui-scale)) 0 calc(6px * var(--ui-scale));
}

.progress-container {
    width: calc(200px * var(--ui-scale));
    height: calc(16px * var(--ui-scale));
    background: rgba(255,255,255,0.1);
    margin-top: calc(10px * var(--ui-scale));
    position: relative;
    border: 1px solid var(--border);
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

.progress-bar {
    width: 100%;
    height: 100%;
    background: var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan);
    transition: width 0.1s linear, background-color 0.1s;
}

.wobble-warning .progress-bar {
    background: var(--neon-red);
    box-shadow: 0 0 20px var(--neon-red);
}

.wobble-warning .hud-panel {
    border-left-color: var(--neon-red);
    animation: flash 0.5s infinite alternate;
}

/* ── Mobile HUD reflow ────────────────────────────────────────────────────
   On a narrow phone the two HUD panels (WAVE/SHARDS/BUILD and DASH CORE) plus
   their padding are far wider than the screen, so the right panel used to spill
   off the edge. Tighten padding, fonts and the dash bar so both panels fit,
   and drop the "[SPACEBAR / CLICK]" hint that only applies to desktop. Guarded
   by the width query so desktop is untouched. */
@media (max-width: 768px) {
    #hud {
        padding: calc(10px * var(--ui-scale)) calc(10px * var(--ui-scale));
    }

    .hud-panel {
        padding: calc(7px * var(--ui-scale)) calc(11px * var(--ui-scale));
    }

    .hud-stat {
        font-size: 0.8rem;
    }

        .hud-stat span {
            font-size: 1.25rem;
            margin-left: calc(6px * var(--ui-scale));
        }

    #hud .progress-container {
        width: calc(120px * var(--ui-scale));
        height: calc(13px * var(--ui-scale));
    }

    .hud-build-mini {
        max-width: calc(118px * var(--ui-scale));
    }

    /* Desktop-only control hint - there is no spacebar on a phone, and the DASH
       button already communicates the action. */
    .dash-key-hint {
        display: none;
    }
}

/* Keep the left HUD panel clear of the enlarged touch pause button so the WAVE
   label never sits underneath it. */
body.touch-device #hud {
    padding-top: calc(calc(10px * var(--ui-scale)) + env(safe-area-inset-top, 0px));
    padding-left: calc(calc(58px * var(--ui-scale)) + env(safe-area-inset-left, 0px));
    padding-right: calc(calc(10px * var(--ui-scale)) + env(safe-area-inset-right, 0px));
}

/* Extra-narrow phones (~320-360px, e.g. iPhone SE): squeeze the HUD further so
   the DASH CORE panel still fits fully on-screen next to the WAVE panel. */
@media (max-width: 374px) {
    #hud .progress-container {
        width: calc(88px * var(--ui-scale));
    }

    .hud-build-mini {
        max-width: calc(96px * var(--ui-scale));
    }

    .hud-stat {
        font-size: 0.72rem;
    }

        .hud-stat span {
            font-size: 1.05rem;
        }

    body.touch-device #hud {
        padding-left: calc(calc(54px * var(--ui-scale)) + env(safe-area-inset-left, 0px));
    }
}

@keyframes flash {
    from {
        box-shadow: inset 10px 0 20px rgba(255,42,42,0.2);
    }

    to {
        box-shadow: inset 10px 0 20px rgba(255,42,42,0.6);
    }
}

.ascension-screen {
    background: radial-gradient(circle at 50% 32%, rgba(138,43,226,0.16), rgba(6,7,14,0.97) 65%);
    padding: calc(48px * var(--ui-scale)) calc(46px * var(--ui-scale));
    gap: calc(4px * var(--ui-scale));
}

.asc-void {
    position: relative;
    width: calc(168px * var(--ui-scale));
    height: calc(168px * var(--ui-scale));
    margin: 0 auto calc(14px * var(--ui-scale));
}

.asc-void-grid {
    position: absolute;
    inset: -40%;
    background-image: linear-gradient(rgba(138,43,226,0.10) 1px, transparent 1px), linear-gradient(90deg, rgba(138,43,226,0.10) 1px, transparent 1px);
    background-size: calc(18px * var(--ui-scale)) calc(18px * var(--ui-scale));
    -webkit-mask: radial-gradient(circle, transparent 38%, #000 72%);
    mask: radial-gradient(circle, transparent 38%, #000 72%);
    animation: ascGridDrift 14s linear infinite;
    opacity: 0.7;
}

@keyframes ascGridDrift {
    from {
        background-position: 0 0;
    }

    to {
        background-position: calc(18px * var(--ui-scale)) calc(18px * var(--ui-scale));
    }
}

.asc-hex-svg {
    position: relative;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 16px rgba(138,43,226,0.5));
}

.asc-hex {
    fill: none;
    stroke-width: 1.5;
    transform-origin: 120px 120px;
}

.asc-hex-3 {
    stroke: rgba(138,43,226,0.35);
    animation: ascRotate 22s linear infinite;
}

.asc-hex-2 {
    stroke: rgba(199,146,255,0.55);
    animation: ascRotateReverse 15s linear infinite;
}

.asc-hex-1 {
    stroke: #C792FF;
    stroke-width: 2;
    animation: ascRotate 9s linear infinite;
}

.asc-core {
    fill: #FFF;
    filter: drop-shadow(0 0 8px #FFF) drop-shadow(0 0 16px #8A2BE2);
    animation: ascCorePulse 1.6s ease-in-out infinite;
}

@keyframes ascRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes ascRotateReverse {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

@keyframes ascCorePulse {
    0%, 100% {
        r: 10;
        opacity: 0.8;
    }

    50% {
        r: 12;
        opacity: 1;
    }
}

.asc-kicker {
    color: #C792FF;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 4px;
    opacity: 0.85;
    margin-bottom: calc(6px * var(--ui-scale));
}

.asc-title {
    color: #FFFFFF;
    font-size: 3.1rem;
    letter-spacing: 3px;
    text-shadow: 0 0 22px #8A2BE2, 0 0 44px rgba(138,43,226,0.5);
    margin-bottom: calc(4px * var(--ui-scale));
}

.asc-subtitle {
    color: var(--text-muted);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 2px;
    margin-bottom: calc(20px * var(--ui-scale));
}

.asc-body {
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.55;
    margin-bottom: calc(12px * var(--ui-scale));
}

.asc-warn {
    color: var(--neon-yellow);
    font-size: 0.92rem;
    margin-bottom: calc(22px * var(--ui-scale));
}

.asc-bonus {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(138,43,226,0.4);
    padding: calc(16px * var(--ui-scale)) calc(20px * var(--ui-scale));
    margin-bottom: calc(24px * var(--ui-scale));
}

    .asc-bonus span {
        font-family: 'Orbitron', sans-serif;
        font-size: 0.8rem;
        letter-spacing: 2px;
        color: var(--text-muted);
    }

    .asc-bonus strong {
        font-family: 'Orbitron', sans-serif;
        font-size: 1.8rem;
        color: var(--neon-yellow);
        text-shadow: 0 0 14px rgba(255,241,0,0.6);
    }

.asc-btn {
    border-color: #8A2BE2;
    color: #C792FF;
}

    .asc-btn:hover {
        background: rgba(138,43,226,0.15);
        box-shadow: 0 0 20px rgba(138,43,226,0.4);
    }

.ascension-screen-t2 {
    background: radial-gradient(circle at 50% 32%, rgba(57,255,106,0.16), rgba(6,7,14,0.97) 65%);
}

.asc-void-grid-t2 {
    background-image: linear-gradient(rgba(57,255,106,0.10) 1px, transparent 1px), linear-gradient(90deg, rgba(57,255,106,0.10) 1px, transparent 1px);
}

.asc-saw-svg {
    position: relative;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 16px rgba(57,255,106,0.5));
}

.asc-saw-blade {
    fill: none;
    stroke-width: 2;
    transform-origin: 120px 120px;
}

.asc-saw-outer {
    stroke: #FFFFFF;
    stroke-width: 2.5;
    animation: ascSawRotate 7s linear infinite;
    filter: drop-shadow(0 0 10px #FFFFFF);
}

.asc-saw-inner {
    stroke: #39FF6A;
    stroke-width: 2;
    animation: ascSawRotateReverse 11s linear infinite;
    filter: drop-shadow(0 0 10px #39FF6A);
}

.asc-saw-core {
    fill: #39FF6A;
    filter: drop-shadow(0 0 8px #FFF) drop-shadow(0 0 16px #39FF6A);
    animation: ascCorePulse 1.6s ease-in-out infinite;
}

@keyframes ascSawRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes ascSawRotateReverse {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

.asc-subtitle-t2 {
    color: #7CFFB0;
}

.asc-bonus-t2 {
    border-color: rgba(57,255,106,0.4);
}

.asc-btn-t2 {
    border-color: #39FF6A;
    color: #9CFFB0;
}

    .asc-btn-t2:hover {
        background: rgba(57,255,106,0.15);
        box-shadow: 0 0 20px rgba(57,255,106,0.4);
    }

/* The "WAVE CLEARED: UPGRADE MODULE" draft screen. Base .screen is
   overflow:hidden with no height cap, so on a phone its cards used to spill off
   the bottom - behind the browser bars - with no way to reach them. Cap it to
   the visible viewport and let it scroll internally instead. dvh === vh on
   desktop and the content is far shorter than the screen there, so no scrollbar
   ever appears and desktop is visually unchanged. */
#screen-draft {
    max-height: calc(100vh - calc(30px * var(--ui-scale)));
    max-height: calc(100dvh - calc(30px * var(--ui-scale)));
    overflow-y: auto;
}

#draft-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(calc(180px * var(--ui-scale)), 1fr));
    gap: calc(15px * var(--ui-scale));
    margin-top: calc(20px * var(--ui-scale));
    text-align: left;
}

.card {
    background: rgba(10,10,20,0.8);
    border: 1px solid var(--text-muted);
    padding: calc(20px * var(--ui-scale));
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    gap: calc(8px * var(--ui-scale));
    position: relative;
    overflow: hidden;
}

    .card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 2px;
        height: 100%;
        background: var(--text-muted);
    }

    .card:hover {
        transform: translateY(-5px) scale(1.02);
        background: rgba(20,20,40,0.9);
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        z-index: 2;
    }

    .card.common:hover {
        border-color: var(--neon-cyan);
    }

        .card.common:hover::before {
            background: var(--neon-cyan);
            box-shadow: 0 0 15px var(--neon-cyan);
        }

    .card.rare:hover {
        border-color: var(--neon-magenta);
    }

        .card.rare:hover::before {
            background: var(--neon-magenta);
            box-shadow: 0 0 15px var(--neon-magenta);
        }

    .card.epic:hover {
        border-color: var(--neon-yellow);
    }

        .card.epic:hover::before {
            background: var(--neon-yellow);
            box-shadow: 0 0 15px var(--neon-yellow);
        }

    .card.legendary:hover {
        border-color: var(--neon-red);
    }

        .card.legendary:hover::before {
            background: var(--neon-red);
            box-shadow: 0 0 15px var(--neon-red);
        }

.skip-perk-btn {
    display: block;
    margin: calc(16px * var(--ui-scale)) auto 0;
    padding: calc(7px * var(--ui-scale)) calc(22px * var(--ui-scale));
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    border-radius: 100px;
    transition: all 0.15s ease;
}

    .skip-perk-btn:hover {
        color: var(--text-main);
        border-color: var(--text-main);
        box-shadow: 0 0 12px rgba(224,252,255,0.35);
    }

.card-type {
    font-family: 'Orbitron';
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 900;
}

.card-archetypes {
    display: flex;
    flex-wrap: wrap;
    gap: calc(5px * var(--ui-scale));
    margin: calc(2px * var(--ui-scale)) 0;
}

.arch-chip {
    display: inline-flex;
    align-items: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: calc(2px * var(--ui-scale)) calc(6px * var(--ui-scale));
    border-left: 3px solid var(--chip-color, var(--text-muted));
    background: rgba(0,0,0,0.35);
    color: var(--chip-color, var(--text-muted));
    text-transform: uppercase;
    white-space: nowrap;
}

.arch-chip-minor {
    opacity: 0.55;
    font-size: 0.56rem;
}

.card-synergy-tag {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.7px;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0,243,255,0.5);
    text-transform: uppercase;
    margin-top: calc(1px * var(--ui-scale));
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #FFF;
    line-height: 1.1;
}

.card-desc {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.4;
    flex-grow: 1;
}

#screen-upgrades {
    max-width: calc(1180px * var(--ui-scale));
    max-height: calc(100vh - calc(40px * var(--ui-scale)));
    max-height: calc(100dvh - calc(40px * var(--ui-scale)));
    gap: calc(14px * var(--ui-scale));
    padding: calc(28px * var(--ui-scale)) calc(34px * var(--ui-scale));
    overflow-y: auto;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    gap: calc(18px * var(--ui-scale));
    align-items: flex-start;
    text-align: left;
}

    .shop-header h2 {
        margin-bottom: calc(6px * var(--ui-scale));
    }

    .shop-header p {
        color: var(--text-muted);
        font-size: 1.1rem;
    }

.shard-bank {
    min-width: calc(150px * var(--ui-scale));
    padding: calc(12px * var(--ui-scale));
    background: linear-gradient(135deg, rgba(255,241,0,0.16), rgba(0,0,0,0.45));
    border: 1px solid rgba(255,241,0,0.55);
    text-align: center;
    box-shadow: inset 0 0 20px rgba(255,241,0,0.08), 0 0 18px rgba(255,241,0,0.12);
}

    .shard-bank span {
        display: block;
        font-family: 'Orbitron';
        font-size: 0.75rem;
        color: var(--text-muted);
        letter-spacing: 2px;
    }

    .shard-bank strong {
        display: block;
        font-family: 'Orbitron';
        font-size: 2.2rem;
        color: var(--neon-yellow);
        text-shadow: 0 0 15px rgba(255,241,0,0.7);
        line-height: 1;
        margin-top: calc(6px * var(--ui-scale));
    }

.upgrades-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: calc(12px * var(--ui-scale));
    margin-bottom: 0;
    max-height: none;
    padding-right: calc(4px * var(--ui-scale));
    text-align: left;
}

.arena2-upgrade-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: calc(16px * var(--ui-scale));
    padding: calc(12px * var(--ui-scale)) calc(16px * var(--ui-scale));
    text-align: left;
    border: 1px solid rgba(0,255,136,0.55);
    background: linear-gradient(90deg, rgba(0,255,136,0.13), rgba(138,43,226,0.14), rgba(0,0,0,0.34));
    box-shadow: inset 0 0 20px rgba(0,255,136,0.07), 0 0 22px rgba(0,255,136,0.12);
    position: relative;
    overflow: hidden;
}

    .arena2-upgrade-banner strong {
        display: block;
        font-family: 'Orbitron';
        color: var(--neon-green);
        letter-spacing: 2px;
        font-size: 0.95rem;
        text-shadow: 0 0 10px rgba(0,255,136,0.65);
    }

    .arena2-upgrade-banner span {
        color: var(--text-main);
        opacity: 0.8;
        font-size: 0.98rem;
    }

    .arena2-upgrade-banner b {
        font-family: 'Orbitron';
        color: var(--neon-yellow);
        white-space: nowrap;
        text-shadow: 0 0 12px rgba(255,241,0,0.7);
    }

.upgrades-list::-webkit-scrollbar {
    width: 6px;
}

.upgrades-list::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 3px;
}

.upgrade-row {
    background: linear-gradient(160deg, rgba(0,243,255,0.10), rgba(0,0,0,0.58) 45%, rgba(255,0,234,0.08));
    border: 1px solid var(--border);
    padding: calc(14px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    min-height: calc(172px * var(--ui-scale));
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 24px rgba(0,243,255,0.05);
}

    .upgrade-row::before {
        content: '';
        position: absolute;
        inset: 0 0 auto 0;
        height: 3px;
        background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-yellow));
        opacity: 0.7;
    }

    .upgrade-row .btn {
        width: 100%;
        padding: calc(10px * var(--ui-scale)) calc(12px * var(--ui-scale));
        font-size: 0.95rem;
        margin-top: calc(14px * var(--ui-scale));
    }

.upgrade-info h4 {
    font-family: 'Orbitron';
    font-size: 1.05rem;
    color: #FFF;
    margin-bottom: calc(8px * var(--ui-scale));
    line-height: 1.2;
}

.upgrade-info {
    display: grid;
    grid-template-rows: calc(44px * var(--ui-scale)) calc(44px * var(--ui-scale)) auto;
    align-items: start;
}

    .upgrade-info h4 span {
        color: var(--neon-magenta);
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .upgrade-info p {
        font-size: 0.95rem;
        color: var(--text-muted);
    }

.upgrade-meter {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    margin-top: calc(10px * var(--ui-scale));
}

    .upgrade-meter span {
        height: calc(7px * var(--ui-scale));
        background: rgba(255,255,255,0.12);
        border: 1px solid rgba(255,255,255,0.06);
    }

        .upgrade-meter span.filled {
            background: var(--neon-yellow);
            box-shadow: 0 0 8px rgba(255,241,0,0.75);
        }

.upgrade-row.upgrade-pulse {
    animation: upgradePulse 0.55s ease-out;
    transform-origin: center;
}

.upgrade-row i {
    position: absolute;
    left: 50%;
    top: 52%;
    width: 5px;
    height: 5px;
    background: var(--neon-yellow);
    box-shadow: 0 0 12px var(--neon-yellow);
    animation: shopSpark 0.55s ease-out var(--d) forwards;
}

@keyframes upgradePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255,241,0,0);
    }

    35% {
        transform: scale(1.08);
        box-shadow: 0 0 36px rgba(255,241,0,0.65), inset 0 0 30px rgba(255,241,0,0.18);
    }

    100% {
        transform: scale(1);
        box-shadow: inset 0 0 24px rgba(0,243,255,0.05);
    }
}

@keyframes shopSpark {
    from {
        transform: translate(0,0) scale(1);
        opacity: 1;
    }

    to {
        transform: translate(var(--x), var(--y)) scale(0);
        opacity: 0;
    }
}

.chassis-panel {
    text-align: left;
}

.shop-section-title {
    font-family: 'Orbitron';
    color: var(--neon-cyan);
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: calc(8px * var(--ui-scale));
}

.chassis-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: calc(10px * var(--ui-scale));
    margin-bottom: calc(6px * var(--ui-scale));
}

.chassis-card {
    text-align: left;
    cursor: pointer;
    border: 1px solid var(--border);
    color: var(--text-main);
    background: rgba(0,0,0,0.44);
    padding: calc(13px * var(--ui-scale));
    font-family: 'Rajdhani', sans-serif;
    display: flex;
    flex-direction: column;
    gap: calc(4px * var(--ui-scale));
    min-height: calc(110px * var(--ui-scale));
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

    .chassis-card:hover {
        transform: translateY(-3px);
        border-color: var(--neon-cyan);
        box-shadow: 0 0 20px rgba(0,243,255,0.18);
    }

    .chassis-card.active {
        border-color: var(--neon-green);
        box-shadow: 0 0 22px rgba(0,255,136,0.20), inset 0 0 18px rgba(0,255,136,0.08);
    }

    .chassis-card.locked {
        border-color: rgba(255,241,0,0.4);
    }

        .chassis-card.locked:hover {
            border-color: var(--neon-yellow);
            box-shadow: 0 0 20px rgba(255,241,0,0.18);
        }

.chassis-name {
    font-family: 'Orbitron';
    font-weight: 900;
    color: #FFF;
    font-size: 1rem;
}

.chassis-stat {
    color: var(--neon-yellow);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.chassis-desc {
    color: var(--text-muted);
    line-height: 1.25;
    font-size: 0.9rem;
}

.chassis-price {
    margin-top: auto;
    padding-top: calc(6px * var(--ui-scale));
    font-family: 'Orbitron';
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--neon-yellow);
    text-shadow: 0 0 8px rgba(255,241,0,0.5);
}

#mobile-controls {
    display: none;
    position: absolute;
    /* Keep clear of the home indicator / rounded corners / browser chrome on
       notched phones. env(safe-area-inset-*) is 0 on desktop, so no change
       there. */
    bottom: calc(30px * var(--ui-scale) + env(safe-area-inset-bottom, 0px));
    width: 100%;
    left: 0;
    padding: 0 calc(calc(40px * var(--ui-scale)) + env(safe-area-inset-right, 0px)) 0 calc(calc(40px * var(--ui-scale)) + env(safe-area-inset-left, 0px));
    /* Only the DASH button lives here now (the joystick floats independently),
       so keep it pinned to the right. */
    justify-content: flex-end;
    align-items: flex-end;
    pointer-events: none;
    z-index: 5;
}

/* Invisible left-side capture area for the dynamic joystick. A touch anywhere
   here spawns the joystick under the thumb (engine.js). Starts below the HUD/
   pause button so reaching for those never spawns a stray joystick. Touch-only:
   hidden unless we're both on a touch device and in a run. */
#joystick-zone {
    display: none;
    position: fixed;
    left: 0;
    top: calc(60px + env(safe-area-inset-top, 0px));
    width: 55%;
    bottom: 0;
    z-index: 4;
    pointer-events: auto;
    touch-action: none;
}

.joystick-base {
    width: calc(130px * var(--ui-scale));
    height: calc(130px * var(--ui-scale));
    border-radius: 50%;
    background: rgba(0, 243, 255, 0.05);
    border: 2px dashed rgba(0, 243, 255, 0.4);
    /* Floating joystick. Rests at this home position (same spot as the old fixed
       control) as a hint, but engine.js repositions it under the thumb via inline
       left/top on touch, then clears them on release to snap back here. */
    display: none;
    position: fixed;
    left: calc(calc(40px * var(--ui-scale)) + env(safe-area-inset-left, 0px));
    bottom: calc(calc(30px * var(--ui-scale)) + env(safe-area-inset-bottom, 0px));
    z-index: 6;
    opacity: 0.45;
    transition: opacity 0.12s ease;
    pointer-events: auto;
    touch-action: none;
}

    .joystick-base.active {
        opacity: 1;
    }

.joystick-stick {
    width: calc(50px * var(--ui-scale));
    height: calc(50px * var(--ui-scale));
    border-radius: 50%;
    background: rgba(0, 243, 255, 0.8);
    box-shadow: 0 0 20px var(--neon-cyan);
    position: absolute;
    top: calc(38px * var(--ui-scale));
    left: calc(38px * var(--ui-scale));
}

/* Promote the stick to its own compositor layer only while it is actually
   being dragged. A permanent will-change makes the browser hold a GPU layer
   for the whole session - pointless on desktop, where the joystick never
   appears, and wasteful on mobile between runs. */
.joystick-base.active .joystick-stick {
    will-change: transform;
}

.rev-btn {
    width: calc(100px * var(--ui-scale));
    height: calc(100px * var(--ui-scale));
    border-radius: 50%;
    background: rgba(255, 0, 234, 0.1);
    border: 3px solid var(--neon-magenta);
    color: #FFF;
    font-family: 'Orbitron';
    font-size: 1.2rem;
    font-weight: 900;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    box-shadow: inset 0 0 20px rgba(255, 0, 234, 0.4), 0 0 20px rgba(255, 0, 234, 0.2);
    text-shadow: 0 0 10px var(--neon-magenta);
}

    .rev-btn:active {
        background: rgba(255, 0, 234, 0.4);
        transform: scale(0.9);
        box-shadow: 0 0 40px var(--neon-magenta);
    }

#onboard-hint {
    position: absolute;
    top: 56%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 6;
    display: none;
    flex-direction: column;
    gap: calc(14px * var(--ui-scale));
    align-items: center;
}

    #onboard-hint.visible {
        display: flex;
        opacity: 1;
    }

    #onboard-hint.fading {
        display: flex;
        animation: hintFadeOut 0.7s ease forwards;
    }

.onboard-goal {
    font-family: 'Orbitron', sans-serif;
    font-size: calc(1.15rem * var(--ui-scale));
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
    color: var(--neon-yellow);
    text-shadow: 0 0 12px rgba(255,241,0,0.55), 0 0 4px rgba(255,241,0,0.9);
    margin-bottom: calc(6px * var(--ui-scale));
    padding: 0 12px;
}

.onboard-row {
    display: flex;
    align-items: center;
    gap: calc(14px * var(--ui-scale));
}

.key-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(4px * var(--ui-scale));
}

.key-line {
    display: flex;
    gap: calc(4px * var(--ui-scale));
}

.key {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: calc(36px * var(--ui-scale));
    height: calc(36px * var(--ui-scale));
    padding: 0 calc(8px * var(--ui-scale));
    background: rgba(0,0,0,0.6);
    border: 2px solid var(--neon-cyan);
    color: #FFF;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 0 12px rgba(0,243,255,0.4);
    border-radius: 3px;
}

.key-wide {
    min-width: calc(90px * var(--ui-scale));
    border-color: var(--neon-magenta);
    box-shadow: 0 0 12px rgba(255,0,234,0.4);
}

.key-mouse {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0,243,255,0.4);
}

.hint-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-shadow: 0 0 8px rgba(0,243,255,0.3);
}

@keyframes hintFadeOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

#toast-container {
    position: absolute;
    bottom: calc(150px * var(--ui-scale));
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: calc(10px * var(--ui-scale));
    align-items: center;
}

.toast {
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--neon-yellow);
    color: var(--neon-yellow);
    padding: calc(8px * var(--ui-scale)) calc(20px * var(--ui-scale));
    font-family: 'Orbitron';
    font-weight: 900;
    font-size: 1.2rem;
    text-shadow: 0 0 10px var(--neon-yellow);
    box-shadow: 0 0 20px rgba(255,241,0,0.3);
    animation: fadeOut 1s forwards;
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}

    .toast.toast-danger {
        border-color: var(--neon-red);
        color: var(--neon-red);
        text-shadow: 0 0 10px var(--neon-red);
        box-shadow: 0 0 20px rgba(255,42,42,0.35);
    }

    .toast.toast-celebration {
        border-color: var(--neon-green);
        color: var(--neon-yellow);
        text-shadow: 0 0 10px var(--neon-yellow), 0 0 18px rgba(0,255,136,0.55);
        box-shadow: 0 0 24px rgba(0,255,136,0.3), inset 0 0 16px rgba(255,241,0,0.08);
        background: linear-gradient(90deg, rgba(0,0,0,0.86), rgba(0,255,136,0.12), rgba(0,0,0,0.86));
    }

.ui-spark {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 7px;
    height: 7px;
    background: var(--c);
    box-shadow: 0 0 12px var(--c), 0 0 2px #fff;
    pointer-events: none;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.3);
    animation: uiSpark 0.9s cubic-bezier(.16, 1, .3, 1) var(--d) forwards;
}

@keyframes uiSpark {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(45deg) scale(0.2);
    }

    16% {
        opacity: 1;
        transform: translate(-50%, -50%) rotate(45deg) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(135deg) scale(0.35);
    }
}

@keyframes shardCountPunch {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.22);
    }

    100% {
        transform: scale(1);
    }
}

.shard-counting {
    display: inline-block;
    animation: shardCountPunch 0.5s cubic-bezier(.34, 1.56, .64, 1);
}


/* ==========================================================================
   GAME OVER & TELEMETRY STAMP (Original Size + Ballistic Glass + Grids)
   ========================================================================== */

#screen-gameover {
    max-width: calc(450px * var(--ui-scale)) !important;
    border-color: var(--neon-red);
    /* Inherits standard generous 40px screen padding */
}

    #screen-gameover h1 {
        font-size: 3.2rem;
        color: var(--neon-red);
        text-shadow: 0 0 15px var(--neon-red), 0 0 30px var(--neon-red);
        margin-bottom: 0.1rem;
    }

    #screen-gameover h2 {
        font-size: 2rem;
        color: #FFFFFF;
        margin-bottom: calc(24px * var(--ui-scale));
        text-shadow: none;
    }

/* ── SHATTERED (game over) - touch/mobile compaction ─────────────────────────
   The game-over screen packs a lot in (title, wave, optional NEW RECORD card,
   harvest grid, a rewarded-ad panel, RETRY + REBOOT). At its full desktop sizing
   that content is ~730px tall, which on a phone (especially landscape, or short
   portraits like the iPhone SE) overflowed the visible viewport and pushed RETRY/
   REBOOT off-screen with no obvious way to continue. These rules shrink the
   headers, cards and gaps on touch devices only so it fits an ordinary phone
   portrait fully, and still scrolls smoothly on very short/landscape screens.
   Scoped to body.touch-device, so desktop keeps its original look exactly. */
body.touch-device #screen-gameover {
    padding-top: calc(16px * var(--ui-scale));
    padding-bottom: calc(16px * var(--ui-scale));
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
}

    body.touch-device #screen-gameover h1 {
        font-size: 2.2rem;
        margin-bottom: 0.05rem;
    }

    body.touch-device #screen-gameover h2 {
        font-size: 1.3rem;
        margin-bottom: calc(12px * var(--ui-scale));
    }

    body.touch-device #screen-gameover .top-score-callout {
        margin-bottom: calc(12px * var(--ui-scale));
    }

    body.touch-device #screen-gameover .top-score-grid {
        padding: calc(9px * var(--ui-scale)) calc(14px * var(--ui-scale)) calc(3px * var(--ui-scale));
    }

    body.touch-device #screen-gameover .top-score-grid strong {
        font-size: 1.4rem;
    }

    body.touch-device #screen-gameover .go-quip {
        margin-top: calc(2px * var(--ui-scale));
        margin-bottom: calc(10px * var(--ui-scale));
        padding-top: calc(6px * var(--ui-scale));
        font-size: 0.78rem;
        line-height: 1.3;
    }

    body.touch-device #screen-gameover .harvest-grid-card {
        margin-bottom: calc(10px * var(--ui-scale));
    }

    body.touch-device #screen-gameover .go-meta-row {
        margin-bottom: calc(12px * var(--ui-scale));
    }

    body.touch-device #screen-gameover .harvest-col {
        padding: calc(11px * var(--ui-scale)) calc(12px * var(--ui-scale));
    }

    body.touch-device #screen-gameover .h-val {
        font-size: 1.9rem;
    }

    body.touch-device #screen-gameover .harvest-col.total .h-val {
        font-size: 1.25rem;
    }

    body.touch-device #screen-gameover .ad-bonus-panel {
        margin-top: calc(6px * var(--ui-scale));
    }

    body.touch-device #screen-gameover .btn-retry {
        margin-bottom: calc(8px * var(--ui-scale));
    }

/* ── Touch/mobile menu compaction ────────────────────────────────────────────
   Cut the scrolling on the busiest menus on real phones. Scoped to
   body.touch-device AND a phone-width viewport, so desktop keeps its full layout
   and wide tablets (which have room for the 4-up grid) are untouched too. Same
   philosophy as the game-over compaction above. */
@media (max-width: 768px) {
    /* Upgrades: a 2-up card grid instead of one tall single column - roughly
       halves the scroll length of the 8-upgrade list, the worst offender. */
    body.touch-device #screen-upgrades .upgrades-list {
        grid-template-columns: 1fr 1fr;
        gap: calc(8px * var(--ui-scale));
    }

    body.touch-device #screen-upgrades .chassis-options {
        grid-template-columns: 1fr 1fr;
    }

    /* The card's fixed 44px title/desc rows are tuned for wide desktop cards; in
       the narrower phone column let them size to their wrapped content so nothing
       clips. */
    body.touch-device #screen-upgrades .upgrade-info {
        grid-template-rows: auto auto auto;
        gap: calc(2px * var(--ui-scale));
    }

    body.touch-device #screen-upgrades .upgrade-row {
        padding: calc(10px * var(--ui-scale));
        gap: calc(6px * var(--ui-scale));
    }

    body.touch-device #screen-upgrades .upgrade-info h4 {
        font-size: 0.9rem;
        margin-bottom: calc(3px * var(--ui-scale));
    }

    body.touch-device #screen-upgrades .upgrade-info h4 span {
        font-size: 0.68rem;
    }

    body.touch-device #screen-upgrades .upgrade-info p {
        font-size: 0.8rem;
    }

    body.touch-device #screen-upgrades .upgrade-row .btn {
        font-size: 0.8rem;
        padding: calc(8px * var(--ui-scale));
        margin-top: calc(8px * var(--ui-scale));
    }

    /* Header + shard bank: trim scale so the list starts higher up the screen. */
    body.touch-device #screen-upgrades .shop-header h2 {
        font-size: 1.5rem;
    }

    body.touch-device #screen-upgrades .shop-header p {
        font-size: 0.82rem;
    }

    body.touch-device #screen-upgrades .shard-bank {
        padding: calc(8px * var(--ui-scale));
    }

    body.touch-device #screen-upgrades .shard-bank strong {
        font-size: 1.6rem;
    }

    body.touch-device #screen-upgrades .chassis-card {
        min-height: auto;
        padding: calc(10px * var(--ui-scale));
    }

    /* Momentum scrolling for any menu that can still scroll on a phone. */
    body.touch-device #screen-upgrades,
    body.touch-device #screen-draft,
    body.touch-device #screen-settings,
    body.touch-device #screen-pause,
    body.touch-device #screen-revive,
    body.touch-device .daily-screen {
        -webkit-overflow-scrolling: touch;
    }
}

/* Smoky Ballistic Glass Override Card */
.top-score-callout {
    display: none;
    position: relative;
    background: rgba(8, 8, 16, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid var(--neon-yellow);
    box-shadow: 0 0 30px rgba(255, 241, 0, 0.15);
    margin-bottom: calc(20px * var(--ui-scale));
    text-align: left;
}

    .top-score-callout.show {
        display: block;
        animation: stampLock 0.18s cubic-bezier(0, 0, 0.2, 1) forwards;
        transform-origin: top center;
    }

@keyframes stampLock {
    0% {
        opacity: 0;
        transform: scaleY(0.1);
    }

    100% {
        opacity: 1;
        transform: scaleY(1);
    }
}

.top-score-banner {
    background: var(--neon-yellow);
    color: #000;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 0.72rem;
    letter-spacing: 2.5px;
    padding: calc(6px * var(--ui-scale)) calc(14px * var(--ui-scale));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .top-score-banner span:last-child {
        font-size: 0.62rem;
        opacity: 0.75;
        letter-spacing: 1px;
    }

/* Internal baseline grid for the record */
.top-score-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    padding: calc(14px * var(--ui-scale)) calc(18px * var(--ui-scale)) calc(4px * var(--ui-scale));
}

    .top-score-grid strong {
        font-family: 'Orbitron', sans-serif;
        color: #FFFFFF;
        font-size: 1.8rem;
        font-weight: 900;
        letter-spacing: 2px;
    }

.top-score-reward {
    color: var(--neon-yellow);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.go-quip {
    margin: calc(4px * var(--ui-scale)) calc(18px * var(--ui-scale)) calc(14px * var(--ui-scale));
    padding-top: calc(8px * var(--ui-scale));
    border-top: 1px dashed rgba(255, 241, 0, 0.25);
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--text-main);
    opacity: 0.85;
}

.top-score-callout.celebrating::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #FFFFFF;
    animation: hardFlash 0.35s ease-out forwards;
    pointer-events: none;
}

@keyframes hardFlash {
    0% {
        opacity: 0.9;
    }

    100% {
        opacity: 0;
    }
}

/* 2-Column Data Grid for Harvested Shards (Restored large font scales) */
.harvest-grid-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(6, 6, 15, 0.55);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 42, 42, 0.5);
    margin-bottom: calc(12px * var(--ui-scale)); /* was 28px; the UPGRADES / DAILY DROP row now follows */
}

/* UPGRADES + DAILY DROP tiles under the harvest grid (game over). Same visual
   language as the main menu's daily corner badge: muted cyan at rest, yellow
   and breathing only while there is something to buy or claim right now. */
.go-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(10px * var(--ui-scale));
    margin-bottom: calc(18px * var(--ui-scale));
}

.go-meta-tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: calc(10px * var(--ui-scale));
    min-width: 0;
    padding: calc(9px * var(--ui-scale)) calc(16px * var(--ui-scale));
    background: rgba(6, 6, 15, 0.55);
    border: 1px solid rgba(0, 243, 255, 0.35);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.12);
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    color: var(--neon-cyan);
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

    .go-meta-tile:hover {
        transform: scale(1.03);
        background: rgba(0, 243, 255, 0.1);
        box-shadow: 0 0 16px rgba(0, 243, 255, 0.22);
    }

    .go-meta-tile.ready {
        color: var(--neon-yellow);
        border-color: rgba(255, 241, 0, 0.6);
        animation: dailyCornerBreath 2.4s infinite alternate;
    }

        .go-meta-tile.ready:hover {
            background: rgba(255, 241, 0, 0.14);
        }

    .go-meta-tile .daily-corner-ping {
        top: calc(6px * var(--ui-scale));
        right: calc(14px * var(--ui-scale));
    }

.go-meta-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    text-shadow: 0 0 10px currentColor;
}

.go-meta-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.go-meta-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.go-meta-sub {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.go-meta-tile.ready .go-meta-sub {
    color: var(--text-main);
}

.harvest-col {
    padding: calc(18px * var(--ui-scale)) calc(14px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    gap: calc(4px * var(--ui-scale));
    text-align: left;
}

    .harvest-col:first-child {
        border-right: 1px solid rgba(255, 42, 42, 0.25);
    }

.h-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    font-weight: 700;
}

.h-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem; /* Restored massive original punch */
    font-weight: 900;
    color: var(--neon-yellow);
    line-height: 1;
    text-shadow: 0 0 15px rgba(255, 241, 0, 0.5);
}

.harvest-col.total .h-val {
    font-size: 1.5rem; /* Restored original secondary size */
    color: var(--text-main);
    text-shadow: none;
    margin-top: auto;
}

/* RETRY — primary action on the SHATTERED screen, sits above REBOOT SYSTEM.
   Green/cyan "go again" energy, distinct from the red SHATTERED framing and
   from the neutral REBOOT (main menu) button below it. */
.btn-retry {
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: inset 0 0 10px rgba(0, 255, 136, 0.2), 0 0 16px rgba(0, 255, 136, 0.15);
    margin-bottom: calc(12px * var(--ui-scale));
    gap: calc(10px * var(--ui-scale));
    animation: btnBreath 2s infinite alternate;
}

    .btn-retry:hover {
        background: var(--neon-green);
        color: #000;
        box-shadow: 0 0 22px var(--neon-green), inset 0 0 15px #FFF;
    }

        .btn-retry:hover .btn-key-hint {
            border-color: #000;
            color: #000;
            box-shadow: none;
        }

.btn-key-hint {
    display: inline-flex;
    align-items: center;
    font-size: 0.62rem;
    letter-spacing: 1px;
    padding: calc(3px * var(--ui-scale)) calc(7px * var(--ui-scale));
    border: 1px solid currentColor;
    border-radius: 3px;
    opacity: 0.85;
}


/* ==========================================================================
   PAUSE, DRAFT & MEDIA QUERIES
   ========================================================================== */

.pause-screen {
    border-color: rgba(0, 243, 255, 0.55);
    background: radial-gradient(circle at 50% 20%, rgba(0,243,255,0.12), rgba(6,7,14,0.95) 62%);
    gap: calc(12px * var(--ui-scale));
}

.pause-mark {
    align-self: center;
    width: calc(58px * var(--ui-scale));
    height: calc(58px * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(8px * var(--ui-scale));
    border: 1px solid rgba(0,243,255,0.5);
    box-shadow: 0 0 24px rgba(0,243,255,0.24), inset 0 0 20px rgba(0,243,255,0.08);
    clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}

    .pause-mark span {
        width: calc(7px * var(--ui-scale));
        height: calc(28px * var(--ui-scale));
        background: var(--neon-cyan);
        box-shadow: 0 0 14px var(--neon-cyan);
    }

.pause-kicker {
    font-family: 'Orbitron';
    color: var(--text-muted);
    letter-spacing: 4px;
    font-size: 0.76rem;
}

.pause-screen h2 {
    margin-bottom: calc(8px * var(--ui-scale));
}

.pause-actions {
    display: flex;
    flex-direction: column;
    gap: calc(12px * var(--ui-scale));
}

    .pause-actions .btn {
        font-size: 1rem;
    }

    /* RESTART RUN — magenta */
    .pause-actions .btn-restart {
        background: transparent;
        border-color: var(--neon-magenta);
        color: var(--neon-magenta);
        box-shadow: inset 0 0 10px rgba(255, 0, 234, 0.2);
    }

        .pause-actions .btn-restart:hover {
            background: var(--neon-magenta);
            color: #000;
            box-shadow: 0 0 20px var(--neon-magenta), inset 0 0 15px #FFF;
        }

/* SETTINGS — same outline treatment as other secondary menu buttons, in neon yellow */
.btn-settings-yellow {
    border-color: var(--neon-yellow) !important;
    color: var(--neon-yellow) !important;
    box-shadow: inset 0 0 10px rgba(255, 241, 0, 0.2) !important;
}

    .btn-settings-yellow:hover {
        background: var(--neon-yellow) !important;
        color: #000 !important;
        box-shadow: 0 0 20px var(--neon-yellow), inset 0 0 15px #FFF !important;
        text-shadow: none !important;
    }

/* On the main menu, secondary buttons (SYSTEM UPGRADES) stay muted until hovered.
   SETTINGS follows that same rest/hover pattern there, just turning yellow instead of magenta. */
.menu-actions .btn-settings-yellow {
    border-color: transparent !important;
    color: var(--text-muted) !important;
    box-shadow: none !important;
}

    .menu-actions .btn-settings-yellow:hover {
        background: transparent !important;
        color: var(--neon-yellow) !important;
        box-shadow: none !important;
        text-shadow: 0 0 10px rgba(255, 241, 0, 0.5) !important;
        transform: scale(1.02);
    }

.pause-actions .pause-quit {
    border-color: var(--neon-red);
    color: var(--neon-red);
    box-shadow: inset 0 0 10px rgba(255, 42, 42, 0.12);
}

    .pause-actions .pause-quit:hover {
        background: var(--neon-red);
        color: #000;
        box-shadow: 0 0 20px var(--neon-red), inset 0 0 15px #FFF;
    }

/* REBOOT SYSTEM (gameover screen) — restores the original neon-cyan outline
   treatment instead of the default pink .btn.outline. */
.btn-cyan {
    border-color: var(--neon-cyan) !important;
    color: var(--neon-cyan) !important;
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.2) !important;
}

    .btn-cyan:hover {
        background: var(--neon-cyan) !important;
        color: #000 !important;
        box-shadow: 0 0 20px var(--neon-cyan), inset 0 0 15px #FFF !important;
        text-shadow: none !important;
    }

#screen-draft {
    max-width: calc(800px * var(--ui-scale)) !important;
}

@keyframes fadeOut {
    0% {
        opacity: 0;
        transform: scale(1.5);
    }

    15% {
        opacity: 1;
        transform: scale(1);
    }

    80% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

@media (max-width: 768px) {
    .screen {
        padding: calc(20px * var(--ui-scale));
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .main-brand h1 {
        font-size: 2.8rem;
    }

    .menu-stats {
        grid-template-columns: 1fr;
    }

    .menu-stat-card {
        min-height: calc(92px * var(--ui-scale));
    }

    .shop-header, .upgrades-list, .chassis-options {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .upgrade-row {
        align-items: stretch;
        gap: calc(10px * var(--ui-scale));
        min-height: auto;
    }

        .upgrade-row .btn {
            width: 100%;
        }

    /* Safely stack the harvest grid on narrow phone screens */
    .harvest-grid-card {
        grid-template-columns: 1fr;
    }

    .harvest-col:first-child {
        border-right: none;
        border-bottom: 1px solid rgba(255,42,42,0.25);
    }

    /* These screens have no phantom-scrollbar JS of their own; on a short phone
       viewport their content can exceed the visible area (browser bars), so let
       them scroll instead of clipping content behind the chrome. The screens
       that DO manage their own overflow (main / upgrades / daily) are handled
       above and deliberately left out here. */
    #screen-gameover,
    #screen-settings,
    #screen-pause,
    #screen-revive {
        max-height: calc(100vh - calc(20px * var(--ui-scale)));
        max-height: calc(100dvh - calc(20px * var(--ui-scale)));
        overflow-y: auto;
    }
}

/* Show the on-screen controls whenever we're on a touch device AND actually in
   a run (hud-visible). Driven by the persistent `touch-device` class set once
   in engine.js - NOT the transient last-input mode - so a synthetic mouse event
   from a tap can never hide the joystick/dash mid-game. Desktop never gets the
   `touch-device` class, so its behaviour is unchanged. */
body.touch-device.hud-visible #mobile-controls {
    display: flex;
}

body.touch-device.hud-visible #joystick,
body.touch-device.hud-visible #joystick-zone {
    display: block;
}
/* ── Settings Screen ─────────────────────────────────────────────────────── */

.settings-screen {
    gap: calc(20px * var(--ui-scale));
}

    .settings-screen h2 {
        margin-bottom: calc(4px * var(--ui-scale));
        color: var(--neon-cyan);
        text-shadow: 0 0 10px var(--neon-cyan);
    }

.settings-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: calc(10px * var(--ui-scale));
}

.settings-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.settings-val {
    font-size: 1.1rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px var(--neon-cyan);
    min-width: 2.2ch;
    text-align: right;
}

.settings-slider-row {
    position: relative;
    width: 100%;
}

/* The option exists in the static settings markup so it is immediately ready
   when a real touch first identifies a mobile device, but it remains completely
   absent from desktop layout and accessibility flow. */
.mobile-only-setting {
    display: none;
}

body.touch-device .mobile-only-setting {
    display: flex;
}

.settings-toggle {
    width: 100%;
    min-height: calc(54px * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(18px * var(--ui-scale));
    cursor: pointer;
}

.settings-toggle-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: calc(4px * var(--ui-scale));
    text-align: left;
}

.settings-toggle-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.settings-toggle-desc {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(75, 120, 130, 0.78);
}

.settings-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.settings-switch {
    width: calc(56px * var(--ui-scale));
    height: calc(30px * var(--ui-scale));
    flex: 0 0 auto;
    position: relative;
    border: 1px solid rgba(0, 243, 255, 0.35);
    border-radius: calc(15px * var(--ui-scale));
    background: rgba(0, 243, 255, 0.08);
    transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.settings-switch span {
    position: absolute;
    width: calc(22px * var(--ui-scale));
    height: calc(22px * var(--ui-scale));
    left: calc(3px * var(--ui-scale));
    top: calc(3px * var(--ui-scale));
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.settings-toggle input:checked + .settings-switch {
    background: rgba(0, 243, 255, 0.2);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.25);
}

.settings-toggle input:checked + .settings-switch span {
    transform: translateX(calc(26px * var(--ui-scale)));
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}

.settings-toggle input:focus-visible + .settings-switch {
    outline: 2px solid #FFF;
    outline-offset: 3px;
}

.settings-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: calc(6px * var(--ui-scale));
    border-radius: 3px;
    background: rgba(0, 243, 255, 0.12);
    border: 1px solid rgba(0, 243, 255, 0.25);
    outline: none;
    cursor: pointer;
    clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}

    .settings-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: calc(18px * var(--ui-scale));
        height: calc(18px * var(--ui-scale));
        background: var(--neon-cyan);
        box-shadow: 0 0 10px var(--neon-cyan), 0 0 20px rgba(0, 243, 255, 0.4);
        clip-path: polygon(50% 0%, 100% 30%, 100% 70%, 50% 100%, 0% 70%, 0% 30%);
        cursor: pointer;
        transition: box-shadow 0.15s ease;
    }

    .settings-slider::-moz-range-thumb {
        width: calc(18px * var(--ui-scale));
        height: calc(18px * var(--ui-scale));
        background: var(--neon-cyan);
        border: none;
        box-shadow: 0 0 10px var(--neon-cyan), 0 0 20px rgba(0, 243, 255, 0.4);
        cursor: pointer;
    }

    .settings-slider:hover::-webkit-slider-thumb {
        box-shadow: 0 0 16px var(--neon-cyan), 0 0 32px rgba(0, 243, 255, 0.6);
    }

    .settings-slider::-webkit-slider-runnable-track {
        height: calc(6px * var(--ui-scale));
        border-radius: 3px;
    }

    .settings-slider::-moz-range-track {
        height: calc(6px * var(--ui-scale));
        background: rgba(0, 243, 255, 0.12);
        border: 1px solid rgba(0, 243, 255, 0.25);
        border-radius: 3px;
    }

/* ==========================================================================
   DAILY REWARDS MODAL (spinner wheel)
   ========================================================================== */

.daily-screen {
    border-color: var(--neon-yellow);
    background: radial-gradient(circle at 50% 18%, rgba(255, 241, 0, 0.10), rgba(6, 7, 14, 0.97) 64%);
    gap: calc(8px * var(--ui-scale));
    padding-top: calc(18px * var(--ui-scale));
    padding-bottom: calc(20px * var(--ui-scale));
    padding-left: calc(32px * var(--ui-scale));
    padding-right: calc(32px * var(--ui-scale));
    max-height: calc(100vh - calc(40px * var(--ui-scale)));
    max-height: calc(100dvh - calc(40px * var(--ui-scale)));
    max-width: calc(540px * var(--ui-scale));
    /* Phantom-scrollbar fix: stay clipped (no track, no thumb) by default.
       daily.js measures real overflow each time content can change size and
       only flips on `.has-overflow` once it clears OVERFLOW_THRESHOLD_PX,
       so a 1px rounding error never paints a scrollbar. */
    overflow-y: hidden;
}

    .daily-screen.has-overflow {
        overflow-y: auto;
    }

    .daily-screen > * {
        flex-shrink: 0;
    }

.daily-kicker {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: calc(4px * var(--ui-scale));
}

    .daily-kicker span {
        color: var(--neon-yellow);
        text-shadow: 0 0 8px var(--neon-yellow);
        font-weight: 700;
    }

.daily-title {
    color: var(--neon-yellow);
    text-shadow: 0 0 12px var(--neon-yellow), 0 0 24px rgba(255, 241, 0, 0.4);
    margin-bottom: calc(10px * var(--ui-scale));
}

/* Bonus-target callout: tells the player which wave to beat for a 2nd spin.
   Three states - locked (still chasing it), ready (earned, not yet spun),
   used (already claimed today's bonus). */
.daily-bonus-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(8px * var(--ui-scale));
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    padding: calc(6px * var(--ui-scale)) calc(14px * var(--ui-scale));
    border-radius: 3px;
    margin-bottom: calc(6px * var(--ui-scale));
    border: 1px solid;
    line-height: 1.3;
}

    .daily-bonus-panel.locked {
        border-color: rgba(0, 243, 255, 0.35);
        background: rgba(0, 243, 255, 0.06);
        color: var(--text-muted);
    }

        .daily-bonus-panel.locked strong {
            color: var(--neon-cyan);
            text-shadow: 0 0 6px var(--neon-cyan);
        }

    .daily-bonus-panel.ready {
        border-color: var(--neon-green);
        background: rgba(0, 255, 136, 0.1);
        color: var(--neon-green);
        text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
        animation: dailyCornerBreath 1.6s infinite alternate;
    }

    .daily-bonus-panel.used {
        border-color: rgba(0, 243, 255, 0.2);
        background: transparent;
        color: var(--text-muted);
        opacity: 0.7;
    }

.daily-bonus-icon {
    font-size: 1rem;
}

.daily-wheel-wrap {
    position: relative;
    width: calc(250px * var(--ui-scale));
    height: calc(250px * var(--ui-scale));
    margin: 0 auto calc(12px * var(--ui-scale));
}

.daily-wheel-ring {
    position: absolute;
    inset: calc(-10px * var(--ui-scale));
    border-radius: 50%;
    border: 2px solid rgba(255, 241, 0, 0.35);
    box-shadow: 0 0 30px rgba(255, 241, 0, 0.18), inset 0 0 24px rgba(255, 241, 0, 0.08);
}

.daily-wheel-svg {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    filter: drop-shadow(0 0 14px rgba(0, 0, 0, 0.6));
    box-shadow: 0 0 0 calc(4px * var(--ui-scale)) rgba(0, 0, 0, 0.5), 0 0 24px rgba(255, 241, 0, 0.15);
}

.daily-wedge {
    stroke: rgba(0, 0, 0, 0.55);
    stroke-width: 1.5;
}

.daily-wedge-jackpot {
    filter: drop-shadow(0 0 6px rgba(255, 241, 0, 0.8));
}

.daily-wedge-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 900;
    fill: #04101A;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.35);
    stroke-width: 0.5px;
}

    .daily-wedge-label.jackpot {
        fill: #1a1300;
        font-size: 19px;
    }

.daily-wheel-pointer {
    position: absolute;
    top: calc(-6px * var(--ui-scale));
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: calc(13px * var(--ui-scale)) solid transparent;
    border-right: calc(13px * var(--ui-scale)) solid transparent;
    border-top: calc(23px * var(--ui-scale)) solid var(--neon-red);
    filter: drop-shadow(0 0 8px var(--neon-red));
    z-index: 3;
}

.daily-wheel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(52px * var(--ui-scale));
    height: calc(52px * var(--ui-scale));
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, #1a1300 0%, #050300 75%);
    border: 2px solid var(--neon-yellow);
    box-shadow: 0 0 18px rgba(255, 241, 0, 0.5), inset 0 0 10px rgba(255, 241, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
    z-index: 2;
}

.daily-result {
    min-height: calc(46px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(2px * var(--ui-scale));
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    margin-bottom: calc(4px * var(--ui-scale));
}

    .daily-result.show {
        opacity: 1;
        transform: translateY(0);
    }

.daily-result-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--text-muted);
}

.daily-result-amount {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--neon-yellow);
    text-shadow: 0 0 14px rgba(255, 241, 0, 0.55);
}

.daily-result.jackpot .daily-result-amount {
    color: #FFFFFF;
    text-shadow: 0 0 10px #FFF, 0 0 22px var(--neon-yellow), 0 0 40px var(--neon-yellow);
    animation: neonPulse 1s infinite alternate;
}

.daily-result.punch {
    animation: shardCountPunch 0.5s cubic-bezier(.34, 1.56, .64, 1);
}

.daily-spin-btn {
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
    box-shadow: inset 0 0 10px rgba(255, 241, 0, 0.2), 0 0 16px rgba(255, 241, 0, 0.15);
    margin-bottom: calc(10px * var(--ui-scale));
    animation: btnBreath 2s infinite alternate;
}

    .daily-spin-btn:hover {
        background: var(--neon-yellow);
        color: #000;
        box-shadow: 0 0 22px var(--neon-yellow), inset 0 0 15px #FFF;
    }

    .daily-spin-btn:disabled {
        animation: none;
    }

.daily-tease {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: calc(2px * var(--ui-scale));
    margin-bottom: calc(4px * var(--ui-scale));
    min-height: calc(34px * var(--ui-scale));
    visibility: hidden;
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.3s ease;
}

    .daily-tease.show {
        visibility: visible;
        opacity: 1;
    }

    .daily-tease strong {
        color: var(--neon-green);
        text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
        font-family: 'Orbitron', sans-serif;
    }

/* ---------------------------------------------------------------------
   Wide layout: wheel sits in a left column, copy/button/tease sit in a
   right column instead of stacking full-width under the wheel. Kicker
   and title stay centered above both. Only kicks in above 768px (the
   same breakpoint the mobile overrides below use).

   The modal itself widens to 700px here (vs. 540px on mobile) - the
   right column needs a real minimum (~300px) for lines like "CLAIMED:
   SEE YOU TOMORROW" to sit on one row instead of wrapping three deep.
--------------------------------------------------------------------- */
@media (min-width: 769px) {
    .daily-screen {
        max-width: calc(700px * var(--ui-scale));
        padding-top: calc(26px * var(--ui-scale));
        padding-bottom: calc(28px * var(--ui-scale));
    }

        .daily-screen.active {
            display: grid;
            grid-template-columns: calc(240px * var(--ui-scale)) minmax(calc(300px * var(--ui-scale)), 1fr);
            grid-template-areas:
                "kicker kicker"
                "title  title"
                "wheel  bonus"
                "wheel  result"
                "wheel  tease"
                "wheel  spin";
            column-gap: calc(32px * var(--ui-scale));
            row-gap: calc(10px * var(--ui-scale));
            align-items: center;
        }

            .daily-screen.active .daily-kicker {
                grid-area: kicker;
                margin-bottom: 0;
            }

            .daily-screen.active .daily-title {
                grid-area: title;
                margin-bottom: calc(8px * var(--ui-scale));
            }

            .daily-screen.active .daily-wheel-wrap {
                grid-area: wheel;
                align-self: center;
                margin: 0;
            }

            /* Right column: left-align the copy so it reads naturally next to the
       wheel instead of staying centered in its own half. Bonus panel
       switches to a single row (icon + text side by side) now that
       there's width for it. */
            .daily-screen.active .daily-bonus-panel {
                grid-area: bonus;
                margin: 0;
                justify-self: stretch;
                align-self: end;
                justify-content: flex-start;
                text-align: left;
            }

            .daily-screen.active .daily-result {
                grid-area: result;
                margin: 0;
                align-items: flex-start;
                text-align: left;
            }

            .daily-screen.active .daily-spin-btn {
                grid-area: spin;
                margin: 0;
                width: 100%;
                align-self: start;
            }

            .daily-screen.active .daily-tease {
                grid-area: tease;
                margin: 0;
                text-align: left;
            }

            /* Not part of the named grid areas - let it fall into its own
       implicit row below, spanning both columns instead of collapsing
       into the left (wheel) column. */
            .daily-screen.active .daily-adboost-panel,
            .daily-screen.active #daily-back-btn {
                grid-column: 1 / -1;
                margin-top: calc(4px * var(--ui-scale));
            }
}

@media (max-width: 768px) {
    .daily-wheel-wrap {
        width: calc(220px * var(--ui-scale));
        height: calc(220px * var(--ui-scale));
    }

    .daily-wedge-label {
        font-size: 16px;
    }

        .daily-wedge-label.jackpot {
            font-size: 17px;
        }
}

/* =========================================================================
   CrazyGames SDK integration - ad placements
   ========================================================================= */

/* Shared "watch a rewarded ad" button - yellow so it reads distinctly as a
   bonus/reward action, never confused with primary nav (cyan), the go-again
   action (green, e.g. .btn-retry), or danger (red). Same base .btn sizing as
   every other button, including its disabled state, so it's never visually
   forced on the player. */
.ad-offer-btn {
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
    box-shadow: inset 0 0 10px rgba(255, 241, 0, 0.2);
    gap: calc(10px * var(--ui-scale));
}

    .ad-offer-btn:hover:not(:disabled) {
        background: var(--neon-yellow);
        color: #000;
        box-shadow: 0 0 20px var(--neon-yellow), inset 0 0 15px #FFF;
    }

    .ad-btn-icon {
        font-size: 0.85em;
    }

.ad-bonus-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(8px * var(--ui-scale));
    width: 100%;
    margin-top: calc(10px * var(--ui-scale));
}

.ad-bonus-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
}

/* Shop screen: sits between chassis config and the RETURN button. */
#screen-upgrades .ad-bonus-panel {
    margin-bottom: calc(6px * var(--ui-scale));
}

/* Game over screen: only shown once per run, hidden entirely after use. */
#go-double-panel {
    margin-top: calc(4px * var(--ui-scale));
    margin-bottom: calc(16px * var(--ui-scale));
}

/* Daily screen: extra spin option, only revealed once free spins are gone.
   Row instead of the .ad-bonus-panel default column - the daily modal has
   spare horizontal width once the button label is just "WATCH AD", so
   button + detail text share one line instead of stacking into two and
   pushing the panel's height out. Wraps to two lines gracefully if a
   narrow viewport can't fit both side by side. */
.daily-adboost-panel {
    padding-top: calc(6px * var(--ui-scale));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: calc(10px * var(--ui-scale));
}

    .daily-adboost-panel .ad-offer-btn {
        width: auto;
        flex-shrink: 0;
    }

/* =========================================================================
   Revive-offer screen (rewarded ad "out of lives" placement)
   ========================================================================= */
.revive-screen {
    border-color: rgba(255, 42, 42, 0.55);
    background: radial-gradient(circle at 50% 20%, rgba(255,42,42,0.14), rgba(6,7,14,0.95) 62%);
    gap: calc(12px * var(--ui-scale));
}

    .revive-screen .pause-mark {
        border-color: rgba(255, 42, 42, 0.5);
        box-shadow: 0 0 24px rgba(255,42,42,0.24), inset 0 0 20px rgba(255,42,42,0.08);
    }

    .revive-screen .pause-mark span {
        background: var(--neon-red);
        box-shadow: 0 0 14px var(--neon-red);
    }

    .revive-screen .pause-kicker {
        color: var(--neon-red);
    }

.revive-countdown {
    width: 100%;
    height: calc(10px * var(--ui-scale));
    margin: 0;
}

    .revive-countdown .progress-bar {
        background: var(--neon-red);
        box-shadow: 0 0 12px var(--neon-red);
        transition: width 1s linear;
    }

.revive-countdown-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: calc(4px * var(--ui-scale));
}

/* Coins-instead-of-ad revive alternative. Cyan so it reads distinctly from the
   yellow rewarded-ad button above it and the red "continue to results" below.
   The price is always shown; when unaffordable the button goes inert with a red
   tint (rather than the neutral disabled grey) so the cost stays legible as a
   goal instead of disappearing. */
.btn-shard-revive {
    border-color: var(--neon-cyan) !important;
    color: var(--neon-cyan) !important;
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.18) !important;
    gap: calc(10px * var(--ui-scale));
}

    .btn-shard-revive:hover:not(:disabled) {
        background: var(--neon-cyan) !important;
        color: #000 !important;
        box-shadow: 0 0 20px var(--neon-cyan), inset 0 0 15px #FFF !important;
    }

    .btn-shard-revive .shard-revive-cost {
        font-size: 0.9em;
        opacity: 0.85;
        letter-spacing: 1px;
    }

    .btn-shard-revive.cant-afford {
        border-color: rgba(255, 42, 42, 0.45) !important;
        color: rgba(255, 130, 130, 0.75) !important;
        box-shadow: none !important;
        opacity: 0.9; /* override .btn:disabled's 0.3 so the price stays readable */
    }

/* ── SHATTERED (game over) - short desktop viewports ─────────────────────────
   The worst case (NEW RECORD card + double-shards ad + the UPGRADES / DAILY
   DROP row) runs ~770px tall at full sizing, so a 720px-tall embed clipped the
   top and bottom of it. Tighten the spacing on short screens; touch devices
   keep their own, more specific compaction above. Below 640px it scrolls
   rather than clipping, since even the compact layout can't fit there. */
@media (max-height: 820px) {
    #screen-gameover {
        padding-top: calc(24px * var(--ui-scale));
        padding-bottom: calc(24px * var(--ui-scale));
    }

        #screen-gameover h1 {
            font-size: 2.6rem;
        }

        #screen-gameover h2 {
            font-size: 1.6rem;
            margin-bottom: calc(12px * var(--ui-scale));
        }

        #screen-gameover .top-score-callout {
            margin-bottom: calc(12px * var(--ui-scale));
        }

        #screen-gameover .harvest-col {
            padding: calc(12px * var(--ui-scale)) calc(14px * var(--ui-scale));
        }

        #screen-gameover .h-val {
            font-size: 2.1rem;
        }

        #screen-gameover .harvest-col.total .h-val {
            font-size: 1.3rem;
        }

        #screen-gameover .btn {
            padding-top: calc(11px * var(--ui-scale));
            padding-bottom: calc(11px * var(--ui-scale));
        }

    #go-double-panel {
        margin-bottom: calc(10px * var(--ui-scale));
    }
}

@media (max-height: 640px) {
    #screen-gameover {
        max-height: 100%;
        overflow-y: auto;
    }
}
