* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #1a1a2e; overflow: hidden; font-family: 'Courier New', monospace; }
#game-canvas { display: block; width: 100vw; height: 100vh; }

/* Split screen divider */
#split-divider {
  position: fixed; top: 0; left: 50%; width: 2px; height: 100%;
  background: rgba(255,255,255,0.3); z-index: 10; pointer-events: none;
}

/* HUD */
#hud {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; user-select: none; z-index: 5;
}
.player-hud {
  position: absolute; top: 14px; padding: 0 16px;
  color: white; text-shadow: 0 0 6px rgba(0,0,0,0.8);
}
#p1-hud { left: 10px; }
#p2-hud { left: calc(50% + 10px); }
.hud-label { font-size: 14px; color: #888; letter-spacing: 2px; }
.lap-display { font-size: 18px; font-weight: bold; letter-spacing: 2px; }
.timer-display { font-size: 15px; margin-top: 2px; color: #aaffaa; }
.speed-display { font-size: 15px; margin-top: 2px; }
.boost-display { font-size: 15px; font-weight: bold; margin-top: 2px; color: #ffff00; text-shadow: 0 0 8px rgba(255,255,0,0.8); letter-spacing: 2px; }
.boost-display.hidden { display: none; }
.item-icon {
  position: absolute; bottom: 16px; left: 16px;
  width: 110px; height: 110px; border-radius: 50%;
  pointer-events: none; z-index: 6;
}
.item-icon-p2 { left: auto; right: 16px; }
.item-icon.hidden { display: none; }

.missile-warn {
  font-size: 16px; font-weight: bold; letter-spacing: 2px;
  color: #ff4444; margin-top: 8px;
  text-shadow: 0 0 10px rgba(255,68,68,0.9);
  animation: warnPulse 0.4s ease-in-out infinite alternate;
}
.missile-warn.hidden { display: none; }
@keyframes warnPulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

#minimap-canvas {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 4px; background: rgba(0,0,0,0.5);
}

/* Event feed */
#event-feed {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; gap: 6px;
  align-items: center; pointer-events: none;
}
.event-msg {
  padding: 6px 14px; border-radius: 4px;
  background: rgba(80,80,80,0.7);
  color: #fff; font-size: 13px; letter-spacing: 1px;
  white-space: nowrap;
  animation: eventFade 3s ease-out forwards;
}
@keyframes eventFade {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* Finish screen */
#finish-screen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: white; z-index: 100;
}
#finish-screen.hidden { display: none; }
#winner-text { font-size: 56px; color: #ffff00; margin-bottom: 16px; letter-spacing: 6px; }
#finish-time { font-size: 28px; color: #aaffaa; margin-bottom: 40px; }
#restart-btn {
  padding: 14px 40px; font-size: 20px; font-family: 'Courier New', monospace;
  background: #ff8800; border: none; color: black; font-weight: bold;
  cursor: pointer; letter-spacing: 2px; pointer-events: all;
}
#restart-btn:hover { background: #ffaa00; }

/* Start overlay */
#start-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,10,0.88);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: white; cursor: pointer; z-index: 100;
}
#start-overlay h1 { font-size: 72px; letter-spacing: 10px; color: #ffff00; margin-bottom: 24px; }
#start-overlay p { font-size: 22px; color: #aaaaaa; margin: 6px 0; }
#start-overlay .controls { font-size: 16px; color: #666; margin-top: 18px; }
#start-overlay.hidden { display: none; }
#mode-select { display: flex; gap: 24px; margin-bottom: 12px; }
.mode-btn {
  padding: 16px 36px; font-size: 22px; font-family: 'Courier New', monospace;
  font-weight: bold; letter-spacing: 3px; border: 2px solid #888;
  background: rgba(255,255,255,0.08); color: #fff;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.mode-btn:hover { background: rgba(255,136,0,0.3); border-color: #ff8800; color: #ffcc00; }

/* Difficulty select */
#difficulty-select {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,10,0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: white; z-index: 102;
}
#difficulty-select.hidden { display: none; }
#difficulty-select h2 { font-size: 38px; letter-spacing: 6px; color: #ffff00; margin-bottom: 24px; }
#diff-buttons { display: flex; gap: 16px; margin-bottom: 18px; }
.diff-btn {
  padding: 14px 28px; font-size: 18px; font-family: 'Courier New', monospace;
  font-weight: bold; letter-spacing: 2px; border: 2px solid #555;
  background: rgba(255,255,255,0.06); color: #aaa;
  cursor: pointer; transition: all 0.15s;
}
.diff-btn:hover { border-color: #ff8800; color: #fff; }
.diff-btn.diff-selected { border-color: #ffcc00; color: #ffff00; background: rgba(255,204,0,0.15); }
.diff-btn.diff-nightmare { color: #ff4444; }
.diff-btn.diff-nightmare.diff-selected { border-color: #ff2222; color: #ff2222; background: rgba(255,34,34,0.15); }
.diff-desc { font-size: 16px; color: #999; margin-bottom: 16px; min-height: 20px; }

/* Map select */
#map-select {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,10,0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: white; z-index: 101;
}
#map-select.hidden { display: none; }
#map-select h2 { font-size: 38px; letter-spacing: 6px; color: #ffff00; margin-bottom: 24px; }
#map-buttons { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; justify-content: center; }

/* Car selection */
#car-select {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,10,0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: white; z-index: 105;
}
#car-select.hidden { display: none; }
#car-select h2 { font-size: 38px; letter-spacing: 6px; color: #ffff00; margin-bottom: 8px; }
#select-timer { font-size: 64px; color: #ff8800; font-weight: bold; margin-bottom: 20px; }
.select-hint { font-size: 16px; color: #888; margin-bottom: 16px; letter-spacing: 2px; }
#select-panels { display: flex; gap: 60px; }
.select-panel {
  width: 260px; padding: 20px; border: 2px solid #444;
  border-radius: 10px; background: rgba(255,255,255,0.05);
  text-align: center;
}
.player-label { font-size: 22px; font-weight: bold; letter-spacing: 3px; margin-bottom: 4px; }
.select-keys { font-size: 13px; color: #888; margin-bottom: 14px; }
.select-preview {
  width: 100%; height: 50px; border-radius: 6px; margin-bottom: 10px;
}
.select-car-name { font-size: 22px; font-weight: bold; letter-spacing: 3px; margin-bottom: 4px; }
.select-car-desc { font-size: 12px; color: #999; margin-bottom: 12px; }
.select-stats { display: flex; flex-direction: column; gap: 5px; text-align: left; }
.stat-row {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  letter-spacing: 1px; color: #ccc;
}
.stat-row span { width: 65px; text-align: right; }
.stat-bar { flex: 1; height: 8px; background: #333; border-radius: 4px; overflow: hidden; }
.stat-fill { height: 100%; border-radius: 4px; }
#p1-panel .stat-fill { background: #ff6666; }
#p2-panel .stat-fill { background: #6688ff; }

/* Countdown */
#countdown {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px; font-weight: bold; font-family: 'Courier New', monospace;
  color: #ffff00;
  text-shadow: 0 0 20px rgba(255,255,0,0.9), 0 0 50px rgba(255,200,0,0.5);
  z-index: 110; pointer-events: none; letter-spacing: 4px;
}
#countdown.hidden { display: none; }
