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

body {
  font-family: 'Arial', sans-serif;
  background: radial-gradient(circle at top, #0a0a0f, #050505);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  touch-action: none;
}

.hidden { display: none !important; }

/* Splash Screen */
.splash-screen {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(20, 20, 40, 0.95);
  padding: 60px 40px;
  border-radius: 20px;
  box-shadow: 0 0 40px cyan, 0 0 80px rgba(0,255,255,0.5);
  z-index: 1000;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 40px cyan, 0 0 80px rgba(0,255,255,0.5); }
  50% { box-shadow: 0 0 60px magenta, 0 0 100px rgba(255,0,255,0.5); }
}

.splash-screen h1 {
  font-size: 56px;
  color: cyan;
  text-shadow: 0 0 20px cyan, 0 0 40px magenta;
  margin-bottom: 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.splash-screen .subtitle {
  color: #aaa;
  font-size: 18px;
  margin-bottom: 30px;
  letter-spacing: 2px;
}

/* Container */
.game-container {
  max-width: 100%;
  width: 100%;
  text-align: center;
  padding: 11px;
}

/* Scoreboard */
.score-board {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.score-item {
  background: rgba(0, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid cyan;
  box-shadow: 0 0 15px rgba(0,255,255,0.3);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.score-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0,255,255,0.5);
}

.score-item strong {
  color: cyan;
  font-size: 20px;
  margin-left: 5px;
}

/* Canvas */
.canvas-wrapper { 
  margin: 20px auto; 
  position: relative;
  display: inline-block;
  max-width: 100%;
}

canvas {
  border: 4px solid magenta;
  border-radius: 15px;
  background: #111;
  box-shadow: 0 0 40px magenta, 0 0 20px cyan inset;
  max-width: 100%;
  height: auto;
  display: block;
}

/* Speedometer */
.speedometer {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 3px solid cyan;
  border-radius: 15px;
  padding: 15px 20px;
  text-align: center;
  box-shadow: 0 0 20px cyan;
  backdrop-filter: blur(10px);
}

.speed-text {
  font-size: 12px;
  color: #aaa;
  letter-spacing: 2px;
}

.speed-value {
  font-size: 36px;
  font-weight: bold;
  color: cyan;
  text-shadow: 0 0 10px cyan;
  margin: 5px 0;
}

.speed-unit {
  font-size: 14px;
  color: #aaa;
}

/* Powerup Notification */
.powerup-notification {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 255, 255, 0.95);
  color: #000;
  padding: 15px 30px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 18px;
  box-shadow: 0 0 30px cyan;
  animation: slideDown 0.3s ease;
  z-index: 10;
}

@keyframes slideDown {
  from { transform: translateX(-50%) translateY(-100%); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Info */
.game-info {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 15px 0;
  font-size: 16px;
  flex-wrap: wrap;
}

.info-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.info-item span:last-child {
  color: cyan;
  font-weight: bold;
  margin-left: 5px;
}

.heart {
  display: inline-block;
  transition: all 0.3s ease;
}

/* Controls */
.controls {
  margin: 15px 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: #aaa;
}

/* Buttons */
.btn-primary, .btn-secondary {
  padding: 15px 40px;
  font-size: 18px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-weight: bold;
  margin: 10px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary {
  background: linear-gradient(90deg, cyan, magenta);
  color: #fff;
  box-shadow: 0 0 20px cyan;
}

.btn-primary:hover { 
  box-shadow: 0 0 40px magenta; 
  transform: scale(1.05);
}

.btn-primary:active {
  transform: scale(0.95);
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 2px solid #aaa;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.2);
  border-color: cyan;
}

/* Menus */
.menu {
  position: fixed;
  top: 50%; 
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20,20,40,0.98);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 0 60px magenta;
  border: 2px solid cyan;
  z-index: 100;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.menu h2 {
  color: cyan;
  font-size: 32px;
  margin-bottom: 30px;
  text-shadow: 0 0 20px cyan;
}

.instructions-content {
  text-align: left;
  margin: 20px 0;
}

.instructions-content p {
  margin: 15px 0;
  font-size: 16px;
  line-height: 1.6;
}

.gameover-stats {
  margin: 20px 0;
}

.gameover-stats p {
  margin: 10px 0;
  font-size: 18px;
}

.new-high-score {
  background: linear-gradient(90deg, gold, orange);
  color: #000;
  padding: 15px;
  border-radius: 10px;
  font-size: 20px;
  font-weight: bold;
  margin: 20px 0;
  animation: celebrate 0.5s ease infinite;
}

@keyframes celebrate {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* Mobile controls */
.mobile-controls {
  display: none;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.mobile-controls button {
  flex: 1;
  padding: 20px;
  font-size: 28px;
  border-radius: 15px;
  border: 3px solid cyan;
  background: linear-gradient(135deg, rgba(0,255,255,0.3), rgba(255,0,255,0.3));
  color: #fff;
  font-weight: bold;
  box-shadow: 0 0 20px rgba(0,255,255,0.5);
  transition: all 0.2s ease;
  touch-action: manipulation;
  user-select: none;
}

.mobile-controls button:active {
  transform: scale(0.95);
  box-shadow: 0 0 40px cyan;
  background: linear-gradient(135deg, rgba(0,255,255,0.6), rgba(255,0,255,0.6));
}

/* Responsive */
@media (max-width: 900px) {
  canvas { 
    max-width: 100%; 
    width: 100% !important;
    height: auto !important;
  }
  
  .score-board {
    gap: 8px;
  }
  
  .score-item { 
    font-size: 12px;
    padding: 8px 12px;
  }
  
  .score-item strong {
    font-size: 16px;
  }
  
  .mobile-controls { 
    display: flex; 
  }
  
  .controls { 
    display: none; 
  }
  
  .speedometer {
    right: 10px;
    bottom: 10px;
    padding: 10px 15px;
  }
  
  .speed-value {
    font-size: 28px;
  }
  
  .splash-screen {
    padding: 40px 30px;
  }
  
  .splash-screen h1 {
    font-size: 40px;
  }
  
  .menu {
    padding: 30px 20px;
  }
  
  .game-info {
    gap: 15px;
    font-size: 14px;
  }
}

@media (max-width: 500px) {
  .splash-screen h1 {
    font-size: 32px;
  }
  
  .btn-primary, .btn-secondary {
    padding: 12px 25px;
    font-size: 16px;
  }
  
  .speedometer {
    padding: 8px 12px;
  }
  
  .speed-text {
    font-size: 10px;
  }
  
  .speed-value {
    font-size: 24px;
  }
  
  .speed-unit {
    font-size: 12px;
  }
}
