* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #060610;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

canvas { display: block; }

#backBtn {
  position: fixed; top: 16px; left: 16px; z-index: 100;
  color: #556; font-size: 13px; text-decoration: none;
  letter-spacing: 2px; transition: color 0.2s;
}
#backBtn:hover { color: #aac; }

/* ---- Start Screen ---- */
#startScreen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(6,6,16,0.95);
}
#startScreen h1 {
  font-size: 72px; font-weight: 800;
  letter-spacing: 12px;
  background: linear-gradient(135deg, #ff44aa 0%, #44ddff 50%, #ffaa22 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
#startScreen .sub {
  font-size: 16px; color: #667; letter-spacing: 4px;
  margin-bottom: 28px;
}
.hint {
  font-size: 12px; color: #556; letter-spacing: 2px;
  margin-bottom: 28px;
}

/* Keybinds */
.keybinds {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 28px;
}
.keybind-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #778;
}
.keybind-label {
  color: #99a; font-size: 12px; letter-spacing: 1px;
  margin-left: 4px;
}
.key {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 13px;
  color: #aac;
  margin: 0 1px;
  min-width: 28px;
  text-align: center;
}

/* Buttons */
#playBtn, #restartBtn, #resumeBtn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #dde; font-size: 16px;
  padding: 14px 48px; border-radius: 8px;
  cursor: pointer; letter-spacing: 4px;
  transition: all 0.25s;
}
#playBtn:hover, #restartBtn:hover, #resumeBtn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

/* ---- Song Select ---- */
#songSelect {
  position: fixed; inset: 0; z-index: 55;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(6,6,16,0.97);
  gap: 16px;
}
#songSelect h2 {
  font-size: 24px; font-weight: 800;
  letter-spacing: 6px; color: #aac;
  margin-bottom: 8px;
}
#songList {
  display: flex; flex-direction: column;
  gap: 8px; max-height: 50vh; overflow-y: auto;
  overflow-x: hidden; width: 340px;
}
.song-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: #ccd; padding: 14px 20px;
  border-radius: 8px; cursor: pointer;
  text-align: left; transition: all 0.2s;
  display: flex; flex-direction: column; gap: 4px;
}
.song-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,68,170,0.4);
  transform: translateX(4px);
}
.song-btn strong { font-size: 14px; color: #eef; letter-spacing: 1px; }
.song-btn span { font-size: 11px; color: #667; }
.no-songs { color: #445; font-size: 13px; font-style: italic; text-align: center; }

/* ---- Difficulty Select ---- */
#diffSelect {
  position: fixed; inset: 0; z-index: 56;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(6,6,16,0.97);
  gap: 16px;
}
#diffSelect h2 {
  font-size: 24px; font-weight: 800;
  letter-spacing: 6px; color: #aac;
}
#diffSongName {
  font-size: 14px; color: #667; letter-spacing: 2px;
  margin-bottom: 8px;
}
#diffBtns {
  display: flex; flex-direction: column;
  gap: 10px; width: 320px;
}
.diff-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: #ccd; padding: 16px 20px;
  border-radius: 8px; cursor: pointer;
  text-align: left; transition: all 0.2s;
  display: flex; flex-direction: column; gap: 4px;
}
.diff-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(68,220,255,0.4);
  transform: translateX(4px);
}
.diff-btn strong {
  font-size: 15px; color: #eef;
  letter-spacing: 3px;
}
.diff-btn span {
  font-size: 11px; color: #667;
}
.diff-btn[data-diff="easy"]:hover { border-color: rgba(68,255,136,0.5); }
.diff-btn[data-diff="medium"]:hover { border-color: rgba(68,220,255,0.5); }
.diff-btn[data-diff="hard"]:hover { border-color: rgba(255,68,68,0.5); }

/* ---- Analyze ---- */
#analyzeMsg {
  position: fixed; inset: 0; z-index: 57;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(6,6,16,0.97);
  gap: 20px;
}
#analyzeMsg p {
  color: #778; font-size: 16px; letter-spacing: 3px;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: #ff44aa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- HUD ---- */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 30; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  gap: 32px; padding: 16px 24px;
}
#hud.hidden { display: none; }

#scoreBox {
  display: flex; flex-direction: column; align-items: center;
}
#scoreLabel {
  font-size: 10px; letter-spacing: 3px; color: #556;
}
#score {
  font-size: 32px; font-weight: 800; color: #fff;
  letter-spacing: 2px;
}
#comboBox { display: flex; align-items: center; }
#combo {
  font-size: 18px; font-weight: 700; color: #88aaff;
  letter-spacing: 1px;
}
#multiplierBox { display: flex; align-items: center; }
#multiplier {
  font-size: 22px; font-weight: 800; color: #ffaa22;
  letter-spacing: 1px;
}

/* Volume Control */
#volControl {
  position: fixed; top: 14px; right: 16px;
  display: flex; align-items: center; gap: 6px;
  pointer-events: auto;
  z-index: 31;
}
#volControl label {
  font-size: 10px; letter-spacing: 2px; color: #556;
}
#volSlider {
  width: 70px; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px; outline: none;
  cursor: pointer;
}
#volSlider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #aac; cursor: pointer;
}
#volSlider::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #aac; border: none; cursor: pointer;
}
#volVal {
  font-size: 10px; color: #556; letter-spacing: 1px;
  min-width: 30px;
}

/* ---- Pause Menu ---- */
#pauseMenu {
  position: fixed; inset: 0; z-index: 65;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(6,6,16,0.88);
  gap: 20px;
}
#pauseMenu.visible {
  display: flex;
}
#pauseMenu h2 {
  font-size: 36px; font-weight: 800;
  letter-spacing: 8px; color: #aac;
}
.pause-hint {
  font-size: 11px; color: #445; letter-spacing: 2px;
}

/* ---- End Overlay ---- */
#endOverlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(6,6,16,0.92);
}
#endOverlay.hidden { display: none; }

#gradeDisplay {
  font-size: 96px; font-weight: 900;
  letter-spacing: 6px;
  margin-bottom: 8px;
  text-shadow: 0 0 40px currentColor, 0 0 80px currentColor;
}

#endTitle {
  font-size: 36px; font-weight: 800;
  letter-spacing: 6px; margin-bottom: 16px;
  background: linear-gradient(135deg, #ff44aa, #44ddff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#endScore {
  font-size: 24px; color: #dde; margin-bottom: 6px;
}
#endAccuracy {
  font-size: 20px; color: #aac; margin-bottom: 8px;
  letter-spacing: 2px;
}
#endStats {
  font-size: 13px; color: #778; margin-bottom: 32px;
  letter-spacing: 1px; line-height: 2;
  text-align: center;
}
