* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #000; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; color: #fff; }
canvas { display: block; }

/* Menu */
#menu-screen {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(135deg, #0a0a2e 0%, #1a1a4e 50%, #0a0a2e 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
}
#menu-screen h1 {
  font-size: 3em; letter-spacing: 6px;
  background: linear-gradient(90deg, #00d4ff, #7b2ff7, #00d4ff);
  background-size: 200%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: shimmer 3s infinite linear;
}
@keyframes shimmer { 0%{background-position:200%} 100%{background-position:-200%} }
.subtitle { color: #88a; font-size: 1.2em; }

#vehicle-selection { display: flex; gap: 20px; margin: 20px 0; }
.vehicle-card {
  width: 200px; padding: 20px; border: 2px solid #334; border-radius: 12px;
  background: rgba(255,255,255,0.05); cursor: pointer; transition: all 0.3s;
  text-align: center;
}
.vehicle-card:hover { border-color: #00d4ff; background: rgba(0,212,255,0.1); }
.vehicle-card.selected { border-color: #00d4ff; background: rgba(0,212,255,0.15); box-shadow: 0 0 20px rgba(0,212,255,0.3); }
.vehicle-icon { font-size: 3em; margin-bottom: 10px; }
.vehicle-card h3 { margin-bottom: 12px; }
.stats { text-align: left; }
.stat { margin: 6px 0; }
.stat span { font-size: 0.75em; color: #99b; }
.bar { height: 6px; background: #223; border-radius: 3px; margin-top: 2px; }
.fill { height: 100%; background: linear-gradient(90deg, #00d4ff, #7b2ff7); border-radius: 3px; }

#start-btn {
  padding: 15px 60px; font-size: 1.3em; font-weight: bold; letter-spacing: 3px;
  border: none; border-radius: 8px; cursor: pointer;
  background: linear-gradient(90deg, #00d4ff, #7b2ff7); color: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}
#start-btn:hover { transform: scale(1.05); box-shadow: 0 0 30px rgba(0,212,255,0.5); }
.controls-hint { color: #556; font-size: 0.9em; margin-top: 10px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#speedometer {
  position: absolute; bottom: 20px; left: 20px;
  width: 200px; height: 200px; text-align: center;
}
#speed-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -30%);
  font-size: 3em; font-weight: bold;
  text-shadow: 0 0 10px rgba(0,212,255,0.8);
}
#speed-unit { position: absolute; top: 65%; left: 50%; transform: translateX(-50%); font-size: 0.9em; color: #88a; }
#gear-display {
  position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%);
  font-size: 1.6em; font-weight: bold; color: #0f0;
}

#indicators {
  position: absolute; bottom: 20px; left: 230px;
}
#rpm-bar {
  width: 200px; height: 14px; background: #112; border-radius: 7px;
  border: 1px solid #334; overflow: hidden; margin-bottom: 8px;
}
#rpm-fill {
  height: 100%; width: 0%; border-radius: 7px;
  background: linear-gradient(90deg, #0f0, #ff0, #f00);
  transition: width 0.1s;
}
#indicator-lights { display: flex; gap: 8px; }
.light {
  padding: 4px 10px; border-radius: 4px; font-size: 0.75em; font-weight: bold;
  background: #222; color: #444; border: 1px solid #333;
}
.light.active { color: #fff; }
#light-brake.active { background: #f00; }
#light-reverse.active { background: #ff0; color: #000; }
#light-headlight.active { background: #0af; }

#minimap-container {
  position: absolute; top: 20px; right: 20px;
  width: 180px; height: 180px;
  border: 2px solid #334; border-radius: 8px;
  background: rgba(0,0,0,0.7); overflow: hidden;
}
#minimap { width: 100%; height: 100%; }

#camera-mode {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  padding: 8px 20px; background: rgba(0,0,0,0.6); border-radius: 20px;
  font-size: 0.9em; color: #aac; border: 1px solid #334;
}

#controls-panel {
  position: absolute; bottom: 20px; right: 20px;
  padding: 12px 16px; background: rgba(0,0,0,0.7);
  border: 1px solid #334; border-radius: 10px;
  font-size: 0.8em; line-height: 1.8; color: #ccd;
}
.controls-title { font-weight: bold; font-size: 0.9em; color: #00d4ff; margin-bottom: 4px; letter-spacing: 2px; }
.control-row { white-space: nowrap; }
.control-row kbd {
  display: inline-block; min-width: 22px; text-align: center;
  padding: 1px 6px; background: #223; border: 1px solid #445;
  border-radius: 4px; font-family: inherit; font-size: 0.9em; color: #fff;
}

/* Loading */
#loading {
  position: fixed; inset: 0; z-index: 200;
  background: #0a0a2e;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}
.loader {
  width: 50px; height: 50px; border: 4px solid #223;
  border-top-color: #00d4ff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
