:root {
  color-scheme: light;
  font-family: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #533224;
  background: #302822;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100svh;
  margin: 0;
  display: grid;
  place-items: center;
  overscroll-behavior: none;
  user-select: none;
}
button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible { outline: 3px solid #151310; outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.game {
  position: relative;
  isolation: isolate;
  width: min(100%, calc(100svh * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  container-type: inline-size;
  background: #f7ebdc;
}
.scenery, #notes, .controls { position: absolute; inset: 0; pointer-events: none; }
.layer { position: absolute; display: block; width: var(--w); height: var(--h); left: var(--x); top: var(--y); }
.stage { --x: 0; --y: 0; --w: 100%; --h: 100%; }
.title-plate { --x: 5.1497%; --y: .9564%; --w: 27.8443%; --h: 17.3220%; }
.score-plate { --x: 70.4790%; --y: 3.0818%; --w: 24.3114%; --h: 8.5016%; }
.combo-plate { --x: 72.6946%; --y: 11.5834%; --w: 21.2575%; --h: 8.0765%; }
.drummer-underlay { --x: 20.4790%; --y: 20.4038%; --w: 8.0838%; --h: 24.6546%; }
.drummer-arm {
  --x: 20.8383%; --y: 25.9299%; --w: 4.9701%; --h: 17.6408%;
  transform-origin: 26.506% 60.843%;
}
.track { --x: .4192%; --y: 55.8980%; --w: 99.1018%; --h: 19.3411%; }
.target { --x: 7.3653%; --y: 52.8162%; --w: 14.1317%; --h: 24.4421%; }
.pad-red { --x: 5.3892%; --y: 77.5770%; --w: 43.3533%; --h: 16.4718%; }
.pad-blue { --x: 51.2575%; --y: 77.5770%; --w: 43.5928%; --h: 16.4718%; }

#score, #combo {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #ae2522;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(10px, 2.62cqw, 51px);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  font-weight: 700;
}
#score { top: 7.6514%; left: 87.1257%; }
#combo { top: 14.8789%; left: 87.4251%; }

.note {
  position: absolute;
  top: 65.0372%;
  width: 5.47cqw;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}
.note-disc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: scale(calc(1 + .36 * var(--emphasis, 0)));
  filter: brightness(calc(1 + .38 * var(--emphasis, 0)));
}
.note.red, .impact[data-tone="red"] { --ring-color: #ff9973; }
.note.blue, .impact[data-tone="blue"] { --ring-color: #85e8ff; }
.note::after, .impact::after {
  content: "";
  position: absolute;
  inset: -9%;
  border: max(2px, .32cqw) solid var(--ring-color);
  border-radius: 50%;
  box-shadow: 0 0 .4cqw #fff5d7, inset 0 0 .3cqw #fff5d7;
}
.note::after {
  opacity: var(--emphasis, 0);
  transform: scale(calc(1 + .36 * var(--emphasis, 0)));
}
.impact {
  position: absolute;
  left: 14.3713%;
  top: 65.0372%;
  width: 5.47cqw;
  aspect-ratio: 1;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(var(--burst-scale, 1));
}
.impact img { display: block; width: 100%; height: 100%; filter: brightness(1.22); }
.impact::after {
  inset: -17%;
  border-width: max(2px, .42cqw);
  box-shadow: 0 0 0 .18cqw #fff7df, 0 0 .85cqw var(--ring-color), inset 0 0 .45cqw #fff5d7;
}
.impact-flash {
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  background: radial-gradient(circle, #fffdf5 18%, #fff3d6 56%, transparent 76%);
  opacity: var(--flash-opacity, 0);
}
.impact-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: .85cqw;
  height: .34cqw;
  border-radius: 20%;
  background: #fff9df;
  box-shadow: 0 0 .42cqw var(--ring-color);
  transform: translate(-50%, -50%) rotate(var(--ray)) translateX(4.05cqw);
}
.note-trail {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9.58cqw;
  height: 2.75cqw;
  transform: translateY(-50%);
}
.judgment {
  position: absolute;
  top: 61.2115%;
  left: 24.3713%;
  transform: translate(-50%, -50%) scale(var(--judgment-scale, 1));
  font-size: clamp(11px, 2.12cqw, 40px);
  font-weight: 850;
  text-shadow: 0 1px 2px #fff4db;
}
.judgment[data-result="Perfect"], .judgment[data-result="Good"] {
  padding: .12em .34em;
  border: max(1px, .09cqw) solid #fff8df;
  border-radius: .36em;
  color: #fff9df;
  text-shadow: 0 1px 2px #553323;
  box-shadow: 0 .12cqw .32cqw #55332340;
}
.judgment[data-result="Perfect"] { background: #a82c24; }
.judgment[data-result="Good"] { background: #176283; }

.pad {
  pointer-events: auto;
  padding: 0 0 1.2cqw;
  color: #fff9f0;
  background: transparent;
  border: 0;
  border-radius: 4cqw;
  font-weight: 850;
  font-size: clamp(15px, 3.35cqw, 63px);
  text-shadow: 0 .14cqw .26cqw #472c274d;
}
.pad::after {
  content: "";
  position: absolute;
  inset: 12% 4.4% 22%;
  border-radius: 3.2cqw;
  pointer-events: none;
  background-color: #fff8e7;
  opacity: 0;
  transition: opacity .13s ease-out;
}
.pad.pressed::after { opacity: .27; }
kbd { font: inherit; }

.card {
  position: absolute;
  isolation: isolate;
  top: 21.1477%;
  left: 30.4790%;
  width: 39.0419%;
  height: 32.7311%;
  text-align: center;
  padding: 7.05cqw .35cqw 0;
}
.card-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}
.card h2 { font-size: clamp(12px, 2.4cqw, 46px); line-height: 1.06; margin: 0 0 .35cqw; font-weight: 850; }
.card p { font-size: clamp(8px, 1.22cqw, 23px); margin: 0 0 .5cqw; line-height: 1.18; white-space: pre-line; }
.card p:empty { display: none; }
.card button {
  color: #6e3828;
  background: #ffe8b7;
  border: max(1px, .13cqw) solid #dba05c;
  border-radius: .65cqw;
  box-shadow: 0 .13cqw .3cqw #a45e2638;
  padding: .26em 1.3em;
  min-height: 20px;
  font-size: clamp(10px, 1.7cqw, 32px);
  font-weight: 800;
}
.card button:disabled { opacity: .65; cursor: wait; }
.rotate { display: none; }

@media (pointer: coarse) { kbd { display: none; } }
@media (orientation: portrait) {
  .rotate { position: fixed; bottom: max(1em, env(safe-area-inset-bottom)); display: block; color: #fff1d8; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .pad::after { transition: none; } }
