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

:root {
    --bg-primary: #040509;
    --bg-secondary: #080a13;
    --bg-panel: rgba(10, 12, 22, 0.78);
    --border-neon: rgba(0, 240, 255, 0.2);
    --border-neon-pink: rgba(255, 0, 127, 0.2);
    
    --neon-cyan: #00f0ff;
    --neon-pink: #ff007f;
    --neon-purple: #a124ff;
    --neon-green: #00ff66;
    --neon-yellow: #ffea00;
    --neon-orange: #ff6c00;
    --neon-blue: #0066ff;
    --neon-red: #ff2a2a;
    
    --text-primary: #f0f2f5;
    --text-secondary: #8595a8;
    
    --glow-cyan: 0 0 10px rgba(0, 240, 255, 0.6), 0 0 20px rgba(0, 240, 255, 0.2);
    --glow-pink: 0 0 10px rgba(255, 0, 127, 0.6), 0 0 20px rgba(255, 0, 127, 0.2);
    --glow-green: 0 0 10px rgba(0, 255, 102, 0.6), 0 0 20px rgba(0, 255, 102, 0.2);
    --glow-red: 0 0 10px rgba(255, 42, 42, 0.6), 0 0 20px rgba(255, 42, 42, 0.2);
    --glow-yellow: 0 0 10px rgba(255, 234, 0, 0.6), 0 0 20px rgba(255, 234, 0, 0.2);
    --glow-purple: 0 0 10px rgba(161, 36, 255, 0.6), 0 0 20px rgba(161, 36, 255, 0.2);

    --font-header: 'Orbitron', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Effects */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.15;
    z-index: -2;
    animation: backgroundShift 120s linear infinite;
}

.cyber-grid-bg {
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: 
        linear-gradient(to right, rgba(0, 240, 255, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 240, 255, 0.035) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: perspective(600px) rotateX(65deg);
    z-index: -1;
    animation: gridScroll 15s linear infinite;
}

@keyframes backgroundShift {
    from { background-position: 0 0, 40px 60px, 130px 270px; }
    to { background-position: 550px 550px, 390px 410px, 380px 820px; }
}

@keyframes gridScroll {
    from { background-position: 0 0; }
    to { background-position: 0 600px; }
}

/* Container */
.app-container {
    width: 100%;
    max-width: 1300px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 1;
}

.game-header {
    text-align: center;
    margin-bottom: 2px;
}

.logo {
    font-family: var(--font-header);
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: 8px;
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.neon-text {
    color: var(--neon-pink);
    text-shadow: var(--glow-pink);
    animation: textFlicker 3s linear infinite;
}

.sub-logo {
    font-family: var(--font-header);
    font-size: 0.7rem;
    letter-spacing: 5px;
    color: var(--neon-cyan);
    text-shadow: var(--glow-cyan);
    margin-top: -3px;
    opacity: 0.8;
}

@keyframes textFlicker {
    0%, 93%, 95%, 97%, 100% { text-shadow: var(--glow-pink); }
    94%, 96% { text-shadow: none; opacity: 0.65; }
}

/* Game Layout Grid */
.game-layout {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 20px;
    width: 100%;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 220px;
    flex-shrink: 0;
}

/* Glassmorphism Panel */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-neon);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 240, 255, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.02);
}

.left-sidebar .panel {
    border-color: var(--border-neon-pink);
}

.left-sidebar .panel:hover {
    border-color: rgba(255, 0, 127, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 0, 127, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.02);
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--neon-cyan), transparent);
}

.left-sidebar .panel::before {
    background: linear-gradient(90deg, var(--neon-pink), transparent);
}

.panel-title {
    font-family: var(--font-header);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
}

/* HUD Overlay Panels in Game Board Frame */
.game-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.board-frame {
    position: relative;
    border-radius: 16px;
    padding: 8px;
    background: rgba(8, 10, 20, 0.85);
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.15), inset 0 0 20px rgba(0, 240, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.board-neon-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 16px;
    border: 2px solid var(--neon-pink);
    opacity: 0.3;
    pointer-events: none;
    animation: borderPulse 4s infinite alternate;
}

@keyframes borderPulse {
    0% { opacity: 0.15; filter: blur(1px); }
    100% { opacity: 0.55; filter: blur(3px); }
}

#game-canvas {
    background: #020306;
    display: block;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* In-game HUD displays overlaying canvas */
.hud-top-left, .hud-top-right {
    position: absolute;
    top: 25px;
    background: rgba(4, 6, 12, 0.7);
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: var(--font-header);
    backdrop-filter: blur(5px);
    z-index: 5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.hud-top-left {
    left: 25px;
    border-left: 3px solid var(--neon-pink);
    border-color: rgba(255, 0, 127, 0.3);
}

.hud-top-right {
    right: 25px;
    border-right: 3px solid var(--neon-cyan);
}

.hud-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.hud-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.hud-top-left .hud-value {
    color: var(--neon-pink);
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.4);
}

.hud-top-right .hud-value {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

/* Speedometer circular HUD */
.hud-bottom-left {
    position: absolute;
    bottom: 25px;
    left: 25px;
    z-index: 5;
}

.speedometer-container {
    background: rgba(4, 6, 12, 0.75);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 50%;
    width: 100px;
    height: 100px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.speed-ring {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(-135deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 6;
}

.ring-fill {
    fill: none;
    stroke: var(--neon-cyan);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 264;
    stroke-dashoffset: 264;
    transition: stroke-dashoffset 0.1s ease;
    filter: drop-shadow(0 0 3px var(--neon-cyan));
}

.speed-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.speed-num {
    font-family: var(--font-header);
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}

.speed-unit {
    font-family: var(--font-header);
    font-size: 0.55rem;
    color: var(--neon-cyan);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Item Slot UI */
.item-slot-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.item-icon-box {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    border: 2px dashed rgba(255, 0, 127, 0.25);
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-header);
    font-weight: 900;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    text-align: center;
}

.item-icon-box.rolling {
    animation: itemBoxPulse 0.15s infinite alternate;
    border-style: solid;
    border-color: var(--neon-yellow);
    box-shadow: var(--glow-yellow);
    color: var(--neon-yellow);
}

.item-icon-box.active-item {
    border-style: solid;
    border-width: 2.5px;
}

.item-icon-box.item-mushroom { border-color: var(--neon-orange); box-shadow: 0 0 15px rgba(255, 108, 0, 0.4); color: var(--neon-orange); text-shadow: 0 0 5px rgba(255,108,0,0.5); }
.item-icon-box.item-banana { border-color: var(--neon-yellow); box-shadow: 0 0 15px rgba(255, 234, 0, 0.4); color: var(--neon-yellow); text-shadow: 0 0 5px rgba(255,234,0,0.5); }
.item-icon-box.item-green_shell { border-color: var(--neon-green); box-shadow: 0 0 15px rgba(0, 255, 102, 0.4); color: var(--neon-green); text-shadow: 0 0 5px rgba(0,255,102,0.5); }
.item-icon-box.item-red_shell { border-color: var(--neon-red); box-shadow: 0 0 15px rgba(255, 42, 42, 0.4); color: var(--neon-red); text-shadow: 0 0 5px rgba(255,42,42,0.5); }
.item-icon-box.item-star { border-color: var(--neon-cyan); box-shadow: 0 0 20px rgba(0, 240, 255, 0.5); color: var(--neon-cyan); text-shadow: var(--glow-cyan); animation: rainbowGlow 2s infinite linear; }

@keyframes itemBoxPulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    100% { transform: scale(1.05); opacity: 1; }
}

@keyframes rainbowGlow {
    0% { border-color: var(--neon-cyan); filter: hue-rotate(0deg); }
    100% { border-color: var(--neon-cyan); filter: hue-rotate(360deg); }
}

.item-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Leaderboard Ranking list */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    font-family: var(--font-header);
    font-size: 0.8rem;
    transition: background-color 0.2s ease;
}

.rank-row.player-row {
    background: rgba(255, 0, 127, 0.08);
    border-color: rgba(255, 0, 127, 0.25);
}

.rank-row.player-row .driver-name {
    color: var(--neon-pink);
    text-shadow: 0 0 5px rgba(255, 0, 127, 0.3);
}

.rank-num {
    font-weight: 900;
    color: var(--text-secondary);
}

.rank-row:nth-child(1) .rank-num { color: var(--neon-yellow); }
.rank-row:nth-child(2) .rank-num { color: #cfd4dc; }
.rank-row:nth-child(3) .rank-num { color: #a2723a; }

.driver-name {
    flex-grow: 1;
    margin-left: 12px;
    text-align: left;
    font-weight: 700;
}

.driver-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Minimap container */
.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 5px;
}

#minimap-canvas {
    background: rgba(0, 0, 0, 0.15);
    display: block;
}

/* Controls keys table */
.control-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.key {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 2.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 3px rgba(0, 240, 255, 0.3);
    min-width: 22px;
    text-align: center;
}

/* Character/Vehicle Selection Panels */
.character-select {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.select-hint {
    font-family: var(--font-header);
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    text-shadow: var(--glow-cyan);
    text-align: left;
}

.vehicle-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vehicle-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px 18px;
    cursor: pointer;
    text-align: left;
    transition: all 0.25s ease;
}

.vehicle-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.3);
}

.vehicle-card.active {
    background: rgba(255, 0, 127, 0.06);
    border-color: var(--neon-pink);
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.25), inset 0 0 10px rgba(255, 0, 127, 0.1);
}

.v-name {
    font-family: var(--font-header);
    font-weight: 900;
    font-size: 0.95rem;
    letter-spacing: 1px;
    color: #fff;
    margin-bottom: 4px;
}

.vehicle-card.active .v-name {
    color: var(--neon-pink);
    text-shadow: 0 0 5px rgba(255, 0, 127, 0.4);
}

.v-stats {
    font-family: var(--font-header);
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* Button Styles */
.btn {
    font-family: var(--font-header);
    font-weight: 700;
    letter-spacing: 2px;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    text-align: center;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, #0088cc 100%);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.5), 0 0 10px var(--neon-cyan);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--neon-pink);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 0, 127, 0.2), 0 0 5px var(--neon-pink);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(1px);
}

.btn-large {
    font-size: 1.1rem;
    padding: 14px 28px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Screens and Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 5, 10, 0.85);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.glass-overlay {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.overlay-content {
    background: rgba(10, 12, 22, 0.82);
    border: 1px solid var(--border-neon);
    border-radius: 20px;
    padding: 35px 45px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 240, 255, 0.1), inset 0 0 20px rgba(255, 255, 255, 0.02);
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.overlay.active .overlay-content {
    transform: translateY(0);
}

.glow-title, .glow-title-cyan, .glow-title-red, .glow-title-settings, .glow-title-scores {
    font-family: var(--font-header);
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 6px;
    margin-bottom: 5px;
}

.glow-title {
    color: var(--neon-pink);
    text-shadow: var(--glow-pink);
}

.glow-title-cyan {
    color: var(--neon-cyan);
    text-shadow: var(--glow-cyan);
}

.glow-title-settings {
    color: var(--neon-purple);
    text-shadow: var(--glow-purple);
}

.glow-title-scores {
    color: var(--neon-yellow);
    text-shadow: var(--glow-yellow);
}

.tagline {
    font-family: var(--font-header);
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Settings Overlay */
.settings-content {
    max-width: 550px;
    border-color: rgba(161, 36, 255, 0.3);
}

.settings-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

.tab-btn {
    background: transparent;
    border: none;
    font-family: var(--font-header);
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--neon-purple);
    background: rgba(161, 36, 255, 0.1);
    box-shadow: inset 0 0 10px rgba(161, 36, 255, 0.1);
}

.tab-content {
    display: none;
    margin-bottom: 30px;
    text-align: left;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

.tab-content::-webkit-scrollbar {
    width: 6px;
}

.tab-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: rgba(161, 36, 255, 0.3);
    border-radius: 3px;
}

.tab-content.active {
    display: block;
}

.setting-control {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-control label {
    font-family: var(--font-header);
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider-container input[type="range"] {
    flex-grow: 1;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.08);
    height: 8px;
    border-radius: 4px;
    outline: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    background: var(--neon-purple);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-purple);
    transition: transform 0.1s ease;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-val {
    font-family: var(--font-header);
    font-size: 0.85rem;
    min-width: 45px;
    text-align: right;
    color: var(--text-primary);
}

/* Keybindings remapper */
.keybind-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.keybind-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px 12px;
}

.keybind-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.keybind-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--neon-cyan);
    font-family: var(--font-header);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 75px;
    text-align: center;
    transition: all 0.2s ease;
}

.keybind-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
}

.keybind-btn.waiting {
    background: rgba(255, 0, 127, 0.1);
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    animation: pulseGlow 1s infinite alternate;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 5px rgba(255, 0, 127, 0.3); }
    100% { box-shadow: 0 0 15px rgba(255, 0, 127, 0.6); }
}

.settings-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
}

/* High Scores Table */
.scores-table {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 25px;
    overflow: hidden;
}

.scores-header, .scores-row {
    display: grid;
    grid-template-columns: 70px 1fr 120px 110px;
    padding: 12px 20px;
    align-items: center;
    font-family: var(--font-header);
    font-size: 0.85rem;
}

.scores-header {
    background: rgba(255, 234, 0, 0.05);
    border-bottom: 1px solid rgba(255, 234, 0, 0.15);
    color: var(--neon-yellow);
    font-weight: 700;
    letter-spacing: 1px;
}

.scores-list {
    max-height: 230px;
    overflow-y: auto;
}

.scores-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background-color 0.2s ease;
}

.scores-row:last-child {
    border-bottom: none;
}

.scores-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.scores-row .rank {
    font-weight: 900;
    color: var(--text-secondary);
}

.scores-row:nth-child(1) .rank { color: var(--neon-yellow); text-shadow: var(--glow-yellow); }
.scores-row:nth-child(2) .rank { color: #d1d5db; }
.scores-row:nth-child(3) .rank { color: #b45309; }

.scores-row .name {
    text-align: left;
    font-family: var(--font-body);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.scores-row .score {
    text-align: right;
    color: var(--neon-cyan);
    font-weight: 700;
}

.scores-row .level {
    text-align: right;
    color: var(--neon-pink);
    font-weight: 700;
}

/* High Score Input */
.highscore-input-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
    display: none;
}

.highscore-input-container.active {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

.highscore-input-container p {
    font-family: var(--font-header);
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    margin-bottom: 10px;
}

.input-row {
    display: flex;
    gap: 10px;
}

#player-name-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 6px;
    padding: 10px 15px;
    color: #fff;
    font-family: var(--font-header);
    font-size: 0.9rem;
    outline: none;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

#player-name-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

/* Audio Toast */
.audio-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(11, 13, 25, 0.9);
    border: 1px solid var(--neon-pink);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 30px;
    font-family: var(--font-header);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    box-shadow: var(--glow-pink);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.audio-toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Victory Dashboard Stats */
.gameover-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 25px;
}

.go-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.go-stat .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.go-stat .val {
    font-family: var(--font-header);
    font-weight: 900;
    font-size: 1.3rem;
    color: var(--neon-pink);
    text-shadow: 0 0 5px rgba(255, 0, 127, 0.3);
}

/* In-game screen alerts (e.g. LAP 2!, FINISH!) */
.board-alert {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    font-family: var(--font-header);
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    z-index: 10;
    letter-spacing: 4px;
    transition: all 0.1s ease;
}

.board-alert.active {
    animation: alertPop 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes alertPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6) rotate(-4deg);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1) rotate(1deg);
    }
    30% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -130%) scale(0.8);
    }
}

/* Responsive scaling for laptop screens */
@media (max-width: 1200px) {
    .app-container {
        max-width: 1000px;
        gap: 5px;
    }
    .logo {
        font-size: 1.8rem;
    }
    .sub-logo {
        font-size: 0.6rem;
    }
    .game-layout {
        gap: 15px;
    }
    .sidebar {
        width: 180px;
        gap: 10px;
    }
    .panel {
        padding: 10px;
        gap: 8px;
    }
    .panel-title {
        font-size: 0.8rem;
    }
    .item-icon-box {
        width: 80px;
        height: 80px;
        font-size: 0.8rem;
    }
    #minimap-canvas {
        width: 140px;
        height: 140px;
    }
    .control-list {
        font-size: 0.65rem;
        gap: 4px;
    }
    .key {
        padding: 1px 4px;
        font-size: 0.6rem;
    }
    #game-canvas {
        width: 600px;
        height: 375px;
    }
    .hud-top-left, .hud-top-right {
        top: 15px;
        padding: 4px 10px;
    }
    .hud-value {
        font-size: 1.1rem;
    }
    .speedometer-container {
        width: 70px;
        height: 70px;
    }
    .speed-ring {
        width: 70px;
        height: 70px;
        viewBox: 0 0 100 100;
    }
    .speed-num {
        font-size: 1.2rem;
    }
    .speed-unit {
        font-size: 0.45rem;
    }
    .hud-bottom-left {
        bottom: 15px;
        left: 15px;
    }
}

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