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

:root {
  --hot: #ff5470;
  --gold: #ffd166;
  --mint: #7dffce;
  --sky: #59d9ff;
  --bg: #07070f;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #f4f1ff;
  -webkit-user-select: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 26px;
  pointer-events: none;
}

.hud-left, .hud-right { display: flex; flex-direction: column; gap: 2px; }
.hud-right { text-align: right; }

.hud-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: #8a7fa8;
}

.hud-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255,209,102,.45);
  font-variant-numeric: tabular-nums;
}

.small-v { font-size: 17px; }

#combo { color: var(--mint); text-shadow: 0 0 12px rgba(125,255,206,.5); transition: transform .08s; }
#combo.pop { transform: scale(1.25); }
#miss { color: var(--hot); text-shadow: 0 0 10px rgba(255,84,112,.5); }

.hud-center { text-align: center; flex: 1; margin: 0 30px; }

.track-name {
  font-size: 13px;
  letter-spacing: 5px;
  color: #b3a6d6;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.progress {
  width: min(420px, 60vw);
  height: 7px;
  border: 1px solid rgba(255,180,71,.4);
  border-radius: 5px;
  overflow: hidden;
  background: rgba(255,180,71,.06);
  margin: 0 auto 7px;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a35c2e, #ffb347);
}

.health {
  width: min(300px, 44vw);
  height: 9px;
  border: 1px solid rgba(255,84,112,.45);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,84,112,.07);
  margin: 0 auto;
}

#health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #8f1a34, var(--hot));
  box-shadow: 0 0 10px rgba(255,84,112,.55);
  transition: width .15s;
}

.health.low #health-fill { animation: hpBlink .5s ease-in-out infinite; }

@keyframes hpBlink {
  50% { opacity: .45; }
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(14,9,24,.86) 0%, rgba(7,7,15,.97) 100%);
  z-index: 10;
  padding: 24px;
}

.hidden { display: none !important; }

.game-title {
  font-size: clamp(48px, 9vw, 96px);
  font-weight: 800;
  letter-spacing: 16px;
  line-height: 1;
  color: #fff7ef;
  margin-left: 16px;
}

.game-title span {
  color: var(--hot);
  text-shadow: 0 0 28px var(--hot), 0 0 70px rgba(255,84,112,.4);
}

.tagline {
  font-size: clamp(14px, 2.2vw, 19px);
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255,209,102,.5);
}

.rules p { margin: 4px 0; color: #c3b6dd; font-size: clamp(13px, 1.7vw, 15.5px); }

.keys-row strong {
  display: inline-block;
  min-width: 34px;
  padding: 5px 9px;
  margin: 0 3px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  color: #fff;
}

.keys-row .dim { margin: 0 6px; }

.track-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(430px, 92vw);
  margin-top: 6px;
}

.track-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 18px;
  border: 1px solid rgba(255,180,71,.4);
  border-radius: 12px;
  background: rgba(255,180,71,.05);
  cursor: pointer;
  transition: all .15s;
  font-size: 14px;
  letter-spacing: 2px;
}

.track-item:hover:not(.locked) {
  background: rgba(255,180,71,.16);
  transform: translateX(5px);
}

.track-item .t-name { color: #ffe9c4; font-weight: 600; }
.track-item .t-meta { color: #9d8f77; font-size: 12px; }
.track-item .t-rank { font-weight: 800; font-size: 17px; margin-left: 12px; }
.track-item.locked { opacity: .32; cursor: default; filter: grayscale(.7); }

.best { font-size: 12px; letter-spacing: 2px; color: #9d8f77; }

h2 { font-size: clamp(28px, 5.5vw, 46px); letter-spacing: 6px; color: #fff7ef; }

.results-title { color: var(--mint); text-shadow: 0 0 26px rgba(125,255,206,.6); }

.rank-wrap { display: flex; align-items: center; gap: 34px; }

.rank-letter {
  font-size: clamp(90px, 18vw, 170px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 40px currentColor;
}

.final-wrap { display: flex; flex-direction: column; gap: 9px; text-align: left; }

.res-row { display: flex; justify-content: space-between; gap: 26px; }

.res-label { font-size: 11px; letter-spacing: 3px; color: #8a7fa8; align-self: center; }

.res-val {
  font-size: 19px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.btn-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.btn {
  padding: 13px 32px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--mint);
  background: transparent;
  border: 2px solid var(--mint);
  border-radius: 40px;
  cursor: pointer;
  transition: all .15s;
}

.btn:hover {
  background: rgba(125,255,206,.12);
  box-shadow: 0 0 22px rgba(125,255,206,.4);
  transform: translateY(-2px);
}

.btn.secondary {
  color: #b3a6d6;
  border-color: rgba(179,166,214,.55);
}

.btn.secondary:hover {
  background: rgba(179,166,214,.09);
  box-shadow: 0 0 16px rgba(179,166,214,.25);
}

.dim { color: #7d7296; }
