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

body {
  background: #0a0a0f;
  overflow: hidden;
  font-family: 'Orbitron', monospace;
  color: #fff;
}

#gameCanvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#ui-overlay > * {
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hud-left, .hud-center, .hud-right {
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 0, 128, 0.5);
  border-radius: 8px;
  padding: 10px 15px;
}

.lap-counter {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ff0080;
  text-shadow: 0 0 10px #ff0080;
}

.lap-times {
  margin-top: 5px;
}

.lap-time {
  font-size: 1.5rem;
  font-weight: 900;
  color: #00ffff;
  text-shadow: 0 0 15px #00ffff;
}

.best-lap {
  font-size: 0.8rem;
  color: #ff00ff;
  margin-top: 3px;
}

.delta-display {
  font-size: 2rem;
  font-weight: 900;
}

.delta-ahead {
  color: #00ff00;
  text-shadow: 0 0 20px #00ff00;
}

.delta-behind {
  color: #ff3333;
  text-shadow: 0 0 20px #ff3333;
}

.speed-display {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffff00;
  text-shadow: 0 0 10px #ffff00;
}

/* Menu Screen */
#menu-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 15, 0.9);
}

.menu-container {
  text-align: center;
  max-width: 600px;
  padding: 30px;
}

.game-title {
  font-size: 3.5rem;
  font-weight: 900;
  color: #ff0080;
  text-shadow: 0 0 30px #ff0080, 0 0 60px #ff0080;
  margin-bottom: 20px;
  letter-spacing: 0.2em;
}

.goal-text {
  font-size: 1.1rem;
  color: #00ffff;
  text-shadow: 0 0 10px #00ffff;
  margin-bottom: 30px;
}

.track-ladder {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.track-card {
  background: rgba(20, 20, 30, 0.8);
  border: 3px solid #333;
  border-radius: 12px;
  padding: 20px;
  width: 160px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.track-card:hover:not(.locked) {
  border-color: #ff0080;
  box-shadow: 0 0 20px rgba(255, 0, 128, 0.5);
  transform: translateY(-5px);
}

.track-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.track-card.locked::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
}

.track-card.unlocked {
  border-color: #00ff00;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.track-card.selected {
  border-color: #00ffff;
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.6);
}

.track-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.track-gold {
  font-size: 0.75rem;
  color: #ffd700;
  margin-bottom: 5px;
}

.track-best {
  font-size: 0.7rem;
  color: #00ffff;
}

.locked .track-name,
.locked .track-gold,
.locked .track-best {
  visibility: hidden;
}

.controls-info {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
}

.control-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 10px;
  font-size: 0.85rem;
  color: #aaa;
}

.key {
  background: rgba(255, 0, 128, 0.3);
  border: 1px solid #ff0080;
  border-radius: 4px;
  padding: 2px 8px;
  color: #ff0080;
  font-weight: 700;
}

/* Countdown */
#countdown-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 15, 0.7);
}

.countdown {
  font-size: 8rem;
  font-weight: 900;
  color: #ff0080;
  text-shadow: 0 0 50px #ff0080, 0 0 100px #ff0080;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Pause Screen */
#pause-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 15, 0.85);
}

.pause-container {
  text-align: center;
  background: rgba(20, 20, 30, 0.9);
  border: 3px solid #ff0080;
  border-radius: 16px;
  padding: 40px;
}

.pause-container h2 {
  font-size: 2.5rem;
  color: #ff0080;
  text-shadow: 0 0 20px #ff0080;
  margin-bottom: 30px;
}

.menu-btn {
  display: block;
  width: 200px;
  margin: 15px auto;
  padding: 15px 30px;
  font-family: 'Orbitron', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 0, 128, 0.3), rgba(0, 255, 255, 0.3));
  border: 2px solid #ff0080;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.menu-btn:hover {
  background: linear-gradient(135deg, rgba(255, 0, 128, 0.5), rgba(0, 255, 255, 0.5));
  box-shadow: 0 0 20px rgba(255, 0, 128, 0.5);
  transform: scale(1.05);
}

/* Finish Screen */
#finish-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 15, 0.9);
}

.finish-container {
  text-align: center;
  background: rgba(20, 20, 30, 0.95);
  border: 3px solid #00ffff;
  border-radius: 16px;
  padding: 40px;
  min-width: 350px;
}

.finish-container h2 {
  font-size: 2rem;
  color: #00ffff;
  text-shadow: 0 0 20px #00ffff;
  margin-bottom: 25px;
}

.finish-times {
  margin-bottom: 20px;
}

.finish-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.finish-row span:first-child {
  color: #aaa;
}

.finish-row span:last-child {
  font-weight: 700;
}

.finish-message {
  font-size: 1.3rem;
  font-weight: 700;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 8px;
}

.finish-message.success {
  color: #00ff00;
  background: rgba(0, 255, 0, 0.1);
  border: 2px solid #00ff00;
}

.finish-message.failure {
  color: #ff3333;
  background: rgba(255, 51, 51, 0.1);
  border: 2px solid #ff3333;
}

/* Champion Screen */
#champion-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #1a0a2e 0%, #0a1a2e 50%, #0a2a1a 100%);
}

.champion-container {
  text-align: center;
  background: rgba(0, 0, 0, 0.8);
  border: 4px solid #ffd700;
  border-radius: 20px;
  padding: 50px;
  min-width: 400px;
}

.champion-title {
  font-size: 3rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 30px #ffd700, 0 0 60px #ffd700;
  margin-bottom: 10px;
}

.champion-subtitle {
  font-size: 1.2rem;
  color: #00ffff;
  margin-bottom: 30px;
}

.career-times {
  margin-bottom: 30px;
}

.career-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 25px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 10px;
}

.career-row span:first-child {
  color: #fff;
  font-weight: 700;
}

.career-row span:last-child {
  color: #ffd700;
  font-weight: 900;
}

/* Touch Controls */
#touch-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
}

.touch-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.touch-row {
  display: flex;
  gap: 5px;
}

.touch-btn {
  width: 60px;
  height: 60px;
  background: rgba(255, 0, 128, 0.3);
  border: 2px solid #ff0080;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  color: #fff;
  user-select: none;
  touch-action: manipulation;
}

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

.touch-actions {
  display: flex;
  gap: 10px;
}

.touch-hb {
  width: 80px;
  background: rgba(255, 255, 0, 0.3);
  border-color: #ffff00;
  font-size: 0.9rem;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .countdown {
    animation: none;
  }
  
  .menu-btn:hover {
    transform: none;
  }
  
  .track-card:hover:not(.locked) {
    transform: none;
  }
}
