/* Dubai Drift 2099 - Style Sheet */
:root {
    --cyan: #00f0ff;
    --cyan-glow: rgba(0, 240, 255, 0.4);
    --pink: #ff003c;
    --pink-glow: rgba(255, 0, 60, 0.4);
    --orange: #f59e0b;
    --orange-glow: rgba(245, 158, 11, 0.4);
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.4);
    --violet: #a855f7;
    --bg-dark: #030308;
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: #000;
    color: #f8fafc;
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gaming-font {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.1em;
}

/* Arcade Cabinet Styling wrapper */
.arcade-cabinet {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 1024px;
    max-height: 600px;
    aspect-ratio: 1024/600;
    background-color: var(--bg-dark);
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.15), 0 0 10px rgba(255, 0, 60, 0.15);
    border: 4px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
}

/* Main Container */
.game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Game Canvas */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #000;
}

/* CRT Overlay Screen scanlines */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    z-index: 10;
    pointer-events: none;
    opacity: 0.85;
}

/* Header bar */
.game-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(to bottom, rgba(3, 3, 8, 0.9) 0%, rgba(3, 3, 8, 0) 100%);
    z-index: 20;
    pointer-events: auto;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    transition: color 0.2s, text-shadow 0.2s;
}

.back-btn:hover {
    color: var(--cyan);
    text-shadow: 0 0 8px var(--cyan-glow);
}

.back-icon {
    width: 16px;
    height: 16px;
}

.game-title {
    font-size: 1.1rem;
    font-weight: 900;
    background: linear-gradient(90deg, #fff, var(--cyan), var(--violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.icon-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--cyan);
}

.sound-icon {
    width: 20px;
    height: 20px;
}

.hidden {
    display: none !important;
}

/* Digital HUD styling */
.hud-container {
    position: absolute;
    top: 3.5rem;
    left: 1.5rem;
    right: 1.5rem;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 20;
}

.hud-item {
    background: rgba(3, 3, 8, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.hud-label {
    font-size: 0.6rem;
    color: #64748b;
    margin-bottom: 0.15rem;
}

.hud-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.hud-unit {
    font-size: 0.55rem;
    color: #64748b;
    margin-top: 0.05rem;
}

.speed-hud .hud-value {
    color: var(--cyan);
    text-shadow: 0 0 8px var(--cyan-glow);
}

.time-hud .hud-value {
    color: #22c55e;
}

.time-hud .hud-value.warning {
    color: var(--pink);
    text-shadow: 0 0 8px var(--pink-glow);
    animation: flash 1s infinite alternate;
}

.score-hud .hud-value {
    color: var(--orange);
    text-shadow: 0 0 8px var(--orange-glow);
}

/* Boost Gauge */
.boost-container {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    width: 180px;
    background: rgba(3, 3, 8, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.4rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    z-index: 20;
    pointer-events: none;
}

.boost-bar-label {
    font-size: 0.55rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
    text-align: center;
}

.boost-bar-track {
    width: 100%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.boost-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    box-shadow: 0 0 10px var(--cyan);
    transition: width 0.1s linear;
}

/* Overlays / Screens */
.overlay-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(3, 3, 8, 0.85);
    backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.overlay-panel.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.glass-container {
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    position: relative;
}

.border-pink { border-color: var(--pink); box-shadow: 0 0 20px rgba(255, 0, 60, 0.1); }
.border-cyan { border-color: var(--cyan); box-shadow: 0 0 20px rgba(0, 240, 255, 0.1); }

.title-glitch {
    font-size: 2.2rem;
    font-weight: 900;
    background: linear-gradient(90deg, #fff, var(--cyan), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.75rem;
    color: #64748b;
    letter-spacing: 0.3em;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

/* Car synthesis selector */
.car-selection-box {
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.8rem;
}

.section-title {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-bottom: 0.6rem;
}

.car-options {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.car-btn {
    background: rgba(3, 3, 8, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    color: #94a3b8;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.car-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.car-btn.border-cyan.active { border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan-glow); }
.car-btn.border-pink.active { border-color: var(--pink); box-shadow: 0 0 10px var(--pink-glow); }
.car-btn.border-yellow.active { border-color: var(--orange); box-shadow: 0 0 10px var(--orange-glow); }

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.bg-cyan { background-color: var(--cyan); }
.bg-pink { background-color: var(--pink); }
.bg-yellow { background-color: var(--orange); }

/* Instructions Grid */
.instructions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: left;
    margin-bottom: 1.5rem;
}

.instruction-box {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.7rem;
    color: #cbd5e1;
    line-height: 1.4;
}

.instruction-box .box-title {
    display: block;
    font-size: 0.65rem;
    color: var(--cyan);
    margin-bottom: 0.4rem;
}

/* Action button styled */
.action-btn {
    display: inline-block;
    background: none;
    border: 2px solid #fff;
    border-radius: 6px;
    padding: 0.75rem 2rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
}

.border-orange-btn {
    border-color: var(--orange);
    color: var(--orange);
}
.border-orange-btn:hover {
    background: var(--orange);
    color: #000;
    box-shadow: 0 0 20px var(--orange-glow);
}

.border-pink-btn {
    border-color: var(--pink);
    color: var(--pink);
}
.border-pink-btn:hover {
    background: var(--pink);
    color: #fff;
    box-shadow: 0 0 20px var(--pink-glow);
}

.border-cyan-btn {
    border-color: var(--cyan);
    color: var(--cyan);
}
.border-cyan-btn:hover {
    background: var(--cyan);
    color: #000;
    box-shadow: 0 0 20px var(--cyan-glow);
}

.border-blue-btn {
    border-color: var(--blue);
    color: var(--blue);
}
.border-blue-btn:hover {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 0 20px var(--blue-glow);
}

/* Screen Stats Table */
.stats-table {
    margin: 1.5rem auto;
    max-width: 320px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.stats-row .label {
    font-size: 0.75rem;
    color: #64748b;
}

.stats-row .value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
}

.alert-title {
    font-size: 2rem;
    font-weight: 900;
    text-shadow: 0 0 15px rgba(255,0,60,0.4);
    margin-bottom: 0.25rem;
}

.text-pink { color: var(--pink) !important; }
.text-cyan { color: var(--cyan) !important; }

.victory-trophy {
    margin: 1rem 0;
    display: inline-flex;
    justify-content: center;
}

.trophy-svg {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 0 10px var(--cyan));
}

/* Achievements Notification Banner */
.achievement-unlocked-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--cyan);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 1.2rem auto;
    max-width: 380px;
    text-align: left;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
    animation: achievementSlide 0.5s ease-out;
}

.ach-glow-icon {
    font-size: 1.8rem;
    color: var(--orange);
    text-shadow: 0 0 8px var(--orange);
    animation: spin 3s infinite linear;
}

.ach-text h4 {
    font-size: 0.7rem;
    color: var(--cyan);
}

.ach-text p {
    font-size: 0.75rem;
    color: #e2e8f0;
}

.actions-box {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Speech Mascot Panel (Dynamic Police Alerts) */
.mascot-alert {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    width: 320px;
    background: rgba(3, 3, 8, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid #3b82f6;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(59, 130, 246, 0.2);
    display: flex;
    gap: 0.75rem;
    z-index: 30;
    pointer-events: none;
    animation: slideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.mascot-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.speech-bubble {
    font-size: 0.7rem;
    color: #cbd5e1;
    line-height: 1.3;
}

.mascot-tag {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 0.15rem;
}

.eye-police-left { animation: policeBlue 0.3s infinite alternate; }
.eye-police-right { animation: policeRed 0.3s infinite alternate; }

/* Mobile Touch Controllers overlay styling */
.mobile-controls-container {
    display: none; /* Hidden by default, toggled via Media Query */
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    justify-content: space-between;
    z-index: 40;
    pointer-events: none;
}

.mobile-dpad, .mobile-actions {
    display: flex;
    gap: 0.5rem;
    pointer-events: auto;
}

.ctrl-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(3, 3, 8, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.ctrl-btn:active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: var(--cyan);
}

.btn-gas {
    background: rgba(34, 197, 94, 0.25);
    border-color: #22c55e;
    color: #22c55e;
}
.btn-gas:active {
    background: #22c55e;
    color: #000;
}

.btn-brake {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ef4444;
}
.btn-brake:active {
    background: #ef4444;
    color: #fff;
}

.btn-boost {
    background: rgba(0, 240, 255, 0.25);
    border-color: var(--cyan);
    color: var(--cyan);
}
.btn-boost:active {
    background: var(--cyan);
    color: #000;
    box-shadow: 0 0 15px var(--cyan);
}

/* Animations */
@keyframes flash {
    0% { opacity: 1; }
    100% { opacity: 0.4; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes policeBlue {
    0% { fill: #3b82f6; }
    100% { fill: #1e293b; }
}

@keyframes policeRed {
    0% { fill: #1e293b; }
    100% { fill: #ef4444; }
}

@keyframes slideIn {
    from { transform: translateX(350px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes achievementSlide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsiveness Media Queries */
@media (max-width: 768px) {
    .instructions-grid {
        grid-template-columns: 1fr;
    }
}

@media (pointer: coarse) {
    /* Touch screen device configurations */
    .mobile-controls-container {
        display: flex;
    }
    .instructions-grid {
        display: none;
    }
}
