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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Courier New', monospace;
  touch-action: none;
}

#game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
}

.hidden {
  display: none !important;
}

/* Title */
.title {
  font-size: clamp(2rem, 10vw, 5rem);
  font-weight: 900;
  color: #0ff;
  text-shadow: 0 0 20px #0ff, 0 0 40px #0af, 0 0 80px #06f;
  letter-spacing: 0.2em;
  animation: pulse-glow 2s ease-in-out infinite;
}

.subtitle {
  font-size: clamp(0.8rem, 3vw, 1.2rem);
  color: #0af;
  margin-top: 0.5rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 20px #0ff, 0 0 40px #0af, 0 0 80px #06f; }
  50% { text-shadow: 0 0 30px #0ff, 0 0 60px #0af, 0 0 120px #06f; }
}

/* Buttons */
.btn-glow {
  margin-top: 2rem;
  padding: 1rem 3rem;
  font-size: clamp(1rem, 4vw, 1.4rem);
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: #0ff;
  background: transparent;
  border: 2px solid #0ff;
  cursor: pointer;
  letter-spacing: 0.15em;
  transition: all 0.2s;
  touch-action: manipulation;
}

.btn-glow:hover, .btn-glow:active {
  background: rgba(0, 255, 255, 0.15);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.settings-link {
  margin-top: 1.5rem;
  color: #06a;
  font-size: 0.9rem;
  cursor: pointer;
  letter-spacing: 0.1em;
}

.settings-link:hover {
  color: #0af;
}

/* Settings Panel */
.panel {
  background: rgba(0, 20, 40, 0.95);
  border: 1px solid #0af;
  padding: 2rem;
  border-radius: 4px;
  width: min(90vw, 400px);
}

.panel h2 {
  color: #0ff;
  margin-bottom: 1.5rem;
  text-align: center;
  letter-spacing: 0.2em;
}

.panel label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #0af;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.panel input[type="range"] {
  flex: 1;
  min-width: 120px;
  accent-color: #0ff;
}

.panel span {
  min-width: 2.5rem;
  text-align: right;
  color: #0ff;
  font-weight: bold;
}

/* HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: env(safe-area-inset-top, 0.5rem) 1rem 0;
  z-index: 50;
  pointer-events: none;
}

#score-display {
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 10px #0ff;
  text-align: center;
}

#combo-display {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0.5rem) + clamp(2.5rem, 8vw, 4rem));
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(1rem, 4vw, 1.5rem);
  font-weight: 700;
  color: #ff0;
  text-shadow: 0 0 10px #ff0;
}

#multiplier-display {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0.5rem) + clamp(4rem, 12vw, 6rem));
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(0.8rem, 3vw, 1.2rem);
  color: #0ff;
}

#fever-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 900;
  color: #f0f;
  text-shadow: 0 0 30px #f0f, 0 0 60px #f0f;
  animation: fever-pulse 0.5s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 60;
}

@keyframes fever-pulse {
  from { opacity: 0.6; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

#progress-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 170, 255, 0.2);
}

#progress-fill {
  height: 100%;
  background: #0ff;
  width: 0%;
  transition: width 0.1s linear;
}

/* Hit Feedback */
#hit-feedback {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
}

.hit-text {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  pointer-events: none;
  animation: hit-pop 0.6s ease-out forwards;
  text-shadow: 0 0 10px currentColor;
}

.hit-text.perfect { color: #0ff; }
.hit-text.great { color: #0f0; }
.hit-text.good { color: #ff0; }
.hit-text.miss { color: #f00; }

@keyframes hit-pop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  30% { transform: translate(-50%, -50%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

/* Game Over */
#final-score {
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 900;
  color: #0ff;
  text-shadow: 0 0 30px #0ff;
  margin: 1rem 0;
}

#final-stats {
  color: #0af;
  font-size: clamp(0.8rem, 3vw, 1rem);
  line-height: 1.8;
  text-align: center;
  margin-bottom: 1rem;
}

/* Mobile tweaks */
@media (max-width: 600px) {
  .btn-glow {
    padding: 0.8rem 2rem;
  }

  .panel {
    padding: 1.5rem;
  }
}
