/* ==========================================================================
   NEON OVERDRIVE 3D CAR SIMULATOR - STYLESHEET
   Cyberpunk / Modern Glassmorphic Design System
   ========================================================================== */

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

:root {
    --primary: #00f0ff;
    --primary-glow: rgba(0, 240, 255, 0.4);
    --secondary: #ff0055;
    --secondary-glow: rgba(ff, 0, 85, 0.4);
    --accent: #ffb700;
    --success: #00ff88;
    --bg-dark: #070a12;
    --panel-bg: rgba(12, 16, 28, 0.75);
    --panel-border: rgba(0, 240, 255, 0.25);
    --glass-blur: blur(16px);
    --font-heading: 'Orbitron', sans-serif;
    --font-sub: 'Rajdhani', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: #ffffff;
}

/* 3D Canvas Container */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Base Glassmorphism Panel */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6),
                inset 0 1px 1px 0 rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   MAIN MENU & OVERLAYS
   ========================================================================== */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.overlay-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#main-menu {
    background: linear-gradient(135deg, rgba(7, 10, 18, 0.9), rgba(15, 20, 36, 0.85)),
                url('../assets/background.jpg') center/cover no-repeat;
}

.menu-card {
    width: 90%;
    max-width: 540px;
    padding: 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: floatIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes floatIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-subtitle {
    font-family: var(--font-sub);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--primary);
    text-transform: uppercase;
    text-shadow: 0 0 12px var(--primary-glow);
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 3.2rem;
    font-weight: 900;
    font-style: italic;
    background: linear-gradient(90deg, #ffffff, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.1;
    filter: drop-shadow(0 0 16px rgba(0, 240, 255, 0.4));
}

.menu-btn-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.cyber-btn {
    position: relative;
    padding: 16px 28px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffffff;
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.15), rgba(0, 240, 255, 0.05));
    border: 1px solid var(--primary);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.15);
}

.cyber-btn:hover {
    background: linear-gradient(90deg, var(--primary), rgba(0, 240, 255, 0.8));
    color: #070a12;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.cyber-btn:active {
    transform: translateY(0);
}

.cyber-btn.secondary {
    border-color: var(--secondary);
    background: linear-gradient(90deg, rgba(255, 0, 85, 0.15), rgba(255, 0, 85, 0.05));
    box-shadow: 0 4px 15px rgba(255, 0, 85, 0.15);
}

.cyber-btn.secondary:hover {
    background: linear-gradient(90deg, var(--secondary), rgba(255, 0, 85, 0.8));
    color: #ffffff;
    box-shadow: 0 8px 25px var(--secondary-glow);
}

/* ==========================================================================
   GARAGE & CUSTOMIZATION MODAL
   ========================================================================== */
#garage-screen {
    background: rgba(7, 10, 18, 0.85);
}

.garage-container {
    width: 95%;
    max-width: 1200px;
    height: 85vh;
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 20px;
    padding: 24px;
}

.garage-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
}

.garage-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-glow);
    padding-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vehicle-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vehicle-card {
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vehicle-card:hover, .vehicle-card.active {
    border-color: var(--primary);
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 15px var(--primary-glow);
}

.vehicle-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.vehicle-type {
    font-size: 0.8rem;
    color: #8a99ad;
    font-family: var(--font-sub);
}

.stat-bar-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.85rem;
    font-family: var(--font-sub);
    display: flex;
    justify-content: space-between;
    color: #c0d1e5;
}

.stat-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-swatch:hover, .color-swatch.active {
    transform: scale(1.2);
    border-color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   IN-GAME HUD (HEADS-UP DISPLAY)
   ========================================================================== */
#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
}

#hud-overlay * {
    pointer-events: auto;
}

.hud-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.timer-box {
    padding: 12px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-label {
    font-family: var(--font-sub);
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: #8a99ad;
}

.timer-val {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.checkpoint-badge {
    padding: 8px 16px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--accent);
    background: rgba(255, 183, 0, 0.15);
    border: 1px solid var(--accent);
    border-radius: 20px;
    margin-top: 6px;
}

/* Drift Combo Counter */
.drift-combo-container {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.drift-combo-container.active {
    opacity: 1;
    animation: pulseDrift 0.5s infinite alternate;
}

@keyframes pulseDrift {
    from { transform: translateX(-50%) scale(1); }
    to { transform: translateX(-50%) scale(1.05); }
}

.drift-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    font-style: italic;
    color: var(--secondary);
    text-shadow: 0 0 15px var(--secondary-glow);
    letter-spacing: 2px;
}

.drift-score {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 20px var(--primary-glow);
}

/* Speedometer & Tachometer Cluster */
.hud-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
}

.minimap-container {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 2px solid var(--primary-glow);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

#minimap-canvas {
    width: 100%;
    height: 100%;
    background: rgba(7, 10, 18, 0.85);
}

.instrument-cluster {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.speedometer-card {
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.speed-digital {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.speed-val {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.speed-unit {
    font-family: var(--font-sub);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.gear-badge {
    position: absolute;
    top: -15px;
    right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--secondary);
    border: 2px solid #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 900;
    box-shadow: 0 0 15px var(--secondary-glow);
}

/* RPM Gauge Gauge Arc */
.rpm-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
}

.rpm-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--secondary));
    transition: width 0.05s linear;
}

/* Nitro Boost Gauge */
.nitro-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 140px;
}

.nitro-label {
    font-family: var(--font-sub);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--primary);
    display: flex;
    justify-content: space-between;
}

.nitro-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--primary-glow);
}

.nitro-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00f0ff, #0088ff);
    border-radius: 4px;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: width 0.1s linear;
}

.nitro-fill.boosting {
    background: linear-gradient(90deg, #ff0055, #ffb700);
    box-shadow: 0 0 15px var(--secondary-glow);
    animation: flashNitro 0.2s infinite alternate;
}

@keyframes flashNitro {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

/* Camera & Control Hints */
.controls-hint {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    background: rgba(12, 16, 28, 0.6);
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    font-family: var(--font-sub);
    color: #8a99ad;
}

.key-cap {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #ffffff;
    font-weight: 700;
}

/* Notification Popups */
.hud-popup {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 25px rgba(255, 183, 0, 0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.hud-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Mobile Touch Controls */
.touch-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    justify-content: space-between;
    pointer-events: none;
}

@media (max-width: 900px) {
    .touch-controls { display: flex; }
    .controls-hint { display: none; }
    .garage-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }
}

.touch-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid var(--primary);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    backdrop-filter: blur(8px);
}
