:root {
  color-scheme: dark;
  --ink: #241b46;
  --paper: #fffaf0;
  --cream: #fff4d5;
  --pink: #ff5f91;
  --pink-dark: #d63e71;
  --yellow: #ffd85a;
  --cyan: #65e4ef;
  --purple: #6f52d9;
  --navy: #17133f;
  --green: #56c896;
  --shadow: 0 16px 45px rgba(20, 13, 57, .28);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  overscroll-behavior: none;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
}

button:focus-visible,
canvas:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

#app {
  min-height: 100dvh;
}

.screen {
  display: none;
  width: 100%;
  min-height: 100dvh;
}

.screen--active {
  display: flex;
  animation: screen-in .36s ease both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

.button,
.icon-button,
.mode-button,
.assist-chip,
.stage-card {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.button {
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 18px;
  font-weight: 900;
  letter-spacing: .02em;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}

.button:active,
.icon-button:active,
.stage-card:active {
  transform: translateY(2px) scale(.98);
}

.button--primary {
  color: #fff;
  background: linear-gradient(145deg, var(--pink), #ff7b62);
  box-shadow: 0 7px 0 #b72b64, 0 12px 26px rgba(255, 95, 145, .28);
}

.button--primary:active {
  box-shadow: 0 3px 0 #b72b64;
}

.button--soft {
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 0 rgba(35, 26, 69, .22);
}

.button--jumbo {
  width: min(92vw, 440px);
  min-height: 62px;
  font-size: clamp(17px, 3.8vw, 22px);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 15px;
  color: #fff;
  background: rgba(25, 18, 68, .58);
  box-shadow: 0 5px 15px rgba(0,0,0,.17);
  font-size: 20px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--yellow);
  font-weight: 900;
  letter-spacing: .14em;
  font-size: 12px;
}

/* title */
#screenTitle {
  position: relative;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 17% 22%, rgba(105, 231, 243, .22), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(255, 95, 145, .28), transparent 29%),
    linear-gradient(145deg, #211854 0%, #17133f 52%, #34206a 100%);
}

.title-stars,
.title-stars::before,
.title-stars::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    radial-gradient(circle, #fff 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(255,216,90,.9) 0 1.4px, transparent 2px);
  background-position: 12px 8px, 58px 36px;
  background-size: 72px 72px, 116px 116px;
  opacity: .38;
}

.title-stars::before { transform: rotate(14deg) scale(1.1); opacity: .35; }
.title-stars::after { transform: rotate(-9deg) scale(1.18); opacity: .25; }

.title-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 970px);
  text-align: center;
}

#gameTitle {
  margin: 0;
  line-height: .92;
  text-shadow: 0 5px 0 rgba(0,0,0,.18);
}

#gameTitle span {
  display: block;
  font-size: clamp(27px, 6vw, 54px);
  letter-spacing: .02em;
}

#gameTitle strong {
  display: block;
  margin-top: 6px;
  color: var(--yellow);
  font-size: clamp(54px, 11vw, 98px);
  -webkit-text-stroke: 2px #fff;
  paint-order: stroke fill;
  transform: rotate(-2deg);
}

.subtitle {
  margin: 2px 0 10px;
  color: var(--cyan);
  font-size: clamp(20px, 4.2vw, 36px);
  font-weight: 900;
  letter-spacing: .13em;
}

.title-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1.15fr) minmax(130px, 1fr);
  align-items: end;
  width: min(94vw, 760px);
  min-height: 212px;
  margin: 0 auto 12px;
  padding: 18px 54px 0;
  overflow: hidden;
  border: 3px solid rgba(255, 216, 90, .75);
  border-radius: 28px 28px 15px 15px;
  background: linear-gradient(#573a8d, #2c1d5f 64%, #151134 65%);
  box-shadow: inset 0 0 50px rgba(0,0,0,.28), var(--shadow);
}

.title-stage::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 25px;
  content: "";
  background: repeating-linear-gradient(90deg, #7f4b2d 0 34px, #66381f 34px 68px);
  box-shadow: 0 -5px 16px rgba(0,0,0,.28);
}

.curtain {
  position: absolute;
  top: -10px;
  z-index: 4;
  width: 92px;
  height: 210px;
  background: repeating-linear-gradient(90deg, #b61f4b 0 18px, #e7466a 18px 36px);
  box-shadow: 0 0 22px rgba(0,0,0,.35);
}

.curtain--left { left: -34px; transform: rotate(-6deg); border-radius: 0 0 80% 0; }
.curtain--right { right: -34px; transform: rotate(6deg); border-radius: 0 0 0 80%; }

.host-card {
  position: relative;
  z-index: 3;
  height: 178px;
  overflow: hidden;
  border: 3px solid #fff;
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.host-card img,
.yuki-crop {
  display: block;
  width: 100%;
  height: 100%;
}

.host-card img { object-fit: cover; object-position: center 16%; }

.yuki-crop {
  background-image: url("assets/reference_dr_yuki.png");
  background-repeat: no-repeat;
  background-position: 33.333% 4%;
  background-size: 400% auto;
}

.host-card span {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: 7px;
  padding: 5px 4px;
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 900;
}

.stage-center {
  align-self: center;
  padding-bottom: 32px;
}

.tap-burst {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--yellow);
  font-size: 28px;
  animation: hero-pop 1.35s ease-in-out infinite;
}

.tap-burst b {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border: 5px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at 35% 28%, #ff8caa, var(--pink));
  box-shadow: 0 8px 0 #a52c5a, 0 0 28px rgba(255,216,90,.42);
  font-size: 24px;
}

@keyframes hero-pop {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

.mini-scenes { display: flex; justify-content: center; gap: 7px; margin-top: 12px; }
.mini-scenes i { font-style: normal; font-size: 22px; }

.title-lead {
  margin: 0 auto 12px;
  font-weight: 800;
  font-size: clamp(14px, 2.6vw, 18px);
}

.title-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.title-actions .button { min-height: 44px; padding: 9px 16px; }
.small-note { margin: 13px 0 0; color: rgba(255,255,255,.72); font-size: 12px; }

/* shared top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: max(11px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  color: #fff;
  background: rgba(18, 13, 57, .82);
  box-shadow: 0 5px 18px rgba(0,0,0,.18);
  backdrop-filter: blur(12px);
}

.topbar h2 { margin: 0; font-size: clamp(17px, 3vw, 24px); }
.topbar-kicker { margin: 0; color: var(--cyan); font-size: 10px; font-weight: 900; }
.topbar-actions { display: flex; gap: 7px; margin-left: auto; }

/* map */
#screenMap {
  flex-direction: column;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 13% 12%, rgba(101,228,239,.25), transparent 28%),
    radial-gradient(circle at 86% 70%, rgba(255,95,145,.24), transparent 31%),
    linear-gradient(150deg, #25185b, #141033 65%);
}

.map-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100% - 24px, 1100px);
  margin: 14px auto 5px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 18px;
  background: rgba(255,255,255,.08);
}

.map-summary > div:first-child { display: flex; align-items: baseline; gap: 2px; white-space: nowrap; }
#clearedCount { color: var(--yellow); font-size: 26px; font-weight: 900; }
.map-summary small { color: rgba(255,255,255,.75); font-weight: 800; }

.progress-track,
.play-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
}

.progress-track { flex: 1; }
.progress-track i,
.play-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--yellow), var(--pink));
  transition: width .3s ease;
}

.assist-chip {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 12px;
  color: #3d265c;
  background: var(--yellow);
  box-shadow: 0 4px 0 #b68f1f;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.assist-chip[aria-pressed="false"] { color: #fff; background: #51458b; box-shadow: 0 4px 0 #2c245f; }

.stage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: min(100% - 24px, 1100px);
  margin: 10px auto 22px;
}

.stage-card {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  min-height: 100px;
  padding: 12px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.36);
  border-radius: 20px;
  color: #fff;
  text-align: left;
  background: linear-gradient(140deg, var(--stage-a), var(--stage-b));
  box-shadow: 0 9px 20px rgba(0,0,0,.2), inset 0 1px rgba(255,255,255,.26);
}

.stage-card::after {
  position: absolute;
  right: -20px;
  bottom: -24px;
  width: 92px;
  height: 92px;
  border: 16px solid rgba(255,255,255,.10);
  border-radius: 50%;
  content: "";
}

.stage-card--locked { filter: grayscale(.35); opacity: .48; cursor: default; }
.stage-card--cleared { border-color: var(--yellow); }
.stage-card--remix { grid-column: span 2; }

.stage-card-number {
  position: absolute;
  top: 7px;
  left: 9px;
  color: rgba(255,255,255,.76);
  font-size: 10px;
  font-weight: 900;
}

.stage-card-icon { font-size: 38px; text-align: center; filter: drop-shadow(0 4px 4px rgba(0,0,0,.18)); }
.stage-card-copy { min-width: 0; }
.stage-card-copy b { display: block; overflow: hidden; font-size: 14px; line-height: 1.25; text-overflow: ellipsis; }
.stage-card-copy small { display: block; margin-top: 5px; color: rgba(255,255,255,.75); font-size: 9px; }
.stage-card-score { position: absolute; right: 8px; top: 7px; color: var(--yellow); font-size: 12px; letter-spacing: -2px; }
.stage-card-lock { position: absolute; right: 10px; bottom: 9px; font-size: 17px; }
.map-tip { margin: auto 14px max(15px, env(safe-area-inset-bottom)); color: rgba(255,255,255,.68); text-align: center; font-size: 11px; }

/* stage intro */
#screenStage {
  flex-direction: column;
  min-height: 100dvh;
  background: linear-gradient(145deg, #151139, #322070);
}

.topbar--floating { z-index: 4; }
.stage-number { margin: 0 auto; color: var(--yellow); font-size: 13px; font-weight: 900; letter-spacing: .12em; }

.stage-intro-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  width: min(100% - 26px, 1080px);
  margin: auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 28px;
  background: rgba(255,255,255,.08);
  box-shadow: var(--shadow);
}

.stage-preview-wrap { position: relative; min-height: 0; background: #18133f; }
#previewCanvas { display: block; width: 100%; height: 100%; min-height: 320px; object-fit: contain; }
.mood-badge { position: absolute; left: 15px; bottom: 15px; padding: 7px 12px; border-radius: 999px; color: var(--ink); background: rgba(255,255,255,.9); font-size: 11px; font-weight: 900; }
.stage-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(18px, 3vw, 34px); color: var(--ink); background: var(--paper); }
.stage-icon { margin: 0; font-size: 44px; }
.stage-copy h2 { margin: 3px 0 8px; font-size: clamp(25px, 4vw, 38px); line-height: 1.1; }
.stage-rule { min-height: 3.4em; margin: 0 0 14px; color: #5c4a73; font-weight: 800; line-height: 1.7; }
.stage-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.stage-meta span { padding: 5px 9px; border-radius: 9px; color: #584c73; background: #ece6ff; font-size: 10px; font-weight: 900; }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-button { min-height: 75px; padding: 9px; border: 2px solid transparent; border-radius: 15px; color: #5b4d72; background: #eee9f7; text-align: left; }
.mode-button b,
.mode-button small { display: block; }
.mode-button b { color: var(--ink); font-size: 12px; }
.mode-button small { margin-top: 3px; font-size: 9px; line-height: 1.3; }
.mode-button--selected { border-color: var(--pink); background: #fff0f5; box-shadow: inset 0 0 0 2px #fff; }
.mode-button:disabled { opacity: .48; cursor: default; }
.stage-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 9px; margin-top: 17px; }
.stage-actions .button { padding-inline: 10px; }

/* gameplay */
.screen--play {
  position: relative;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0e0c28;
}

.play-shell {
  display: flex;
  flex-direction: column;
  width: min(100vw, calc(100dvh * 1.78));
  max-height: 100dvh;
  padding: max(5px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
}

.play-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 4px 7px;
}

.play-hud small,
.play-hud b { display: block; }
.play-hud small { color: var(--yellow); font-size: 9px; letter-spacing: .1em; }
.play-hud b { overflow: hidden; max-width: 32vw; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.hud-center { display: flex; gap: 8px; }
.hud-center span { padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.1); font-size: 11px; font-weight: 900; }
.play-tools { display: flex; justify-content: flex-end; gap: 6px; }
.play-tools .icon-button { width: 42px; height: 42px; }

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 18px;
  background: #19143d;
  box-shadow: 0 12px 32px rgba(0,0,0,.42);
}

#gameCanvas { display: block; width: 100%; aspect-ratio: 16/9; cursor: pointer; touch-action: none; }
.play-progress { height: 7px; margin: 7px 8px 0; }

.countdown,
.judge-text,
.tap-hint {
  position: absolute;
  left: 50%;
  pointer-events: none;
  transform: translateX(-50%);
}

.countdown {
  top: 34%;
  z-index: 4;
  color: #fff;
  font-size: clamp(62px, 14vw, 120px);
  font-weight: 1000;
  text-shadow: 0 8px 0 rgba(0,0,0,.25), 0 0 35px rgba(255,216,90,.65);
}

.judge-text {
  top: 15%;
  z-index: 5;
  opacity: 0;
  font-size: clamp(28px, 7vw, 58px);
  font-weight: 1000;
  text-shadow: 0 5px 0 rgba(0,0,0,.25), 0 0 18px currentColor;
}

.judge-text--show { animation: judge-pop .62s ease both; }
.judge-text--perfect { color: var(--yellow); }
.judge-text--good { color: var(--cyan); }
.judge-text--miss { color: #ff96b5; }

@keyframes judge-pop {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(.5) rotate(-4deg); }
  22% { opacity: 1; transform: translate(-50%, 0) scale(1.12) rotate(2deg); }
  75% { opacity: 1; transform: translate(-50%, -2px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(.92); }
}

.tap-hint {
  bottom: 4%;
  z-index: 3;
  padding: 7px 15px;
  border: 2px solid rgba(255,255,255,.75);
  border-radius: 999px;
  color: #fff;
  background: rgba(24,16,63,.62);
  font-size: clamp(11px, 2.2vw, 15px);
  font-weight: 900;
  opacity: .82;
}

.pause-panel {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10,7,31,.78);
  backdrop-filter: blur(9px);
}

.pause-card { width: min(90vw, 380px); padding: 28px; border-radius: 26px; color: var(--ink); background: var(--paper); text-align: center; box-shadow: var(--shadow); }
.pause-card h2 { margin: 0; font-size: 30px; }
.pause-card p { color: #645874; }
.pause-card .button { display: block; width: 100%; margin-top: 12px; }

/* result */
#screenResult {
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(15px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(15px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 20% 10%, rgba(101,228,239,.28), transparent 30%),
    radial-gradient(circle at 84% 76%, rgba(255,95,145,.3), transparent 32%),
    linear-gradient(145deg, #241752, #12102f);
}

.result-shell { width: min(100%, 900px); text-align: center; }
.result-shell h2 { margin: 2px 0 0; font-size: clamp(32px, 7vw, 58px); }
.result-paws { margin: 5px 0; color: var(--yellow); font-size: clamp(31px, 7vw, 55px); letter-spacing: 5px; filter: drop-shadow(0 5px 0 rgba(0,0,0,.22)); }
.result-message { margin: 0 0 14px; color: #d8d3ff; font-weight: 800; }
.result-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(220px, .65fr); gap: 15px; align-items: stretch; }
.photo-card { overflow: hidden; border: 7px solid #fff; border-bottom-width: 44px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); transform: rotate(-1deg); }
#photoCanvas { display: block; width: 100%; aspect-ratio: 16/9; }
.photo-card > div { display: flex; align-items: center; justify-content: space-between; height: 37px; padding: 4px 8px; color: var(--ink); }
.photo-card b { font-size: 12px; }
.photo-card span { color: #766c85; font-size: 9px; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.result-stats div { display: flex; flex-direction: column; justify-content: center; min-height: 84px; padding: 9px; border: 1px solid rgba(255,255,255,.22); border-radius: 17px; background: rgba(255,255,255,.1); }
.result-stats dt { color: #d7d0ff; font-size: 10px; font-weight: 900; }
.result-stats dd { margin: 2px 0 0; color: var(--yellow); font-size: 30px; font-weight: 1000; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 10px; margin-top: 17px; }

/* dialog and modals */
.dialog-overlay,
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(11, 8, 34, .82);
  backdrop-filter: blur(10px);
}

.dialog-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, .42fr) minmax(290px, .58fr);
  width: min(94vw, 760px);
  min-height: 315px;
  overflow: hidden;
  border: 3px solid var(--yellow);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.dialog-portrait { min-height: 315px; background-color: #d9ecff; background-repeat: no-repeat; }
.dialog-portrait--doctor { background-image: url("assets/dr_yamaneko.jpg"); background-position: center 17%; background-size: cover; }
.dialog-portrait--yuki { background-image: url("assets/reference_dr_yuki.png"); background-position: 33.333% 2%; background-size: 400% auto; }
.dialog-copy { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 30px; color: var(--ink); text-align: left; }
.dialog-copy span { padding: 5px 10px; border-radius: 9px; color: #fff; background: var(--purple); font-size: 12px; font-weight: 900; }
.dialog-copy p { min-height: 5em; margin: 15px 0 18px; font-size: clamp(18px, 3vw, 25px); font-weight: 900; line-height: 1.65; }
.dialog-copy .button { align-self: flex-end; }
.dialog-skip { position: absolute; top: 12px; right: 13px; z-index: 3; min-height: 38px; padding: 7px 12px; border: 0; border-radius: 12px; color: #655a72; background: #eee8f2; cursor: pointer; font-size: 11px; font-weight: 900; }

.modal-card {
  position: relative;
  width: min(94vw, 600px);
  max-height: min(90dvh, 720px);
  overflow: auto;
  padding: clamp(22px, 4vw, 38px);
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
  user-select: text;
  -webkit-user-select: text;
}

.modal-card--wide { width: min(96vw, 880px); }
.modal-card h2 { margin: 0 0 12px; font-size: 30px; }
.modal-card p { color: #5d526e; line-height: 1.7; }
.modal-card > .button { display: block; min-width: 160px; margin: 20px auto 0; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; color: #fff; background: var(--purple); cursor: pointer; font-size: 25px; font-weight: 900; }
.howto-grid { display: grid; gap: 9px; }
.howto-grid div { padding: 13px 15px; border-radius: 16px; background: #eee8ff; }
.howto-grid b,
.howto-grid span { display: block; }
.howto-grid span { margin-top: 3px; color: #695c7b; font-size: 12px; }
.credits-card p { margin: 11px 0; }
.credits-note { padding: 10px; border-radius: 12px; background: #eee8ff; font-size: 11px; }

.album-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.album-item { position: relative; overflow: hidden; min-height: 112px; border: 4px solid #fff; border-radius: 10px; color: #fff; background: linear-gradient(145deg, var(--stage-a), var(--stage-b)); box-shadow: 0 5px 13px rgba(34,24,68,.2); }
.album-item b { position: absolute; right: 5px; bottom: 5px; left: 5px; overflow: hidden; padding: 4px; border-radius: 6px; background: rgba(20,12,52,.67); font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.album-item span { display: grid; place-items: center; height: 90px; font-size: 41px; }
.album-item--locked { filter: grayscale(1); opacity: .38; }

.rotate-notice {
  display: none;
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 90;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 13px;
  background: rgba(18,13,57,.88);
  box-shadow: 0 7px 20px rgba(0,0,0,.3);
  font-size: 10px;
}

.rotate-notice div { font-size: 20px; }
.rotate-notice b,
.rotate-notice span { display: block; }
.rotate-notice span { color: rgba(255,255,255,.68); font-size: 8px; }

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

@media (max-width: 820px) {
  .title-stage { min-height: 180px; padding-inline: 44px; }
  .host-card { height: 152px; }
  .tap-burst b { width: 72px; height: 72px; font-size: 20px; }
  .stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage-card--remix { grid-column: span 1; }
  .stage-intro-card { grid-template-columns: 1.15fr .85fr; }
  #previewCanvas { min-height: 280px; }
  .stage-copy { padding: 18px; }
  .stage-copy h2 { font-size: 25px; }
  .stage-rule { font-size: 13px; }
}

@media (max-width: 620px) {
  .title-stage { grid-template-columns: 1fr 1fr; width: min(94vw, 480px); min-height: 170px; padding-inline: 38px; }
  .host-card { height: 142px; }
  .stage-center { display: none; }
  .title-lead { max-width: 390px; }
  .stage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stage-card { min-height: 91px; grid-template-columns: 46px 1fr; padding: 10px; }
  .stage-card-icon { font-size: 31px; }
  .map-summary { gap: 7px; }
  .progress-track { display: none; }
  .stage-intro-card { display: block; margin: 12px auto; overflow: auto; }
  #previewCanvas { min-height: auto; aspect-ratio: 16/9; }
  .stage-rule { min-height: 0; }
  .dialog-card { grid-template-columns: 140px 1fr; min-height: 260px; }
  .dialog-portrait { min-height: 260px; }
  .dialog-copy { padding: 22px 18px; }
  .dialog-copy p { min-height: 4em; font-size: 17px; }
  .result-body { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: repeat(4, 1fr); }
  .result-stats div { min-height: 62px; padding: 4px; }
  .result-stats dt { font-size: 8px; }
  .result-stats dd { font-size: 23px; }
  .album-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (orientation: portrait) and (max-width: 620px) {
  .rotate-notice { display: flex; }
  .screen--play .rotate-notice { display: flex; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .title-shell { transform: scale(.88); }
  .title-stage { min-height: 150px; margin-bottom: 7px; }
  .host-card { height: 130px; }
  .subtitle { margin-bottom: 5px; }
  .title-lead { margin-bottom: 7px; }
  .button--jumbo { min-height: 50px; }
  .title-actions { margin-top: 9px; }
  .small-note { margin-top: 8px; }
  .stage-intro-card { width: min(100% - 18px, 960px); }
  #previewCanvas { min-height: 270px; }
  .stage-copy { padding: 14px 18px; }
  .stage-copy h2 { font-size: 23px; }
  .stage-rule { min-height: 2.8em; margin-bottom: 8px; font-size: 12px; }
  .mode-button { min-height: 61px; }
  .stage-actions { margin-top: 10px; }
  .result-shell { transform: scale(.9); }
}

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