:root {
  /* ── Prodigies Bell Colors ── */
  --p-red:    #E72829; /* C       */
  --p-poppy:  #EE5524; /* C# / Db */
  --p-orange: #F39422; /* D       */
  --p-gold:   #FFD25B; /* D# / Eb */
  --p-yellow: #F1E606; /* E       */
  --p-green:  #6AB845; /* F       */
  --p-mint:   #65C081; /* F# / Gb */
  --p-teal:   #009999; /* G       */
  --p-blue:   #1E7FC3; /* G# / Ab */
  --p-purple: #7B569E; /* A       */
  --p-plum:   #9F5B90; /* A# / Bb */
  --p-pink:   #EA6BA3; /* B       */
  --p-navy:   #1A233D;
  --p-brown:  #512D1C;

  /* ── Layout & UI ── */
  --tile-size: 106px;
  --gap: 10px;
  --dock-height: clamp(196px, 30vh, 238px);
  --dock-bg-height: clamp(74px, 12vh, 98px);
  --bank-note-size: 96px;
  --bank-note-gap: 8px;
  --bg1: #eef1f5;
  --bg2: #eef1f5;
  --ink: var(--p-navy);
  --panel: #ffffff;
  --panel-border: #e4edff;
  --teal: var(--p-teal);
  --teal-dark: #007d7d;
  --green: var(--p-green);
  --green-soft: #a8d58c;
  --line: #d7e2f2;
  /* ── Ink scale ── */
  --ink-mid:   #42506f;
  --ink-muted: #5e6780;
  --ink-soft:  #8494b4;
  --ink-dim:   #35425b;

  /* ── Easing ── */
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-ui:   cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-snap: cubic-bezier(0.34, 0.82, 0.24, 1);

  /* ── Z-index scale ── */
  --z-game:      1;
  --z-bank:      4;
  --z-hud:      10;
  --z-float:    60;
  --z-dock:     70;
  --z-fly:      90;
  --z-daily:   116;
  --z-set:     117;
  --z-overlay: 118;
  --z-end:     119;
  --z-modal:   120;
  --z-settings: 130;
  --z-top:     300;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* ── Mobile baseline ───────────────────────────────────────────
   touch-action:manipulation removes the 300 ms tap delay and
   double-tap-zoom on all interactive elements without disabling
   normal scrolling gestures on the document.
   -webkit-tap-highlight-color removes the blue flash on iOS tap.
   user-select:none prevents text-selection on long-press.
──────────────────────────────────────────────────────────────── */
button, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  height: 100vh;
  height: 100svh;
  height: 100dvh; /* dynamic viewport — collapses with browser chrome on mobile */
  font-family: "Nunito", "Avenir Next Rounded", "Trebuchet MS", "Verdana", sans-serif;
  color: var(--ink);
  background: var(--bg1);
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

.app {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  margin: 0 auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  position: relative;
}

/* Desktop: fixed 430×820 phone card — no resize behaviour */
@media (min-width: 480px) {
  body {
    background: #c2ccd9;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .app {
    height: min(820px, 100svh); /* cap at 820px; never overflow viewport */
    border-radius: 28px;
    box-shadow: 0 8px 48px rgba(26, 35, 61, 0.22);
  }
  .screen {
    height: 100%; /* inherit .app height */
  }
  /* NOTE: the slots-N tile sizes used to be repeated here as well. They were dead
     — identical selector and specificity to the rules ~1400 lines below, which come
     later and therefore always won. Edit those, not this block. */
}

.screen {
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  padding: calc(20px + env(safe-area-inset-top)) 14px 0;
  position: relative;
  background: var(--bg1);
}

.boot-loader {
  position: absolute;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  gap: 10px;
  background: rgba(249, 252, 255, 0.9);
  transition: opacity 0.18s var(--ease-ui);
}

.boot-loader.done {
  opacity: 0;
}

.intro-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(min-content, 1fr); /* min-content lets row grow past 1fr when card is tall */
  padding: 22px 16px calc(24px + env(safe-area-inset-bottom));
  /* Near-opaque fill instead of backdrop-filter: blur(). A backdrop blur sits above
     the infinitely-swaying intro bells, forcing Safari to recompute the blur every
     frame (a heavy GPU/battery cost on iOS) for almost no visual gain here. */
  background: rgba(238, 241, 245, 0.975);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.intro-card {
  grid-area: 1 / 1;
  width: min(420px, 100%);
  padding: 36px 28px 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--panel-border);
  box-shadow: 0 16px 36px rgba(31, 54, 104, 0.12);
  text-align: center;
  transition: opacity 0.18s var(--ease-ui), transform 0.18s var(--ease-ui);
}

.intro-overlay.show-settings .intro-card {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
}

.intro-settings-card {
  text-align: left;
}

.intro-settings-card .intro-title {
  text-align: center;
}

.intro-settings-card .settings {
  margin-top: 14px;
}

.intro-overlay.show-settings .intro-settings-card {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.end-overlay {
  z-index: var(--z-end);
}

.end-card {
  max-width: 430px;
}

.end-reward-row {
  margin: 6px 0 18px;
}

.intro-title {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.8rem);
  line-height: 0.95;
  font-weight: 900;
  color: var(--p-navy);
}

.intro-copy {
  margin: 12px auto 18px;
  max-width: 28ch;
  font-size: 0.98rem;
  line-height: 1.35;
  color: var(--ink-mid);
}

.intro-actions {
  display: grid;
  gap: 10px;
}

.intro-actions-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 28px;
  gap: 12px;
}

/* How to Play now shares intro-settings-btn base style — no overrides needed */

/* Game Mode pre-game screen */
.game-mode-card {
  max-width: 380px;
  padding: 28px 24px 24px;
}

.game-mode-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 20px 0 24px;
  text-align: left;
}

.game-mode-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-mode-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8494b4;
  margin: 0;
}

/* Game mode section: full-width toggle buttons */
.game-mode-section .mode-toggle {
  width: 100%;
  display: flex;
  gap: 8px;
}

.game-mode-section .mode-btn {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: 12px;
  text-align: center;
}

/* Slimmer Play/Back buttons in game mode card */
.game-mode-card .intro-play-btn,
.game-mode-card .intro-settings-btn {
  min-height: 44px;
  font-size: 0.92rem;
}

.game-mode-card .intro-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

/* How to Play card */
.how-to-play-card {
  max-width: 420px;
  padding: 28px 24px 24px;
}

.htp-steps {
  list-style: none;
  padding: 0;
  margin: 20px 0 20px;
  display: grid;
  gap: 12px;
  text-align: left;
}

.htp-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--p-navy);
}

.htp-icon {
  font-size: 1.25rem;
  line-height: 1.2;
  flex-shrink: 0;
  width: 26px;
  text-align: center;
}

.intro-play-btn,
.intro-settings-btn {
  min-height: 52px;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 900;
}

.intro-play-btn {
  background: var(--p-teal);
  color: #fff;
}

/* "Coming Soon" (chromatic mode not yet playable) — reads as inactive, not a CTA */
.intro-play-btn.is-coming-soon {
  background: #d3dbe8;
  color: #7a869e;
  box-shadow: none;
  cursor: not-allowed;
}

.intro-play-btn.is-coming-soon:active {
  transform: none;
}

.intro-settings-btn {
  background: #e8f7f7;
  color: var(--p-navy);
  border: 2px solid var(--p-teal);
}

.boot-loader-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #c8d7f6;
  border-top-color: #099695;
  animation: bootSpin 0.82s linear infinite;
}

.boot-loader-text {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: #446196;
}

@keyframes bootSpin {
  to { transform: rotate(360deg); }
}

button {
  border: 0;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

/* Bank notes have their own press feedback (.note-playing) and celebration animations.
   The generic button:active down-press persists until touchend — if a correct answer
   is processed before touchend, the animation starts from translateY(0) while the
   button is still at translateY(1px), causing a visible jerk. Override to none. */
.bank-note:active {
  transform: none;
}

.app-title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.52rem, 7vw, 2.2rem);
  font-weight: 900;
  color: var(--ink);
  line-height: 1.1;
  white-space: nowrap;
}

.top-ui {
  display: flex;
  align-items: center; /* title vertically aligned with quit/settings buttons */
  justify-content: center;
  min-height: 54px;
  margin-bottom: 2px;
  position: relative;
}

.app-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.app-title-top {
  position: relative;
  font-size: clamp(1.5rem, 6.6vw, 2rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
}

/* Rounder, lifted tool buttons in the title bar */
.quit-btn,
.settings-btn {
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #e2eafc;
  box-shadow: 0 2px 7px rgba(31, 54, 104, 0.1);
}

.quit-btn:active,
.settings-btn:active {
  transform: translateY(-50%) scale(0.92);
}

.play-center {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 6;
  width: auto;
  display: grid;
  place-items: center;
  gap: 4px;
  margin: 0;
  transform: none;
  transition: opacity 0.18s var(--ease-ui), transform 0.18s var(--ease-ui);
}

.play-center.sequence-active {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.play-center.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.settings-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
}

.quit-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  color: var(--ink-soft);
  border-color: #c8d5e8;
}

.quit-btn:hover {
  color: var(--p-red);
  border-color: var(--p-red);
  background: #fff0f0;
}

.quit-glyph {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

/* Quit confirm overlay */
.quit-confirm-overlay {
  z-index: var(--z-modal);
}

.quit-confirm-card {
  max-width: 360px;
}

.quit-confirm-copy {
  margin: 10px 0 20px;
  font-size: 0.95rem;
  color: var(--ink-mid);
  line-height: 1.4;
}

.quit-yes-btn {
  background: var(--p-red);
  border-color: #c00;
}

.settings-glyph {
  display: inline-block;
  font-size: 1.5rem;
  line-height: 1;
  transform: translateY(1px);
}

.settings-btn.active {
  background: #099695;
  color: #fff;
  border-color: var(--teal-dark);
  box-shadow: none;
}

.settings-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(760px, calc(100vw - 44px));
  z-index: var(--z-settings);
  max-height: min(78vh, 520px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.settings {
  width: 100%;
  margin: 0;
  padding: 7px 9px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  display: grid;
  gap: 6px;
}

.intro-settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.intro-settings-cancel-btn,
.intro-settings-accept-btn {
  min-height: 46px;
  border-radius: 14px;
  font-size: 0.96rem;
  font-weight: 900;
}

.intro-settings-cancel-btn {
  background: #f2f6ff;
  color: var(--p-navy);
  border: 2px solid #d3e1ff;
}

.intro-settings-accept-btn {
  background: var(--p-teal);
  color: #fff;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(88px, 118px) 1fr;
  align-items: center;
  gap: 8px;
}

.setting-row-slider {
  grid-template-columns: minmax(88px, 118px) 1fr minmax(42px, 50px);
}

/* Difficulty is the one three-way row in here. The label column is sized for a
   two-button toggle, so give this row a narrower label and let the three chips
   share the rest evenly instead of wrapping "Hard" onto its own line. */
.setting-row-triple { grid-template-columns: minmax(74px, 96px) 1fr; }
.setting-row-triple .mode-toggle { flex-wrap: nowrap; }
.setting-row-triple .mode-btn { flex: 1 1 0; min-width: 0; padding-inline: 6px; }

.setting-label {
  font-weight: 900;
  color: #2a4478;
  font-size: 0.81rem;
}

.setting-value {
  text-align: center;
  font-weight: 900;
  color: #0f4474;
  background: var(--panel);
  border: 2px solid #d8e6ff;
  border-radius: 999px;
  padding: 1px 4px;
  font-size: 0.74rem;
}

.settings input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.mode-toggle {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mode-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-group-label {
  font-size: 0.78rem;
  font-weight: 900;
  color: #2a4478;
  min-width: 42px;
}

.mode-btn {
  color: #23416e;
  background: #f2f6ff;
  border: 2px solid #d3e1ff;
  min-height: 30px;
  min-width: 72px;
  padding: 5px 9px;
  font-size: 0.76rem;
  border-radius: 10px;
}

.mode-btn.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal-dark);
  box-shadow: none;
}

.toolbar {
  display: grid;
  grid-template-columns: auto;
  justify-content: end;
  gap: 6px;
  align-items: center;
  width: auto;
  margin-top: 18px;
}

.question-hint-label {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(34, 69, 127, 0.55);
  margin: 10px 0 0;
  min-height: 1.2em;
  transition: opacity 0.25s var(--ease-ui);
}
.question-hint-label:empty {
  visibility: hidden;
}

.transport-btn {
  min-height: 46px;
  border: 2px solid var(--green);
  border-radius: 15px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #17366a;
  background: var(--panel);
  box-shadow: none;
  font-size: 0.92rem;
  font-weight: 900;
}

.play-circle {
  width: 100%;
  height: auto;
}

.play-triangle {
  width: 0;
  height: 0;
  border-left: 12px solid var(--green);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  margin-left: 1px;
}

.transport-label {
  color: inherit;
  font-size: inherit;
  line-height: 1;
  font-weight: 900;
}

.replay-btn {
  position: relative;
}

.tool-icon-btn,
.score-skip-btn {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  border-radius: 15px;
  padding: 0;
  background: var(--panel);
  border: 2px solid var(--line);
  color: #4f6796;
  box-shadow: none;
}

.tool-icon-btn svg,
.score-skip-btn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.score-skip-btn {
  width: auto;
  min-width: 0;
  display: inline-grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  font: inherit;
}

.score-skip-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.replay-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* ── Game Dash: unified stats card ─────────────────────────── */
.hud-panel {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 16px;
  /* Capped and centred: stretched edge-to-edge on a wide screen, four little
     stats marooned across a metre of panel. The cards are the point — the
     scoreboard reads as a strip above them, not a banner. */
  width: 100%;          /* auto margins alone shrink a flex item to its content */
  max-width: 640px;
  margin: 2px auto 6px;
  padding: 8px 14px 7px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hud-row {
  display: flex;
  align-items: center;
}

/* Row 1: four equal stat chips */
.hud-stats-row {
  justify-content: space-around;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.hud-divider {
  width: 1px;
  height: 28px;
  background: #dde8f6;
  flex-shrink: 0;
}

.hud-label {
  font-size: 0.56rem;
  font-weight: 900;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hud-value {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.2;
}

/* Row 2: bonus meter full-width */
.hud-meter-row {
  gap: 10px;
  padding: 0 2px;
  align-items: center;
}

.hud-meter-label {
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-meter-row .bonus-meter {
  flex: 1;
  height: 9px;
  margin: 0; /* override any inherited margin */
}

/* Row 3: progress track */
.hud-progress-row {
  gap: 8px;
  align-items: center;
}

.hud-progress-label {
  flex-shrink: 0;
}

.hud-progress-row .outcome-track-rail {
  flex: 1;
}

.hud-progress-row .outcome-track-value {
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Legacy score-row kept for any stray references — visually hidden */
.score-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 8px;
}

.reward-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 8px;
}

.reward-pill {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 249, 255, 0.96));
  text-align: center;
}

.reward-pill-meter {
  text-align: left;
}

.reward-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.reward-value {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
  font-weight: 900;
  color: var(--ink);
}

.setting-row-actions {
  grid-template-columns: 1fr;
  gap: 6px;
}

.clear-scores-btn {
  width: 100%;
  min-height: 42px;
}

.bonus-meter {
  display: block;
  height: 11px;
  border-radius: 999px;
  background: #dfe8f5;
  border: 1px solid #cedcf0;
  margin-top: 10px;
  overflow: hidden;
  position: relative;
}

.bonus-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--p-teal), var(--p-green));
  transition: width 0.4s var(--ease-out);
}

.bonus-meter.is-ready .bonus-meter-fill {
  background: linear-gradient(90deg, var(--p-gold), var(--p-orange));
  animation: bonus-meter-pulse 0.55s ease 2;
}

@keyframes bonus-meter-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

.end-scores {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.end-scores-label {
  margin: 0 0 10px;
  text-align: center;
}

.end-score-list {
  margin: 0;
  padding-left: 22px;
  color: var(--p-navy);
  display: grid;
  gap: 10px;
}

.end-score-list li::marker {
  color: var(--p-teal);
  font-weight: 900;
}

.end-score-item {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f6fbff);
  box-shadow: 0 12px 26px rgba(27, 35, 62, 0.08);
}

.end-score-item.is-pending-entry {
  list-style: none;
  margin-left: -22px;
  border: 2px dashed rgba(0, 153, 153, 0.34);
  background: linear-gradient(180deg, rgba(0, 153, 153, 0.08), rgba(255, 255, 255, 0.98));
}

.end-score-item.is-new-entry {
  border-color: #6abb4a;
  background: linear-gradient(180deg, rgba(106, 187, 74, 0.2), #ffffff);
  box-shadow: 0 14px 28px rgba(106, 187, 74, 0.18);
  animation: newScorePop 420ms cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

.end-score-item.is-rank-1 {
  border-color: #f2c94c;
  background: linear-gradient(180deg, rgba(242, 201, 76, 0.26), #fffdf3);
  box-shadow: 0 16px 30px rgba(242, 201, 76, 0.2);
}

.end-score-item.is-rank-2 {
  border-color: #b8c7dc;
  background: linear-gradient(180deg, rgba(184, 199, 220, 0.26), #fbfdff);
  box-shadow: 0 14px 28px rgba(118, 140, 168, 0.16);
}

.end-score-item.is-rank-3 {
  border-color: #d89a62;
  background: linear-gradient(180deg, rgba(216, 154, 98, 0.24), #fffaf6);
  box-shadow: 0 14px 28px rgba(216, 154, 98, 0.16);
}

.end-score-item.is-empty-entry,
.end-score-item.is-unranked-entry {
  list-style: none;
  margin-left: -22px;
}

.end-score-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.end-score-name {
  font-size: 1rem;
  font-weight: 900;
  color: var(--p-navy);
}

.end-score-points {
  font-size: 0.96rem;
  font-weight: 900;
  color: var(--p-teal);
  white-space: nowrap;
}

.end-score-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-muted);
}

.end-score-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--p-teal);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.end-score-tag.is-rank-1 {
  background: #f2c94c;
  color: var(--p-navy);
}

.end-score-tag.is-rank-2 {
  background: #c4d1e3;
  color: var(--p-navy);
}

.end-score-tag.is-rank-3 {
  background: #e0a06d;
}

.end-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.end-name-input {
  min-height: 46px;
  border-radius: 14px;
  border: 2px solid #d3e1ff;
  background: var(--panel);
  color: var(--p-navy);
  font: inherit;
  font-weight: 800;
  padding: 0 14px;
}

.end-name-input:focus-visible {
  outline: 2px solid var(--p-teal);
  outline-offset: 2px;
  border-color: var(--p-teal);
  box-shadow: 0 0 0 3px rgba(0, 153, 153, 0.16);
}

.end-save-btn {
  min-height: 46px;
  white-space: nowrap;
}

.end-name-error {
  min-height: 20px;
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #b33f54;
}

@keyframes newScorePop {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.last-chip {
  display: none;
}

.score-chip,
.score-skip-btn {
  border: 1px solid #e2e9f4;
  border-radius: 999px;
  background: transparent;
  padding: 6px 6px;
  text-align: center;
  box-shadow: none;
}

.chip-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.chip-value {
  display: block;
  font-size: 1rem;
  font-weight: 900;
  color: var(--ink);
}

.tries-value {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 2px;
}

.try-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #c8d7f7;
  background: var(--bg1);
}

.try-dot.is-available {
  border-color: var(--green);
  background: var(--green);
}

.outcome-track {
  margin: 2px 0 8px;
  padding: 0 2px 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.outcome-track-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.outcome-track-label {
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.outcome-track-value {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--ink);
}

.outcome-track-rail {
  position: relative;
  padding: 2px 0;
}

.outcome-track-rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  background: #dde7fb;
}

.outcome-track-fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6ec4ff, #57a8ef);
  transition: width 260ms var(--ease-ui);
}

.outcome-dots {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.outcome-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #c8d7f7;
  background: var(--bg1);
  transition: transform 0.18s var(--ease-ui), background-color 0.2s var(--ease-ui), border-color 0.2s var(--ease-ui);
}

.outcome-dot.is-correct {
  background: #58d36f;
  border-color: #2ea448;
}

.outcome-dot.is-half {
  background: #ffd95b;
  border-color: #e3b62f;
}

.outcome-dot.is-wrong {
  background: #ff7171;
  border-color: #d74f4f;
}

.outcome-dot.is-filled {
  transform: scale(1.03);
}

/* Message line removed — all text routes through Burst Zone */
.message { display: none !important; }

/* ── Burst Zone: primary communicator for all game events ──── */

/* Default: try-again, hints — bouncy but unhurried */
@keyframes burst-in {
  0%   { opacity: 0; transform: scaleX(0.70) scaleY(1.36) translateY(16px)  rotate(2.5deg);  letter-spacing: -0.07em; }
  32%  { opacity: 1; transform: scaleX(1.14) scaleY(0.82) translateY(-6px)  rotate(-1.8deg); letter-spacing: 0.08em;  }
  55%  { transform:            scaleX(0.94) scaleY(1.07) translateY(2px)    rotate(0.8deg);  letter-spacing: -0.01em; }
  72%  { transform:            scaleX(1.02) scaleY(0.98) translateY(-0.5px) rotate(0);       letter-spacing: 0;       }
  87%  { transform:            scaleX(0.995) scaleY(1.005);                                                           }
  100% { opacity: 1; transform: scale(1)                  translateY(0)     rotate(0);       letter-spacing: 0;       }
}

/* Combo: rises from below with squash-and-stretch — deliberate, readable */
@keyframes burst-in-combo {
  0%   { opacity: 0; transform: scaleX(0.62) scaleY(1.56) translateY(22px)  rotate(3deg);    letter-spacing: -0.10em; }
  30%  { opacity: 1; transform: scaleX(1.22) scaleY(0.72) translateY(-10px) rotate(-2deg);   letter-spacing: 0.14em;  }
  52%  { transform:            scaleX(0.90) scaleY(1.12) translateY(4px)    rotate(1.2deg);  letter-spacing: -0.03em; }
  68%  { transform:            scaleX(1.05) scaleY(0.96) translateY(-1px)   rotate(-0.4deg); letter-spacing: 0;       }
  82%  { transform:            scaleX(0.99) scaleY(1.01);                                                             }
  100% { opacity: 1; transform: scale(1)                  translateY(0)     rotate(0);       letter-spacing: -0.01em; }
}

/* Intro: title card drop — starts as compressed horizontal bar, opens vertically */
@keyframes burst-in-intro {
  0%   { opacity: 0; transform: scaleX(1.70) scaleY(0.14) translateY(-14px) rotate(-1.2deg); letter-spacing: 0.22em;  }
  28%  { opacity: 1; transform: scaleX(0.78) scaleY(1.34) translateY(8px)   rotate(0.8deg);  letter-spacing: -0.04em; }
  50%  { transform:            scaleX(1.10) scaleY(0.90) translateY(-3px)   rotate(-0.3deg); letter-spacing: 0.09em;  }
  68%  { transform:            scaleX(0.97) scaleY(1.03) translateY(1px)    rotate(0);       letter-spacing: 0.07em;  }
  84%  { transform:            scaleX(1.01) scaleY(0.99);                                    letter-spacing: 0.06em;  }
  100% { opacity: 1; transform: scale(1)                  translateY(0)     rotate(0);       letter-spacing: 0.06em;  }
}

/* Exit: short windup then collapse — snappy but not jarring */
@keyframes burst-out {
  0%   { opacity: 1; transform: scale(1)                  rotate(0);     }
  20%  { opacity: 1; transform: scaleX(1.10) scaleY(0.90) rotate(-1deg); }
  100% { opacity: 0; transform: scaleX(0.50) scaleY(0.40) translateY(-14px) rotate(3.5deg); letter-spacing: 0.08em; }
}

/* #gameScreen: true viewport-locked flex column — no scroll */
#gameScreen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%; /* ID specificity beats .screen { height:100svh } — fills .app exactly */
  padding: calc(20px + env(safe-area-inset-top)) 24px 0; /* ID beats class — more breathing room */
}

.bonus-burst {
  flex-shrink: 0;
  min-height: clamp(40px, 6vh, 56px); /* compact — melody gets more vertical real-estate */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 8px; /* narrow — transform-scaled text clipped by #gameScreen overflow:hidden */
  position: relative;
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--teal-dark);
  opacity: 0;
  pointer-events: none;
  margin: 0;
}

.burst-text {
  display: block;
}

.bonus-burst.is-entering {
  animation: burst-in       0.72s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
/* Tone-specific entrances — higher specificity overrides the base */
.bonus-burst.is-entering.is-combo {
  animation: burst-in-combo 0.84s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.bonus-burst.is-entering.is-intro {
  animation: burst-in-intro 0.88s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.bonus-burst.is-entering.is-finish {
  animation: burst-in-combo 0.84s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.bonus-burst.is-leaving {
  animation: burst-out 0.26s ease-in forwards;
}

.bonus-burst.is-intro    { color: var(--p-navy, #1b233e); letter-spacing: 0.06em; }
.bonus-burst.is-combo    { color: var(--teal-dark); font-size: 1.28rem; }
.bonus-burst.is-finish   { color: #1e7a48; font-size: 1.24rem; }
.bonus-burst.is-gameover { color: #7a1f1f; letter-spacing: -0.02em; font-size: 1.14rem; }

/* Fly-active: make container visible so #bonusFloat child animation isn't killed by parent opacity:0 */
.bonus-burst.is-fly-active { opacity: 1; }

/* ── 2× Bonus fly-up: score travels from Burst Zone to Game Dash ── */
@keyframes bonus-fly-up {
  0%   { opacity: 0;    transform: translateX(-50%) translateY(0)      scale(0.55); }
  14%  { opacity: 1;    transform: translateX(-50%) translateY(-12px)   scale(1.45); }
  72%  { opacity: 0.9;  transform: translateX(-50%) translateY(-120px)  scale(1.05); }
  100% { opacity: 0;    transform: translateX(-50%) translateY(-150px)  scale(0.85); }
}

.bonus-fly {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(0);
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--p-gold, #f5b325);
  letter-spacing: -0.02em;
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-fly);
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(245, 179, 37, 0.45);
}

.bonus-fly.is-flying {
  animation: bonus-fly-up 1.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.question-wrap {
  flex: 1; /* fills space between HUD/burst and bell bank — keeps melody centered */
  min-height: 0; /* let flex shrink below content height so bank-dock stays pinned */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 16px 0 12px;
  box-shadow: none;
  position: relative;
}

.question-prompt {
  display: none;
  margin: 0;
  text-align: center;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  font-weight: 900;
  color: #22457f;
}

.question-grid {
  width: max-content;
  margin: 0 auto;
  display: grid;
  gap: var(--gap);
}

.question-grid.melody-stack {
  width: min(100%, 430px);
  height: calc(var(--tile-size) + 90px);
  display: block;
  position: relative;
  /* NEVER SHRINK THIS BOX. The slots inside are absolutely positioned and
     anchored to the bottom, so they do not shrink with it — a squeezed box
     just lets the cards spill out of the top. Left to flex's default
     shrinking, a short window took this from 244px down to 90px and dropped
     154px cards straight through the prompt above (measured 125px of overlap
     on a 1400x700 window, 2026-09-11). The height above is a reservation for
     the pitch fan; it has to be honoured, not negotiated. */
  flex: 0 0 auto;
}

.melody-stack .question-slot {
  position: absolute;
  left: calc(50% - (var(--tile-size) / 2) + var(--stack-x, 0px));
  bottom: var(--stack-y, 0px);
  z-index: var(--stack-z, 1);
  transform: rotate(var(--stack-rotate, 0deg));
}

.melody-stack .question-card {
  /* Two-layer shadow gives each fanned card its own lift so overlapping cards separate
     cleanly instead of merging into one blob. */
  box-shadow: 0 10px 20px rgba(27, 35, 62, 0.16), 0 2px 5px rgba(27, 35, 62, 0.12);
}

.melody-stack .question-slot.revealed .question-card {
  transform: rotateY(180deg);
}

/* Desktop / tablet (>480px): the .app card is a fixed 430px, so tiles use fixed px.
   (vw units here would balloon to the clamp max inside the small card and bury the fan.)
   Portrait phones are handled by the @media (max-width: 480px) block far below. */
/* The cards ARE the game, so they take the room they deserve: each size grows
   with the viewport and is capped by whichever axis runs out first — vh for a
   short window, vw so five cards still fit a narrow one. The px floors keep
   phones exactly where they were. (Rob, 2026-08-27: "MAKE THE CARDS BIGGER".) */
.question-grid.slots-2 {
  --tile-size: clamp(176px, min(29vh, 30vw), 248px);
  --gap: 14px;
}

.question-grid.slots-3 {
  --tile-size: clamp(150px, min(28vh, 25vw), 240px);
  --gap: 12px;
}

.question-grid.slots-4 {
  --tile-size: clamp(116px, min(27vh, 20vw), 225px);
  --gap: 10px;
}

.question-grid.slots-5 {
  --tile-size: clamp(96px, min(25vh, 17vw), 205px);
  --gap: 9px;
}

.question-slot {
  width: var(--tile-size);
  height: var(--tile-size);
  perspective: 1000px;
  position: relative;
}

.question-card {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  border: 2px solid #e3ebfc;
  background: #ffffff;
  box-shadow: none;
  -webkit-transform-style: preserve-3d; /* required for iOS Safari card flip */
  transform-style: preserve-3d;
  transition: transform 0.36s var(--ease-ui);
  position: relative;
}

.question-slot.revealed .question-card {
  transform: rotateY(180deg);
}

.question-slot.playing .question-card {
  border-color: #cfd9f6;
  box-shadow: none;
}

.question-slot.playing .question-face-front {
  animation: questionJiggle 280ms var(--ease-ui);
  color: #40639f;
}

.question-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  -webkit-backface-visibility: hidden; /* required for iOS Safari — without this both faces render */
  backface-visibility: hidden;
}

.question-face-front {
  font-size: 2.1rem;
  font-weight: 900;
  color: #5e75a5;
}

.question-face-back {
  transform: rotateY(180deg);
}

.question-face-back .question-note {
  width: calc(var(--tile-size) - 8px);
  height: calc(var(--tile-size) - 8px);
  border-radius: 16px;
  pointer-events: none;
}

.question-slot.first-note-hint .question-note-hint {
  opacity: 0.5;
  filter: saturate(0.82);
}

.bank-dock {
  /* In-flow flex child — sticks to bottom naturally */
  flex-shrink: 0;
  /* Inherits #gameScreen's 24px side padding — matches HUD panel alignment */
  padding: 8px 0 10px;
  padding-bottom: calc(26px + env(safe-area-inset-bottom)); /* extra room for labels below C/Hi-C */
  background: transparent;
  z-index: var(--z-dock);
  position: relative;
}

.bank-dock::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--dock-bg-height) + env(safe-area-inset-bottom));
  /* Blends with the page — depth comes from each bell's own drop shadow, not a shelf edge.
     (A tinted fill / highlight here drew a visible horizontal line across the D–B bells.) */
  background: var(--bg1);
  box-shadow: none;
  pointer-events: none;
}

.bank-dock-inner,
.bank-area {
  height: auto;
}

.bank-dock-inner {
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.bank-area {
  border-radius: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.bank-area.chromatic-bank-area {
  border-radius: 14px;
  border: 1px solid #cfdcf3;
  background: var(--panel);
  padding: 0 2px 10px;
}

.bank-grid {
  width: max-content;
  margin: 0 auto;
}

.bank-grid.bank-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: var(--bank-note-gap);
  padding: 2px 6px 0;
}

/* C major strip: edge-to-edge flex — bells share available width equally, zero overlap.
   8 bells + 33px spacer fill the full dock width (~430px → ~50px per bell).
   No horizontal overlap = no ambiguous hit zones. */
.bank-grid.c-major-strip {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  /* Narrower row → each bell sits ~48px from the next, matching the 47px vertical arch
     step so the staircase reads as an even ~45° arch instead of a shallow wide one.
     A small center spacer keeps F and G from crowding at the peak. */
  width: min(100%, 406px);
  overflow: visible;
  margin: 0 auto;
  padding: 0;
  gap: 0;
}

/* flex:1 0 0 — each bell grows equally from a 0 basis, sharing space with no overlap.
   min-width:0 overrides the base .bank-note min-width variable, preventing size fights.
   height:44px = stage card only; bell composite overflows above via bottom:0 anchor. */
.bank-grid.c-major-strip .bank-note {
  flex: 1 0 0;
  height: 44px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  overflow: visible; /* bell composite overflows above the 44px stage hit zone */
}

/* Arch staircase. CSS `translate` keeps tap animations (which use `transform`) from
   clobbering the arch position — both properties compose independently. */
.bank-grid.c-major-strip .bank-note:nth-child(1) { translate: 0 0;      z-index: 8; } /* C  */
.bank-grid.c-major-strip .bank-note:nth-child(2) { translate: 0 -47px;  z-index: 7; } /* D  */
.bank-grid.c-major-strip .bank-note:nth-child(3) { translate: 0 -94px;  z-index: 6; } /* E  */
.bank-grid.c-major-strip .bank-note:nth-child(4) { translate: 0 -141px; z-index: 5; } /* F  */
/* nth-child(5) = .arch-listen-spacer */
.bank-grid.c-major-strip .bank-note:nth-child(6) { translate: 0 -141px; z-index: 5; } /* G  */
.bank-grid.c-major-strip .bank-note:nth-child(7) { translate: 0 -94px;  z-index: 6; } /* A  */
.bank-grid.c-major-strip .bank-note:nth-child(8) { translate: 0 -47px;  z-index: 7; } /* B  */
.bank-grid.c-major-strip .bank-note:nth-child(9) { translate: 0 0;      z-index: 8; } /* c  */

/* Spacer: fixed 33px between F and G; its center lands at 50% of 430px = phone center,
   aligning perfectly with the circle listen button (position:absolute; left:50%). */
.arch-listen-spacer {
  /* Modest center gap so F and G get breathing room at the peak (and frame the Listen
     button below) without reopening the old wide gap. The element stays in the DOM so
     the :nth-child arch rules keep their positions. */
  flex: 0 0 22px;
  width: 22px;
  height: 44px;
  align-self: flex-end;
  pointer-events: none;
  visibility: hidden;
}

/* THE WHOLE DRAWN BELL IS PRESSABLE.

   The button is the 44px stage card and the bell art towers 74px above it with
   pointer-events:none, so for a child the big colourful bell -- the only part
   that looks like the thing to press -- did nothing, and only the little card
   at its feet worked. Measured before this rule: 0 of 8 taps on a bell's face
   registered, 0 of 8 on its belly, 8 of 8 on the base. A tap that plays nothing
   does not read as "you missed", it reads as "this app is slow", which is
   exactly what Rob reported.

   Done with a pseudo-element rather than by growing the button, because the
   arch layout is built on the button's 44px height: the :nth-child translate
   staircase, the hidden spacer and the dock's padding-top are all measured
   against it. An absolutely positioned ::before takes pointer events without
   contributing to layout, so nothing moves.

   Width stays at the button's own column (inset left/right 0, and the column is
   94px against 74px of art, so the art is fully covered). Columns therefore
   tile without overlapping, and no bell can steal its neighbour's taps -- the
   mistake that made the hex board feel wrong. */
.bank-grid.c-major-strip .bank-note::before {
  content: "";
  position: absolute;
  /* Up over the full 118px composite: 118 - 44 = 74. */
  inset: -74px 0 0 0;
  /* Invisible; this element exists only to be pressed. */
  background: transparent;
}

/* Prodigies Bells app design: stage card = hit zone (44px), bell blob overflows above.
   Composite anchored to button bottom, extends 68px above button top (112 - 44 = 68).
   Bell image fills full 112px composite; stage image fills bottom 44px — bell towers above. */
.bank-grid.c-major-strip .bank-note .bell-composite {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 74px;
  height: 118px;
  pointer-events: none; /* hit zone is the button, not the visual */
}

/* Stage: landscape card anchored to button floor — overrides base inset:0 rule */
.bank-grid.c-major-strip .bank-note .note-art-stage {
  position: absolute;
  inset: auto;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 44px;
  object-fit: fill;
  /* Soft contact shadow so each pedestal reads as sitting on the tray. */
  filter: drop-shadow(0 3px 3px rgba(26, 35, 61, 0.16));
}

/* Bell: fills full composite height, overflowing above the stage card */
.bank-grid.c-major-strip .bank-note .note-art-bell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  /* Grounds the character bell with a gentle drop shadow — gives the tray real depth. */
  filter: drop-shadow(0 5px 4px rgba(26, 35, 61, 0.22));
}

/* Dock: bell composite extends 68px above each button (112px composite, 44px button).
   Peak translate is -141px, so visual top = 141 + 68 = 209px above dock floor.
   padding-top: 209 + 11 breathing = 220px. dock-height: 220 + 44 + ~36 bottom ≈ 300px
   NOTE: was :root:has(.bank-grid.c-major-strip) — replaced with #gameScreen to avoid
   :has() layout dependency on mobile browsers. Arch is always active in the game screen. */
#gameScreen {
  --dock-height: 308px;
  --dock-bg-height: 80px;
}

/* Push the bell row down so the arch peak sits inside the dock's box.
   NOTE: was .bank-dock:has(.bank-grid.c-major-strip) — replaced with #gameScreen .bank-dock
   to remove :has() from a load-bearing layout rule. */
#gameScreen .bank-dock {
  padding-top: 226px; /* 141px arch + 74px bell overflow above stage + 11px breathing */
  padding-left: 0;
  padding-right: 0;
}

/* CRITICAL: bank-area defaults to overflow-y: hidden (to prevent scroll on other layouts).
   For the arch layout, overflow: hidden clips every bell that translates upward.
   NOTE: .bank-area:not(.chromatic-bank-area) below already sets overflow: visible —
   this rule is now redundant and removed. */

/* Center bells in non-chromatic bank area */
.bank-area:not(.chromatic-bank-area) {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding-top: 4px;
}

.bank-grid.chromatic-piano {
  width: max-content;
  padding: 10px 4px 12px;
  margin-bottom: 4px;
}

.chromatic-piano-strip {
  position: relative;
  width: calc((var(--white-count) * var(--bank-note-size)) + ((var(--white-count) - 1) * var(--bank-note-gap)));
  padding-top: calc(var(--bank-note-size) * 0.72);
}

.chromatic-white-row {
  display: flex;
  gap: var(--bank-note-gap);
  align-items: flex-end;
}

.chromatic-black-row {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--bank-note-size) * 0.86);
  pointer-events: none;
}

.chromatic-black-wrap {
  position: absolute;
  top: -10px;
  transform: translateX(-50%);
  pointer-events: auto;
  z-index: 4;
}

.chromatic-black-wrap .bank-note {
  width: calc(var(--bank-note-size) * 0.9);
  height: calc(var(--bank-note-size) * 1.18);
  min-width: calc(var(--bank-note-size) * 0.9);
  min-height: calc(var(--bank-note-size) * 1.18);
}

.note {
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: 22px;
  border: 3px solid transparent;
  margin: 0;
  padding: 0;
  background: var(--note-color, #ff7a7a);
  color: #fff;
  font-size: clamp(1.75rem, 4.8vw, 2.2rem);
  font-weight: 900;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  box-shadow: none;
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  position: relative;
  transition: transform 0.12s var(--ease-ui), filter 0.12s var(--ease-ui);
}

.note.has-image {
  background: var(--panel);
  border-color: var(--note-color, #8fa3d8);
  color: #20315f;
  text-shadow: none;
}

.bank-note {
  width: var(--bank-note-size);
  height: calc(var(--bank-note-size) * 1.22);
  min-width: var(--bank-note-size);
  min-height: calc(var(--bank-note-size) * 1.22);
  border: 3px solid var(--note-color, #c9d7f5);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: none;
  color: #1f3668;
  font-size: 0.98rem;
  font-weight: 900;
  text-shadow: none;
}

.bank-note .bell-composite {
  width: 88%;
  height: 82%;
  margin-top: -6px;
}

.chromatic-white-note .bell-composite {
  margin-top: -5px;
}

.bank-note .note-label {
  bottom: 8px;
  min-width: 0;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1.2;
  color: #223e75;
  background: transparent;
  border: 0;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.66);
  box-shadow: none;
}

.bank-grid.c-major-strip .bank-note .note-label {
  /* Float below the bell image — art fills the full slot */
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  bottom: auto;
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.chromatic-white-note .note-label {
  bottom: 5px;
}

.chromatic-black-note {
  border: 0;
  background: #35425b;
  box-shadow: none;
  color: #eef2ff;
}

.chromatic-black-note .note-label {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.38);
}

.bank-note.chromatic-black-note.has-image {
  border: 0;
  background: #35425b;
  color: #eef2ff;
  box-shadow: none;
}

.bank-note.chromatic-black-note.has-image .note-label,
.bank-note.chromatic-black-note .note-label {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.38);
}

/* ── Production-style 20-bell layout ── */
.bank-grid.production-20 {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  gap: 0;
}

.production-bells {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.production-bells-main-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  width: 100%;
}

.production-bells-top-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  /* offset right by half a main-bell width so each top bell centers above the gap */
  padding-left: calc(100% / 24);
  margin-bottom: -10px; /* slight overlap so stages touch */
  position: relative;
  z-index: 2;
}

/* Bell note styling for production-20 — same no-card approach as c-major-strip */
.bank-grid.production-20 .bank-note {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  height: auto;
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bank-grid.production-20 .production-bells-main-row .bank-note {
  aspect-ratio: 1 / 1.22;
}

.bank-grid.production-20 .production-bells-top-row .bank-note {
  aspect-ratio: 1 / 0.9; /* sharps are shorter */
}

.production-bell-spacer {
  flex: 1 1 0;
  min-width: 0;
  pointer-events: none;
  visibility: hidden;
}

.bank-grid.production-20 .bank-note .bell-composite {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  width: 100%;
  margin-top: 0;
}

.bank-grid.production-20 .bank-note .note-label {
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  bottom: auto;
  font-size: 0.58rem;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

/* Dock height for production-20 */
:root:has(.bank-grid.production-20) {
  --dock-height: 140px;
  --dock-bg-height: 64px;
}

/* ── Bell composite (bell body + stage, same artboard size) ── */
.bell-composite {
  /* Occupies the same footprint as the old single note-art img */
  position: relative;
  width: 74%;
  height: 74%;
  margin-top: -8px;
  flex-shrink: 0;
}

.note-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: none;
}

.note-art-stage,
.note-art-bell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* When no stageBaseUrl is configured (e.g. bc_ SVGs with stage baked in), the stage img
   has no src set — hide it so it doesn't show a broken-image placeholder. */
.note-art-stage:not([src]),
.note-art-stage[src=""] {
  display: none;
}

.note-art-bell {
  /* bell body sits on top of stage */
  z-index: 1;
}

.note-label {
  position: absolute;
  left: 50%;
  bottom: 8px;          /* was 2px — it read as falling off the card */
  transform: translateX(-50%);
  min-width: 36px;
  padding: 1px 4px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #173065;
  background: transparent;
  text-shadow:
    0 1px 1px rgba(255, 255, 255, 0.8),
    0 0 2px rgba(255, 255, 255, 0.6);
  pointer-events: none;
  white-space: nowrap;
}

.note.note-playing,
.bank-note.note-playing {
  transform: translateY(1px) scale(1.03);
  filter: brightness(1.04);
}

/* Arch bells: a livelier "singing" hop on press/play. The arch height uses the `translate`
   property, so this `transform` composes with it instead of clobbering the staircase. */
.bank-grid.c-major-strip .bank-note.note-playing,
.bank-grid.c-major-strip .bank-note:active {
  transform: translateY(-6px) scale(1.07);
}

@media (hover: hover) {
  .bank-note:hover {
    transform: none;
    filter: none;
  }
}

.bank-note.note-correct-pop {
  animation: bankNoteCorrectPop 420ms var(--ease-ui);
}

.bank-note.note-wrong-wobble {
  animation: bankNoteWrongWobble 480ms var(--ease-ui);
}

.bank-note.note-celebrate {
  animation: bankNoteCelebrate 760ms var(--ease-ui);
  pointer-events: none;
}

.bank-note.first-note-hint-key {
  border-color: var(--note-color, #8fa3d8);
  border-width: 3px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--note-color, #8fa3d8) 45%, transparent),
              0 0 16px 5px color-mix(in srgb, var(--note-color, #8fa3d8) 40%, transparent);
}

.bank-note.chromatic-black-note.first-note-hint-key {
  border: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--note-color, #8fa3d8) 60%, transparent),
              0 0 16px 5px color-mix(in srgb, var(--note-color, #8fa3d8) 45%, transparent);
}

.bank-note.next-hint-key {
  animation: nextHintPulse 680ms var(--ease-ui);
}

.question-slot.hinting .question-card {
  animation: nextHintGlow 680ms var(--ease-ui);
}

.confetti-layer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confettiDrop 900ms ease forwards;
  will-change: transform, opacity; /* promote to its own layer so drops don't repaint siblings */
}

.firework-flash {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.96) 0%, rgba(255, 247, 191, 0.82) 36%, rgba(255, 152, 86, 0.35) 66%, rgba(255, 152, 86, 0) 100%);
  box-shadow:
    0 0 0 2px rgba(255, 213, 136, 0.34),
    0 0 28px rgba(255, 226, 166, 0.7);
  opacity: 0;
  animation: fireworkFlash 820ms ease-out forwards;
}

@keyframes confettiDrop {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx, 0px), var(--dy, 120px), 0) rotate(var(--rot, 240deg));
  }
}

@keyframes bankNoteCorrectPop {
  0% { transform: translateY(1px) scale(1.03); } /* launch from note-playing state — no snap */
  36% { transform: translateY(-6px) scale(1.08) rotate(-2deg); }
  70% { transform: translateY(0) scale(1.03) rotate(1deg); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes bankNoteWrongWobble {
  0% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(-4px) rotate(-4deg); }
  40% { transform: translateX(4px) rotate(4deg); }
  60% { transform: translateX(-3px) rotate(-3deg); }
  80% { transform: translateX(2px) rotate(2deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes bankNoteCelebrate {
  0% { transform: translateY(1px) scale(1.03); } /* launch from note-playing state — no snap */
  18% { transform: translateY(-10px) scale(1.06) rotate(-3deg); }
  40% { transform: translateY(0) scale(1.02) rotate(2deg); }
  62% { transform: translateY(-6px) scale(1.04) rotate(-2deg); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes fireworkFlash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.9);
  }
}

@keyframes questionJiggle {
  0% { transform: translateX(0) rotate(0deg); }
  22% { transform: translateX(-5px) rotate(-4deg); }
  48% { transform: translateX(4px) rotate(3deg); }
  72% { transform: translateX(-2px) rotate(-2deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes nextHintPulse {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.06); filter: brightness(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes nextHintGlow {
  0% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.85); }
  35% {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.9),
      0 0 0 4px rgba(87, 168, 239, 0.25);
  }
  100% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.85); }
}

.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;
}

@media (max-width: 900px) {
  :root {
    --tile-size: clamp(58px, 15vw, 76px);
    --bank-note-size: 84px;
    --bank-note-gap: 6px;
  }

  .top-ui {
    justify-content: center;
  }

  .toolbar {
    justify-content: center;
  }

  .score-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .outcome-dot {
    width: 16px;
    height: 16px;
  }

  .question-wrap {
    padding-inline: 4px;
  }
}

@media (max-width: 640px) {
  :root {
    --tile-size: clamp(54px, 17vw, 66px);
    --gap: 8px;
    --bank-note-size: clamp(64px, 19vw, 76px);
    --bank-note-gap: 8px;
    --dock-height: clamp(204px, 31vh, 226px);
    --dock-bg-height: clamp(72px, 12vh, 92px);
  }

  body {
    padding: 0;
  }

  .screen {
    padding: calc(20px + env(safe-area-inset-top)) 14px 0;
  }

  .app-title {
    max-width: 100%;
    margin: 0 auto;
  }

  .settings-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    top: calc(66px + env(safe-area-inset-top));
    width: auto;
  }

  .play-center {
    top: 2px;
    right: 2px;
  }

  .play-center.sequence-active {
    transform: translateY(6px);
  }

  .toolbar {
    grid-template-columns: auto;
    justify-content: end;
  }

  .play-circle {
    width: auto;
    min-height: 42px;
  }

  .transport-btn {
    min-height: 42px;
    padding: 7px 11px;
    gap: 7px;
    font-size: 0.92rem;
    border-width: 2px;
    border-radius: 14px;
  }

  .play-triangle {
    border-left-width: 12px;
    border-top-width: 7px;
    border-bottom-width: 7px;
    margin-left: 1px;
  }

  .score-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .score-chip {
    min-width: 0;
    padding: 6px 4px;
  }

  .score-skip-btn {
    min-height: 52px;
    padding: 6px 4px;
  }

  .chip-label {
    font-size: 0.58rem;
  }

  .chip-value {
    font-size: 0.96rem;
  }

  .outcome-track {
    margin-bottom: 7px;
  }

  .outcome-track-head {
    margin-bottom: 7px;
  }

  .outcome-dot {
    width: 14px;
    height: 14px;
  }

  .message {
    min-height: 26px;
    margin: 3px 0 7px;
    font-size: 0.92rem;
  }

  .question-wrap {
    padding: 12px 0 8px;
  }

  /* No slots-2 rule here on purpose: real phones are covered by the
     @media (max-width: 480px) block near the end of this file, and between 481
     and 640px the 430px app card holds the full-size pair comfortably. Adding a
     third layer here only makes the winner harder to predict. */
  .question-grid.slots-3 {
    --tile-size: clamp(116px, 36vw, 130px);
    --gap: 9px;
  }

  .question-grid.melody-stack {
    height: 226px;
  }

  .question-grid.slots-4 {
    --tile-size: clamp(94px, 29vw, 108px);
    --gap: 7px;
  }

  .question-grid.slots-5 {
    --tile-size: clamp(76px, 23vw, 88px);
    --gap: 6px;
  }

  .question-card {
    border-radius: 15px;
  }

  .question-face-front {
    font-size: 1.7rem;
  }

  .setting-row {
    grid-template-columns: 74px 1fr;
    gap: 6px;
  }

  .setting-row-slider {
    grid-template-columns: 74px 1fr 42px;
  }

  .mode-btn {
    min-width: 64px;
    padding-inline: 7px;
    font-size: 0.72rem;
  }

  /* c-major-strip single-row rules are now global — only tweak label size here */
  .bank-grid.c-major-strip .bank-note .note-label {
    font-size: clamp(0.55rem, 1.8vw, 0.7rem);
  }

  /* Flat layout dock on small phones */
  #gameScreen {
    --dock-height: clamp(90px, 14vh, 110px);
    --dock-bg-height: clamp(62px, 10vh, 74px);
  }

  .bank-note {
    border-radius: 17px;
  }

  .bank-note .bell-composite {
    width: 90%;
    height: 84%;
    margin-top: -4px;
  }

  .bank-note .note-label {
    bottom: 4px;
  }

  .bank-area.chromatic-bank-area {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .bank-grid.chromatic-piano {
    padding-top: 8px;
  }
}

@media (max-width: 360px) {
  :root {
    --tile-size: 51px;
    --gap: 6px;
    --bank-note-size: 68px;
    --bank-note-gap: 8px;
  }

  .question-grid.slots-3 {
    --tile-size: 116px;
    --gap: 9px;
  }

  .question-grid.melody-stack {
    height: 218px;
  }

  .question-grid.slots-4 {
    --tile-size: 92px;
    --gap: 7px;
  }

  .question-grid.slots-5 {
    --tile-size: 74px;
    --gap: 6px;
  }

  .app-title {
    font-size: 1.42rem;
  }

  .settings-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }
}

@media (max-width: 420px) and (max-height: 700px) {
  :root {
    --bank-note-size: 56px;
    --bank-note-gap: 6px;
    --dock-height: 152px;
    --dock-bg-height: 50px;
  }

  .screen {
    padding: calc(12px + env(safe-area-inset-top)) 10px 0;
  }

  .top-ui {
    min-height: 58px;
    margin-bottom: 4px;
  }

  .app-title {
    font-size: clamp(1.24rem, 8vw, 1.62rem);
  }

  .settings-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .score-row {
    gap: 6px;
    margin: 6px 0 4px;
  }

  .score-chip,
  .score-skip-btn {
    padding: 4px;
  }

  .score-skip-btn {
    min-height: 46px;
  }

  .chip-label {
    font-size: 0.54rem;
  }

  .chip-value {
    font-size: 0.88rem;
  }

  .tries-value {
    gap: 6px;
    min-height: 18px;
  }

  .try-dot {
    width: 14px;
    height: 14px;
  }

  .outcome-track {
    margin-bottom: 4px;
    padding-bottom: 4px;
  }

  .outcome-track-head {
    margin-bottom: 5px;
  }

  .outcome-track-label {
    font-size: 0.64rem;
  }

  .outcome-track-value {
    font-size: 0.76rem;
  }

  .outcome-dot {
    width: 12px;
    height: 12px;
  }

  .message {
    min-height: 22px;
    margin: 2px 0 4px;
    font-size: 0.86rem;
  }

  .question-wrap {
    padding: 8px 0 6px;
  }

  .question-grid.melody-stack {
    height: 146px;
  }

  .question-grid.slots-3 {
    --tile-size: 86px;
    --gap: 6px;
  }

  .question-grid.slots-4 {
    --tile-size: 70px;
    --gap: 5px;
  }

  .question-grid.slots-5 {
    --tile-size: 58px;
    --gap: 5px;
  }

  .question-card {
    border-radius: 14px;
  }

  .question-face-front {
    font-size: 1.4rem;
  }

  .play-center {
    top: 0;
    right: 0;
  }

  .toolbar {
    grid-template-columns: auto;
  }

  .transport-btn {
    min-height: 38px;
    padding: 6px 10px;
    gap: 6px;
    font-size: 0.86rem;
  }

  .play-triangle {
    border-left-width: 10px;
    border-top-width: 6px;
    border-bottom-width: 6px;
    margin-left: 1px;
  }

  .bank-dock {
    padding: 4px 8px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom)); /* room for labels below C/Hi-C */
  }

  .bank-area:not(.chromatic-bank-area) {
    padding-top: 0;
  }

  .bank-note {
    border-radius: 15px;
  }

  .bank-note .bell-composite {
    margin-top: -2px;
  }

  .bank-note .note-label {
    bottom: 3px;
    font-size: 0.6rem;
  }
  .bank-grid.c-major-strip .bank-note .note-label {
    font-size: 0.6rem;
  }

  /* Flat layout dock on tiny phones */
  #gameScreen {
    --dock-height: clamp(85px, 13vh, 105px);
    --dock-bg-height: clamp(60px, 9vh, 72px);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --tile-size: clamp(48px, 11vh, 62px);
    --bank-note-size: clamp(52px, 15vh, 68px);
    --dock-height: clamp(132px, 34vh, 166px);
    --dock-bg-height: 52px;
  }

  .screen {
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  .score-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 6px 0 4px;
  }

  .score-chip,
  .score-skip-btn {
    padding: 4px;
  }

  .chip-label {
    font-size: 0.56rem;
  }

  .chip-value {
    font-size: 0.88rem;
  }

  .outcome-track {
    margin-bottom: 4px;
    padding-bottom: 4px;
  }

  .outcome-track-head {
    margin-bottom: 4px;
  }

  .message {
    min-height: 22px;
    margin: 2px 0 4px;
    font-size: 0.84rem;
  }

  .question-wrap {
    max-width: 360px;
    margin: 0 auto;
    padding: 38px 0 18px;
  }

  .question-grid.melody-stack {
    width: min(100%, 320px);
    height: 112px;
  }

  .question-grid.slots-3 {
    --tile-size: 72px;
    --gap: 6px;
  }

  .question-grid.slots-4 {
    --tile-size: 58px;
    --gap: 5px;
  }

  .question-grid.slots-5 {
    --tile-size: 48px;
    --gap: 4px;
  }

  .play-center {
    top: 0;
    right: 0;
  }

  .play-center.sequence-active {
    transform: translateY(6px);
  }

  .toolbar {
    grid-template-columns: auto;
    justify-content: end;
  }

  .transport-btn {
    min-height: 36px;
    padding: 6px 10px;
    gap: 6px;
    font-size: 0.84rem;
    border-width: 2px;
  }
}

/* ════════════════════════════════════════════
   Daily Challenge
   ════════════════════════════════════════════ */

.daily-streak-bar {
  min-height: 24px;
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 900;
  color: #e07b00;
  text-align: center;
  letter-spacing: 0.01em;
}

.intro-daily-btn {
  min-height: 52px;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 900;
  background: var(--p-gold);           /* #FFD25B — Prodigies D#/Eb bell */
  color: var(--p-brown);               /* #512D1C — dark shade for contrast */
  border: 2.5px solid #c9a000;         /* deeper gold shade */
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 2px 0 #a07800;
}

.intro-daily-btn:hover {
  background: #ffe07a;                 /* lighter gold tint */
}

.intro-daily-btn:active {
  transform: scale(0.97);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 0 #a07800;
}

.intro-daily-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.daily-result-overlay {
  z-index: var(--z-daily);
}

.daily-result-card {
  max-width: 380px;
}

.daily-streak-burst {
  font-size: 1.5rem;
  font-weight: 900;
  text-align: center;
  margin: 10px 0 14px;
  min-height: 44px;
  line-height: 1.4;
  color: var(--ink);
}

.daily-song-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #007a7a;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

/* ════════════════════════════════════════════
   Set Complete Card
   ════════════════════════════════════════════ */

.set-complete-overlay {
  z-index: var(--z-set);
}

.set-complete-card {
  max-width: 380px;
}

.set-complete-stars {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 12px;
}

.set-star {
  font-size: 2.8rem;
  line-height: 1;
  color: #dde5f5;
  display: inline-block;
}

.set-star.earned {
  color: #f2c94c;
  text-shadow: 0 2px 14px rgba(242, 201, 76, 0.55);
  animation: starPop 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.3) both;
}

@keyframes starPop {
  0%   { transform: scale(0.3) rotate(-20deg); opacity: 0; }
  65%  { transform: scale(1.25) rotate(5deg);  opacity: 1; }
  100% { transform: scale(1)    rotate(0deg);  opacity: 1; }
}

.set-complete-rewards {
  margin-bottom: 16px;
}

.set-complete-next-label {
  font-size: 0.82rem;
  line-height: 1.3;
}

/* ════════════════════════════════════════════
   Contour Direction Hints
   ════════════════════════════════════════════ */

.contour-hint-arrow {
  display: block;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  animation: hintFadeIn 0.3s ease both;
}

@keyframes hintFadeIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* Step intervals — narrow movement, familiar territory */
.hint-step-up   { color: var(--p-teal); }    /* Teal  (G)  — up a step   */
.hint-step-down { color: var(--p-blue); }    /* Blue  (G#) — down a step */

/* Skip intervals — third/fourth */
.hint-skip-up   { color: var(--p-orange); }  /* Orange (D) — skip up    */
.hint-skip-down { color: var(--p-purple); }  /* Purple (A) — skip down  */

/* Leap intervals — fifth, octave, and beyond */
.hint-leap-up   { color: var(--p-red);    font-size: 0.85rem; }  /* Red — large leap up   */
.hint-leap-down { color: var(--p-pink);   font-size: 0.85rem; }  /* Pink — large leap down */

/* Unison */
.hint-same      { color: #6b7a99; font-size: 0.9rem; }

/* ── Score pop float animation ─────────────────────────────── */
.score-row-wrap {
  position: relative;
}

.score-pop {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--p-teal);
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-float);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.score-pop.is-popping {
  animation: score-float 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.score-pop.is-bonus {
  color: var(--p-gold);
  font-size: 1.35rem;
  text-shadow: 0 1px 8px rgba(255, 210, 91, 0.6);
}

@keyframes score-float {
  0%   { opacity: 0;   transform: translateX(-50%) translateY(0)    scale(0.8); }
  18%  { opacity: 1;   transform: translateX(-50%) translateY(4px)   scale(1.22); }
  65%  { opacity: 0.9; transform: translateX(-50%) translateY(14px)  scale(1); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(28px)  scale(0.9); }
}

/* ── Score fly-to-HUD: earned points arc from the burst zone up to the Score chip ── */
.score-fly {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--p-teal);
  letter-spacing: -0.02em;
  text-shadow: 0 2px 10px rgba(0, 153, 153, 0.4);
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-fly);
  white-space: nowrap;
}

.score-fly.is-flying {
  animation: score-fly-to-hud 0.82s cubic-bezier(0.5, 0, 0.2, 1) forwards;
}

@keyframes score-fly-to-hud {
  0%   { opacity: 0; transform: translate(-50%, -50%) translate(0, 0) scale(0.7); }
  16%  { opacity: 1; transform: translate(-50%, -50%) translate(calc(var(--fly-dx, 0px) * 0.06), -20px) scale(1.28); }
  78%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--fly-dx, 0px), var(--fly-dy, -120px)) scale(0.62); }
}

/* Chip reacts as the number lands */
.hud-value.score-bump {
  animation: score-chip-bump 0.34s var(--ease-snap);
}

@keyframes score-chip-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.24); color: var(--p-teal); }
  100% { transform: scale(1); }
}

/* ── Level transition overlay ──────────────────────────────── */
.level-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-top);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 35, 61, 0.88);
  opacity: 0;
  transition: opacity 0.4s var(--ease-ui);
  pointer-events: none;
}

.level-transition-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.level-transition-card {
  text-align: center;
  animation: none;
}

.level-transition-overlay.is-visible .level-transition-card {
  animation: level-zoom-in 0.55s var(--ease-snap) both;
}

.level-transition-label {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.level-transition-num {
  font-size: 7rem;
  font-weight: 900;
  color: #fff;
  margin: 0;
  line-height: 1;
  text-shadow: 0 0 50px var(--p-teal), 0 0 20px var(--p-teal);
}

.level-transition-concept {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.08em;
  margin: 10px 0 0;
  text-transform: uppercase;
  min-height: 1.4em;
}

@keyframes level-zoom-in {
  0%   { opacity: 0; transform: scale(0.45); }
  100% { opacity: 1; transform: scale(1); }
}

/* ── Bell color accents on score chips ─────────────────────── */
.score-total-chip .chip-value { color: var(--p-teal); }
.round-chip .chip-value       { color: var(--p-purple); }
.tries-chip .chip-value       { color: var(--p-orange); }
.last-chip .chip-value        { color: var(--p-green); }

.outcome-track-fill {
  background: linear-gradient(90deg, var(--p-teal), var(--p-green));
}

.reward-pill { border-color: rgba(0, 153, 153, 0.2); }
.reward-pill .reward-value { color: var(--p-teal); }
.reward-pill .reward-label { color: var(--p-purple); }

/* ── Intro title bell decoration ───────────────────────────── */
.intro-card {
  position: relative; /* anchor for intro-bell-deco */
}

.intro-title-wrap {
  text-align: center;
}

.intro-bell-deco {
  position: absolute;
  width: 64px;
  height: auto;
  /* Centered, floating above the top of the card */
  left: 50%;
  top: -40px;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.22));
  /* Pivot from the hanging point at the top — like a real bell on a chain */
  transform-origin: 50% 0%;
  animation: bell-idle-sway 4.4s ease-in-out infinite;
  animation-delay: 0.6s;
  will-change: transform; /* layer-promote so the static drop-shadow isn't re-rasterized each sway frame */
}

/* On click: swap to dramatic ring animation */
.intro-bell-deco.is-ringing {
  animation: bell-ring 0.9s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

/* Gentle pendulum sway — pivots from top, organic decay */
@keyframes bell-idle-sway {
  0%    { transform: translateX(-50%) rotate(0deg); }
  10%   { transform: translateX(-50%) rotate(-9deg); }
  26%   { transform: translateX(-50%) rotate(7deg); }
  40%   { transform: translateX(-50%) rotate(-4deg); }
  51%   { transform: translateX(-50%) rotate(2.5deg); }
  60%   { transform: translateX(-50%) rotate(-1deg); }
  67%   { transform: translateX(-50%) rotate(0deg); }
  100%  { transform: translateX(-50%) rotate(0deg); }
}

/* On-click ring — big initial swing, natural settle */
@keyframes bell-ring {
  0%    { transform: translateX(-50%) rotate(0deg); }
  8%    { transform: translateX(-50%) rotate(-26deg); }
  22%   { transform: translateX(-50%) rotate(20deg); }
  34%   { transform: translateX(-50%) rotate(-12deg); }
  44%   { transform: translateX(-50%) rotate(7deg); }
  54%   { transform: translateX(-50%) rotate(-3.5deg); }
  63%   { transform: translateX(-50%) rotate(1.5deg); }
  73%   { transform: translateX(-50%) rotate(-0.5deg); }
  100%  { transform: translateX(-50%) rotate(0deg); }
}

/* ── Bell trio: standing atop the card ───────────────────────── */
.intro-bell-trio {
  position: absolute;
  bottom: calc(100% - 22px); /* feet sit at card's top edge, ~22px overlap */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;     /* share the same foot-baseline */
  gap: 0;                    /* negative margins handle overlap below */
  pointer-events: none;
  z-index: 2;
}

/* Extra top padding so card content clears the trio */
.intro-card:has(.intro-bell-trio) {
  padding-top: 52px;
}

/* Base trio bell styles */
.intro-bell-trio .intro-bell-deco {
  position: relative;
  top: auto;
  left: auto;
  width: 52px;
  transform-origin: 50% 90%; /* pivot near feet — teeter-totter */
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

/* C overlaps E and sits in front */
.intro-bell-c {
  margin-right: -10px;
  z-index: 2;
  animation: bell-sway-c 3.8s cubic-bezier(0.37, 0, 0.63, 1) infinite;
  animation-delay: 0s;
}

/* E sits behind C and G */
.intro-bell-e {
  z-index: 1;
  animation: bell-sway-e 3.8s cubic-bezier(0.37, 0, 0.63, 1) infinite;
  animation-delay: -1.4s;
}

/* G overlaps E and sits in front */
.intro-bell-g {
  margin-left: -10px;
  z-index: 2;
  animation: bell-sway-g 3.8s cubic-bezier(0.37, 0, 0.63, 1) infinite;
  animation-delay: -2.7s;
}

/* Ring overrides — fire immediately, no phase delay.
   Keep transform-origin: 50% 90% (feet pivot) so the bell returns
   seamlessly to idle sway with no pivot-point snap. */
.intro-bell-trio .intro-bell-deco.is-ringing {
  animation: bell-trio-ring 0.85s ease-out forwards !important;
  animation-delay: 0s !important;
}

/* ── Sway: smooth bezier pendulum, each bell biased toward center ── */

/* C (left): rests leaning right, swings left then back */
@keyframes bell-sway-c {
  0%   { transform: rotate(3deg); }
  50%  { transform: rotate(-4deg); }
  100% { transform: rotate(3deg); }
}

/* E (center): symmetric gentle sway */
@keyframes bell-sway-e {
  0%   { transform: rotate(-3deg); }
  50%  { transform: rotate(3deg); }
  100% { transform: rotate(-3deg); }
}

/* G (right): rests leaning left, swings right then back */
@keyframes bell-sway-g {
  0%   { transform: rotate(-3deg); }
  50%  { transform: rotate(4deg); }
  100% { transform: rotate(-3deg); }
}

/* ── Ring: straight vertical leap with tiny lean (≤3°) so feet-pivot
         stays subtle. Full flutter wiggle at apex, clean descent,
         ends at rotate(0deg) so sway resumes without snapping. ── */
@keyframes bell-trio-ring {
  0%   { transform: translateY(0px)   rotate(0deg); }
  10%  { transform: translateY(-6px)  rotate(2deg); }    /* push-off lean */
  30%  { transform: translateY(-18px) rotate(3deg); }    /* rising, lean builds */
  42%  { transform: translateY(-22px) rotate(3deg); }    /* apex */
  52%  { transform: translateY(-22px) rotate(-2deg); }   /* apex wiggle left */
  60%  { transform: translateY(-19px) rotate(2deg); }    /* apex wiggle right */
  70%  { transform: translateY(-10px) rotate(-1deg); }   /* descending */
  82%  { transform: translateY(-2px)  rotate(0.5deg); }  /* landing */
  90%  { transform: translateY(1px)   rotate(0deg); }    /* land bounce */
  100% { transform: translateY(0px)   rotate(0deg); }    /* settled → sway resumes */
}

/* ── Listen button: circle sitting in the arch hollow ───────────────────────────────── */
/* Absolutely positioned, centered horizontally, bottom flush with C/c bell bottoms,    */
/* top flush with E/A bell bottoms (78px = 2 × 39px arch step = circle diameter).       */
.bank-dock .toolbar.arch-listen {
  position: absolute;
  /* Lifted clear of the arch: as a disc sitting on the C/c baseline it read as
     one more bell. It belongs with the cards it plays, not with the row it
     stands in front of. (Rob, 2026-08-27.) The desktop/iPad offset lives in
     the min-width:900px block below — that is the one that governs there. */
  bottom: calc(104px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  /* Phone: ABOVE the arch, not inside it (Rob, iPhone: "play button is in a
     weird place -- right in the middle of the bells"). Measured, it was landing
     on the F and G bells at the peak.

     Anchored to the dock's TOP edge rather than given a bottom offset, because
     the bells are lifted out of their layout boxes by the arch `translate`
     rules — the dock's own top sits only 9px above the visual top of the arch,
     so nothing inside it can clear the bells, and flow layout cannot see them
     at all. Going up from that edge lands in the empty tail of the question
     area, which is 294px tall with its cards ending well above the bottom.
     Measured clearance: 19px over the bells, 22px under the cards. */
  width: auto;
  height: auto;
  z-index: var(--z-hud);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  grid-template-columns: unset;
}

.bank-dock .toolbar.arch-listen .transport-btn {
  /* A solid green button with white type, like Major or Minor's Listen —
     the outlined white disc was quiet next to the bells it stood among. */
  width: auto;
  height: auto;
  min-height: 56px;
  border: none;
  border-radius: 16px;
  padding: 15px 30px;
  display: flex;
  flex-direction: row;         /* triangle beside the word, not stacked */
  align-items: center;
  justify-content: center;
  gap: 11px;
  font-size: 1.06rem;
  color: #fff;
  background: var(--green);
  box-shadow: 0 4px 0 #4e9636, 0 6px 16px rgba(26, 35, 61, 0.18);
  transition: transform 0.14s var(--ease-ui), box-shadow 0.14s var(--ease-ui);
  /* Wide enough to read as the thing you press first, like What Note Is It's
     (Rob: "fix melody memory button to match"). The colours already matched;
     what did not was presence — that one is a broad bar, this was a 101px pill
     tucked among the bells. */
  min-width: 190px;
}

@media (max-width: 899px) {
  .bank-dock .toolbar.arch-listen {
    top: -76px;
    bottom: auto;
  }
}

.bank-dock .toolbar.arch-listen .play-triangle {
  border-width: 9px 0 9px 15px;
  border-left-color: #fff;     /* white on the green fill */
  margin-left: 0;
}

.bank-dock .toolbar.arch-listen .transport-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #4e9636, 0 8px 18px rgba(26, 35, 61, 0.2);
}

.bank-dock .toolbar.arch-listen .transport-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #4e9636, 0 3px 10px rgba(26, 35, 61, 0.18);
}

/* ── Desktop melody-stack height override (must come after base rule at line ~1340) ─── */
/* Base .question-grid.melody-stack { height: 246px } wins over the early desktop query
   due to source order. This late rule restores the correct desktop height.
   210px = max card-top needed: slots-3 pitchLift(72)+riseStep(4)+tile(124) = 200px.    */

/* ── Portrait phone: compress arch so melody cards have room ──────────────────────────
   Problem: iOS Safari reports ~797px for CSS media query (max-height) even when the
   visual viewport is only ~664px (address bar visible). A height-based query at 780px
   never fires on iPhone 14, so the 220px arch padding-top stays, leaving only ~17px
   for .question-wrap — cards overflow into unpredictable positions.

   Solution: target by WIDTH (max-width: 480px) which fires reliably on all portrait
   phones (iPhone ≤428px, Android ≤480px) with no iOS viewport-height ambiguity.

   On desktop the window is always wider than 480px so this never fires there.

   Compressed arch (step 26px instead of 47px):
     • max translation: 78px (was 141px)
     • padding-top: 150px (78 arch + 68 bell overflow + 4 breathing — was 220px)

   Math check at iPhone 14 (390px, 100dvh≈664px with address bar, safe-area-inset-bottom≈34px):
     gameScreen content = 664 - (20+47 safe-top) = 597px
     top-ui 84 + hud-panel ~132 + burst 40 = 256px fixed above
     bank dock = 146 padding-top + 44 stage + 60 safe-bottom = 250px
     question-wrap = 597 - 256 - 250 = 91px (larger on no-safe-area devices ~180-200px)
     question-grid: 180px; centered in wrap — overflows ~45px above+below on safe-area devices ✓
     lowest card (bottom:0, tile 96px): top at 96px ≤ 180px grid ✓
     highest card (pitchLift 62, tile 96px): top at 158px ≤ 180px grid (22px headroom) ✓
──────────────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Compressed arch staircase — step 32px instead of 47px (desktop).
     Note: --bank-note-size does NOT affect c-major arch bells (they use flex:1 width
     and a fixed .bell-composite). The arch scale is controlled by .bell-composite below. */
  .bank-grid.c-major-strip .bank-note:nth-child(2) { translate: 0 -35px; }
  .bank-grid.c-major-strip .bank-note:nth-child(3) { translate: 0 -70px; }
  .bank-grid.c-major-strip .bank-note:nth-child(4) { translate: 0 -105px; }
  .bank-grid.c-major-strip .bank-note:nth-child(6) { translate: 0 -105px; }
  .bank-grid.c-major-strip .bank-note:nth-child(7) { translate: 0 -70px; }
  .bank-grid.c-major-strip .bank-note:nth-child(8) { translate: 0 -35px; }

  /* Bigger, more legible bells (accessibility): composite 68×108. Arch step 35px keeps
     spacing comfortable; with the 22px center spacer, F and G stay just clear of each
     other at this size. Bell overflow above the 44px stage: 108-44 = 64px. */
  .bank-grid.c-major-strip .bank-note .bell-composite {
    width: 68px;
    height: 108px;
  }

  #gameScreen .bank-dock {
    padding-top: 174px; /* 105px arch + 64px bell overflow + 5px breathing */
  }

  /* Center cards in the available space between HUD and bells — avoids a top-heavy
     gap when question-wrap is large (devices without safe-area-inset-bottom). */
  .question-wrap {
    justify-content: center;
  }

  /* Melody cards: taller grid + larger tiles so the fanned deck fills more of its area.
     JS getMelodyStackMetrics uses "short" positions when innerHeight ≤ 700px, so the
     tallest card auto-shrinks on address-bar-visible Safari. On the full-height app
     (~812px) the tallest 3-card (pitchLift 74 + tile 122 = 196px) fits the 204px grid. */
  .question-grid.melody-stack { height: 204px; min-height: 204px; }
  .question-grid.slots-2 { --tile-size: clamp(104px, 33vw, 132px); --gap: 8px; }
  .question-grid.slots-3 { --tile-size: clamp(96px, 30vw, 122px);  --gap: 8px; }
  .question-grid.slots-4 { --tile-size: clamp(80px, 25vw, 100px);  --gap: 7px; }
  .question-grid.slots-5 { --tile-size: clamp(64px, 19vw, 80px);   --gap: 6px; }
}

/* ════════════════════════════════════════════
   Reduced motion — accessibility (special learners)
   Collapses all animations to opacity-only crossfades.
   ════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  /* Preserve opacity-only fades so overlays still appear/disappear gracefully */
  .boot-loader,
  .intro-overlay,
  .end-overlay,
  .quit-confirm-overlay,
  .level-transition-overlay,
  .bonus-burst,
  .score-pop {
    transition: opacity 150ms linear !important;
    animation: none !important;
  }

  /* Keep bells usable — just no animation */
  .bank-note {
    transform: none !important;
    animation: none !important;
  }

  /* Melody cards — no rotation/scale entrance animation */
  .question-tile {
    animation: none !important;
    transform: none !important;
  }
}

/* The bar is out of flow now, so the app has to be pushed down and shortened
   by exactly its height or the dock falls off the bottom. */
.app {
  margin-top: 44px;
  height: calc(100dvh - 44px);
}
@media (min-width: 1024px) {
  .app {
    /* 760px on a 1366pt iPad is a narrow column in a sea of background — it
       reads as a scaled-up phone app rather than an iPad one. */
    max-width: 1040px;
    height: auto;
    min-height: min(880px, calc(100vh - 44px));
  }
}

/* ─────────────────────────────────────────────────────────────────────────
   DESKTOP BELL BAR
   The arch exists so eight bells fit across a narrow phone: each steps up 47px
   so the row reads as a staircase rather than a squeeze. With desktop width
   there is no squeeze to solve, and the arch actively costs — its peak needs
   226px of dock padding. Above 900px the bells lie flat and spread wide, the
   way the Compose Tool draws its bell bar.

   NOTE the :nth-child(n) below. The arch is set by
   `.bank-grid.c-major-strip .bank-note:nth-child(N)` — three class-level
   selectors. A plain `.bank-grid.c-major-strip .bank-note` loses on
   specificity even inside a media query, so this matches it exactly and wins
   on order instead. That is also why it overrides `translate` rather than
   `transform`: the arch used `translate`, leaving `transform` free for the
   press animations, and this keeps that split intact.
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 899px) {
  /* Narrower pill on a phone: the arch leaves it far less room than the flat
     desktop row does. */
  .bank-dock .toolbar.arch-listen .transport-btn {
    min-height: 48px;
    padding: 12px 18px;
    font-size: 0.9rem;
    gap: 8px;
  }
}

@media (min-width: 900px) {
  .bank-grid.c-major-strip {
    width: min(100%, 780px);
    align-items: flex-end;
    gap: 4px;
  }
  .bank-grid.c-major-strip .bank-note:nth-child(n) { translate: 0 0; z-index: 2; }
  .bank-grid.c-major-strip .bank-note:hover,
  .bank-grid.c-major-strip .bank-note:focus-visible { z-index: 9; }

  /* The spacer framed the arch peak; flat, it only needs to not exist. */
  .arch-listen-spacer { flex: 0 0 0; width: 0; }

  /* No peak to clear. */
  #gameScreen .bank-dock { padding-top: 104px; }

  /* Listen sat in the arch hollow. Flat there is no hollow — and 132px off the
     floor still read as part of the bell row. Anchored to the dock's TOP edge
     instead, so it belongs to the cards it plays; a px offset drifts back into
     the bells as the taller cards squeeze the dock. (Rob, 2026-08-27.) */
  .bank-dock .toolbar.arch-listen {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: calc(100% + 16px);
  }

  /* Listen hangs above the dock and over the card area, so the deck has to stop
     short of it — otherwise the wrap centres a tall five-card fan straight
     through the button. 88px = the button (56) + its gap (16) + breathing (16). */
  #gameScreen .question-wrap {
    padding-bottom: 88px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FULL-WIDTH, SEAMLESS, BIGGER BELLS — 2026-08-18 (Rob)

   Two complaints, one cause. The layout still carried its phone-simulator
   heritage: a 1040px "device card" with a 28px radius and a drop shadow,
   floating on a darker page. On a phone that card IS the screen and the styling
   is invisible; on an iPad it reads as a pill sitting on a separate background,
   and it costs the bells the width they need.

   So the card stops being a card above 900px: full width, no radius, no
   shadow, and the page behind it painted the same colour so there is no edge
   left to see. The bells then get the width back — a wider strip, a tighter
   gap, and a larger composite.

   Everything is inside `@media (min-width: 900px)` on purpose: the phone
   layout below that width is correct as it stands and must not move.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 900px) {
  /* Seamless. The shadow and radius are what made it a pill; max-width is what
     made it a column. `background: transparent` was already set on the base
     rule, so the page colour simply shows through. */
  .app {
    max-width: none;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    min-height: calc(100dvh - 44px);
    /* A DEFINITE height, not just a floor. #gameScreen is height:100% over a
       flex column, and a percentage against a min-height-only parent resolves
       to auto — so on any window shorter than the content the dock walked off
       the bottom of the screen and the top-ui walked up under the coin purse,
       with overflow:hidden leaving no way to scroll to either (Rob,
       2026-08-27). With a real height the column shrinks as designed. */
    height: calc(100dvh - 44px);
  }

  /* The grey gutter either side of the old card had nothing to do once the
     card went full width. */
  body { background: var(--bg1); }

  /* ── Bigger bells, tighter row ──────────────────────────────────────────
     Was min(100%, 780px) with a 4px gap and a 102px composite: eight bells in
     the middle of a 1366pt screen with air between them. The row now takes the
     width it is given (capped so bells stay bell-sized rather than becoming
     posters), the gap closes to 2px, and the composite grows.

     `.bank-grid.c-major-strip` is three class-level selectors deep, so this
     matches that specificity exactly and wins on order — the same reason the
     900px block above it explains for the arch. */
  .bank-grid.c-major-strip {
    width: min(100%, 1120px);
    gap: 2px;
  }

  /* 74% of the note box in the base rule left the bells small and floating.
     A fixed size is what the row wants, and 128 wide keeps the drawn aspect. */
  .bank-grid.c-major-strip .bank-note .bell-composite {
    width: 128px;
    height: 128px;
    margin-top: -10px;
  }

  /* The dock reserved room for the arch peak plus bell overflow. Flat bells
     that are now 128 tall over a 44px stage need 84px of overflow cleared. */
  #gameScreen .bank-dock { padding-top: 128px; }
}

/* ── Short windows: shrink, don't amputate ───────────────────────────────
   A laptop window is wide but often only 560–760px tall, and the fixed budget
   — title, HUD, a 128px bell over its stage, the Listen band, the card fan —
   does not fit in that. Everything below scales off the height that exists so
   the instrument always lands on screen; the floors keep it playable rather
   than pretty at the extreme. */
@media (min-width: 900px) and (max-height: 880px) {
  .question-grid.slots-2 { --tile-size: clamp(120px, 22vh, 200px); }
  .question-grid.slots-3 { --tile-size: clamp(110px, 21vh, 190px); }
  .question-grid.slots-4 { --tile-size: clamp(96px, 19vh, 170px); }
  .question-grid.slots-5 { --tile-size: clamp(84px, 17vh, 150px); }

  .bank-grid.c-major-strip .bank-note .bell-composite {
    width: clamp(74px, 13vh, 128px);
    height: clamp(74px, 13vh, 128px);
    margin-top: -8px;
  }

  #gameScreen { --dock-height: clamp(150px, 25vh, 252px); }
  #gameScreen .bank-dock { padding-top: clamp(74px, 13vh, 128px); }
  #gameScreen .question-wrap { padding-bottom: clamp(56px, 9vh, 88px); }

  /* The duel's instruments get the same treatment. */
  .mm-duel .bank-note .bell-composite { width: clamp(40px, min(calc((50vw - 44px) / 8), 11vh), 96px); }
  .mm-duel-bank { padding-top: clamp(58px, 11vh, 92px); }
}

/* ─── Level 1 coach marks ───────────────────────────────────────────────────
   The first-run walkthrough. Deliberately NOT a modal: the root is
   pointer-events:none and the dimming is a box-shadow spread from the
   spotlight, so there is no sheet in front of the game and every tap still
   lands on the bell or button underneath. Only the "Got it" chip takes
   pointer events. */
.mm-coach {
  position: fixed;
  inset: 0;
  z-index: 240;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.mm-coach.is-visible { opacity: 1; }

/* Positioned by transform, NOT by left/top, and with no transition on its
   geometry — positionTutorial() interpolates the glide in JS instead (the
   maths is shared with What Interval Is It? in www/js/coach-glide.js).

   There used to be `transition: left/top/width/height 260ms`, and it fought the
   rAF loop that repositions this ring every frame: each frame wrote new
   geometry, starting a brand-new 260ms transition toward a target that was
   already one frame stale, so the ring never arrived and every frame paid
   layout on four animated properties.

   left/top must be pinned to 0 because the element is position:fixed with no
   offsets of its own; without them it would fall back to its static position. */
.mm-coach-spot {
  position: fixed;
  left: 0;
  top: 0;
  border-radius: 22px;
  /* The spread IS the dim: everything outside this rect darkens, and because it
     is a shadow rather than an element it cannot intercept a tap. */
  box-shadow: 0 0 0 9999px rgba(23, 32, 56, 0.44);
  outline: 3px solid #ffd25b;
  outline-offset: 2px;
}

/* Same treatment as the spot: transform, pinned left/top, glide driven from JS.
   The bubble rides along with the ring so the two move as one object. */
.mm-coach-tip {
  position: fixed;
  left: 0;
  top: 0;
  width: min(280px, calc(100vw - 24px));
  background: #ffffff;
  border-radius: 18px;
  padding: 14px 16px 12px;
  box-shadow: 0 14px 34px rgba(23, 32, 56, 0.3);
  text-align: center;
}

.mm-coach-text {
  margin: 0 0 10px;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.34;
  color: #1f2a44;
}

.mm-coach-text b { color: var(--p-teal, #009999); }

.mm-coach-skip {
  pointer-events: auto;      /* the one thing in here that is tappable */
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff;
  background: var(--p-teal, #009999);
  border-radius: 999px;
  padding: 9px 20px;
  min-height: 40px;
}

/* Only the fade is a CSS transition now. The spot and tip glide from JS, so
   their reduced-motion handling lives there (tutorialReducedMotion()) — a rule
   here could not have stopped it. */
@media (prefers-reduced-motion: reduce) {
  .mm-coach { transition: none; }
}

/* ── level select: 28 journey sets as a star grid (flappy/pipes pattern) ──
   Numbers + stars only on the chips — a non-reader picks by number and
   sparkle. The concept name rides in the aria-label for everyone else. */
.mm-level-card { width: min(560px, 94vw); }
.mm-level-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 10px 0 14px;
}
@media (max-width: 560px) { .mm-level-grid { grid-template-columns: repeat(4, 1fr); } }
.mm-level {
  appearance: none; border: 0; cursor: pointer; font-family: inherit;
  background: #eef3fc;
  border-radius: 14px;
  padding: 8px 2px 6px;
  display: grid; justify-items: center; gap: 1px;
  min-height: 56px;
  transition: transform 140ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mm-level:active { transform: scale(0.94); }
.mm-level b { font-size: 18px; font-weight: 900; color: #1f2a44; line-height: 1.1; }
.mm-level .mm-level-stars { font-size: 10px; letter-spacing: 1px; line-height: 1; }
.mm-level .mm-level-stars .off { opacity: 0.22; }
.mm-level.is-locked { pointer-events: none; background: #f5f7fb; }
.mm-level.is-locked b { color: #c2cbdc; }
.mm-level.is-locked .mm-level-stars { visibility: hidden; }
.mm-level.is-current { outline: 3px solid #099695; outline-offset: -3px; }

/* card swap for the level grid — same mechanism as .show-settings */
.intro-overlay.show-levels .intro-card {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
}
.intro-overlay.show-levels .mm-level-card {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TWO-PLAYER DUEL — 2026-08-27 (Rob)

   Two children, one iPad, one melody: both hear it, each gets half the table.
   The row deliberately does NOT carry `bank-grid` or `c-major-strip`, because
   those styles switch on VIEWPORT width — a half-width column would inherit
   the full-screen row's sizing and the phone arch's fixed translate steps, and
   fight both. Everything here is scoped to .mm-duel and sized off the half it
   actually lives in.
   ═══════════════════════════════════════════════════════════════════════════ */
/* Fills .app the way the overlays do. `height: 100%` collapses here — .app
   carries a min-height, not a height, so the percentage resolves to auto and
   the whole arena bunches up at the top. Absolute-inset needs no dvh maths and
   works for both the phone card and the full-width iPad layout. */
#duelScreen.mm-duel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: auto;
  overflow: hidden;
  padding: calc(6px + env(safe-area-inset-top)) 0 0;
  /* Each child owns a HALF of the table, floor to ceiling — the tint is on the
     screen rather than on the bell strip so the ownership reads even where
     there is nothing but air. */
  background:
    linear-gradient(to right,
      rgba(0, 153, 153, 0.05) 0 50%,
      rgba(243, 148, 34, 0.05) 50% 100%),
    var(--bg1);
  z-index: 5;
}

/* The dividing line runs the full height for the same reason. */
#duelScreen.mm-duel::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  border-left: 2px dashed rgba(27, 35, 62, 0.12);
  pointer-events: none;
}

.mm-duel-top {
  flex: 1;                 /* soaks up the space above the bells */
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  padding: 0 14px;
}

/* Stars stay at the top corners; the shared question sits in the middle of the
   room it has, which is where two children looking up will find it. */
.mm-duel-center {
  align-self: center;
}

.mm-duel-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mm-duel-prompt {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--ink-muted);
  text-align: center;
}

.mm-duel-cards { display: flex; gap: 8px; }

.mm-duel-card {
  width: clamp(52px, 8vh, 74px);
  height: clamp(52px, 8vh, 74px);
  border-radius: 14px;
  border: 2px solid #e3ebfc;
  background: #ffffff;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 900;
  color: #4a5b86;
  transition: transform 0.2s var(--ease-ui), background 0.2s var(--ease-ui);
}

/* Face-down through the race on purpose: a shared card row that flips as the
   leader advances would let the trailing child read the answer off their
   sibling's progress instead of using their ears. */
.mm-duel-card.is-ringing { transform: translateY(-4px) scale(1.06); }
.mm-duel-card.is-revealed {
  background: var(--card-color, #8fa3d8);
  border-color: var(--card-color, #8fa3d8);
  color: #ffffff;
}

.mm-duel-listen {
  min-height: 42px;
  padding: 9px 20px;
  border: none;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.92rem;
  font-weight: 900;
  color: #fff;
  background: var(--green);
  box-shadow: 0 3px 0 #4e9636;
}
.mm-duel-listen:disabled { opacity: 0.5; }
.mm-duel-listen .play-triangle { border-left-color: #fff; }

/* Win stars: one per round needed, filling toward the middle of the table. */
.mm-duel-stars { display: flex; gap: 5px; }
#duelStarsP2 { justify-content: flex-end; }

.mm-duel-star {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(27, 35, 62, 0.12);
  transition: background 0.2s var(--ease-ui), transform 0.2s var(--ease-ui);
}
#duelStarsP1 .mm-duel-star.is-on { background: var(--p-teal); transform: scale(1.15); }
#duelStarsP2 .mm-duel-star.is-on { background: var(--p-orange, #f39422); transform: scale(1.15); }

/* ── The table ── */
.mm-duel-arena {
  flex: none;              /* the instruments hug the floor */
  display: flex;
  align-items: flex-end;
}

.mm-duel-side {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 8px calc(26px + env(safe-area-inset-bottom));
}
.mm-duel-divider { flex: none; width: 0; }

.mm-duel-pips {
  display: flex;
  justify-content: center;
  gap: 7px;
  min-height: 14px;
}
.mm-duel-pip {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(27, 35, 62, 0.13);
  transition: background 0.16s var(--ease-ui), transform 0.16s var(--ease-ui);
}
.mm-duel-side[data-player="1"] .mm-duel-pip.is-on { background: var(--p-teal); transform: scale(1.2); }
.mm-duel-side[data-player="2"] .mm-duel-pip.is-on { background: var(--p-orange, #f39422); transform: scale(1.2); }
.mm-duel-pips.is-reset { animation: mmDuelShake 380ms ease; }

@keyframes mmDuelShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ── The bells ── */
.mm-duel-bank {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  /* room for the body standing above its stage card */
  padding-top: 92px;
}

/* Re-zero the base .bank-note card styling, the same way the solo strip does. */
.mm-duel .bank-note {
  flex: 1 0 0;
  min-width: 0;
  width: auto;
  height: 44px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  position: relative;
  overflow: visible;
}

/* The whole drawn bell is pressable — the lesson from solo tap testing, and it
   matters twice as much with two excited children aiming at half a screen. */
.mm-duel .bank-note::before {
  content: "";
  position: absolute;
  inset: -66px 0 0 0;
  background: transparent;
}

.mm-duel .bank-note .bell-composite {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  /* Eight bells into half the window, capped so they stay bell-sized. */
  width: clamp(44px, calc((50vw - 44px) / 8), 96px);
  aspect-ratio: 74 / 118;
  height: auto;
  margin: 0;
  pointer-events: none;
}

.mm-duel .bank-note .note-art-stage {
  position: absolute;
  inset: auto;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 37%;
  object-fit: fill;
  filter: drop-shadow(0 3px 3px rgba(26, 35, 61, 0.16));
}

.mm-duel .bank-note .note-art-bell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 5px 4px rgba(26, 35, 61, 0.22));
}

.mm-duel .bank-note .note-label {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  bottom: auto;
  font-size: 0.66rem;
  line-height: 1;
  white-space: nowrap;
}

/* ── The banner (Ready / GO / who took the round) ── */
.mm-duel-banner {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 40;
  padding: 12px 30px;
  border-radius: 18px;
  background: rgba(23, 32, 56, 0.9);
  color: #fff;
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 900;
  pointer-events: none;
}
.mm-duel-banner.is-pop { animation: mmDuelPop 320ms var(--ease-ui); }

@keyframes mmDuelPop {
  0% { transform: translate(-50%, -50%) scale(0.7); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* The winning half lights up for the round-win beat. */
#duelScreen.mm-duel.won-p1 {
  background: linear-gradient(to right, rgba(0, 153, 153, 0.16) 0 50%, rgba(243, 148, 34, 0.05) 50% 100%), var(--bg1);
}
#duelScreen.mm-duel.won-p2 {
  background: linear-gradient(to right, rgba(0, 153, 153, 0.05) 0 50%, rgba(243, 148, 34, 0.16) 50% 100%), var(--bg1);
}

.mm-duel-hint {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink-muted);
  text-align: center;
}
.mm-duel-bands { margin-bottom: 16px; }

/* ── Portrait: stack the halves rather than squeeze eight bells into 47vw ── */
@media (orientation: portrait) {
  /* Stacked, the halves no longer meet at the middle of the SCREEN — the
     shared question sits above them — so the ownership colour goes back onto
     each half, where it lines up with the instrument it belongs to. */
  #duelScreen.mm-duel { background: var(--bg1); }
  #duelScreen.mm-duel::after { display: none; }
  #duelScreen.mm-duel.won-p1,
  #duelScreen.mm-duel.won-p2 { background: var(--bg1); }

  .mm-duel-top { flex: none; }
  .mm-duel-side[data-player="1"] { background: rgba(0, 153, 153, 0.05); }
  .mm-duel-side[data-player="2"] { background: rgba(243, 148, 34, 0.05); }
  #duelScreen.mm-duel.won-p1 .mm-duel-side[data-player="1"] { background: rgba(0, 153, 153, 0.16); }
  #duelScreen.mm-duel.won-p2 .mm-duel-side[data-player="2"] { background: rgba(243, 148, 34, 0.16); }

  .mm-duel-divider {
    width: auto;
    height: 0;
    border-top: 2px dashed rgba(27, 35, 62, 0.12);
  }
  /* Stacked, the arena's main axis turns vertical — so the base rule's
     `align-items: flex-end` stops meaning "bells on the floor" and starts
     meaning "squeeze both instruments against the right edge". */
  .mm-duel-arena { flex: 1; flex-direction: column; align-items: stretch; }
  .mm-duel-side { justify-content: flex-end; }
  .mm-duel-side { justify-content: center; }
  .mm-duel .bank-note .bell-composite { width: clamp(44px, calc((100vw - 60px) / 8), 88px); }
  .mm-duel-bank { padding-top: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  .mm-duel-banner.is-pop,
  .mm-duel-pips.is-reset { animation: none; }
}

/* Free tier: a members-only level reads as "not yet", never as broken, and
   stays tappable (it opens the unlock) even before it is reached. */
.mm-level.is-paywalled { opacity: .72; }
.mm-level.is-paywalled b { filter: grayscale(.6); }
.mm-level .mm-level-lock { display: flex; justify-content: center; font-size: 9px; line-height: 1; }

/* Note names (1.0.2): a Do Re Mi label longer than its letters ("Lo Sol♯", "Hi Do/8")
   shrinks a little rather than overflow the bell. Never set in letters mode. */
.note-label.nn-long { scale: 0.84; }
