/* ── Type ──────────────────────────────────────────────────────────────────
   Atkinson Hyperlegible: drawn for fast, unmistakable reading, which suits
   glancing at note names and numbers while your hands are on the keys.     */

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-display: block;
}

@font-face {
  font-family: 'Atkinson Hyperlegible Mono';
  src: url('fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-display: block;
}

/* ── Tokens ────────────────────────────────────────────────────────────────
   A clean white page with the keyboard in a dark case at the bottom, after
   MuseTrainer. Colour is kept for meaning: green = held, orange = press next,
   pale green = still sounding on the pedal, sky blue = pedals and controls.  */

/* Safari on an iPad enlarges text by itself when the iPad is turned: not here (22 Nov 2026). */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root {
  color-scheme: light;

  --page: #ffffff;
  --wash: #f8fafc;
  --fill: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #64748b; /* (4.5:1 or more on white and the page: small print stays readable) */

  --accent: #0ea5e9;
  --accent-ink: #0369a1;

  --right-hand: #0ea5e9; /* the same colours as the keys a song plays */
  --right-wash: #e0f2fe;
  --right-ink: #0369a1;
  --left-hand: #8b5cf6;
  --left-wash: #ede9fe;
  --left-ink: #6d28d9;

  --held: #22c55e;
  --held-ink: #15803d;
  --held-wash: #f0fdf4;
  --held-line: #86efac;
  --next: #f97316;
  --next-ink: #c2410c;
  --amber: #f59e0b;
  --amber-ink: #b45309;
  --alarm: #ef4444;
  --heart: #f43f5e;

  /* Notes in the sheet music: next is the same orange as the keys; then played, wrong, missed. */
  --played: #0284c7;
  --wrong: #dc2626;
  --missed: #94a3b8;
  --paper: #ffffff;

  /* The orchard: the sky behind the trees, the grass and the soil they stand in. */
  --orchard-sky: #f3f6f0;
  --grass: #4a8640;
  --soil: #5b4433;

  /* XP and levels: gold, the colour of what practice earns (as stars are). */
  --xp: #f59e0b;
  --xp-2: #fbbf24;
  --xp-deep: #d97706;
  --xp-ink: #92400e;
  --xp-wash: #fffbeb;
  --xp-line: #fcd34d;
  --xp-pale: #fde68a;
  --xp-glow: rgba(245, 158, 11, 0.28);

  --font-ui: 'Atkinson Hyperlegible Next', 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif, 'Segoe UI Symbol';
  --font-mono: 'Atkinson Hyperlegible Mono', 'Cascadia Mono', Consolas, monospace, 'Segoe UI Symbol';

  --gutter: clamp(16px, 2vw, 40px);
  --radius-s: 8px;
  --radius-m: 14px;
  --shadow-panel: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 30px -12px rgba(15, 23, 42, 0.12);
}

/* ── Base ──────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  display: grid;
  /* (One column, never wider than the window: on an iPad Pro on its side, 1194 pixels, the top
     bar's contents would otherwise widen the whole page past the screen.) */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
}

/* ── Buttons and links ─────────────────────────────────────────────────── */

.btn {
  padding: 5px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--page);
  font-size: 14px;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  border-color: var(--ink-3);
  background: var(--wash);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn[aria-pressed='true'] {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}

.btn--primary:hover:not(:disabled) {
  border-color: #1e293b;
  background: #1e293b;
}

.btn--small {
  padding: 3px 10px;
  font-size: 13px;
}

.btn--icon {
  width: 32px;
  padding: 2px 0;
  font-size: 18px;
  line-height: 1.2;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link:hover {
  color: var(--accent-ink);
}

/* ── Top bar ───────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  flex: none;
  margin: 0;
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* The name is also the way home: the Home tab. */
.wordmark__home {
  padding: 2px 4px;
  margin: -2px -4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.wordmark__home:hover {
  color: var(--accent-ink);
}

.sim-tag {
  display: none;
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}

/* A little narrower: a little less room between things, so a 1280-pixel screen still fits one row. */
@media (max-width: 1320px) {
  .topbar {
    gap: 10px;
  }

  .topbar .tabs__tab {
    padding: 6px 12px;
  }
}

/* Too narrow for everything on one row: the tabs take a second row of their own, centred.
   (The ::after is an empty flex item a whole row wide, which breaks the line before them.) */
@media (max-width: 1180px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .topbar::after {
    content: '';
    order: 2;
    flex-basis: 100%;
    height: 0;
  }

  .topbar > .tabs {
    order: 3;
    margin: 0 auto;
  }
}

html[data-simulated] .sim-tag {
  display: inline-block;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-left: auto;
}

.btn--calibrate {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 16px;
  border-radius: 999px;
}

.btn__dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.btn--calibrate[data-calibration='saved'] .btn__dot {
  display: block;
  background: var(--held);
}

.btn--calibrate[data-calibration='correcting'] .btn__dot {
  display: block;
  background: var(--amber);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: min(56vw, 820px);
  min-height: 38px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  font-size: 14px;
  cursor: pointer;
}

.status:hover {
  border-color: var(--ink-3);
  background: var(--wash);
}

.status__dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.status__label {
  flex: none;
  font-weight: 700;
  white-space: nowrap;
}

.status__detail {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status__detail:empty {
  display: none;
}

.status__tick {
  display: none;
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--held);
}

.status[data-state='connected'] .status__dot {
  display: none;
}

.status[data-state='starting'] .status__dot,
.status[data-state='searching'] .status__dot,
.status[data-state='connecting'] .status__dot,
.status[data-state='signal-lost'] .status__dot {
  animation: breathe 1.4s ease-in-out infinite;
}

.status[data-state='busy'] .status__dot,
.status[data-state='unavailable'] .status__dot {
  background: var(--alarm);
}

/* Connected: the green tick, after the piano's name (in place of the old beating heart). */
.status[data-state='connected'] .status__tick {
  display: block;
}

@keyframes breathe {
  50% {
    opacity: 0.35;
  }
}

/* ── Desk: everything above the keys ───────────────────────────────────── */

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gutter);
  min-height: 0;
  padding: clamp(14px, 2vh, 24px) var(--gutter) clamp(14px, 2vh, 24px);
}

.app.debug-open .desk {
  grid-template-columns: minmax(0, 1fr) minmax(600px, 50%);
}

.app.calibrating .home {
  display: none;
}

@media (max-width: 1699px) {
  .app.debug-open .desk {
    grid-template-columns: minmax(0, 1fr);
  }
  .app.debug-open .home,
  .app.calibrating .debug {
    display: none;
  }
}

.readouts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(24px, 4vw, 80px);
  min-height: 0;
}

/* The last note, set large. */

.now {
  min-width: 0;
}

.now__prompt {
  margin: 0;
  color: var(--ink-2);
  font-size: clamp(28px, 4.2vh, 46px);
  font-weight: 500;
}

.now[data-state='idle'] .now__note,
.now[data-state='idle'] .chord,
.now:not([data-state='idle']) .now__prompt,
.now:not([data-state='idle']) .now__hint {
  display: none;
}

.now__hint {
  max-width: 40rem;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1.5;
}

.now__note {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px clamp(20px, 3vw, 56px);
}

.now__name {
  color: var(--ink);
  font-size: clamp(96px, 19vh, 240px);
  font-weight: 760;
  line-height: 0.8;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.now[data-state='held'] .now__name {
  color: #16a34a;
}

.now__name .acc {
  margin-left: 0.02em;
  font-size: 0.5em;
  font-weight: 500;
  vertical-align: 0.7em;
}

.now__name .oct {
  margin-left: 0.04em;
  color: var(--ink-3);
  font-size: 0.4em;
  font-weight: 600;
  letter-spacing: 0;
}

.now__detail {
  min-width: 0;
  padding-bottom: 0.2em;
}

.velocity {
  display: grid;
  grid-template-columns: auto minmax(140px, 340px) 3.2ch;
  align-items: center;
  gap: 14px;
}

.velocity__label {
  color: var(--ink-2);
  font-size: 14px;
}

.velocity__track {
  height: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--fill);
}

.velocity__fill {
  display: block;
  height: 100%;
  background: var(--line-strong);
  transform: scaleX(var(--v, 0));
  transform-origin: left;
}

.now[data-state='held'] .velocity__fill {
  background: var(--held);
}

.velocity__value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.now__line {
  margin: 8px 0 0;
  color: var(--ink-2);
}

.now[data-state='held'] .now__state {
  color: var(--held-ink);
  font-weight: 700;
}

.chord {
  display: grid;
  gap: 10px;
  margin-top: clamp(24px, 5vh, 56px);
}

.chord__row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-height: 32px;
}

.chord__label {
  flex: none;
  width: 5.5em;
  color: var(--ink-2);
  font-size: 14px;
}

.chord__notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chord__empty {
  color: var(--ink-3);
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 3px 10px;
  border-radius: var(--radius-s);
  font-weight: 700;
}

.chip b {
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.chip--held {
  background: var(--held-wash);
  color: var(--held-ink);
  box-shadow: inset 0 0 0 1px var(--held-line);
}

.chip--ringing {
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* Pedals: meters that fill as each pedal goes down. */

.pedals {
  display: flex;
  align-items: flex-end;
  gap: clamp(12px, 1.6vw, 28px);
}

.pedal {
  display: grid;
  justify-items: center;
  width: 84px;
  text-align: center;
}

.pedal__track {
  position: relative;
  width: 44px;
  height: clamp(110px, 21vh, 230px);
  overflow: hidden;
  border-radius: 22px 22px 8px 8px;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
}

.pedal__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #0284c7, #38bdf8);
  transform: scaleY(0);
  transform-origin: bottom;
}

.pedal__value {
  margin-top: 10px;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pedal__name {
  font-weight: 700;
}

.pedal__state {
  color: var(--ink-2);
  font-size: 14px;
}

.pedal[data-state='down'] .pedal__state {
  color: var(--accent-ink);
  font-weight: 700;
}

.pedal[data-state='unknown'] {
  opacity: 0.6;
}

.pedal[data-state='unknown'] .pedal__track {
  background: transparent;
  box-shadow: none;
  outline: 1.5px dashed var(--line-strong);
  outline-offset: -1.5px;
}

/* Calibration said this pedal isn't fitted: hide it unless it ever sends something. */
.pedal[data-fitted='false'][data-state='unknown'] {
  display: none;
}

/* ── Keyboard ──────────────────────────────────────────────────────────────
   Drawn on a canvas (see ui/keyboard.js), sized to the exact screen pixels it
   covers. Keys keep real proportions: the height follows the width.         */

.keybed {
  position: relative;
  height: clamp(150px, calc((100vw - 20px) / 9.6 + 32px), 32vh);
  margin: 0 10px 10px;
}

.keyboard-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* fingers play keys instead of scrolling */
}

/* Note names on the keys: sits on the dark rail above the keys, at the right. */
.labels-control {
  position: absolute;
  z-index: 1;
  top: 5px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1;
}

.labels-control__title {
  padding: 0 6px 0 8px;
  color: rgba(255, 255, 255, 0.55);
}

.labels-control button {
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.labels-control button:hover {
  color: #fff;
}

.labels-control button[aria-checked='true'] {
  background: #fff;
  color: var(--ink);
}

/* ── Panels (debug, calibrate) ─────────────────────────────────────────── */

.debug,
.calibrate {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--page);
  box-shadow: var(--shadow-panel);
}

/* ── Debug panel ───────────────────────────────────────────────────────── */

.debug {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  user-select: text;
}

.debug__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
}

.debug__title {
  margin: 0 auto 0 0;
  font-size: 16px;
  font-weight: 700;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}

.toggle input,
.inputs input {
  accent-color: var(--accent);
}

.debug__body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr);
  min-height: 0;
}

.log {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border-right: 1px solid var(--line);
}

/* Fixed pixel columns so the 12 px header lines up with the 13 px rows. */
.row {
  display: grid;
  grid-template-columns: 106px 70px minmax(0, 1fr) 22px 58px;
  gap: 8px;
  padding: 2px 14px 2px 11px;
  border-left: 3px solid transparent;
  white-space: nowrap;
}

.row > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .num {
  text-align: right;
}

.log__head {
  padding-top: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
}

.log__rows {
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  list-style: none;
  font: 13px/1.55 var(--font-mono);
}

.row--on {
  border-left-color: var(--held);
}

.row--off {
  border-left-color: var(--line-strong);
}

.row--pedal {
  border-left-color: var(--accent);
}

/* Sent to the piano (played on screen). */
.row--sent {
  border-left-color: var(--next);
  background: #fff7ed;
}

.row--beat {
  color: var(--ink-3);
}

.row__time,
.row__bytes,
.log__rows .num {
  color: var(--ink-2);
}

.log__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 6px 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
}

.log__paused {
  color: var(--amber-ink);
}

.side {
  display: grid;
  align-content: start;
  gap: 22px;
  min-height: 0;
  padding: 14px 16px 24px;
  overflow-x: hidden;
  overflow-y: auto;
}

.side h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.lat {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lat th {
  padding: 2px 6px;
  color: var(--ink-3);
  font-weight: 500;
  text-align: right;
}

.lat td {
  padding: 2px 6px;
  font-family: var(--font-mono);
  text-align: right;
}

.lat td:first-child {
  padding-left: 0;
  color: var(--ink-2);
  font-family: var(--font-ui);
  text-align: left;
  white-space: nowrap;
}

.note {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
}

.kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 16px;
  margin: 0;
  font-size: 13px;
}

.kv dt {
  color: var(--ink-2);
}

.kv dd {
  margin: 0;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* A choice inside the details list (how notes are sent). */
.debug__select {
  max-width: 100%;
  margin: -3px 0;
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
}

.inputs {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.inputs label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  cursor: pointer;
}

.inputs__meta {
  color: var(--ink-3);
  font-size: 12px;
}

.connlog {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 12px/1.45 var(--font-mono);
}

.connlog time {
  margin-right: 10px;
  color: var(--ink-3);
}

/* ── Calibrate mode ────────────────────────────────────────────────────── */

.calibrate {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.calibrate__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--line);
}

.calibrate__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.calibrate__title:focus {
  outline: none;
}

.calibrate__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 auto 0 0;
  padding: 0;
  list-style: none;
}

.cstepper__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: 13px;
}

.cstepper__num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cstepper__item[data-state='current'] {
  color: var(--ink);
}

.cstepper__item[data-state='current'] .cstepper__num {
  background: var(--next);
  box-shadow: none;
  color: #fff;
}

.cstepper__item[data-state='done'] {
  color: var(--ink-2);
}

.cstepper__item[data-state='done'] .cstepper__num {
  background: #dcfce7;
  box-shadow: inset 0 0 0 1px var(--held-line);
  color: var(--held-ink);
}

.cstepper__item[data-state='skipped'] .cstepper__label {
  text-decoration: line-through;
}

.calibrate__notice {
  margin: 0;
  padding: 10px 20px;
  border-bottom: 1px solid #fde68a;
  background: #fffbeb;
  color: var(--amber-ink);
  font-size: 14px;
}

.calibrate__body {
  --pad-y: clamp(20px, 4vh, 48px);
  --pad-x: clamp(20px, 3vw, 56px);
  min-height: 0;
  overflow-y: auto;
}

.cstep,
.cresult {
  padding: var(--pad-y) var(--pad-x);
}

.cstep {
  max-width: 54rem;
}

.cstep__title {
  margin: 0;
  font-size: clamp(28px, 4.4vh, 46px);
  font-weight: 760;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.cstep__help {
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 18px;
}

.cstep__feedback {
  min-height: 1.5em;
  margin: 28px 0 0;
  color: var(--ink-2);
  font-size: 18px;
}

.cstep__feedback[data-tone='ok'] {
  color: var(--held-ink);
}

.cstep__feedback[data-tone='check'] {
  color: var(--amber-ink);
}

.cconfirm {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.cconfirm .btn {
  padding: 7px 16px;
  font-size: 15px;
}

.cstep__previous {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 14px;
}

.cactions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.cactions .btn {
  padding: 7px 16px;
  font-size: 15px;
}

.cpedals {
  display: flex;
  gap: 22px;
  margin-top: 28px;
}

.cpedal {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.cpedal__body {
  position: relative;
  width: 52px;
  height: 120px;
  overflow: hidden;
  border-radius: 26px 26px 10px 10px;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line);
}

.cpedal__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #0284c7, #38bdf8);
  transform: scaleY(0);
  transform-origin: bottom;
}

.cpedal[data-target='false'] {
  opacity: 0.4;
}

.cpedal[data-target='true'] .cpedal__body {
  box-shadow: 0 0 0 2px var(--next);
}

.cpedal__label {
  color: var(--ink-2);
  font-size: 14px;
}

.cpedal[data-target='true'] .cpedal__label {
  color: var(--next-ink);
  font-weight: 700;
}

.cpedal__reading {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.cresult {
  max-width: 72rem;
  padding-bottom: 0;
}

.cresult__title {
  margin: 0;
  font-size: clamp(26px, 3.6vh, 40px);
  font-weight: 760;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.cresult__summary {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 18px;
}

.cresult__table {
  width: 100%;
  margin-top: 24px;
  border-collapse: collapse;
  font-size: 15px;
}

.cresult__table th {
  padding: 6px 14px 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.cresult__table td {
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}

.cresult__what {
  font-weight: 700;
  white-space: nowrap;
}

.cresult__redo {
  text-align: right;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--expected {
  background: #dcfce7;
  color: var(--held-ink);
}

.badge--adjusted {
  background: #e0f2fe;
  color: var(--accent-ink);
}

.badge--check {
  background: #fef3c7;
  color: var(--amber-ink);
}

.badge--missing {
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink-2);
}

.cresult__findings {
  display: grid;
  gap: 10px;
  max-width: 54rem;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.cresult__findings li {
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-2);
  line-height: 1.5;
}

.cresult__findings li[data-tone='ok'] {
  border-left-color: var(--held);
  color: var(--ink);
}

.cresult__findings li[data-tone='fixed'] {
  border-left-color: var(--accent);
  color: var(--ink);
}

.cresult__findings li[data-tone='check'] {
  border-left-color: var(--amber);
  color: var(--ink);
}

/* Keep "Save calibration" in view however long the findings run. */
.cresult .cactions {
  position: sticky;
  bottom: 0;
  margin-top: 20px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
  background: var(--page);
}

/* ── Live-reload notice ────────────────────────────────────────────────── */

.toast {
  position: fixed;
  z-index: 10;
  top: 70px;
  left: 50%;
  max-width: min(760px, calc(100vw - 48px));
  padding: 7px 16px;
  border-radius: 18px;
  line-height: 1.4;
  text-align: center;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-panel);
  transform: translateX(-50%);
  pointer-events: none;
}

/* On the song screen, just above the keyboard rather than over the song's header and controls. */
html[data-screen='song'] .toast {
  top: auto;
  bottom: calc(clamp(150px, calc((100vw - 20px) / 9.6 + 32px), 32vh) + 30px);
}

/* ── Debug panel tabs ──────────────────────────────────────────────────── */

.debug__title {
  margin-right: 4px;
}

.tabs {
  display: inline-flex;
  margin-right: auto;
  padding: 3px;
  border-radius: 10px;
  background: var(--fill);
}

.tabs__tab {
  padding: 4px 14px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tabs__tab[aria-selected='true'] {
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.tabs__tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.debug__tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Song inspector (Songs tab) ────────────────────────────────────────── */

.songs {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  min-height: 0;
}

.songs__library {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--wash);
}

.songs__folder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--line);
}

.songs__folder-text {
  display: grid;
  min-width: 0;
  margin-right: auto;
}

.songs__folder-label {
  font-size: 13px;
  font-weight: 700;
}

.songs__folder-path {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl; /* keep the end of a long path, which is the useful part */
  text-align: left;
}

.songs__list {
  margin: 0;
  padding: 6px 0 10px;
  overflow-y: auto;
  list-style: none;
}

.songs__list:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.songs__group {
  padding: 12px 14px 4px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
}

.songs__empty,
.songs__problem {
  padding: 2px 14px 6px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.45;
}

.songs__problem {
  color: var(--amber-ink);
}

.song-item {
  display: grid;
  gap: 1px;
  margin: 0 6px;
  padding: 6px 8px;
  border-radius: var(--radius-s);
  cursor: pointer;
}

.song-item:hover {
  background: var(--fill);
}

.song-item[aria-selected='true'] {
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 2px rgba(15, 23, 42, 0.06);
}

.song-item__title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-item__meta {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-item[data-status='error'] .song-item__meta {
  color: var(--amber-ink);
}

.songs__hint {
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.4;
}

.song {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 14px 16px 0;
  overflow-y: auto;
}

.song > * {
  flex: none;
}

.song__message {
  display: grid;
  gap: 6px;
  max-width: 54ch;
  margin: 40px auto;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.song__message--error strong {
  color: var(--ink);
}

.song__head {
  display: flex;
  align-items: flex-start;
  gap: 8px 16px;
}

.song__names {
  flex: 1;
  min-width: 0;
}

.song__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.song__by {
  margin: 3px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.song__actions {
  display: flex;
  flex-wrap: wrap-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 4px 10px;
  max-width: 50%;
}

.song__play-note {
  color: var(--amber-ink);
  font-size: 12px;
}

.btn--play {
  min-width: 132px;
  padding: 7px 16px;
}

.btn--play[aria-pressed='true'] {
  border-color: var(--ink);
  background: var(--page);
  color: var(--ink);
}

.btn--play[aria-pressed='true']::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 2px;
  background: currentColor;
}

.song__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 12px 0 0;
  font-size: 13px;
}

.song__facts dt {
  color: var(--ink-3);
  font-size: 12px;
}

.song__facts dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.song__extra {
  color: var(--ink-2);
  font-weight: 400;
}

.song__hands {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 13px;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.swatch--right {
  background: var(--right-hand);
}

.swatch--left {
  margin-left: 8px;
  background: var(--left-hand);
}

.song__hands-why {
  margin-left: 10px;
  color: var(--ink-3);
}

.song__warnings {
  margin: 10px 0 0;
  padding: 8px 12px 8px 28px;
  border-radius: var(--radius-s);
  background: #fffbeb;
  color: var(--amber-ink);
  font-size: 13px;
  line-height: 1.45;
}

/* The roll shows a piece from its lowest note to its highest. One that uses most of the
   keyboard has many rows, so it's given the height to keep each row readable (5px a row, plus
   the bar numbers, the pedal lane and the scroll bar), up to nearly half the panel. */
.song__roll {
  flex: none;
  height: clamp(150px, max(min(34%, 280px), min(46%, calc(var(--roll-rows, 0) * 5px + 50px))), 500px);
  margin-top: 12px;
}

/* The piano roll */

.roll {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}

.roll__scroller {
  position: absolute;
  inset: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.roll__spacer {
  position: absolute;
  top: 0;
  left: 0;
  height: 1px;
}

.roll__canvas {
  display: block;
  position: sticky;
  left: 0;
  top: 0;
}

.roll__tip {
  position: absolute;
  z-index: 2;
  max-width: 90%;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

/* The steps table */

.song > .steps {
  flex: 1 1 0;
  min-height: 160px;
  margin: 12px -16px 0;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.steps:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.steps__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.steps__table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--page);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.steps__table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--fill);
  vertical-align: middle;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.steps__table th:first-child,
.steps__table td:first-child {
  padding-left: 16px;
}

.steps__table .num {
  text-align: right;
}

.steps__table tbody tr {
  cursor: pointer;
}

.steps__table tbody tr:hover {
  background: var(--wash);
}

.steps__table tr[aria-selected='true'] {
  background: #fff7ed;
  box-shadow: inset 3px 0 0 var(--next);
}

.steps__table tr.is-playing {
  background: var(--fill);
  box-shadow: inset 3px 0 0 var(--ink);
}

.steps__repeat {
  color: var(--accent-ink);
}

.steps__notes {
  white-space: normal !important;
}

.steps__more td {
  padding: 10px 16px;
  color: var(--ink-3);
  cursor: default;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  margin: 1px 4px 1px 0;
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 600;
}

.chip--right {
  background: var(--right-wash);
  color: var(--right-ink);
}

.chip--left {
  background: var(--left-wash);
  color: var(--left-ink);
}

.chip--grace {
  opacity: 0.7;
  font-size: 12px;
}

.chip__finger {
  position: relative;
  top: -0.5em;
  margin-left: 1px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.chip__length {
  margin-left: 5px;
  font-weight: 400;
  opacity: 0.75;
}

/* ── Dropping files on the window ──────────────────────────────────────── */

.drop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(248, 250, 252, 0.88);
  pointer-events: none;
}

.drop__card {
  display: grid;
  gap: 6px;
  width: min(560px, 100%);
  padding: 40px 32px;
  border: 2px dashed var(--accent);
  border-radius: 20px;
  background: var(--page);
  box-shadow: var(--shadow-panel);
  text-align: center;
}

.drop__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.drop__formats {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .status__dot {
    animation: none !important;
  }
}


/* ── Songs menu (top bar) ──────────────────────────────────────────────── */

.songs-menu {
  position: relative;
}

.btn--songs {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 11px;
  font-weight: 650;
}

.btn--songs svg {
  width: 16px;
  height: 16px;
}

.btn--songs .btn__chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
  transition: transform 140ms ease;
}

.btn--songs[aria-expanded='true'] .btn__chevron {
  transform: rotate(180deg);
}

.picker {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(520px, calc(100vw - 32px));
  max-height: min(72vh, 680px);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--page);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06), 0 24px 60px -24px rgba(15, 23, 42, 0.4);
}

.picker__search {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.picker__search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.picker__search input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 0;
}

.picker__list {
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.pick:hover:not(:disabled),
.pick:focus-visible {
  background: var(--fill);
}

.pick:focus-visible {
  outline-offset: -2px;
}

.pick[aria-selected='true'] {
  background: var(--right-wash);
}

.pick:disabled {
  cursor: default;
}

.pick:disabled .pick__title {
  color: var(--ink-2);
}

.pick__words {
  display: grid;
  min-width: 0;
}

.pick__title,
.pick__by {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick__title {
  font-weight: 650;
}

.pick__by {
  color: var(--ink-2);
  font-size: 13px;
}

.pick__meta {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 12px;
}

.pick__format {
  min-width: 62px;
  color: var(--ink-3);
  font-size: 12px;
  text-align: right;
}

.picker__empty {
  padding: 20px;
  color: var(--ink-2);
  text-align: center;
}

.picker__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.picker__hint {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

.picker__folder {
  flex: none;
}

/* Level, as five dots (two levels each). */
.level-dots {
  display: inline-flex;
  gap: 3px;
}

.level-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}

.level-dots i.on {
  background: var(--ink-2);
}

/* ── Song screen (the music stand) ───────────────────────────────────────────────────────── */

/* The stand lays itself out by its own width (the debug panel can take half the window), so
   its header and playback controls use container sizes, not the window's. */
.stand {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.4vh, 16px);
  min-width: 0;
  min-height: 0;
  container: stand / inline-size;
}

.app.song-open .home,
.app.calibrating .stand,
.app.course-open .home,
.app.calibrating .course,
.app.song-open .course {
  display: none;
}

@media (max-width: 1699px) {
  .app.debug-open .stand,
  .app.debug-open .course {
    display: none;
  }
}

.stand__head {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.3cqw, 44px);
  min-width: 0;
}

.stand__titles {
  flex: 1 1 auto;
  min-width: 0;
}

.stand__title {
  margin: 0;
  overflow: hidden;
  font-size: clamp(22px, 1.15cqw + 12px, 34px);
  font-weight: 760;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stand__by {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stand__facts {
  display: flex;
  flex: none;
  gap: clamp(16px, 1.9cqw, 34px);
  margin: 0;
}

.stand__fact dt {
  color: var(--ink-3);
  font-size: 13px;
}

.stand__fact dd {
  margin: 1px 0 0;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
}

.stand__unit {
  margin-left: 4px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.stand__fact--level dd {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Less room: the facts go first, then the size buttons; narrower still (beside the debug
   panel), the title gets a row of its own. */
@container stand (max-width: 1630px) {
  .stand__fact--time,
  .stand__fact--length {
    display: none;
  }
}

@container stand (max-width: 1340px) {
  .stand__fact--tempo,
  .stand__tools .stand__zoom {
    display: none;
  }
}

@container stand (max-width: 940px) {
  .stand__head {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .stand__titles {
    flex-basis: 100%;
  }

  .stand__facts {
    display: none;
  }

  .stand__close {
    margin-left: auto;
  }
}

.stand__modes {
  display: inline-flex;
  flex: none;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--fill);
}

.stand__mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 104px;
  justify-content: center;
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.stand__mode svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.stand__mode:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

.stand__mode[aria-pressed='true'] {
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(15, 23, 42, 0.1);
}

.stand__mode[data-mode='listen'][aria-pressed='true'] {
  color: var(--accent-ink);
}

.stand__mode:disabled {
  opacity: 0.45;
  cursor: default;
}

.stand__close {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.stand__close svg {
  width: 20px;
  height: 20px;
}

.stand__close:hover {
  border-color: var(--line);
  background: var(--fill);
  color: var(--ink);
}

.stand__body {
  position: relative; /* Play mode's score display and the tap test are laid over the music */
  display: grid;
  flex: 1 1 0;
  min-height: 0;
}

.stand__score {
  min-height: 0;
}

.stand__tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
}

.stand__notice {
  color: var(--ink-3);
}

.stand__by [data-ref='by']:not(:empty) + .stand__notice::before {
  content: '';
  display: inline-block;
  width: 1px;
  height: 0.9em;
  margin: 0 10px;
  background: var(--line-strong);
  vertical-align: -0.1em;
}

.stand__tool {
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.stand__tool:hover:not(:disabled) {
  background: var(--fill);
  color: var(--ink);
}

.stand__tool[aria-pressed='true'] {
  background: var(--right-wash);
  color: var(--accent-ink);
}

.stand__tool:disabled {
  opacity: 0.4;
  cursor: default;
}

.stand__tool--icon {
  width: 32px;
  padding: 6px 0;
  font-size: 18px;
  line-height: 1;
}

.stand__zoom {
  display: flex;
  align-items: center;
  margin-left: 4px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}

/* The Band button and its menu of styles (the improvement plan's Stage 2). */
.stand__band {
  position: relative;
  margin-right: 4px;
  padding-right: 6px;
  border-right: 1px solid var(--line);
}

.stand__band-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stand__band-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.stand__band-caret {
  font-size: 11px;
  opacity: 0.7;
}

.stand__band-button[data-off='true'] {
  color: var(--ink-3);
}

.stand__band-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  right: 0;
  width: 290px;
  max-height: min(70vh, 540px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  background: var(--page);
  box-shadow: 0 0 0 1px var(--line), 0 12px 32px rgba(15, 23, 42, 0.18);
}

.stand__band-head {
  margin: 4px 10px 6px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stand__band-item,
.stand__band-more {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.stand__band-item b {
  font-size: 14px;
}

.stand__band-item span {
  color: var(--ink-3);
  font-size: 12.5px;
}

.stand__band-item:hover,
.stand__band-item:focus-visible,
.stand__band-more:hover,
.stand__band-more:focus-visible {
  background: var(--fill);
}

.stand__band-item[aria-checked='true'] {
  background: var(--right-wash);
}

.stand__band-item[aria-checked='true'] b {
  color: var(--accent-ink);
}

.stand__band-more {
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
}

.stand__zoom-value {
  min-width: 48px;
  color: var(--ink-2);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ── Sheet music ───────────────────────────────────────────────────────── */

.score {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: var(--fill);
}

.score__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  outline: none;
  cursor: grab;
  touch-action: none;
  contain: strict;
}

.score__viewport:focus-visible {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}

.score__viewport.is-over-note {
  cursor: pointer;
}

.score.is-dragging .score__viewport {
  cursor: grabbing;
}

/* The music moves as one GPU layer; scrolling only changes its transform. */
.score__track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: clamp(12px, 1.3vw, 26px);
  will-change: transform;
}

.score[data-layout='line'] .score__track {
  width: max-content;
  min-width: 100%;
}

.score__paper {
  position: relative;
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 28px -16px rgba(15, 23, 42, 0.22);
  transform-origin: 0 0;
}

.score[data-layout='line'] .score__paper {
  width: max-content;
}

.score__music {
  position: relative;
}

.score__music svg {
  display: block;
}

/* Listen mode: the bar under the pointer, which a click jumps to. */
.score__barhover {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 7px;
  background: rgba(14, 165, 233, 0.07);
  box-shadow: inset 0 0 0 1.5px rgba(14, 165, 233, 0.38);
  pointer-events: none;
  will-change: transform;
}

/* Where a click would play from: a line at that note, inside the highlighted bar. */
.score__playfrom {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  pointer-events: none;
  will-change: transform;
}

.score__cursor {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 7px;
  background: rgba(249, 115, 22, 0.13);
  box-shadow: inset 0 0 0 1.5px rgba(249, 115, 22, 0.55);
  pointer-events: none;
  will-change: transform;
}

/* Where the music has jumped to (a repeat, a 2nd-time bar): a few words under the step, pointing up at it. */
.score__cue {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 5px 11px 6px;
  border-radius: 999px;
  background: var(--next-ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16), 0 3px 10px rgba(194, 65, 12, 0.18);
  animation: cue-in 220ms ease-out both;
}

.score__cue::before {
  content: '';
  position: absolute;
  top: -4px;
  left: var(--point, 50%);
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 1.5px;
  background: inherit;
  transform: rotate(45deg);
}

@keyframes cue-in {
  from {
    opacity: 0;
    translate: 0 -4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .score__cue {
    animation: none;
  }
}

/* A wrong key in Learn mode: a red note where that key is on the staff, there for a moment. */
.score__ghosts {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.score__ghost {
  position: absolute; /* its left and top are the middle of the notehead */
  width: 0;
  height: 0;
  color: var(--wrong);
  animation: ghost-note 900ms ease-out both;
}

.score__ghost-head {
  position: absolute;
  left: calc(var(--w) / -2);
  top: calc(var(--h) / -2);
  width: var(--w);
  height: var(--h);
  border-radius: 50%;
  background: currentColor;
  transform: rotate(-20deg);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.score__ghost-ledger {
  position: absolute;
  left: calc(var(--w) * -0.9);
  width: calc(var(--w) * 1.8);
  height: max(1px, calc(var(--space) * 0.13));
  margin-top: calc(var(--space) * -0.065);
  background: currentColor;
}

.score__ghost-sign {
  position: absolute;
  right: calc(var(--w) / 2 + var(--space) * 0.15);
  top: 0;
  transform: translateY(-52%);
  font: 400 calc(var(--space) * 2.5) / 1 'Segoe UI Symbol', 'Noto Music', 'DejaVu Sans', sans-serif;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff;
}

@keyframes ghost-note {
  0% {
    opacity: 0;
    scale: 0.5;
  }
  12% {
    opacity: 1;
    scale: 1.18;
  }
  24% {
    scale: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    scale: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .score__ghost {
    animation-name: ghost-note-fade;
  }
}

@keyframes ghost-note-fade {
  0%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Coloured notes: only the noteheads change. */
.score__music [data-state='next'] path {
  fill: var(--next);
}

.score__music [data-state='played'] path {
  fill: var(--played);
}

.score__music [data-state='wrong'] path {
  fill: var(--wrong);
}

.score__music [data-state='missed'] path {
  fill: var(--missed);
}

/* Letter names inside the noteheads. */
.score__names {
  display: none;
  pointer-events: none;
}

.score[data-names='on'] .score__names {
  display: inline;
}

.score__names text {
  fill: #fff;
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-anchor: middle;
  dominant-baseline: central;
}

.score__names text.hollow {
  fill: var(--ink);
}

.score__names text.hollow[data-state='next'] {
  fill: var(--next-ink);
}

.score__names text.hollow[data-state='played'] {
  fill: var(--played);
}

.score__names text.hollow[data-state='wrong'] {
  fill: var(--wrong);
}

.score__names text.hollow[data-state='missed'] {
  fill: var(--missed);
}

.score__bar {
  position: absolute;
  z-index: 2;
  border-radius: 999px;
}

.score__bar[data-axis='y'] {
  top: 10px;
  right: 4px;
  bottom: 10px;
  width: 9px;
}

.score__bar[data-axis='x'] {
  right: 10px;
  bottom: 4px;
  left: 10px;
  height: 9px;
}

.score__thumb {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.2);
  will-change: transform;
}

.score__bar[data-axis='y'] .score__thumb {
  width: 100%;
}

.score__bar[data-axis='x'] .score__thumb {
  height: 100%;
}

.score__thumb:hover,
.score.is-dragging-bar .score__thumb {
  background: rgba(15, 23, 42, 0.36);
}

.score__message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  color: var(--ink-2);
  font-size: 16px;
  text-align: center;
  pointer-events: none;
}

.score[data-state='problem'] .score__message {
  color: var(--ink);
}


/* ── Playback controls (Listen mode) ───────────────────────────────────── */

.stand__transport {
  flex: none;
  min-width: 0;
}

.transport {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6cqw, 30px);
  padding: 7px 14px 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--wash);
}

.transport__buttons {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
}

.transport__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--page);
  color: var(--ink-2);
  cursor: pointer;
}

.transport__icon:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.transport__icon svg,
.transport__play svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.transport__play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 118px;
  padding: 9px 20px 9px 15px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.transport__play:hover {
  background: #1e293b;
}

.transport__where {
  display: flex;
  flex: 1 1 240px;
  align-items: center;
  gap: 12px;
  min-width: 170px;
}

.transport__bar {
  flex: none;
  min-width: 92px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
}

.transport__time {
  flex: none;
  color: var(--ink-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.transport__track {
  position: relative;
  flex: 1 1 auto;
  min-width: 60px;
  height: 26px;
  outline: none;
  cursor: pointer;
  touch-action: none;
}

.transport__rail {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 6px;
  margin-top: -3px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--line-strong);
}

.transport__fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* A hairline at each bar, so the track reads as bars. */
.transport__ticks {
  position: absolute;
  z-index: 1;
  inset: 0;
}

.transport__ticks i {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.85);
}

.transport__thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--page);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.transport__track:focus-visible .transport__thumb,
.transport__track.is-dragging .transport__thumb {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent);
}

.transport__group {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.transport__label {
  color: var(--ink-3);
  font-size: 13px;
}

.transport__seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
}

.transport__seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.transport__seg button:hover {
  color: var(--ink);
}

.transport__seg button[aria-checked='true'] {
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* The same colours the keys light in when the app plays each hand. */
.hand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.hand-dot--left {
  background: var(--left-hand);
}

.hand-dot--right {
  background: var(--right-hand);
}

/* The tempo slider, drawn to match the position track. --f is how far along it is (0 to 1);
   the small notch marks 100%, the tempo as written. */
.transport__tempo input[type='range'] {
  --f: 0.6;
  --written: calc(7px + (100% - 14px) * 0.6);
  width: clamp(90px, 9.4cqw, 180px);
  height: 26px;
  margin: 0;
  appearance: none;
  background: linear-gradient(to right, transparent calc(var(--written) - 1px), var(--ink-3) 0, var(--ink-3) calc(var(--written) + 1px), transparent 0) 0 50% / 100% 14px no-repeat;
  outline: none;
  cursor: pointer;
}

.transport__tempo input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) calc(7px + (100% - 14px) * var(--f)), var(--line-strong) 0);
}

.transport__tempo input[type='range']::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -4px;
  appearance: none;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--page);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.transport__tempo input[type='range']:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent);
}

.transport__nudge {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--page);
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.transport__nudge:hover:not(:disabled) {
  border-color: var(--ink-3);
  color: var(--ink);
}

.transport__nudge:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Quick tempos: 60, 80 and 100% (the improvement plan's Stage 2). */
.transport__picks {
  display: inline-flex;
  flex: none;
  gap: 2px;
  margin-left: 2px;
}

.transport__picks button {
  min-width: 34px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.transport__picks button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.transport__picks button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
}

.transport__percent {
  min-width: 54px;
  padding: 4px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  cursor: pointer;
}

.transport__percent[data-changed='true'] {
  background: var(--right-wash);
  color: var(--accent-ink);
}

.transport__bpm {
  min-width: 56px;
  color: var(--ink-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.transport__sound select {
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.transport__note {
  color: var(--amber-ink);
  font-size: 13px;
}

.transport__note:empty {
  display: none;
}

/* ── Learn mode's controls: the same bar, with its own few parts ─────────── */

.learnbar__restart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.learnbar__restart svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.learnbar__restart:hover {
  border-color: var(--ink-3);
}

/* Finished: playing it again is the thing to do next. */
.learnbar__restart[data-finished='true'] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.learnbar__count {
  flex: none;
  color: var(--ink-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.learnbar__count[data-finished='true'] {
  color: var(--ink);
  font-weight: 650;
}

/* Where this practice began: a small post on the track. */
.learnbar__from {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 16px;
  margin: -8px 0 0 -1px;
  border-radius: 1px;
  background: var(--ink-2);
  pointer-events: none;
}

.learnbar__switch {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 9px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.learnbar__knob {
  position: relative;
  flex: none;
  width: 32px;
  height: 19px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color 120ms ease;
}

.learnbar__knob::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.3);
  transition: transform 120ms ease;
}

.learnbar__switch[aria-checked='true'] {
  color: var(--ink);
}

.learnbar__switch[aria-checked='true'] .learnbar__knob {
  background: var(--accent);
}

.learnbar__switch[aria-checked='true'] .learnbar__knob::after {
  transform: translateX(13px);
}

.learnbar__switch:disabled {
  opacity: 0.45;
  cursor: default;
}

.learnbar__short {
  display: none;
}

.learnbar__mistakes {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
}

.learnbar__number {
  min-width: 30px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.learnbar__mistakes[data-any='true'] .learnbar__number {
  background: color-mix(in srgb, var(--wrong) 11%, var(--page));
  color: var(--wrong);
}

@media (prefers-reduced-motion: reduce) {
  .learnbar__knob,
  .learnbar__knob::after {
    transition: none;
  }
}

@container stand (max-width: 1440px) {
  .learnbar__long {
    display: none;
  }

  .learnbar__short {
    display: inline;
  }
}

@container stand (max-width: 1150px) {
  .learnbar__restart {
    padding: 9px 11px;
  }

  .learnbar__restart span,
  .learnbar__count {
    display: none;
  }
}

/* With less room the extras go first, keeping space for the position track. */
@container stand (max-width: 1680px) {
  .transport__bpm {
    display: none;
  }
}

@container stand (max-width: 1440px) {
  .transport__time,
  .transport__sound .transport__label,
  .transport__tempo .transport__nudge {
    display: none;
  }
}

@container stand (max-width: 1150px) {
  .transport {
    padding-right: 10px;
  }

  .transport__play {
    min-width: 0;
    padding: 10px 13px;
  }

  .transport__play span,
  .transport .hand-dot {
    display: none;
  }

  .transport__bar {
    min-width: 0;
  }

  .transport__where {
    gap: 9px;
    min-width: 0;
  }

  .transport__percent {
    min-width: 46px;
    padding: 4px 2px;
  }
}

@container stand (max-width: 960px) {
  .transport__label {
    display: none;
  }

  .transport__seg button {
    padding: 5px 9px;
  }
}


/* ── Play mode ─────────────────────────────────────────────────────────────
   One line of music slides under a fixed play line. Orange is "play this
   now", as everywhere else, so the line is orange; a note that was hit goes
   blue and gets a tick; one that was missed goes grey.                      */

/* The play line: fixed in the view, as tall as the staves and a bit more. */
.score__playline {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 0;
  pointer-events: none;
  will-change: transform;
}

.score__playline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -12px;
  width: 24px;
  border-radius: 12px;
  background: linear-gradient(to bottom, rgba(249, 115, 22, 0), rgba(249, 115, 22, 0.13) 14%, rgba(249, 115, 22, 0.13) 86%, rgba(249, 115, 22, 0));
}

.score__playline::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  border-radius: 1px;
  background: var(--next);
}

/* A tick on each note that was hit. It sits on the notehead and travels with it. */
.score__ticks {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* A note given to the other hand (R.H. / L.H.), or a chord to roll: a ring round the notehead
   and a word beside it, in the hand's colour (slate for a roll). */
.score__marks {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.score__mark {
  --ring: #0ea5e9;
  --tag: #0369a1;
  position: absolute; /* its left and top are the middle of the notehead */
  width: 0;
  height: 0;
}

.score__mark[data-kind='left'] {
  --ring: #8b5cf6;
  --tag: #6d28d9;
}

.score__mark[data-kind='roll'] {
  --ring: #94a3b8;
  --tag: #475569;
}

.score__mark::before {
  content: '';
  position: absolute;
  left: calc((var(--w) + 9px) / -2);
  top: calc((var(--h) + 9px) / -2);
  width: calc(var(--w) + 9px);
  height: calc(var(--h) + 9px);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--ring);
}

.score__mark span {
  position: absolute;
  left: calc(var(--w) / 2 + 4px);
  top: calc(var(--h) / 2 + 2px);
  padding: 1px 5px 2px;
  border-radius: 999px;
  background: var(--tag);
  color: #fff;
  font: 700 10.5px/1.2 var(--font-ui);
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 0 0 1.5px #fff;
}

.score__tick {
  position: absolute; /* its left and top are the middle of the notehead */
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  border-radius: 50%;
  background: var(--played);
  box-shadow: 0 0 0 1.5px var(--paper);
  color: #fff;
}

.score__tick svg {
  display: block;
  width: 100%;
  height: 100%;
}

.score__tick.is-fresh {
  animation: tick-pop 380ms cubic-bezier(0.2, 0.9, 0.3, 1.35) both;
}

.score__tick.is-fresh::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--played);
  animation: tick-ring 520ms ease-out both;
}

.score__tick.is-fresh path {
  stroke-dasharray: 14;
  stroke-dashoffset: 14;
  animation: tick-draw 220ms 110ms ease-out forwards;
}

@keyframes tick-pop {
  0% {
    opacity: 0;
    scale: 0.3;
  }

  55% {
    opacity: 1;
    scale: 1.2;
  }

  100% {
    scale: 1;
  }
}

@keyframes tick-ring {
  0% {
    opacity: 0.65;
    scale: 1;
  }

  100% {
    opacity: 0;
    scale: 2.2;
  }
}

@keyframes tick-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* The music before where a run starts is washed out, so the eye goes to where the playing begins. */
.score__veil {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.8) calc(100% - 46px), rgba(255, 255, 255, 0));
  pointer-events: none;
}

/* The paper becomes a band right across the view: the music slides in along it from the right,
   and off it to the left, instead of the page's edge passing under the play line. The band is
   one piece lying behind the paper, a view and more to either side, and it carries the shadow:
   two pieces butted against the paper's ends showed a hair of shadow where they met. The shadow
   is a close one, because the band's edges are near the edges of the view: the page's wide
   shadow would be cut off there and read as a grey bar. */
.score[data-playline='on'] .score__paper {
  isolation: isolate;
  border-radius: 0;
  box-shadow: none;
}

.score[data-playline='on'] .score__paper::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0;
  right: -300vw;
  bottom: 0;
  left: -300vw;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07), 0 5px 12px -6px rgba(15, 23, 42, 0.16);
}

/* Where the band would nearly fill the view, the whole view is paper instead. */
.score[data-playline='on'][data-band='full'] {
  background: var(--paper);
}

.score[data-playline='on'][data-band='full'] .score__paper::before {
  box-shadow: none;
}

/* The clock moves the music here, so there's no scrollbar to drag. */
.score[data-playline='on'] .score__bar {
  display: none;
}

/* In Play mode a click starts from the bar, so the whole bar is the thing to point at. */
.score[data-playline='on'] .score__viewport,
.score[data-playline='on'] .score__viewport.is-over-note {
  cursor: pointer;
}

/* What's shown over the music: the count-in and grades by the line, the score, a hint, the summary. */
.playhud,
.taptest {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.taptest {
  z-index: 4;
}

.playhud {
  pointer-events: none;
}

.playhud__flag {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  padding: 3px 13px 4px;
  translate: -50% 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
  color: var(--ink-2);
  font-size: 19px;
  font-weight: 750;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.playhud__flag[data-tone='perfect'] {
  color: var(--played);
  font-weight: 800;
}

.playhud__flag[data-tone='good'] {
  color: var(--accent-ink);
}

.playhud__flag[data-tone='early'],
.playhud__flag[data-tone='late'] {
  color: var(--amber-ink);
}

.playhud__flag[data-tone^='count'] {
  margin-bottom: 4px;
  padding: 0 12px;
  background: none;
  box-shadow: none;
  color: var(--ink);
  font-size: 50px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.05;
}

.playhud__flag[data-tone='count-strong'] {
  color: var(--next-ink);
}

.playhud__flag.is-shown {
  animation: flag-show 640ms ease-out both;
}

@keyframes flag-show {
  0% {
    opacity: 0;
    scale: 0.9;
    translate: -50% 5px;
  }

  14% {
    opacity: 1;
    scale: 1;
    translate: -50% 0;
  }

  72% {
    opacity: 1;
    translate: -50% 0;
  }

  100% {
    opacity: 0;
    translate: -50% -7px;
  }
}

/* The running score, in the corner. */
/* The running score. It's on the left, over music that has already gone by: the right is where
   the notes to come are read. */
.playhud__score {
  position: absolute;
  top: 14px;
  left: 16px;
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 9px 6px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 22px -14px rgba(15, 23, 42, 0.3);
}

.playhud__stat {
  min-width: 112px;
  padding: 0 14px;
}

.playhud__stat + .playhud__stat {
  border-left: 1px solid var(--line);
}

.playhud__stat dt {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.playhud__stat dd {
  margin: 0;
  color: var(--ink);
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  line-height: 1.12;
  transform-origin: 0 60%;
}

.playhud__stat dd[data-any='true'] {
  color: var(--played);
}

.playhud__stat dd.is-lifted {
  animation: combo-lift 420ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

@keyframes combo-lift {
  0% {
    scale: 1;
  }

  40% {
    scale: 1.22;
  }

  100% {
    scale: 1;
  }
}

.playhud__hint {
  position: absolute;
  right: 0;
  bottom: 18px;
  left: 0;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.taptest__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.taptest__actions .btn {
  padding: 8px 18px;
  font-size: 15px;
}

/* Play mode's controls: the same bar again, with the timing choice and the tap test. */
.playbar__timing {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.playbar__timing svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.playbar__timing:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.playbar__done {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}

.playbar__timing[data-checked='true'] .playbar__done {
  background: var(--held);
}

@container stand (max-width: 1840px) {
  .playbar .learnbar__long {
    display: none;
  }

  .playbar .learnbar__short {
    display: inline;
  }
}

@container stand (max-width: 1620px) {
  .playbar .transport__nudge {
    display: none;
  }
}

@container stand (max-width: 1480px) {
  .playbar .transport__label {
    display: none;
  }
}

@container stand (max-width: 1280px) {
  .playbar .transport__tempo input[type='range'],
  .playbar .hand-dot,
  .playbar .transport__bar {
    display: none;
  }

  .playbar .transport__nudge {
    display: grid;
  }

  .playbar__timing span {
    display: none;
  }

  .playbar__timing {
    padding: 6px 9px;
  }
}

@container stand (max-width: 1280px) {
  .playhud__stat {
    min-width: 84px;
    padding: 0 11px;
  }

  .playhud__stat dt {
    font-size: 12px;
  }

  .playhud__stat dd {
    font-size: 26px;
  }
}

@container stand (max-width: 1040px) {
  .playbar .transport__seg button {
    padding: 5px 8px;
  }

  .playbar .learnbar__short {
    display: none;
  }
}

/* ── The tap test ────────────────────────────────────────────────────────── */

.taptest {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: var(--radius-m);
  background: rgba(241, 245, 249, 0.9);
}

.taptest[hidden],
.playhud[hidden] {
  display: none;
}

.taptest__card {
  width: min(660px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 18px 24px 24px;
  border-radius: 18px;
  background: var(--page);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08), 0 28px 70px -24px rgba(15, 23, 42, 0.42);
}

.taptest__head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}

.taptest__title {
  margin: 0;
  outline: none;
  font-size: 20px;
  font-weight: 780;
}

.taptest__steps {
  display: flex;
  flex: 1;
  gap: 16px;
  margin: 0;
  padding: 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
}

.taptest__steps span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.taptest__steps [data-state='current'] {
  color: var(--ink);
}

.taptest__steps [data-state='current'] span {
  background: var(--ink);
  color: #fff;
}

.taptest__steps [data-state='done'] span {
  background: var(--held);
  color: #fff;
}

.taptest__lead {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.005em;
  line-height: 1.25;
}

.taptest__text {
  max-width: 62ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.5;
}

.taptest__saved {
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.taptest__problem {
  margin: 12px 0 0;
  color: var(--amber-ink);
  font-size: 15px;
  font-weight: 600;
}

.taptest__status {
  margin: 18px 0 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.taptest__pips {
  display: flex;
  gap: 9px;
}

.taptest__pips i {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
}

.taptest__pips i[data-on='true'] {
  border-color: var(--held);
  background: var(--held);
}

/* The screen test: marks slide to a line, the way notes do in Play mode. */
.taptest__lane {
  position: relative;
  height: 92px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--fill);
}

.taptest__strip {
  position: absolute;
  top: 50%;
  left: 0;
  will-change: transform;
}

.taptest__mark {
  position: absolute;
  top: -11px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: var(--ink);
}

.taptest__mark--lead {
  border: 2.5px solid var(--ink-3);
  background: none;
}

.taptest__line {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -1px;
  width: 2px;
  border-radius: 1px;
  background: var(--next);
  will-change: transform;
}

.taptest__line::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--next);
  opacity: 0;
}

.taptest__line.is-flashing::after {
  animation: tap-flash 260ms ease-out both;
}

@keyframes tap-flash {
  0% {
    opacity: 0.9;
    scale: 0.7;
  }

  100% {
    opacity: 0;
    scale: 1.5;
  }
}

/* The result: each tap as a dot, early to the left and late to the right. */
.taptest__chart {
  margin-top: 16px;
}

.taptest__rail {
  position: relative;
  height: 36px;
  border-radius: 9px;
  background: var(--fill);
}

.taptest__zero {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--ink-3);
}

.taptest__typical {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 4px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--played);
}

.taptest__dot {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.5;
}

.taptest__scale {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 12.5px;
}

@media (prefers-reduced-motion: reduce) {
  .score__tick.is-fresh,
  .score__tick.is-fresh::after,
  .score__tick.is-fresh path,
  .playhud__stat dd.is-lifted,
  .taptest__line.is-flashing::after {
    animation: none;
  }

  .score__tick.is-fresh path {
    stroke-dashoffset: 0;
  }

  .playhud__flag.is-shown {
    animation-name: flag-plain;
  }
}

@keyframes flag-plain {
  0%,
  75% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}


/* ── Stars ─────────────────────────────────────────────────────────────────
   One to three for a finished run; gold, the one colour kept for them.       */

.stars {
  display: inline-flex;
  gap: 0.12em;
  vertical-align: -0.12em;
}

.star {
  width: 1em;
  height: 1em;
  flex: none;
  fill: var(--line-strong);
}

.star.is-earned {
  fill: var(--amber);
}

.stars--small {
  font-size: 13px;
}

/* ── Home ──────────────────────────────────────────────────────────────────
   What to practise next, how practice has been going and the piano itself
   along the top; the song library below, filling the rest.                   */

.home {
  display: grid;
  /* (The songs keep room for a row of cards: in a short window the home screen scrolls instead.) */
  grid-template-rows: auto auto auto auto minmax(250px, 1fr);
  gap: clamp(14px, 2.2vh, 24px);
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  container: home / inline-size;
}

.songs__top {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.85fr) minmax(320px, 1fr);
  gap: clamp(12px, 1.2vw, 20px);
  min-width: 0;
}

.nextup,
.practice,
.songs .readouts {
  min-width: 0;
  padding: 18px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--page);
}

.nextup__label,
.practice__label,
.songs .readouts::before {
  margin: 0 0 6px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}

/* Next up. Orange is "play this next" everywhere in the app, so it marks this too: a line
   down the side, like the play line. */
.nextup {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  align-items: center;
  gap: 24px;
  padding-left: 30px;
  overflow: hidden;
}

.nextup::before {
  content: '';
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 14px;
  width: 3px;
  border-radius: 2px;
  background: var(--next);
}

.nextup[data-kind='none']::before {
  background: var(--line-strong);
}

.nextup__title {
  margin: 0;
  font-size: clamp(22px, 2.5cqw, 32px);
  font-weight: 780;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.nextup__why {
  max-width: 34rem;
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.45;
}

.nextup__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.nextup__guide {
  padding: 9px 18px;
  font-size: 16px;
}

.nextup__go {
  padding: 9px 22px;
  font-size: 16px;
}

.nextup__more {
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.6;
}

.nextup__roll {
  align-self: stretch;
  min-height: 96px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--wash);
}

/* A song's opening, drawn small. */
.opening {
  display: block;
  width: 100%;
  height: 100%;
}

.opening__note {
  fill: var(--right-hand);
}

.opening__note--left {
  fill: var(--left-hand);
}

/* Practice: the streak, and the last seven days as seven keys. A day's key fills from the
   bottom with how long was practised, in the green of a key being held. */
.practice {
  display: grid;
  align-content: start;
}

.practice__streak {
  display: flex;
  align-items: baseline;
  gap: 10px;
  line-height: 1;
}

.practice__days {
  font-size: 46px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.practice__unit {
  font-size: 17px;
  font-weight: 650;
}

.practice__words {
  padding: 8px 0 6px;
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.01em;
}

.practice__note {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.4;
}

.practice__week {
  display: flex;
  gap: 5px;
  margin: 14px 0 0;
  padding: 0 0 20px;
  list-style: none;
}

.practice__key {
  position: relative;
  flex: 1 1 0;
  max-width: 34px;
  height: 52px;
  border-radius: 2px 2px 5px 5px;
  background: linear-gradient(#f1f5f9, #ffffff 30%);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.practice__key i {
  position: absolute;
  right: 1px;
  bottom: 1px;
  left: 1px;
  border-radius: 1px 1px 4px 4px;
  background: linear-gradient(#4ade80, var(--held));
}

.practice__key[data-today='true'] {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.practice__key[data-today='true'] i {
  right: 2px;
  bottom: 2px;
  left: 2px;
}

.practice__day {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.practice__key[data-today='true'] .practice__day {
  color: var(--ink);
  font-weight: 800;
}

.practice__totals {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.practice__totals b {
  color: var(--ink);
  font-weight: 700;
}

/* The orchard: the tree practice is growing (drawn by orchard/tree-art.js, cut away below the
   ground to show the seed and the roots), what it needs to grow on, and the trees grown so far
   standing on one strip of ground. Green is "growing" here, as it's "held" on the keys. */
.orchard {
  display: grid;
  grid-template-columns: auto minmax(250px, 0.95fr) minmax(0, 1.7fr);
  align-items: stretch;
  gap: clamp(16px, 1.6vw, 28px);
  min-width: 0;
  padding: 12px 20px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--page);
}

.orchard__plot {
  width: clamp(150px, 14cqw, 212px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--orchard-sky);
}

.orchard__plot svg,
.orchard__tree svg {
  display: block;
  width: 100%;
  height: 100%;
}

.orchard__about {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 4px 0;
}

.orchard__label {
  margin: 0 0 6px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}

.orchard__title {
  margin: 0;
  font-size: clamp(21px, 2.1cqw, 27px);
  font-weight: 780;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.orchard__stage {
  margin: 5px 0 0;
  color: var(--held-ink);
  font-size: 15px;
  font-weight: 700;
}

.orchard__bar {
  position: relative;
  height: 8px;
  margin: 12px 0 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fill);
}

.orchard__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 4px;
  background: var(--held);
  transition: width 700ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

/* Where each stage begins. */
.orchard__tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--page);
}

.orchard__next {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.4;
}

.orchard__boost {
  margin: 4px 0 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.4;
}

.orchard__boost[data-on='true'] {
  color: var(--amber-ink);
  font-weight: 650;
}

.orchard__news {
  margin: 10px 0 0;
  padding: 7px 11px;
  border-radius: var(--radius-s);
  background: var(--held-wash);
  color: var(--held-ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.orchard__how {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.4;
}

.orchard__grove {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 4px;
}

.orchard__count {
  margin-left: 4px;
  color: var(--ink-3);
  font-weight: 600;
}

/* The trees stand on one strip of ground: the grass line and the soil are drawn here, and each
   tree is drawn with its foot on the grass line (86% down its own picture). */
.orchard__row {
  --tree-h: 150px;
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  height: var(--tree-h);
  margin: auto 0 0;
  padding: 0 10px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 10px;
  background: linear-gradient(to bottom, var(--orchard-sky) 85.5%, var(--grass) 85.5%, var(--grass) 87%, var(--soil) 87%);
  list-style: none;
  scrollbar-width: thin;
}

.orchard__tree {
  flex: 0 0 auto;
  height: 100%;
  aspect-ratio: 104 / 120;
  margin-right: 1%;
}

.orchard__tree svg {
  overflow: visible;
}

/* Just planted: it grows up out of the ground. */
.orchard__tree.is-new {
  transform-origin: 50% 86%;
  animation: orchard-plant 900ms cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
}

@keyframes orchard-plant {
  from {
    transform: scale(0.2);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orchard__tree.is-new {
    animation: none;
  }

  .orchard__fill {
    transition: none;
  }
}

.orchard__later {
  flex: 0 0 auto;
  align-self: center;
  max-width: 300px;
  margin: 0 0 18px 22px;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.4;
}

.orchard__later:first-child {
  margin-left: 12px;
}

/* The piano itself: the last note and the pedals, small. (The same readout as before the
   home screen existed; it used to have the whole space above the keys.) */
.songs .readouts {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: start;
  gap: 0 18px;
}

.songs .readouts::before {
  content: 'Your piano';
  grid-column: 1 / -1;
}

.songs .now__prompt {
  font-size: 21px;
  font-weight: 650;
  color: var(--ink);
}

.songs .now__hint {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.45;
}

.songs .now__note {
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
}

.songs .now__name {
  font-size: 68px;
  line-height: 0.9;
}

.songs .now__detail {
  flex: 1 1 0;
  padding-bottom: 0;
}

.songs .velocity {
  grid-template-columns: minmax(40px, 1fr) 3ch;
  gap: 8px;
}

.songs .velocity__label {
  display: none;
}

.songs .velocity__track {
  height: 8px;
}

.songs .velocity__value {
  font-size: 19px;
}

.songs .now__line {
  margin-top: 3px;
  font-size: 13.5px;
}

.songs .chord {
  gap: 2px;
  margin-top: 10px;
}

.songs .chord__row {
  gap: 8px;
  min-height: 26px;
}

.songs .chord__label {
  width: auto;
  font-size: 13px;
}

.songs .chip {
  padding: 1px 7px;
  font-size: 13.5px;
}

.songs .pedals {
  align-self: end;
  gap: 4px;
}

.songs .pedal {
  width: 62px;
}

.songs .pedal__track {
  width: 24px;
  height: 64px;
  border-radius: 12px 12px 6px 6px;
}

.songs .pedal__value {
  margin-top: 5px;
  font-size: 14px;
}

.songs .pedal__name {
  font-size: 12px;
  font-weight: 650;
}

.songs .pedal__state {
  display: none;
}

/* The library. */
.library {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.library__head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 2px 12px;
}

.library__title {
  margin: 0 8px 0 0;
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.library__count {
  margin-left: 4px;
  color: var(--ink-3);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.library__search {
  width: min(300px, 32cqw);
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.library__search:focus,
.library__sort select:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 0;
}

.library__sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 14px;
}

.library__sort select {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
}

.library__folder {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 7px 13px;
  white-space: nowrap;
}

.library__folder svg {
  width: 17px;
  height: 17px;
}

.library__problem {
  margin: 0 2px 12px;
  padding: 8px 12px;
  border-radius: var(--radius-s);
  background: #fef3c7;
  color: #78350f;
  font-size: 14.5px;
}

.library__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(228px, 12.5cqw, 300px), 1fr));
  align-content: start;
  gap: 14px;
  min-height: 0;
  margin: 0;
  padding: 2px 8px 14px 2px;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.library__grid > li {
  display: grid;
  min-width: 0;
}

.library__empty {
  margin: 8px 2px;
  color: var(--ink-2);
  font-size: 16px;
}

.library__add {
  align-content: center;
  min-height: 150px;
  padding: 16px 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--ink-2);
}

.library__add-title {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.library__add-how {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.4;
}

/* (the website only: choose files with the browser's Open box) */
.library__add-choose {
  justify-self: start;
  margin-top: 10px;
}

/* A song. */
.card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  min-width: 0;
  padding: 0 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    translate 120ms ease-out,
    box-shadow 120ms ease-out,
    border-color 120ms ease-out;
}

.card > span {
  display: block;
  min-width: 0;
  padding: 0 14px;
}

.card:hover:not(:disabled) {
  translate: 0 -2px;
  border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 26px -14px rgba(15, 23, 42, 0.28);
}

.card:focus-visible {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 1px;
}

.card:disabled {
  color: var(--ink-2);
  cursor: default;
}

/* (A card out of sight in a long library doesn't lay out or paint its picture.) */
.card > .card__roll {
  height: 62px;
  margin-bottom: 11px;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: var(--wash);
  content-visibility: auto;
  contain-intrinsic-size: auto 62px;
}

.card__title {
  display: -webkit-box !important;
  overflow: hidden;
  font-size: 16.5px;
  font-weight: 730;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card__by {
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card > .card__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.card__format {
  padding: 0 6px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.5;
}

.card__length {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.card > .card__best {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
}

.card__mode {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.card__new {
  color: var(--ink-3);
}

.card > .card__resume {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--page);
  box-shadow: 0 0 0 1px var(--line-strong);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
}

@container home (max-width: 1240px) {
  .songs__top {
    grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr);
  }

  .songs .readouts {
    display: none;
  }
}

@container home (max-width: 1240px) {
  .orchard {
    grid-template-columns: auto minmax(230px, 1fr) minmax(0, 1.1fr);
  }

  .orchard__how {
    display: none;
  }
}

@container home (max-width: 860px) {
  .orchard {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .orchard__grove {
    display: none;
  }

  .nextup {
    grid-template-columns: minmax(0, 1fr);
  }

  .nextup__roll,
  .library__sort span {
    display: none;
  }
}

@container home (max-width: 700px) {
  .songs__top {
    grid-template-columns: minmax(0, 1fr);
  }

  .practice {
    display: none;
  }
}

/* A short window: the top row gives height back to the songs. */
@media (max-height: 960px) {
  .nextup,
  .practice,
  .songs .readouts {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .nextup::before {
    top: 14px;
    bottom: 14px;
  }

  .nextup__actions {
    margin-top: 12px;
  }

  .nextup__more {
    margin-top: 10px;
  }

  .nextup__roll {
    min-height: 72px;
  }

  .practice__days {
    font-size: 38px;
  }

  .practice__week {
    margin-top: 10px;
  }

  .practice__key {
    height: 40px;
  }

  .orchard {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .orchard__plot {
    width: clamp(130px, 11cqw, 160px);
  }

  .orchard__row {
    --tree-h: 124px;
  }

  .orchard__how {
    display: none;
  }

  .songs .pedal__track {
    height: 48px;
  }
}

@media (max-height: 760px) {
  .nextup__more,
  .practice__note,
  .orchard__boost {
    display: none;
  }

  .orchard__plot {
    width: 112px;
  }

  .orchard__row {
    --tree-h: 96px;
  }
}

/* ── The song page: its best scores, and carrying on ───────────────────── */

.stand__best {
  display: inline-flex;
  margin-left: 1px;
}

.stand__resume {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 8px 16px;
  border-radius: var(--radius-m);
  background: var(--right-wash);
  color: var(--ink);
}

.stand__resume-text {
  margin: 0 auto 0 0;
  font-size: 15.5px;
}

.stand__resume .btn {
  padding: 6px 16px;
  font-size: 15px;
}

.stand__resume-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.stand__resume-close:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.stand__resume-close svg {
  width: 18px;
  height: 18px;
}

@container stand (max-width: 1340px) {
  .stand__best {
    display: none;
  }
}

/* ── Results ───────────────────────────────────────────────────────────────
   How a run went, laid over the music it was played from.                    */

.results {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: var(--radius-m);
  background: rgba(248, 250, 252, 0.74);
  /* (How much room there is decides how the card is laid out: see the end of this section.) */
  container: results / size;
}

.results[hidden] {
  display: none;
}

.results__card {
  width: min(880px, 100%);
  max-height: 100%;
  padding: 22px 28px 0;
  overflow: auto;
  border-radius: 18px;
  background: var(--page);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08), 0 28px 70px -24px rgba(15, 23, 42, 0.42);
  scrollbar-width: thin;
}

.results__card.is-in {
  animation: results-in 260ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

@keyframes results-in {
  from {
    opacity: 0;
    scale: 0.97;
  }
}

.results__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.results__title {
  margin: 0;
  font-size: 26px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.results__facts {
  margin: 3px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.results__score {
  display: flex;
  align-items: center;
  flex: none;
  gap: 22px;
}

.results__stars {
  gap: 5px;
  font-size: 38px;
}

.results__card.is-in .results__stars .star.is-earned {
  animation: star-in 420ms cubic-bezier(0.2, 0.9, 0.3, 1.5) both;
}

.results__card.is-in .results__stars .star.is-earned:nth-child(1) {
  animation-delay: 180ms;
}

.results__card.is-in .results__stars .star.is-earned:nth-child(2) {
  animation-delay: 360ms;
}

.results__card.is-in .results__stars .star.is-earned:nth-child(3) {
  animation-delay: 540ms;
}

@keyframes star-in {
  from {
    fill: var(--line-strong);
    scale: 0.4;
  }

  60% {
    scale: 1.25;
  }
}

.results__big {
  margin: 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 0.9;
  white-space: nowrap;
}

.results__percent {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.results__unit {
  margin-left: 2px;
  color: var(--ink-2);
  font-size: 26px;
  font-weight: 700;
}

.results__notes {
  margin-top: 8px;
}

.results__notes:empty {
  display: none;
}

.results__note,
.results__best {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.results__best {
  color: var(--amber-ink);
  font-weight: 700;
}

.results__went {
  margin-top: 14px;
}

.results__split {
  display: flex;
  gap: 2px;
  height: 12px;
  margin: 0 0 10px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--fill);
}

.results__split i {
  min-width: 3px;
}

.results__split [data-grade='perfect'],
.results__grades [data-grade='perfect']::before,
.results__col[data-zone='perfect'] {
  background: var(--played);
  fill: var(--played);
}

.results__split [data-grade='good'],
.results__grades [data-grade='good']::before,
.results__col[data-zone='good'] {
  background: #7dd3fc;
  fill: #7dd3fc;
}

.results__split [data-grade='early'],
.results__grades [data-grade='early']::before,
.results__col[data-zone='early'] {
  background: #fbbf24;
  fill: #fbbf24;
}

.results__split [data-grade='late'],
.results__grades [data-grade='late']::before,
.results__col[data-zone='late'] {
  background: #d97706;
  fill: #d97706;
}

.results__split [data-grade='missed'],
.results__grades [data-grade='missed']::before {
  background: var(--missed);
}

.results__grades {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0 0 8px;
  padding: 0;
  color: var(--ink-2);
  font-size: 14px;
  list-style: none;
}

.results__grades li::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 2px;
}

.results__grades b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.results__grades [data-none='true'] {
  opacity: 0.5;
}

.results__more {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

/* Each hand's own score. */
.results__hands {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 12px;
}

.results__hand-name {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
}

.results__meter {
  display: block;
  height: 8px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fill);
}

.results__meter i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--right-hand);
}

.results__hand[data-hand='left'] .results__meter i {
  background: var(--left-hand);
}

/* The two charts. */
.results__charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px 26px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.results__chart {
  min-width: 0;
  margin: 0;
}

.results__chart-title {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
}

.results__svg {
  display: block;
  width: 100%;
  height: 84px;
  overflow: visible;
}

/* Each column is as wide as its share of the chart; a stroke the colour of the card makes the gaps. */
.results__col {
  stroke: var(--page);
  stroke-width: 3px;
  paint-order: stroke;
}

.results__svg[data-close='true'] .results__col {
  stroke-width: 1.5px;
}

.results__col[data-empty='true'],
.results__col[data-zone='clear'] {
  fill: var(--line-strong);
}

.results__col[data-zone='some'] {
  fill: #fbbf24;
}

.results__col[data-zone='hot'] {
  fill: var(--wrong);
}

.results__centre {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.results__median {
  stroke: var(--ink);
  stroke-width: 3.5px;
  stroke-linecap: round;
}

.results__hit {
  fill: transparent;
  cursor: pointer;
}

.results__hit:hover {
  fill: rgba(14, 165, 233, 0.1);
}

.results__scale {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 12.5px;
}

.results__chart-note {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 14.5px;
}

/* What to do next stays in reach at the foot of the card, whatever has to scroll above it. */
.results__actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  padding: 12px 0 20px;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0), var(--page) 10px);
}

.results__actions .btn {
  padding: 8px 18px;
  font-size: 15px;
}

/* What the run did for the tree: a small picture of it growing, and a sentence. */
.results__growth {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 8px 12px 8px 8px;
  border-radius: 10px;
  background: var(--held-wash);
}

.results__tree {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--orchard-sky);
}

.results__tree svg {
  display: block;
  width: 100%;
  height: 100%;
}

.results__grew {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.4;
}

.results__grew b {
  color: var(--held-ink);
  font-weight: 750;
}

@container stand (max-width: 760px) {
  .results__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .results__stars {
    font-size: 30px;
  }

  .results__percent {
    font-size: 48px;
  }
}

/* With less height (a smaller window, or the keyboard taking its share) the card closes up so
   that it still fits whole: smaller numbers, the two notes on one line, shorter charts with
   what each one found beside its title. (The heights are the room inside the padding: the
   card is about 545px tall at full size and about 415px closed up.) */
@container results (max-height: 548px) {
  .results__card {
    padding-top: 14px;
  }

  .results__head {
    gap: 16px;
  }

  .results__title {
    font-size: 22px;
  }

  .results__stars {
    font-size: 30px;
  }

  .results__percent {
    font-size: 50px;
  }

  .results__unit {
    font-size: 21px;
  }

  .results__notes {
    display: flex;
    flex-wrap: wrap;
    column-gap: 16px;
    margin-top: 5px;
  }

  .results__went {
    margin-top: 10px;
  }

  .results__split {
    margin-bottom: 7px;
  }

  .results__hands {
    margin-top: 8px;
  }

  .results__charts {
    margin-top: 10px;
    padding-top: 10px;
  }

  .results__chart {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 14px;
    align-items: baseline;
  }

  .results__chart-title {
    grid-area: 1 / 1;
    margin-bottom: 4px;
  }

  .results__chart-note {
    grid-area: 1 / 2;
    margin: 0;
    color: var(--ink-2);
    font-size: 13.5px;
    text-align: right;
  }

  .results__svg,
  .results__scale {
    grid-column: 1 / -1;
  }

  .results__svg {
    height: 62px;
  }

  .results__actions {
    margin-top: 0;
    padding: 10px 0 14px;
  }
}

@container results (max-height: 414px) {
  .results__svg {
    height: 38px;
  }

  .results__tree {
    display: none;
  }

  .results__growth {
    margin-top: 8px;
    padding: 6px 10px;
  }

  .results__facts {
    font-size: 13.5px;
  }

  .results__actions .btn {
    padding: 6px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .results__card.is-in,
  .results__card.is-in .results__stars .star.is-earned {
    animation: none;
  }

  .card {
    transition: none;
  }
}

/* ── Practice tools: the metronome and loop buttons ─────────────────────────
   At the end of each mode's bar of controls. The metronome lights with each
   click; the loop is amber wherever it shows (the button, the band over the
   bars, the mark on the track, the strip under the controls).               */

.transport__practice {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.practice__button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--page);
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.practice__button svg {
  width: 20px;
  height: 20px;
}

.practice__button:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.practice__button--metronome[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
}

.practice__button--loop[data-loop='on'],
.practice__button--loop[data-loop='picking'] {
  border-color: var(--amber);
  background: #fffbeb;
  color: var(--amber-ink);
}

.practice__button--loop[data-loop='picking'] {
  animation: picking-ring 1.2s ease-in-out infinite;
}

@keyframes picking-ring {
  50% {
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.28);
  }
}

/* The loop's bars on a bar of controls' track. */
.transport__loop {
  position: absolute;
  top: 50%;
  height: 16px;
  margin-top: -8px;
  border-radius: 5px;
  background: rgba(245, 158, 11, 0.16);
  box-shadow: inset 0 0 0 1.5px rgba(245, 158, 11, 0.8);
  pointer-events: none;
}

/* Learn mode's tempo, which the metronome and the other hand go at. */
@container stand (max-width: 1840px) {
  .learnbar__tempo .transport__nudge {
    display: none;
  }
}

@container stand (max-width: 1560px) {
  .learnbar__tempo .transport__label {
    display: none;
  }
}

@container stand (max-width: 1300px) {
  .learnbar__tempo input[type='range'] {
    display: none;
  }

  .learnbar__tempo .transport__nudge {
    display: grid;
  }
}

@container stand (max-width: 1100px) {
  .practice__button {
    width: 34px;
    height: 34px;
  }
}

/* ── The loop strip ──────────────────────────────────────────────────────── */

.stand__loop {
  flex: none;
  min-width: 0;
}

.loopstrip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 7px 10px 7px 10px;
  border: 1px solid #fde68a;
  border-radius: var(--radius-m);
  background: #fffbeb;
  font-size: 14.5px;
  animation: bar-in 200ms ease-out backwards;
}

.loopstrip[hidden] {
  display: none;
}

.loopstrip__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
}

.loopstrip__icon svg {
  width: 18px;
  height: 18px;
}

.loopstrip__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 750;
  white-space: nowrap;
}

.loopstrip__text {
  flex: 1 1 280px;
  margin: 0;
  color: var(--ink-2);
}

.loopstrip__text strong {
  color: var(--ink);
}

.loopstrip__setting {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.loopstrip__label {
  color: var(--ink-2);
  font-size: 13.5px;
}

.loopstrip__select {
  padding: 3px 6px;
  border: 1px solid #fcd34d;
  border-radius: 7px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.loopstrip__switch {
  padding: 2px 0;
}

.loopstrip__switch[aria-checked='true'] .learnbar__knob {
  background: var(--amber);
}

.loopstrip__progress {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.loopstrip__dots {
  display: inline-flex;
  gap: 4px;
}

.loopstrip__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--held);
}

.loopstrip__dots i[data-clean='false'] {
  background: transparent;
  box-shadow: inset 0 0 0 2px #f87171;
}

.loopstrip__dots i:last-child {
  animation: dot-in 300ms cubic-bezier(0.2, 0.9, 0.3, 1.4) backwards;
}

@keyframes dot-in {
  from {
    scale: 0.2;
  }
}

.loopstrip__status {
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
}

.loopstrip__meter {
  display: block;
  flex: none;
  width: 90px;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #fde68a;
}

.loopstrip__meter i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--amber);
  transition: width 400ms ease;
}

.loopstrip__buttons {
  display: flex;
  flex: none;
  gap: 6px;
  margin-left: auto;
}

/* Reached the target: green, with a tick that pops in and a shine across the strip. */
.loopstrip[data-state='done'] {
  border-color: var(--held-line);
  background: var(--held-wash);
}

.loopstrip[data-state='done'] .loopstrip__icon {
  background: var(--held);
}

.loopstrip__badge {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--held);
  color: #fff;
}

.loopstrip__badge svg {
  width: 16px;
  height: 16px;
}

.loopstrip.is-done {
  position: relative;
  overflow: hidden;
}

.loopstrip.is-done .loopstrip__badge {
  animation: badge-pop 520ms cubic-bezier(0.2, 0.9, 0.3, 1.5) backwards;
}

.loopstrip.is-done::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.85) 50%, transparent 70%);
  translate: -100% 0;
  animation: shine 900ms 120ms ease-out backwards;
  pointer-events: none;
}

@keyframes badge-pop {
  from {
    scale: 0;
  }

  60% {
    scale: 1.3;
  }
}

@keyframes shine {
  to {
    translate: 100% 0;
  }
}

/* ── Loops on the sheet music ──────────────────────────────────────────────── */

.score__loop {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.score__loop-band {
  position: absolute;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.09);
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.6);
}

.score__loop-band.is-first::before {
  content: 'Loop';
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--amber);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

/* While the bars are being picked, the band follows the pointer, dashed. */
.score__loop[data-picking='true'] .score__loop-band {
  background: rgba(245, 158, 11, 0.13);
  box-shadow: none;
  outline: 2px dashed rgba(217, 119, 6, 0.85);
  outline-offset: -2px;
}

.score__loop[data-picking='true'] .score__loop-band.is-first::before {
  content: 'Loop these';
}

.score[data-looppick='on'] .score__viewport,
.score[data-looppick='on'] .score__viewport.is-over-note {
  cursor: crosshair;
}

.score.is-picking .score__viewport {
  cursor: col-resize;
}

/* ── The clefs and key kept in view on Play mode's line ─────────────────────
   A strip of the line's own start, at the left edge, that the music slides
   under; its right edge fades into the music.                               */

.score__sticky {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  background: var(--paper);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
  will-change: transform;
  animation: sticky-in 180ms ease-out backwards;
}

.score__sticky svg {
  display: block;
}

.score__sticky-lines {
  fill: none;
  stroke: #000;
  stroke-width: 1;
}

@keyframes sticky-in {
  from {
    opacity: 0;
  }
}

/* ── Play mode: sheet music or falling notes ──────────────────────────────── */

.stand__view {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
}

.stand__view[hidden] {
  display: none;
}

.stand__view button {
  padding: 5px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.stand__view button:hover {
  color: var(--ink);
}

.stand__view button[aria-checked='true'] {
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(15, 23, 42, 0.08);
}

.stand[data-shows='falling'] .stand__tools > :not(.stand__view, .stand__band) {
  display: none;
}

.stand__body[data-shows='falling'] .stand__score {
  visibility: hidden;
}

.stand__falling {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.falling {
  overflow: hidden;
  border-radius: var(--radius-m);
  background: #0b1220;
  animation: falling-in 220ms ease-out backwards;
}

.falling[hidden] {
  display: none;
}

.falling__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.falling__line {
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 0;
}

.falling__anchor {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 0;
}

.falling .playhud__flag {
  margin-bottom: 14px;
}

.falling .playhud__flag[data-tone^='count'] {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.falling .playhud__flag[data-tone='count-strong'] {
  color: #fdba74;
}

@keyframes falling-in {
  from {
    opacity: 0;
  }
}

/* A loop's pass: clean, or once more. */
.playhud__flag[data-tone='clean'] {
  color: var(--held-ink);
  font-weight: 800;
}

.playhud__flag[data-tone='again'] {
  color: var(--amber-ink);
}

/* ── Colours by hand ───────────────────────────────────────────────────────
   Chosen in Settings: the notes to play next are in their hand's colour
   (sky blue right, violet left) instead of orange, and turn green once
   played. In Listen the notes take the colour of the hand playing them.    */

html[data-scheme='hand'] .score__music [data-state='next'][data-hand='right'] path {
  fill: var(--right-hand);
}

html[data-scheme='hand'] .score__music [data-state='next'][data-hand='left'] path {
  fill: var(--left-hand);
}

html[data-scheme='hand'] .score__music [data-state='played'] path {
  fill: #16a34a;
}

html[data-scheme='hand'] .stand[data-current='listen'] .score__music [data-state='played'][data-hand='right'] path {
  fill: var(--right-hand);
}

html[data-scheme='hand'] .stand[data-current='listen'] .score__music [data-state='played'][data-hand='left'] path {
  fill: var(--left-hand);
}

html[data-scheme='hand'] .score__names text.hollow[data-state='next'][data-hand='right'] {
  fill: var(--right-ink);
}

html[data-scheme='hand'] .score__names text.hollow[data-state='next'][data-hand='left'] {
  fill: var(--left-ink);
}

html[data-scheme='hand'] .score__names text.hollow[data-state='played'] {
  fill: #15803d;
}

html[data-scheme='hand'] .score__tick {
  background: #16a34a;
}

html[data-scheme='hand'] .score__cursor {
  background: rgba(100, 116, 139, 0.1);
  box-shadow: inset 0 0 0 1.5px rgba(71, 85, 105, 0.45);
}

/* By hand there's no orange for "next": the words under the step take the band's slate. */
html[data-scheme='hand'] .score__cue {
  background: #334155;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16), 0 3px 10px rgba(15, 23, 42, 0.16);
}

/* ── Settings ──────────────────────────────────────────────────────────── */

.btn--gear {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  color: var(--ink-2);
}

.btn--gear svg {
  width: 20px;
  height: 20px;
}

.btn--gear:hover {
  color: var(--ink);
}

.settings,
.guide {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.settings[hidden],
.guide[hidden] {
  display: none;
}

.settings__backdrop,
.guide__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  animation: backdrop-in 180ms ease-out backwards;
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}

.settings__card,
.guide__card {
  position: relative;
  width: min(860px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 0 30px 26px;
  border-radius: 18px;
  background: var(--page);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08), 0 30px 80px -24px rgba(15, 23, 42, 0.5);
  scrollbar-width: thin;
}

.settings__card.is-in,
.guide__card.is-in {
  animation: settings-in 240ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}

@keyframes settings-in {
  from {
    opacity: 0;
    scale: 0.97;
    translate: 0 6px;
  }
}

.settings__head,
.guide__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 12px;
  background: linear-gradient(var(--page) 82%, rgb(255 255 255 / 0));
}

.settings__title,
.guide__heading-main {
  margin: 0;
  font-size: 26px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.settings__close,
.guide__close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.settings__close svg,
.guide__close svg {
  width: 20px;
  height: 20px;
}

.settings__close:hover,
.guide__close:hover {
  border-color: var(--line);
  background: var(--fill);
  color: var(--ink);
}

.settings__section {
  padding: 18px 0 14px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 70px;
}

.settings__section-title {
  margin: 0;
  font-size: 17.5px;
  font-weight: 730;
}

.settings__about {
  max-width: 62ch;
  margin: 4px 0 12px;
  color: var(--ink-2);
  font-size: 14.5px;
}

.settings__schemes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.settings__scheme {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--wash);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.settings__scheme:hover {
  border-color: var(--line-strong);
}

.settings__scheme[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--page);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.settings__preview {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 9px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.settings__staffline {
  stroke: #94a3b8;
  stroke-width: 1;
}

.settings__stem {
  stroke: #1e293b;
  stroke-width: 1.4;
}

.settings__key {
  stroke: #94a3b8;
  stroke-width: 0.8;
}

.settings__scheme-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 730;
}

.settings__scheme[aria-checked='true'] .settings__scheme-name::after {
  content: 'In use';
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--right-wash);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
}

.settings__scheme-about {
  display: block;
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 14px;
}

.settings__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 7px 0;
}

.settings__label {
  font-size: 15px;
  font-weight: 600;
}

.settings__seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
}

.settings__seg button {
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.settings__seg button:hover:not(:disabled) {
  color: var(--ink);
}

.settings__seg button[aria-checked='true'] {
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(15, 23, 42, 0.08);
}

.settings__seg button:disabled {
  opacity: 0.45;
  cursor: default;
}

.settings__keys {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.settings__keys th {
  padding: 6px 18px 6px 0;
  font-weight: 400;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.settings__keys td {
  padding: 6px 0;
  color: var(--ink-2);
}

.settings__keys tr + tr {
  border-top: 1px solid var(--fill);
}

.settings__keys kbd {
  display: inline-block;
  min-width: 26px;
  margin-right: 4px;
  padding: 1px 7px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--wash);
  color: var(--ink);
  font: 600 13px/1.6 var(--font-mono);
  text-align: center;
}

.settings__plus {
  margin: 0 5px 0 1px;
  color: var(--ink-3);
}

/* ── Moving between screens, and the results arriving ───────────────────── */

.app.song-open .stand {
  animation: screen-in 240ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}

.app:not(.song-open) .tabpanel,
.app.course-open .course {
  animation: screen-in 240ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}

@keyframes screen-in {
  from {
    opacity: 0;
    translate: 0 10px;
  }
}

.stand__transport:not([hidden]) {
  animation: bar-in 200ms ease-out backwards;
}

@keyframes bar-in {
  from {
    opacity: 0;
    translate: 0 -4px;
  }
}

/* The results: the columns grow up from the line, the split fills from the left. */
.results__card.is-in .results__col {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: col-grow 560ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
  animation-delay: calc(260ms + var(--i, 0) * 14ms);
}

.results__card.is-in .results__split i,
.results__card.is-in .results__meter i {
  transform-origin: 0 50%;
  animation: split-grow 620ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
  animation-delay: calc(200ms + var(--i, 0) * 70ms);
}

@keyframes col-grow {
  from {
    transform: scaleY(0);
  }
}

@keyframes split-grow {
  from {
    transform: scaleX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app.song-open .stand,
  .app:not(.song-open) .tabpanel,
  .app.course-open .course,
  .stand__transport:not([hidden]),
  .loopstrip,
  .loopstrip.is-done::after,
  .loopstrip.is-done .loopstrip__badge,
  .loopstrip__dots i:last-child,
  .falling,
  .score__sticky,
  .settings__card.is-in,
  .guide__card.is-in,
  .settings__backdrop,
  .practice__button--loop[data-loop='picking'],
  .results__card.is-in .results__col,
  .results__card.is-in .results__split i,
  .results__card.is-in .results__meter i {
    animation: none;
  }
}

/* ── Stage 10: the piano went away mid-song ─────────────────────────────── */

.stand__away {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  border-radius: var(--radius-m);
  background: #fef3c7;
  color: #78350f;
  animation: bar-in 220ms ease-out backwards;
}

.stand__away-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--amber);
  color: #ffffff;
}

.stand__away-icon svg {
  width: 18px;
  height: 18px;
}

.stand__away-text {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
}

/* ── Stage 10: settings, your progress ──────────────────────────────────── */

.settings__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings__confirm {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-m);
  background: #fef3c7;
  color: #78350f;
}

.settings__confirm[hidden] {
  display: none;
}

.settings__question {
  max-width: 62ch;
  margin: 0;
  font-size: 15px;
}

.settings__status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.settings__status[data-tone='ok'] {
  color: var(--held-ink);
}

.settings__status[data-tone='problem'],
.settings__status--problem {
  color: var(--wrong);
}

.settings__status[hidden] {
  display: none;
}

/* ── Stage 10: the guide ────────────────────────────────────────────────── */

.guide__card {
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  height: min(660px, 100%); /* the same for every page, so it doesn't jump */
  overflow: hidden;
}

.guide__body {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  min-height: 0;
  padding-top: 8px;
}

.guide__nav {
  display: grid;
  align-content: start;
  gap: 2px;
}

.guide__tab {
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.guide__tab:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.guide__tab[aria-current='true'] {
  background: var(--right-wash);
  color: var(--right-ink);
  font-weight: 700;
}

.guide__page {
  max-width: 64ch;
  min-height: 0;
  overflow: auto;
  outline: none;
  scrollbar-width: thin;
}

.guide__title {
  margin: 4px 0 14px;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.guide__heading {
  margin: 18px 0 4px;
  font-size: 16.5px;
}

.guide__text,
.guide__list {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.55;
}

.guide__list {
  padding-left: 1.2em;
}

.guide__list li + li {
  margin-top: 6px;
}

.guide__page kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.86em;
  text-align: center;
}

.guide__next {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .guide__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .guide__nav {
    grid-auto-flow: column;
    overflow-x: auto;
  }
}


/* ── XP and levels ─────────────────────────────────────────────────────────
   The level bar fills in gold, in ten segments; rest still to come shows as
   pale gold stripes ahead of the fill. At a tenth level the full bar waits,
   shimmering, for the exam.                                                  */

.xpbar {
  --xpbar-h: 10px;
  position: relative;
  display: block;
  height: var(--xpbar-h);
  overflow: hidden;
  border-radius: calc(var(--xpbar-h) / 2);
  background: var(--fill);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.xpbar > i {
  position: absolute;
  top: 0;
  bottom: 0;
}

.xpbar__fill {
  left: 0;
  border-radius: inherit;
  background: linear-gradient(to bottom, var(--xp-2), var(--xp));
  transition: width 700ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

.xpbar__rested {
  background: repeating-linear-gradient(135deg, var(--xp-pale) 0 5px, var(--xp-wash) 5px 10px);
  transition:
    left 700ms cubic-bezier(0.3, 0.7, 0.3, 1),
    width 700ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

.xpbar__bank {
  display: none;
}

.xpbar__tick {
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.85);
}

.xpbar[data-gated='true'] .xpbar__fill {
  background: linear-gradient(100deg, var(--xp) 0%, var(--xp-2) 40%, #fef3c7 50%, var(--xp-2) 60%, var(--xp) 100%) 0 0 / 220% 100%;
  animation: xp-shimmer 2.6s linear infinite;
}

@keyframes xp-shimmer {
  from {
    background-position: 110% 0;
  }
  to {
    background-position: -110% 0;
  }
}

.xpbar--pill {
  --xpbar-h: 6px;
  width: clamp(70px, 7vw, 130px);
}

.xpbar--card {
  --xpbar-h: 12px;
}

.xpbar--course {
  --xpbar-h: 14px;
}

.xpbar--results {
  --xpbar-h: 9px;
}

/* The level badge: a gold disc with the level on it. */
.levelpill__badge,
.coursecard__badge,
.course__badge,
.levelup__badge {
  display: grid;
  place-content: center;
  justify-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fde68a, var(--xp) 58%, var(--xp-deep));
  box-shadow:
    inset 0 -2px 0 rgba(146, 64, 14, 0.22),
    0 1px 2px rgba(146, 64, 14, 0.25);
  color: #fff;
  text-shadow: 0 1px 1px rgba(146, 64, 14, 0.45);
  line-height: 1;
}

/* The level in the top bar. */
.levelpill {
  position: relative;
  flex: none;
}

.levelpill__button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 3px 14px 3px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  cursor: pointer;
}

.levelpill__button:hover {
  border-color: var(--xp-line);
  background: var(--xp-wash);
}

.levelpill__badge {
  width: 30px;
  height: 30px;
}

.levelpill__word {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.levelpill__number {
  font-size: 14.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.levelpill__words {
  min-width: 5.5ch;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.levelpill[data-gated='true'] .levelpill__words {
  color: var(--xp-ink);
}

.levelpill[data-rested='true'] .levelpill__badge {
  box-shadow:
    0 0 0 2px var(--page),
    0 0 0 4px var(--xp-pale);
}

.levelpill__button.is-levelling .levelpill__badge {
  animation: badge-pop 900ms cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

@keyframes badge-pop {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 var(--xp-glow);
  }
  35% {
    transform: scale(1.28);
    box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(1);
  }
}

.levelpill__floats {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  z-index: 30;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.levelpill__float {
  grid-area: 1 / 1;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--xp-wash);
  box-shadow: 0 0 0 1px var(--xp-line);
  color: var(--xp-ink);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  animation: xp-float 1500ms ease-out forwards;
}

.levelpill__float--up {
  background: var(--xp);
  box-shadow: 0 4px 14px -4px rgba(146, 64, 14, 0.5);
  color: #fff;
  font-size: 15px;
  animation-duration: 2400ms;
}

@keyframes xp-float {
  0% {
    opacity: 0;
    translate: -50% -6px;
  }
  15% {
    opacity: 1;
    translate: -50% 0;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    translate: -50% 10px;
  }
}

/* ── The Course card (home) ─────────────────────────────────────────────── */

.coursecard {
  display: grid;
  grid-template-columns: auto minmax(0, 1.25fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: clamp(16px, 1.8vw, 30px);
  min-width: 0;
  padding: 16px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: linear-gradient(100deg, var(--xp-wash), var(--page) 42%);
}

.coursecard__badge {
  width: 82px;
  height: 82px;
}

.coursecard__badge-word,
.course__badge-word,
.levelup__badge-word {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.92;
}

.coursecard__badge-number {
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.coursecard__main {
  min-width: 0;
}

.coursecard__label {
  margin: 0 0 4px;
  color: var(--xp-ink);
  font-size: 14px;
  font-weight: 650;
}

.coursecard__title {
  margin: 0;
  font-size: clamp(20px, 2cqw, 26px);
  font-weight: 780;
  line-height: 1.15;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.coursecard__why {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coursecard__barline {
  margin-top: 12px;
}

.coursecard__facts {
  margin: 7px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.coursecard__facts b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.coursecard__extra {
  margin: 3px 0 0;
  color: var(--ink-3);
  font-size: 13.5px;
}

.coursecard__rested {
  color: var(--xp-ink);
  font-weight: 650;
}

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

/* A level with other quests (Stage 7: a groove, a showpiece's part, a jam): four or five in a row. */
.coursecard__quests[data-count='4'] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.coursecard__quests[data-count='5'] {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.coursecard__quests {
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.coursecard__quest {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--page);
}

.coursecard__quest[data-ready='false'][data-done='false'] {
  background: var(--wash);
}

.coursecard__quest[data-done='true'] {
  border-color: var(--xp-line);
  background: var(--xp-wash);
}

.coursecard__quest-kind {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.coursecard__quest-title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coursecard__quest-state {
  color: var(--ink-3);
  font-size: 13px;
}

.coursecard__quest[data-done='true'] .coursecard__quest-state {
  color: var(--xp-ink);
  font-weight: 650;
}

.coursecard__actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.coursecard__actions .btn {
  padding: 8px 16px;
  font-size: 15px;
  white-space: nowrap;
}

.coursecard[data-state='exam'] .coursecard__badge {
  animation: badge-glow 2.4s ease-in-out infinite;
}

@keyframes badge-glow {
  50% {
    box-shadow:
      inset 0 -2px 0 rgba(146, 64, 14, 0.22),
      0 0 0 8px var(--xp-glow);
  }
}

@container home (max-width: 1240px) {
  .coursecard {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .coursecard__quests {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@container home (max-width: 700px) {
  .coursecard {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .coursecard__actions {
    grid-column: 1 / -1;
    grid-auto-flow: column;
  }

  .coursecard__quests {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-height: 1100px) {
  .coursecard__why {
    display: none;
  }

  .coursecard__barline {
    margin-top: 10px;
  }
}

@media (max-height: 960px) {
  .coursecard {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .coursecard__badge {
    width: 66px;
    height: 66px;
  }

  .coursecard__badge-number {
    font-size: 28px;
  }

  .coursecard__why {
    display: none;
  }

  .coursecard__barline {
    margin-top: 8px;
  }
}

@media (max-height: 760px) {
  .coursecard__extra {
    display: none;
  }
}

/* ── The Course screen ──────────────────────────────────────────────────── */

.course {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
  container: course / inline-size;
}

.course__head {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(16px, 2vw, 36px);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.course__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}

.course__back:hover {
  background: var(--wash);
}

.course__back svg {
  width: 18px;
  height: 18px;
}

.course__label {
  margin: 0;
  color: var(--xp-ink);
  font-size: 14px;
  font-weight: 650;
}

.course__title {
  margin: 0;
  font-size: clamp(22px, 2.2cqw, 30px);
  font-weight: 780;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.course__now {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.course__badge {
  width: 66px;
  height: 66px;
}

.course__badge-number {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.course__about {
  min-width: 0;
}

.course__facts {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.course__facts b {
  color: var(--ink);
}

.course__extra {
  margin: 2px 0 0;
  color: var(--ink-3);
  font-size: 13.5px;
}

.course__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 31%);
  gap: clamp(14px, 1.4vw, 24px);
  min-height: 0;
}

.course__path {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 2px 8px 24px 2px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.course__chunk {
  flex: none;
  padding: 14px 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--page);
}

.course__chunk[data-state='current'] {
  border-color: var(--xp-line);
  box-shadow: 0 0 0 3px var(--xp-wash);
}

.course__chunk[data-state='later'] {
  background: var(--wash);
}

.course__chunk-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 18px;
}

.course__chunk-title {
  margin: 0;
  font-size: 17px;
  font-weight: 760;
  white-space: nowrap;
}

.course__chunk-meta {
  margin: 1px 0 0;
  color: var(--ink-3);
  font-size: 13px;
  white-space: nowrap;
}

.course__chunk-can {
  margin: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course__nodes {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.course__step {
  position: relative;
  display: flex;
  justify-content: center;
  min-width: 0;
}

/* The path between one level and the next: gold as far as the learner has come. */
.course__step + .course__step::before {
  content: '';
  position: absolute;
  top: 21px;
  right: 50%;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--line-strong);
}

.course__step + .course__step:has(> .course__node[data-state='done'], > .course__node[data-state='current'])::before {
  background: var(--xp);
}

.course__node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  cursor: pointer;
}

.course__node:focus-visible {
  outline: none;
}

.course__node:focus-visible .course__dot {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.course__dot {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--page);
  color: var(--ink-3);
  font-size: 15px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.course__dot svg {
  width: 22px;
  height: 22px;
}

.course__node:hover .course__dot {
  transform: scale(1.08);
}

.course__node[data-state='done'] .course__dot {
  border-color: var(--xp);
  background: linear-gradient(to bottom, var(--xp-2), var(--xp));
  color: #fff;
}

.course__node[data-state='current'] .course__dot {
  border: 3px solid var(--xp);
  color: var(--ink);
  font-size: 16px;
  animation: node-here 2.4s ease-in-out infinite;
}

@keyframes node-here {
  0%,
  100% {
    box-shadow: 0 0 0 4px var(--xp-glow);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(245, 158, 11, 0.12);
  }
}

.course__node[data-state='open'] .course__dot {
  border-style: dashed;
  border-color: var(--xp-deep);
  color: var(--ink-2);
}

.course__node[data-state='locked'] .course__dot {
  background: var(--wash);
}

.course__node[aria-pressed='true'] .course__dot {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.course__node--exam .course__dot {
  width: 48px;
  border-radius: 14px;
}

.course__node--exam[data-passed='true'] .course__dot,
.course__node--exam[data-state='done'] .course__dot {
  border-color: var(--xp-deep);
  background: linear-gradient(to bottom, var(--xp), var(--xp-deep));
  color: #fff;
}

.course__gate-name {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.course__pips {
  display: flex;
  gap: 4px;
  height: 6px;
}

.course__pips i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
}

.course__pips i[data-some='true'] {
  background: var(--xp-pale);
}

.course__pips i[data-done='true'] {
  background: var(--xp);
}

/* The level sheet. */
.levelsheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 18px 20px 20px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--page);
  scrollbar-width: thin;
}

.levelsheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.levelsheet__where {
  margin: 0;
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 600;
}

.levelsheet__title {
  margin: 2px 0 0;
  font-size: 25px;
  font-weight: 790;
  letter-spacing: -0.015em;
}

.levelsheet__chip {
  flex: none;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.levelsheet__chip[data-state='current'] {
  background: var(--xp);
  color: #451a03;
}

.levelsheet__chip[data-state='done'] {
  background: var(--xp-wash);
  color: var(--xp-ink);
}

.levelsheet__chip[data-state='open'] {
  background: var(--xp-wash);
  color: var(--xp-ink);
  box-shadow: inset 0 0 0 1px var(--xp-line);
}

.levelsheet__new {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
}

.levelsheet__new-word {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px var(--xp-line);
  color: var(--xp-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.levelsheet__xp,
.levelsheet__note {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.levelsheet__note {
  color: var(--ink-3);
  font-size: 13.5px;
}

.levelsheet__quests {
  display: grid;
  gap: 10px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.levelsheet__quest {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 12px 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.levelsheet__quest[data-done='true'] {
  border-color: var(--xp-line);
  background: var(--xp-wash);
}

.levelsheet__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--ink-2);
}

.levelsheet__quest[data-done='true'] .levelsheet__icon {
  background: var(--xp);
  color: #fff;
}

.levelsheet__icon svg {
  width: 21px;
  height: 21px;
}

.levelsheet__kind {
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 650;
}

.levelsheet__quest-title {
  margin: 1px 0 0;
  font-size: 16.5px;
  font-weight: 740;
  line-height: 1.3;
}

.levelsheet__by {
  margin: 1px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}

.levelsheet__about {
  margin: 3px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
}

.levelsheet__hands {
  margin: 4px 0 0;
  color: var(--right-ink);
  font-size: 13px;
  font-weight: 650;
}

.levelsheet__side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.levelsheet__stars {
  font-size: 18px;
}

.levelsheet__state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 150px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.35;
  text-align: right;
}

.levelsheet__quest[data-done='true'] .levelsheet__state {
  color: var(--xp-ink);
  font-weight: 700;
}

.levelsheet__state svg {
  width: 16px;
  height: 16px;
}

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

.levelsheet__buttons--wrap {
  flex-wrap: wrap;
}

.levelsheet__exam {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.levelsheet__exam-title {
  margin: 0 0 8px;
  font-size: 15.5px;
  font-weight: 760;
}

.levelsheet__exam-parts {
  display: grid;
  gap: 6px;
  margin: 0;
}

.levelsheet__exam-part {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.levelsheet__exam-part dt {
  color: var(--ink-3);
  font-weight: 650;
}

.levelsheet__exam-part dd {
  margin: 0;
  color: var(--ink-2);
}

.levelsheet__marks,
.levelsheet__exam-status {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.45;
}

.levelsheet__exam-status {
  color: var(--ink);
  font-weight: 650;
}

.levelsheet__exam .levelsheet__buttons {
  margin-top: 10px;
}

.levelsheet__soon {
  color: var(--ink-3);
  font-size: 13px;
}

.levelsheet__milestone {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--xp-wash);
  color: var(--xp-ink);
  font-size: 14px;
  font-weight: 650;
}

.levelsheet__dev {
  padding: 12px 14px;
  border: 1px dashed var(--xp-deep);
  border-radius: 12px;
}

.levelsheet__dev-title {
  margin: 0;
  color: var(--xp-ink);
  font-size: 13.5px;
  font-weight: 750;
}

.levelsheet__dev .levelsheet__buttons {
  margin-top: 8px;
}

@container course (max-width: 1100px) {
  .course__body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .levelsheet {
    max-height: 46vh;
  }

  .course__sheet {
    order: -1;
  }

  .course__head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .course__titles {
    display: none;
  }
}

@container course (max-width: 760px) {
  .course__dot {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .course__node--exam .course__dot {
    width: 36px;
  }

  .course__step + .course__step::before {
    top: 16px;
  }

  .course__chunk-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .course__gate-name {
    font-size: 11px;
  }
}

/* ── A new level ────────────────────────────────────────────────────────── */

.levelup {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.levelup[hidden] {
  display: none;
}

.levelup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(2px);
}

.levelup__card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(540px, 100%);
  max-height: calc(100vh - 48px);
  padding: 28px 30px 24px;
  overflow-y: auto;
  border-radius: 22px;
  background: var(--page);
  box-shadow: 0 30px 80px -24px rgba(15, 23, 42, 0.45);
  text-align: center;
}

.levelup__eyebrow {
  margin: 0;
  color: var(--xp-ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.levelup__badge {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 4px 0;
}

/* A burst of gold behind the badge as it arrives. */
.levelup__badge::before {
  content: '';
  position: absolute;
  inset: -22px;
  z-index: -1;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(251, 191, 36, 0.55) 0deg 8deg, transparent 8deg 22deg);
  mask: radial-gradient(circle, transparent 46%, #000 48%, transparent 72%);
  opacity: 0;
}

.levelup__badge-number {
  font-size: 46px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.levelup__title {
  margin: 0;
  font-size: 25px;
  font-weight: 790;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.levelup__about {
  margin: 0;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.45;
  text-wrap: pretty;
}

.levelup__quests {
  display: grid;
  gap: 6px;
  width: 100%;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.levelup__quest {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--wash);
}

.levelup__quest-kind {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.levelup__quest-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.levelup__quest-extra {
  color: var(--ink-3);
  font-size: 13px;
  white-space: nowrap;
}

.levelup__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.levelup__actions .btn {
  padding: 8px 16px;
  font-size: 15px;
}

.levelup__card.is-in {
  animation: levelup-in 420ms cubic-bezier(0.2, 0.9, 0.3, 1.15) backwards;
}

.levelup__card.is-in .levelup__badge {
  animation: levelup-badge 820ms cubic-bezier(0.2, 0.9, 0.3, 1.35) 120ms backwards;
}

.levelup__card.is-in .levelup__badge::before {
  animation: levelup-burst 1400ms ease-out 260ms;
}

@keyframes levelup-in {
  from {
    opacity: 0;
    scale: 0.92;
  }
}

@keyframes levelup-badge {
  from {
    opacity: 0;
    scale: 0.3;
    rotate: -18deg;
  }
}

@keyframes levelup-burst {
  0% {
    opacity: 0;
    scale: 0.6;
    rotate: 0deg;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    scale: 1.35;
    rotate: 40deg;
  }
}

/* The XP a run earned, on the results card. */
.results__xp {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px var(--xp-line);
}

.results__xp-gained {
  margin: 0;
  color: var(--xp-ink);
  white-space: nowrap;
}

.results__xp-gained b {
  font-size: 26px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.results__xp-gained span {
  font-size: 15px;
  font-weight: 700;
}

.results__xp-words {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
}

.results__xp-words b {
  color: var(--ink);
}

.settings__about--row {
  margin: -2px 0 6px;
  font-size: 13.5px;
}

@media (prefers-reduced-motion: reduce) {
  .xpbar__fill,
  .xpbar__rested,
  .xpbar[data-gated='true'] .xpbar__fill,
  .levelpill__button.is-levelling .levelpill__badge,
  .levelpill__float,
  .coursecard[data-state='exam'] .coursecard__badge,
  .course__node[data-state='current'] .course__dot,
  .levelup__card.is-in,
  .levelup__card.is-in .levelup__badge,
  .levelup__card.is-in .levelup__badge::before {
    animation: none;
    transition: none;
  }
}

/* ── The change log (Settings) ─────────────────────────────────────────── */

.settings__head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings__jump {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
}

.settings__jump:hover {
  border-color: var(--line-strong);
  background: var(--fill);
  color: var(--ink);
}

.changelog {
  display: grid;
  gap: 12px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.changelog__entry {
  padding: 13px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page);
}

.changelog__entry[data-learning] {
  border-color: var(--xp-line);
  background: linear-gradient(var(--xp-wash), var(--page) 70%);
}

.changelog__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.changelog__stage {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--right-wash);
  color: var(--right-ink);
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.changelog__entry[data-stage='extra'] .changelog__stage {
  background: var(--held-wash);
  color: var(--held-ink);
}

.changelog__entry[data-learning] .changelog__stage {
  background: var(--xp-pale);
  color: var(--xp-ink);
}

.changelog__title {
  margin: 0;
  font-size: 16px;
  font-weight: 730;
}

.changelog__tag {
  padding: 1px 8px;
  border: 1px solid var(--xp-line);
  border-radius: 999px;
  color: var(--xp-ink);
  font-size: 12px;
  font-weight: 650;
}

.changelog__date {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.changelog__summary {
  max-width: 72ch;
  margin: 7px 0 7px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
}

.changelog__items {
  display: grid;
  gap: 2px;
  max-width: 76ch;
  margin: 0;
  padding-left: 19px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.changelog__items li::marker {
  color: var(--ink-3);
}

/* ── Lessons (Stage 13): the voice explains, the piano shows, the learner tries ─ */

.app.lesson-open .home,
.app.lesson-open .course,
.app.lesson-open .stand,
.app.lesson-strip .home,
.app.lesson-strip .course {
  display: none;
}

.app.lesson-strip .desk {
  grid-template-rows: auto minmax(0, 1fr);
}

.lesson {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: 'head' 'body' 'controls';
  gap: clamp(10px, 1.6vh, 18px);
  min-width: 0;
  min-height: 0;
  container: lesson / inline-size;
}

.lesson__head {
  grid-area: head;
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
}

.lesson__where {
  margin: 0;
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.lesson__title {
  margin: 0;
  font-size: clamp(20px, 1.6vw, 26px);
  font-weight: 780;
  letter-spacing: -0.01em;
}

.lesson__progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fill);
}

.lesson__progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #38bdf8, var(--accent));
  transition: width 400ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.lesson__count {
  color: var(--ink-2);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lesson__close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
}

.lesson__close svg {
  width: 20px;
  height: 20px;
}

.lesson__close:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--fill);
  color: var(--ink);
}

.lesson__body {
  grid-area: body;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: clamp(16px, 2vw, 32px);
  min-height: 0;
}

.lesson__scene {
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: clamp(12px, 2vh, 26px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--wash);
}

.lesson-scene {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  animation: lesson-scene-in 360ms cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
}

.lesson-scene > svg,
.lesson-scene > div {
  max-width: 100%;
  max-height: 100%;
}

.lesson-scene > svg {
  width: min(100%, 720px);
  height: auto;
  max-height: calc(100cqh - 40px);
}

@keyframes lesson-scene-in {
  from {
    opacity: 0;
    translate: 0 8px;
  }
}

.lesson-scene__note {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  text-align: center;
}

/* What the voice says, and what it waits for. */
.lesson__talk {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(12px, 2vh, 20px);
  min-width: 0;
  padding: 4px 4px 4px 0;
}

.lesson__voice {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  background: var(--right-wash);
  color: var(--right-ink);
  font-size: 13.5px;
  font-weight: 700;
}

.lesson__voice svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.lesson__voice svg rect {
  transform-box: fill-box;
  transform-origin: center;
}

.lesson__voice[data-speaking='true'] svg rect {
  animation: voice-bar 760ms ease-in-out infinite alternate;
}

.lesson__voice[data-speaking='true'] svg rect:nth-child(2) {
  animation-delay: -240ms;
}

.lesson__voice[data-speaking='true'] svg rect:nth-child(3) {
  animation-delay: -480ms;
}

.lesson__voice[data-speaking='true'] svg rect:nth-child(4) {
  animation-delay: -120ms;
}

.lesson__voice[data-voice='off'] {
  background: var(--fill);
  color: var(--ink-2);
}

@keyframes voice-bar {
  from {
    transform: scaleY(0.45);
  }
  to {
    transform: scaleY(1.15);
  }
}

.lesson__caption {
  margin: 0;
  max-width: 34ch;
  color: var(--ink);
  font-size: clamp(21px, 1.85vw, 31px);
  font-weight: 640;
  line-height: 1.34;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}

.lesson__hint {
  margin: 0;
  max-width: 40ch;
  padding: 10px 14px;
  border-left: 4px solid var(--amber);
  border-radius: 4px 10px 10px 4px;
  background: #fffbeb;
  color: var(--amber-ink);
  font-size: clamp(16px, 1.25vw, 19px);
  font-weight: 600;
  line-height: 1.4;
  animation: lesson-scene-in 240ms ease-out backwards;
}

.lesson__turn {
  display: grid;
  gap: 2px;
  align-self: flex-start;
  min-width: min(100%, 300px);
  padding: 12px 18px 13px;
  border: 2px solid var(--right-hand);
  border-radius: 14px;
  background: var(--right-wash);
}

.lesson__turn-word {
  color: var(--right-ink);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lesson__turn-what {
  color: var(--ink);
  font-size: clamp(18px, 1.4vw, 22px);
  font-weight: 750;
}

.lesson__turn[data-state='waiting'] {
  animation: turn-breathe 2.4s ease-in-out infinite;
}

.lesson__turn[data-state='right'] {
  border-color: var(--held);
  background: var(--held-wash);
}

.lesson__turn[data-state='right'] .lesson__turn-word {
  color: var(--held-ink);
}

.lesson__turn[data-state='right'] .lesson__turn-word::after {
  content: ' ✓';
}

@keyframes turn-breathe {
  50% {
    box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.16);
  }
}

.lesson__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lesson__choices .btn {
  padding: 10px 18px;
  font-size: 15.5px;
}

/* The controls along the bottom. */
.lesson__controls {
  grid-area: controls;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
}

.lesson__controls-left,
.lesson__controls-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lesson__control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px 8px 12px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 650;
}

.lesson__control svg {
  width: 17px;
  height: 17px;
}

.lesson__voices {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--fill);
}

.lesson__voice-choice {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
}

.lesson__voice-choice[aria-checked='true'] {
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.lesson__speed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lesson__speed-label {
  color: var(--ink-2);
  font-size: 13.5px;
}

.lesson__speed-step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
}

.lesson__speed-value {
  min-width: 3.4ch;
  font-size: 14.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* The start card. */
.lesson__intro {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(248 250 252 / 0.82);
  backdrop-filter: blur(3px);
}

.lesson__intro[hidden] {
  display: none;
}

.lesson__intro-card {
  display: grid;
  gap: 12px;
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 26px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--page);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06), 0 26px 60px -26px rgba(15, 23, 42, 0.45);
  animation: settings-in 260ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}

.lesson__intro-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--right-wash);
  color: var(--right-ink);
}

.lesson__intro-icon svg {
  width: 26px;
  height: 26px;
}

.lesson__intro-where {
  margin: 4px 0 0;
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 700;
}

.lesson__intro-title {
  margin: -6px 0 0;
  font-size: 28px;
  font-weight: 790;
  letter-spacing: -0.015em;
}

.lesson__intro-about {
  margin: 0;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.45;
}

.lesson__intro-voices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.lesson__intro-label {
  grid-column: 1 / -1;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lesson__intro-voice {
  display: grid;
  gap: 1px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lesson__intro-voice b {
  font-size: 15px;
}

.lesson__intro-voice span {
  color: var(--ink-2);
  font-size: 12.5px;
}

.lesson__intro-voice:hover {
  border-color: var(--line-strong);
  background: var(--wash);
}

.lesson__intro-voice[aria-checked='true'] {
  border-color: var(--right-hand);
  background: var(--right-wash);
}

.lesson__intro-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
}

.lesson__intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.lesson__intro-actions .btn {
  padding: 10px 18px;
  font-size: 15px;
}

/* While the start card shows, the stage behind it waits quietly. */
.lesson[data-layout='intro'] .lesson__controls,
.lesson[data-layout='intro'] .lesson__talk {
  visibility: hidden;
}

/* Talking over the song screen: one strip above it. */
.lesson[data-layout='strip'] {
  grid-template-rows: auto;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: 'body controls head';
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 14px;
  border: 1px solid #bae6fd;
  border-radius: 14px;
  background: linear-gradient(100deg, var(--right-wash), var(--page) 70%);
  animation: lesson-scene-in 280ms ease-out backwards;
}

.lesson[data-layout='strip'] .lesson__titles,
.lesson[data-layout='strip'] .lesson__progress,
.lesson[data-layout='strip'] .lesson__count,
.lesson[data-layout='strip'] .lesson__scene,
.lesson[data-layout='strip'] .lesson__controls-right,
.lesson[data-layout='strip'] .lesson__turn,
.lesson[data-layout='strip'] .lesson__intro {
  display: none;
}

.lesson[data-layout='strip'] .lesson__head {
  grid-template-columns: auto;
}

.lesson[data-layout='strip'] .lesson__body {
  display: block;
}

.lesson[data-layout='strip'] .lesson__talk {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 0;
}

.lesson[data-layout='strip'] .lesson__caption {
  flex: 1 1 320px;
  max-width: none;
  font-size: clamp(15.5px, 1.15vw, 18px);
  font-weight: 620;
}

.lesson[data-layout='strip'] .lesson__hint {
  padding: 4px 10px;
  font-size: 15px;
}

.lesson[data-layout='strip'] .lesson__voice {
  align-self: center;
}

.lesson[data-layout='strip'] .lesson__control {
  padding: 6px 12px 6px 10px;
  font-size: 13.5px;
}

/* (While the song's run goes on, pausing or replaying the lesson would start the run again.) */
.lesson[data-song='running'] .lesson__control:not([data-action='skip']) {
  display: none;
}

@container lesson (max-width: 980px) {
  .lesson__body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(160px, 1fr) auto;
  }

  .lesson__head {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .lesson__progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .lesson__speed-label {
    display: none;
  }
}

/* ── The lesson's pictures ── */

.lesson-path {
  overflow: visible;
}

.lesson-path__line {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 4;
  stroke-dasharray: 2 10;
  stroke-linecap: round;
}

.lesson-path__node circle {
  fill: var(--page);
  stroke: var(--line-strong);
  stroke-width: 2.5;
}

.lesson-path__node text {
  fill: var(--ink-2);
  font-size: 14px;
  font-weight: 750;
}

.lesson-path__node.is-here circle {
  fill: var(--xp);
  stroke: var(--xp-deep);
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.55));
}

.lesson-path__node.is-here text {
  fill: #fff;
  font-size: 19px;
}

.lesson-path__here {
  fill: var(--xp-ink);
  font-size: 15px;
  font-weight: 750;
}

.lesson-path__gate path {
  fill: var(--fill);
  stroke: var(--ink-3);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.lesson-path__gate .lesson-path__bars {
  fill: none;
}

.lesson-path__label {
  fill: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
}

.lesson-path.is-gate .lesson-path__gate path:first-child {
  fill: var(--xp-pale);
  stroke: var(--xp-deep);
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5));
}

.lesson-path.is-gate .lesson-path__label {
  fill: var(--xp-ink);
}

.lesson-path.is-gate .lesson-path__node.is-here circle {
  fill: var(--page);
  stroke: var(--xp);
  filter: none;
}

.lesson-path.is-gate .lesson-path__node.is-here text {
  fill: var(--xp-ink);
}

/* The XP bar, explained. */
.lesson-xp {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 640px);
}

.lesson-xp__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.lesson-xp__badge,
.lesson-xp__next {
  display: grid;
  place-content: center;
  justify-items: center;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  line-height: 1;
}

.lesson-xp__badge {
  background: radial-gradient(circle at 35% 30%, #fde68a, var(--xp) 58%, var(--xp-deep));
  box-shadow: inset 0 -3px 0 rgba(146, 64, 14, 0.22), 0 2px 6px rgba(146, 64, 14, 0.3);
  color: #fff;
  text-shadow: 0 1px 1px rgba(146, 64, 14, 0.45);
}

.lesson-xp__next {
  border: 2px dashed var(--line-strong);
  color: var(--ink-3);
}

.lesson-xp__badge span,
.lesson-xp__next span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lesson-xp__badge b,
.lesson-xp__next b {
  font-size: 34px;
  font-weight: 850;
}

.xpbar--lesson {
  --xpbar-h: 24px;
}

.lesson-xp__words {
  margin: 0;
  color: var(--xp-ink);
  font-size: 17px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.lesson-xp__path {
  width: min(100%, 520px);
  height: auto;
  margin-top: 6px;
}

/* The seed. */
.lesson-seed-box {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.lesson-seed svg {
  display: block;
  width: min(360px, 60cqw);
  height: auto;
}

/* Keys, drawn big. */
.lesson-keys {
  overflow: visible;
}

.lesson-keys__case {
  fill: #1f2937;
}

.lesson-keys__white {
  fill: #fff;
  stroke: #cbd5e1;
  stroke-width: 1;
  transition: fill 120ms;
}

.lesson-keys__black {
  fill: #1e293b;
  transition: fill 120ms;
}

.lesson-keys__white.is-middle {
  fill: var(--right-wash);
}

.lesson-keys__black.is-pair {
  animation: pair-pulse 1.3s ease-in-out infinite;
}

@keyframes pair-pulse {
  50% {
    fill: #38bdf8;
  }
}

.lesson-keys .is-next {
  fill: #7dd3fc;
}

.lesson-keys .is-lit {
  fill: var(--right-hand);
}

.lesson-keys .is-held,
.lesson-keys .is-right {
  fill: #4ade80;
}

.lesson-keys .is-wrong {
  fill: #f87171;
}

.lesson-keys__c {
  fill: var(--ink-3);
  font-size: 17px;
  font-weight: 800;
}

.lesson-keys[data-mark='off'] .lesson-keys__c {
  visibility: hidden;
}

.lesson-keys__middle {
  visibility: hidden;
}

.lesson-keys[data-mark='middle-c'] .lesson-keys__middle,
.lesson-keys[data-mark='hand'] .lesson-keys__middle {
  visibility: visible;
}

.lesson-keys__middle rect {
  fill: var(--right-hand);
}

.lesson-keys__middle text {
  fill: #fff;
  font-size: 13px;
  font-weight: 800;
}

/* A hand: an outline round the whole shape, a pale fill, the fingers numbered. */
.hand__outline path {
  fill: #475569;
  stroke: #475569;
  stroke-width: 5;
  stroke-linejoin: round;
}

.hand__fill path {
  fill: #f8fafc;
}

.hand {
  opacity: 0.94;
}

.hand__number circle {
  fill: var(--right-hand);
  stroke: #fff;
  stroke-width: 2;
}

.hand__number text {
  fill: #fff;
  font-weight: 800;
}

.hand__letter {
  fill: #0f172a;
  font-weight: 800;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.lesson-hand__label {
  fill: var(--right-ink);
  font-size: 16px;
  font-weight: 750;
}

/* The hand (ui/hand-art.js): the right hand on C to G from above, in the sitting picture's colours. */
.hand-art__shadow {
  fill: rgba(15, 23, 42, 0.16);
  filter: blur(5px);
}

.hand-art__outline path {
  fill: #b9825f;
  stroke: #b9825f;
  stroke-width: 4;
  stroke-linejoin: round;
}

.hand-art__skin path {
  fill: #e8b896;
}

.hand-art__shade path,
.hand-art__shade ellipse {
  fill: #d29a76;
  opacity: 0.45;
}

.hand-art__shade {
  filter: blur(2.5px);
}

.hand-art__glow ellipse {
  fill: #f3cfb2;
  opacity: 0.8;
}

.hand-art__lines path {
  fill: none;
  stroke: #b47c58;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.7;
}

.hand-art__lines .hand-art__tendon {
  stroke: #d29c78;
  stroke-width: 3;
  opacity: 0.45;
}

.hand-art__nail {
  fill: #f6d9ca;
  stroke: #d8a98e;
  stroke-width: 1.5;
}

.hand-art__cuff {
  fill: #367c5b;
}

.hand-art__rib {
  fill: none;
  stroke: #2f6b4f;
  stroke-width: 3;
}

.hand-art__badge circle {
  fill: var(--right-hand);
  stroke: #fff;
  stroke-width: 3;
}

.hand-art__badge text {
  fill: #fff;
  font-size: 19px;
  font-weight: 850;
}

.hand-art__pop {
  animation: posture-pop 420ms cubic-bezier(0.2, 0.9, 0.3, 1.4) backwards;
  animation-delay: 300ms;
}

.hand-art__pop[data-n='1'] {
  animation-delay: 650ms;
}

.hand-art__pop[data-n='2'] {
  animation-delay: 1000ms;
}

.hand-art__pop[data-n='3'] {
  animation-delay: 1350ms;
}

.hand-art__pop[data-n='4'] {
  animation-delay: 1700ms;
}

@media (prefers-reduced-motion: reduce) {
  .hand-art__pop {
    animation: none;
  }
}

/* Over the real keys. */
.keyoverlay {
  position: absolute;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}

.keyoverlay:not([width]) {
  display: none;
}

.keyoverlay__pair {
  fill: rgba(56, 189, 248, 0.7);
  stroke: #0ea5e9;
  stroke-width: 1.5;
  animation: overlay-pulse 1.3s ease-in-out infinite;
}

@keyframes overlay-pulse {
  50% {
    opacity: 0.25;
  }
}

.keyoverlay__c {
  fill: rgba(14, 165, 233, 0.22);
  stroke: var(--right-hand);
  stroke-width: 2;
}

.keyoverlay__c--middle {
  fill: rgba(14, 165, 233, 0.3);
  stroke-width: 3;
}

.hand--ghost {
  opacity: 0.8;
}

.hand--ghost .hand__outline path {
  stroke-width: 3;
}

/* Sitting at the piano (ui/posture-art.js): the learner at a digital piano on its stand, numbered
   points to notice and their key down the left. The learner is a puppet that acts out what Timothy
   says: the points his line mentions start wrong (data-wait on the picture names them) and move
   right as he says each one, its number popping up. The pedal version presses the pedal over and
   over; the warm-up's shoulders roll and hands shake out. */
.lesson-posture {
  overflow: visible;
}

.posture__floorband {
  fill: #edf1f5;
}

.posture__floor {
  stroke: #cbd5e1;
  stroke-width: 2;
}

.posture__shadow {
  fill: rgb(15 23 42 / 0.1);
}

.posture__wood {
  fill: #b5835a;
}

.posture__wood-dark {
  fill: #8c5f3c;
}

.posture__cushion {
  fill: #3f4654;
}

.posture__case {
  fill: #2b2f36;
}

.posture__case-light {
  fill: #3a3f47;
}

.posture__white {
  fill: #fff;
  stroke: #cbd5e1;
  stroke-width: 1;
}

.posture__black {
  fill: #16181d;
}

.posture__sheet {
  fill: #fffdf7;
  stroke: #e2e8f0;
}

.posture__sheet-lines {
  fill: none;
  stroke: #c7cdd6;
  stroke-width: 1.2;
}

.posture__pedal {
  fill: #c8a456;
}

.posture__jumper {
  fill: #2f6b4f;
}

.posture__hem {
  fill: #285c43;
}

.posture__sleeve,
.posture__cuff,
.posture__forearm,
.posture__thigh,
.posture__shin,
.posture__above-arm {
  fill: none;
  stroke-linecap: round;
}

.posture__sleeve {
  stroke: #367c5b;
  stroke-width: 30;
}

.posture__cuff {
  stroke: #367c5b;
  stroke-width: 26;
}

.posture__forearm {
  stroke: #e8b896;
  stroke-width: 19;
}

.posture__skin {
  fill: #e8b896;
}

.posture__ear {
  fill: #d99f7c;
}

.posture__eye {
  fill: #1f2937;
}

.posture__mouth,
.posture__knuckle {
  fill: none;
  stroke: #c58a66;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.posture__hair {
  fill: #3b2a21;
}

.posture__thigh {
  stroke: #34425a;
  stroke-width: 46;
}

.posture__shin {
  stroke: #34425a;
  stroke-width: 34;
}

.posture__thigh--far,
.posture__shin--far {
  stroke: #26324a;
}

.posture__shoe {
  fill: #1d222b;
}

.posture__shoe-far {
  fill: #303744;
}

/* What to notice. */
.posture__guide {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 7 6;
  stroke-linecap: round;
}

.posture__bracket,
.posture__angle,
.posture__arrow,
.posture__roll {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.posture__shake-lines {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 2;
  stroke-linecap: round;
}

.posture__halo {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.posture__badge circle {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 2.5;
}

.posture__badge text {
  fill: #fff;
  font-size: 15px;
  font-weight: 800;
}

.posture__key-text {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 650;
}

.posture__title {
  fill: var(--ink-2);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.posture__caption {
  fill: var(--ink-2);
  font-size: 14px;
  font-weight: 650;
}

.posture__c-label {
  fill: var(--accent);
  font-size: 12.5px;
  font-weight: 800;
}

.posture__c-mark {
  fill: var(--accent);
}

.posture__c {
  fill: #e0f2fe;
  stroke: var(--accent);
  stroke-width: 1.5;
}

.posture__centre {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.posture__stool-top {
  fill: #b5835a;
}

.posture__above-arm {
  stroke: #367c5b;
  stroke-width: 13;
  stroke-linejoin: round;
}

/* Hands, drawn (from above and from the side): skin with a fine outline, nails, creases, tendons. */
.posture__hand {
  fill: #e8b896;
  stroke: #c98d6b;
  stroke-width: 1;
  stroke-linejoin: round;
}

.posture__hand--far {
  fill: #d9a582;
}

.posture__hand--soft {
  stroke: none;
}

.posture__hand-edge {
  fill: none;
  stroke: #c98d6b;
  stroke-width: 1;
  stroke-linecap: round;
}

.posture__nail {
  fill: #f6dccd;
  stroke: #d9a385;
  stroke-width: 0.6;
}

.posture__crease,
.posture__tendon {
  fill: none;
  stroke: #cf9573;
  stroke-width: 0.8;
  stroke-linecap: round;
}

.posture__tendon {
  stroke: #d9a17f;
  stroke-width: 0.9;
  opacity: 0.55;
}

.posture__shine {
  fill: none;
  stroke: #f6d4bd;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.posture__above-cuff {
  fill: #367c5b;
}

.posture__rib {
  fill: none;
  stroke: #2a6047;
  stroke-width: 1.1;
  stroke-linecap: round;
}

.posture__key-lip {
  fill: #eef1f5;
}

.posture__black-top {
  fill: #2f333b;
}

.posture__above-arm-light {
  fill: none;
  stroke: #3f8a66;
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.7;
}

.posture__seam {
  fill: none;
  stroke: #285c43;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.posture__hair-strand {
  fill: none;
  stroke: #57402f;
  stroke-width: 1.3;
  stroke-linecap: round;
}

.posture__nail-edge,
.posture__nostril,
.posture__ear-inner,
.posture__lid {
  fill: none;
  stroke: #c58a66;
  stroke-width: 1.2;
  stroke-linecap: round;
}

.posture__nail-edge {
  stroke: #f6dccd;
  stroke-width: 1.6;
}

.posture__lid {
  stroke: #8a5a42;
  stroke-width: 1.3;
}

.posture__brow {
  fill: none;
  stroke: #3b2a21;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.posture__eye-glint {
  fill: #fff;
}

.posture__cheek {
  fill: rgb(214 112 92 / 0.22);
}

.posture__jaw,
.posture__neck-shade {
  fill: rgb(176 108 78 / 0.18);
}

.posture__hair-shine {
  fill: none;
  stroke: #6b4e3a;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.posture__collar {
  fill: #285c43;
}

.posture__rib--collar {
  stroke: #367c5b;
}

.posture__rib--across {
  stroke-width: 1.2;
}

.posture__knit {
  fill: none;
  stroke: #2a6148;
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.55;
}

.posture__jumper-band {
  fill: #2a6047;
}

.posture__jumper-light {
  fill: none;
  stroke: #3a8461;
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.7;
}

.posture__sleeve-shade,
.posture__fold {
  fill: none;
  stroke: #2d6a4e;
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.8;
}

.posture__fold {
  stroke-width: 1.6;
  stroke: #285c43;
}

.posture__forearm-shade {
  fill: none;
  stroke: #d39f7d;
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0.8;
}

.posture__trouser-light {
  fill: none;
  stroke: #3e4e69;
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.85;
}

.posture__trouser-crease {
  fill: none;
  stroke: #283349;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.posture__trouser-hem {
  fill: none;
  stroke: #2a3550;
  stroke-width: 3;
  stroke-linecap: round;
}

.posture__sole {
  fill: #6b4a33;
}

.posture__sole--far {
  fill: #574031;
}

.posture__lace {
  fill: none;
  stroke: #4a5160;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.posture__piping {
  fill: none;
  stroke: #2f3541;
  stroke-width: 1.4;
}

.posture__grain {
  fill: none;
  stroke: #7a5233;
  stroke-width: 1;
  opacity: 0.6;
}

.posture__ipad-body {
  fill: #1f2328;
}

.posture__ipad-screen {
  stroke: #9fd3b8;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.posture__ipad-label {
  fill: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
}

.posture__hand-label {
  fill: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.posture__thumb-ring {
  fill: none;
  stroke: var(--accent, #1e88e5);
  stroke-width: 2.5;
}

/* Motion. */
.posture__pop {
  animation: posture-pop 420ms cubic-bezier(0.2, 0.9, 0.3, 1.4) backwards;
  animation-delay: 300ms;
}

.posture__key-row {
  animation: posture-fade 420ms ease backwards;
  animation-delay: 300ms;
}

[data-n='1'].posture__pop,
.posture__key-row[data-n='1'] {
  animation-delay: 700ms;
}

[data-n='2'].posture__pop,
.posture__key-row[data-n='2'] {
  animation-delay: 1100ms;
}

[data-n='3'].posture__pop,
.posture__key-row[data-n='3'] {
  animation-delay: 1500ms;
}

.posture__key-row .posture__pop {
  animation: none;
}

.posture__guide,
.posture__bracket,
.posture__angle {
  animation: posture-fade 600ms 900ms ease backwards;
}

.posture__foot--pedal {
  transform-box: view-box;
  transform-origin: 582px 440px;
  animation: posture-press 2.4s 0.4s ease-in-out infinite;
}

.posture__pedal--moving {
  transform-box: view-box;
  transform-origin: 674px 429px;
  animation: posture-pedal 2.4s 0.4s ease-in-out infinite;
}

.posture__upper--roll {
  animation: posture-roll 3.2s 0.8s ease-in-out infinite;
}

.posture__shake {
  transform-box: view-box;
  transform-origin: 450px 262px;
  animation: posture-shake 3.2s 1.2s ease-in-out infinite;
}

@keyframes posture-pop {
  from {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@keyframes posture-fade {
  from {
    opacity: 0;
  }
}

@keyframes posture-press {
  0%,
  55%,
  100% {
    transform: rotate(0deg);
  }
  20%,
  35% {
    transform: rotate(3deg);
  }
}

@keyframes posture-pedal {
  0%,
  55%,
  100% {
    transform: rotate(0deg);
  }
  20%,
  35% {
    transform: rotate(-5deg);
  }
}

@keyframes posture-roll {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-2px, -3px);
  }
  50% {
    transform: translate(-3px, 1px);
  }
  75% {
    transform: translate(0, 2px);
  }
}

@keyframes posture-shake {
  0%,
  40%,
  100% {
    transform: rotate(0deg);
  }
  8%,
  24% {
    transform: rotate(7deg);
  }
  16%,
  32% {
    transform: rotate(-7deg);
  }
}

/* The puppet's joints: each turns about its own point (in the picture's units). */
.pp-body,
.pp-torso,
.pp-head,
.pp-shoulder,
.pp-upperarm,
.pp-forearm,
.pp-lower,
.pp-foot,
.pp-above,
.pp-breath,
.pp-eye,
.posture__foot--pedal,
.posture__marks {
  transform-box: view-box;
  transition: transform 950ms cubic-bezier(0.34, 1.25, 0.5, 1);
}

.pp-torso,
.pp-breath {
  transform-origin: 424px 264px;
}

.pp-head {
  transform-origin: 446px 84px;
}

.pp-shoulder,
.pp-upperarm {
  transform-origin: 442px 110px;
}

.pp-forearm {
  transform-origin: 470px 190px;
}

.pp-forearm--hang {
  transform-origin: 446px 196px;
}

.pp-lower {
  transform-origin: 578px 260px;
}

.pp-lower--far {
  transform-origin: 570px 252px;
}

.pp-foot {
  transform-origin: 578px 420px;
}

.pp-foot--far {
  transform-origin: 570px 418px;
}

.pp-eye {
  transform-origin: 466px 40px;
}

/* Alive: breathing, and blinking. A line about breathing gets two slow, deep breaths (in for four,
   out for six). */
.pp-breath {
  animation: posture-breathe 4.2s ease-in-out infinite;
}

.lesson-posture.is-deep .pp-breath {
  animation: posture-deep 10s ease-in-out 2;
}

.pp-eye {
  animation: posture-blink 5.3s 1.7s infinite;
}

/* The starting poses, while Timothy's line hasn't reached them. */
.lesson-posture[data-wait~='tall'] .pp-torso {
  transform: rotate(6deg);
}

.lesson-posture[data-wait~='tall'] .pp-head {
  transform: rotate(10deg);
}

.lesson-posture[data-wait~='tall'] .pp-shoulder {
  transform: rotate(-6deg);
}

.lesson-posture[data-wait~='level'] .pp-upperarm {
  transform: rotate(16deg);
}

.lesson-posture[data-wait~='level'] .pp-forearm {
  transform: rotate(2deg);
}

.lesson-posture[data-wait~='front'] .pp-body,
.lesson-posture[data-wait~='front'] .posture__marks {
  transform: translateX(-30px);
}

.lesson-posture[data-wait~='feet'] .pp-lower {
  transform: rotate(22deg);
}

.lesson-posture[data-wait~='feet'] .pp-foot {
  transform: rotate(-12deg);
}

.lesson-posture[data-wait~='square'] .pp-above {
  transform: translateX(34px);
}

.lesson-posture[data-wait~='heel'] .pp-lower:not(.pp-lower--far) {
  transform: rotate(-14deg);
}

.lesson-posture[data-wait~='ball'] .posture__foot--pedal {
  transform: rotate(-14deg);
}

.lesson-posture[data-wait~='press'] .posture__foot--pedal,
.lesson-posture[data-wait~='press'] .posture__pedal--moving,
.lesson-posture[data-wait~='roll'] .posture__upper--roll,
.lesson-posture[data-wait~='shake'] .posture__shake {
  animation: none;
}

.lesson-posture[data-wait~='roll'] .pp-shoulder {
  transform: translate(4px, -12px);
}

.lesson-posture[data-wait~='roll'] .pp-head {
  transform: translate(4px, 8px);
}

.lesson-posture[data-wait~='hang'] .pp-upperarm {
  transform: rotate(-22deg);
}

.lesson-posture[data-wait~='hang'] .pp-forearm {
  transform: rotate(-76deg);
}

/* Straight into the starting poses (the first line), without moving there. */
.lesson-posture[data-still] * {
  transition: none !important;
}

/* A point's number, its line or mark, and its row in the key wait for its word too (data-hide: not
   while it's only being shown again). */
.posture__marks > [data-cue]:not(.posture__badge),
.posture__key-row {
  transition: opacity 500ms ease;
}

.lesson-posture[data-hide~='tall'] .posture__marks > .posture__badge[data-cue='tall'] .posture__pop,
.lesson-posture[data-hide~='level'] .posture__marks > .posture__badge[data-cue='level'] .posture__pop,
.lesson-posture[data-hide~='front'] .posture__marks > .posture__badge[data-cue='front'] .posture__pop,
.lesson-posture[data-hide~='feet'] .posture__marks > .posture__badge[data-cue='feet'] .posture__pop,
.lesson-posture[data-hide~='square'] .posture__marks > .posture__badge[data-cue='square'] .posture__pop,
.lesson-posture[data-hide~='heel'] .posture__marks > .posture__badge[data-cue='heel'] .posture__pop,
.lesson-posture[data-hide~='ball'] .posture__marks > .posture__badge[data-cue='ball'] .posture__pop,
.lesson-posture[data-hide~='press'] .posture__marks > .posture__badge[data-cue='press'] .posture__pop,
.lesson-posture[data-hide~='roll'] .posture__marks > .posture__badge[data-cue='roll'] .posture__pop,
.lesson-posture[data-hide~='hang'] .posture__marks > .posture__badge[data-cue='hang'] .posture__pop,
.lesson-posture[data-hide~='shake'] .posture__marks > .posture__badge[data-cue='shake'] .posture__pop {
  animation: none;
  transform: scale(0);
  opacity: 0;
}

.lesson-posture[data-hide~='tall'] .posture__marks > [data-cue='tall']:not(.posture__badge),
.lesson-posture[data-hide~='level'] .posture__marks > [data-cue='level']:not(.posture__badge),
.lesson-posture[data-hide~='front'] .posture__marks > [data-cue='front']:not(.posture__badge),
.lesson-posture[data-hide~='feet'] .posture__marks > [data-cue='feet']:not(.posture__badge),
.lesson-posture[data-hide~='square'] .posture__marks > [data-cue='square']:not(.posture__badge),
.lesson-posture[data-hide~='heel'] .posture__marks > [data-cue='heel']:not(.posture__badge),
.lesson-posture[data-hide~='ball'] .posture__marks > [data-cue='ball']:not(.posture__badge),
.lesson-posture[data-hide~='press'] .posture__marks > [data-cue='press']:not(.posture__badge),
.lesson-posture[data-hide~='roll'] .posture__marks > [data-cue='roll']:not(.posture__badge),
.lesson-posture[data-hide~='hang'] .posture__marks > [data-cue='hang']:not(.posture__badge),
.lesson-posture[data-hide~='shake'] .posture__marks > [data-cue='shake']:not(.posture__badge) {
  opacity: 0;
}

.lesson-posture[data-hide~='tall'] .posture__key-row[data-cue='tall'],
.lesson-posture[data-hide~='level'] .posture__key-row[data-cue='level'],
.lesson-posture[data-hide~='front'] .posture__key-row[data-cue='front'],
.lesson-posture[data-hide~='feet'] .posture__key-row[data-cue='feet'],
.lesson-posture[data-hide~='square'] .posture__key-row[data-cue='square'],
.lesson-posture[data-hide~='heel'] .posture__key-row[data-cue='heel'],
.lesson-posture[data-hide~='ball'] .posture__key-row[data-cue='ball'],
.lesson-posture[data-hide~='press'] .posture__key-row[data-cue='press'],
.lesson-posture[data-hide~='roll'] .posture__key-row[data-cue='roll'],
.lesson-posture[data-hide~='hang'] .posture__key-row[data-cue='hang'],
.lesson-posture[data-hide~='shake'] .posture__key-row[data-cue='shake'] {
  opacity: 0.3;
}

/* Its word: the number pops up, and its row in the key lights up. */
.posture__marks > .posture__badge.is-cued .posture__pop {
  animation: posture-pop 520ms cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

.posture__key-row.is-cued .posture__pop {
  animation: posture-pulse 700ms ease both;
}

.posture__key-row.is-cued .posture__key-text {
  animation: posture-ink 2.2s ease both;
}

@keyframes posture-breathe {
  0%,
  100% {
    transform: scale(1, 1);
  }
  45% {
    transform: scale(1.008, 1.016);
  }
}

@keyframes posture-deep {
  0%,
  100% {
    transform: scale(1, 1);
  }
  40% {
    transform: scale(1.03, 1.05);
  }
}

@keyframes posture-blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  96.5% {
    transform: scaleY(0.1);
  }
}

@keyframes posture-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.3);
  }
}

@keyframes posture-ink {
  0%,
  55% {
    fill: var(--accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lesson-posture *,
  .lesson-posture *::before {
    animation: none !important;
    transition: none !important;
  }
}

/* The beat. */
.lesson-beat {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.lesson-beat__light {
  display: grid;
  place-items: center;
  width: clamp(120px, 22cqh, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #7dd3fc, var(--accent) 62%, #0369a1);
  box-shadow: 0 0 0 10px rgba(14, 165, 233, 0.12), 0 8px 26px -8px rgba(3, 105, 161, 0.6);
  color: #fff;
}

.lesson-beat__light[data-phase='play'] {
  background: radial-gradient(circle at 38% 32%, #86efac, var(--held) 62%, #15803d);
  box-shadow: 0 0 0 10px rgba(34, 197, 94, 0.14), 0 8px 26px -8px rgba(21, 128, 61, 0.6);
}

.lesson-beat__count {
  font-size: clamp(44px, 7cqh, 72px);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.lesson-beat__dots {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lesson-beat__dot {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--page);
  transition: background 120ms, border-color 120ms;
}

.lesson-beat__dot[data-state='due'] {
  border-color: var(--held);
}

.lesson-beat__dot[data-state='on'] {
  border-color: var(--held-ink);
  background: var(--held);
}

.lesson-beat__dot[data-state='early'],
.lesson-beat__dot[data-state='late'] {
  border-color: var(--amber-ink);
  background: var(--amber);
}

.lesson-beat__dot[data-state='missed'] {
  border-color: var(--line-strong);
  background: var(--fill);
}

.lesson-beat__words,
.lesson-hold__words {
  min-height: 1.4em;
  margin: 0;
  color: var(--ink-2);
  font-size: 17px;
  font-weight: 650;
  text-align: center;
}

/* A held note. */
.lesson-hold {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(100%, 560px);
}

.lesson-hold__key {
  display: grid;
  place-items: center;
  width: 64px;
  height: 92px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(#fff 55%, var(--right-wash));
  color: var(--right-ink);
  font-size: 26px;
  font-weight: 850;
}

.lesson-hold__key {
  transition: transform 120ms ease, background 120ms ease;
}

.lesson-hold__key[data-down='true'] {
  transform: translateY(4px);
  background: linear-gradient(var(--right-wash), #bae6fd);
  box-shadow: inset 0 3px 8px rgba(15, 23, 42, 0.12);
}

/* The beats as numbered cells the bar fills, and "Let go" at the end (from 13 Nov). */
.lesson-hold__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.lesson-hold__track {
  position: relative;
  flex: 1;
  height: 56px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.lesson-hold__cell {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  border-right: 2px solid rgba(15, 23, 42, 0.12);
  color: var(--ink-3);
  font-size: 26px;
  font-weight: 850;
  transition: color 150ms ease;
}

.lesson-hold__cell:last-child {
  border-right: 0;
}

.lesson-hold__cell[data-state='now'] {
  color: var(--ink);
  text-shadow: 0 0 8px #fff, 0 0 3px #fff;
  animation: hold-beat 420ms cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.lesson-hold__cell[data-state='done'] {
  color: rgba(255, 255, 255, 0.82);
}

.lesson-hold__go {
  flex: none;
  padding: 12px 18px;
  border: 2px dashed var(--line-strong);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.lesson-hold__go[data-state='now'] {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  animation: hold-beat 520ms cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes hold-beat {
  0% {
    transform: scale(0.8);
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lesson-hold__cell[data-state='now'],
  .lesson-hold__go[data-state='now'] {
    animation: none;
  }
}

.lesson-hold__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, #38bdf8, var(--accent));
}

.lesson-hold__fill[data-state='ok'] {
  background: linear-gradient(90deg, #4ade80, var(--held));
}

.lesson-hold__fill[data-state='short'] {
  background: linear-gradient(90deg, #fcd34d, var(--amber));
}

.lesson-hold__beat {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: rgba(15, 23, 42, 0.18);
}

.lesson-hold__need {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 75%;
  width: 0;
  border-left: 2px dashed rgba(15, 23, 42, 0.28);
}

.lesson-hold__labels {
  display: flex;
  justify-content: space-around;
  width: 100%;
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 700;
}

/* A rhythm: the count light, and the line of notes with its playhead (Stage 20's lessons). */
.lesson-rhythm {
  width: min(100%, 860px);
}

.lesson-rhythm__light {
  width: clamp(86px, 15cqh, 130px);
}

.lesson-rhythm__line {
  width: 100%;
  height: auto;
  max-height: calc(100cqh - 230px);
}

.lesson-rhythm__line[data-hold='true'] .notation__length {
  fill: rgb(139 92 246 / 0.18);
}

/* The stave: the note asked for ringed, each ticked as it's played, and the letters underneath. */
.lesson-stave {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
}

.lesson-stave__music {
  display: grid;
  place-items: center;
  width: 100%;
}

.lesson-stave__music .notation--stave {
  width: min(100%, 620px);
  height: auto;
  max-height: calc(100cqh - 70px);
}

.lesson-stave .notation__note.is-mark,
.game-stave .notation__note.is-mark {
  color: var(--right-hand);
}

.lesson-stave .notation__note.is-done {
  color: var(--held);
}

.lesson-stave__name {
  fill: var(--ink-2);
  font-size: 9px;
  font-weight: 750;
}

.lesson-stave__grand {
  display: grid;
  gap: 4px;
  width: min(100%, 620px);
}

.lesson-stave__grand .notation--stave {
  width: 100%;
  height: auto;
  max-height: calc(50cqh - 40px);
}

.lesson-stave__interval {
  fill: var(--left-ink);
  font-size: 8.5px;
  font-weight: 800;
}

.lesson-stave__words {
  min-height: 1.4em;
  margin: 0;
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 650;
}

/* Loud and quiet. */
.lesson-loud .notation[data-state='asked'] {
  color: var(--right-hand);
}

.lesson-loud .notation[data-state='right'] {
  color: var(--held);
}

/* How an exam is marked. */
.lesson-exam {
  display: grid;
  gap: 26px;
  width: min(100%, 760px);
}

.lesson-exam__parts {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lesson-exam__part {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  padding: 14px 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--page);
  transition: border-color 200ms, background 200ms, transform 200ms;
}

.lesson-exam__part b {
  font-size: 16px;
}

.lesson-exam__marks {
  color: var(--accent-ink);
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.lesson-exam__about {
  color: var(--ink-3);
  font-size: 13px;
}

.lesson-exam[data-show='pieces'] [data-part='pieces'],
.lesson-exam[data-show='technical'] [data-part='technical'],
.lesson-exam[data-show='reading'] [data-part='reading'],
.lesson-exam[data-show='listening'] [data-part='listening'],
.lesson-exam[data-show='parts'] .lesson-exam__part {
  border-color: var(--right-hand);
  background: var(--right-wash);
}

.lesson-exam[data-show='pieces'] [data-part='pieces'],
.lesson-exam[data-show='technical'] [data-part='technical'],
.lesson-exam[data-show='reading'] [data-part='reading'],
.lesson-exam[data-show='listening'] [data-part='listening'] {
  transform: translateY(-4px);
}

.lesson-exam__bands {
  display: grid;
  gap: 6px;
  opacity: 0.55;
  transition: opacity 200ms;
}

.lesson-exam[data-show='marks'] .lesson-exam__bands,
.lesson-exam[data-show='again'] .lesson-exam__bands {
  opacity: 1;
}

.lesson-exam__bar {
  position: relative;
  height: 16px;
  margin-bottom: 34px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--fill) 0 66.6%, var(--xp-wash) 66.6% 80%, #fef3c7 80% 86.6%, #fde68a 86.6%);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.lesson-exam__band {
  position: absolute;
  top: -4px;
  display: grid;
  justify-items: start;
  padding-left: 6px;
  border-left: 2px solid var(--ink-2);
  height: 46px;
  font-size: 13px;
  white-space: nowrap;
}

.lesson-exam__band b {
  margin-top: 22px;
  font-variant-numeric: tabular-nums;
}

.lesson-exam__band span {
  color: var(--ink-2);
}

.lesson-exam__total {
  justify-self: end;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .lesson-scene,
  .lesson__hint,
  .lesson__intro-card,
  .lesson[data-layout='strip'],
  .lesson__turn[data-state='waiting'],
  .lesson__voice[data-speaking='true'] svg rect,
  .lesson-keys__black.is-pair,
  .keyoverlay__pair {
    animation: none;
  }
}

.lesson-path__plot {
  fill: none;
  stroke: rgba(15, 23, 42, 0.12);
  stroke-width: 1.5;
}

/* The scene's pictures fit its box both ways. */
.lesson__scene {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  container: scene / size;
}

.lesson-scene {
  height: 100%;
}

.lesson-scene > svg {
  width: min(100%, 760px);
  height: auto;
  max-height: calc(100cqh - 46px);
}

.lesson-scene--hand > svg,
.lesson-scene--posture > svg {
  width: min(100%, 1000px);
  max-height: calc(100cqh - 8px);
}

.lesson-hand__tag {
  visibility: visible;
}

.lesson-seed svg {
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1);
}

/* ── Games (Stage 14) ─────────────────────────────────────────────────────── */

.app.game-open .home,
.app.game-open .course,
.app.game-open .stand,
.app.game-open .lesson {
  display: none;
}

.game {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.4vh, 16px);
  min-width: 0;
  min-height: 0;
  container: game / inline-size;
}

.game[hidden] {
  display: none;
}

.game__head {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.game__where {
  margin: 0;
  color: var(--left-ink);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.game__title {
  margin: 0;
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.game__time {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.game__timebar {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--fill);
}

.game__timebar-fill {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: linear-gradient(90deg, #a78bfa, var(--left-hand));
  transform-origin: left;
  transition: transform 120ms linear;
}

.game__timebar-fill[data-low='true'] {
  background: linear-gradient(90deg, #fbbf24, var(--next));
}

.game__clock {
  min-width: 3.2em;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.game__close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
}

.game__close svg {
  width: 20px;
  height: 20px;
}

.game__close:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--fill);
  color: var(--ink);
}

.game__hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.game__stat {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page);
}

.game__stat-label {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.game__stat-value {
  display: inline-block;
  min-width: 1.5em;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.game__stat--score .game__stat-value {
  min-width: 3.4em;
  color: var(--left-ink);
}

.game__times {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--next);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
}

.game__times[data-on='false'] {
  display: none;
}

.game__pips {
  display: inline-flex;
  gap: 3px;
  align-self: center;
}

.game__pip {
  width: 7px;
  height: 14px;
  border-radius: 2px;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.game__pip[data-on='true'] {
  background: var(--left-hand);
  box-shadow: none;
}

.game__news {
  margin: 0 0 0 auto;
  color: var(--left-ink);
  font-size: 14.5px;
  font-weight: 700;
}

.game__news[data-tone='down'] {
  color: var(--ink-2);
}

.game__stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  justify-items: center;
  gap: clamp(8px, 1.6vh, 18px);
  min-height: 0;
  padding: clamp(14px, 2.4vh, 28px) clamp(14px, 2vw, 28px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--wash);
}

.game__prompt {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.game__words {
  margin: 0;
  font-size: clamp(28px, 4.6vh, 46px);
  font-weight: 820;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.game__detail {
  margin: 0;
  color: var(--ink-2);
  font-size: 16px;
}

.game__stage[data-phase='listen'] .game__words::before {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.35em;
  border-radius: 50%;
  background: var(--left-hand);
  vertical-align: 0.12em;
  animation: game-listen 900ms ease-in-out infinite;
}

@keyframes game-listen {
  50% {
    transform: scale(0.6);
    opacity: 0.5;
  }
}

.game__scene {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 0;
  container: scene / size;
}

.game-scene {
  display: grid;
  place-items: center;
  gap: 14px;
  width: 100%;
  min-height: 0;
  animation: lesson-scene-in 300ms cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
}

.game-scene__note {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  text-align: center;
}

.game__feedback {
  min-height: 1.5em;
  margin: 0;
  color: var(--ink-2);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  white-space: pre-wrap;
}

.game__feedback[data-tone='right'] {
  color: var(--held-ink);
}

.game__feedback[data-tone='wrong'] {
  color: var(--wrong);
}

.game__feedback[data-tone='hint'] {
  color: var(--amber-ink);
}

.game__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.game__control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px 8px 12px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 650;
}

.game__control svg {
  width: 17px;
  height: 17px;
}

.game[data-layout='intro'] .game__controls,
.game[data-layout='intro'] .game__hud,
.game[data-layout='results'] .game__controls {
  visibility: hidden;
}

/* The start card and the results, over the stage. */
.game__intro,
.game__results {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(248 250 252 / 0.84);
  backdrop-filter: blur(3px);
}

.game__intro[hidden],
.game__results[hidden] {
  display: none;
}

.game__card {
  display: grid;
  gap: 12px;
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 26px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--page);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06), 0 26px 60px -26px rgba(15, 23, 42, 0.45);
  animation: settings-in 260ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}

.game__card-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--left-wash);
  color: var(--left-ink);
}

.game__card-icon svg {
  width: 28px;
  height: 28px;
}

.game__card-where {
  margin: 4px 0 0;
  color: var(--left-ink);
  font-size: 13.5px;
  font-weight: 700;
}

.game__card-title {
  margin: -6px 0 0;
  font-size: 28px;
  font-weight: 790;
  letter-spacing: -0.015em;
}

.game__card-how {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.45;
}

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

.game__card-facts--results {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.game__card-fact {
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--fill);
}

.game__card-fact dt {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game__card-fact dd {
  margin: 2px 0 0;
  font-size: 15.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.game__card-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
}

.game__card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.game__card-actions .btn {
  padding: 10px 18px;
  font-size: 15px;
}

.game__result-score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.game__result-score b {
  color: var(--left-ink);
  font-size: 52px;
  font-weight: 850;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.game__result-score > span {
  color: var(--ink-2);
  font-size: 16px;
}

.game__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  background: #fef3c7;
  color: var(--amber-ink) !important;
  font-size: 14px !important;
  font-weight: 800;
}

.game__badge svg {
  width: 18px;
  height: 18px;
}

/* A hidden song (Finger Numbers): the finger number big, the score and the challenge quiet. */
.game[data-hidden='true'] .game__words {
  font-size: clamp(64px, 12vh, 120px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.game[data-hidden='true'] .game__hud {
  opacity: 0.55;
  transform: scale(0.88);
  transform-origin: top right;
}

.game__reveal {
  display: grid;
  gap: 4px;
  justify-items: start;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--held-wash);
  color: var(--held-ink);
}

.game__reveal p {
  margin: 0;
}

.game__reveal-by {
  font-weight: 700;
}

/* Stage 7: a drill's notes, played back as a tune with the band; a quick check's one line. */
.game__tune {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.4;
}

.game__tune b {
  color: var(--ink);
}

.game__card-line {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 15px;
}

.game__quest {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.4;
}

.game__quest[data-state='passed'] {
  background: var(--held-wash);
  color: var(--held-ink);
  font-weight: 700;
}

/* What the round earned, beside its points. */
.game__result-score > .game__result-xp {
  align-self: center;
  padding: 4px 12px;
  border: 1px solid var(--xp-line);
  border-radius: 999px;
  background: var(--xp-wash);
  color: var(--xp-ink);
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* The results' tiles in their tiers (round.js TIERS: the lines are the game's own). Each lands
   once its number has counted up: Not yet and Nearly in soft, flat colours (honest, never
   alarming: no shake, no glow); Good in green with a soft glow; Great in gold leaf that catches
   the light once; Exceptional in platinum, cool and bright, catching the light now and then
   with a slow glow and a twinkle. The word says it too, so it never rests on colour alone. */
.game__tile {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1.5px solid transparent;
  transition: background-color 450ms ease, border-color 450ms ease, box-shadow 700ms ease;
}

.game__tile dd {
  display: grid;
  gap: 1px;
}

.game__tile-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  transition: color 450ms ease;
}

.game__tile-tier {
  min-height: 1.25em;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 320ms 120ms ease, transform 420ms 120ms cubic-bezier(0.2, 0.9, 0.25, 1.3);
}

.game__tile[data-revealed='true'] .game__tile-tier {
  opacity: 1;
  transform: none;
}

.game__tile::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / 0.9) 47%, rgb(255 255 255 / 0) 62%);
  opacity: 0;
  transform: translateX(-110%);
  pointer-events: none;
}

.game__tile[data-tier='red'][data-revealed='true'] {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.game__tile[data-tier='amber'][data-revealed='true'] {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.game__tile[data-tier='green'][data-revealed='true'] {
  background: #f0fdf4;
  border-color: #86efac;
  box-shadow: 0 0 0 3px rgb(34 197 94 / 0.12), 0 6px 18px -8px rgb(34 197 94 / 0.55);
  color: #15803d;
  animation: tile-land 520ms cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

.game__tile[data-tier='gold'][data-revealed='true'] {
  background: linear-gradient(140deg, #fffbeb 0%, #fef3c7 48%, #fde68a 100%);
  border-color: #f5b73b;
  box-shadow: 0 0 0 3px rgb(245 158 11 / 0.16), 0 8px 24px -6px rgb(245 158 11 / 0.6);
  color: #92400e;
  animation: tile-land 560ms cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

.game__tile[data-tier='gold'][data-revealed='true']::before {
  animation: tile-sheen 1100ms 140ms ease-out;
}

.game__tile[data-tier='platinum'][data-revealed='true'] {
  background: linear-gradient(140deg, #ffffff 0%, #f1f5f9 30%, #e2e8f0 52%, #f5f3ff 74%, #ecfeff 100%);
  border-color: #a5b4c8;
  color: #1e293b;
  animation: tile-land 600ms cubic-bezier(0.2, 0.9, 0.25, 1.2), platinum-glow 3.2s 600ms ease-in-out infinite alternate;
  box-shadow: 0 0 0 3px rgb(199 210 254 / 0.55), 0 0 22px 0 rgb(165 180 252 / 0.45), 0 10px 26px -10px rgb(71 85 105 / 0.5);
}

.game__tile[data-tier='platinum'][data-revealed='true']::before {
  animation: tile-sheen-again 4.2s 140ms ease-in-out infinite;
}

.game__tile[data-tier='platinum'][data-revealed='true']::after {
  content: '';
  position: absolute;
  top: 9px;
  right: 10px;
  width: 11px;
  height: 11px;
  background: linear-gradient(135deg, #ffffff, #a5b4fc);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: twinkle 2.6s 900ms ease-in-out infinite;
}

.game__tile[data-tier='platinum'] .game__tile-tier {
  background: linear-gradient(90deg, #475569, #6366f1 55%, #0891b2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes tile-land {
  40% {
    transform: scale(1.045);
  }
}

@keyframes tile-sheen {
  0% {
    opacity: 1;
    transform: translateX(-110%);
  }
  100% {
    opacity: 1;
    transform: translateX(110%);
  }
}

@keyframes tile-sheen-again {
  0% {
    opacity: 1;
    transform: translateX(-110%);
  }
  32%,
  100% {
    opacity: 1;
    transform: translateX(110%);
  }
}

@keyframes platinum-glow {
  to {
    box-shadow: 0 0 0 3px rgb(199 210 254 / 0.75), 0 0 34px 4px rgb(165 180 252 / 0.6), 0 10px 26px -10px rgb(71 85 105 / 0.5);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.7) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) rotate(45deg);
  }
}

/* The challenge: where it ended, as pips, and what the next round does. */
.game__challenge dd {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.game__challenge-next {
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}

/* How it's scored: the points, and the tiers' scale. */
.game__how {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.45;
}

.game__how summary {
  width: fit-content;
  color: var(--left-ink);
  font-weight: 700;
  cursor: pointer;
}

.game__how p {
  margin: 6px 0 0;
}

.game__tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.game__tier-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12.5px;
}

.game__tier-chip span {
  opacity: 0.8;
}

.game__tier-chip[data-tier='red'] {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.game__tier-chip[data-tier='amber'] {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.game__tier-chip[data-tier='green'] {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
}

.game__tier-chip[data-tier='gold'] {
  border-color: #f5b73b;
  background: linear-gradient(140deg, #fffbeb, #fde68a);
  color: #92400e;
}

.game__tier-chip[data-tier='platinum'] {
  border-color: #a5b4c8;
  background: linear-gradient(140deg, #ffffff, #e2e8f0 55%, #f5f3ff);
  color: #1e293b;
}

@media (prefers-reduced-motion: reduce) {
  .game__tile,
  .game__tile-value,
  .game__tile-tier {
    transition: none;
  }

  .game__tile[data-revealed='true'],
  .game__tile[data-revealed='true']::before,
  .game__tile[data-revealed='true']::after {
    animation: none !important;
  }
}

/* Answer buttons (listening prompts). */
.game__choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.game__choices[hidden] {
  display: none;
}

.game__choice {
  display: grid;
  grid-template-rows: 56px auto;
  justify-items: center;
  gap: 4px;
  min-width: 150px;
  padding: 12px 22px 10px;
  border: 2px solid var(--line-strong);
  border-radius: 16px;
  background: var(--page);
  color: var(--ink);
}

.game__choice .notation--dynamic {
  height: 52px;
  color: var(--ink);
}

.game__choice-label {
  font-size: 17px;
  font-weight: 750;
}

.game__choice-key {
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink-2);
  font: 600 11px/1.6 inherit;
}

.game__choice:hover:not(:disabled) {
  border-color: var(--left-hand);
  background: var(--left-wash);
}

.game__choice:disabled {
  opacity: 0.55;
}

.game__choice[data-state='answer'] {
  border-color: var(--held);
  background: var(--held-wash);
  opacity: 1;
}

.game__choice[data-state='wrong'] {
  border-color: var(--wrong);
  background: #fef2f2;
  opacity: 1;
}

/* Smooth and bouncy, drawn: a long joined line, or short dots. */
.game__choice-sign {
  display: block;
  align-self: center;
  width: 92px;
  height: 22px;
}

.game__choice-sign--legato {
  border-radius: 11px;
  background: linear-gradient(90deg, var(--right-hand) 0 22%, transparent 22% 26%, var(--right-hand) 26% 48%, transparent 48% 52%, var(--right-hand) 52% 74%, transparent 74% 78%, var(--right-hand) 78%);
  background-size: 100% 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.game__choice-sign--staccato {
  background: radial-gradient(circle, var(--right-hand) 5px, transparent 6px) 0 50% / 23px 22px repeat-x;
}

/* C Hunt: the eight Cs. */
.game-cs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game-cs__c {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 2px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--page);
  color: var(--ink-3);
  font-size: 18px;
  font-weight: 800;
}

.game-cs__c[data-middle='true'] {
  border-style: solid;
}

.game-cs__c[data-found='true'] {
  border: 2px solid var(--held);
  background: var(--held-wash);
  color: var(--held-ink);
  animation: game-pop 300ms cubic-bezier(0.2, 0.8, 0.3, 1.4);
}

@keyframes game-pop {
  from {
    transform: scale(0.8);
  }
}

/* Copy Me and finger sequences: a dot for each note. */
.game-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game-dots__dot {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--page);
  color: var(--ink-2);
  font-size: 20px;
  font-weight: 800;
  transition: background 160ms, border-color 160ms, transform 160ms;
}

.game-dots__dot[data-state='waiting'] {
  border-style: dashed;
}

.game-dots__dot[data-state='playing'] {
  border-color: var(--left-hand);
  background: var(--left-wash);
  transform: scale(1.12);
}

.game-dots__dot[data-state='heard'] {
  border-color: #c4b5fd;
}

.game-dots__dot[data-state='right'] {
  border-color: var(--held);
  background: var(--held-wash);
  color: var(--held-ink);
}

.game-dots__dot[data-state='wrong'] {
  border-color: var(--wrong);
  background: #fef2f2;
}

/* Pedal Timing: under the notes, a mark for each key's pedal change, and the pedal's state. */
.game-pedal {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.game-pedal__cell {
  width: 40px;
  height: 10px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
}

.game-pedal__cell[data-state='ok'] {
  border-color: var(--held);
  background: var(--held-wash);
}

.game-pedal__cell[data-state='early'],
.game-pedal__cell[data-state='blur'],
.game-pedal__cell[data-state='dry'],
.game-pedal__cell[data-state='none'] {
  border-color: var(--wrong);
  background: #fef2f2;
}

.game-pedal__state {
  margin: 8px 0 0;
  color: var(--ink-2);
  text-align: center;
}

.game-pedal__state[data-down='true'] {
  color: var(--held-ink);
  font-weight: 600;
}

/* Finger Numbers: the number called and a hand of five fingers. */
.game-fingers {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.game-fingers__number {
  color: var(--left-ink);
  font-size: clamp(64px, 14cqh, 120px);
  font-weight: 860;
  letter-spacing: 0.08em;
  line-height: 1;
}

.game-fingers__hand {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 92px;
}

.game-fingers__finger {
  display: grid;
  place-items: end center;
  width: 34px;
  padding-bottom: 6px;
  border-radius: 17px 17px 10px 10px;
  background: #fde7d4;
  box-shadow: inset 0 0 0 1.5px #e9b48c;
  color: #9a5b33;
  font-size: 15px;
  font-weight: 800;
}

.game-fingers__finger[data-finger='1'] {
  height: 52px;
}
.game-fingers__finger[data-finger='2'] {
  height: 80px;
}
.game-fingers__finger[data-finger='3'] {
  height: 90px;
}
.game-fingers__finger[data-finger='4'] {
  height: 82px;
}
.game-fingers__finger[data-finger='5'] {
  height: 64px;
}

.game-fingers__finger[data-called='true'] {
  background: var(--left-hand);
  box-shadow: none;
  color: #fff;
}

/* Hand Swap: two hands, the part each plays, in that hand's own colour. */
.game-fingers__parts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(24px, 6cqw, 72px);
}

.game-fingers__part {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.game-fingers__number--part {
  font-size: clamp(36px, 8cqh, 64px);
}

.game-fingers__part:has([data-hand='right']) .game-fingers__number {
  color: var(--right-ink);
}

.game-fingers--parts .game-fingers__hand[data-hand='right'] .game-fingers__finger[data-called='true'] {
  background: var(--right-hand);
}

/* Staves. */
.game-stave {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
}

.game-stave .notation--stave {
  width: min(100%, 640px);
  height: auto;
  max-height: calc(100cqh - 60px);
}

/* The grand staff (Grand Staff Catcher): treble over bass, as one picture. */
.game-stave__grand {
  display: grid;
  gap: 0;
  justify-items: center;
  width: min(100%, 560px);
}

.game-stave__grand .notation--stave {
  width: 100%;
  max-height: calc(50cqh - 34px);
}

.notation {
  overflow: visible;
  color: var(--ink);
}

.notation path {
  fill: currentColor;
}

.notation__line,
.notation__ledger,
.notation__stem,
.notation__bar {
  stroke: currentColor;
  stroke-width: 1;
}

.notation__bar--end {
  stroke-width: 1.6;
}

.notation__catch {
  stroke: var(--left-hand);
  stroke-width: 2.4;
  stroke-dasharray: 3 3;
}

.notation__note--travel {
  color: var(--ink);
}

.notation__note--travel[data-caught='right'] {
  color: var(--held);
}

.notation__note--travel[data-caught='missed'] {
  color: var(--wrong);
}

.notation__slur {
  fill: currentColor;
}

.game-moves {
  display: flex;
  justify-content: center;
  gap: 12px;
  min-height: 30px;
}

.game-moves__move {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--fill);
  font-size: 15px;
  font-weight: 750;
}

.game-moves__move--step {
  background: var(--right-wash);
  color: var(--right-ink);
}

.game-moves__move--skip {
  background: var(--left-wash);
  color: var(--left-ink);
}

/* Smooth or Bouncy: how the notes joined, as bars along a line. */
.game-touch {
  position: relative;
  width: min(100%, 520px);
  height: 34px;
  border-bottom: 1px solid var(--line-strong);
}

.game-touch__note {
  position: absolute;
  height: 12px;
  border-radius: 6px;
  background: var(--right-hand);
}

.game-touch__note[data-join='gap'],
.game-touch__note[data-join='blurred'] {
  background: var(--amber);
}

/* Rhythm: the phrase, a playhead, and the next one underneath. */
.game-rhythm {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
}

.game-rhythm__now {
  display: grid;
  justify-items: center;
  width: 100%;
}

.game-rhythm__now .notation--rhythm {
  width: min(100%, 900px);
  height: auto;
  max-height: calc(100cqh - 110px);
}

.game-rhythm__head {
  stroke: var(--left-hand);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.game-rhythm__head[data-state='waiting'] {
  stroke: var(--line-strong);
}

.game-rhythm__count {
  min-height: 1.4em;
  margin: 0;
  color: var(--left-ink);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.game-rhythm__next {
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0.6;
}

.game-rhythm__next-word {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game-rhythm__next .notation--rhythm {
  width: min(48vw, 420px);
  height: auto;
}

.notation--rhythm .notation__length {
  fill: transparent;
}

.game__scene[data-hold='true'] .notation__length {
  fill: rgb(139 92 246 / 0.18);
}

.notation--rhythm .notation__note[data-state='perfect'],
.notation--rhythm .notation__note[data-state='good'] {
  color: var(--held);
}

.notation--rhythm .notation__note[data-state='early'],
.notation--rhythm .notation__note[data-state='late'],
.notation--rhythm .notation__note[data-state='short'],
.notation--rhythm .notation__note[data-state='long'] {
  color: var(--amber);
}

.notation--rhythm .notation__note[data-state='missed'] {
  color: var(--wrong);
}

/* Loud or Quiet: the signs and the meter. */
.game-loud {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(100%, 620px);
}

.game-loud__signs {
  display: flex;
  gap: 24px;
}

.game-loud__signs .notation--dynamic {
  height: clamp(70px, 16cqh, 120px);
  width: auto;
}

.game-loud__signs .notation[data-state='right'] {
  color: var(--held);
}

.game-loud__signs .notation[data-state='wrong'] {
  color: var(--wrong);
}

.game-loud__ear {
  color: var(--left-ink);
  font-size: 22px;
  font-weight: 750;
}

.game-meter {
  position: relative;
  width: 100%;
  height: 26px;
  margin: 8px 0 18px;
  border-radius: 13px;
  background: linear-gradient(90deg, #ede9fe, #f8fafc 50%, #fee2e2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.game-meter__zone {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 13px;
}

.game-meter__zone--quiet {
  left: 0;
  background: rgb(139 92 246 / 0.18);
}

.game-meter__zone--loud {
  background: rgb(239 68 68 / 0.16);
}

.game-meter__end {
  position: absolute;
  top: 30px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}

.game-meter__end--quiet {
  left: 4px;
}

.game-meter__end--loud {
  right: 4px;
}

.game-meter__mark {
  position: absolute;
  top: -6px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 38px;
  margin-left: -13px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  animation: game-pop 240ms cubic-bezier(0.2, 0.8, 0.3, 1.4);
}

.game-meter__mark[data-ok='true'] {
  background: var(--held);
}

.game-meter__mark[data-ok='false'] {
  background: var(--wrong);
}

/* Balance Beam: the tune's mark (right hand) and the left hand's, in their own colours; the ring
   says whether the pair was balanced. */
.game-meter__mark--left {
  width: 18px;
  height: 28px;
  margin-left: -9px;
  top: -1px;
  background: var(--left-hand);
}

.game-meter__mark--right {
  background: var(--right-hand);
}

.game-meter__mark--left[data-ok],
.game-meter__mark--right[data-ok] {
  box-shadow: 0 0 0 2px var(--surface, #fff), 0 0 0 4px var(--held);
}

.game-meter__mark--left[data-ok='false'],
.game-meter__mark--right[data-ok='false'] {
  box-shadow: 0 0 0 2px var(--surface, #fff), 0 0 0 4px var(--wrong);
}

/* Split Touch: each hand's stave, what it's asked for, and its notes as bars below. */
.game-split {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 100%;
}

.game-split__label {
  color: var(--right-ink);
  font-size: 14px;
  font-weight: 760;
}

.game-split[data-hand='left'] .game-split__label {
  color: var(--left-ink);
}

.game-split .notation--stave {
  width: min(100%, 400px);
  max-height: none;
}

.game-split[data-hand='left'] .game-touch__note {
  background: var(--left-hand);
}

/* No Stopping: each note's letter under the tune. */
.game-rhythm__letter {
  fill: var(--ink-2);
  font-size: 9px;
  font-weight: 760;
}

/* A hairpin between two dynamics (Level 34): opening out for a crescendo, closing for a diminuendo. */
.lesson-hairpin {
  align-self: center;
  width: clamp(80px, 14cqw, 160px);
  height: auto;
  color: var(--ink);
}

.lesson-hairpin path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* A road map (Level 36's lesson, Map Reader): bars on a stave, the signs, and where you are. */
.game-map {
  display: grid;
  justify-items: center;
  width: 100%;
}

.road-map {
  width: min(100%, 760px);
  height: auto;
  overflow: visible;
  color: var(--ink);
}

.road-map__cell {
  fill: transparent;
  transition: fill 160ms ease;
}

.road-map__cell[data-state='here'] {
  fill: rgb(14 165 233 / 0.2);
  stroke: var(--right-hand);
  stroke-width: 1.4;
}

.road-map__cell[data-state='next'] {
  fill: rgb(34 197 94 / 0.2);
  stroke: var(--held);
  stroke-width: 1.4;
}

.road-map__cell[data-state='wrong'] {
  fill: rgb(239 68 68 / 0.14);
  stroke: var(--wrong);
  stroke-width: 1.2;
  stroke-dasharray: 3 2;
}

.road-map__cell[data-state='played'] {
  fill: rgb(139 92 246 / 0.12);
}

.road-map__line,
.road-map__barline {
  stroke: currentColor;
  stroke-width: 0.7;
}

.road-map__barline {
  stroke-width: 0.9;
}

.road-map__thick,
.road-map__dot {
  fill: currentColor;
}

.road-map__bracket {
  fill: none;
  stroke: currentColor;
  stroke-width: 0.9;
}

.road-map__number {
  fill: var(--ink-2);
  font-size: 7.5px;
  font-weight: 700;
}

.road-map__ending {
  fill: currentColor;
  font-size: 8px;
  font-weight: 800;
}

.road-map__word {
  fill: currentColor;
  font-family: 'Alegreya', Georgia, serif;
  font-size: 9px;
  font-style: italic;
  font-weight: 700;
}

.road-map__label {
  fill: var(--ink-2);
  font-size: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .road-map__cell {
    transition: none;
  }
}

/* Rings on the real keys: the Cs found so far. */
.keyoverlay__ring--found {
  fill: rgb(34 197 94 / 0.24);
  stroke: var(--held);
  stroke-width: 2.4;
}

.keyoverlay__ring--target {
  fill: rgb(139 92 246 / 0.22);
  stroke: var(--left-hand);
  stroke-width: 2.4;
}

/* Calibrate: the soft and loud presses. */
.ctouch {
  display: flex;
  gap: 18px;
  margin: 8px 0 4px;
}

.ctouch__press {
  position: relative;
  display: grid;
  place-items: end center;
  width: 54px;
  height: 90px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.ctouch__fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 180ms ease-out;
}

.ctouch[data-want='loud'] .ctouch__fill {
  background: var(--next);
}

.ctouch__value {
  position: relative;
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ctouch__press[data-done='true'] .ctouch__value {
  color: #fff;
}

@container game (max-width: 720px) {
  .game__head {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .game__time {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .game__news {
    width: 100%;
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-cs__c[data-found='true'],
  .game-meter__mark,
  .game__stage[data-phase='listen'] .game__words::before {
    animation: none;
  }
}

/* ── Choosing the exam pieces (Stage 15) ────────────────────────────────── */

.exampieces {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
}

.exampieces[hidden] {
  display: none;
}

.exampieces__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(2px);
}

.exampieces__dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, 100%);
  max-height: calc(100vh - 40px);
  border-radius: 20px;
  background: var(--page);
  box-shadow: 0 30px 80px -24px rgba(15, 23, 42, 0.45);
  overflow: hidden;
}

.exampieces__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--line);
}

.exampieces__where {
  margin: 0;
  color: var(--xp-ink);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.exampieces__title {
  margin: 2px 0 0;
  font-size: 24px;
  font-weight: 790;
  line-height: 1.2;
}

.exampieces__close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--ink-2);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.exampieces__close:hover {
  background: var(--line);
  color: var(--ink);
}

.exampieces__body {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px 24px 20px;
  overflow-y: auto;
}

.exampieces__about {
  max-width: 78ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}

.exampieces__when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.exampieces__label {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
}

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

.exampieces__year {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.exampieces__year:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.exampieces__year[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.exampieces__note {
  max-width: 90ch;
  margin: 0;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.45;
}

.exampieces__lists {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.exampieces__list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.exampieces__list-title {
  margin: 0;
  font-size: 17px;
  font-weight: 780;
}

.exampieces__list-about {
  margin: -4px 0 2px;
  color: var(--ink-3);
  font-size: 13px;
}

.exampieces__pieces {
  display: grid;
  gap: 6px;
}

.exampieces__piece {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.exampieces__piece:hover {
  border-color: var(--line-strong);
  background: var(--wash);
}

.exampieces__piece[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.exampieces__n {
  display: grid;
  place-items: center;
  height: 26px;
  border-radius: 8px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.exampieces__piece[aria-checked='true'] .exampieces__n {
  background: var(--accent);
  color: #fff;
}

.exampieces__piece-words {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.exampieces__piece-title {
  font-size: 14.5px;
  font-weight: 720;
  line-height: 1.3;
}

.exampieces__by,
.exampieces__in {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.35;
}

.exampieces__in {
  color: var(--ink-3);
  font-size: 12.5px;
}

.exampieces__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.exampieces__tag {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
}

.exampieces__tag--course {
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px var(--xp-line);
  color: var(--xp-ink);
}

.exampieces__earlier {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.exampieces__earlier summary {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.exampieces__earlier[open] summary {
  margin-bottom: 8px;
}

.exampieces__earlier-lists {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.exampieces__earlier-title {
  margin: 0 0 4px;
  font-size: 14px;
}

.exampieces__earlier-list {
  margin: 0;
  padding-left: 22px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}

.exampieces__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  background: var(--wash);
}

.exampieces__summary {
  flex: 1 1 320px;
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.4;
}

.exampieces__summary b {
  color: var(--ink);
}

.exampieces__actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 900px) {
  .exampieces {
    padding: 10px;
  }

  .exampieces__lists,
  .exampieces__earlier-lists {
    grid-template-columns: minmax(0, 1fr);
  }

  .exampieces__head,
  .exampieces__body,
  .exampieces__foot {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* The learner's pieces on a level sheet. */
.levelsheet__pieces {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--right-wash);
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.35);
}

.levelsheet__pieces-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 760;
}

.levelsheet__pieces-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 1.4;
}

.levelsheet__pieces-list-name {
  display: inline-block;
  min-width: 52px;
  margin-right: 6px;
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 800;
}

.levelsheet__pieces .levelsheet__by {
  display: inline;
}

/* ── The trainer: scales and sight-reading (Stage 16) ─────────────────────── */

.app.trainer-open .home,
.app.trainer-open .course,
.app.trainer-open .stand,
.app.trainer-open .lesson,
.app.trainer-open .game {
  display: none;
}

.trainer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 1.4vh, 16px);
  min-width: 0;
  min-height: 0;
}

.trainer[hidden] {
  display: none;
}

.trainer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.trainer__where {
  margin: 0;
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 700;
}

.trainer__title {
  margin: 0;
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.trainer__close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
}

.trainer__close svg {
  width: 20px;
  height: 20px;
}

.trainer__body {
  min-height: 0;
  overflow-y: auto;
}

.trainer__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.trainer__quest,
.trainer__xp {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.trainer__quest[data-state='passed'] {
  color: var(--xp-ink);
  font-weight: 750;
}

/* The bands: Distinction, Merit, Pass, Not yet. */
.trainer-band {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 750;
  white-space: nowrap;
}

.trainer-band[data-band='distinction'] {
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px var(--xp-line);
  color: var(--xp-ink);
}

.trainer-band[data-band='merit'] {
  background: var(--held-wash);
  box-shadow: inset 0 0 0 1px var(--held-line);
  color: var(--held-ink);
}

.trainer-band[data-band='pass'] {
  background: var(--right-wash);
  color: var(--right-ink);
}

.trainer-band[data-band='not-yet'] {
  background: #fef2f2;
  color: #b91c1c;
}

.trainer-band--big {
  padding: 4px 14px;
  font-size: 17px;
}

/* The practice room. */
.trainer-room {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.trainer-room__tool {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--page);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
}

.trainer-room__title {
  margin: 0;
  font-size: 18px;
  font-weight: 780;
}

.trainer-room__about,
.trainer-room__level {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.trainer-room__level b {
  color: var(--ink);
}

.trainer-room__tabs {
  display: flex;
  gap: 6px;
}

.trainer-room__tab {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
}

.trainer-room__tab[aria-selected='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
}

.trainer-room__items {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trainer-room__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 0;
  padding: 8px 12px;
  border-radius: 10px;
  text-align: left;
}

.trainer-room__item-name {
  font-size: 14.5px;
  font-weight: 700;
}

.trainer-room__item-detail {
  grid-row: 2;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}

.trainer-room__item .trainer-band {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.trainer-room__steps summary {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.trainer-room__step-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

/* A scale asked for, and its verdict. */
.trainer-scale,
.trainer-reading,
.trainer-summary {
  display: grid;
  align-content: start;
  gap: 14px;
  max-width: 980px;
}

.trainer-scale__ask {
  display: grid;
  gap: 4px;
  padding: 18px 22px;
  border-radius: 16px;
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.trainer-scale__count {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 700;
}

.trainer-scale__words {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.015em;
}

.trainer-scale__detail,
.trainer-scale__hint {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.45;
}

.trainer-scale__hint {
  color: var(--ink-3);
}

/* The scale's music, with its fingers (18 Nov). */
.trainer-scale__music {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 8px 14px 10px;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
  overflow-x: auto;
}

.trainer-scale__paper {
  min-height: 110px;
}

.trainer-scale__paper svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.trainer-scale__caption {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 650;
}

/* Teach me: the steps, the words, and the progress while playing along. */
.trainer-teach__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.trainer-teach__steps li {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 700;
}

.trainer-teach__steps li[data-state='done'] {
  color: var(--ink-2);
}

.trainer-teach__steps li[data-state='now'] {
  background: var(--next-ink);
  box-shadow: none;
  color: #fff;
}

.trainer-teach__words {
  margin: 0;
  max-width: 68ch;
  font-size: 17px;
  line-height: 1.55;
}

.trainer-teach__hint {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
}

.trainer-teach__progress {
  font-variant-numeric: tabular-nums;
}

.trainer-scale__status,
.trainer-reading__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 650;
}

.trainer-verdict {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--page);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
}

.trainer-verdict__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.trainer-verdict__marks {
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 650;
}

.trainer-verdict__best {
  color: var(--xp-ink);
  font-size: 13.5px;
  font-weight: 750;
}

.trainer-verdict__words {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
}

.trainer-bars {
  display: grid;
  gap: 7px;
  margin: 0;
}

.trainer-bars__row {
  display: grid;
  grid-template-columns: 118px minmax(80px, 1fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}

.trainer-bars__row dt {
  color: var(--ink-2);
  font-weight: 700;
}

.trainer-bars__row dd {
  margin: 0;
}

.trainer-bars__meter {
  position: relative;
  height: 9px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--fill);
}

.trainer-bars__meter i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 5px;
  background: var(--held);
}

.trainer-bars__meter i[data-level='fair'] {
  background: var(--amber);
}

.trainer-bars__meter i[data-level='poor'] {
  background: var(--wrong);
}

.trainer-bars__detail {
  color: var(--ink-3);
}

.trainer-summary__list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.trainer-summary__list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 14.5px;
}

.trainer-summary__name {
  font-weight: 700;
}

.trainer-summary__words {
  flex-basis: 100%;
  color: var(--ink-2);
  font-size: 13.5px;
}

/* Sight-reading: the test on its paper. */
.trainer-reading__info {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 650;
}

.trainer-reading__paper {
  position: relative;
  min-height: 210px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
}

.trainer-reading__music {
  overflow-x: auto;
}

.trainer-reading__music svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.trainer-reading__cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: 14px;
  background: repeating-linear-gradient(135deg, var(--wash) 0 12px, var(--fill) 12px 24px);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 650;
  text-align: center;
}

.trainer-reading__countdown {
  min-width: 3em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.trainer-reading__timebar {
  position: relative;
  width: 160px;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fill);
}

.trainer-reading__timebar i {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: left;
  transition: transform 240ms linear;
}

.trainer-seg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
}

.trainer-seg__label {
  margin-right: 4px;
  color: var(--ink-2);
  font-weight: 700;
}

.trainer-seg__choice {
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 13px;
}

.trainer-seg__choice[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
}

@media (max-width: 860px) {
  .trainer-room {
    grid-template-columns: minmax(0, 1fr);
  }

  .trainer-bars__row {
    grid-template-columns: 100px minmax(60px, 1fr);
  }

  .trainer-bars__detail {
    grid-column: 1 / -1;
  }
}

.trainer-scale__status:empty {
  display: none;
}

/* The aural tests (Stage 17). */
.aural {
  display: grid;
  align-content: start;
  gap: 14px;
  max-width: 980px;
}

.aural__status {
  min-height: 24px;
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.aural__meter {
  position: relative;
  width: 120px;
  height: 8px;
  margin-left: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fill);
}

.aural__meter i {
  position: absolute;
  inset: 0;
  background: var(--held);
  transform: scaleX(0);
  transform-origin: left;
}

.aural__question {
  display: grid;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.aural__question-words {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.aural__question .btn[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
}

.trainer-room__sub {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.game-ear .game-loud__ear {
  font-size: 22px;
}

/* ── The chunk exams (Stage 18) ─────────────────────────────────────────── */

.app.exam-open .home,
.app.exam-open .course,
.app.exam-open .stand,
.app.exam-open .lesson,
.app.exam-open .game,
.app.exam-open .trainer {
  display: none;
}

section.exam {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 1.4vh, 16px);
  min-width: 0;
  min-height: 0;
}

section.exam[hidden] {
  display: none;
}

.exam__body > .exam {
  display: grid;
  align-content: start;
  gap: 16px;
  max-width: 980px;
  padding-bottom: 12px;
}

.exam__lead,
.exam__part,
.exam__closed,
.exam__practise,
.exam__confirm {
  display: grid;
  gap: 8px;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--page);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
}

.exam__lead {
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.exam__h {
  margin: 0;
  font-size: 16px;
  font-weight: 780;
}

.exam__about,
.exam__what,
.exam__note,
.exam__hint,
.exam__choose,
.exam__next,
.exam__outcome {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.45;
}

.exam__note {
  color: var(--accent-ink);
  font-weight: 650;
}

.exam__hint {
  color: var(--ink-3);
  font-size: 13.5px;
}

.exam__choose {
  color: var(--ink);
  font-weight: 650;
}

.exam__next,
.exam__outcome {
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 650;
}

.exam__message {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #fde68a;
  color: #92400e;
  font-size: 14.5px;
  line-height: 1.45;
}

.exam__pieces {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam__piece {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--right-wash);
}

.exam__piece-title,
.exam__option-title {
  font-weight: 750;
}

.exam__piece-meta,
.exam__option-meta {
  color: var(--ink-3);
  font-size: 13px;
}

.exam__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.exam__option {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 12px;
  text-align: left;
}

.exam__option[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.exam__tempo {
  flex-wrap: wrap;
}

.exam__order {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 22px;
}

.exam__order-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
}

.exam__order-words span {
  color: var(--ink-2);
}

.exam__move {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
}

.exam__move svg {
  width: 16px;
  height: 16px;
}

/* Taking it: the parts in order, done and to come. */
.exam__progress {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exam__step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
}

.exam__step[data-state='next'] {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.exam__step[data-state='done'] {
  background: var(--wash);
}

.exam__step-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--held-ink);
}

.exam__step[data-state='done'] .exam__step-mark {
  background: var(--held-wash);
  box-shadow: inset 0 0 0 1px var(--held);
}

.exam__step[data-state='next'] .exam__step-mark {
  background: var(--accent);
}

.exam__step-mark svg {
  width: 16px;
  height: 16px;
}

.exam__step-words {
  display: grid;
  gap: 2px;
  font-size: 15px;
}

.exam__step-what {
  color: var(--ink-2);
  font-size: 13.5px;
}

.exam__step-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.exam__step-pieces li {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}

.exam__step-pieces li[data-state='done'] {
  background: var(--held-wash);
  color: var(--held-ink);
}

.exam__step-pieces li[data-state='next'] {
  background: var(--right-wash);
  color: var(--accent-ink);
}

/* The report. */
.exam__result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 18px 22px;
  border-radius: 16px;
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.exam__total {
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 820;
  letter-spacing: -0.015em;
}

.exam__bands {
  color: var(--ink-3);
  font-size: 13.5px;
}

.exam__marks {
  display: grid;
  gap: 0;
  border-radius: 16px;
  background: var(--page);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
  overflow: hidden;
}

.exam__marks-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) 70px 104px minmax(0, 2.4fr);
  align-items: center;
  gap: 6px 14px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.exam__marks-row:first-child {
  border-top: 0;
}

.exam__marks-name {
  font-weight: 750;
}

.exam__marks-num {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.exam__marks-words {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.4;
}

.exam__practise ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 22px;
  font-size: 14.5px;
  line-height: 1.45;
}

.exam__certificate {
  display: grid;
  justify-items: center;
}

.exam__certificate-picture {
  width: min(100%, 560px);
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow-panel);
}

.exam__confirm p {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

/* The last report, in the course's exam sheet. */
.levelsheet__report {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.levelsheet__report-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 750;
}

.levelsheet__report-list {
  display: grid;
  gap: 3px;
  margin: 6px 0 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 860px) {
  .exam__marks-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .exam__marks-words {
    grid-column: 1 / -1;
  }
}

.exam__closed-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 22px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}


/* ── Today's plan (Stage 19) ────────────────────────────────────────────── */

.today {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--page);
}

.today[hidden] {
  display: none;
}

.today__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 24px;
}

.today__label {
  margin: 0;
  color: var(--accent-ink);
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.today__title {
  margin: 2px 0 0;
  font-size: 19px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.today__goal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.today__minutes {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.today__bar {
  position: relative;
  width: 140px;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fill);
}

.today__bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #4ade80, var(--held));
}

.today__choices {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: var(--fill);
}

.today__choice {
  min-width: 34px;
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}

.today__choice[aria-checked='true'] {
  background: var(--page);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.12);
  color: var(--ink);
}

.today__welcome {
  margin: 0;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px var(--xp-line);
  color: var(--xp-ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

.today__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.today__item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  align-content: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.today__item[data-done='true'] {
  background: var(--held-wash);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--held) 45%, transparent);
}

.today__mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--page);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: var(--held-ink);
}

.today__item[data-done='true'] .today__mark {
  background: var(--held);
  box-shadow: none;
  color: #fff;
}

.today__mark svg {
  width: 15px;
  height: 15px;
}

.today__words {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.today__kind {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today__item-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 750;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* A song choice's suggestion (Stage 7): its Easy, Medium or Hard leaves, as on the Course card. */
.today__leaves {
  font-size: 10px;
  font-weight: 400;
}

.today__detail {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.today__note {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}

.today__mix summary {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.today__mix-rows {
  display: grid;
  gap: 6px;
  max-width: 560px;
  margin-top: 8px;
}

.today__mix-row {
  display: grid;
  grid-template-columns: 96px minmax(80px, 1fr) 120px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.today__mix-name {
  color: var(--ink-2);
  font-weight: 700;
}

.today__mix-meter {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--fill);
}

.today__mix-actual {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 4px;
  background: var(--accent);
}

.today__mix-target {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--ink);
}

.today__mix-numbers {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.today__mix-about {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 12.5px;
}

.practice__key[data-frozen='true'] {
  background: linear-gradient(#e0f2fe, #f0f9ff);
  box-shadow: inset 0 0 0 1px #7dd3fc;
}

/* ── Stage 20, from the first playtest: tabs, a calmer home, the seed bed ─────────────────────────────
   Four tabs along the top. Home is the level and its missions, today's other
   practice, and the seed with its watering can; the library is under Songs and
   the trees under Orchard. The keyboard shows only while something is played. */

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: var(--fill);
}

.tabs__tab {
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.tabs__tab:hover {
  color: var(--ink);
}

.tabs__tab[aria-selected='true'] {
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.14);
}

.app.song-open .tabpanel,
.app.course-open .tabpanel,
.app.lesson-open .tabpanel,
.app.lesson-strip .tabpanel,
.app.game-open .tabpanel,
.app.trainer-open .tabpanel,
.app.jam-open .tabpanel,
.app.exam-open .tabpanel,
.app.calibrating .tabpanel {
  display: none;
}

.app:not(.song-open):not(.lesson-open):not(.lesson-strip):not(.game-open):not(.trainer-open):not(.jam-open):not(.exam-open):not(.calibrating):not(.welcome-keys) .keybed {
  display: none;
}

/* Home: the level and today on the left, the seed on the right. */
.home {
  grid-template-columns: minmax(0, 1fr) clamp(300px, 25vw, 380px);
  grid-template-rows: auto;
  align-items: start;
  gap: clamp(14px, 1.6vw, 24px);
}

.home__main {
  display: grid;
  gap: clamp(14px, 2vh, 22px);
  min-width: 0;
}

@container home (max-width: 900px) {
  .home {
    grid-template-columns: minmax(0, 1fr);
  }
}

.songs,
.orchardtab {
  display: grid;
  gap: clamp(14px, 2.2vh, 24px);
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  container: home / inline-size;
}

/* (The Songs tab shares its class with the debug panel's song inspector, whose two columns it
   mustn't take: one column here.) */
.songs.tabpanel {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(250px, 1fr);
}

.songs__top {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
}

.orchardtab {
  grid-template-rows: auto auto;
  align-content: start;
}

/* The level card: its head, then its three missions, each with a button. */
.coursecard {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  padding: 20px 22px;
}

.coursecard__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(14px, 1.6vw, 24px);
}

.coursecard__quests {
  gap: 12px;
}

.coursecard__quest {
  grid-template-rows: auto auto 1fr auto auto;
  gap: 4px;
  padding: 14px 16px;
}

.coursecard__quest-title {
  white-space: normal;
  font-size: 17px;
}

.coursecard__quest-about {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.42;
}

.coursecard__quest-state {
  margin-top: 4px;
}

.coursecard__quest .btn {
  justify-self: start;
  margin-top: 8px;
  padding: 7px 14px;
  font-size: 14.5px;
}

.coursecard__quest[data-next='true'] {
  border-color: var(--next);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

.coursecard__quest[data-done='true'] {
  border-color: var(--held-line);
  background: var(--held-wash);
}

.coursecard__quest[data-done='true'] .coursecard__quest-state {
  color: var(--held-ink);
}

.coursecard__quest[data-done='true'] .coursecard__quest-kind::after {
  content: ' · done';
  color: var(--held-ink);
}

.coursecard__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@container home (max-width: 760px) {
  .coursecard__quests {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The seed bed. */
.seedbed {
  position: sticky;
  top: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: linear-gradient(180deg, var(--orchard-sky), var(--page) 72%);
}

.seedbed__label {
  margin: 0;
  color: var(--grass);
  font-size: 14px;
  font-weight: 650;
}

.seedbed__title {
  margin: 0;
  font-size: 24px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.seedbed__ground {
  position: relative;
  justify-self: center;
  width: min(100%, 290px);
  aspect-ratio: 1;
}

.seedbed__plot,
.seedbed__plot svg {
  display: block;
  width: 100%;
  height: 100%;
}

.seedbed__plot {
  overflow: hidden;
  border-radius: 16px;
  background: var(--orchard-sky);
  box-shadow: inset 0 0 0 1px var(--line);
}

.seedbed__stage {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.seedbed__pour {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.seedbed[data-pouring='true'] .seedbed__pour {
  opacity: 1;
}

.can--pour {
  position: absolute;
  top: 4%;
  left: 50%;
  width: 46%;
  transform-origin: 30% 75%;
}

.seedbed[data-pouring='true'] .can--pour {
  animation: can-tilt 1.7s ease-in-out both;
}

@keyframes can-tilt {
  0% {
    opacity: 0;
    transform: translateY(-12px) rotate(0deg);
  }
  15% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  35%,
  78% {
    transform: rotate(-36deg);
  }
  100% {
    opacity: 0;
    transform: rotate(0deg);
  }
}

.seedbed__drop {
  position: absolute;
  top: 26%;
  left: 49%;
  width: 6px;
  height: 10px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: #4a9fd8;
  opacity: 0;
}

.seedbed[data-pouring='true'] .seedbed__drop {
  animation: drop-fall 0.62s ease-in 0.45s 2 both;
}

.seedbed__drop:nth-of-type(2) { left: 45%; animation-delay: 0.55s !important; }
.seedbed__drop:nth-of-type(3) { left: 52%; animation-delay: 0.65s !important; }
.seedbed__drop:nth-of-type(4) { left: 47%; animation-delay: 0.75s !important; }
.seedbed__drop:nth-of-type(5) { left: 54%; animation-delay: 0.85s !important; }
.seedbed__drop:nth-of-type(6) { left: 43%; animation-delay: 0.95s !important; }
.seedbed__drop:nth-of-type(7) { left: 50%; animation-delay: 1.05s !important; }

@keyframes drop-fall {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(130px);
  }
}

.seedbed__water {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page);
}

.seedbed__can {
  width: 74px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  cursor: pointer;
}

.seedbed__can:disabled {
  cursor: default;
}

.seedbed__can svg {
  display: block;
  width: 100%;
  height: 100%;
}

.seedbed[data-water='full'] .seedbed__water {
  border-color: #4a9fd8;
  box-shadow: 0 0 0 4px rgba(74, 159, 216, 0.18);
}

.seedbed[data-water='full'] .seedbed__can {
  animation: can-bob 1.6s ease-in-out infinite;
}

@keyframes can-bob {
  50% {
    transform: translateY(-4px) rotate(-7deg);
  }
}

.seedbed__can-head {
  display: block;
  font-size: 15px;
}

.seedbed__can-sub {
  display: block;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.38;
}

.seedbed__meter {
  display: block;
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--fill);
}

.seedbed__meter i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: #4a9fd8;
}

.seedbed__next,
.seedbed__streak {
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.42;
}

.seedbed__streak {
  color: var(--held-ink);
  font-weight: 650;
}

.seedbed__more {
  justify-self: start;
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .seedbed[data-pouring='true'] .can--pour,
  .seedbed[data-pouring='true'] .seedbed__drop,
  .seedbed[data-water='full'] .seedbed__can {
    animation: none;
  }
}

/* The Orchard tab: the tree growing, then the ten plots of the course. */
.orchard__cap {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--soil);
  opacity: 0.55;
}

.orchard__how {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.45;
}

.orchard__row {
  counter-reset: none;
}

.orchard__tree {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 2px;
}

.orchard__tree[data-state='waiting'] {
  min-height: 120px;
  border-bottom: 3px solid var(--soil);
  opacity: 0.5;
}

.orchard__tree-name {
  font-size: 13px;
  font-weight: 700;
}

.orchard__tree-levels {
  color: var(--ink-3);
  font-size: 12px;
}

.orchardtab .orchard {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 18px 26px;
  padding: 18px 22px 20px;
}

.orchardtab .orchard__plot {
  width: clamp(200px, 22cqw, 280px);
}

.orchardtab .orchard__grove {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.orchardtab .orchard__row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  height: auto;
  margin: 0;
  padding: 12px 12px 8px;
  overflow: visible;
  background: linear-gradient(to bottom, var(--orchard-sky) 70%, color-mix(in srgb, var(--grass) 16%, var(--page)) 70%);
}

.orchardtab .orchard__tree {
  height: auto;
  aspect-ratio: auto;
  margin: 0;
}

.orchardtab .orchard__tree svg {
  width: 100%;
  height: auto;
  aspect-ratio: 100 / 120;
}

.orchardtab .orchard__tree[data-state='waiting'] {
  min-height: 0;
  border: 0;
}

.orchardtab .orchard__tree[data-state='waiting']::before {
  content: '';
  display: block;
  width: 70%;
  margin: 0 auto;
  aspect-ratio: 100 / 120;
  border-bottom: 3px solid var(--soil);
}

.orchardtab .orchard__how {
  display: block;
}

@container home (max-width: 860px) {
  .orchardtab .orchard__row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .orchardtab .orchard__grove {
    display: grid;
  }
}

/* Stage 10: a tree per grove, its fruit (the grove's songs at three stars), a rosette for a full
   basket, and the old row (trees grown under the first rules). */
.orchard__fruit {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.4;
}

.orchardtab .orchard__tree-name {
  white-space: nowrap;
}

.orchard__tree-fruit {
  color: var(--ink-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.orchard__tree[data-state='resting'] svg {
  opacity: 0.9;
}

.orchard__badge,
.orchardtab .orchard__tree svg.orchard__badge {
  width: 14px;
  height: 18px;
  aspect-ratio: auto;
  margin-left: 3px;
  vertical-align: -3px;
}

.orchard__old {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.orchard__old[hidden] {
  display: none;
}

.orchard__old-note {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.4;
}

.orchardtab .orchard__row--old {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  opacity: 0.92;
}

/* Stage 10: a rest day, and a weekly goal instead of a daily streak. */
.practice__rest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 8px;
}

.practice__goal {
  display: block;
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 13px;
}

.practice__goal-pick {
  margin-left: 4px;
  font: inherit;
}

/* ── The welcome (Stage 20: from the first playtest, reworked from the second) ─────────────
   First light over an orchard that stands on a keyboard (welcome-scene.js), with the name in
   Alegreya. Every step after the first is a card in the same place, top left, over the scene. While
   the keyboard on screen shows below, the welcome ends above it. */

@font-face {
  font-family: 'Alegreya';
  src: url('fonts/alegreya-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

.welcome {
  --w-forest: #1f3b2d;
  --w-forest-2: #2f5641;
  --w-leaf: #4a8640;
  --w-mist: #e3eedd;
  --w-light: #fbf0cf;
  --w-gold: #f2b84b;
  --w-ivory: #fffdf6;
  --w-ink-2: #46594d;
  --w-font: 'Alegreya', Georgia, 'Times New Roman', serif;

  /* How much of the bottom the hills, the trees and the drawn keyboard take up: the landscape is
     drawn 1600 wide and 1000 high (840 while the keyboard on screen shows below), filling the
     welcome, and the trees under the words reach up to about 380 (230) from its bottom. */
  --ground: max(23.75cqw, 38cqh);

  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: hidden;
  container-type: size;
  background: linear-gradient(180deg, #dfeadb 0%, #eef2df 38%, var(--w-light) 66%, #f6dfa6 100%);
  color: var(--w-forest);
}

:root[data-welcome-keys] .welcome {
  --ground: max(14.4cqw, 27.4cqh);
  bottom: calc(clamp(150px, calc((100vw - 20px) / 9.6 + 32px), 32vh) + 10px);
}

/* The landscape */
.wscene {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 500ms ease, filter 500ms ease;
}

.wscene__land {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.wscene[data-keys='true'] .wscene__keys {
  display: none;
}

.wscene__tree {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

/* The one moment: middle C lights, the sun rises a little, and the trees grow along the ridge. */
.welcome.is-dawn .wscene__glow {
  animation: wscene-glow 1.6s 200ms ease-out backwards;
}

.welcome.is-dawn .wscene__c {
  animation: wscene-c 900ms 150ms ease-out backwards;
}

.welcome.is-dawn .wscene__sun {
  animation: wscene-sun 2.6s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.welcome.is-dawn .wscene__tree {
  animation: wscene-grow 900ms calc(700ms + var(--i, 0) * 160ms) cubic-bezier(0.2, 0.9, 0.25, 1.15) backwards;
}

@keyframes wscene-glow {
  from {
    opacity: 0;
  }
}

@keyframes wscene-c {
  from {
    fill: #fbfaf4;
  }
}

@keyframes wscene-sun {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
}

@keyframes wscene-grow {
  from {
    opacity: 0;
    transform: scale(0.15);
  }
}

/* Where the steps go: in the middle of the sky, above the trees. The space after the step is the
   ground's height, so the step is centred in the sky; it gives way if a step needs more room, and
   past that the page scrolls. */
.welcome__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  overflow-y: auto;
  padding: clamp(16px, 4vh, 48px) 20px 16px;
}

.welcome__stage > * {
  flex-shrink: 0;
  margin-block: auto;
}

.welcome__stage::after {
  content: '';
  flex: 0 1 var(--ground);
  min-height: 0;
}

/* Every step is written straight onto the sky, centred, with no card: just a little more light
   behind the words, so they stay clear where they come down over the trees. */
.welcome__hello,
.welcome__card {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  gap: clamp(12px, 1.4vmin, 18px);
  width: min(100%, clamp(540px, 76vmin, 1000px));
  text-align: center;
}

.welcome__hello::before,
.welcome__card::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -12% -14%;
  background: radial-gradient(closest-side, rgb(255 251 236 / 0.7), rgb(255 251 236 / 0.38) 60%, rgb(255 251 236 / 0));
  pointer-events: none;
}

/* The first page: the name, large, in the middle of the sky. */
.welcome__hello {
  gap: clamp(16px, 2vmin, 26px);
  width: min(100%, clamp(560px, 90vmin, 1100px));
}

.welcome__name {
  margin: 0 0 4px;
  font-family: var(--w-font);
  font-size: clamp(56px, 9.5vmin, 132px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.015em;
  color: var(--w-forest);
}

.welcome.is-dawn .welcome__hello > * {
  animation: welcome-rise 700ms calc(250ms + var(--n, 0) * 90ms) cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}

.welcome__hello > :nth-child(2) {
  --n: 1;
}

.welcome__hello > :nth-child(3) {
  --n: 2;
}

.welcome__hello > :nth-child(4) {
  --n: 3;
}

@keyframes welcome-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.welcome__hello .welcome__lead {
  max-width: 32ch;
  font-size: clamp(21px, 2.4vmin, 31px);
  line-height: 1.35;
}

.welcome__hello .welcome__text {
  max-width: 50ch;
  font-size: clamp(16px, 1.6vmin, 21px);
}

.welcome__card.is-entering {
  animation: welcome-in 380ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}

@keyframes welcome-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Where this step is among the welcome's four stages. */
.welcome__rail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 22px;
  margin: 0 0 clamp(4px, 1vmin, 14px);
  padding: 0;
  list-style: none;
  font-size: clamp(13.5px, 1.2vmin, 16px);
  font-weight: 650;
}

.welcome__rail-stage {
  display: flex;
  align-items: center;
  gap: 7px;
  color: color-mix(in srgb, var(--w-forest) 42%, transparent);
}

.welcome__rail-stage::before {
  content: '';
  width: 9px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 50% 0;
  transform: rotate(-45deg);
}

.welcome__rail-stage[data-state='done'] {
  color: var(--w-leaf);
}

.welcome__rail-stage[data-state='done']::before {
  background: currentColor;
}

.welcome__rail-stage[data-state='now'] {
  color: var(--w-forest);
}

.welcome__rail-stage[data-state='now']::before {
  border-color: var(--w-leaf);
  background: var(--w-leaf);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--w-leaf) 22%, transparent);
}

.welcome__title {
  margin: 0;
  font-family: var(--w-font);
  font-size: clamp(30px, 4.6vmin, 62px);
  font-weight: 750;
  line-height: 1.06;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--w-forest);
}

.welcome__lead {
  max-width: 46ch;
  margin: 0;
  font-size: clamp(18px, 2.1vmin, 27px);
  line-height: 1.45;
  color: var(--w-forest);
}

.welcome__text {
  max-width: 64ch;
  margin: 0;
  color: var(--w-ink-2);
  font-size: clamp(16px, 1.55vmin, 20px);
  line-height: 1.55;
}

.welcome__text--quiet,
.welcome__small {
  color: color-mix(in srgb, var(--w-ink-2) 85%, transparent);
  font-size: clamp(14.5px, 1.35vmin, 18px);
}

.welcome__small {
  max-width: 56ch;
  margin: 0;
  line-height: 1.5;
}

.welcome__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 22px;
  margin-top: clamp(6px, 1vmin, 14px);
}

.welcome .btn {
  border-radius: 999px;
}

.welcome .btn--primary {
  padding: clamp(12px, 1.25vmin, 16px) clamp(24px, 2.6vmin, 36px);
  border-color: var(--w-forest);
  background: var(--w-forest);
  color: var(--w-ivory);
  font-size: clamp(16.5px, 1.55vmin, 20px);
}

.welcome .btn--primary:hover {
  background: var(--w-forest-2);
}

.welcome .btn--primary:focus-visible,
.welcome .btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--w-leaf) 55%, transparent);
  outline-offset: 2px;
}

.welcome__hello .btn--primary {
  padding: clamp(15px, 1.5vmin, 19px) clamp(30px, 3.2vmin, 42px);
  font-size: clamp(18px, 1.8vmin, 23px);
}

.welcome .btn--link {
  color: var(--w-forest);
  font-size: clamp(15px, 1.35vmin, 18px);
  text-decoration-color: color-mix(in srgb, var(--w-leaf) 60%, transparent);
  text-decoration-thickness: 2px;
}

.btn--link {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.welcome__seed {
  width: clamp(130px, 14vmin, 190px);
  height: clamp(130px, 14vmin, 190px);
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 70%, #f9efcf, var(--w-mist));
}

.welcome__seed svg,
.tour__tree svg {
  display: block;
  width: 100%;
  height: 100%;
}

.welcome__waiting {
  margin: 0;
  color: var(--amber-ink);
  font-weight: 650;
  animation: waiting 1.6s ease-in-out infinite;
}

@keyframes waiting {
  50% {
    opacity: 0.45;
  }
}

/* The black-key jam's eight bars (the improvement plan's Stage 3). */
.welcome__bars {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 1vmin, 12px);
  margin: clamp(14px, 2vmin, 24px) 0 clamp(6px, 1vmin, 12px);
}

.welcome__bar {
  width: clamp(30px, 4vmin, 48px);
  height: clamp(10px, 1.2vmin, 14px);
  border-radius: 999px;
  background: color-mix(in srgb, var(--w-forest) 22%, transparent);
  transition: background-color 0.3s ease;
}

.welcome__bar.is-on {
  background: var(--w-leaf);
}

.welcome__dots {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 1.6vmin, 22px);
}

.welcome__dot {
  display: grid;
  place-items: center;
  width: clamp(58px, 6.4vmin, 84px);
  height: clamp(58px, 6.4vmin, 84px);
  border: 2px dashed color-mix(in srgb, var(--w-forest) 30%, transparent);
  border-radius: 50%;
  color: var(--w-ivory);
  font-size: clamp(15px, 1.5vmin, 20px);
  font-weight: 750;
}

.welcome__dot.is-on {
  border: 0;
  background: var(--w-leaf);
  animation: dot-on 300ms cubic-bezier(0.2, 0.8, 0.25, 1.4) backwards;
}

@keyframes dot-on {
  from {
    transform: scale(0.6);
  }
}

.welcome__pedal {
  width: clamp(120px, 12vmin, 160px);
  height: clamp(46px, 4.6vmin, 60px);
  border-radius: 12px 12px 18px 18px;
  background: linear-gradient(180deg, #d4d9e0, #9aa3ad);
  box-shadow: 0 8px 0 #6b7480;
  transition: transform 120ms, box-shadow 120ms;
}

.welcome__pedal.is-down {
  transform: translateY(7px);
  box-shadow: 0 1px 0 #6b7480;
}

.welcome__pedal.is-done {
  background: linear-gradient(180deg, #bbf7d0, var(--held));
  box-shadow: 0 8px 0 var(--held-ink);
}

/* The first song, a note at a time: the tune in its bars, each note a pebble with its letter and finger. */
.welcome__tune {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 0;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.welcome__bar {
  padding: 0 10px;
  border-left: 2px solid color-mix(in srgb, var(--w-forest) 22%, transparent);
}

.welcome__bar:last-child {
  border-right: 4px double color-mix(in srgb, var(--w-forest) 30%, transparent);
}

.welcome__bar-notes {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.welcome__pebble {
  display: grid;
  place-items: center;
  width: clamp(40px, 4.2vmin, 54px);
  height: clamp(50px, 5.2vmin, 66px);
  border: 1.5px solid color-mix(in srgb, var(--w-forest) 20%, transparent);
  border-radius: 20px;
  background: var(--w-ivory);
  transition: background 160ms, border-color 160ms, transform 160ms;
}

.welcome__pebble b {
  font-size: clamp(17px, 1.75vmin, 22px);
  line-height: 1;
}

.welcome__pebble span {
  color: var(--w-ink-2);
  font-size: clamp(11.5px, 1.15vmin, 14px);
  font-weight: 700;
}

.welcome__pebble[data-state='done'] {
  border-color: var(--w-leaf);
  background: var(--w-leaf);
  color: var(--w-ivory);
}

.welcome__pebble[data-state='done'] span {
  color: color-mix(in srgb, var(--w-ivory) 80%, transparent);
}

.welcome__pebble[data-state='now'] {
  border: 2.5px solid var(--right-hand);
  background: var(--right-wash);
  color: var(--right-ink);
  transform: translateY(-3px);
}

.welcome__pebble[data-missed] {
  animation: pebble-shake 360ms ease;
}

@keyframes pebble-shake {
  25% {
    translate: -4px 0;
  }
  75% {
    translate: 4px 0;
  }
}

.welcome__say {
  min-height: 1.5em;
  margin: 0;
  font-size: clamp(17px, 1.75vmin, 22px);
  font-weight: 650;
}

.welcome__say[data-tone='miss'] {
  color: var(--next-ink);
}

/* Forms: labels on the left, in a column in the middle. */
.welcome__form {
  display: grid;
  gap: 12px;
  width: min(100%, 440px);
  text-align: left;
}

.welcome__field {
  position: relative;
  display: grid;
  gap: 4px;
}

.welcome__field-label {
  font-size: 14px;
  font-weight: 650;
}

.welcome__input {
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--w-forest) 28%, transparent);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.welcome__input:focus {
  border-color: var(--w-leaf);
  outline: 3px solid color-mix(in srgb, var(--w-leaf) 25%, transparent);
  outline-offset: 0;
}

.welcome__field .btn--small {
  position: absolute;
  top: 29px;
  right: 8px;
  padding: 4px 10px;
  font-size: 13px;
}

.welcome__hint {
  color: var(--ink-3);
  font-size: 13px;
}

.welcome__error {
  min-height: 1.2em;
  margin: 0;
  color: var(--wrong);
  font-size: 14.5px;
  font-weight: 600;
}

.welcome__error:empty {
  min-height: 0;
}

.welcome__ok {
  margin: 0;
  color: var(--held-ink);
  font-size: 14.5px;
  font-weight: 600;
}

/* The first page: their first name, the box and the button side by side (one above the other on
   a phone), larger than the account forms'. */
.welcome__form--name {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 12px;
  width: min(100%, clamp(420px, 46vmin, 600px));
}

.welcome__form--name .welcome__field-label {
  font-size: clamp(14px, 1.3vmin, 17px);
}

.welcome__form--name .welcome__input {
  padding: clamp(12px, 1.3vmin, 16px) clamp(14px, 1.5vmin, 18px);
  border-radius: 12px;
  font-size: clamp(19px, 2.1vmin, 26px);
}

.welcome__form--name .welcome__error {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .welcome__form--name {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* "Lovely to meet you, Dawn!" over the name. */
.welcome__hi {
  margin: 0 0 -4px;
  color: var(--w-leaf);
  font-family: var(--w-font);
  font-size: clamp(22px, 2.8vmin, 36px);
  font-weight: 700;
}

/* The tour */
.welcome__picture {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(150px, 17vmin, 230px);
}

.tour__path {
  width: 100%;
  overflow: visible;
}

.tour__dot {
  fill: color-mix(in srgb, var(--w-forest) 22%, transparent);
}

.tour__dot.is-exam {
  fill: var(--xp);
}

.tour__dot.is-here {
  fill: var(--next);
}

.tour__chunk {
  fill: var(--w-ink-2);
  font-size: 8.5px;
  font-weight: 700;
  text-anchor: middle;
}

.tour__here text {
  fill: var(--next-ink);
  font-size: 11px;
  font-weight: 750;
}

.tour__here circle {
  animation: here-pulse 1.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes here-pulse {
  50% {
    transform: scale(1.3);
  }
}

.tour__missions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 10px;
  justify-content: center;
}

.tour__mission {
  padding: clamp(10px, 1.1vmin, 14px) clamp(14px, 1.6vmin, 22px);
  font-size: clamp(15px, 1.5vmin, 19px);
  border: 1px solid var(--held-line);
  border-radius: 10px;
  background: var(--held-wash);
  font-weight: 700;
  animation: welcome-in 400ms cubic-bezier(0.2, 0.8, 0.25, 1) backwards;
}

.tour__mission:nth-child(2) {
  animation-delay: 250ms;
}

.tour__mission:nth-child(3) {
  animation-delay: 500ms;
}

.tour__bar {
  grid-column: 1 / -1;
  height: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px var(--xp-line);
}

.tour__bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--xp-2), var(--xp));
  animation: bar-fill 1.8s 0.8s cubic-bezier(0.3, 0.7, 0.3, 1) both;
}

@keyframes bar-fill {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.tour__tree {
  width: clamp(190px, 21vmin, 270px);
  height: clamp(190px, 21vmin, 270px);
}

.tour__can .can--tour {
  width: clamp(150px, 16vmin, 210px);
  animation: can-bob 1.6s ease-in-out infinite;
}

.tour__progress {
  display: flex;
  gap: 6px;
}

.tour__progress i {
  width: 22px;
  height: 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--w-forest) 14%, transparent);
}

.tour__progress i.is-on {
  background: var(--w-leaf);
}

/* Narrow: closer to the edges. */
@media (max-width: 760px) {
  .welcome__stage {
    padding-inline: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .welcome__card.is-entering,
  .welcome.is-dawn .welcome__hello > *,
  .welcome.is-dawn .wscene__tree,
  .welcome.is-dawn .wscene__glow,
  .welcome.is-dawn .wscene__c,
  .welcome.is-dawn .wscene__sun,
  .welcome__waiting,
  .welcome__dot.is-on,
  .welcome__pebble[data-missed],
  .tour__here circle,
  .tour__mission,
  .tour__bar i,
  .tour__can .can--tour {
    animation: none;
  }

  .tour__bar i {
    width: 100%;
  }

  .wscene {
    transition: none;
  }
}

/* The welcome's first song: just the music, the notes falling and a way to pause or start again
   (the song screen's other controls are for later). */
:root[data-first-song] .stand__facts,
:root[data-first-song] .stand__modes,
:root[data-first-song] .stand__tools,
:root[data-first-song] .playbar .transport__group,
:root[data-first-song] .playbar .learnbar__switch,
:root[data-first-song] .playbar .transport__practice,
:root[data-first-song] .playbar > :not(.transport__buttons, .transport__where) {
  display: none;
}

/* Report a bug (ui/bug-report.js): a card over everything, with what kind of problem, and what happened. */
.bugreport {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.bugreport__card {
  display: grid;
  gap: 12px;
  width: min(100%, 560px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 24px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  color: var(--ink);
}

.bugreport__title {
  margin: 0;
  font-size: 22px;
}

.bugreport__lead,
.bugreport__note {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
}

.bugreport__note {
  color: var(--ink-3);
  font-size: 13px;
}

.bugreport__kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.bugreport__label {
  display: grid;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.bugreport__kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}

.bugreport__kind input {
  margin: 0;
  accent-color: var(--accent);
}

.bugreport__kind:has(input:checked) {
  border-color: var(--accent);
  background: var(--right-wash);
}

.bugreport textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
  font-weight: 400;
  resize: vertical;
}

.bugreport__status {
  min-height: 1.2em;
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.bugreport__status[data-tone='warn'] {
  color: var(--amber);
}

.bugreport__status[data-tone='ok'] {
  color: var(--held);
}

.bugreport__actions {
  display: flex;
  gap: 10px;
}

.lesson__control--bug,
.game__control--bug {
  margin-left: auto;
  color: var(--ink-2);
}

/* ── The songbooks (14 Nov 2026) ──────────────────────────────────────────
   At the top of the Songs tab: the ten groves, then the chosen grove's songs
   on three shelves, Easy, Medium and Hard. Green is the orchard's colour for
   growing; a card's top edge says its shelf.                                */

.songbook {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 18px 22px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--page);
}

.songbook__head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.songbook__titles {
  min-width: 0;
  margin-right: auto;
}

.songbook__title {
  margin: 0;
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.songbook__why {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
}

.songbook__surprise {
  white-space: nowrap;
}

.songbook__groves {
  display: grid;
  grid-auto-columns: minmax(118px, 1fr);
  grid-auto-flow: column;
  gap: 8px;
  min-width: 0;
  padding: 2px 2px 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.songbook__grove {
  display: grid;
  align-content: start;
  gap: 1px;
  min-width: 0;
  padding: 9px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--wash);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.songbook__grove:hover {
  border-color: var(--line-strong);
}

.songbook__grove:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 1px;
}

.songbook__grove[aria-selected='true'] {
  border-color: var(--grass);
  background: color-mix(in srgb, var(--grass) 9%, var(--page));
  box-shadow: inset 0 0 0 1px var(--grass);
}

.songbook__grove[data-state='locked'] {
  background: var(--page);
  color: var(--ink-3);
}

.songbook__grove-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 720;
  white-space: nowrap;
}

.songbook__grove[data-state='here'] .songbook__grove-name::before {
  content: '';
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--grass);
}

.songbook__grove-name svg,
.songbook__locked svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.songbook__grove-levels {
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
}

.songbook__grove-meter {
  display: block;
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.songbook__grove-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--grass);
}

.songbook__shelfhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.songbook__grove-title {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
}

.songbook__grove-sub {
  color: var(--ink-3);
  font-size: 15px;
  font-weight: 600;
}

.songbook__facts {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.songbook__facts b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.songbook__locked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
  font-weight: 650;
}

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

.songbook__filter {
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.songbook__filter:hover {
  color: var(--ink);
}

.songbook__filter[aria-pressed='true'] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--page);
}

.songbook__shelves {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.songbook__shelf {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-width: 0;
}

.songbook__tier {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1px;
  margin: 12px 0 0;
  font-size: 14px;
  font-weight: 720;
}

.songbook__tier svg {
  width: 14px;
  height: 14px;
  fill: var(--grass);
}

.songbook__tier-count {
  margin-left: 3px;
  color: var(--ink-3);
  font-weight: 600;
}

.songbook__row {
  display: grid;
  grid-auto-columns: clamp(184px, 15cqw, 228px);
  grid-auto-flow: column;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 3px 2px 9px;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.songbook__row > li {
  display: grid;
  min-width: 0;
}

.songbook__row > .songbook__none {
  align-self: center;
  padding: 18px 4px;
  color: var(--ink-3);
  font-size: 14px;
}

/* A songbook song. */
.sbcard {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 2px;
  min-width: 0;
  padding: 9px 12px 11px;
  border: 1px solid var(--line);
  border-top: 3px solid color-mix(in srgb, var(--grass) 55%, var(--page));
  border-radius: 12px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    translate 120ms ease-out,
    box-shadow 120ms ease-out,
    border-color 120ms ease-out;
}

.sbcard[data-tier='2'] {
  border-top-color: var(--xp-2);
}

.sbcard[data-tier='3'] {
  border-top-color: var(--next);
}

.sbcard:hover:not(:disabled) {
  translate: 0 -2px;
  border-right-color: var(--line-strong);
  border-bottom-color: var(--line-strong);
  border-left-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 26px -14px rgba(15, 23, 42, 0.28);
}

.sbcard:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 1px;
}

.sbcard:disabled {
  opacity: 0.6;
  cursor: default;
}

.sbcard__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 650;
}

.sbcard__length {
  font-variant-numeric: tabular-nums;
}

.sbcard__title {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 730;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sbcard__by {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sbcard__best {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 6px;
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.sbcard__new {
  color: var(--ink-3);
}

.sbcard__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.sbcard__tag {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.5;
}

.sbcard__tag--course {
  background: var(--right-wash);
  color: var(--right-ink);
}

.sbcard__tag--exam {
  background: var(--left-wash);
  color: var(--left-ink);
}

.sbcard__tag--stretch {
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px var(--xp-line);
  color: var(--xp-ink);
}

@container home (max-width: 760px) {
  .songbook__shelf {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .songbook__tier {
    margin-top: 2px;
  }
}

/* ── The Jam room (Stage 8) ─────────────────────────────────────────────── */

.app.jam-open .home,
.app.jam-open .course,
.app.jam-open .stand,
.app.jam-open .lesson,
.app.jam-open .game,
.app.jam-open .trainer {
  display: none;
}

.jamroom {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 1.4vh, 16px);
  min-width: 0;
  min-height: 0;
}

.jamroom[hidden] {
  display: none;
}

.jamroom__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.jamroom__where {
  margin: 0;
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 700;
}

.jamroom__title {
  margin: 0;
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.jamroom__close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-color: transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
}

.jamroom__close svg {
  width: 20px;
  height: 20px;
}

.jamroom__body {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
}

.jamroom__intro,
.jamroom__about,
.jamroom__lefthand,
.jamroom__mode-about,
.jamroom__note {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.45;
}

.jamroom__lefthand {
  color: var(--ink);
  font-weight: 650;
}

/* The list: the jams by grove. */
.jamroom__groves {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

.jamroom__grove {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--page);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
}

.jamroom__grove-title {
  margin: 0;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.jamroom__jams {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jamroom__pick {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 0;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
}

.jamroom__pick:disabled {
  opacity: 0.6;
  cursor: default;
}

.jamroom__jam-title {
  font-size: 15.5px;
  font-weight: 760;
}

.jamroom__jam-about {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
}

.jamroom__jam-facts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
}

.jamroom__jam-facts svg {
  width: 14px;
  height: 14px;
}

/* A jam: the chords going by, how to play, what happened. */
.jamroom__top {
  display: grid;
  gap: 4px;
}

.jamroom__chords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jamroom__chord {
  min-width: 52px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font-size: 17px;
  font-weight: 760;
  text-align: center;
  transition:
    background 0.12s,
    color 0.12s;
}

.jamroom__chord[data-now='true'] {
  background: var(--right-wash);
  box-shadow: inset 0 0 0 2px var(--accent);
  color: var(--accent-ink);
}

.jamroom__modes {
  display: flex;
  gap: 6px;
}

.jamroom__mode {
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
}

.jamroom__mode[aria-selected='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
}

.jamroom__status {
  margin: 0;
  min-height: 1.4em;
  font-size: 17px;
  font-weight: 700;
}

.jamroom__pocket {
  margin: 0;
  min-height: 1.3em;
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 600;
}

.jamroom__riff,
.jamroom__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.jamroom__riff:empty {
  display: none;
}

.jamroom__riff-line {
  margin: 0 6px 0 0;
  font-size: 15px;
  font-weight: 700;
}

.jamroom__riffs {
  display: grid;
  gap: 6px;
}

.jamroom__riffs:empty {
  display: none;
}

.jamroom__riffs-title {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 760;
}

.jamroom__riff-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jamroom__riff-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
}

.jamroom__riff-notes {
  flex: 1;
  font-size: 14px;
  font-weight: 650;
}

.jamroom__riff-item .btn {
  min-height: 30px;
  padding: 0 10px;
}

.jamroom__forget {
  color: var(--ink-3);
}

/* ── A groove's rounds (Stage 6): the same room, with the pattern and the hits ── */

.groove__hands {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14.5px;
}

.groove__hand[data-hand='left'] b {
  color: var(--left-ink, #6d28d9);
}

.groove__hand[data-hand='right'] b {
  color: var(--accent-ink);
}

.groove__pattern {
  justify-self: start;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 13px;
}

.groove__pattern th {
  min-width: 28px;
  color: var(--ink-3);
  font-weight: 700;
  text-align: center;
}

.groove__pattern tr th:first-child {
  padding-right: 6px;
  text-align: right;
}

.groove__pattern td {
  min-width: 44px;
  padding: 6px 4px;
  border-radius: 8px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-3);
  font-weight: 700;
  text-align: center;
}

.groove__pattern tr[data-hand='right'] td[data-mark='C'],
.groove__pattern tr[data-hand='right'] td[data-mark='R'],
.groove__pattern tr[data-hand='right'] td[data-mark='5'] {
  background: var(--right-wash);
  color: var(--accent-ink);
}

.groove__pattern tr[data-hand='left'] td[data-mark='C'],
.groove__pattern tr[data-hand='left'] td[data-mark='R'],
.groove__pattern tr[data-hand='left'] td[data-mark='5'] {
  background: #ede9fe;
  color: #5b21b6;
}

.groove__rounds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.groove__round {
  min-height: 34px;
  border-radius: 999px;
}

.groove__round[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
}

.groove__numeral {
  display: block;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
}

.groove__now {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-height: 34px;
}

.groove__chord {
  font-size: 28px;
  font-weight: 800;
}

.groove__keys {
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 650;
}

.groove__hits {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.groove__hit {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--line);
}

.groove__hit[data-grade='perfect'] {
  background: #16a34a;
}

.groove__hit[data-grade='good'] {
  background: #4ade80;
}

.groove__hit[data-grade='early'],
.groove__hit[data-grade='late'] {
  background: #f59e0b;
}

.groove__hit[data-grade='missed'] {
  background: #ef4444;
}

.groove__more {
  display: grid;
  gap: 8px;
  max-width: 760px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--page);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
}

.groove__more h3 {
  margin: 0;
  font-size: 16px;
}

.groove__more p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.5;
}
/* ── Practise and Perform, the practice panel, the coach's chip (Stage 4; the "practice" worker) ── BEGIN ── */

/* Four modes on the stand now: a little narrower each. */
.stand__mode {
  min-width: 92px;
  padding: 8px 13px;
}

.stand__mode[data-mode='practise'][aria-pressed='true'] {
  color: var(--amber-ink);
}

/* The sweet-spot coach's one suggestion: on the stand (after the composer), and on the results.
   It does nothing until tapped. */
.stand__chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  margin-left: 12px;
  padding: 2px 11px;
  vertical-align: 1px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1.5px var(--xp-line, rgba(245, 158, 11, 0.55));
  color: var(--amber-ink);
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.stand__chip::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
}

.stand__chip:hover {
  background: #fef3c7;
}

.stand__chip[hidden] {
  display: none;
}

.results__chip {
  align-self: center;
  margin: 4px auto 10px;
  padding: 6px 13px;
}

/* Perform, paused part-way: "Practise this bit". */
.stand__offer {
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.4);
}

.stand__offer[hidden] {
  display: none;
}

/* The guide melody's button (Learn and Perform: Practise has it in the panel). */
.stand__guide[aria-pressed='true'] {
  color: var(--amber-ink);
}

/* Practise: the panel has the tempo, the hands and the lights, so Play's bar doesn't repeat them. */
.stand[data-practising='true'] .playbar .transport__tempo,
.stand[data-practising='true'] .playbar .playbar__hands,
.stand[data-practising='true'] .playbar .playbar__lights {
  display: none;
}

.ppanel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-m);
  background: var(--xp-wash);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.3);
}

.ppanel[hidden] {
  display: none;
}

.ppanel__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.ppanel__title {
  flex: none;
  color: var(--amber-ink);
  font-size: 14px;
  font-weight: 700;
}

.ppanel__track {
  flex: 1 1 260px;
  min-width: 160px;
}

.ppanel__track .transport__loop {
  height: 20px;
  margin-top: -10px;
  background: rgba(245, 158, 11, 0.22);
}

.ppanel__track.is-dragging .transport__thumb {
  opacity: 0.4;
}

.ppanel__where {
  min-width: 84px;
  color: var(--ink-2);
  font-weight: 600;
}

.ppanel__bars {
  flex: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.ppanel__percent {
  min-width: 46px;
  font-variant-numeric: tabular-nums;
}

.ppanel__switch:disabled {
  opacity: 0.45;
  cursor: default;
}

.ppanel__band b {
  font-weight: 650;
}

.ppanel__band[data-off='true'] b {
  color: var(--ink-3);
}

.ppanel .transport__seg button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* (The track's own "Bar n of N": the bars looped say more here.) */
.ppanel__where {
  display: none;
}

/* Four modes and the chip leave the title less room: the modes and the facts give some back. */
@container stand (max-width: 1630px) {
  .stand__mode {
    min-width: 0;
    padding: 8px 11px;
    gap: 6px;
  }

  .stand__fact--tempo {
    display: none;
  }
}

@container stand (max-width: 1340px) {
  .stand__mode svg {
    display: none;
  }
}

/* ── Stage 4 ── END ── */

/* A song quest's choices (Stage 7): any of them at two stars completes the quest. */
.coursecard__choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.coursecard__choices-label {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 650;
}

.coursecard__quest .coursecard__choice {
  margin-top: 0;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

.coursecard__leaves {
  font-size: 10px;
}

.coursecard__choice-stars {
  color: var(--xp-ink, #b45309);
}

/* ── The results' trick and pedal lines (Stage 6 leftovers; the "practice" worker) ── BEGIN ── */
.results__trick {
  color: var(--amber-ink);
  font-weight: 700;
}

.results__pedal {
  color: var(--ink-2);
  font-style: italic;
}
/* ── END ── */
/* ── The grove recitals (Stage 7): ui/recital-view.js, ui/audience-art.js, ui/rosette-art.js ── */

.app.recital-open .home,
.app.recital-open .course,
.app.recital-open .stand,
.app.recital-open .lesson,
.app.recital-open .game,
.app.recital-open .trainer,
.app.recital-open .tabpanel {
  display: none;
}

section.recital {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(8px, 1.4vh, 16px);
  min-width: 0;
  min-height: 0;
}

section.recital[hidden] {
  display: none;
}

.recital__hall {
  max-width: 980px;
  width: 100%;
}

section.recital[data-phase='report'] .recital__hall,
section.recital[data-phase='checklist'] .recital__hall {
  max-height: 120px;
  overflow: hidden;
  opacity: 0.85;
}

.recital__body {
  overflow: auto;
}

.recital__page {
  display: grid;
  align-content: start;
  gap: 14px;
  max-width: 980px;
  padding-bottom: 12px;
}

.recital__lead,
.recital__part,
.recital__practise,
.recital__confirm,
.recital__verdict {
  display: grid;
  gap: 8px;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--page);
  box-shadow: var(--shadow-panel), inset 0 0 0 1px var(--line);
}

.recital__lead {
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.recital__h {
  margin: 0;
  font-size: 16px;
  font-weight: 780;
}

.recital__about,
.recital__note,
.recital__choose,
.recital__next,
.recital__outcome,
.recital__verdict-words {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.45;
}

.recital__note {
  color: var(--accent-ink);
  font-weight: 650;
}

.recital__choose,
.recital__next,
.recital__outcome {
  color: var(--ink);
  font-weight: 650;
}

.recital__message {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fffbeb;
  box-shadow: inset 0 0 0 1px #fde68a;
  color: #92400e;
  font-size: 14.5px;
}

.recital__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.recital__option {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 12px;
  text-align: left;
}

.recital__option[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.recital__option-title {
  font-weight: 750;
}

.recital__option-meta,
.recital__piece-meta,
.recital__check-meta {
  color: var(--ink-3);
  font-size: 13px;
}

.recital__showpiece {
  margin: 0;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--right-wash);
  font-weight: 750;
}

.recital__verdict {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 14px;
}

.recital__verdict[data-ok='true'] {
  background: #f0fdf4;
  box-shadow: inset 0 0 0 1px #bbf7d0;
}

.recital__verdict-stars {
  color: #d97706;
  font-size: 26px;
  letter-spacing: 2px;
}

.recital__order,
.recital__checks {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recital__piece,
.recital__check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
}

.recital__piece[data-state='next'] {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: var(--right-wash);
}

.recital__piece[data-state='later'] {
  opacity: 0.7;
}

.recital__piece-words,
.recital__check-words {
  display: grid;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.recital__piece-mark,
.recital__check-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: #fff;
}

.recital__piece[data-state='done'] .recital__piece-mark,
.recital__check[data-done='true'] .recital__check-mark {
  background: #16a34a;
  box-shadow: none;
}

.recital__piece-mark svg,
.recital__check-mark svg {
  width: 16px;
  height: 16px;
}

.recital__piece-stars {
  color: #d97706;
  font-size: 18px;
  letter-spacing: 1px;
}

.recital__order--report .recital__piece[data-state='short'] .recital__piece-stars {
  color: var(--ink-3);
}

.recital__result {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-radius: 18px;
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--line);
}

.recital__result[data-result='pass'] {
  background: #fefce8;
  box-shadow: inset 0 0 0 1px #fde68a;
}

.recital__result-words {
  display: grid;
  gap: 4px;
}

.recital__result-title {
  font-size: 20px;
}

.recital__rosette {
  flex: none;
  animation: recital-rosette 700ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

@keyframes recital-rosette {
  from {
    transform: scale(0.3) rotate(-30deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.orchard__rosette {
  margin-left: 4px;
  vertical-align: -3px;
}

/* The audience: flat silhouettes in a lamp-lit hall. */
.audience {
  display: block;
  width: 100%;
  height: auto;
  max-height: 210px;
}

.audience__wall {
  fill: #3d3352;
}

.audience__lamp {
  fill: #e9c46a;
}

.audience__glow {
  fill: #f4d58d;
  opacity: 0.22;
}

.audience__person--back .audience__body,
.audience__person--back .audience__hand {
  fill: #261f33;
}

.audience__person--front .audience__body,
.audience__person--front .audience__hand {
  fill: #151120;
}

.audience__hands {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 220ms;
}

.audience__hand {
  transform-box: fill-box;
  transform-origin: center;
}

.audience[data-clapping='true'] .audience__hands {
  transform: translateY(-14px);
}

.audience[data-clapping='true'] .audience__hand--l {
  animation: audience-clap-l 180ms ease-in-out infinite alternate;
  animation-delay: var(--clap-delay, 0ms);
}

.audience[data-clapping='true'] .audience__hand--r {
  animation: audience-clap-r 180ms ease-in-out infinite alternate;
  animation-delay: var(--clap-delay, 0ms);
}

@keyframes audience-clap-l {
  from {
    transform: translateX(-3px);
  }
  to {
    transform: translateX(1.5px);
  }
}

@keyframes audience-clap-r {
  from {
    transform: translateX(3px);
  }
  to {
    transform: translateX(-1.5px);
  }
}

/* The lessons' recital picture (Levels 10, 20 and 30). */
.lesson-recital__stars {
  color: #d97706;
  font-size: 18px;
  letter-spacing: 1px;
  opacity: 0.35;
  transition: opacity 200ms;
}

.lesson-recital__hall {
  border-radius: 14px;
  overflow: hidden;
  opacity: 0.6;
  transition: opacity 200ms;
}

.lesson-recital__checks {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px 16px 10px 34px;
  border-radius: 14px;
  background: var(--page);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font-size: 14px;
  opacity: 0.55;
  transition: opacity 200ms;
}

.lesson-exam[data-show='showpiece'] [data-part='showpiece'] {
  border-color: var(--right-hand);
  background: var(--right-wash);
  transform: translateY(-4px);
}

.lesson-exam[data-show='stars'] .lesson-recital__stars,
.lesson-exam[data-show='parts'] .lesson-recital__stars,
.lesson-exam[data-show='audience'] .lesson-recital__hall,
.lesson-exam[data-show='parts'] .lesson-recital__hall,
.lesson-exam[data-show='checklist'] .lesson-recital__checks {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .audience[data-clapping='true'] .audience__hand--l,
  .audience[data-clapping='true'] .audience__hand--r,
  .recital__rosette {
    animation: none;
  }
}

/* Unlocked mode (14 Nov): its switch in the course's head. */
.course__unlock {
  justify-self: start;
  margin-top: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.course__unlock[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--right-wash);
  color: var(--accent-ink);
}

details.levelsheet__dev > summary {
  cursor: pointer;
}

/* Up next (14 Nov): the path's next step, one big Continue at the top of the home screen. */
.upnext {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--right-wash), var(--page));
  box-shadow: var(--shadow-panel), inset 0 0 0 1.5px var(--accent);
}

.upnext[hidden] {
  display: none;
}

.upnext__words {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.upnext__label {
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.upnext__title {
  font-size: 19px;
  line-height: 1.25;
}

.upnext__go {
  flex: none;
  min-width: 150px;
  min-height: 52px;
  font-size: 17px;
}

/* The results card: one Continue, Play again, and the rest under More. */
.results__onward {
  max-width: 100%;
  white-space: normal;
}

.results__more {
  position: relative;
}

.results__more > summary {
  list-style: none;
  cursor: pointer;
}

.results__more > summary::-webkit-details-marker {
  display: none;
}

.results__more > summary::after {
  content: ' ▾';
}

.results__more[open] > summary::after {
  content: ' ▴';
}

.results__more-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.results__more[open] {
  flex-basis: 100%;
}

/* A lesson's quieter way out, beside its next step. */
.lesson__choices .btn[data-style='quiet'] {
  border-color: transparent;
  background: none;
  box-shadow: none;
  color: var(--ink-3);
  text-decoration: underline;
}

/* ── The reset (15 Nov 2026): ticks move you on ─────────────────────────────
   The course card is a checklist: a tick box on each task, extras marked as such, and the
   grove's ticks with a pip per level. */
.coursecard__grove {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.coursecard__pips {
  display: inline-flex;
  gap: 4px;
}

.coursecard__pip {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--page);
}

.coursecard__pip[data-state='done'] {
  border-color: var(--leaf, #2f8f4e);
  background: var(--leaf, #2f8f4e);
}

.coursecard__pip[data-state='here'] {
  border-color: var(--accent, #e07b24);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #e07b24) 25%, transparent);
}

.coursecard__quest {
  position: relative;
  padding-left: 40px;
}

.coursecard__quest::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 5px;
  background: var(--page);
}

.coursecard__quest[data-done='true']::before {
  content: '✓';
  border-color: var(--leaf, #2f8f4e);
  background: var(--leaf, #2f8f4e);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.coursecard__quest[data-core='false'] .coursecard__quest-kind::after {
  content: ' · extra';
  font-weight: 600;
  text-transform: none;
}

.coursecard__quest[data-core='false']::before {
  border-style: dashed;
}

/* The Games tab (the reset, 15 Nov 2026): every game met so far, grouped by what it trains. */
.gamestab {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  min-height: 0;
  padding-bottom: 24px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.gameshub__title {
  margin: 0;
  font-size: 22px;
}

.gameshub__about {
  margin: 4px 0 0;
  color: var(--ink-2);
}

.gameshub__group-title {
  margin: 0 0 8px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gameshub__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gameshub__game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--page);
}

.gameshub__words {
  display: grid;
  min-width: 0;
}

.gameshub__name {
  font-weight: 700;
}

.gameshub__where {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gameshub__best {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* Songs: playing with the band, at the top. */
.songs__band {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px 14px;
}

.songs__band-words {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.songs.tabpanel {
  grid-template-rows: auto auto auto minmax(250px, 1fr);
}


/* The 3D hand on its keys (characters/hand/hand.js): the canvas fills the scene's box, with the
   fingers' numbers and "Middle C" placed over it as the hand moves. */
.hand3d {
  position: relative;
  /* (Sized by the lesson's scene box, never the window: James, 16 Nov, saw it run over the piano
     and the buttons on a shorter screen.) */
  width: min(100%, 620px, calc((100cqh - 8px) * 4 / 3));
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  overflow: hidden;
}
.hand3d__canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.hand3d__labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hand3d__finger,
.hand3d__middle-c {
  position: absolute;
  transform: translate(-50%, -50%);
}
.hand3d__finger {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  background: #0ea5e9;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  transition: transform 120ms ease, background-color 120ms ease;
}
.hand3d__finger.is-down {
  background: #0369a1;
  transform: translate(-50%, -50%) scale(1.15);
}
.hand3d__middle-c {
  padding: 3px 12px;
  border-radius: 999px;
  background: #0ea5e9;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

/* ── "More to do" on the level card (Stage 10 of the reset): extra songs, the warm-up, games again ── */
.coursecard__more {
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--page);
}

.coursecard__more-head {
  cursor: pointer;
  padding: 9px 12px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 650;
}

.coursecard__more-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 4px 12px;
  margin: 0;
  padding: 0 12px 10px;
  list-style: none;
}

.coursecard__more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 0;
  font-size: 13.5px;
}

.coursecard__more-tick {
  flex: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  color: var(--green-ink, #15803d);
  font-size: 12px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}

.coursecard__more-item[data-done='true'] .coursecard__more-tick {
  border-color: currentColor;
}

.coursecard__more-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coursecard__more-item .btn {
  flex: none;
  margin: 0;
}

/* ── My exam pieces: the practice kits (Stage 13 of the reset): ui/exam-kit-view.js ── */
.examkit {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
}

.examkit[hidden] {
  display: none;
}

.examkit__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(2px);
}

.examkit__dialog {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(980px, 100%);
  max-height: calc(100vh - 40px);
  padding: 20px 24px;
  overflow: auto;
  border-radius: 20px;
  background: var(--page);
  box-shadow: 0 30px 80px -24px rgba(15, 23, 42, 0.45);
}

.examkit__title {
  margin: 0;
  font-size: 22px;
}

.examkit__about {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.examkit__pieces {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.examkit__piece {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--wash);
}

.examkit__list {
  margin: 0;
  color: var(--xp-ink, #b45309);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.examkit__piece-title,
.examkit__select,
.examkit__bpm {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.examkit__bpm {
  width: 64px;
}

.examkit__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.examkit__bpm-label {
  color: var(--ink-2);
  font-size: 13px;
}

.examkit__actions {
  display: grid;
  gap: 6px;
}

.examkit__actions .btn {
  margin: 0;
}

.examkit__note {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

.examkit__foot {
  display: flex;
  justify-content: flex-end;
}

/* ── A lighter Path and Songs tab (16 Nov, James: "so much of the home screen doesn't need to be
   there"; the music's coloured shape and "Waiting for the piano" gone from Songs) ── */
.songs__top[hidden],
.seedbed[hidden] {
  display: none !important;
}

.home {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1040px;
  width: 100%;
  margin-inline: auto;
}

button.coursecard__badge {
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

button.coursecard__badge:hover {
  transform: scale(1.04);
}

/* The level's tasks: a title, its stars or tick, and one button. The longer words are in each
   button's tooltip and the course. */
.coursecard__quest-about,
.coursecard__quest-note,
.coursecard__quest-state:not(:has(.stars)),
.coursecard__grove {
  display: none !important;
}

/* (16 Nov: "Today" left the Path: Up next and the level's tasks say what to do.) */
#today {
  display: none !important;
}

.coursecard__quest {
  grid-template-rows: none;
  align-content: start;
}

.coursecard__quest > .btn {
  justify-self: start;
  align-self: start;
}

/* The rhythm games' phrase stays big on a shorter screen (16 Nov: at 1366 × 768 the phrase to play
   shrank to a sliver while the "Next" preview stayed large). */
.game-rhythm__now .notation--rhythm {
  max-height: max(140px, calc(100cqh - 190px));
}

.game-rhythm__next .notation--rhythm {
  width: min(32vw, 300px);
  max-height: 64px;
}

/* The orchard tab, all garden (16 Nov 2026, James: "this 3D view of our orchard should be… front
   and center… it should take up the whole bit"): the garden fills the tab, with its tree card and
   the garden and house pickers over it; the groves' names (and percentages) underneath. */
.orchardtab .orchard {
  display: block;
  padding: 14px 16px 16px;
}

.orchard__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.orchard__head .orchard__label {
  margin: 0;
}

.orchard__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.orchard__tools[hidden],
.orchard__tool[hidden] {
  display: none;
}

.orchard__tool {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.orchard__tool:hover {
  border-color: var(--grass);
}

.orchard__tool[aria-pressed='true'] {
  border-color: var(--grass);
  background: color-mix(in srgb, var(--grass) 14%, var(--page));
  color: var(--grass);
}

.orchard3d__stage {
  position: relative;
  height: clamp(420px, calc(100dvh - 230px), 1000px);
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, #8fd0ff 0%, #c9ebff 48%, #e9f8ff 100%);
}

.orchard3d__stage[hidden] {
  display: none;
}

.orchard3d__stage .orchard3d {
  position: absolute;
  inset: 0;
  width: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: none;
}

.orchard3d__loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--ink-2);
  font-weight: 650;
  pointer-events: none;
}

.orchard3d__loading[hidden],
.orchard3d__card[hidden],
.orchard3d__picker[hidden] {
  display: none;
}

.orchard3d__card {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  display: grid;
  gap: 6px;
  width: min(340px, calc(100% - 32px));
  padding: 14px 16px 16px;
  border-radius: 16px;
  background: rgb(255 255 255 / 96%);
  color: #1d2a1a;
  box-shadow: 0 10px 30px rgb(0 0 0 / 18%);
}

.orchard3d__card p,
.orchard3d__card h3 {
  margin: 0;
}

.orchard3d__close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.orchard3d__close:hover {
  background: var(--line);
}

.orchard3d__card-label {
  padding-right: 26px;
  color: var(--grass);
  font-size: 12.5px;
  font-weight: 650;
}

.orchard3d__card-title {
  font-size: 22px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.orchard3d__card-stage {
  font-weight: 650;
}

.orchard3d__bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3eadf;
}

.orchard3d__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5cbf3a, #3f9b3c);
}

.orchard3d__card-time,
.orchard3d__card-next,
.orchard3d__card-here,
.orchard3d__card-rosette {
  color: var(--ink-2);
  font-size: 14px;
}

.orchard3d__card-here {
  color: var(--grass);
  font-weight: 650;
}

.orchard3d__card-rosette svg {
  vertical-align: -4px;
}

.orchard3d__picker {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  overflow-y: auto;
  background: rgb(246 251 255 / 82%);
  backdrop-filter: blur(6px);
  text-align: center;
}

.orchard3d__picker-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
}

.orchard3d__picker-lead {
  max-width: 560px;
  margin: 0;
  color: var(--ink-2);
}

.orchard3d__choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 280px));
  gap: 14px;
  justify-content: center;
  width: 100%;
}

.orchard3d__choice {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 10px 10px 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.orchard3d__choice:hover:not(:disabled) {
  border-color: var(--grass);
  transform: translateY(-2px);
}

.orchard3d__choice[aria-current='true'] {
  border-color: var(--grass);
}

.orchard3d__choice:disabled {
  cursor: default;
  opacity: 0.6;
}

.orchard3d__choice strong {
  font-size: 17px;
}

.orchard3d__choice span {
  color: var(--ink-2);
  font-size: 13.5px;
}

.orchard3d__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  background: linear-gradient(180deg, #a9dcff, #d4efc4);
}

.orchard3d__picker-close {
  margin-top: 4px;
}

@media (max-width: 760px) {
  .orchard3d__choices {
    grid-template-columns: minmax(0, 340px);
  }

  .orchard3d__card {
    left: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}

.orchardtab .orchard__grove--3d .orchard__row {
  margin-top: 8px;
}

.orchardtab .orchard__tree {
  cursor: pointer;
  border-radius: 10px;
}

.orchardtab .orchard__tree.is-selected {
  background: color-mix(in srgb, var(--grass) 14%, transparent);
}

/* Your tree on the Path: small, and tapped it opens (16 Nov 2026). */
.home .seedbed {
  position: static;
  display: block;
  padding: 0;
  overflow: hidden;
}

.seedbed__toggle {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 16px 10px 10px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.seedbed .seedbed__plot {
  width: 72px;
  height: 72px;
  border-radius: 12px;
}

.seedbed__words {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.seedbed .seedbed__label {
  font-size: 12.5px;
}

.seedbed .seedbed__title {
  font-size: 19px;
}

.seedbed .seedbed__stage {
  color: var(--ink-2);
  font-size: 13.5px;
  text-align: left;
}

.seedbed__bar {
  position: relative;
  display: block;
  height: 7px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3eadf;
}

.seedbed__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5cbf3a, #3f9b3c);
}

.seedbed__tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgb(255 255 255 / 85%);
}

.seedbed__chevron::before {
  content: '›';
  display: inline-block;
  color: var(--ink-3);
  font-size: 26px;
  line-height: 1;
  transition: transform 0.15s;
}

.seedbed.is-open .seedbed__chevron::before {
  transform: rotate(90deg);
}

.seedbed__details {
  display: grid;
  gap: 6px;
  padding: 0 16px 14px 96px;
}

.seedbed__details[hidden] {
  display: none;
}

.seedbed__details p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.seedbed__go {
  justify-self: start;
  margin-top: 4px;
}

@media (max-width: 560px) {
  .seedbed__details {
    padding-left: 16px;
  }
}

/* ── The grove as one ordered list (16 Nov, James: "one ordered list" per grove) ─────────────
   Each level folds to a line; the learner's own is open. Each row is a button: what it is, its
   name, and its stars or tick. Rows not open yet are greyed; the next thing to do is outlined. */
.grovepath {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.grovepath__level {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--page);
}

.grovepath__level[data-state='here'] {
  border-color: var(--xp-line);
  box-shadow: 0 0 0 3px var(--xp-wash);
}

.grovepath__level[data-state='done'] {
  background: var(--held-wash);
  border-color: var(--held-line);
}

.grovepath__level[data-state='ahead'] {
  background: var(--wash);
}

.grovepath__level--gate {
  border-style: dashed;
}

.grovepath__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

.grovepath__head::-webkit-details-marker {
  display: none;
}

.grovepath__number {
  color: var(--xp-ink);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.grovepath__skill {
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grovepath__note {
  color: var(--ink-3);
  font-size: 13px;
  white-space: nowrap;
}

.grovepath__level[data-state='done'] .grovepath__note {
  color: var(--held-ink);
  font-weight: 650;
}

.grovepath__items {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0 10px 10px;
  list-style: none;
}

.grovepath__level--gate .grovepath__items {
  padding-top: 10px;
}

.grovepath__go {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--page);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.grovepath__go:hover {
  border-color: var(--line);
  background: var(--wash);
}

.grovepath__kind {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.grovepath__title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grovepath__state {
  color: var(--held-ink);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.grovepath__item[data-open='false'] .grovepath__go {
  opacity: 0.5;
}

.grovepath__item[data-open='false'] .grovepath__go:hover {
  opacity: 0.75;
}

.grovepath__item[data-next='true'] .grovepath__go {
  border-color: var(--next);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

.grovepath__why {
  margin: 4px 12px 0;
  color: var(--ink-2);
  font-size: 13.5px;
}

.grovepath__ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 4px 0 6px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--wash);
  font-size: 14px;
}

.grovepath__ask .btn {
  padding: 6px 12px;
  font-size: 14px;
}

/* A listed grove's shelves are its levels (16 Nov): "Level 3", and the level's lesson under it. */
.songbook__tier-sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}

/* Arranging the garden (16 Nov 2026): a bar along the garden's foot while it's on. */
.orchard3d__arrange {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  width: min(760px, calc(100% - 24px));
  padding: 10px 14px;
  border-radius: 16px;
  background: rgb(255 255 255 / 95%);
  box-shadow: 0 10px 30px rgb(0 0 0 / 18%);
  transform: translateX(-50%);
}

.orchard3d__arrange[hidden] {
  display: none;
}

.orchard3d__arrange-text {
  flex: 1 1 260px;
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
}

.orchard3d__arrange .orchard__tool:disabled {
  opacity: 0.45;
  cursor: default;
}

.orchard3d__stage.is-arranging {
  box-shadow: inset 0 0 0 3px #ffd75a;
}

.orchard__tool--arrange[aria-pressed='true'] {
  border-color: #c99a00;
  background: #fff4c7;
  color: #6b5200;
}

/* The exam standards on the tour's path (17 Nov): a ring at Level 60 and Level 100, named below. */
.tour__mark circle {
  fill: none;
  stroke: var(--xp);
  stroke-width: 2;
}

.tour__mark text {
  fill: var(--w-forest);
  font-size: 9px;
  font-weight: 750;
  text-anchor: middle;
}

.tour__mark .tour__mark-level {
  fill: var(--w-ink-2);
  font-size: 7.5px;
  font-weight: 600;
}

/* A song inside a lesson (22 Nov 2026, from James on the iPad: far too much on the screen). The
   lesson's banner leads, so the song is just its music, start or pause, start again, and how far
   it's got. Everything else (modes, band, names, tempo, hands, timing, lights) is for the Songs tab. */
.app.lesson-strip .stand__facts,
.app.lesson-strip .stand__modes,
.app.lesson-strip .stand__tools,
.app.lesson-strip .stand__close,
.app.lesson-strip .stand__chip,
.app.lesson-strip .stand__offer,
.app.lesson-strip .playbar > :not(.transport__buttons, .transport__where),
.app.lesson-strip .learnbar > :not(.transport__buttons, .transport__where) {
  display: none !important;
}

.app.lesson-strip .stand__head {
  min-height: 0;
}

.app.lesson-strip .stand__title {
  overflow: visible;
  white-space: nowrap;
  text-overflow: clip;
}

/* The lesson's banner over its song keeps one height (22 Nov 2026): when its words changed length
   the music below was drawn again at another size, mid-song. Fewer buttons beside the words, so
   they need fewer lines (Back and Report a bug stay on the lesson's own page, and the top bar).
   Later on 22 Nov (James: the box "takes up quite a lot of space"): a slimmer banner, which stands
   in for the song's own title row (hidden under it), and once Timothy has finished his line it
   shows the song's name and composer, on one line, instead. */
.lesson[data-layout='strip'] {
  height: 74px;
  min-height: 74px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.lesson[data-layout='strip'] .lesson__caption {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: clamp(14.5px, 1.05vw, 16.5px);
  line-height: 1.3;
}

.lesson[data-layout='strip'] .lesson__caption[data-kind='title'] {
  display: flex;
  align-items: baseline;
  gap: 12px;
  overflow: hidden;
  white-space: nowrap;
}

.lesson__song-title {
  font-size: clamp(20px, 1vw + 10px, 26px);
  font-weight: 760;
  letter-spacing: -0.015em;
}

.lesson__song-by {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
}

.app.lesson-strip .stand__head {
  display: none;
}

/* The song's title and its composer on one line (James, 22 Nov 2026), to give the music the room. */
.stand__titles {
  display: flex;
  align-items: baseline;
  gap: 4px 14px;
  min-width: 0;
}

.stand__titles .stand__title {
  flex: 0 1 auto;
}

.stand__titles .stand__by {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}

.lesson[data-layout='strip'] .lesson__control--bug,
.lesson[data-layout='strip'] .lesson__control[data-action='back'] {
  display: none;
}

/* "Press play to start" sits under the score box, left of the play line, where nothing is drawn
   (it was over the bottom of the bass stave: 22 Nov 2026). */
.playhud__hint {
  top: 96px;
  right: auto;
  bottom: auto;
  left: 16px;
  width: auto;
  max-width: min(240px, 30%);
  margin: 0;
  border-radius: 14px;
  white-space: normal;
}

/* An iPad held upright (22 Nov 2026): the top bar in two rows, not three. The piano's name and the
   (since 25 Nov) its tick stays: the name leaves the status button, and Calibrate gets narrower, so the name, the level and the
   buttons share the first row, with the tabs under them. */
@media (max-width: 980px) {
  .topbar .status__detail,
  .levelpill__to,
  html[data-simulated] .sim-tag {
    display: none;
  }

  .topbar .btn--calibrate {
    padding: 6px 12px;
  }

  .topbar__right {
    gap: 6px;
  }
}

/* The piano set-up's three steps (22 Nov 2026). */
.welcome__steps {
  display: grid;
  gap: 10px;
  max-width: 34rem;
  margin: 4px auto 0;
  padding: 0;
  list-style: none;
  counter-reset: setup;
  text-align: left;
}

.welcome__steps li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgb(255 255 255 / 0.72);
  color: var(--w-forest);
  font-size: 1.05rem;
  line-height: 1.4;
  counter-increment: setup;
}

.welcome__steps li::before {
  content: counter(setup);
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--w-forest);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Settings, tidied (23 Nov 2026): the rarely used parts folded away under More, the version at the
   foot. */
.course__unlock[hidden],
.settings__section[hidden] {
  display: none;
}
.settings__more {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.settings__more-title {
  cursor: pointer;
  padding: 8px 0;
  font-weight: 750;
  font-size: 16px;
  color: var(--ink);
  list-style-position: inside;
}
.settings__more-title:hover {
  color: var(--accent, var(--ink));
}
.settings__version {
  margin: 18px 0 4px;
  color: var(--ink-3, var(--ink-2));
  font-size: 12px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

/* James's logo above the name on the opening screens (24 Nov 2026). */
.welcome__logo {
  display: block;
  width: clamp(76px, 12vmin, 132px);
  height: auto;
  margin: 0 auto 18px;
  border-radius: 22.5%;
  box-shadow: 0 10px 28px rgba(31, 59, 45, 0.28), 0 0 0 1px rgba(31, 59, 45, 0.08);
}

/* ── Redesign, 25 Nov 2026 (James's picks from the options deck) ──────────────────────────── */

/* Fix 1: in Learn, "Step 1 of 32" ran into "Practise". The step count keeps its room, and the
   word "Practise" (Left / Both / Right already say it) is left for screen readers only. */
.learnbar .transport__where {
  min-width: min-content;
}

.learnbar .learnbar__count {
  margin-right: 4px;
}

.learnbar #learnbar-hands {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* …and the 60 / 80 / 100 shortcuts step aside when the bar is short of room: the slider, − and +,
   and the percentage (back to the written tempo) do the same job. */
@container stand (max-width: 1500px) {
  .learnbar .transport__picks {
    display: none;
  }
}

/* Fixes 3 and 4: the Games tab, a grove at a time (folded), each card one button. */
.gameshub__group {
  border-radius: 14px;
}

.gameshub__group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 2px 10px;
  cursor: pointer;
  list-style: none;
}

.gameshub__group-head::-webkit-details-marker {
  display: none;
}

.gameshub__group-head::before {
  content: '';
  align-self: center;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.gameshub__group[open] > .gameshub__group-head::before {
  transform: rotate(45deg);
}

.gameshub__group-head .gameshub__group-title {
  margin: 0;
}

.gameshub__group-count {
  color: var(--ink-3);
  font-size: 13px;
}

.gameshub__game {
  display: block;
  padding: 0;
  border: 0;
  background: none;
}

.gameshub__go {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--page);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.gameshub__go:hover {
  border-color: var(--line-strong);
  background: var(--wash);
}

.gameshub__go .gameshub__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gameshub__side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gameshub__best--new {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--held-wash);
  color: var(--held-ink);
}

.gameshub__play {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  font-size: 14px;
  font-weight: 650;
}

.gameshub__go:hover .gameshub__play {
  border-color: var(--accent);
  color: var(--accent-ink);
}


/* Fix 5: the groves' tabs show their whole names, the strip scrolling sideways when they don't fit. */
.songbook__groves {
  grid-auto-columns: minmax(118px, max-content);
}

.songbook__grove-name {
  overflow: visible;
}

/* Fix 6: Easy, Medium or Hard said in words with leaves, in place of the unexplained stripe. */
.sbcard,
.sbcard[data-tier='2'],
.sbcard[data-tier='3'] {
  border-top: 1px solid var(--line);
}

.sbcard {
  grid-template-rows: auto auto auto 1fr auto auto;
}

.sbcard__tier {
  display: inline-flex;
  align-self: end;
  align-items: center;
  gap: 1px;
  margin-top: 4px;
  color: var(--grass);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.sbcard__tier svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

/* ── Theme B: the orchard bar (James, 25 Nov: "I like option B … what can we do to improve
   that?"). This is the base all three of its versions share: a forest-green top bar with the gate
   logo, titles in Alegreya, warm cream cards on a soft sage page, forest-green main buttons and
   leaf-green accents. Sheet music stays white (--paper), and so does its frame's neutral grey. */
:root {
  --page: #fffdf7;
  --wash: #f4f6ec;
  --fill: #ebf0e0;
  --line: #dde4cf;
  --line-strong: #c3d0b0;
  --ink: #16281b;
  --ink-2: #435747;
  --ink-3: #56695a; /* (4.5:1 on the cream and the sage) */
  --accent: #3f8f4a;
  --accent-ink: #2b6a35;
  --forest: #1d3a27;
  --forest-2: #2f6b3a;
  --bar-ink: #fbf5df;
  --bar-ink-2: #d5e4c8;
  --sage: #e8eedd;
}

body,
.app {
  background: var(--sage);
}

.topbar {
  border-bottom: 0;
  background: linear-gradient(180deg, #24452f, #1b3624);
  box-shadow: 0 2px 12px -4px rgba(20, 42, 29, 0.55);
  color: var(--bar-ink);
}

.wordmark__home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--bar-ink);
  font-family: 'Alegreya', Georgia, serif;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0;
}

.wordmark__home::before {
  content: '';
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: url('web/logo-256.png') center / cover;
  box-shadow: 0 0 0 1.5px rgba(251, 245, 223, 0.35);
}

.wordmark__home:hover {
  color: #fff;
}

.topbar .tabs {
  background: rgba(255, 255, 255, 0.1);
}

.topbar .tabs__tab {
  color: var(--bar-ink-2);
}

.topbar .tabs__tab:hover {
  color: #fff;
}

.topbar .tabs__tab[aria-selected='true'] {
  background: var(--bar-ink);
  color: var(--forest);
  box-shadow: none;
}

.topbar .btn--gear,
.topbar .btn--calibrate,
.topbar .status,
.topbar .levelpill__button {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--bar-ink);
}

.topbar .btn--gear:hover:not(:disabled),
.topbar .btn--calibrate:hover:not(:disabled),
.topbar .status:hover,
.topbar .levelpill__button:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.16);
}

.topbar .status__detail,
.topbar .levelpill__words {
  color: var(--bar-ink-2);
}

.topbar .status__tick {
  color: #22c55e;
}

.topbar :focus-visible {
  outline-color: var(--bar-ink);
}

.btn--primary {
  border-color: var(--forest-2);
  background: var(--forest-2);
}

.btn--primary:hover:not(:disabled) {
  border-color: #275a31;
  background: #275a31;
}

.coursecard__title,
.upnext__title,
.songbook__title,
.gameshub__title,
.stand__title,
.game__title,
.lesson__title,
.game__words,
.grovepath__skill,
.songbook__grove-name,
.gameshub__name,
.gameshub__group-title {
  font-family: 'Alegreya', Georgia, serif;
  letter-spacing: 0;
}

.coursecard__title {
  font-weight: 700;
  line-height: 1.15;
}

.upnext__title,
.grovepath__skill,
.gameshub__name {
  font-weight: 700;
}

.songbook__title,
.gameshub__title,
.stand__title,
.game__title,
.lesson__title,
.game__words {
  font-weight: 800;
}

.gameshub__group-title {
  color: var(--ink);
  font-size: 19px;
  letter-spacing: 0;
  text-transform: none;
}

.upnext {
  background: linear-gradient(135deg, #eef5e4, var(--page));
  box-shadow: var(--shadow-panel), inset 0 0 0 1.5px #7fae6c;
}

.upnext__label {
  color: var(--accent-ink);
}

/* The sheet music's frame stays a neutral grey, never green. */
.score {
  background: #f3f4f1;
}

/* G2 (settled 25 Nov): every game in the orchard, on a solid white card so nothing shows behind the
   notes. The card and the stage's sides share one measure, so the game always fits on its card. */
.game__stage {
  --card-side: clamp(20px, 9%, 150px);
  padding-inline: calc(var(--card-side) + 18px);
  border: 0;
  background: url('web/orchard-scene.webp') center 70% / cover no-repeat;
  isolation: isolate;
}

.game__stage::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 12px var(--card-side);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 50px -20px rgba(20, 42, 29, 0.5);
}

/* ── Theme B2 + B3 (James, 26 Nov: "I like B2 painted … B3 with the pill shapes more opaque, but not
   100%, so it's easier to read them"). The painted countryside behind the top bar, Up next and the
   section heads; each grove's own tree on the path and the grove tabs; the top bar's pills on a deep
   green that lets only a hint of the painting through. */
.topbar {
  background:
    linear-gradient(180deg, rgba(27, 54, 36, 0.55), rgba(22, 44, 29, 0.72)),
    url('orchard/textures/panorama.webp') center 58% / cover;
}

.topbar .tabs,
.topbar .btn--gear,
.topbar .btn--calibrate,
.topbar .status,
.topbar .levelpill__button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(18, 38, 25, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.topbar .btn--gear:hover:not(:disabled),
.topbar .btn--calibrate:hover:not(:disabled),
.topbar .status:hover,
.topbar .levelpill__button:hover {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(30, 60, 39, 0.86);
}

.topbar .tabs__tab[aria-selected='true'] {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.wordmark__home {
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.upnext {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding-left: 132px;
  background:
    linear-gradient(90deg, rgba(255, 253, 247, 0.97) 0%, rgba(255, 253, 247, 0.92) 52%, rgba(255, 253, 247, 0.15) 100%),
    url('orchard/textures/panorama.webp') center 62% / cover;
}

.upnext__tree {
  position: absolute;
  bottom: 6px;
  left: 22px;
  width: 96px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 6px 6px rgba(20, 42, 29, 0.25));
  pointer-events: none;
}

.coursecard__head {
  position: relative;
}

.coursecard__main {
  padding-right: 120px;
}

.coursecard__tree {
  position: absolute;
  top: -14px;
  right: 8px;
  width: 118px;
  height: 118px;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(20, 42, 29, 0.22));
  pointer-events: none;
}

.songbook__grove {
  position: relative;
  padding-left: 52px;
}

.songbook__grove-tree {
  position: absolute;
  top: 50%;
  left: 8px;
  width: 38px;
  height: 44px;
  object-fit: contain;
  transform: translateY(-50%);
  pointer-events: none;
}

.songbook__grove[data-state='locked'] .songbook__grove-tree {
  filter: grayscale(1) opacity(0.45);
}

.songbook__head,
.gameshub__head {
  position: relative;
  padding: 26px 28px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(23, 47, 31, 0.9), rgba(23, 47, 31, 0.55) 60%, rgba(23, 47, 31, 0.1)),
    url('orchard/textures/panorama.webp') center 55% / cover;
  color: #fff;
}

.songbook__head .songbook__title,
.gameshub__head .gameshub__title {
  color: var(--bar-ink);
}

.songbook__head .songbook__why,
.gameshub__head .gameshub__about {
  color: #dbe8cf;
}

.songbook__head .songbook__surprise {
  background: var(--page);
  color: var(--ink);
}

/* An iPad held upright: smaller pictures, so the words keep their room. */
@media (max-width: 980px) {
  .upnext {
    padding-left: 96px;
  }

  .upnext__tree {
    left: 14px;
    width: 70px;
    height: 80px;
  }

  .coursecard__main {
    padding-right: 84px;
  }

  .coursecard__tree {
    top: -6px;
    width: 84px;
    height: 84px;
  }
}
