:root {
  color-scheme: dark;
  font-family: "Noto Sans HK", system-ui, sans-serif;
  --ink: #faf5ff;
  --muted: #d2c4e8;
  --cyan: #8ef8ff;
  --pink: #ffadea;
  --mono: "IBM Plex Mono", monospace;
  --display: "Barlow Condensed", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 15% 90%, #6326538c, transparent 58%),
    radial-gradient(ellipse at 85% 0%, #205280b3, transparent 55%), #17112b;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--cyan); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
[hidden] { display: none !important; }
.shell { width: min(100% - 32px, 1040px); margin-inline: auto; }
.game-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 17px;
  border-bottom: 1px solid #cdb4f14d;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.game-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 20px; }
h1 { margin: 0; font-size: clamp(36px, 7vw, 66px); font-weight: 900; letter-spacing: -.06em; line-height: 1.1; }
.game-heading p { margin: 6px 0 0; color: var(--pink); font-weight: 700; }
.game-heading p span { color: var(--muted); font: 500 12px var(--mono); }
.sound { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.sound input { accent-color: var(--cyan); }
.game-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(245px, 1fr); align-items: start; gap: 16px; padding-bottom: 24px; }
.cabinet, .game-panel { border: 1px solid #cdb4f155; border-radius: 16px; background: #1d1533; }
.cabinet {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: clamp(9px, 2vw, 22px);
  background: repeating-linear-gradient(132deg, transparent 0 40px, #ffffff08 40px 41px, transparent 41px 70px),
    radial-gradient(ellipse at 50% 45%, #553c89, #1d1533 75%);
}
.field {
  position: relative;
  isolation: isolate;
  width: min(100%, 490px);
  aspect-ratio: 1;
  scroll-margin: 8px;
}
.field::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(#d9c9f222 0deg 11.25deg, #b6e4ff52 11.25deg 33.75deg, #d9c9f222 33.75deg 45deg);
  mask-image: radial-gradient(circle, transparent 54.8%, #000 55.3% 68%, transparent 68.8%);
}
.track {
  position: absolute;
  inset: 11%;
  border: 2px solid #d5bbfc;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, transparent 0 23px, #ba9fe138 24px 25px, transparent 26px 42px),
    repeating-conic-gradient(from 22.5deg, #d1bafc3b 0deg 1deg, transparent 1deg 45deg),
    radial-gradient(circle, #4a3674, #1e1438 72%);
  box-shadow: 0 0 0 5px #af80e951, 0 0 25px #c89af26e, inset 0 0 30px #120d26;
}
.notes, .pads { position: absolute; inset: 0; }
.notes { pointer-events: none; }
.note, .pad { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; }
.note {
  width: 8%;
  aspect-ratio: 1;
  border: clamp(2px, .55vw, 5px) solid var(--note-color);
  box-shadow: 0 0 10px var(--note-color), inset 0 0 10px var(--note-color);
}
.note-hold {
  transform: translate(-50%, -50%) rotate(var(--note-angle));
  border-color: #ffda87;
  border-radius: 27%;
  background: #8d5d30;
  box-shadow: 0 0 11px #ffda87;
}
.note-hold::before {
  content: "";
  position: absolute;
  width: var(--tail);
  height: 70%;
  top: 15%;
  right: 89%;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, #fbb65740, #ffda87);
}
.note-hold.is-held { background: #ffda87; }
.note-break {
  border: 4px double #ffa97a;
  background: #ed74344d;
  box-shadow: 0 0 14px #ff874a, inset 0 0 11px #ff874a;
}
.note-break::after { content: "✦"; display: grid; place-items: center; height: 100%; color: #ffe4bc; font-size: clamp(9px, 2.6vw, 17px); }
.note-slide {
  z-index: 1;
  display: grid;
  place-items: center;
  border: 0;
  color: #c9f9ff;
  font-size: clamp(19px, 5vw, 34px);
  line-height: 1;
  text-shadow: 0 0 13px #34e9ff, 0 2px 3px #14102c;
  box-shadow: none;
}
.slide-path {
  position: absolute;
  height: 0;
  border-top: 3px dashed #8ef8ff;
  transform-origin: left center;
  filter: drop-shadow(0 0 5px #55e9ff);
}
.slide-path::after {
  content: "";
  position: absolute;
  right: 0;
  top: -7px;
  width: 11px;
  height: 11px;
  border: 2px solid #b1fcff;
  border-left: 0;
  border-bottom: 0;
  transform: rotate(45deg);
}
.touch-note {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-content: center;
  width: max(16%, 48px);
  aspect-ratio: 1;
  border: 2px solid #ffb4f4;
  border-radius: 50%;
  background: #552857;
  color: #fff2fc;
  font: 800 clamp(13px, 3.5vw, 24px)/1 var(--display);
  transform: translate(-50%, -50%);
  touch-action: manipulation;
}
.touch-note small { margin-top: 3px; font: 600 8px var(--mono); }
.touch-note::before {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px dashed #ffb4f4;
  border-radius: 50%;
  transform: scale(var(--touch-ring, 1));
  box-shadow: 0 0 12px #ff8ce9;
  pointer-events: none;
}
.pad {
  display: grid;
  place-content: center;
  justify-items: center;
  width: max(13%, 36px);
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid var(--pad-color);
  background: #2b2045;
  color: var(--ink);
  font: 800 clamp(19px, 4vw, 28px)/1 var(--display);
  box-shadow: inset 0 -4px #100a27, 0 0 12px #d6aef04b;
  touch-action: none;
  user-select: none;
}
.pad small { color: var(--pad-color); font: 600 clamp(8px, 1.8vw, 11px)/1 var(--mono); }
.pad:not(:disabled):hover { background: #3c2a60; }
.pad:disabled { cursor: default; }
.pad.is-hit { color: #211138; background: var(--pad-color); box-shadow: 0 0 22px var(--pad-color); }
.pad.is-hit small { color: #211138; }
.pad.is-miss { border-color: #ff91b8; background: #653452; }
.readout {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 35%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 4px #1c1036, 0 0 16px #1c1036;
}
.readout strong { font: 800 clamp(25px, 5.2vw, 56px)/.95 var(--display); color: var(--cyan); }
.readout strong[data-grade="good"] { color: #ffdc91; }
.readout strong[data-grade="miss"] { color: #ffacd1; }
.readout span { margin-top: 5px; color: var(--ink); font: 600 clamp(9px, 2vw, 13px) var(--mono); }
progress { width: 100%; height: 8px; accent-color: var(--cyan); }
.game-panel { display: grid; gap: 16px; padding: 18px; }
.scoreboard, .tally { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; }
.scoreboard div, .tally div { padding: 7px 9px; border: 1px solid #d4b4ff3b; border-radius: 8px; background: #2d2147; }
.scoreboard dt, .tally dt { color: var(--muted); font-size: 12px; }
.scoreboard dd, .tally dd { margin: 0; color: var(--cyan); font: 800 31px/1.1 var(--display); }
.game-panel h2 { margin: 0 0 4px; font-size: 19px; }
.game-panel p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.note-guide { display: grid; gap: 4px; margin: 10px 0 0; }
.note-guide div { display: grid; grid-template-columns: 73px 1fr; gap: 8px; align-items: baseline; }
.note-guide dt { font: 800 15px var(--display); letter-spacing: .06em; }
.note-guide dd { margin: 0; color: var(--muted); font-size: 12px; }
.guide-tap, .guide-slide { color: var(--cyan); }
.guide-hold { color: #ffda87; }
.guide-touch { color: var(--pink); }
.guide-break { color: #ffa97a; }
.game-result h2 { color: var(--pink); font: 800 40px/1 var(--display), "Noto Sans HK", sans-serif; }
.tally { margin-top: 10px; }
.tally dd { font-size: 23px; }
.start, .stop { min-height: 45px; border-radius: 9px; font-weight: 900; }
.start { border: 1px solid #fff; color: #221339; background: linear-gradient(110deg, var(--cyan), var(--pink)); }
.start:hover { background: #fff; }
.stop { border: 1px solid #cbafe482; color: var(--ink); background: #2d2147; }
.stop:hover { background: #453164; }
.boss-start { border-color: #f1a9e8; color: #ffd5f6; }
.extra-stage {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #ffe1fa;
  border-radius: 9px;
  background: linear-gradient(115deg, #ffd0ee, #a7f5ff);
  color: #2c1d47;
}
.extra-stage:hover { color: #2c1d47; background: #fff1fc; }
.extra-stage span { font-size: 13px; }
@media (max-width: 680px) {
  .game-grid { grid-template-columns: 1fr; gap: 10px; }
  .game-heading { padding-block: 14px; }
  .game-panel { padding: 12px; gap: 10px; }
  .start, #stop { grid-row: 1; }
  .boss-start { grid-row: 2; }
}
