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

body {
    font-family: 'Orbitron', sans-serif;
    background: #0A0A0F;
    color: #FFFFFF;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

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

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

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

/* Menu Screen */
.menu-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.weather-ticker {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #E85D04 0%, #CC6633 50%, #E85D04 100%);
    padding: 8px 20px;
    display: flex;
    gap: 40px;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    animation: tickerGlow 2s ease-in-out infinite;
}

@keyframes tickerGlow {
    0%, 100% { box-shadow: 0 0 10px #E85D04; }
    50% { box-shadow: 0 0 20px #E85D04; }
}

.game-title {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;
    color: #E85D04;
    text-shadow: 
        0 0 20px #E85D04,
        0 0 40px #E85D04,
        0 0 60px #CC6633;
    letter-spacing: 0.1em;
    animation: titlePulse 3s ease-in-out infinite;
    margin-bottom: 60px;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

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

.menu-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 20px 60px;
    background: transparent;
    border: 3px solid #E85D04;
    color: #FFFFFF;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.menu-btn:hover,
.menu-btn.selected {
    background: #E85D04;
    box-shadow: 0 0 30px #E85D04;
    transform: scale(1.05);
}

.menu-controls {
    position: absolute;
    bottom: 60px;
    display: flex;
    gap: 40px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: #888;
}

.footer-link {
    position: absolute;
    bottom: 20px;
    font-size: 12px;
    color: #666;
}

/* Player Select */
.player-select-screen,
.rover-select-screen,
.track-select-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    height: 100%;
}

.player-select-screen h2,
.rover-select-screen h2,
.track-select-screen h2 {
    font-size: 2.5rem;
    color: #E85D04;
    margin-bottom: 40px;
    text-shadow: 0 0 20px #E85D04;
}

.player-buttons {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.player-count-btn {
    width: 150px;
    height: 180px;
    background: #1A1A2E;
    border: 3px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    color: #FFF;
}

.player-count-btn:hover,
.player-count-btn.selected {
    border-color: #E85D04;
    box-shadow: 0 0 30px #E85D0466;
    transform: translateY(-5px);
}

.player-icons {
    font-size: 2rem;
}

/* Rover Select */
.rover-showcase {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.rover-preview {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #1A1A2E 0%, #0A0A0F 100%);
    border: 2px solid #E85D04;
    border-radius: 10px;
}

.rover-info {
    max-width: 400px;
}

.rover-info h3 {
    font-size: 2rem;
    color: #E85D04;
    margin-bottom: 20px;
}

.rover-stats {
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.stat-row span {
    width: 100px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.stat-bar {
    width: 150px;
    height: 12px;
    background: #1A1A2E;
    border-radius: 6px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #E85D04, #FF6B00);
    transition: width 0.3s ease;
}

.rover-special {
    background: #1A1A2E;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #00D4FF;
    margin-bottom: 15px;
}

.special-icon {
    font-size: 1.5rem;
    margin-right: 10px;
}

.rover-special p {
    color: #888;
    font-size: 14px;
    margin-top: 5px;
}

.best-for, .weight {
    color: #888;
    font-size: 14px;
}

.rover-tabs {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.rover-tab {
    padding: 15px 30px;
    background: #1A1A2E;
    border: 2px solid #333;
    color: #FFF;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rover-tab:hover,
.rover-tab.selected {
    border-color: #FF0000;
    box-shadow: 0 0 20px #FF000066;
}

/* Track Select */
.track-content {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

.track-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 600px;
}

@media (max-width: 768px) {
    .track-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.track-card {
    background: #1A1A2E;
    border: 2px solid #333;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.track-card:hover,
.track-card.selected {
    border-color: #E85D04;
    box-shadow: 0 0 30px #E85D0444;
    transform: scale(1.02);
}

.track-preview {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    margin-bottom: 10px;
}

.track-icon {
    font-size: 2rem;
}

.track-card h4 {
    color: #FFF;
    margin-bottom: 8px;
}

.track-info {
    display: flex;
    gap: 15px;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}

.difficulty-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
}

.settings-panel {
    background: #1A1A2E;
    padding: 30px;
    border-radius: 10px;
    border: 2px solid #333;
    min-width: 250px;
}

.settings-panel h3 {
    color: #E85D04;
    margin-bottom: 25px;
    text-align: center;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.toggle-btn {
    padding: 8px 20px;
    background: #333;
    border: none;
    color: #888;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.toggle-btn.on {
    background: #E85D04;
    color: #FFF;
}

.lap-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lap-btn {
    width: 35px;
    height: 35px;
    background: #333;
    border: none;
    color: #FFF;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
}

.lap-btn:hover {
    background: #E85D04;
}

#lap-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    width: 30px;
    text-align: center;
}

.start-race-btn {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #E85D04, #FF6B00);
    border: none;
    color: #FFF;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.start-race-btn:hover {
    box-shadow: 0 0 40px #E85D04;
    transform: scale(1.02);
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 30px;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 5px solid #333;
    border-top-color: #E85D04;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-message {
    font-size: 2rem;
    color: #E85D04;
    text-shadow: 0 0 20px #E85D04;
}

.loading-bar {
    width: 300px;
    height: 8px;
    background: #1A1A2E;
    border-radius: 4px;
    overflow: hidden;
}

.loading-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #E85D04, #FF6B00);
    animation: loadingProgress 3s ease-out forwards;
}

@keyframes loadingProgress {
    to { width: 100%; }
}

/* Race UI */
.race-ui {
    position: relative;
    width: 100%;
    height: 100%;
}

.race-ui.split-2 .player-hud:nth-child(1) { left: 0; width: 50%; }
.race-ui.split-2 .player-hud:nth-child(2) { left: 50%; width: 50%; }

.race-ui.split-3 .player-hud:nth-child(1) { left: 0; top: 50%; width: 50%; height: 50%; }
.race-ui.split-3 .player-hud:nth-child(2) { left: 50%; top: 50%; width: 50%; height: 50%; }
.race-ui.split-3 .player-hud:nth-child(3) { left: 0; top: 0; width: 100%; height: 50%; }

.race-ui.split-4 .player-hud:nth-child(1) { left: 0; top: 50%; width: 50%; height: 50%; }
.race-ui.split-4 .player-hud:nth-child(2) { left: 50%; top: 50%; width: 50%; height: 50%; }
.race-ui.split-4 .player-hud:nth-child(3) { left: 0; top: 0; width: 50%; height: 50%; }
.race-ui.split-4 .player-hud:nth-child(4) { left: 50%; top: 0; width: 50%; height: 50%; }

.player-hud {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border: 2px solid transparent;
}

.hud-top-left {
    position: absolute;
    top: 15px;
    left: 15px;
}

.position-badge {
    font-size: 2rem;
    font-weight: 900;
    color: #E85D04;
    text-shadow: 0 0 10px #E85D04;
}

.lap-counter {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: #888;
}

.hud-top-center {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.race-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: #FFF;
    text-shadow: 0 0 10px #000;
}

.checkpoint-progress {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #E85D04;
}

.hud-top-right {
    position: absolute;
    top: 15px;
    right: 15px;
    text-align: right;
}

.health-bar,
.battery-bar {
    width: 120px;
    height: 12px;
    background: #1A1A2E;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 5px;
    margin-left: auto;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.bar-fill.battery {
    background: #00FFFF;
}

.speed-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFF;
}

.hud-bottom {
    position: absolute;
    bottom: 15px;
    right: 15px;
}

.minimap {
    background: rgba(10, 10, 15, 0.8);
    border: 2px solid #E85D04;
    border-radius: 8px;
    overflow: hidden;
}

.minimap canvas {
    display: block;
}

/* Pause Menu */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pause-menu {
    text-align: center;
}

.pause-menu h2 {
    font-size: 3rem;
    color: #E85D04;
    margin-bottom: 40px;
    text-shadow: 0 0 30px #E85D04;
}

/* Results Screen */
.results-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    height: 100%;
    overflow-y: auto;
}

.results-screen h1 {
    font-size: 3rem;
    color: #E85D04;
    margin-bottom: 30px;
    text-shadow: 0 0 30px #E85D04;
}

.podium {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    align-items: flex-end;
}

.podium-spot {
    text-align: center;
    padding: 20px;
    background: #1A1A2E;
    border-radius: 10px;
}

.podium-spot.pos-1 {
    order: 2;
    border: 2px solid gold;
    padding-bottom: 40px;
}

.podium-spot.pos-2 {
    order: 1;
    border: 2px solid silver;
}

.podium-spot.pos-3 {
    order: 3;
    border: 2px solid #CD7F32;
}

.medal {
    font-size: 3rem;
}

.player-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 10px 0;
}

.rover-name {
    color: #888;
    font-size: 0.9rem;
}

.time {
    font-family: 'JetBrains Mono', monospace;
    color: #E85D04;
    margin-top: 10px;
}

.results-table {
    margin-bottom: 30px;
}

.results-table table {
    border-collapse: collapse;
    background: #1A1A2E;
}

.results-table th,
.results-table td {
    padding: 12px 25px;
    border: 1px solid #333;
    text-align: center;
}

.results-table th {
    background: #E85D04;
    color: #FFF;
}

.awards {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.award {
    background: linear-gradient(135deg, #1A1A2E, #2A2A3E);
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid #E85D04;
    text-align: center;
}

.award-name {
    color: #E85D04;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

.award-desc {
    color: #888;
    font-size: 12px;
}

.weather-summary {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    font-family: 'JetBrains Mono', monospace;
    color: #888;
}

.results-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Controls Screen */
.controls-screen,
.about-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    height: 100%;
    overflow-y: auto;
}

.controls-screen h2,
.about-screen h2 {
    font-size: 2.5rem;
    color: #E85D04;
    margin-bottom: 30px;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin-bottom: 30px;
}

.control-panel {
    background: #1A1A2E;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #333;
}

.control-panel h3 {
    color: #E85D04;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.control-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #222;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.control-row span:first-child {
    color: #00D4FF;
    font-weight: 700;
}

.about-content {
    max-width: 600px;
    text-align: center;
    line-height: 1.8;
    margin-bottom: 30px;
}

.about-content p {
    margin-bottom: 15px;
}

.credit {
    color: #888;
    font-size: 14px;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .game-title {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    .menu-btn {
        padding: 15px 40px;
        font-size: 1.2rem;
    }
    
    .player-count-btn {
        width: 100px;
        height: 120px;
    }
    
    .rover-preview {
        width: 200px;
        height: 200px;
    }
    
    .race-timer {
        font-size: 1.2rem;
    }
    
    .position-badge {
        font-size: 1.5rem;
    }
    
    .minimap {
        display: none;
    }
}