:root {
  --gold: #f0c14d;
  --magenta: #ff2d95;
  --cyan: #27e7ff;
  --ink: #07060d;
  --paper: #f4efe4;
  --display: Impact, "Arial Black", "Haettenschweiler", sans-serif;
  --body: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  overflow: hidden;
  touch-action: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button, a { font-family: inherit; }

#view {
  position: fixed;
  inset: 0;
}
#c { width: 100%; height: 100%; display: block; }
#fx-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.5) 100%);
}
#fx-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
#view.chroma #c { animation: rgb 0.14s steps(2, end) infinite; }
#view.chroma #fx-overlay::after {
  opacity: 1;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.08) 0 1px,
    transparent 1px 5px
  );
  mix-blend-mode: screen;
  animation: tear 0.12s steps(2, end) infinite;
}
#view.flash #fx-overlay { animation: flash 0.16s linear; }

@keyframes rgb {
  0% { transform: translate(0, 0); filter: none; }
  40% { transform: translate(-4px, 1px); filter: hue-rotate(50deg) saturate(1.4); }
  70% { transform: translate(4px, -2px); filter: hue-rotate(-40deg); }
}
@keyframes tear {
  50% { transform: translateY(3px); }
}
@keyframes flash {
  0% { box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0); }
  30% { box-shadow: inset 0 0 80px 20px rgba(255, 255, 255, 0.35); }
  100% { box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0); }
}

#bug {
  position: fixed;
  z-index: 8;
  top: max(10px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  font-family: var(--display);
  letter-spacing: 0.14em;
  font-size: 14px;
  color: var(--paper);
  pointer-events: none;
}
#bug em {
  color: var(--magenta);
  font-style: normal;
  margin-left: 6px;
  animation: live 1.3s steps(2, end) infinite;
}
@keyframes live { 50% { opacity: 0.25; } }

#mute-btn {
  position: fixed;
  z-index: 20;
  top: max(8px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  min-width: 64px;
  height: 36px;
  border: 1px solid rgba(244, 239, 228, 0.35);
  background: rgba(7, 6, 13, 0.72);
  color: var(--paper);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
}

#hud {
  position: fixed;
  z-index: 4;
  top: calc(40px + env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.plate {
  width: min(46vw, 300px);
  background: rgba(8, 7, 14, 0.82);
  border-top: 3px solid var(--gold);
  padding: 8px 10px 10px;
}
.plate.right { text-align: right; border-top-color: var(--magenta); }
.row { display: flex; gap: 8px; align-items: center; }
.plate.right .row { justify-content: flex-end; }
.who {
  font-family: var(--display);
  letter-spacing: 0.04em;
  font-size: 18px;
  line-height: 1;
}
.tag {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink);
  background: var(--gold);
  padding: 2px 5px;
  font-weight: 800;
}
.bar {
  margin-top: 6px;
  height: 8px;
  background: #241c2e;
  overflow: hidden;
}
.fill { height: 100%; width: 100%; background: linear-gradient(90deg, #f0c14d, #fff1c2); transition: width 0.28s ease; }
.fill.opp { background: linear-gradient(90deg, #ff2d95, #ffd0ea); margin-left: auto; }
.plate.right .bar { display: flex; }
#hud.nobar .bar { display: none; }

#heat-badge {
  position: fixed;
  z-index: 4;
  top: calc(96px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  gap: 6px;
  max-width: calc(100vw - 24px);
  font-family: var(--display);
  letter-spacing: 0.12em;
  font-size: 14px;
  color: var(--ink);
}
#heat-badge span { padding: 4px 10px; background: var(--gold); white-space: nowrap; }
#heat-badge span.theirs { font-size: 12px; opacity: 0.92; }
#heat-badge .hot { background: #ffb703; }
#heat-badge .mixed { background: #d9d6ea; }
#heat-badge .cold { background: #9aa4c7; }
#heat-badge .botch { background: #ff5a6a; }
#heat-badge .perfect { background: var(--gold); }
@media (max-width: 520px) {
  #heat-badge { flex-direction: column; align-items: center; gap: 3px; }
}

#callout {
  position: fixed;
  z-index: 5;
  top: calc(124px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 520px);
  text-align: center;
  pointer-events: none;
  font-family: var(--display);
  letter-spacing: 0.05em;
  font-size: clamp(18px, 4.6vw, 30px);
  line-height: 1.02;
  color: white;
  background: rgba(8, 7, 14, 0.78);
  padding: 6px 10px;
  opacity: 0;
}
#callout.on { opacity: 1; }
#callout.pop { animation: pop 0.45s ease; }
@keyframes pop {
  0% { transform: translateX(-50%) scale(1.18); }
  100% { transform: translateX(-50%) scale(1); }
}

#grade-pop {
  position: fixed;
  z-index: 6;
  left: 50%;
  top: auto;
  bottom: calc(214px + env(safe-area-inset-bottom));
  transform: translate(-50%, 0);
  pointer-events: none;
  font-family: var(--display);
  font-size: clamp(26px, 6vw, 48px);
  text-shadow: 0 2px 0 #140814;
  letter-spacing: 0.08em;
  opacity: 0;
}
#grade-pop.on { animation: grade 0.7s ease; }
#grade-pop.perfect { color: var(--gold); }
#grade-pop.good { color: white; }
#grade-pop.miss { color: #ff5a6a; }
@keyframes grade {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1.05); }
}

#toasts {
  position: fixed;
  z-index: 6;
  right: max(10px, env(safe-area-inset-right));
  bottom: calc(196px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  width: min(168px, 46vw);
}
.toast {
  background: rgba(8, 7, 14, 0.9);
  border-left: 4px solid var(--cyan);
  padding: 8px 10px;
  font-family: var(--display);
  letter-spacing: 0.08em;
  font-size: 16px;
  animation: toast 1.7s ease forwards;
}
.toast.good { border-left-color: #39ff88; }
.toast.bad { border-left-color: #ff5a6a; }
.toast.even { border-left-color: #f0c14d; }
@keyframes toast {
  0% { opacity: 0; transform: translateY(8px); }
  12% { opacity: 1; transform: none; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

#cue {
  position: fixed;
  z-index: 6;
  left: max(8px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(480px, calc(100vw - 156px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#cue-label {
  font-family: var(--display);
  letter-spacing: 0.14em;
  font-size: 18px;
  background: rgba(7, 6, 13, 0.8);
  padding: 4px 8px;
}
#pips { display: flex; gap: 6px; }
#pips i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
  background: #3a3344;
  box-shadow: inset 0 0 0 2px #07060d;
}
#pips i.live {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--gold);
  transform: scale(1.35);
}
#pips i.perfect { background: var(--gold); }
#pips i.good { background: white; }
#pips i.miss { background: #ff5a6a; }

#glitch-btn {
  position: fixed;
  z-index: 6;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: #140814;
  font-family: var(--display);
  letter-spacing: 0.08em;
  font-size: 16px;
  touch-action: none;
}
#glitch-btn span { position: relative; z-index: 2; }
#glitch-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ff2d95, #27e7ff, #ffe14a, #ff2d95);
  animation: spin 2.4s linear infinite;
  z-index: 0;
}
#glitch-btn::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #fff, #d7fff8 40%, #b8fff4);
  z-index: 1;
}
#glitch-btn:active { transform: scale(0.94); }
@keyframes spin { to { transform: rotate(1turn); } }

#screen {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(7, 6, 13, 0.05) 0%, rgba(7, 6, 13, 0.35) 38%, rgba(7, 6, 13, 0.88) 100%);
}
#screen[hidden] { display: none; }
.panel {
  pointer-events: auto;
  margin: 12px;
  margin-bottom: max(12px, env(safe-area-inset-bottom));
  padding: 16px 16px 18px;
  background: rgba(10, 8, 16, 0.94);
  border: 1px solid rgba(240, 193, 77, 0.35);
  max-height: min(62vh, 560px);
  overflow: auto;
  animation: sheet 0.32s ease;
}
@keyframes sheet {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.title-card {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: max(8vh, 24px);
}
.kicker {
  margin: 0 0 4px;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
}
h1, h2 {
  font-family: var(--display);
  letter-spacing: 0.04em;
  font-weight: 400;
  margin: 0 0 8px;
  line-height: 0.9;
}
h1 { font-size: clamp(64px, 16vw, 108px); }
h2 { font-size: clamp(36px, 8vw, 56px); }
.lede, .help { margin: 0 0 12px; line-height: 1.35; color: #ddd4c6; }

.go, .ghost {
  display: block;
  width: 100%;
  min-height: 52px;
  border: 0;
  font-family: var(--display);
  letter-spacing: 0.12em;
  font-size: 22px;
  cursor: pointer;
}
.go { background: var(--gold); color: #140814; }
.go:active, .ghost:active, .card:active { transform: scale(0.98); }
.ghost {
  margin-top: 8px;
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(244, 239, 228, 0.35);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  padding: 4px 2px 12px;
}
.card {
  text-align: left;
  background: #120e18;
  color: var(--paper);
  border: 1px solid #3a3144;
  padding: 12px;
  min-height: 92px;
  position: relative;
}
.card i {
  display: block;
  height: 6px;
  width: 100%;
  background: var(--c, var(--gold));
  margin-bottom: 8px;
}
.card strong {
  display: block;
  font-family: var(--display);
  letter-spacing: 0.04em;
  font-size: 22px;
  font-weight: 400;
}
.card em, .card span { display: block; font-style: normal; color: #c9bfb0; font-size: 13px; margin-top: 2px; }
.card b {
  position: absolute;
  top: 22px;
  right: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #140814;
  background: var(--gold);
  padding: 2px 4px;
}
.card.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }

.vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.vs strong { font-family: var(--display); font-size: 22px; font-weight: 400; letter-spacing: 0.03em; }
.vs span { display: block; color: #c9bfb0; font-size: 13px; }
.vs em { font-family: var(--display); font-style: normal; color: var(--magenta); font-size: 28px; }
.vs div:last-child { text-align: right; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.stats div { background: #16121c; padding: 8px; }
.stats b { display: block; font-family: var(--display); font-size: 18px; letter-spacing: 0.04em; font-weight: 400; }
.stats span { color: #c9bfb0; font-size: 12px; letter-spacing: 0.08em; }

#boot-error {
  position: fixed;
  z-index: 40;
  inset: auto 16px max(16px, env(safe-area-inset-bottom));
  background: #3a1020;
  color: white;
  padding: 12px;
  border-left: 4px solid #ff5a6a;
}

@media (max-height: 520px) {
  .panel { max-height: 80vh; }
  #glitch-btn { width: 74px; height: 74px; font-size: 13px; }
  h1 { font-size: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  #glitch-btn::before, #bug em, .panel { animation: none; }
  #view.chroma #c { animation: none; }
  .fill { transition: none; }
}

/* Menu controls use rounded Material surfaces, visible focus and 48px targets. */
:root { --surface: #211c28; --outline: #817487; }
#save-status { position: fixed; top: 43px; left: 12px; z-index: 8; font-size: 9px; color: var(--cyan); letter-spacing: .05em; pointer-events: none; }
.card.locked { opacity: 1; border-color: #6a5a38; }
.lock-badge {
  position: absolute;
  top: 18px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0c14d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='11' width='14' height='10' rx='1.5' fill='%23140814'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' fill='none' stroke='%23140814' stroke-width='2'/%3E%3C/svg%3E") center / 16px no-repeat;
}
#glitch-dock {
  position: fixed;
  z-index: 6;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(132px, 38vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: rgba(8, 7, 14, .92);
  border: 1px solid rgba(244, 239, 228, .28);
}
#glitch-dock[hidden] { display: none !important; }
#glitch-readout { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-align: center; }
#glitch-readout.favors { color: #39ff88; }
#glitch-readout.risky { color: #ff8b98; }
#glitch-readout.uncertain { color: #f4efe4; }
#glitch-meter { width: 100%; height: 8px; background: #2a2030; }
#glitch-meter span { display: block; height: 100%; width: var(--p, 50%); background: linear-gradient(90deg, #ff5a6a, #f0c14d 50%, #39ff88); }
#glitch-dock #momentum { position: static; width: auto; margin: 0; padding: 0; background: none; font-size: 11px; line-height: 1.3; text-align: center; }
#glitch-dock #glitch-btn { position: relative; right: auto; bottom: auto; width: 84px; height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.xp-progress { width: 100%; height: 16px; accent-color: var(--gold); margin-bottom: 12px; }
.unlock-list { list-style: none; padding: 0; }
.unlock-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border-bottom: 1px solid var(--outline); font-size: 13px; }
.unlock-list span { color: var(--cyan); text-align: right; }
.unlock-list small { display: block; color: #c9bfcf; font-size: 11px; font-weight: 400; margin-top: 4px; }
#account-error { color: #ffadbb; }
#account-conflict:not(:empty) { background: #302632; padding: 12px; border-radius: 14px; margin-bottom: 12px; }
#account-dialog .help { font-size: 13px; margin-top: 12px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
#toolbar { position: fixed; right: max(10px, env(safe-area-inset-right)); top: max(7px, env(safe-area-inset-top)); z-index: 20; display: flex; gap: 6px; }
#toolbar button { min-height: 48px; padding: 0 14px; border-radius: 24px; border: 1px solid var(--outline); background: rgba(21,16,28,.94); color: var(--paper); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
#toolbar #mute-btn { position: static; height: auto; letter-spacing: .06em; min-width: 64px; }
#bug { top: 22px; }
#hud { top: calc(66px + env(safe-area-inset-top)); }
#heat-badge { top: calc(120px + env(safe-area-inset-top)); }
#callout { top: calc(149px + env(safe-area-inset-top)); }
#glitch-btn small { position: relative; z-index: 2; font: 700 11px var(--body); }
#glitch-btn:disabled::before { animation: none; }
.panel { border-radius: 24px; box-shadow: 0 8px 32px #0006; padding: 18px 20px; max-height: min(54vh, 580px); }
.title-card { max-height: 70vh; }
.go, .ghost { border-radius: 28px; min-height: 52px; font-family: var(--body); font-size: 15px; font-weight: 800; letter-spacing: .07em; }
.actions { display: flex; gap: 12px; align-items: stretch; }
.actions > * { flex: 1; }
.actions .ghost { margin-top: 0; }
details.how-to { margin-top: 12px; text-align: left; }
details.how-to summary { min-height: 48px; display: flex; align-items: center; font-weight: 800; letter-spacing: .06em; cursor: pointer; }
details.how-to p, details.how-to li { font-size: 14px; line-height: 1.4; }
.roster-detail { margin: 8px 0; padding: 10px 12px; background: #16121c; border-left: 4px solid var(--gold); }
.roster-detail b { display: block; letter-spacing: .06em; }
.card b { top: 6px; right: 10px; }
.cards { touch-action: pan-x pan-y; overscroll-behavior-x: contain; }
.trait-chip { color: var(--cyan) !important; margin-top: 8px !important; }
.status { color: var(--cyan); font-size: 13px; min-height: 18px; margin: 8px 0; }
.key-help { color: #c9bfcf; font-size: 12px; line-height: 1.5; margin: 10px 0 0; }
.key-help a { color: #27e7ff; }
.rivalry { padding: 10px 14px; background: var(--surface); border-radius: 16px; margin: 8px 0 12px; }
.rivalry b { color: var(--gold); font-size: 13px; letter-spacing: .06em; }
.rivalry span { float: right; font-size: 12px; }
.rivalry p { font-size: 14px; margin: 5px 0 0; }
#cue-hint, #timing-feedback { font-size: 12px; color: var(--paper); padding: 3px 7px; background: #100b19df; border-radius: 8px; min-height: 20px; }
#timing-feedback:empty { visibility: hidden; }
#toasts { bottom: calc(210px + env(safe-area-inset-bottom)); left: auto; right: max(10px, env(safe-area-inset-right)); transform: none; width: min(168px, 42vw); }
details { margin: 12px 0; }
summary { padding: 10px 4px; cursor: pointer; min-height: 44px; }
.cue-results { list-style: none; margin: 0; padding: 0; }
.cue-results li { display: flex; gap: 8px; justify-content: space-between; border-bottom: 1px solid #55465c; padding: 7px 0; font-size: 12px; }
.cue-results b { text-align: right; }
.cue-results .perfect { color: var(--gold); }
.cue-results .miss { color: #ff91a1; }
dialog { width: min(92vw, 500px); max-height: 88vh; overflow: auto; background: #211b2b; color: var(--paper); border: 1px solid #817487; border-radius: 28px; padding: 26px; box-shadow: 0 20px 70px #000a; }
dialog::backdrop { background: #05030bbd; }
dialog h2 { font-size: 36px; }
dialog .setting { display: flex; gap: 15px; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid #53475e; }
dialog .setting small { display: block; color: #c9bfcf; font-size: 12px; }
dialog select { min-height: 48px; max-width: 180px; border-radius: 12px; background: #332b40; color: white; border: 1px solid #817487; padding: 6px 10px; }
dialog input { width: 24px; height: 24px; accent-color: var(--gold); flex-shrink: 0; }
dialog .go { margin-top: 16px; }
.reduced-effects *, .reduced-effects *::before, .reduced-effects *::after { animation: none !important; transition: none !important; }
.reduced-effects #grade-pop.on { opacity: 1; }
@media (max-width: 600px) {
  #bug { font-size: 11px; letter-spacing: .03em; top: 24px; }
  #bug em { display: none; }
  #toolbar { gap: 4px; right: 6px; }
  #toolbar button { padding: 0 9px; font-size: 10px; }
  #toolbar button { padding: 0 7px; font-size: 9px; }
  #toolbar #account-btn:disabled { display: none; }
  #save-status { top: 43px; font-size: 8px; max-width: 112px; }
  .panel { margin: 8px; padding: 14px; border-radius: 20px; max-height: 56vh; }
  .title-card { max-height: 76vh; }
  h2 { font-size: 30px; line-height: 1.05; }
  .lede, .help { font-size: 13px; }
  .actions { flex-direction: column; gap: 8px; }
  .card { flex-basis: 180px; }
  .rivalry span { float: none; display: block; margin-top: 4px; }
  .rivalry p { font-size: 12px; }
  .who { font-size: 14px; }
  #callout { font-size: 18px; }
  #glitch-btn { width: 76px; height: 76px; font-size: 13px; }
  #toasts { bottom: 188px; }
  .stats { gap: 5px; }
  .stats b { font-size: 17px; }
  .stats span { font-size: 10px; }
  #toasts { bottom: 200px; }
}
@media (max-height: 540px) and (min-width: 601px) {
  .panel { max-height: 72vh; }
  #glitch-dock { width: 108px; }
  #glitch-dock #glitch-btn { width: 68px; height: 68px; font-size: 12px; }
  #toasts { bottom: 168px; width: 108px; }
}

/* Lane game: notes glide down three lanes to a lit target line. Each lane
   counts its next note in (the pad's approach ring closes, the target and pad
   light up) and the pad reads TAP, HOLD or LET GO at exactly the right time. */
#cue {
  left: max(14px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(1080px, calc(100vw - 250px));
  align-items: stretch;
  gap: 8px;
}
body:not(.has-glitch-dock) #cue { width: min(1180px, calc(100vw - 32px)); }
.cue-heading {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: rgba(8, 7, 14, .94);
  box-shadow: 0 6px 22px #0008;
}
#cue-label { padding: 0; background: none; font-size: clamp(14px, 2vw, 20px); }
#cue-progress { flex: 0 0 auto; color: var(--gold); font: 800 15px/1 var(--body); letter-spacing: .1em; }
#cue-hint {
  align-self: flex-start;
  min-height: 0;
  padding: 4px 10px;
  color: #d9faff;
  background: rgba(8, 7, 14, .84);
  font-size: 12px;
}
#cue.started #cue-hint { display: none; }
#lane-board {
  --pad-h: 82px;
  --pad-gap: 10px;
  --hit-inset: 30px;
  --note-h: 24px;
  position: relative;
  isolation: isolate;
  display: flex;
  gap: 14px;
  width: 100%;
  height: min(420px, 38vh);
  min-height: 250px;
}
.lane { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.lane:nth-child(1), .lane:nth-child(3) { --lane-color: #ff2d95; --lane-glow: #ff8ccb; --lane-deep: #6e0c43; --lane-dark: #210a1b; }
.lane:nth-child(2) { --lane-color: #27e7ff; --lane-glow: #a6f6ff; --lane-deep: #075568; --lane-dark: #071a26; }
.lane-notes {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--lane-color) 55%, transparent);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background:
    linear-gradient(rgba(244, 239, 228, .09) 1px, transparent 1px) center / 100% 18%,
    linear-gradient(180deg, color-mix(in srgb, var(--lane-dark) 50%, transparent), var(--lane-dark));
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--lane-color) 10%, transparent);
  transition: box-shadow .12s ease;
}
.lane.now .lane-notes, .lane.held .lane-notes { box-shadow: inset 0 -70px 60px -30px color-mix(in srgb, var(--lane-color) 55%, transparent); }
/* The hit line runs across each lane; the target bracket marks where the note lands. */
.lane-notes::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--hit-inset) - 1.5px);
  height: 3px;
  background: linear-gradient(90deg, #ffca38, #fff4b0, #ffca38);
  box-shadow: 0 0 8px #ffe08c;
  opacity: .75;
}
.lane-target {
  position: absolute;
  z-index: 1;
  left: 10%;
  right: 10%;
  bottom: calc(var(--hit-inset) - var(--note-h) / 2 - 3px);
  height: calc(var(--note-h) + 6px);
  border-radius: 10px;
  border: 2px solid color-mix(in srgb, var(--lane-color) 50%, transparent);
  pointer-events: none;
  transition: border-color .1s ease, box-shadow .1s ease, transform .1s ease;
}
.lane.near .lane-target { border-color: color-mix(in srgb, var(--lane-glow) calc(40% + var(--approach, 0) * 60%), transparent); }
.lane.now .lane-target { border-color: #fff; transform: scale(1.06); box-shadow: 0 0 16px var(--lane-color), 0 0 34px var(--lane-color), inset 0 0 10px #fff9; }
.lane.held .lane-target { border-color: #e6fdff; box-shadow: 0 0 18px #27e7ff, inset 0 0 12px #b8fbff; animation: sustain .16s linear infinite alternate; }
@keyframes sustain { to { box-shadow: 0 0 30px #27e7ff, inset 0 0 18px #fff; } }
.lane-note {
  position: absolute;
  z-index: 2;
  top: calc(var(--note-h) / -2);
  left: 50%;
  width: 74%;
  height: var(--note-h);
  pointer-events: none;
  will-change: transform;
}
.lane-note .head {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  border: 2px solid #fff;
  background: linear-gradient(180deg, #fff 0%, var(--lane-glow) 34%, var(--lane-color) 78%);
  box-shadow: 0 3px 0 var(--lane-deep), 0 0 14px color-mix(in srgb, var(--lane-color) 80%, transparent);
  transition: transform .08s ease, box-shadow .08s ease;
}
.lane-note.now .head { transform: scale(1.1, 1.2); box-shadow: 0 0 0 3px #fff, 0 0 24px var(--lane-color), 0 0 44px var(--lane-glow); }
.lane-note.hold .trail {
  position: absolute;
  z-index: -1;
  left: 32%;
  right: 32%;
  bottom: 50%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(to top, #c6fcff, rgba(39, 231, 255, .4));
  box-shadow: 0 0 14px rgba(39, 231, 255, .7);
}
/* The bar at the top of a hold is where you let go. */
.lane-note.hold .trail::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -55%;
  right: -55%;
  height: 8px;
  border-radius: 4px;
  background: #e8fdff;
  box-shadow: 0 0 12px #27e7ff;
}
.lane-note.held .head { background: linear-gradient(180deg, #fff, #c6fcff 50%, #27e7ff); box-shadow: 0 0 0 3px #fff, 0 0 30px #27e7ff; }
.lane-note.missed { opacity: 0; transition: opacity .38s ease-in; }
.lane-note.missed .head { background: #4a1d2a; border-color: #ff5a6a; box-shadow: none; }
.lane-note.missed .trail { background: #4a1d2a; box-shadow: none; }
.lane-burst {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: var(--hit-inset);
  width: 96%;
  height: 74px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, 50%) scale(.4);
  opacity: 0;
  animation: burst .38s ease-out;
}
.lane-burst::after {
  content: "";
  position: absolute;
  inset: 22% 6%;
  border-radius: 50%;
  border: 3px solid var(--burst, #fff);
}
.lane-burst.perfect { --burst: #ffe9a3; background: radial-gradient(ellipse at center, #fff 0%, #ffe9a3 20%, rgba(240, 193, 77, .6) 42%, transparent 70%); }
.lane-burst.good { --burst: var(--lane-glow); background: radial-gradient(ellipse at center, #fff 0%, color-mix(in srgb, var(--lane-glow) 70%, transparent) 30%, transparent 68%); }
.lane-burst.hold { --burst: #b8fbff; background: radial-gradient(ellipse at center, #e8fdff 0%, rgba(39, 231, 255, .55) 30%, transparent 66%); }
.lane-burst.miss { --burst: #ff5a6a; background: radial-gradient(ellipse at center, rgba(255, 90, 106, .7), transparent 62%); }
@keyframes burst {
  0% { opacity: 1; transform: translate(-50%, 50%) scale(.4); }
  100% { opacity: 0; transform: translate(-50%, 50%) scale(1.45); }
}
.lane-btn {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 var(--pad-h);
  width: min(160px, 86%);
  height: var(--pad-h);
  margin: var(--pad-gap) 0 0;
  border-radius: 18px;
  border: 3px solid color-mix(in srgb, var(--lane-color) 70%, white);
  background: linear-gradient(180deg, color-mix(in srgb, var(--lane-color) 34%, #1a1024), #120a18 90%);
  color: #fff;
  font: 800 clamp(12px, 1.3vw, 15px)/1 var(--body);
  letter-spacing: .1em;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 6px 0 var(--lane-deep), 0 10px 18px #0008;
  transition: transform .06s ease, box-shadow .08s ease, background .1s ease, color .1s ease;
}
.lane-btn .lane-word { position: relative; z-index: 1; pointer-events: none; }
.lane-btn .lane-key {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  background: #0006;
  color: #fff9;
  font: 700 10px/1.5 var(--body);
  pointer-events: none;
}
/* The approach ring closes onto the pad as the note reaches the line. */
.lane-btn::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 22px;
  border: 3px solid var(--lane-glow);
  opacity: 0;
  transform: scale(calc(1.5 - .5 * var(--approach, 0)));
  pointer-events: none;
}
.lane.near .lane-btn::after { opacity: calc(.2 + .8 * var(--approach, 0)); }
.lane.now .lane-btn {
  color: #140814;
  background: linear-gradient(180deg, #fff 0%, var(--lane-glow) 40%, var(--lane-color) 100%);
  box-shadow: 0 6px 0 var(--lane-deep), 0 0 24px var(--lane-color), 0 0 50px color-mix(in srgb, var(--lane-color) 55%, transparent);
  animation: pad-now .2s ease-in-out infinite alternate;
}
@keyframes pad-now { to { filter: brightness(1.22); } }
.lane.held .lane-btn {
  border-color: #e6fdff;
  background: linear-gradient(0deg, #27e7ff calc(var(--hold, 0) * 100%), #0d1f29 calc(var(--hold, 0) * 100%));
  box-shadow: 0 6px 0 #075568, 0 0 24px #27e7ff;
}
.lane.held .lane-btn::after { opacity: 0; }
.lane.release .lane-btn { color: #062a33; background: #fff; animation: pad-now .14s ease-in-out infinite alternate; }
.lane-btn.down { transform: translateY(4px); box-shadow: 0 2px 0 var(--lane-deep), 0 4px 10px #0008; }
.lane.hit-perfect .lane-btn { box-shadow: 0 6px 0 var(--lane-deep), 0 0 34px #ffe9a3, 0 0 70px var(--gold); }
.lane.hit-good .lane-btn { box-shadow: 0 6px 0 var(--lane-deep), 0 0 30px var(--lane-glow); }
.lane.hit-miss .lane-btn { border-color: #ff5a6a; animation: pad-miss .22s ease; }
@keyframes pad-miss { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
#grade-pop {
  z-index: 8;
  bottom: var(--grade-bottom, calc(214px + env(safe-area-inset-bottom)));
  font-size: clamp(20px, 3vw, 34px);
  white-space: nowrap;
  text-shadow: 0 2px 0 #140814, 0 0 18px currentColor;
}
#timing-feedback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#pips { display: none; }
@media (hover: none) and (pointer: coarse) {
  .lane-btn .lane-key { display: none; }
}
@media (max-width: 700px) {
  #cue {
    left: max(8px, env(safe-area-inset-left));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 122px);
  }
  body:not(.has-glitch-dock) #cue { width: calc(100vw - 16px); }
  .cue-heading { min-height: 38px; padding: 0 9px; gap: 8px; }
  #cue-label { font-size: 12px; letter-spacing: .1em; }
  #cue-progress { font-size: 12px; }
  #cue-hint { font-size: 10px; padding: 3px 7px; }
  #lane-board {
    --pad-h: 62px;
    --pad-gap: 8px;
    --hit-inset: 24px;
    --note-h: 20px;
    height: min(280px, 32vh);
    min-height: 190px;
    gap: 6px;
  }
  .lane-btn { width: 92%; border-radius: 14px; font-size: 11px; letter-spacing: .06em; }
  .lane-btn::after { border-radius: 18px; }
  #glitch-dock { width: 102px; padding: 6px; gap: 4px; }
  #glitch-dock #glitch-btn { width: 64px; height: 64px; }
  #glitch-readout { font-size: 10px; }
  #glitch-dock #momentum { font-size: 9px; }
  #grade-pop { font-size: 19px; }
}
@media (max-height: 620px) {
  #lane-board { height: min(320px, 38vh); min-height: 170px; }
}
@media (prefers-reduced-motion: reduce) {
  .lane-btn, .lane-note .head, .lane-target { transition: none; }
}

/* Pause: the show freezes, the HUD steps aside and the camera is free. */
#pause-btn { border-color: var(--gold); color: var(--gold); }
#pause-btn[aria-pressed="true"] { background: var(--gold); color: #140814; }
body.paused #cue,
body.paused #glitch-dock,
body.paused #hud,
body.paused #heat-badge,
body.paused #callout,
body.paused #grade-pop,
body.paused #toasts { visibility: hidden; }
body.paused #c { cursor: grab; touch-action: none; }
body.paused #c.dragging { cursor: grabbing; }
body.paused #fx-overlay { background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.42) 100%); }
#pause-panel {
  position: fixed;
  z-index: 12;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(820px, calc(100vw - 20px));
  padding: 14px 18px 16px;
  background: rgba(14, 10, 20, 0.86);
  border: 1px solid rgba(240, 193, 77, 0.45);
  border-radius: 22px;
  box-shadow: 0 12px 40px #000a;
  backdrop-filter: blur(6px);
  animation: pause-in 0.24s ease;
}
@keyframes pause-in {
  from { opacity: 0; transform: translate(-50%, 18px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.pause-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.pause-head h2 { margin: 0; font-size: clamp(30px, 5vw, 44px); }
.pause-hint { margin: 0 0 4px; max-width: 420px; color: #d9d2e0; font-size: 12px; line-height: 1.45; text-align: right; }
.pause-hint .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .pause-hint .hint-mouse { display: none; }
  .pause-hint .hint-touch { display: inline; }
}
#pause-error:empty { display: none; }
#pause-error { margin: 8px 0 0; color: #ffadbb; font-size: 13px; }
.pause-actions { display: flex; gap: 10px; margin-top: 12px; }
.pause-actions > * { flex: 1; margin: 0; min-height: 48px; }
.pause-actions .go { flex: 1.4; }
.loading-card h2 { font-size: clamp(26px, 5vw, 38px); margin: 0; }
@media (max-width: 700px) {
  #pause-panel { padding: 12px 12px 14px; border-radius: 18px; }
  .pause-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pause-hint { text-align: left; font-size: 11px; }
  .pause-actions { flex-wrap: wrap; gap: 8px; }
  .pause-actions > * { flex: 1 1 40%; min-height: 44px; font-size: 13px; }
  .pause-actions .go { flex-basis: 100%; }
}

/* Menus: few words, and the primary action pinned to the bottom of each panel. */
.panel:has(> .panel-actions) { padding-bottom: 0; }
.panel-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 12px -20px 0;
  padding: 14px 20px 18px;
  background: linear-gradient(180deg, rgba(10, 8, 16, 0), rgba(10, 8, 16, .97) 14px);
}
.panel-actions .status { margin: 0 0 8px; min-height: 0; text-align: center; }
.panel-actions .status:empty { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sheet-head h2, .sheet-head .kicker { margin: 0; }
.sheet-head h2 { font-size: clamp(26px, 4.6vw, 42px); line-height: 1; }
.card.locked b { right: 46px; }
.chip-button {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--outline);
  background: rgba(33, 28, 40, .9);
  color: var(--gold);
  font: 800 11px var(--body);
  letter-spacing: .07em;
}
.stakes-line { margin: 0 0 8px; color: #ddd4c6; font-size: 14px; }
.cage-tag { color: #ff9a4d; }
.unlock-line { margin: 0 0 10px; color: var(--gold); font-size: 13px; font-weight: 700; }
.rivalry span.met { color: #39ff88; }
.rivalry span.missed { color: #ff91a1; }
.xp-lines { margin: 0 0 6px; font-size: 12px; color: #c9bfcf; }
details.how-to ul { margin: 2px 0 8px; padding-left: 18px; }
details.how-to li { margin: 4px 0; }
.keys { margin: 0; font-size: 13px; color: #c9bfcf; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 5px;
  border: 1px solid #817487;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #2a2333;
  color: var(--paper);
  font: 700 11px/1.4 var(--body);
  text-align: center;
}
@media (max-width: 600px) {
  .panel-actions { margin: 10px -14px 0; padding: 12px 14px 14px; }
  .panel-actions .go, .panel-actions .ghost { min-height: 46px; }
  .sheet-head h2 { font-size: 26px; }
  .chip-button { min-height: 36px; padding: 0 10px; font-size: 10px; }
}
@media (max-height: 540px) {
  .panel-actions { padding: 8px 20px 10px; margin-top: 8px; }
  .panel-actions .go, .panel-actions .ghost { min-height: 42px; }
  .sheet-head { margin-bottom: 6px; }
  .sheet-head h2 { font-size: clamp(22px, 4vw, 32px); }
  .chip-button { min-height: 34px; }
}
