* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
  background: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app {
  width: 100vmin;
  height: 100vmin;
  position: relative;
  overflow: hidden;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: clamp(6px, 2vmin, 12px) clamp(8px, 2.5vmin, 16px);
  display: flex;
  align-items: center;
  gap: clamp(6px, 2vmin, 10px);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.4s;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}
#hud.visible { opacity: 1; }

#score {
  font-size: clamp(20px, 5.5vmin, 32px);
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8), 0 0 12px rgba(255,180,0,0.3);
  min-width: clamp(40px, 12vmin, 70px);
  letter-spacing: 1px;
  font-style: italic;
}

#combo {
  font-size: clamp(14px, 3.5vmin, 20px);
  font-weight: 800;
  color: #ff4400;
  text-shadow: 0 0 8px rgba(255,68,0,0.6);
  animation: comboPop 0.3s ease-out;
  font-style: italic;
}
#combo.hidden { display: none; }

@keyframes comboPop {
  0% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.8vmin, 5px);
}

#nitro-bar, #health-bar {
  position: relative;
  height: clamp(8px, 2vmin, 12px);
  background: rgba(0,0,0,0.5);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
#nitro-bar span, #health-bar span {
  position: absolute;
  right: clamp(3px, 1vmin, 6px);
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(6px, 1.5vmin, 8px);
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
}

#nitro-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #cc5500, #ff8800, #ffaa00);
  border-radius: 2px;
  transition: width 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
#health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22aa22, #44dd44);
  border-radius: 2px;
  transition: width 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Title Screen */
#title-screen, #game-over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 20;
}
#title-screen.hidden, #game-over.hidden { display: none; }

.title-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.title-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg,
    rgba(0,0,0,0.9) 0%,
    rgba(0,0,0,0.3) 40%,
    rgba(0,0,0,0.1) 60%,
    rgba(0,0,0,0.2) 100%);
}
.title-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-bottom: clamp(40px, 12vmin, 70px);
}

.title-prompt {
  font-size: clamp(16px, 4vmin, 24px);
  font-weight: 800;
  color: #ffd700;
  letter-spacing: 3px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  animation: pulse 2s ease-in-out infinite;
  font-style: italic;
}
.title-hint {
  margin-top: clamp(6px, 1.5vmin, 10px);
  font-size: clamp(11px, 2.5vmin, 15px);
  color: rgba(255,255,255,0.45);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* How To Play */
#how-to {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 25;
}
#how-to.hidden { display: none; }

.how-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%,
    rgba(40,25,10,0.95) 0%,
    rgba(10,10,15,0.98) 80%);
}
.how-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 clamp(20px, 6vmin, 40px);
}
.how-title {
  font-size: clamp(28px, 7vmin, 42px);
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 4px;
  font-style: italic;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  margin-bottom: clamp(16px, 5vmin, 30px);
}
.how-rules {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 3vmin, 18px);
  text-align: left;
}
.how-rule {
  display: flex;
  align-items: flex-start;
  gap: clamp(8px, 2.5vmin, 14px);
}
.how-icon {
  font-size: clamp(20px, 5vmin, 30px);
  flex-shrink: 0;
  width: clamp(28px, 7vmin, 38px);
  text-align: center;
  line-height: 1.2;
}
.how-text {
  font-size: clamp(12px, 2.8vmin, 16px);
  color: rgba(255,255,255,0.75);
  line-height: 1.4;
}
.how-text strong {
  color: #ffcc44;
  font-weight: 700;
}
.how-prompt {
  margin-top: clamp(20px, 6vmin, 36px);
  font-size: clamp(14px, 3.5vmin, 20px);
  font-weight: 800;
  color: #ffd700;
  letter-spacing: 3px;
  animation: pulse 2s ease-in-out infinite;
  font-style: italic;
}

/* Game Over */
.go-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 60%,
    rgba(80,20,0,0.6) 0%,
    rgba(10,10,15,0.95) 70%);
}
.go-content {
  position: relative;
  z-index: 2;
  text-align: center;
  margin: auto;
}

.go-label {
  font-size: clamp(44px, 13vmin, 76px);
  font-weight: 900;
  color: #ff3300;
  letter-spacing: 6px;
  text-shadow: 0 4px 0 #660000, 0 0 40px rgba(255,50,0,0.4);
  font-style: italic;
}
.go-score {
  margin-top: clamp(8px, 2.5vmin, 16px);
  font-size: clamp(24px, 7vmin, 40px);
  font-weight: 800;
  color: #ffd700;
  font-style: italic;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.go-best {
  margin-top: clamp(3px, 1vmin, 6px);
  font-size: clamp(12px, 2.8vmin, 16px);
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}
.go-stats {
  margin-top: clamp(8px, 2vmin, 14px);
  font-size: clamp(11px, 2.5vmin, 14px);
  color: rgba(255,200,100,0.5);
  font-weight: 600;
}
.go-prompt {
  margin-top: clamp(24px, 6vmin, 36px);
  font-size: clamp(14px, 3.5vmin, 20px);
  font-weight: 800;
  color: #ffd700;
  letter-spacing: 3px;
  animation: pulse 2s ease-in-out infinite;
  font-style: italic;
}

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