:root {
  --bg: #05070d;
  --glass: rgba(8, 16, 34, 0.62);
  --line: rgba(120, 220, 255, 0.28);
  --text: #e8f1ff;
  --muted: #8fa3c8;
  --cyan: #5fe8ff;
  --green: #5fffb0;
  --red: #ff4d6a;
  --yellow: #ffd84a;
  --orange: #ffb35f;
  --font: "Rajdhani", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: var(--font); -webkit-tap-highlight-color: transparent; }
#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font: 700 11px/1 ui-monospace, monospace; padding: 2px 4px; border-radius: 4px; background: #ffffff14; border: 1px solid #ffffff2a; }

/* splash */
#splash { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #0d1e3c, #05070d 70%); transition: opacity .6s; }
#splash h1 { margin: 0; font-size: 72px; letter-spacing: 12px; color: var(--cyan); text-shadow: 0 0 30px #22d3ff88; }
#splash p { color: var(--muted); letter-spacing: 4px; }
body.ready #splash { opacity: 0; pointer-events: none; }

/* VR button + note */
.vr-pill { position: fixed; top: max(16px, env(safe-area-inset-top)); right: 16px; z-index: 20; height: 52px; padding: 0 24px;
  border-radius: 26px; font-size: 20px; font-weight: 700; letter-spacing: 3px; color: #fff;
  border: 2px solid var(--cyan); background: linear-gradient(90deg, rgba(95,232,255,.25), rgba(169,139,255,.25));
  backdrop-filter: blur(10px); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 34px rgba(95, 232, 255, .55); } }
body:not([data-state="menu"]) .vr-pill { display: none; }
#note { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); margin: 0; z-index: 20; color: var(--muted);
  font-size: 14px; letter-spacing: 1px; text-align: center; pointer-events: none; }
#note:empty { display: none; }

/* HUD strip (desktop/phone while playing) */
#hud { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: none; justify-content: center; align-items: stretch;
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom)); pointer-events: none;
  background: linear-gradient(to top, rgba(5, 10, 22, 0.75), rgba(5, 10, 22, 0)); }
body[data-state="playing"] #hud, body[data-state="paused"] #hud { display: flex; }
#hProgressWrap { position: absolute; left: 12%; right: 12%; bottom: 6px; height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; }
#hProgress { height: 100%; width: 0; background: var(--cyan); border-radius: 2px; box-shadow: 0 0 8px var(--cyan); }
#hud .cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  min-width: 0; flex: 0 1 170px; padding: 0 12px; }
#hud .cell + .cell::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 8%; width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(140, 170, 220, .35), transparent); }
#hud small { font-size: 12px; font-weight: 700; letter-spacing: 3px; color: var(--muted); white-space: nowrap; }
#hud span { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; text-shadow: 0 0 14px currentColor; }
#hud .big span { font-size: 40px; }
#hud em { position: absolute; right: 8px; bottom: 6px; font-style: normal; font-size: 14px; font-weight: 700; color: #5fffb0aa; }
#hud .g { color: var(--green); } #hud .y { color: var(--yellow); } #hud .c { color: var(--cyan); } #hud .o { color: var(--orange); }
#hNext { font-size: 24px !important; letter-spacing: 1px; }
#hPips { position: absolute; top: -10px; display: flex; gap: 5px; }
#hPips b { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.18); }
#hPips b.on { background: var(--red); box-shadow: 0 0 8px var(--red); }

/* +points pop */
#pts { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 6; pointer-events: none; opacity: 0;
  font-size: 40px; font-weight: 700; color: #fff; text-shadow: 0 0 18px var(--cyan); }
#pts.go { animation: pts .6s ease-out; }
@keyframes pts { from { opacity: 1; transform: translate(-50%, -30%) scale(1.1); } to { opacity: 0; transform: translate(-50%, -120%) scale(.9); } }

.round { position: fixed; top: max(16px, env(safe-area-inset-top)); right: 16px; z-index: 6; width: 48px; height: 48px; border-radius: 50%;
  display: none; font-size: 13px; letter-spacing: 1px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(8px); }
body[data-state="playing"] .round { display: block; }

/* touch pads — touch devices only */
#pads { position: fixed; left: 8px; right: 8px; bottom: 100px; z-index: 5; display: none; gap: 6px; justify-content: center; }
@media (pointer: coarse) { body[data-state="playing"] #pads { display: flex; } }
.pad { flex: 1; max-width: 110px; padding: 16px 2px; border-radius: 14px; border: 1.5px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, rgba(6, 12, 28, .6)); color: var(--c); touch-action: none; user-select: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pad b { font-size: 13px; font-weight: 700; }
.pad kbd { display: none; }
.pad.hit { animation: padHit .25s ease-out; }
@keyframes padHit { from { background: var(--c); color: #000; transform: scale(.94); } }

#flash { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: 0; box-shadow: inset 0 0 120px 20px var(--c, #22d3ff); }
#flash.go { animation: flash .3s ease-out; }
#flash.bad { box-shadow: inset 0 0 80px 6px var(--c); }
@keyframes flash { from { opacity: .7; } to { opacity: 0; } }

body.in-vr #hud, body.in-vr #pads, body.in-vr .round, body.in-vr .vr-pill, body.in-vr #pts { display: none !important; }

@media (max-width: 640px) {
  #hud { padding: 10px 4px calc(10px + env(safe-area-inset-bottom)); }
  #hud .cell { padding: 0 4px; }
  #hud small { font-size: 9px; letter-spacing: 1px; }
  #hud span { font-size: 20px; }
  #hud .big span { font-size: 22px; }
  #hNext { font-size: 14px !important; }
  #hud em { display: none; }
  #pads { bottom: 78px; }
  .vr-pill { height: 44px; font-size: 16px; padding: 0 16px; }
}
