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

body {
    background: #0a0505;
    overflow: hidden;
    font-family: 'Exo 2', sans-serif;
    color: #fff;
}

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

#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, transparent, rgba(255, 102, 0, 0.3), transparent);
    padding: 10px 20px;
    font-size: 14px;
    text-align: center;
    animation: ticker-glow 2s ease-in-out infinite;
}

@keyframes ticker-glow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(36px, 8vw, 72px);
    font-weight: 900;
    background: linear-gradient(135deg, #ff6600 0%, #ff3300 50%, #ff8800 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 60px rgba(255, 102, 0, 0.5);
    margin-bottom: 60px;
    letter-spacing: 4px;
    animation: title-pulse 3s ease-in-out infinite;
}

@keyframes title-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.02); filter: brightness(1.1); }
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-item {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    padding: 15px 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    border: 2px solid transparent;
}

.menu-item:hover, .menu-item.selected {
    color: #ff6600;
    text-shadow: 0 0 20px rgba(255, 102, 0, 0.8);
    border-color: #ff6600;
    background: rgba(255, 102, 0, 0.1);
}

.menu-hint {
    position: absolute;
    bottom: 60px;
    font-size: 14px;
    opacity: 0.6;
}

.footer-link {
    position: absolute;
    bottom: 20px;
    font-size: 12px;
    opacity: 0.5;
}

.footer-link a {
    color: #ff6600;
    text-decoration: none;
}

/* Select Screens */
.select-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    height: 100%;
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(24px, 5vw, 36px);
    color: #ff6600;
    margin-bottom: 40px;
    text-shadow: 0 0 30px rgba(255, 102, 0, 0.5);
}

/* Player Select */
.player-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.player-button {
    width: 140px;
    height: 140px;
    background: rgba(20, 10, 5, 0.8);
    border: 3px solid #663300;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.player-button:hover, .player-button.selected {
    border-color: #ff6600;
    box-shadow: 0 0 30px rgba(255, 102, 0, 0.5);
    transform: scale(1.05);
}

.player-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.player-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    font-weight: bold;
}

/* Rover Select */
.rover-screen {
    justify-content: flex-start;
    padding-top: 60px;
}

.ready-players {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ready-badge {
    background: #22aa22;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.rover-info {
    background: rgba(20, 10, 5, 0.9);
    border: 2px solid #663300;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    margin-bottom: 30px;
}

.rover-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    color: #ff6600;
    text-align: center;
    margin-bottom: 20px;
}

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

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

.stat-label {
    width: 80px;
    font-size: 14px;
    opacity: 0.8;
}

.stat-bar {
    flex: 1;
    height: 12px;
    background: #331100;
    border-radius: 6px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff3300, #ff6600);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.rover-details p {
    margin: 8px 0;
    font-size: 14px;
}

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

.rover-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.rover-option:hover, .rover-option.selected {
    border-color: #ff6600;
    background: rgba(255, 102, 0, 0.1);
}

.rover-preview {
    width: 60px;
    height: 40px;
    border-radius: 8px;
}

.rover-label {
    font-size: 12px;
    font-weight: bold;
}

/* Track Select */
.track-screen {
    justify-content: flex-start;
}

.track-layout {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 900px;
}

.track-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    flex: 1;
    min-width: 300px;
}

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

.track-card {
    background: rgba(20, 10, 5, 0.9);
    border: 2px solid #663300;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.track-card:hover, .track-card.selected {
    border-color: #ff6600;
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.4);
    transform: translateY(-3px);
}

.track-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 8px;
}

.track-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    margin-bottom: 5px;
}

.track-info {
    font-size: 11px;
    opacity: 0.7;
}

.settings-panel {
    background: rgba(20, 10, 5, 0.9);
    border: 2px solid #663300;
    border-radius: 15px;
    padding: 25px;
    min-width: 250px;
}

.settings-panel h3 {
    font-family: 'Orbitron', sans-serif;
    color: #ff6600;
    margin-bottom: 20px;
    text-align: center;
}

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

.toggle-btn {
    background: #331100;
    border: 2px solid #663300;
    color: #888;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: #ff6600;
    border-color: #ff6600;
    color: #fff;
}

.lap-count {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    color: #ff6600;
}

.start-button {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    background: linear-gradient(135deg, #ff3300, #ff6600);
    border: none;
    border-radius: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 102, 0, 0.6);
}

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

.loading-text {
    margin-bottom: 30px;
}

.loading-step {
    font-size: 18px;
    margin: 10px 0;
    opacity: 0;
    animation: fade-in 0.5s forwards;
}

.loading-step:nth-child(1) { animation-delay: 0s; }
.loading-step:nth-child(2) { animation-delay: 0.5s; }
.loading-step:nth-child(3) { animation-delay: 1s; }

@keyframes fade-in {
    to { opacity: 1; }
}

.loading-bar {
    width: 300px;
    height: 6px;
    background: #331100;
    border-radius: 3px;
    overflow: hidden;
}

.loading-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff3300, #ff6600);
    animation: loading 1.8s ease-out forwards;
}

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

/* Racing HUD */
.racing-hud {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.racing-hud > * {
    pointer-events: auto;
}

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

.position {
    font-family: 'Orbitron', sans-serif;
    font-size: 36px;
    font-weight: bold;
    color: #ff6600;
    text-shadow: 0 0 20px rgba(255, 102, 0, 0.8);
}

.lap {
    font-size: 18px;
    opacity: 0.8;
}

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

.race-timer {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.checkpoint-info {
    font-size: 14px;
    opacity: 0.7;
}

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

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

.stat-icon {
    font-size: 16px;
}

.stat-bar-mini {
    width: 80px;
    height: 8px;
    background: #331100;
    border-radius: 4px;
    overflow: hidden;
}

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

.stat-bar-mini.health .fill {
    background: linear-gradient(90deg, #ff3333, #33ff33);
}

.stat-bar-mini.battery .fill {
    background: #ffcc00;
}

.speed-display {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    color: #00ffff;
    margin-top: 10px;
}

.hud-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

.powerup-slots {
    display: flex;
    gap: 10px;
}

.powerup-slot {
    width: 50px;
    height: 50px;
    border: 2px solid #663300;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(20, 10, 5, 0.8);
}

.powerup-slot.active {
    border-color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

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

.minimap {
    width: 120px;
    height: 120px;
    background: rgba(20, 10, 5, 0.8);
    border: 2px solid #663300;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.minimap-track {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    border: 2px solid #ff6600;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.minimap-rover {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 5px currentColor;
}

.weather-display {
    position: absolute;
    top: 80px;
    left: 20px;
    display: flex;
    gap: 15px;
    font-size: 14px;
    opacity: 0.8;
}

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

.pause-overlay h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 48px;
    color: #ff6600;
    margin-bottom: 40px;
}

.pause-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pause-menu button {
    padding: 15px 40px;
    background: transparent;
    border: 2px solid #ff6600;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pause-menu button:hover {
    background: #ff6600;
}

/* Results Screen */
.results-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    height: 100%;
    background: rgba(10, 5, 5, 0.9);
}

.results-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(28px, 6vw, 48px);
    color: #ff6600;
    margin-bottom: 40px;
    text-shadow: 0 0 30px rgba(255, 102, 0, 0.5);
}

.results-table {
    background: rgba(20, 10, 5, 0.9);
    border: 2px solid #663300;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 30px;
    width: 90%;
    max-width: 700px;
}

.results-header, .results-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 1fr 1fr;
    padding: 15px 20px;
    gap: 10px;
}

.results-header {
    background: #331100;
    font-weight: bold;
    font-size: 14px;
}

.results-row {
    border-top: 1px solid #331100;
}

.results-row.winner {
    background: rgba(255, 102, 0, 0.2);
}

.awards {
    margin-bottom: 30px;
}

.award {
    font-size: 18px;
    margin: 10px 0;
}

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

.results-actions button {
    padding: 15px 30px;
    background: linear-gradient(135deg, #ff3300, #ff6600);
    border: none;
    border-radius: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.results-actions button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .track-layout {
        flex-direction: column;
    }
    
    .settings-panel {
        width: 100%;
    }
    
    .results-header, .results-row {
        grid-template-columns: 40px 1fr 1fr 1fr;
        font-size: 12px;
        padding: 10px;
    }
    
    .results-header span:last-child,
    .results-row span:last-child {
        display: none;
    }
}