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

body {
  overflow: hidden;
  background: #0a0a0a;
  font-family: 'Orbitron', sans-serif;
}

#scene-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

#scene-container canvas {
  display: block;
}

/* START SCREEN */
#start-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at center bottom, #1a1a2e 0%, #0a0a0a 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.8s ease;
}

#start-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.start-content {
  text-align: center;
  max-width: 600px;
  padding: 20px;
}

.title-glow {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(48px, 12vw, 96px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px rgba(230, 57, 70, 0.8), 0 0 80px rgba(230, 57, 70, 0.4), 0 0 120px rgba(230, 57, 70, 0.2);
  letter-spacing: 8px;
  margin-bottom: 12px;
  animation: pulse-glow 2s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
  from { text-shadow: 0 0 40px rgba(230, 57, 70, 0.8), 0 0 80px rgba(230, 57, 70, 0.4); }
  to { text-shadow: 0 0 60px rgba(230, 57, 70, 1), 0 0 120px rgba(230, 57, 70, 0.6), 0 0 200px rgba(230, 57, 70, 0.3); }
}

.tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(11px, 2vw, 16px);
  color: rgba(255,255,255,0.5);
  font-weight: 300;
  letter-spacing: 3px;
  margin-bottom: 36px;
  text-transform: uppercase;
}

.color-picker {
  margin-bottom: 30px;
}

.color-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
  display: block;
  margin-bottom: 12px;
}

.color-options {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  transform: scale(1);
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 15px rgba(255,255,255,0.4);
  transform: scale(1.2);
}

#start-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #e63946 0%, #c1121f 100%);
  border: none;
  padding: 16px 48px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 4px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  margin-bottom: 24px;
}

#start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(230, 57, 70, 0.5);
}

.controls-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.records-display {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 1px;
}

/* HUD */
#hud {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

#controls-help {
  position: absolute;
  top: 16px;
  left: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.4);
  padding: 8px 14px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  opacity: 1;
  transition: opacity 1s ease;
  backdrop-filter: blur(4px);
}

#controls-help.faded {
  opacity: 0;
}

#minimap-container {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0,0,0,0.6);
  border-radius: 8px;
  padding: 4px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1);
}

#minimap {
  display: block;
  border-radius: 6px;
}

#hud-bottom {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 20px;
}

#rpm-bar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rpm-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
}

#rpm-bar-bg {
  width: 16px;
  height: 100px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(4px);
}

#rpm-bar-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(to top, #2a9d8f, #f4a261, #e63946);
  border-radius: 0 0 7px 7px;
  transition: height 0.05s linear;
}

#speedo-container {
  text-align: center;
  background: rgba(0,0,0,0.5);
  border-radius: 12px;
  padding: 10px 24px 14px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  min-width: 200px;
  position: relative;
}

#speedo-arc {
  display: block;
  margin: 0 auto -10px;
}

#speed-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 48px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  transition: color 0.2s ease;
}

#speed-units {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2px;
}

#speed-mph {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 1px;
  margin-top: 2px;
}

#gear-display {
  position: absolute;
  top: 10px;
  right: 16px;
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
}

#stats-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  padding: 10px 14px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.08);
}

.stat-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1px;
}

.stat-row span:last-child {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
}

#milestone-flash {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(24px, 6vw, 48px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 30px rgba(230, 57, 70, 0.8), 0 0 60px rgba(244, 162, 97, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
  letter-spacing: 6px;
  pointer-events: none;
}

#milestone-flash.show {
  opacity: 1;
  animation: milestone-anim 2s ease-out forwards;
}

@keyframes milestone-anim {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  30% { transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1) translateY(-30px); }
}

#footer-link {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
}

#footer-link a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  text-decoration: none;
  letter-spacing: 1px;
  transition: color 0.2s;
}

#footer-link a:hover {
  color: rgba(255,255,255,0.5);
}

/* Mobile touch controls */
#touch-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 200px;
  z-index: 20;
  pointer-events: none;
}

@media (max-width: 768px) {
  #hud-bottom { bottom: 180px; transform: translateX(-50%) scale(0.8); }
  #minimap-container { transform: scale(0.7); transform-origin: top right; }
}