/* ============================================
   DRAG RACE - Mario & Princess Peach Theme
   CSS Styles
   ============================================ */

/* Import fun fonts */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700;900&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    /* Mario colors */
    --mario-red: #E52521;
    --mario-blue: #049CD8;
    --mario-green: #43B047;
    --mario-yellow: #FBD000;
    --mario-brown: #8B4513;

    /* Peach colors */
    --peach-pink: #F096BE;
    --peach-gold: #FFD700;
    --peach-dress: #FF69B4;
    --peach-light: #FFB6C1;

    /* Track / sky colors */
    --sky-dark: #0B0B2E;
    --sky-mid: #1A1A4E;
    --road-color: #2A2A3A;
    --road-line: #FFD700;

    /* Tachometer zones */
    --zone-gray: #555;
    --zone-yellow: #FFC107;
    --zone-green: #4CAF50;
    --zone-red: #F44336;

    /* UI */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-white: #FFFFFF;
    --text-muted: rgba(255, 255, 255, 0.7);
}

/* ---------- Reset & Base ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--sky-dark);
    color: var(--text-white);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
    -webkit-user-select: none;
}

/* Material Symbols filled style */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ---------- Header ---------- */
.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

.back-btn,
.mute-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.back-btn:hover,
.mute-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--mario-yellow);
    text-shadow: 0 0 10px rgba(251, 208, 0, 0.5);
}

.game-title .material-symbols-rounded {
    font-size: 28px;
    color: var(--mario-red);
}

/* ---------- Race Progress Bar ---------- */
.race-progress-bar {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 99;
    height: 32px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    padding: 0 16px;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    position: relative;
    margin: 0 8px;
}

.progress-finish {
    position: absolute;
    right: -2px;
    top: -7px;
    width: 4px;
    height: 20px;
    background: repeating-linear-gradient(
        0deg,
        #fff 0px,
        #fff 4px,
        #000 4px,
        #000 8px
    );
    border-radius: 1px;
}

.progress-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    transition: left 0.1s linear;
    left: 0%;
}

.progress-dot.mario-dot {
    background: var(--mario-red);
    z-index: 2;
}

.progress-dot.peach-dot {
    background: var(--peach-pink);
    z-index: 1;
}

.progress-label {
    font-size: 0.7em;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* ---------- Race HUD ---------- */
.race-hud {
    position: fixed;
    top: 92px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 98;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 6px 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    font-weight: 700;
    font-size: 0.9em;
}

.hud-race-num {
    color: var(--mario-yellow);
}

.hud-score {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hud-score.mario-score {
    color: var(--mario-red);
}

.hud-score.peach-score {
    color: var(--peach-pink);
}

/* ---------- Game Area ---------- */
.game-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Stars background */
.stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite alternate;
}

.star.big {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 4px #fff;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Clouds */
.clouds-container {
    position: absolute;
    top: 5%;
    left: 0;
    width: 100%;
    height: 40%;
    overflow: hidden;
    pointer-events: none;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    animation: cloudFloat linear infinite;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}

.cloud::before {
    width: 60%;
    height: 130%;
    top: -40%;
    left: 20%;
}

.cloud::after {
    width: 40%;
    height: 100%;
    top: -30%;
    left: 50%;
}

@keyframes cloudFloat {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-200px); }
}

/* ---------- Road ---------- */
.road {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 45%;
    background: var(--road-color);
    overflow: hidden;
}

/* Rainbow edges */
.road::before,
.road::after {
    content: '';
    position: absolute;
    top: 0;
    width: 12px;
    height: 100%;
    background: repeating-linear-gradient(
        180deg,
        #FF0000 0px,
        #FF0000 8px,
        #FF7700 8px,
        #FF7700 16px,
        #FFDD00 16px,
        #FFDD00 24px,
        #00CC00 24px,
        #00CC00 32px,
        #0088FF 32px,
        #0088FF 40px,
        #8800FF 40px,
        #8800FF 48px
    );
    z-index: 2;
    animation: rainbowScroll var(--scroll-speed, 2s) linear infinite;
}

.road::before {
    left: 0;
}

.road::after {
    right: 0;
}

@keyframes rainbowScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 48px; }
}

/* Lane divider (scrolling dashes) */
.lane-divider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    transform: translateX(-50%);
    background: repeating-linear-gradient(
        180deg,
        var(--road-line) 0px,
        var(--road-line) 30px,
        transparent 30px,
        transparent 60px
    );
    opacity: 0.6;
    animation: dividerScroll var(--scroll-speed, 2s) linear infinite;
    z-index: 1;
}

@keyframes dividerScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 60px; }
}

/* ---------- Karts ---------- */
.kart-container {
    position: absolute;
    bottom: 12%;
    z-index: 10;
    transition: transform 0.15s ease-out;
}

.kart-container.player-kart {
    left: 20%;
}

.kart-container.ai-kart {
    left: 65%;
}

/* Kart body */
.kart {
    position: relative;
    width: 100px;
    height: 45px;
}

/* Main body */
.kart-body {
    position: absolute;
    bottom: 8px;
    left: 5px;
    width: 90px;
    height: 28px;
    border-radius: 8px 25px 5px 5px;
    z-index: 2;
}

/* Roof / windshield */
.kart-roof {
    position: absolute;
    bottom: 30px;
    left: 25px;
    width: 40px;
    height: 20px;
    clip-path: polygon(10% 100%, 90% 100%, 75% 0%, 25% 0%);
    z-index: 3;
}

/* Emblem on kart body */
.kart-emblem {
    position: absolute;
    bottom: 14px;
    left: 50px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka One', cursive;
    font-size: 10px;
    font-weight: 900;
    z-index: 4;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

/* Wheels */
.kart-wheel {
    position: absolute;
    bottom: 0;
    width: 16px;
    height: 16px;
    background: #333;
    border-radius: 50%;
    border: 3px solid #666;
    z-index: 5;
    animation: wheelSpin var(--wheel-speed, 0.5s) linear infinite;
}

.kart-wheel.front {
    left: 65px;
}

.kart-wheel.rear {
    left: 12px;
}

@keyframes wheelSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Wheel detail */
.kart-wheel::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: #999;
    border-radius: 50%;
}

/* Exhaust puff */
.kart-exhaust {
    position: absolute;
    bottom: 12px;
    left: -8px;
    width: 10px;
    height: 10px;
    background: rgba(200, 200, 200, 0.4);
    border-radius: 50%;
    animation: exhaustPuff 0.4s ease-out infinite;
    z-index: 1;
}

@keyframes exhaustPuff {
    0% { transform: scale(0.5); opacity: 0.6; left: -8px; }
    100% { transform: scale(1.5); opacity: 0; left: -25px; }
}

/* --- Mario Kart Colors --- */
.kart.mario .kart-body {
    background: linear-gradient(180deg, var(--mario-red) 0%, #C41E1A 100%);
    border: 2px solid #A01A17;
    border-bottom: none;
}

.kart.mario .kart-roof {
    background: linear-gradient(180deg, var(--mario-blue) 0%, rgba(4, 156, 216, 0.7) 100%);
}

.kart.mario .kart-emblem {
    background: var(--mario-yellow);
    color: var(--mario-red);
}

/* --- Peach Kart Colors --- */
.kart.peach .kart-body {
    background: linear-gradient(180deg, var(--peach-pink) 0%, #E080A8 100%);
    border: 2px solid #D070A0;
    border-bottom: none;
}

.kart.peach .kart-roof {
    background: linear-gradient(180deg, var(--peach-gold) 0%, rgba(255, 215, 0, 0.7) 100%);
}

.kart.peach .kart-emblem {
    background: var(--peach-gold);
    color: var(--peach-dress);
}

/* ---------- Character Portraits ---------- */
.char-portrait {
    position: absolute;
    bottom: 42px;
    left: 30px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    z-index: 6;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.6);
}

/* Mario portrait */
.char-portrait.mario-face {
    background: #FFDBB4;
}

/* Mario hat */
.char-portrait.mario-face::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 45%;
    background: var(--mario-red);
    border-radius: 50% 50% 0 0;
}

/* Mario mustache */
.char-portrait.mario-face::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 5px;
    background: var(--mario-brown);
    border-radius: 0 0 8px 8px;
}

/* Peach portrait */
.char-portrait.peach-face {
    background: #FFDBB4;
}

/* Peach crown */
.char-portrait.peach-face::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 10px;
    background: var(--peach-gold);
    clip-path: polygon(0% 100%, 15% 30%, 30% 70%, 50% 0%, 70% 70%, 85% 30%, 100% 100%);
    z-index: 1;
}

/* Peach hair */
.char-portrait.peach-face::after {
    content: '';
    position: absolute;
    top: 6px;
    left: -2px;
    width: 32px;
    height: 22px;
    background: #FFD700;
    border-radius: 50%;
    z-index: -1;
}

/* ---------- Speed Lines ---------- */
.speed-lines-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

.speed-lines-container.active {
    opacity: 1;
}

.speed-line {
    position: absolute;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    animation: speedLineMove 0.3s linear infinite;
}

@keyframes speedLineMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(60px); }
}

/* ---------- Traffic Light ---------- */
.traffic-light {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: #222;
    padding: 12px;
    border-radius: 12px;
    border: 3px solid #444;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.traffic-light.visible {
    opacity: 1;
}

.traffic-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #333;
    border: 2px solid #555;
    transition: background 0.2s, box-shadow 0.2s;
}

.traffic-circle.red-on {
    background: #FF0000;
    box-shadow: 0 0 15px #FF0000, 0 0 30px rgba(255, 0, 0, 0.5);
}

.traffic-circle.yellow-on {
    background: #FFD700;
    box-shadow: 0 0 15px #FFD700, 0 0 30px rgba(255, 215, 0, 0.5);
}

.traffic-circle.green-on {
    background: #00FF00;
    box-shadow: 0 0 15px #00FF00, 0 0 30px rgba(0, 255, 0, 0.5);
}

/* ---------- Finish Line ---------- */
.finish-line {
    position: absolute;
    top: 0;
    right: 5%;
    width: 20px;
    height: 100%;
    background: repeating-conic-gradient(
        #fff 0% 25%,
        #000 0% 50%
    ) 0 0 / 10px 10px;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.5s;
}

.finish-line.visible {
    opacity: 0.8;
}

/* ---------- Particles ---------- */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: particleFall linear forwards;
}

@keyframes particleFall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Gold coin confetti colors */
.particle.gold1 { background: #FFD700; }
.particle.gold2 { background: #FFC107; }
.particle.gold3 { background: #FFAB00; }
.particle.gold4 { background: #FFE57F; }
.particle.red { background: var(--mario-red); }
.particle.pink { background: var(--peach-pink); }

/* ---------- Tachometer ---------- */
.tachometer {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    width: 200px;
    height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tach-svg {
    width: 200px;
    height: 110px;
}

.tach-bg {
    fill: none;
    stroke: #333;
    stroke-width: 14;
    stroke-linecap: round;
}

.tach-fill {
    fill: none;
    stroke-width: 14;
    stroke-linecap: round;
    transition: stroke 0.1s;
}

.tach-info {
    text-align: center;
    margin-top: -20px;
}

.tach-gear {
    font-family: 'Fredoka One', cursive;
    font-size: 2em;
    line-height: 1;
    color: var(--mario-yellow);
    text-shadow: 0 0 10px rgba(251, 208, 0, 0.5);
}

.tach-speed {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--text-white);
}

.tach-rpm {
    font-size: 0.7em;
    color: var(--text-muted);
}

/* Shift quality flash */
.shift-quality {
    position: fixed;
    bottom: 155px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 91;
    font-family: 'Fredoka One', cursive;
    font-size: 1.6em;
    opacity: 0;
    transition: opacity 0.1s;
    pointer-events: none;
    text-shadow: 0 0 15px currentColor;
}

.shift-quality.show {
    opacity: 1;
    animation: shiftFlash 0.8s ease-out forwards;
}

@keyframes shiftFlash {
    0% { transform: translateX(-50%) scale(1.3); opacity: 1; }
    100% { transform: translateX(-50%) scale(1) translateY(-20px); opacity: 0; }
}

.shift-quality.perfect { color: var(--zone-green); }
.shift-quality.good { color: var(--zone-yellow); }
.shift-quality.miss { color: var(--zone-red); }

/* ---------- Mobile Shift Button ---------- */
.mobile-shift-btn {
    display: none;
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 92;
    padding: 16px 48px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.3em;
    background: linear-gradient(135deg, var(--mario-red), #FF6B6B);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(229, 37, 33, 0.5);
    -webkit-tap-highlight-color: transparent;
}

.mobile-shift-btn:active {
    transform: translateX(-50%) scale(0.95);
    box-shadow: 0 2px 10px rgba(229, 37, 33, 0.5);
}

/* Show on touch devices */
@media (hover: none) and (pointer: coarse) {
    .mobile-shift-btn {
        display: block;
    }
}

/* ---------- Overlays ---------- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.overlay.active {
    display: flex;
}

.overlay-content {
    background: linear-gradient(135deg, rgba(30, 30, 60, 0.95), rgba(50, 20, 70, 0.95));
    border: 2px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.overlay-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8em;
    margin-bottom: 20px;
    color: var(--mario-yellow);
    text-shadow: 0 0 10px rgba(251, 208, 0, 0.4);
}

/* ---------- Start Screen ---------- */
.char-select-label {
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.char-select-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.char-btn {
    flex: 1;
    max-width: 180px;
    padding: 16px 12px;
    border-radius: 16px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.char-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.char-btn.selected {
    border-color: var(--mario-yellow);
    background: rgba(251, 208, 0, 0.1);
    box-shadow: 0 0 20px rgba(251, 208, 0, 0.2);
}

.char-btn-portrait {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 auto 8px;
    position: relative;
    overflow: hidden;
}

/* Mario select portrait */
.char-btn-portrait.mario-select {
    background: #FFDBB4;
    border: 3px solid var(--mario-red);
}

.char-btn-portrait.mario-select::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 45%;
    background: var(--mario-red);
    border-radius: 50% 50% 0 0;
}

.char-btn-portrait.mario-select::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 6px;
    background: var(--mario-brown);
    border-radius: 0 0 10px 10px;
}

/* Peach select portrait */
.char-btn-portrait.peach-select {
    background: #FFDBB4;
    border: 3px solid var(--peach-pink);
}

.char-btn-portrait.peach-select::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 14px;
    background: var(--peach-gold);
    clip-path: polygon(0% 100%, 15% 30%, 30% 70%, 50% 0%, 70% 70%, 85% 30%, 100% 100%);
    z-index: 1;
}

.char-btn-portrait.peach-select::after {
    content: '';
    position: absolute;
    top: 8px;
    left: -3px;
    width: 56px;
    height: 36px;
    background: #FFD700;
    border-radius: 50%;
    z-index: -1;
}

.char-btn-name {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1em;
}

/* Difficulty picker */
.difficulty-label {
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.difficulty-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.diff-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: 2px solid var(--glass-border);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-weight: 700;
    font-size: 0.9em;
    transition: all 0.2s;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.diff-btn.selected {
    border-color: var(--zone-green);
    background: rgba(76, 175, 80, 0.2);
    color: var(--zone-green);
}

/* Controls hint */
.controls-hint {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
    line-height: 1.6;
}

.controls-hint kbd {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.95em;
}

.controls-nav-hint {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.85em;
    opacity: 0.7;
}

/* Start / action buttons */
.action-btn {
    padding: 14px 40px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2em;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    color: white;
    background: linear-gradient(135deg, var(--mario-green), #2E8B37);
    box-shadow: 0 4px 15px rgba(67, 176, 71, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(67, 176, 71, 0.6);
}

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

/* ---------- Race Result Overlay ---------- */
.result-winner {
    font-family: 'Fredoka One', cursive;
    font-size: 1.4em;
    margin-bottom: 8px;
}

.result-time {
    color: var(--text-muted);
    margin-bottom: 4px;
}

.result-perfects {
    color: var(--zone-green);
    font-weight: 700;
    margin-bottom: 20px;
}

/* ---------- Champion Overlay ---------- */
.champion-trophy {
    font-size: 60px;
    margin-bottom: 12px;
    color: var(--mario-yellow);
}

.champion-trophy .material-symbols-rounded {
    font-size: 60px;
}

.champion-name {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8em;
    margin-bottom: 8px;
}

.champion-tally {
    font-size: 1.1em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.champion-best {
    font-size: 0.95em;
    color: var(--zone-green);
    margin-bottom: 20px;
}

/* ---------- Footer ---------- */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    text-align: center;
    padding: 4px;
    font-size: 0.7em;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .game-title {
        font-size: 1em;
    }

    .game-title .material-symbols-rounded {
        font-size: 22px;
    }

    .overlay-content {
        padding: 24px 16px;
    }

    .overlay-title {
        font-size: 1.4em;
    }

    .char-select-row {
        gap: 10px;
    }

    .char-btn {
        padding: 12px 8px;
    }

    .tachometer {
        width: 160px;
        height: 110px;
        bottom: 10px;
    }

    .tach-svg {
        width: 160px;
        height: 90px;
    }

    .tach-gear {
        font-size: 1.5em;
    }

    .tach-speed {
        font-size: 0.75em;
    }

    .shift-quality {
        font-size: 1.3em;
        bottom: 130px;
    }

    .mobile-shift-btn {
        bottom: 130px;
        padding: 12px 36px;
        font-size: 1.1em;
    }

    .kart {
        width: 80px;
        height: 36px;
    }

    .kart-body {
        width: 72px;
        height: 22px;
        left: 4px;
    }

    .kart-roof {
        width: 32px;
        height: 16px;
        left: 20px;
        bottom: 24px;
    }

    .kart-emblem {
        width: 14px;
        height: 14px;
        font-size: 8px;
        left: 40px;
        bottom: 12px;
    }

    .kart-wheel {
        width: 12px;
        height: 12px;
    }

    .kart-wheel.front {
        left: 52px;
    }

    .kart-wheel.rear {
        left: 10px;
    }

    .char-portrait {
        width: 22px;
        height: 22px;
        bottom: 34px;
        left: 24px;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 6px 10px;
    }

    .back-btn,
    .mute-btn {
        width: 34px;
        height: 34px;
    }

    .game-title {
        font-size: 0.85em;
    }

    .race-hud {
        font-size: 0.75em;
        gap: 12px;
        padding: 4px 14px;
    }

    .tachometer {
        width: 130px;
        height: 90px;
    }

    .tach-svg {
        width: 130px;
        height: 75px;
    }

    .tach-gear {
        font-size: 1.2em;
    }

    .kart-container.player-kart {
        left: 12%;
    }

    .kart-container.ai-kart {
        left: 58%;
    }
}

/* Landscape mode on short screens */
@media (max-height: 500px) {
    .game-header {
        padding: 4px 12px;
    }

    .race-progress-bar {
        top: 44px;
        height: 24px;
    }

    .race-hud {
        top: 72px;
        font-size: 0.75em;
        padding: 3px 12px;
    }

    .tachometer {
        width: 140px;
        height: 95px;
        bottom: 8px;
    }

    .tach-svg {
        width: 140px;
        height: 80px;
    }

    .road {
        height: 50%;
    }

    .kart-container {
        bottom: 15%;
    }

    .shift-quality {
        bottom: 110px;
        font-size: 1.2em;
    }

    .mobile-shift-btn {
        bottom: 110px;
    }
}
