* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  background: #000;
  font-family: 'Orbitron', sans-serif;
  color: #fff;
  user-select: none;
}

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

#scene-container canvas {
  display: block;
}

/* START SCREEN */
#start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: linear-gradient(135deg, rgba(0,0,0,0.85) 0%, rgba(10,15,30,0.9) 100%);
  backdrop-filter: blur(4px);
}

#start-content {
  text-align: center;
  animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

#game-title {
  font-size: clamp(36px, 8vw, 80px);
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(135deg, #00f0ff, #0080ff, #ff4060);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(0,200,255,0.3));
  margin-bottom: 8px;
}

#game-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(10px, 2vw, 14px);
  font-weight: 300;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 40px;
  text-transform: uppercase;
}

#settings {
  margin-bottom: 40px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-group label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
}

.toggle-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.toggle-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5);
  padding: 8px 20px;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: rgba(0,200,255,0.15);
  border-color: #00c8ff;
  color: #00f0ff;
}

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

.color-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.color-btn.active {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

#start-prompt {
  font-size: clamp(12px, 2.5vw, 18px);
  letter-spacing: 4px;
  animation: pulse 2s ease-in-out infinite;
  color: #00f0ff;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

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

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

#distance-counter {
  position: absolute;
  top: 15px;
  left: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #00f0ff;
  background: rgba(0,0,0,0.5);
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid rgba(0,200,255,0.2);
}

#fps-counter {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}

#minimap-container {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 140px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0,200,255,0.3);
  background: rgba(0,10,20,0.7);
}

#minimap {
  display: block;
}

#speed-panel {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  background: rgba(0,0,0,0.6);
  padding: 12px 30px 15px;
  border-radius: 8px;
  border: 1px solid rgba(0,200,255,0.2);
  min-width: 200px;
}

#rpm-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

#rpm-bar {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: #00ff88;
  transition: width 0.05s, background 0.2s;
}

#rpm-label {
  position: absolute;
  right: 0;
  top: -16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.35);
}

#speed-readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

#speed-value {
  font-size: 48px;
  font-weight: 900;
  color: #00f0ff;
  line-height: 1;
  letter-spacing: -2px;
}

#speed-unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

#gear-indicator {
  font-size: 20px;
  font-weight: 700;
  color: #ff4060;
  margin-top: 4px;
  letter-spacing: 2px;
}

/* Controls Overlay */
#controls-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#controls-panel {
  background: rgba(10,15,30,0.95);
  border: 1px solid rgba(0,200,255,0.3);
  border-radius: 10px;
  padding: 30px 40px;
  max-width: 400px;
  width: 90%;
}

#controls-panel h2 {
  font-size: 22px;
  letter-spacing: 4px;
  color: #00f0ff;
  margin-bottom: 20px;
  text-align: center;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.key {
  color: #00f0ff;
  font-weight: 700;
  background: rgba(0,200,255,0.1);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
}

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

#touch-left {
  position: absolute;
  left: 10px;
  bottom: 80px;
  width: 130px;
  height: 130px;
  pointer-events: auto;
}

#touch-joystick-area {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#touch-joystick-base {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(0,200,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#touch-joystick-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,200,255,0.4);
  border: 2px solid #00c8ff;
  position: absolute;
}

#touch-right {
  position: absolute;
  right: 15px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.touch-btn {
  width: 70px;
  height: 50px;
  border-radius: 8px;
  border: 2px solid rgba(0,200,255,0.4);
  background: rgba(0,200,255,0.15);
  color: #00f0ff;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  -webkit-touch-callout: none;
}

.touch-btn:active {
  background: rgba(0,200,255,0.4);
}

.small-btn {
  height: 36px;
  font-size: 10px;
}

#touch-gas {
  border-color: rgba(0,255,136,0.5);
  background: rgba(0,255,136,0.15);
  color: #00ff88;
}

#touch-brake {
  border-color: rgba(255,64,96,0.5);
  background: rgba(255,64,96,0.15);
  color: #ff4060;
}

/* Remix Link */
#remix-link {
  position: fixed;
  bottom: 8px;
  right: 12px;
  z-index: 200;
  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;
}

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

@media (max-width: 600px) {
  #speed-panel {
    bottom: 210px;
    padding: 8px 20px 10px;
    min-width: 160px;
  }
  #speed-value { font-size: 36px; }
  #minimap-container { width: 100px; height: 100px; }
  #minimap { width: 100px; height: 100px; }
  #distance-counter { font-size: 13px; }
}