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

body {
    overflow: hidden;
    background: #1a1a2e;
    font-family: 'Segoe UI', Arial, sans-serif;
}

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

#game-container canvas {
    display: block;
}

/* HUD */
#hud {
    position: fixed;
    top: 20px;
    left: 20px;
    color: white;
    z-index: 100;
    pointer-events: none;
}

#gas-container {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
}

#gas-label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
}

#gas-bar {
    width: 200px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
}

#gas-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ffaa44, #44ff44);
    transition: width 0.1s;
}

#stats {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 16px;
}

#stats > div {
    margin: 5px 0;
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.overlay.hidden {
    display: none;
}

.popup-content {
    background: #2a2a4e;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: white;
}

.popup-content h1 {
    font-size: 48px;
    margin-bottom: 30px;
    color: #44ffaa;
}

.popup-content input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    background: #1a1a2e;
    color: white;
}

.popup-content input::placeholder {
    color: #666;
}

#color-picker {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.color-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: white;
    transform: scale(1.15);
}

.popup-content button {
    padding: 15px 60px;
    font-size: 24px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: #44ffaa;
    color: #1a1a2e;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.popup-content button:hover {
    transform: scale(1.05);
    background: #66ffbb;
}

#final-time {
    font-size: 24px;
    margin-bottom: 30px;
}

/* Leaderboard */
#leaderboard {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 10px;
    color: white;
    min-width: 180px;
    z-index: 100;
}

#leaderboard-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #44ffaa;
}

#leaderboard-list {
    font-size: 14px;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.leaderboard-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Joystick */
#joystick-base {
    position: fixed;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    z-index: 150;
    pointer-events: none;
}

#joystick-base.hidden {
    display: none;
}

#joystick-stick {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    #hud {
        top: 10px;
        left: 10px;
    }

    #gas-bar {
        width: 150px;
    }

    #leaderboard {
        top: 10px;
        right: 10px;
        min-width: 140px;
    }

    .popup-content {
        padding: 20px;
        margin: 20px;
    }

    .popup-content h1 {
        font-size: 32px;
    }
}
