:root { color-scheme: dark; }

* { box-sizing: border-box; }

/* Beats the id/class display rules below, which otherwise out-specify the
   UA's [hidden] { display: none } and leave every overlay on screen. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #0d1015;
  color: #f2f5fa;
  font: 16px/1.4 system-ui, sans-serif;
}

#stage {
  position: relative;
  width: min(100vw, 177.7vh);      /* 16:9, fit whichever axis is tighter */
  aspect-ratio: 16 / 9;
  box-shadow: 0 0 0 1px #2a3040, 0 18px 50px #0006;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* ---- HUD ---- */

#hud {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  gap: 1.5rem;
  padding: 0.6rem 0.9rem;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 6px #000a;
}

#hud b { font-size: 1.4rem; }
#hud .label { opacity: 0.6; font-size: 0.75rem; letter-spacing: 0.08em; }
#hud .spacer { flex: 1; }
#hud .low { color: #ff8b5e; }

/* YouTube's Terms require a visible player: do not hide or cover this. */
#music {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  width: 256px;
  display: grid;
  gap: 0.35rem;
  justify-items: end;
}

#ytplayer { width: 256px; height: 200px; background: #000; border-radius: 4px; }
#music iframe { width: 100%; height: 100%; border: 0; border-radius: 4px; }

#mute {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  color: inherit;
  background: #1b2030cc;
  border: 1px solid #39405260;
  border-radius: 4px;
  cursor: pointer;
}

/* ---- overlay screens ---- */

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.7rem;
  justify-items: center;
  text-align: center;
  padding: 2rem;
  background: #0b0f16d0;
  backdrop-filter: blur(2px);
}

.screen h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.6rem); letter-spacing: 0.02em; }
.screen h2 { margin: 0; font-size: clamp(1.4rem, 4vw, 2.2rem); }
.screen p  { margin: 0; max-width: 34ch; opacity: 0.75; }
.screen kbd {
  padding: 0.05em 0.4em;
  border: 1px solid #4a5468;
  border-radius: 3px;
  font: inherit;
  font-size: 0.85em;
}

.screen button {
  margin-top: 0.4rem;
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.8rem;
  color: #12161d;
  background: #ffb347;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.screen button:hover { background: #ffc46b; }

@media (max-width: 560px) {
  #music, #ytplayer { width: 150px; }
  #ytplayer { height: 120px; }
  #hud { gap: 0.8rem; font-size: 0.85rem; }
}
