.hud {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ── Top-left: Lap counter ── */
.hud-lap {
    position: absolute;
    top: 16px;
    left: 20px;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* ── Top-right: Leaderboard ── */
.hud-leaderboard {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 140px;
}

.leaderboard-row {
    display: flex;
    gap: 8px;
    padding: 2px 0;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.leaderboard-row:first-child {
    color: #ffd700;
}

.lb-pos {
    min-width: 24px;
}

.lb-name {
    white-space: nowrap;
}

/* ── Center: Power-up slot ── */
.hud-powerup-slot {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border: 3px solid #fff;
    border-radius: 12px;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    color: #fff;
}

/* ── Bottom-left: Energy bar + label ── */
.hud-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

.hud-energy-label {
    font-size: 14px;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    margin-bottom: 4px;
}

.hud-energy-bar {
    width: 200px;
    height: 20px;
    background: rgba(0,0,0,0.6);
    border: 2px solid #fff;
    border-radius: 10px;
    overflow: hidden;
}

.hud-energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #00cc00, #44ff44);
    transition: width 0.3s;
    border-radius: 8px;
}

.hud-energy-fill.low {
    background: linear-gradient(90deg, #cc0000, #ff4444);
    animation: pulse-energy 0.5s infinite alternate;
}

@keyframes pulse-energy {
    from { opacity: 0.6; }
    to { opacity: 1.0; }
}

.hud-energy-fill.medium {
    background: linear-gradient(90deg, #ccaa00, #ffdd44);
}

/* ── Bottom-right: Speed (above minimap) ── */
.hud-speed {
    position: absolute;
    bottom: 228px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* ── Center-top: Pit zone indicator ── */
.hud-pit-indicator {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    padding: 6px 18px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    background: rgba(0, 180, 0, 0.5);
    border: 2px solid #00cc00;
    color: #fff;
}

.hud-pit-indicator.approaching {
    background: rgba(200, 150, 0, 0.5);
    border-color: #ffaa00;
    animation: pulse-energy 0.5s infinite alternate;
}

.hud-pit-indicator.refueling {
    background: rgba(0, 180, 0, 0.6);
    border-color: #00ff44;
}

/* ── Countdown overlay ── */
.countdown-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    font-weight: bold;
    text-shadow: 4px 4px 8px rgba(0,0,0,0.8);
    color: #fff;
    z-index: 100;
}
