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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    color: white;
    min-height: 100vh;
    overflow: hidden;
}

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

header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px #ffd700; }
    to { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 20px #ffd700; }
}

#race-info {
    display: flex;
    gap: 20px;
}

.info-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
}

#menu-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="20">🎄❄️🎅</text></svg>');
}

.menu-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    text-align: center;
    max-width: 800px;
    width: 90%;
}

.menu-content h2 {
    margin-bottom: 30px;
    font-size: 2.5em;
    color: #ffd700;
}

#player-name {
    padding: 15px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    margin-bottom: 30px;
    width: 300px;
    text-align: center;
}

.track-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.track-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.track-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    border-color: #ffd700;
}

.track-card.selected {
    background: rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.track-card h3 {
    margin-bottom: 10px;
    color: #ffd700;
}

.difficulty {
    margin-top: 10px;
    font-size: 0.9em;
    color: #ff6b6b;
}

.vehicle-selection {
    margin: 30px 0;
}

.vehicles {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.vehicle {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.vehicle:hover, .vehicle.selected {
    background: rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
}

button {
    padding: 15px 40px;
    font-size: 18px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    margin: 10px;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

#race-canvas {
    display: block;
    margin: 80px auto 0;
    border: 3px solid #ffd700;
    border-radius: 10px;
    background: #0a0a0a;
}

#controls-info {
    text-align: center;
    margin-top: 10px;
    opacity: 0.8;
}

#race-hud {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meter-label {
    font-size: 12px;
    margin-bottom: 5px;
    text-align: center;
}

#speed-meter, #turbo-meter {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 10px;
    min-width: 150px;
}

#speed-bar, #turbo-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

#speed-bar::before {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #f39c12, #e74c3c);
    width: 0%;
    transition: width 0.1s;
}

#turbo-bar::before {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #3498db, #9b59b6);
    width: 100%;
    transition: width 0.1s;
}

#position {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
}

#result-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
}

.result-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    text-align: center;
    max-width: 600px;
}

#race-result {
    font-size: 3em;
    margin-bottom: 20px;
    animation: resultPulse 2s ease-in-out infinite;
}

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

#final-positions {
    margin: 20px 0;
}

.position-entry {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.position-entry.player {
    background: rgba(255, 215, 0, 0.3);
    border: 2px solid #ffd700;
}

.result-buttons {
    margin-top: 30px;
}

#particles-race {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.race-particle {
    position: absolute;
    font-size: 16px;
    animation: raceParticle linear infinite;
}

@keyframes raceParticle {
    from {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .track-selection {
        grid-template-columns: 1fr;
    }
    
    .vehicles {
        flex-direction: column;
        align-items: center;
    }
    
    #race-canvas {
        width: 95%;
        height: auto;
    }
    
    #race-hud {
        flex-direction: column;
        gap: 10px;
    }
}
