* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #1a1a2e; }
canvas { display: block; }

/* HUD overlay */
#hud {
  position: fixed; top: 20px; left: 20px;
  font-family: 'Segoe UI', sans-serif; color: #fff; z-index: 10;
  pointer-events: none;
}
#hud .score {
  font-size: 32px; font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
#hud .high-score {
  font-size: 14px; opacity: .7; margin-top: 2px;
}
#hud .health-bar {
  margin-top: 8px; width: 160px; height: 14px;
  background: rgba(0,0,0,.35); border-radius: 7px;
  overflow: hidden; border: 1px solid rgba(255,255,255,.2);
}
#hud .health-bar-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff4444, #ffcc00, #44ff44);
  border-radius: 7px;
  transition: width .2s ease-out;
}

/* Audio Controls */
#audioControls {
  position: fixed; top: 20px; right: 20px;
  display: flex; gap: 8px; z-index: 10;
}
.audio-btn {
  pointer-events: auto;
  width: 40px; height: 40px;
  border: 2px solid rgba(255,255,255,.4); border-radius: 8px;
  background: rgba(0,0,0,.3); color: #fff;
  font-size: 18px; font-weight: 700;
  backdrop-filter: blur(4px);
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  cursor: pointer;
}
.audio-btn:hover { background: rgba(255,255,255,.2); }
.audio-btn:active { background: rgba(255,255,255,.4); transform: scale(0.95); }
.audio-btn.disabled {
  opacity: 0.4;
  background: rgba(255,0,0,.2);
  border-color: rgba(255,0,0,.4);
}

/* Game-over / start screen overlay */
#overlay {
  position: fixed; inset: 0; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); z-index: 20;
  font-family: 'Segoe UI', sans-serif; color: #fff;
  transition: opacity .3s;
}
#overlay.hidden { opacity: 0; pointer-events: none; }
#overlay h1 { font-size: 48px; margin-bottom: 8px; }
#overlay p  { font-size: 18px; opacity: .8; }
#overlay .final-score { font-size: 28px; margin: 12px 0; color: #ffd700; }

/* Pause overlay */
#pauseOverlay {
  position: fixed; inset: 0; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0,0,0,.65); z-index: 30;
  font-family: 'Segoe UI', sans-serif; color: #fff;
  gap: 16px;
  transition: opacity .3s;
}
#pauseOverlay.hidden { opacity: 0; pointer-events: none; }
#pauseOverlay h1 { font-size: 48px; }
#pauseOverlay button {
  padding: 12px 36px; font-size: 18px; font-weight: 600;
  border: none; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.15); color: #fff;
  backdrop-filter: blur(4px);
  transition: background .15s;
}
#pauseOverlay button:hover { background: rgba(255,255,255,.3); }
#pauseOverlay .pause-hint { font-size: 14px; opacity: .6; margin-top: 8px; }

/* Mobile touch controls */
#touchControls {
  display: none;
  position: fixed; bottom: 20px; left: 0; right: 0;
  padding: 0 20px; z-index: 15;
  justify-content: space-between; align-items: flex-end;
  pointer-events: none;
}
.touch-btn {
  pointer-events: auto;
  width: 64px; height: 64px;
  border: 2px solid rgba(255,255,255,.4); border-radius: 16px;
  background: rgba(0,0,0,.3); color: #fff;
  font-size: 24px; font-weight: 700;
  backdrop-filter: blur(4px);
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
}
.touch-btn:active { background: rgba(255,255,255,.25); }
.touch-left { display: flex; gap: 12px; }
.touch-boost {
  width: 96px; height: 96px; border-radius: 50%;
  font-size: 14px; letter-spacing: 1px;
}
@media (hover: none) and (pointer: coarse) {
  #touchControls { display: flex; }
}
body.touch-device #touchControls { display: flex; }
