/* PASTE YOUR EXISTING CSS HERE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    height: 100vh;
    color: white;
}

.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(90deg, rgba(0,0,0,0.9) 0%, rgba(20,20,40,0.9) 100%);
    backdrop-filter: blur(15px);
    border-bottom: 2px solid rgba(255,255,255,0.1);
    height: 70px;
    z-index: 100;
}

.race-info {
    display: flex;
    gap: 25px;
    align-items: center;
}

.player-score {
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%);
    padding: 10px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 14px;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.lap-counter {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    padding: 10px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.game-controls {
    display: flex;
    gap: 10px;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}
.btn:disabled {
    background: linear-gradient(135deg, #555 0%, #777 100%);
    cursor: not-allowed;
    opacity: 0.7;
}


.btn.secondary {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.btn.danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    position: relative;
    overflow: hidden;
}

canvas {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    background: #001a00;
    max-width: 100%;
    max-height: 100%;
}

.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(10px);
}

.menu-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    color: white;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    max-width: 500px;
}

.menu-content h2 {
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.menu-content p {
    font-size: 18px;
    margin-bottom: 25px;
    opacity: 0.9;
}

.menu-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.settings-panel {
    position: fixed;
    top: 80px;
    right: -400px;
    width: 380px;
    background: linear-gradient(135deg, rgba(0,0,0,0.95) 0%, rgba(20,20,40,0.95) 100%);
    color: white;
    padding: 25px;
    border-radius: 25px 0 0 25px;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.settings-panel.show {
    right: 0;
}

.settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    margin-bottom: 12px;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}
.control-item span:last-child {
    color: #aaa;
}

.minimap {
    position: absolute;
    top: 90px;
    left: 20px;
    width: 150px;
    height: 120px;
    background: rgba(0,0,0,0.7);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    overflow: hidden;
}
#minimapCanvas {
    width: 100%;
    height: 100%;
}

.speed-meter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(0,0,0,0.8) 0%, rgba(20,20,40,0.9) 100%);
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    backdrop-filter: blur(10px);
    color: #fff;
}
.speed-meter small {
    font-size: 12px;
    font-weight: normal;
    color: #ccc;
}


.power-up-display {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
}

.power-up-item {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
    color: white;
    text-shadow: 0 0 5px black;
}
.power-up-item.empty {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.3);
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 8px 16px rgba(0,0,0,0.8);
    z-index: 180;
    opacity: 0;
    transition: all 0.3s ease;
}

.countdown.show {
    opacity: 1;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
@keyframes countdownPulseFinal {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.countdown.final.show {
    animation: countdownPulseFinal 1s ease-in-out;
}

/* Game Mode Selector - Not used for P2P game mode selection, can be removed or repurposed */
.game-mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.mode-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.3);
    border-color: rgba(255,255,255,0.4);
}

.mode-card.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #fff;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.mode-card h4 {
    font-size: 18px;
    margin-bottom: 8px;
}

.mode-card p {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 0;
}