:root {
  --capoo: #55c9e9;
  --capoo-dark: #1598c0;
  --ink: #292a30;
  --cream: #fffaf0;
  --yellow: #ffe35b;
  --coral: #ff7178;
  --pink: #ff9bc6;
  --mint: #8be0b1;
  --lane-0: #ff7178;
  --lane-1: #ffe35b;
  --lane-2: #55c9e9;
  --groove: 50%;
  color-scheme: light;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

body {
  color: var(--ink);
  font-family: "Avenir Next Condensed", "Hiragino Sans GB", "PingFang SC", sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--cream);
}

.game-shell::after {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 300;
  border: 2px solid var(--ink);
  pointer-events: none;
}

.halftone {
  position: absolute;
  inset: 0;
  z-index: 250;
  opacity: .055;
  pointer-events: none;
  background-image: radial-gradient(circle, #1d1e23 0 1px, transparent 1.25px);
  background-size: 8px 8px;
  mix-blend-mode: multiply;
}

.speed-lines {
  position: absolute;
  inset: 0;
  z-index: 240;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.speed-lines::before,
.speed-lines::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: repeating-conic-gradient(from 90deg at 50% 50%, transparent 0deg 5deg, rgba(255,255,255,.16) 5.2deg 5.7deg);
  animation: fever-spin 4s linear infinite;
}

.speed-lines::after {
  background: repeating-radial-gradient(circle, transparent 0 14px, rgba(255,227,91,.12) 15px 17px);
  animation: fever-pulse .55s ease-in-out infinite alternate;
}

.game-shell.is-fever .speed-lines {
  opacity: 1;
}

@keyframes fever-spin { to { transform: rotate(360deg) scale(1.2); } }
@keyframes fever-pulse { to { transform: scale(1.08); } }

/* Header */
.topbar {
  position: relative;
  z-index: 80;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 76px;
  padding: 12px clamp(22px, 3vw, 48px);
  border-bottom: 3px solid var(--ink);
  background: var(--cream);
}

.topbar::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 38%;
  height: 6px;
  background: var(--coral);
  clip-path: polygon(0 0, 100% 0, 98% 100%, 0 100%);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  color: var(--ink);
  text-decoration: none;
}

.brand__stamp {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  margin-right: 12px;
  border: 3px solid var(--ink);
  border-radius: 11px 16px 9px 14px;
  background: var(--capoo);
  box-shadow: 5px 5px 0 var(--yellow);
  font: 900 15px/1 "Cooper Black", "Avenir Next Condensed", sans-serif;
  transform: rotate(-4deg);
  transition: transform .2s, box-shadow .2s;
}

.brand:hover .brand__stamp {
  transform: rotate(2deg) translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--yellow);
}

.brand b,
.brand small {
  display: block;
}

.brand b {
  font: 900 11px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .2em;
}

.brand small {
  margin-top: 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
}

.hud {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hud__item {
  min-width: 68px;
  text-align: center;
}

.hud__item span,
.hud__item strong {
  display: block;
}

.hud__item span {
  margin-bottom: 4px;
  font: 900 7px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .18em;
}

.hud__item strong {
  font: 900 21px/1 "Futura Condensed ExtraBold", "Avenir Next Condensed", sans-serif;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}

.hud__item strong b {
  font-weight: inherit;
}

.hud__item--score strong {
  color: var(--capoo-dark);
}

.hud__slash {
  font: 300 30px/1 "Bodoni 72", serif;
  transform: rotate(13deg);
}

.sound-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: var(--cream);
  cursor: pointer;
  font: 900 8px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .13em;
  transition: color .2s, background .2s, transform .2s;
}

.sound-toggle:hover {
  background: var(--ink);
  color: var(--cream);
  transform: translateY(-2px);
}

.sound-toggle i {
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(139,224,177,.26);
}

.sound-toggle[aria-pressed="false"] i {
  background: transparent;
  box-shadow: none;
}

/* Main stage */
.game-stage {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(300px, 37%) 1fr;
  height: calc(100% - 76px);
  overflow: hidden;
}

.party-booth {
  position: relative;
  overflow: hidden;
  border-right: 4px solid var(--ink);
  background:
    linear-gradient(145deg, transparent 0 47%, rgba(255,255,255,.24) 47.4% 48%, transparent 48.4%),
    radial-gradient(circle at 17% 88%, var(--pink) 0 18%, transparent 18.4%),
    linear-gradient(150deg, var(--yellow) 0 51%, var(--capoo) 51% 100%);
}

.party-booth::before {
  content: "";
  position: absolute;
  top: -18%;
  right: -34%;
  width: 84%;
  aspect-ratio: 1;
  border: 31px solid rgba(255,255,255,.32);
  border-radius: 50%;
}

.party-booth::after {
  content: "PARTY / PARTY / PARTY /";
  position: absolute;
  left: -14px;
  bottom: 41%;
  color: rgba(41,42,48,.14);
  font: 900 clamp(54px, 7vw, 110px)/.75 "Futura Condensed ExtraBold", "Avenir Next Condensed", sans-serif;
  letter-spacing: -.07em;
  white-space: nowrap;
  transform: rotate(-90deg) translateX(-30%);
  transform-origin: left bottom;
}

.booth-sign {
  position: absolute;
  top: 23px;
  left: 24px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 2px solid var(--ink);
  background: var(--cream);
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(-2deg);
}

.booth-sign span {
  padding: 4px 5px;
  background: var(--coral);
  color: var(--cream);
  font: 900 7px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .16em;
  animation: live-blink 1s steps(2) infinite;
}

@keyframes live-blink { 50% { opacity: .35; } }

.booth-sign b {
  font-size: 10px;
  letter-spacing: .12em;
}

.dj-wrap {
  position: absolute;
  top: 12%;
  left: 50%;
  z-index: 5;
  width: min(85%, 410px);
  aspect-ratio: 1.18;
  transform: translateX(-50%);
}

.dj-ring {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 75%;
  aspect-ratio: 1;
  border: 19px solid rgba(255,113,120,.72);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: record-spin 7s linear infinite;
}

.dj-ring::before,
.dj-ring::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.dj-ring::before {
  inset: 12%;
  border: 4px dashed var(--ink);
}

.dj-ring::after {
  inset: 39%;
  background: var(--yellow);
  border: 4px solid var(--ink);
}

@keyframes record-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.dj-capoo {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(10px 14px 0 rgba(41,42,48,.18));
}

.reaction-wrap {
  position: absolute;
  left: 8%;
  bottom: 8%;
  z-index: 10;
  width: clamp(135px, 17vw, 245px);
  height: clamp(120px, 16vw, 230px);
  border: 3px solid var(--ink);
  border-radius: 50% 46% 42% 48%;
  background: var(--cream);
  box-shadow: 8px 8px 0 var(--ink);
  transform: rotate(-3deg);
  transition: transform .18s;
}

.reaction-wrap.is-pop {
  animation: reaction-pop .35s cubic-bezier(.2,.8,.2,1);
}

@keyframes reaction-pop {
  0% { transform: rotate(-3deg) scale(.78); }
  65% { transform: rotate(2deg) scale(1.08); }
  100% { transform: rotate(-3deg) scale(1); }
}

.reaction-capoo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.08);
}

.reaction-bubble {
  position: absolute;
  right: -28px;
  top: -24px;
  min-width: 78px;
  padding: 8px 9px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  transform: rotate(7deg);
}

.reaction-bubble::after {
  content: "";
  position: absolute;
  left: 5px;
  bottom: -10px;
  border-top: 12px solid var(--ink);
  border-right: 12px solid transparent;
  transform: rotate(25deg);
}

.speaker {
  position: absolute;
  right: 6%;
  bottom: 10%;
  z-index: 4;
  width: 88px;
  height: 125px;
  border: 4px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  box-shadow: 8px 8px 0 rgba(41,42,48,.2);
  transform: rotate(4deg);
}

.speaker--left { display: none; }

.speaker i,
.speaker b {
  position: absolute;
  left: 50%;
  border: 5px solid var(--cream);
  border-radius: 50%;
  transform: translateX(-50%);
}

.speaker i {
  top: 13px;
  width: 34px;
  height: 34px;
  background: var(--pink);
}

.speaker b {
  bottom: 12px;
  width: 56px;
  height: 56px;
  background: var(--capoo-dark);
}

.game-shell[data-state="playing"] .speaker b,
.game-shell[data-state="countdown"] .speaker b {
  animation: speaker-pulse .508s ease-in-out infinite;
}

@keyframes speaker-pulse { 50% { transform: translateX(-50%) scale(.84); } }

.groove-meter {
  position: absolute;
  right: 5%;
  top: 42%;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 12px auto;
  align-items: end;
  gap: 6px;
  height: 132px;
  padding: 9px 8px;
  border: 2px solid var(--ink);
  background: rgba(255,250,240,.86);
  box-shadow: 4px 4px 0 var(--ink);
}

.groove-meter > span {
  align-self: center;
  font: 900 7px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .15em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.groove-meter > div {
  position: relative;
  width: 12px;
  height: 100%;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--cream);
}

.groove-meter > div i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--groove);
  background: linear-gradient(to top, var(--coral), var(--yellow), var(--mint));
  transition: height .2s;
}

.groove-meter > b {
  font: 900 9px/1 "Avenir Next Condensed", sans-serif;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

/* Rhythm board */
.beat-board {
  position: relative;
  display: grid;
  grid-template-rows: 35px 1fr 92px;
  min-width: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
}

.board-head {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 2px solid rgba(255,255,255,.28);
  background: #1c1d22;
  font: 900 8px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .2em;
}

.board-head b {
  color: var(--yellow);
}

.lanes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(to bottom, transparent 0 78%, rgba(255,255,255,.05) 78% 100%),
    repeating-linear-gradient(to bottom, transparent 0 48px, rgba(255,255,255,.035) 49px 50px),
    #292a30;
}

.lanes::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,.04), transparent 26%, rgba(0,0,0,.32));
}

.lane {
  position: relative;
  z-index: 1;
  border-right: 2px solid rgba(255,255,255,.13);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--lane-color) 12%, transparent), transparent 58%);
}

.lane:last-of-type {
  border-right: 0;
}

.lane--0 { --lane-color: var(--lane-0); }
.lane--1 { --lane-color: var(--lane-1); }
.lane--2 { --lane-color: var(--lane-2); }

.lane > span {
  position: absolute;
  left: 10px;
  top: 10px;
  color: rgba(255,255,255,.2);
  font: 900 10px/1 "Avenir Next Condensed", sans-serif;
}

.notes-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.beat-note {
  --note-color: var(--coral);
  position: absolute;
  left: var(--lane-x);
  top: 0;
  display: grid;
  place-items: center;
  width: clamp(45px, 5.2vw, 72px);
  aspect-ratio: 1;
  border: 4px solid var(--cream);
  border-radius: 50%;
  background: var(--note-color);
  color: var(--ink);
  box-shadow: 0 7px 0 rgba(0,0,0,.35), inset 0 0 0 4px var(--ink);
  opacity: 0;
  transform: translate(-50%, calc(var(--note-y) - 50%));
  font: 900 clamp(13px, 1.4vw, 20px)/1 "Cooper Black", "Avenir Next Condensed", sans-serif;
  will-change: transform, opacity;
}

.beat-note--0 { --note-color: var(--lane-0); }
.beat-note--1 { --note-color: var(--lane-1); }
.beat-note--2 { --note-color: var(--lane-2); }

.beat-note.is-visible { opacity: 1; }
.beat-note.is-hit { animation: note-hit .34s cubic-bezier(.2,.8,.2,1) forwards; }
.beat-note.is-missed { animation: note-miss .32s ease forwards; }

@keyframes note-hit {
  0% { opacity: 1; scale: 1; }
  55% { opacity: 1; scale: 1.45; rotate: 12deg; }
  100% { opacity: 0; scale: 2.1; rotate: -15deg; }
}

@keyframes note-miss {
  to { opacity: 0; filter: grayscale(1); translate: 0 32px; scale: .65; }
}

.target-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 78%;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  height: 6px;
  background: var(--cream);
  box-shadow: 0 0 22px rgba(255,255,255,.35);
  pointer-events: none;
}

.target-line i {
  justify-self: center;
  width: clamp(62px, 7vw, 100px);
  height: clamp(62px, 7vw, 100px);
  border: 4px solid var(--cream);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--ink), 0 0 0 2px var(--ink);
}

.target-line i:nth-child(1) { background: rgba(255,113,120,.2); }
.target-line i:nth-child(2) { background: rgba(255,227,91,.2); }
.target-line i:nth-child(3) { background: rgba(85,201,233,.2); }

.judge-text {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 30;
  padding: 8px 13px 6px;
  border: 3px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  opacity: 0;
  font: 900 clamp(22px, 3vw, 48px)/.8 "Cooper Black", "Avenir Next Condensed", sans-serif;
  letter-spacing: -.05em;
  transform: translate(-50%, -50%) rotate(-4deg) scale(.6);
  pointer-events: none;
}

.judge-text.is-showing {
  animation: judge-pop .42s cubic-bezier(.15,.8,.2,1);
}

.judge-text.is-good { background: var(--capoo); }
.judge-text.is-miss { background: var(--coral); color: var(--cream); }

@keyframes judge-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-7deg) scale(.3); }
  45% { opacity: 1; transform: translate(-50%, -50%) rotate(2deg) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -70%) rotate(-2deg) scale(.96); }
}

.pads {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border-top: 3px solid var(--cream);
  background: var(--cream);
}

.pad {
  --pad-color: var(--coral);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 14px);
  border: 0;
  background: var(--pad-color);
  color: var(--ink);
  cursor: pointer;
  transition: filter .12s, transform .12s;
  touch-action: manipulation;
}

.pad--0 { --pad-color: var(--lane-0); }
.pad--1 { --pad-color: var(--lane-1); }
.pad--2 { --pad-color: var(--lane-2); }

.pad:hover {
  filter: brightness(1.08);
}

.pad.is-pressed {
  transform: translateY(5px) scale(.97);
  filter: brightness(.88);
}

.pad kbd {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 0 4px 0 var(--ink);
  font: 900 15px/1 "Futura", "Avenir Next Condensed", sans-serif;
}

.pad span {
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 900;
}

.pad.is-pressed kbd {
  box-shadow: 0 1px 0 var(--ink);
  transform: translateY(3px);
}

/* Fever */
.fever-banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 45%;
  z-index: 210;
  display: flex;
  justify-content: space-around;
  padding: 9px 0 7px;
  border-block: 3px solid var(--ink);
  background: var(--pink);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  font: 900 clamp(26px, 4vw, 58px)/.8 "Cooper Black", "Avenir Next Condensed", sans-serif;
  transform: rotate(-3deg) scaleX(1.08) translateX(-120%);
}

.game-shell.is-fever .fever-banner {
  animation: fever-swipe 1.1s cubic-bezier(.15,.8,.2,1);
}

@keyframes fever-swipe {
  0% { opacity: 0; transform: rotate(-3deg) scaleX(1.08) translateX(-120%); }
  22%, 72% { opacity: 1; transform: rotate(-3deg) scaleX(1.08) translateX(0); }
  100% { opacity: 0; transform: rotate(-3deg) scaleX(1.08) translateX(120%); }
}

/* Intro */
.intro-screen,
.result-screen {
  position: absolute;
  inset: 0;
  z-index: 150;
  overflow: hidden;
  background: var(--cream);
  transition: opacity .55s, visibility .55s;
}

.intro-screen {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  padding: clamp(90px, 12vh, 130px) clamp(40px, 7vw, 110px) clamp(38px, 7vh, 70px);
  background:
    linear-gradient(114deg, transparent 0 58%, rgba(255,255,255,.34) 58.3% 59%, transparent 59.3%),
    radial-gradient(circle at 88% 9%, var(--yellow) 0 18%, transparent 18.3%),
    linear-gradient(135deg, var(--capoo) 0 65%, var(--pink) 65% 100%);
}

.intro-screen::before {
  content: "BEAT\A MACHINE";
  position: absolute;
  right: -3vw;
  bottom: -6vh;
  color: rgba(41,42,48,.08);
  font: 900 clamp(120px, 18vw, 280px)/.62 "Futura Condensed ExtraBold", "Avenir Next Condensed", sans-serif;
  white-space: pre;
  letter-spacing: -.09em;
}

.game-shell[data-state="countdown"] .intro-screen,
.game-shell[data-state="playing"] .intro-screen,
.game-shell[data-state="result"] .intro-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-copy {
  position: relative;
  z-index: 3;
  align-self: center;
  max-width: 680px;
}

.intro-kicker {
  width: max-content;
  margin: 0 0 14px;
  padding: 6px 9px 5px;
  border: 2px solid var(--ink);
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--ink);
  font: 900 8px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .18em;
  transform: rotate(-1deg);
}

.intro-copy h1 {
  margin: 0;
  color: var(--cream);
  font-family: "Hiragino Maru Gothic ProN", "Yuanti SC", "PingFang SC", sans-serif;
  font-size: clamp(76px, 10vw, 160px);
  font-weight: 900;
  line-height: .75;
  letter-spacing: -.11em;
  -webkit-text-stroke: clamp(2px, .23vw, 4px) var(--ink);
  text-shadow: .055em .055em 0 var(--ink);
}

.intro-copy h1 span {
  display: inline-block;
  margin-left: .35em;
  color: var(--yellow);
  transform: rotate(-3deg);
}

.intro-subtitle {
  margin: clamp(22px, 4vh, 38px) 0 22px;
  font-size: clamp(15px, 1.5vw, 22px);
  font-weight: 900;
  letter-spacing: .08em;
}

.intro-rules {
  display: flex;
  gap: 9px;
  max-width: 620px;
}

.intro-rules > div {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 2px solid var(--ink);
  background: rgba(255,250,240,.82);
}

.intro-rules b {
  margin-right: 8px;
  color: var(--coral);
  font: 900 19px/1 "Futura", "Avenir Next Condensed", sans-serif;
}

.intro-rules span {
  font-size: 9px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: .05em;
}

.primary-button,
.secondary-button {
  cursor: pointer;
  font-weight: 900;
  letter-spacing: .1em;
  transition: transform .2s, box-shadow .2s, background .2s;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-width: min(330px, 100%);
  min-height: 55px;
  margin-top: 22px;
  padding: 0 9px 0 20px;
  border: 3px solid var(--ink);
  background: var(--coral);
  color: var(--cream);
  box-shadow: 8px 8px 0 var(--ink);
  font-size: 14px;
}

.primary-button i {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-style: normal;
}

.primary-button:hover {
  transform: translate(-3px, -3px);
  box-shadow: 11px 11px 0 var(--ink);
}

.best-score {
  display: inline-block;
  margin: 0 0 0 18px;
  font: 900 8px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .15em;
}

.best-score b {
  color: var(--cream);
  font-size: 12px;
}

.intro-mascot {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  align-self: center;
  height: 75vh;
  max-height: 680px;
}

.intro-mascot img {
  position: relative;
  z-index: 2;
  width: min(43vw, 580px);
  height: min(55vh, 530px);
  object-fit: contain;
  filter: drop-shadow(16px 20px 0 rgba(41,42,48,.16));
}

.intro-burst {
  position: absolute;
  width: min(40vw, 540px);
  aspect-ratio: 1;
  border: 5px solid var(--ink);
  border-radius: 50%;
  background:
    repeating-conic-gradient(var(--yellow) 0 8deg, var(--cream) 8deg 16deg);
  box-shadow: 14px 14px 0 var(--ink);
  animation: intro-turn 26s linear infinite;
}

@keyframes intro-turn { to { transform: rotate(360deg); } }

.intro-mascot > span {
  position: absolute;
  right: 2%;
  top: 17%;
  z-index: 4;
  padding: 12px 16px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 6px 6px 0 var(--ink);
  font-size: 14px;
  font-weight: 900;
  transform: rotate(7deg);
}

/* Countdown */
.countdown {
  position: absolute;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  background: rgba(41,42,48,.76);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.game-shell[data-state="countdown"] .countdown {
  opacity: 1;
  visibility: visible;
}

.countdown span {
  display: grid;
  place-items: center;
  width: min(38vmin, 350px);
  aspect-ratio: 1;
  border: clamp(7px, 1.2vw, 16px) solid var(--cream);
  border-radius: 50%;
  background: var(--coral);
  color: var(--cream);
  box-shadow: 20px 20px 0 var(--ink);
  font: 900 min(24vmin, 220px)/1 "Cooper Black", "Avenir Next Condensed", sans-serif;
  text-shadow: 8px 8px 0 var(--ink);
  animation: countdown-pop .72s cubic-bezier(.15,.8,.2,1) infinite;
}

@keyframes countdown-pop {
  0% { transform: scale(.35) rotate(-12deg); opacity: 0; }
  42% { transform: scale(1.08) rotate(3deg); opacity: 1; }
  100% { transform: scale(.92) rotate(0); opacity: 1; }
}

/* Results */
.result-screen {
  display: grid;
  place-items: center;
  padding: 70px 28px 28px;
  background:
    radial-gradient(circle at 8% 12%, var(--yellow) 0 16%, transparent 16.4%),
    radial-gradient(circle at 92% 88%, var(--pink) 0 22%, transparent 22.4%),
    var(--capoo);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.game-shell[data-state="result"] .result-screen {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.result-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(330px, 550px);
  align-items: center;
  width: min(1020px, 94vw);
  min-height: min(650px, 79vh);
  border: 4px solid var(--ink);
  background: var(--cream);
  box-shadow: 16px 16px 0 var(--ink);
}

.result-card > img {
  width: 100%;
  height: min(54vh, 480px);
  object-fit: contain;
  filter: drop-shadow(12px 14px 0 rgba(41,42,48,.14));
}

.result-rank {
  position: absolute;
  left: -29px;
  top: -34px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 122px;
  height: 130px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 8px 8px 0 var(--ink);
  transform: rotate(-8deg);
}

.result-rank span {
  margin-bottom: -28px;
  font: 900 8px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .18em;
}

.result-rank strong {
  font: 900 78px/.8 "Cooper Black", serif;
  color: var(--coral);
  text-shadow: 4px 4px 0 var(--ink);
}

.result-copy {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px 48px 42px 24px;
}

.result-copy > p:first-child {
  width: max-content;
  margin: 0 0 12px;
  padding: 5px 8px;
  background: var(--ink);
  color: var(--yellow);
  font: 900 8px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .2em;
}

.result-copy h2 {
  margin: 0 0 20px;
  font-size: clamp(25px, 3vw, 46px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.04em;
}

.result-copy > strong {
  font: 900 clamp(50px, 7vw, 96px)/.8 "Futura Condensed ExtraBold", "Avenir Next Condensed", sans-serif;
  color: var(--capoo-dark);
  letter-spacing: .02em;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 26px;
  border: 3px solid var(--ink);
}

.result-stats > div {
  padding: 10px 8px;
  border-right: 2px solid var(--ink);
  text-align: center;
}

.result-stats > div:last-child { border-right: 0; }
.result-stats span,
.result-stats b { display: block; }
.result-stats span { margin-bottom: 5px; font: 900 7px/1 "Avenir Next Condensed", sans-serif; letter-spacing: .1em; }
.result-stats b { font: 900 21px/1 "Futura", "Avenir Next Condensed", sans-serif; }

.accuracy {
  margin: 13px 0 0;
  font: 900 9px/1 "Avenir Next Condensed", sans-serif;
  letter-spacing: .16em;
}

.accuracy b {
  margin-left: 5px;
  color: var(--coral);
  font-size: 15px;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 3px;
}

.result-actions .primary-button {
  min-width: 220px;
}

.secondary-button {
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  background: transparent;
  font-size: 11px;
}

.secondary-button:hover {
  background: var(--ink);
  color: var(--cream);
  transform: translateY(-2px);
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 30px;
  background: var(--capoo);
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

@media (max-width: 760px) {
  .game-shell::after { inset: 5px; }

  .topbar {
    grid-template-columns: auto 1fr auto;
    min-height: 59px;
    padding: 8px 11px;
  }

  .brand__stamp {
    width: 34px;
    height: 34px;
    margin-right: 7px;
    border-width: 2px;
    box-shadow: 3px 3px 0 var(--yellow);
    font-size: 12px;
  }

  .brand b { font-size: 7px; }
  .brand small { display: none; }

  .hud {
    justify-self: center;
    gap: 7px;
  }

  .hud__item { min-width: 41px; }
  .hud__item span { font-size: 5px; }
  .hud__item strong { font-size: 14px; }
  .hud__item--score { min-width: 57px; }
  .hud__slash { font-size: 18px; }

  .sound-toggle {
    min-width: 34px;
    min-height: 34px;
    justify-content: center;
    padding: 0;
  }

  .sound-toggle span { display: none; }

  .game-stage {
    grid-template-columns: 1fr;
    grid-template-rows: 31% 69%;
    height: calc(100% - 59px);
  }

  .party-booth {
    border-right: 0;
    border-bottom: 3px solid var(--ink);
  }

  .party-booth::after { display: none; }
  .booth-sign { top: 10px; left: 11px; padding: 5px 7px; }
  .booth-sign b { font-size: 7px; }
  .booth-sign span { font-size: 5px; }

  .dj-wrap {
    top: 2%;
    left: 36%;
    width: 44%;
    max-height: 100%;
  }

  .dj-ring { border-width: 10px; }

  .reaction-wrap {
    left: auto;
    right: 7%;
    bottom: 6%;
    width: 30vw;
    height: 27vw;
    min-width: 102px;
    min-height: 94px;
    border-width: 2px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .reaction-bubble {
    right: -12px;
    top: -15px;
    min-width: 57px;
    padding: 5px 7px;
    border-width: 2px;
    font-size: 8px;
  }

  .speaker {
    right: auto;
    left: 4%;
    bottom: 7%;
    width: 48px;
    height: 70px;
    border-width: 3px;
  }

  .speaker i { top: 7px; width: 20px; height: 20px; border-width: 3px; }
  .speaker b { bottom: 7px; width: 31px; height: 31px; border-width: 3px; }

  .groove-meter {
    right: 49%;
    top: auto;
    bottom: 7%;
    grid-template-columns: auto 8px auto;
    height: 82px;
    padding: 5px;
  }

  .groove-meter > div { width: 8px; border-width: 1px; }
  .groove-meter > span,
  .groove-meter > b { font-size: 5px; }

  .beat-board {
    grid-template-rows: 25px 1fr 72px;
  }

  .board-head { padding-inline: 11px; font-size: 6px; }
  .lane > span { top: 6px; left: 6px; font-size: 7px; }
  .beat-note { width: clamp(42px, 15vw, 58px); border-width: 3px; box-shadow: 0 5px 0 rgba(0,0,0,.35), inset 0 0 0 3px var(--ink); }
  .target-line { height: 4px; }
  .target-line i { width: min(18vw, 68px); height: min(18vw, 68px); border-width: 3px; }
  .pads { gap: 2px; padding: 2px; border-top-width: 2px; }
  .pad { gap: 7px; }
  .pad kbd { width: 28px; height: 28px; border-width: 2px; border-radius: 6px; box-shadow: 0 3px 0 var(--ink); font-size: 12px; }
  .pad span { font-size: 18px; }

  .fever-banner { top: 48%; font-size: 28px; }

  .intro-screen {
    grid-template-columns: 1fr;
    align-items: end;
    padding: 76px 20px 24px;
  }

  .intro-screen::before {
    right: -10vw;
    bottom: 3vh;
    font-size: 38vw;
  }

  .intro-copy {
    align-self: end;
    z-index: 4;
  }

  .intro-kicker { margin-bottom: 10px; font-size: 6px; }
  .intro-copy h1 { font-size: clamp(67px, 22vw, 94px); line-height: .76; }
  .intro-subtitle { margin: 18px 0 13px; font-size: 13px; }
  .intro-rules { gap: 5px; }
  .intro-rules > div { padding: 6px; }
  .intro-rules b { display: none; }
  .intro-rules span { font-size: 7px; }
  .primary-button { min-height: 49px; margin-top: 15px; box-shadow: 6px 6px 0 var(--ink); font-size: 12px; }
  .best-score { margin-left: 9px; font-size: 6px; }
  .best-score b { font-size: 9px; }

  .intro-mascot {
    position: absolute;
    right: -9%;
    top: 8%;
    width: 72vw;
    height: 43vh;
    opacity: .88;
  }

  .intro-mascot img { width: 100%; height: 100%; }
  .intro-burst { width: 65vw; border-width: 3px; box-shadow: 8px 8px 0 var(--ink); }
  .intro-mascot > span { right: 12%; top: 6%; padding: 7px 9px; border-width: 2px; box-shadow: 4px 4px 0 var(--ink); font-size: 9px; }

  .result-screen { padding: 73px 15px 17px; }
  .result-card {
    grid-template-columns: 34% 66%;
    width: 100%;
    min-height: 70vh;
    border-width: 3px;
    box-shadow: 8px 8px 0 var(--ink);
  }

  .result-card > img { height: 42vh; }
  .result-rank { left: -10px; top: -25px; width: 82px; height: 88px; border-width: 3px; box-shadow: 5px 5px 0 var(--ink); }
  .result-rank span { margin-bottom: -18px; font-size: 5px; }
  .result-rank strong { font-size: 50px; }
  .result-copy { padding: 26px 15px 22px 6px; }
  .result-copy h2 { margin-bottom: 13px; font-size: 20px; }
  .result-copy > strong { font-size: 45px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); margin-top: 16px; border-width: 2px; }
  .result-stats > div { padding: 7px 5px; border-right-width: 1px; border-bottom: 1px solid var(--ink); }
  .result-stats > div:nth-child(2) { border-right: 0; }
  .result-stats > div:nth-child(n+3) { border-bottom: 0; }
  .result-stats span { font-size: 5px; }
  .result-stats b { font-size: 16px; }
  .result-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .result-actions .primary-button { min-width: 0; width: 100%; }
  .secondary-button { min-height: 40px; }
}

@media (max-height: 650px) and (min-width: 761px) {
  .topbar { min-height: 62px; padding-block: 7px; }
  .game-stage { height: calc(100% - 62px); }
  .dj-wrap { top: 7%; width: 68%; }
  .reaction-wrap { bottom: 5%; transform: rotate(-3deg) scale(.8); transform-origin: bottom left; }
  .groove-meter { top: 35%; height: 110px; }
  .beat-board { grid-template-rows: 29px 1fr 76px; }
  .intro-screen { padding-top: 72px; }
  .intro-copy h1 { font-size: 105px; }
  .intro-subtitle { margin-block: 20px 14px; }
  .intro-mascot { height: 67vh; }
  .result-card { min-height: 78vh; }
}

@media (max-width: 760px) and (max-height: 520px) and (orientation: landscape) {
  .topbar {
    min-height: 48px;
    padding-block: 5px;
  }

  .game-stage {
    grid-template-columns: 34% 66%;
    grid-template-rows: 1fr;
    height: calc(100% - 48px);
  }

  .party-booth {
    border-right: 3px solid var(--ink);
    border-bottom: 0;
  }

  .dj-wrap {
    top: 6%;
    left: 13%;
    width: 72%;
  }

  .reaction-wrap {
    right: 4%;
    bottom: 4%;
    width: 25%;
    height: 28%;
    min-width: 72px;
    min-height: 72px;
  }

  .speaker,
  .groove-meter { display: none; }

  .beat-board { grid-template-rows: 24px 1fr 58px; }
  .pad kbd { width: 25px; height: 25px; }
  .pad span { font-size: 14px; }

  .intro-screen {
    grid-template-columns: 1.08fr .92fr;
    align-items: center;
    padding: 58px 34px 18px;
  }

  .intro-copy { align-self: center; }
  .intro-kicker { margin-bottom: 7px; }
  .intro-copy h1 { font-size: clamp(54px, 11.8vw, 76px); }
  .intro-subtitle { margin: 13px 0 9px; font-size: 10px; }
  .intro-rules { gap: 4px; }
  .intro-rules > div { padding: 5px; }
  .intro-rules span { font-size: 6px; }
  .intro-copy .primary-button { min-height: 39px; margin-top: 10px; font-size: 10px; }
  .intro-copy .primary-button i { width: 28px; height: 28px; }

  .intro-mascot {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: 68vh;
    opacity: 1;
  }

  .intro-mascot img { width: 90%; height: 90%; }
  .intro-burst { width: 34vw; }

  .result-screen { padding: 13px 20px; }
  .result-card {
    grid-template-columns: 31% 69%;
    width: min(620px, 94vw);
    height: calc(100dvh - 28px);
    min-height: 0;
  }

  .result-card > img { height: 66vh; }
  .result-rank { left: -9px; top: -8px; width: 66px; height: 70px; }
  .result-rank span { margin-bottom: -13px; }
  .result-rank strong { font-size: 40px; }
  .result-copy { padding: 14px 17px 11px 3px; }
  .result-copy > p:first-child { margin-bottom: 6px; padding: 4px 6px; font-size: 6px; }
  .result-copy h2 { margin-bottom: 7px; font-size: 18px; }
  .result-copy > strong { font-size: 39px; }
  .result-stats { grid-template-columns: repeat(4, 1fr); margin-top: 9px; }
  .result-stats > div { padding: 5px 3px; border-right: 1px solid var(--ink); border-bottom: 0; }
  .result-stats > div:nth-child(2) { border-right: 1px solid var(--ink); }
  .result-stats > div:last-child { border-right: 0; }
  .result-stats span { margin-bottom: 3px; font-size: 4px; }
  .result-stats b { font-size: 13px; }
  .accuracy { margin-top: 6px; font-size: 6px; }
  .accuracy b { font-size: 11px; }
  .result-actions { flex-direction: row; gap: 7px; }
  .result-actions .primary-button {
    width: auto;
    min-width: 150px;
    min-height: 37px;
    margin-top: 6px;
    box-shadow: 4px 4px 0 var(--ink);
    font-size: 9px;
  }
  .result-actions .primary-button i { width: 26px; height: 26px; }
  .secondary-button { min-height: 37px; padding-inline: 10px; font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .speed-lines,
  .intro-burst {
    animation: none;
  }
}
