body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #f5576c);
  color: #333;
  min-height: 100vh;
  overflow-x: hidden;
}

header {
  padding: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  text-align: center;
  backdrop-filter: blur(10px);
}

h1 {
  margin: 0;
  font-size: 2.2rem;
  color: #333;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 15px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

main {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.game-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  text-align: center;
}

.hidden {
  display: none !important;
}

/* Mode Selection */
h2 {
  margin-bottom: 30px;
  font-size: 2rem;
  color: #333;
}

.mode-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #ddd;
  border-radius: 15px;
  padding: 30px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mode-btn:hover {
  border-color: #667eea;
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.mode-btn.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.mode-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.mode-btn h3 {
  margin: 10px 0;
  font-size: 1.4rem;
  color: #333;
}

.mode-btn p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

/* Car Selection */
.car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.car-option {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #ddd;
  border-radius: 15px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.car-option:hover {
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.car-option.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.car-preview {
  font-size: 4rem;
  margin-bottom: 10px;
}

.car-name {
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 5px;
  color: #333;
}

.car-stats {
  color: #666;
  font-size: 0.9rem;
}

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

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.btn.primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.8);
  color: #333;
  border: 2px solid #ddd;
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 1);
  border-color: #667eea;
}

/* Advanced Racing Dashboard */
.racing-dashboard {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 20, 0.9));
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.main-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* Speedometer */
.speedometer {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, #1a1a1a, #333);
  border: 4px solid #ff6b6b;
  box-shadow: inset 0 0 30px rgba(255, 107, 107, 0.3), 0 0 20px rgba(255, 107, 107, 0.2);
}

.speed-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 45px;
  background: linear-gradient(to top, #ff6b6b, #fff);
  transform-origin: bottom center;
  transform: translate(-50%, -100%) rotate(0deg);
  transition: transform 0.3s ease;
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
}

.speed-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
}

.speed-value {
  font-size: 1.4rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.speed-unit {
  font-size: 0.6rem;
  opacity: 0.8;
}

/* Race Info Center */
.race-info {
  text-align: center;
  color: white;
}

.position-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-bottom: 10px;
}

.position-number {
  font-size: 3rem;
  font-weight: bold;
  color: #4ecdc4;
  text-shadow: 0 0 20px rgba(78, 205, 196, 0.6);
}

.position-suffix {
  font-size: 1.2rem;
  color: #4ecdc4;
  margin-left: 5px;
}

.lap-info {
  font-size: 0.9rem;
  opacity: 0.9;
}

.race-time {
  font-size: 1.1rem;
  font-weight: bold;
  color: #feca57;
  text-shadow: 0 0 10px rgba(254, 202, 87, 0.5);
}

/* Tachometer (RPM) */
.tachometer {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, #1a1a1a, #333);
  border: 4px solid #4ecdc4;
  box-shadow: inset 0 0 30px rgba(78, 205, 196, 0.3), 0 0 20px rgba(78, 205, 196, 0.2);
}

.rpm-needle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 45px;
  background: linear-gradient(to top, #4ecdc4, #fff);
  transform-origin: bottom center;
  transform: translate(-50%, -100%) rotate(0deg);
  transition: transform 0.3s ease;
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.8);
}

.rpm-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
}

.rpm-value {
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.rpm-unit {
  font-size: 0.6rem;
  opacity: 0.8;
}

/* Secondary Stats */
.secondary-stats {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  border-radius: 10px;
  text-align: center;
  min-width: 80px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Boost Meter */
.boost-meter {
  position: relative;
  min-width: 120px;
}

.boost-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
  margin: 5px 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.boost-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9ff3, #f368e0);
  border-radius: 4px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(243, 104, 224, 0.6);
}

.boost-percentage {
  font-size: 0.8rem;
  color: #f368e0;
  font-weight: bold;
}

/* Timer Container */
.timer-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 15px;
  margin: 20px 0;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.timer-display {
  text-align: center;
  margin-bottom: 15px;
}

.timer-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 5px;
}

.timer-value {
  font-size: 2rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
  transition: color 0.3s ease;
}

.timer-value.warning {
  color: #ff9f00;
  text-shadow: 0 0 10px rgba(255, 159, 0, 0.5);
}

.timer-value.critical {
  color: #ff4757;
  text-shadow: 0 0 15px rgba(255, 71, 87, 0.8);
  animation: pulse 0.5s infinite alternate;
}

.timer-progress {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #81C784);
  border-radius: 10px;
  transition: width 1s ease, background-color 0.5s ease;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.timer-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.control-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Power-ups */
.powerups-display {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin: 20px 0;
}

.powerup-slot {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #ddd;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  min-width: 80px;
}

.powerup-slot.active {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.1);
}

.powerup-icon {
  font-size: 2rem;
  margin-bottom: 5px;
}

.powerup-label {
  font-size: 0.8rem;
  color: #666;
}

/* Advanced 3D Race Track */
.race-track-3d {
  position: relative;
  width: 100%;
  height: 500px;
  background: linear-gradient(180deg, #87CEEB 0%, #4FC3F7 30%, #333 100%);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  perspective: 1000px;
  transform-style: preserve-3d;
}

/* 3D Track Surface */
.track-surface {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 100%;
  background: linear-gradient(to bottom, 
    #2c2c2c 0%, 
    #1a1a1a 50%, 
    #000 100%);
  box-shadow: 
    inset 0 0 50px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(0, 0, 0, 0.8);
  transform-origin: bottom center;
  transform: translateX(-50%) rotateX(1deg);
}

.road-lines {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 10px,
    yellow 10px,
    yellow 30px
  );
  animation: roadMove 0.5s linear infinite;
}

/* Lane Markers */
.lane-markers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 15px,
      rgba(255, 255, 0, 0.8) 15px,
      rgba(255, 255, 0, 0.8) 25px,
      transparent 25px,
      transparent 50px
    );
  animation: laneMove 0.3s linear infinite;
}

.road-center-line {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    #fff 0px,
    #fff 20px,
    transparent 20px,
    transparent 40px
  );
  animation: laneMove 0.3s linear infinite;
}

@keyframes laneMove {
  from { background-position-y: 0px; }
  to { background-position-y: 40px; }
}

/* Advanced Player Car */
.player-car-3d {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  transition: all 0.2s ease;
}

.car-body {
  font-size: 2.5rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
}

.car-shadow {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 20px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.4), transparent);
  border-radius: 50%;
}

.boost-flames {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.2rem;
  animation: flameFlicker 0.1s infinite alternate;
}

@keyframes flameFlicker {
  0% { opacity: 0.8; transform: translateX(-50%) scale(1); }
  100% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

/* AI Racing Cars */
.ai-car {
  position: absolute;
  font-size: 2rem;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  z-index: 8;
}

.ai-car.overtaking {
  animation: overtakeManeuver 2s ease-in-out;
}

@keyframes overtakeManeuver {
  0% { transform: translateX(0); }
  50% { transform: translateX(30px); }
  100% { transform: translateX(0); }
}

/* Track Boundaries */
.track-boundaries {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.left-barrier, .right-barrier {
  position: absolute;
  top: 0;
  width: 10px;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    #ff4757 0px,
    #ff4757 20px,
    #fff 20px,
    #fff 40px
  );
  box-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
}

.left-barrier {
  left: calc(50% - 160px);
}

.right-barrier {
  right: calc(50% - 160px);
}

/* Dynamic Racing Background */
.racing-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.sky-gradient {
  position: absolute;
  top: 0;
  width: 100%;
  height: 60%;
  background: linear-gradient(180deg, #87CEEB 0%, #4FC3F7 100%);
}

.mountains {
  position: absolute;
  top: 40%;
  width: 100%;
  height: 30%;
  background: 
    polygon(0 100%, 10% 60%, 20% 80%, 30% 40%, 45% 70%, 60% 30%, 75% 60%, 85% 45%, 100% 70%, 100% 100%);
  background-color: #666;
  opacity: 0.6;
}

.trees-layer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 40%;
  z-index: 1;
}

.background-tree {
  position: absolute;
  font-size: 1.5rem;
  animation: treeScroll 3s linear infinite;
  opacity: 0.7;
}

@keyframes treeScroll {
  from { transform: translateY(-50px); }
  to { transform: translateY(250px); }
}

.player-car {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  z-index: 10;
  transition: left 0.1s ease;
}

.traffic {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 5;
}

.enemy-car {
  position: absolute;
  font-size: 1.8rem;
  transition: top 0.1s ease;
}

.powerups {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 6;
}

.powerup {
  position: absolute;
  font-size: 1.5rem;
  animation: bounce 1s ease-in-out infinite;
  cursor: pointer;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.scenery {
  position: absolute;
  top: 0;
  width: calc(50% - 100px);
  height: 100%;
  z-index: 1;
}

.scenery.left {
  left: 0;
}

.scenery.right {
  right: 0;
}

.tree {
  position: absolute;
  font-size: 2rem;
  animation: treeMove 2s linear infinite;
}

@keyframes treeMove {
  from { top: -50px; }
  to { top: 450px; }
}

/* Advanced Controls Interface */
.controls-interface {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 15px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Steering Wheel */
.steering-wheel-container {
  text-align: center;
}

.steering-wheel {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, #333, #111);
  border: 4px solid #666;
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease;
  margin: 0 auto 10px;
  cursor: pointer;
}

.steering-wheel:hover {
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.5),
    0 0 25px rgba(78, 205, 196, 0.3);
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  background: #4ecdc4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.wheel-spoke {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 35px;
  background: #666;
  transform-origin: bottom center;
}

.spoke-1 { transform: translate(-50%, -100%) rotate(0deg); }
.spoke-2 { transform: translate(-50%, -100%) rotate(120deg); }
.spoke-3 { transform: translate(-50%, -100%) rotate(240deg); }

.steering-indicator {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.turn-left, .turn-right, .straight {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 1.2rem;
  font-weight: bold;
  transition: all 0.3s ease;
}

.turn-left { color: #ff6b6b; }
.straight { color: #4ecdc4; }
.turn-right { color: #ff6b6b; }

.turn-left.active, .turn-right.active, .straight.active {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 15px currentColor;
}

/* Pedals */
.pedals-container {
  display: flex;
  gap: 15px;
  align-items: end;
}

.pedal {
  width: 50px;
  height: 80px;
  background: linear-gradient(to bottom, #333, #111);
  border-radius: 10px 10px 5px 5px;
  border: 2px solid #666;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.pedal:hover {
  box-shadow: 0 5px 20px rgba(255, 255, 255, 0.1);
}

.pedal.pressed {
  transform: translateY(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.brake-pedal.pressed {
  border-color: #ff6b6b;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.gas-pedal.pressed {
  border-color: #4ecdc4;
  box-shadow: 0 2px 8px rgba(78, 205, 196, 0.3);
}

.pedal-label {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: #ccc;
  font-weight: bold;
}

.pedal-pad {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 35px;
  height: 15px;
  background: #444;
  border-radius: 3px;
}

/* Boost Button */
.boost-button {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, #f368e0, #ff9ff3);
  border: 3px solid #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  box-shadow: 0 0 20px rgba(243, 104, 224, 0.4);
}

.boost-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(243, 104, 224, 0.6);
}

.boost-button.active {
  animation: boostPulse 0.5s ease-in-out infinite alternate;
}

@keyframes boostPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

.boost-label {
  font-size: 0.7rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.boost-ring {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 2px solid transparent;
  border-radius: 50%;
  animation: boostRing 2s linear infinite;
}

@keyframes boostRing {
  0% {
    border-color: transparent;
    transform: scale(1);
  }
  50% {
    border-color: rgba(243, 104, 224, 0.5);
    transform: scale(1.1);
  }
  100% {
    border-color: transparent;
    transform: scale(1);
  }
}

/* Gear Shifter */
.gear-shifter {
  text-align: center;
}

.gear-display {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px;
  border-radius: 10px;
  border: 2px solid #4ecdc4;
  margin-bottom: 10px;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.2);
}

.current-gear {
  font-size: 2rem;
  font-weight: bold;
  color: #4ecdc4;
  text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.gear-label {
  font-size: 0.7rem;
  color: #ccc;
  margin-top: 5px;
}

.gear-stick {
  position: relative;
  width: 20px;
  height: 60px;
  background: linear-gradient(to bottom, #666, #333);
  border-radius: 10px;
  margin: 0 auto;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.gear-knob {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  background: radial-gradient(circle, #4ecdc4, #333);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.result-stats {
  margin: 20px 0;
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.stat-row:last-child {
  border-bottom: none;
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Race Mode Selector */
.race-mode-selector {
  display: flex;
  justify-content: center;
  gap: 15px;
  background: rgba(0, 0, 0, 0.8);
  padding: 15px;
  border-radius: 15px;
  margin: 20px 0;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.mode-tab {
  padding: 12px 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  min-width: 100px;
}

.mode-tab:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(78, 205, 196, 0.5);
}

.mode-tab.active {
  background: linear-gradient(135deg, #4ecdc4, #44a08d);
  border-color: #4ecdc4;
  color: white;
  box-shadow: 0 0 20px rgba(78, 205, 196, 0.4);
}

.tab-icon {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.tab-label {
  font-size: 0.9rem;
  font-weight: bold;
  color: white;
}

/* Race Status Panel */
.race-status-panel {
  display: flex;
  gap: 20px;
  background: rgba(0, 0, 0, 0.8);
  padding: 15px;
  border-radius: 15px;
  margin: 20px 0;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Mini Map */
.mini-map {
  position: relative;
  width: 120px;
  height: 80px;
  background: linear-gradient(to bottom, #333, #111);
  border-radius: 10px;
  border: 2px solid #4ecdc4;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.2);
}

.map-track {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 60px;
  background: #666;
  border-radius: 2px;
}

.map-player {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: #4ecdc4;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(78, 205, 196, 0.8);
}

.map-opponent {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ff6b6b;
  border-radius: 50%;
  transition: all 0.3s ease;
}

/* Leaderboard */
.race-leaderboard {
  flex: 1;
  color: white;
}

.leaderboard-title {
  font-size: 0.9rem;
  font-weight: bold;
  color: #4ecdc4;
  margin-bottom: 10px;
  text-align: center;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  font-size: 0.8rem;
}

.leaderboard-item.player {
  background: rgba(78, 205, 196, 0.2);
  border: 1px solid rgba(78, 205, 196, 0.4);
}

.leader-position {
  font-weight: bold;
  color: #feca57;
}

.leader-name {
  flex: 1;
  text-align: left;
  margin-left: 10px;
}

.leader-time {
  font-family: 'Courier New', monospace;
  color: #4ecdc4;
}

/* Advanced Controls Help */
.advanced-controls-help {
  background: rgba(0, 0, 0, 0.8);
  border-radius: 15px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.help-section {
  color: white;
}

.help-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: #4ecdc4;
  margin-bottom: 15px;
  text-align: center;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.help-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 0.9rem;
}

kbd {
  background: linear-gradient(135deg, #333, #111);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #4ecdc4;
  border: 1px solid #666;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-family: 'Courier New', monospace;
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    padding: 20px;
  }
  
  .ui-top {
    justify-content: center;
  }
  
  .race-track {
    height: 300px;
  }
  
  .road {
    width: 150px;
  }
  
  .controls-info {
    flex-direction: column;
    align-items: center;
  }
  
  .modal-content {
    padding: 30px 20px;
  }
  
  .modal-buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .mode-buttons {
    grid-template-columns: 1fr;
  }
  
  .car-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .timer-controls {
    flex-direction: column;
    align-items: center;
  }
  
  .control-btn {
    width: 100%;
    max-width: 200px;
  }
}