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

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 9999;
}

#loading h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

/* Menu Styles */
#menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10;
    pointer-events: auto;
}

#menu h1 {
    color: white;
    font-size: 3em;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.menu-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    margin: 15px 0;
    width: 90%;
    max-width: 800px;
    backdrop-filter: blur(10px);
}

.menu-section h2 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.car-select, .track-select {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.car-option, .track-option {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.car-option:hover, .track-option:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.car-option.selected, .track-option.selected {
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid white;
}

.car-preview {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.car-option p, .track-option h3 {
    color: white;
    margin: 10px 0;
    font-weight: bold;
}

.car-option small, .track-option p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
}

.controls-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    max-width: 600px;
    text-align: center;
}

.controls-info h3, .controls-info p {
    color: white;
    margin: 5px 0;
}

.btn-primary, .btn-secondary {
    padding: 15px 40px;
    font-size: 1.2em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin: 10px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #FF6B6B, #FF5252);
    color: white;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 82, 82, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Game Styles */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

#game {
    z-index: 1;
    pointer-events: none;
}

#game.active {
    pointer-events: auto;
}

#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    color: white;
    font-family: monospace;
}

.hud-top {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 0 20px;
}

.hud-item {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1.2em;
    backdrop-filter: blur(5px);
}

.label {
    color: #FFD700;
    margin-right: 5px;
}

.hud-bottom {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
}

.speedometer {
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 30px;
    border-radius: 15px;
    text-align: center;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.speed-label {
    font-size: 0.9em;
    color: #FFD700;
    margin-bottom: 5px;
}

.speed-value {
    font-size: 3em;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.speed-unit {
    font-size: 1em;
    color: #FFD700;
    margin-top: 5px;
}

#minimap {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    backdrop-filter: blur(5px);
}

#pauseMenu, #finishScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    pointer-events: auto;
    min-width: 400px;
}

#pauseMenu h2, #finishScreen h2 {
    color: white;
    margin-bottom: 30px;
    font-size: 2em;
}

#results {
    color: white;
    margin: 20px 0;
    font-size: 1.2em;
    line-height: 1.8;
}

#results .result-item {
    margin: 10px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

#results .highlight {
    color: #FFD700;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    #menu h1 {
        font-size: 2em;
    }
    
    .car-select, .track-select {
        flex-direction: column;
    }
    
    .hud-top {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .speedometer {
        padding: 15px 20px;
    }
    
    .speed-value {
        font-size: 2em;
    }
    
    #minimap {
        width: 100px;
        height: 100px;
    }
}
