.rhythm-shell {
  width: min(1080px, calc(100% - 32px));
}

.game-card {
  overflow: hidden;
  border: 3px solid var(--ink);
  background: var(--panel);
  box-shadow: 10px 10px 0 var(--shadow);
}

.game-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  padding: 30px 34px;
  border-bottom: 3px solid var(--ink);
}

.game-heading .eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.game-heading h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 4.9rem);
  line-height: 0.95;
}

.lede {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.progress-box {
  min-width: 150px;
  padding: 16px;
  border: 2px solid var(--line);
  background: #171220;
  text-align: center;
}

.progress-box > span,
.stat > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.progress-box strong {
  color: var(--gold);
  font-size: 1.6rem;
}

.mode-panel {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px solid var(--line);
  background: #171220;
}

.mode-switch {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.mode-switch button {
  padding: 10px 14px;
  border: 2px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.mode-switch button[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--night);
}

.mode-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: right;
}

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

.stat {
  min-width: 0;
  padding: 18px 12px;
  border-right: 2px solid var(--line);
  text-align: center;
}

.stat:last-child {
  border-right: 0;
}

.stat strong {
  font-size: clamp(1.05rem, 3vw, 1.55rem);
}

.rhythm-stage {
  display: flex;
  min-height: 650px;
  flex-direction: column;
  align-items: center;
  padding: 26px 28px 32px;
  background:
    linear-gradient(rgba(88, 199, 215, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 199, 215, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 50% 30%, #312342 0, transparent 55%);
  background-size: 24px 24px, 24px 24px, auto;
}

.tempo-row {
  display: flex;
  gap: 12px;
  align-items: center;
  align-self: stretch;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.tempo-row strong {
  color: var(--blue);
}

.beat-display {
  display: grid;
  place-items: center;
  margin: 24px 0 18px;
}

.beat-orbit {
  display: grid;
  width: min(230px, 62vw);
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: #171220;
  box-shadow: 7px 7px 0 var(--shadow);
}

.beat-core {
  display: grid;
  width: 116px;
  aspect-ratio: 1;
  place-items: center;
  border: 5px solid var(--ink);
  border-radius: 50%;
  background: var(--blue-dark);
  transition: transform 80ms ease, background 80ms ease, box-shadow 80ms ease;
}

.beat-core span {
  width: 34px;
  height: 34px;
  background: var(--blue);
  box-shadow: 5px 5px 0 var(--shadow);
}

.beat-core.is-pulse {
  background: var(--gold);
  box-shadow: 0 0 0 16px rgba(247, 201, 72, 0.16);
  transform: scale(1.12);
}

.beat-core.is-pulse span {
  background: var(--night);
}

.beat-core.is-hit {
  background: var(--green);
  box-shadow: 0 0 0 16px rgba(83, 221, 131, 0.15);
}

.beat-core.is-miss {
  background: var(--red);
  box-shadow: 0 0 0 16px rgba(237, 78, 92, 0.15);
}

.beat-pips {
  display: flex;
  gap: 12px;
  margin-top: 23px;
}

.beat-pips span {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  background: #171220;
}

.beat-pips span.is-played {
  border-color: var(--gold);
  background: var(--gold);
}

.beat-pips .player-pip {
  border-style: dashed;
  border-color: var(--blue);
}

.beat-pips .player-pip.is-played {
  border-style: solid;
  border-color: var(--green);
  background: var(--green);
}

.stage-copy {
  min-height: 135px;
  text-align: center;
}

.stage-kicker {
  margin: 0 0 9px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.stage-copy h2 {
  margin: 0;
  font-size: clamp(1.55rem, 5vw, 2.5rem);
}

.stage-copy > p:not(.stage-kicker) {
  max-width: 620px;
  margin: 10px auto 0;
  color: var(--muted);
  line-height: 1.5;
}

.result-flash {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: center;
  margin-top: 12px;
}

.result-flash[hidden] {
  display: none;
}

.result-flash strong {
  font-size: 1.35rem;
}

.result-flash span {
  color: var(--muted);
  font-size: 0.8rem;
}

.tap-button {
  display: flex;
  width: min(480px, 100%);
  min-height: 96px;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  border: 4px solid var(--ink);
  border-bottom-width: 9px;
  background: var(--blue);
  color: var(--night);
  cursor: pointer;
  touch-action: manipulation;
}

.tap-button strong {
  font-size: clamp(1.8rem, 6vw, 2.7rem);
  letter-spacing: 0.12em;
}

.tap-button span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.tap-button kbd {
  width: auto;
  height: auto;
  padding: 2px 7px;
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: var(--ink);
}

.tap-button:not(:disabled):active,
.tap-button.is-pressed {
  border-bottom-width: 4px;
  transform: translateY(5px);
}

.tap-button:disabled {
  border-color: var(--line);
  background: #241d33;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.primary-button {
  min-width: min(380px, 100%);
  margin-top: 16px;
}

.control-note,
.audio-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: center;
}

.audio-note {
  margin-top: 5px;
}

.content-section,
.faq-section,
.related-section {
  margin-top: 48px;
}

.content-heading h2,
.faq-section h2,
.related-section h2,
.info-panel h2 {
  margin: 8px 0 0;
}

.steps-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 0;
  list-style: none;
}

.steps-list li,
.info-panel,
.faq-list details,
.related-links a {
  border: 2px solid var(--line);
  background: var(--panel);
}

.steps-list li {
  display: flex;
  gap: 14px;
  padding: 20px;
}

.steps-list li > span {
  color: var(--gold);
  font-size: 1.25rem;
  font-weight: 900;
}

.steps-list p,
.info-panel p,
.faq-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.reading-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 32px;
}

.info-panel {
  padding: 26px;
}

.info-panel .section-kicker {
  margin: 0;
  color: var(--gold);
}

.info-panel h2 {
  margin-bottom: 16px;
}

.info-panel p + p {
  margin-top: 12px;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.faq-list details {
  padding: 18px 20px;
}

.faq-list summary {
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.faq-list p {
  margin-top: 12px;
}

.related-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.related-links a {
  display: flex;
  gap: 5px;
  flex-direction: column;
  padding: 18px;
  color: var(--ink);
  text-decoration: none;
}

.related-links a:hover {
  border-color: var(--gold);
}

.related-links small {
  color: var(--muted);
}

@media (max-width: 720px) {
  .rhythm-shell {
    width: min(100% - 20px, 1080px);
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-meta {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .game-heading {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 24px 20px;
  }

  .progress-box {
    min-width: 0;
  }

  .mode-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-switch button {
    flex: 1;
  }

  .mode-description {
    text-align: left;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat:nth-child(2) {
    border-right: 0;
  }

  .stat:nth-child(-n + 2) {
    border-bottom: 2px solid var(--line);
  }

  .rhythm-stage {
    min-height: 620px;
    padding: 22px 16px 28px;
  }

  .beat-orbit {
    width: min(196px, 58vw);
  }

  .beat-core {
    width: 98px;
  }

  .tap-button {
    min-height: 104px;
  }

  .steps-list,
  .reading-grid,
  .related-links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .topbar-meta {
    max-width: 210px;
  }

  .topbar-link {
    font-size: 0.63rem;
  }

  .game-heading h1 {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .rhythm-stage {
    min-height: 590px;
  }

  .beat-display {
    margin-top: 18px;
  }

  .beat-pips {
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .beat-core,
  .tap-button {
    transition: none;
  }
}
