/* Piano Recall — "Nocturne"
   A concert hall after dark: lacquer-black stage, gold leaf, an ivory
   manuscript on the music stand and a real keybed beneath it. */

@font-face { font-family: PianoRecallNotation; src: url('./vendor/piano-notation.woff2') format('woff2'); font-display: block; }

:root {
  color-scheme: dark;
  --night-0: #06070d;
  --night-1: #0a0b14;
  --night-2: #11131f;
  --night-3: #191c2c;
  --glass: rgba(255, 246, 225, .035);
  --glass-2: rgba(255, 246, 225, .06);
  --glass-3: rgba(255, 246, 225, .1);
  --hair: rgba(226, 190, 128, .16);
  --hair-2: rgba(226, 190, 128, .32);
  --gold: #e2b866;
  --gold-hi: #f8e2aa;
  --gold-lo: #9e7637;
  --gold-grad: linear-gradient(135deg, #fbe8b8 0%, #e6bd6c 45%, #b98a3f 100%);
  --ivory: #f6efdf;
  --ivory-2: #ece1c8;
  --ink: #1b1828;
  --ink-soft: #5c556b;
  --ink-faint: #8e8597;
  --text: #f1e9d8;
  --text-soft: #aaa3b8;
  --text-faint: #716b83;
  --verdigris: #74d8b0;
  --verdigris-deep: #23775c;
  --green-line: #62d39b;
  --ember: #f39073;
  --ember-deep: #b5472c;
  --felt: #7d1e2c;
  --display: 'Didot', 'Bodoni 72', 'Bodoni Moda', 'Bodoni MT', 'Playfair Display', 'Iowan Old Style', Georgia, serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: 'Avenir Next', Avenir, 'Segoe UI Variable Text', 'Segoe UI', 'Helvetica Neue', system-ui, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-soft: cubic-bezier(.45, 0, .2, 1);
  --fg: var(--text);
  --fg-soft: var(--text-soft);
  --fg-faint: var(--text-faint);
  --rule: var(--hair);
  /* Names older feature styles may still reach for. */
  --bg: var(--night-1); --paper: var(--night-2); --muted: var(--text-soft); --line: var(--hair); --green: var(--gold); --lime: rgba(226, 184, 102, .25);
  --level: 0;
  font-family: var(--sans);
  color: var(--fg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scrollbar-color: #3a3448 transparent;
  background-color: var(--night-0);
}
body { margin: 0; min-height: 100dvh; background: transparent; overflow-x: hidden; }
::selection { background: rgba(226, 184, 102, .35); color: #fff8e6; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
svg { display: block; }
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c2838; border-radius: 10px; border: 2px solid var(--night-1); }
::-webkit-scrollbar-track { background: transparent; }

/* ───────────── The stage: light, haze and dust ───────────── */
.stage-lights {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; contain: strict;
  background:
    radial-gradient(120% 70% at 50% -12%, #2b2440 0%, rgba(43, 36, 64, 0) 62%),
    radial-gradient(90% 60% at 100% 110%, #1d1630 0%, rgba(29, 22, 48, 0) 60%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-0) 100%);
}
.stage-lights > i { position: absolute; display: block; }
.aurora { width: 70vmax; height: 70vmax; opacity: .5; }
.aurora-a { left: -22vmax; top: -30vmax; background: radial-gradient(circle closest-side, rgba(59, 42, 94, .95) 0%, rgba(59, 42, 94, .45) 40%, rgba(59, 42, 94, 0) 100%); animation: drift-a 38s var(--ease-soft) infinite alternate; }
.aurora-b { right: -26vmax; top: 10vmax; background: radial-gradient(circle closest-side, rgba(18, 58, 68, .95) 0%, rgba(18, 58, 68, .45) 40%, rgba(18, 58, 68, 0) 100%); opacity: .45; animation: drift-b 46s var(--ease-soft) infinite alternate; }
.aurora-c { left: 20vmax; bottom: -42vmax; background: radial-gradient(circle closest-side, rgba(74, 37, 51, .95) 0%, rgba(74, 37, 51, .45) 40%, rgba(74, 37, 51, 0) 100%); opacity: .38; animation: drift-c 52s var(--ease-soft) infinite alternate; }
.spotlight {
  left: 50%; top: -8vh; width: min(1200px, 130vw); height: 110vh; transform: translateX(-50%);
  background: radial-gradient(50% 60% at 50% 0%, rgba(255, 226, 160, .13) 0%, rgba(255, 226, 160, .05) 40%, rgba(255, 226, 160, 0) 72%);
  animation: spot-breathe 9s ease-in-out infinite;
}
.cursor-glow {
  left: 0; top: 0; width: 1040px; height: 1040px; margin: -520px 0 0 -520px;
  background: radial-gradient(circle closest-side, rgba(240, 205, 140, .07), rgba(240, 205, 140, 0) 70%);
  transform: translate3d(50vw, 20vh, 0); will-change: transform;
}
.staves {
  left: -20vw; right: -20vw; top: 22vh; height: 62vh;
  background: repeating-linear-gradient(180deg, rgba(226, 190, 128, .07) 0 1px, transparent 1px 12px, rgba(226, 190, 128, .07) 12px 13px, transparent 13px 24px, rgba(226, 190, 128, .07) 24px 25px, transparent 25px 36px, rgba(226, 190, 128, .07) 36px 37px, transparent 37px 48px, rgba(226, 190, 128, .07) 48px 49px, transparent 49px 210px);
  -webkit-mask-image: radial-gradient(60% 55% at 50% 50%, #000 0%, transparent 75%);
  mask-image: radial-gradient(60% 55% at 50% 50%, #000 0%, transparent 75%);
  transform: rotate(-7deg);
}
.grain {
  inset: 0;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .95 0 0 0 0 .85 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.mote {
  position: absolute; left: var(--x); bottom: -4vh;
  width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 233, 180, .95) 0%, rgba(255, 220, 150, 0) 70%);
  opacity: 0; animation: mote-rise var(--d) linear var(--delay) infinite;
}
.drift-glyph {
  position: absolute; left: var(--x); bottom: -12vh;
  font-family: PianoRecallNotation; font-size: var(--size); line-height: 1;
  color: rgba(232, 196, 130, .085);
  opacity: 0; animation: glyph-rise var(--d) linear var(--delay) infinite;
}

/* ───────────── Marquee (top navigation) ───────────── */
.marquee {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  height: 78px; padding: 0 clamp(18px, 4vw, 48px);
}
.marquee::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(9, 10, 18, .97) 0%, rgba(10, 11, 20, .9) 100%);
  animation: fade-in .9s var(--ease-out) both;
}
.brand, .marquee-actions { animation: fade-down .9s var(--ease-out) .05s both; }
.movements { animation: fade-down .9s var(--ease-out) .15s both; }
.marquee::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--hair-2) 30%, rgba(248, 226, 170, .55) 50%, var(--hair-2) 70%, transparent 100%);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; justify-self: start; min-height: 44px; }
.brand-mark { width: 40px; height: 40px; overflow: visible; }
.brand-ring { fill: none; stroke: url(#brand-gold); stroke-width: 1.1; stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 1.8s var(--ease-out) .2s forwards; }
.brand-note { fill: url(#brand-gold); stroke: url(#brand-gold); transform-origin: 20px 26px; }
.brand-note path { fill: none; stroke-width: 1.7; stroke-linecap: round; }
.brand-note ellipse { stroke: none; }
.brand:hover .brand-note { animation: note-wiggle .7s var(--ease-spring); }
.wordmark { display: flex; flex-direction: column; line-height: 1; }
.wordmark em { font-family: var(--display); font-style: italic; font-size: 27px; letter-spacing: -.3px; color: var(--text); }
.wordmark span { font-size: 8.5px; letter-spacing: .58em; font-weight: 600; text-transform: uppercase; color: var(--gold); margin: 5px 0 0 2px; }

.movements { position: relative; display: flex; align-items: center; gap: 4px; counter-reset: movement; }
.movements a {
  position: relative; z-index: 1; counter-increment: movement;
  display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 10px 16px;
  text-decoration: none; font-size: 13.5px; font-weight: 500; letter-spacing: .02em; color: var(--text-soft);
  border-radius: 999px; overflow: hidden;
  transition: color .35s, transform .35s var(--ease-out);
}
.movements a::before {
  content: counter(movement, upper-roman);
  min-width: 1.6em; text-align: right;
  font-family: var(--display); font-size: 14px; letter-spacing: .06em; color: var(--text-faint);
  transition: color .35s, transform .5s var(--ease-spring);
}
.movements a > span:first-child { display: none; }
.movements a:hover { color: var(--text); }
.movements a:hover::before { color: var(--gold); transform: translateY(-2px) rotate(-8deg); }
.movements a.active { color: var(--gold-hi); }
.movements a.active::before { color: var(--gold); }
.movements:not(.has-glider) a.active { background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--hair-2); }
.nav-glider {
  position: absolute; left: 0; top: 0; z-index: 0; border-radius: 999px; pointer-events: none;
  background: linear-gradient(180deg, rgba(248, 226, 170, .1), rgba(248, 226, 170, .03));
  box-shadow: inset 0 0 0 1px var(--hair-2), 0 8px 30px -10px rgba(226, 184, 102, .45);
  transition: transform .6s var(--ease-spring), width .6s var(--ease-spring), height .6s var(--ease-spring), opacity .3s;
}
.nav-glider::after {
  content: ''; position: absolute; left: 50%; bottom: -1px; width: 22px; height: 2px; margin-left: -11px; border-radius: 2px;
  background: var(--gold-grad); box-shadow: 0 0 12px 1px rgba(248, 210, 130, .7);
}
.marquee-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.account-button {
  position: relative; overflow: hidden; min-height: 40px; max-width: 200px; padding: 9px 18px;
  border: 1px solid var(--hair-2); border-radius: 999px; background: var(--glass);
  color: var(--gold-hi); font-size: 12.5px; font-weight: 600; letter-spacing: .03em; white-space: nowrap; text-overflow: ellipsis;
  transition: border-color .3s, background .3s, transform .3s var(--ease-out), box-shadow .3s;
}
.account-button:hover { border-color: rgba(248, 226, 170, .6); background: var(--glass-2); transform: translateY(-1px); box-shadow: 0 8px 26px -12px rgba(226, 184, 102, .6); }
.quiet-button {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-soft); font-size: 12.5px;
  transition: color .3s, background .3s;
}
.quiet-button:hover { color: var(--text); background: var(--glass-2); }
.quiet-button svg { width: 18px; height: 18px; transition: transform .6s var(--ease-spring); }
.quiet-button:hover svg { transform: rotate(-20deg) scale(1.1); }

.rail {
  position: fixed; left: 24px; top: 50%; z-index: 2;
  display: flex; align-items: center; gap: 14px;
  transform: translateY(-50%) rotate(180deg); writing-mode: vertical-rl;
  font-size: 9.5px; font-weight: 600; letter-spacing: .5em; text-transform: uppercase; color: var(--text-faint);
  pointer-events: none;
}
.rail i { width: 1px; height: 46px; background: linear-gradient(var(--hair-2), transparent); }
.rail #page-name { color: var(--gold); transition: opacity .4s; }

/* ───────────── Page frame ───────────── */
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 56px); min-width: 0; }
#view { min-height: calc(100dvh - 210px); padding: 44px 0 30px; }
.curtain-call {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 34px 0 48px; margin-top: 30px; color: var(--text-faint); font-size: 12px; letter-spacing: .04em;
  border-top: 1px solid; border-image: linear-gradient(90deg, transparent, var(--hair), transparent) 1;
}
.curtain-call p { margin: 0; font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--text-soft); }
.fermata { font-family: PianoRecallNotation; font-size: 30px; line-height: 1; height: 20px; color: var(--gold); opacity: .7; }
.footer-help {
  position: relative; overflow: hidden; border: 0; background: none; padding: 8px 4px; color: var(--gold); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.footer-help::after { content: ''; position: absolute; left: 4px; right: 4px; bottom: 4px; height: 1px; background: currentColor; transform: scaleX(.3); transition: transform .5s var(--ease-out); }
.footer-help:hover::after { transform: scaleX(1); }

/* ───────────── Page headers ───────────── */
.intro-row { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0 auto 38px; max-width: 760px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .38em; text-transform: uppercase; color: var(--gold);
}
.eyebrow::before, .eyebrow::after { content: ''; width: 34px; height: 1px; background: linear-gradient(90deg, transparent, var(--hair-2)); }
.eyebrow::after { transform: scaleX(-1); }
.eyebrow .status-dot { display: none; }
.intro-row h1 {
  margin: 16px 0 12px;
  font-family: var(--display); font-weight: 400; font-size: clamp(40px, 6.4vw, 76px); line-height: 1.02; letter-spacing: -.015em;
  background: linear-gradient(100deg, #f4ead4 0%, #f4ead4 38%, #ffe2a0 48%, #fff4d6 52%, #f4ead4 62%, #f4ead4 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.8s ease-in-out .9s both;
}
.intro-row h1.is-split { background: none; animation: none; color: var(--text); }
.intro-row h1 .word {
  display: inline-block;
  background: inherit; background-image: linear-gradient(100deg, #f4ead4 0%, #f4ead4 38%, #ffe2a0 48%, #fff4d6 52%, #f4ead4 62%, #f4ead4 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: word-rise 1.1s var(--ease-out) calc(var(--w) * 90ms + 80ms) both, shimmer 1.8s ease-in-out calc(1s + var(--w) * 90ms) both;
}
.intro-row p { margin: 0 auto; font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.6; color: var(--text-soft); max-width: 560px; }
.streak {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; padding: 8px 16px 8px 12px;
  border: 1px solid var(--hair); border-radius: 999px; background: rgba(22, 22, 34, .78);
  font-size: 12px; color: var(--text-soft); white-space: nowrap;
}
.streak svg { width: 18px; height: 18px; color: #ffb36b; filter: drop-shadow(0 0 6px rgba(255, 160, 80, .55)); transform-origin: 50% 90%; animation: flicker 2.6s ease-in-out infinite; }
.streak strong { color: var(--text); font-weight: 600; }
body[data-page="practice"] .intro-row { margin-bottom: 26px; }
body[data-page="practice"] .intro-row h1 { font-size: clamp(38px, 5vw, 60px); }

/* ───────────── Practice stage ───────────── */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 34px; }
.practice-column { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.practice-column > * { width: 100%; }
.session-strip {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 14px;
  max-width: 760px; margin: 0 0 14px; padding: 0 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--text-faint);
}
.session-strip strong { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 600; }
.session-strip strong svg { width: 16px; height: 16px; }
.session-strip span { text-align: center; }
.session-strip b { color: var(--gold-lo); margin: 0 6px; }
.beginner-note {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 760px; margin: 0 0 18px; padding: 12px 14px 12px 20px;
  border-radius: 14px; background: rgba(22, 22, 34, .74); border: 1px solid var(--hair);
  position: relative; overflow: hidden;
}
.beginner-note::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; border-radius: 2px; background: var(--gold-grad); }
.beginner-note p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text-soft); }
.beginner-note strong { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 16px; color: var(--text); }
.beginner-note button { flex-shrink: 0; }

/* The manuscript */
.practice-card {
  --fg: var(--ink); --fg-soft: var(--ink-soft); --fg-faint: var(--ink-faint); --rule: rgba(110, 86, 48, .2);
  position: relative; max-width: 780px; color: var(--fg);
  border-radius: 6px 6px 10px 10px;
  background-color: var(--ivory);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .22 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"),
    radial-gradient(120% 80% at 50% 0%, rgba(255, 252, 240, .9) 0%, rgba(255, 252, 240, 0) 60%),
    radial-gradient(140% 120% at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(120, 90, 40, .16) 100%),
    linear-gradient(180deg, #f8f2e4 0%, #f1e7d0 100%);
  box-shadow:
    inset 0 0 0 1px rgba(160, 124, 56, .34),
    inset 0 0 0 7px rgba(246, 239, 223, .65),
    inset 0 0 0 8px rgba(160, 124, 56, .18),
    0 1px 0 rgba(255, 255, 255, .5),
    0 40px 80px -30px rgba(0, 0, 0, .85),
    0 0 120px -30px rgba(255, 220, 150, .28);
}
.practice-card::before {
  content: '\e4c0'; font-family: PianoRecallNotation; position: absolute; left: 50%; top: 26px; transform: translateX(-50%);
  font-size: 30px; line-height: 0; color: var(--gold-lo); opacity: .6; pointer-events: none;
}
.practice-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; box-shadow: 0 0 0 1px rgba(35, 119, 92, .3), 0 0 150px -12px rgba(116, 216, 176, .55);
}
.card-topline { display: flex; justify-content: center; padding: 40px 24px 0; }
.tag {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: .3em; color: var(--gold-lo);
}
.tag::before, .tag::after { content: ''; width: 5px; height: 5px; background: currentColor; transform: rotate(45deg); opacity: .7; }
.card-counter { font-size: 11px; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.music-space { position: relative; text-align: center; padding: 6px 24px 0; }
.prompt-title { margin: 12px 0 0; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 4vw, 42px); line-height: 1.1; letter-spacing: -.01em; color: var(--fg); }
.prompt-subtitle { margin: 8px 0 0; min-height: 22px; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--fg-soft); }
.practice-card[data-phase="correction"] .prompt-title { color: var(--ember-deep); }
.practice-card[data-phase="correct"] .prompt-title { color: var(--verdigris-deep); }
.staff-svg { width: min(100%, 560px); height: 236px; margin: 2px auto -6px; color: var(--ink); overflow: visible; pointer-events: none; }
.staff-svg.revealed { color: var(--verdigris-deep); }
.practice-card[data-phase="correction"] .staff-svg.revealed { color: var(--ember-deep); }
.music-glyph { font-family: PianoRecallNotation; }
.staff-svg > g:first-of-type line { stroke-dasharray: 440; stroke-dashoffset: 0; }
.staff-svg .music-glyph[x="260"] { transform-box: fill-box; transform-origin: 50% 50%; }
.practice-card[data-phase="correct"] .staff-svg .music-glyph[x="260"] { filter: drop-shadow(0 0 8px rgba(35, 119, 92, .55)); animation: notehead-glow 2.2s ease-in-out infinite; }
.practice-card[data-phase="correction"] .staff-svg .music-glyph[x="260"] { filter: drop-shadow(0 0 8px rgba(181, 71, 44, .45)); }

.card-response { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 46px; padding: 0 20px; margin-bottom: 18px; font-size: 14px; color: var(--fg-soft); text-align: center; }
.response-idle { font-family: var(--serif); font-style: italic; color: var(--fg-soft); }
.feedback-good { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--verdigris-deep); color: #f6fff9; animation: pop-in .6s var(--ease-spring) both; }
.feedback-good svg { width: 16px; height: 16px; stroke-width: 2.4; }
.feedback-wrong { color: var(--ember-deep); font-weight: 500; }
.recent-answer { color: var(--fg); font-weight: 500; }
.grade-note { color: var(--fg-faint); }
.elapsed { min-width: 52px; font-family: var(--display); font-size: 22px; color: var(--fg); font-variant-numeric: tabular-nums; text-align: left; }
.listening-dot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--gold-lo); flex-shrink: 0; }
.listening-dot::before, .listening-dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--gold-lo);
  animation: listen-ring 2.4s var(--ease-out) infinite;
}
.listening-dot::after { animation-delay: 1.2s; }
.listening-dot { transform: scale(calc(1 + var(--level, 0) * .8)); transition: transform .12s; }

.start-overlay { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 24px 34px; text-align: center; }
.start-overlay p { margin: 0; max-width: 420px; font-size: 13px; line-height: 1.6; color: var(--fg-soft); }
.practice-card[data-phase="idle"] .card-response,
.practice-card[data-phase="idle"] .card-actions,
.practice-card[data-phase="paused"] .card-actions { display: none; }
.practice-card[data-phase="paused"] .staff-svg { opacity: .32; filter: blur(1.5px); transition: opacity .6s, filter .6s; }
.practice-card[data-phase="paused"] .card-response { font-family: var(--serif); font-style: italic; }

.card-actions {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  min-height: 64px; margin: 0 8px 8px; padding: 10px 18px;
  border-top: 1px solid var(--rule); border-radius: 0 0 6px 6px; background: rgba(120, 90, 40, .04);
}
.input-chip { display: inline-flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-faint); }
.input-chip svg { width: 16px; height: 16px; }
.small-wave { display: inline-flex; align-items: center; gap: 2px; height: 16px; }
.small-wave i { width: 2px; height: 100%; border-radius: 2px; background: var(--gold-lo); transform-origin: 50% 50%; animation: eq 1.1s ease-in-out infinite; }
.small-wave i:nth-child(1) { animation-delay: -.2s; }
.small-wave i:nth-child(2) { animation-delay: -.55s; }
.small-wave i:nth-child(3) { animation-delay: -.1s; }
.small-wave i:nth-child(4) { animation-delay: -.75s; }
.small-wave i:nth-child(5) { animation-delay: -.4s; }
.level-meter { width: 54px; height: 3px; border-radius: 3px; overflow: hidden; background: rgba(120, 90, 40, .15); }
.level-meter i { display: block; height: 100%; width: 0; background: var(--gold-grad); transition: width .1s; }

/* Summary (all caught up) */
.summary-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 420px; padding: 56px 28px 40px; }
.summary-card .big-spark { font-size: 46px; line-height: 1; color: var(--gold-lo); display: inline-block; animation: spin-slow 14s linear infinite; }
.summary-card h2 { margin: 18px 0 10px; font-family: var(--display); font-weight: 400; font-size: clamp(32px, 4.4vw, 46px); line-height: 1.08; }
.summary-card p { max-width: 430px; margin: 0 0 24px; font-family: var(--serif); font-size: 16px; line-height: 1.7; color: var(--fg-soft); }
.summary-card p[style] { font-family: var(--sans); font-style: normal; color: var(--fg-faint); }
.summary-metrics { display: flex; gap: 0; margin: 4px 0 28px; }
.summary-metrics > div { padding: 0 30px; }
.summary-metrics > div + div { border-left: 1px solid var(--rule); }
.summary-metrics strong { display: block; font-family: var(--display); font-weight: 400; font-size: 46px; line-height: 1; }
.summary-metrics span { display: block; margin-top: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--fg-faint); }

/* ───────────── The keybed ───────────── */
.keyboard-area {
  position: relative; max-width: 960px; margin-top: 30px; padding: 0 16px 14px;
  border-radius: 22px 22px 16px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .07) 0%, rgba(255, 255, 255, 0) 16%),
    linear-gradient(180deg, #17151f 0%, #0b0a10 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), inset 0 -1px 0 rgba(0, 0, 0, .8), 0 30px 60px -24px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .03);
}
.keyboard-area::before {
  content: ''; position: absolute; left: 10%; right: 10%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 240, 200, .45), transparent);
}
.keyboard-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 6px 13px; }
.keyboard-head strong { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 15px; color: var(--gold-hi); text-shadow: 0 0 18px rgba(248, 210, 130, .25); }
.keyboard-head > span { font-size: 9.5px; font-weight: 600; letter-spacing: .32em; text-align: right; color: var(--text-faint); }
.keyboard-scroll { overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 2px; border-radius: 4px 4px 10px 10px; }
.keyboard {
  position: relative; display: flex; height: 184px; min-width: 260px; padding-top: 6px;
  border-radius: 4px 4px 10px 10px; background: #050407;
  box-shadow: inset 0 10px 14px -8px rgba(0, 0, 0, .9);
}
.keyboard::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 7px; z-index: 4; pointer-events: none;
  background: linear-gradient(180deg, #a0303f 0%, var(--felt) 55%, #4a0f19 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
.key { position: relative; overflow: hidden; border: 0; padding: 0; display: flex; align-items: flex-end; justify-content: center; user-select: none; -webkit-user-select: none; font: inherit; }
.white-key {
  flex: 1 1 0; min-width: 0; height: 100%; padding-bottom: 14px; margin: 0 1px 0 0;
  border-radius: 0 0 7px 7px;
  background: linear-gradient(180deg, #e8dfcb 0%, #fbf6ea 9%, #f7f0e0 70%, #ece2cb 100%);
  box-shadow: inset 0 -7px 0 #d6c9ad, inset 0 -8px 0 #fffaf0, inset 1px 0 0 rgba(255, 255, 255, .7), 0 3px 0 #29242f;
  color: var(--ink-soft); font-size: 11px; font-weight: 600;
  transition: transform .14s var(--ease-out), box-shadow .14s, background .3s;
}
.white-key:last-child { margin-right: 0; }
.white-key > span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.white-key small { max-width: 52px; font-size: 11px; font-weight: 700; letter-spacing: 0; line-height: 1.15; white-space: normal; color: var(--ink-soft); }
.white-key.key-c { background: linear-gradient(180deg, #e9dcc2 0%, #fff6e2 9%, #fbf0d8 70%, #efdfbf 100%); }
.white-key.in-note-group::after {
  content: ''; position: absolute; left: 18%; right: 18%; bottom: 4px; height: 3px; border-radius: 3px;
  background: var(--green-line); box-shadow: 0 0 10px rgba(98, 211, 155, .8);
}
.black-key {
  position: absolute; top: 6px; z-index: 2; height: 60%; padding-bottom: 12px;
  border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg, #121118 0%, #2a2833 82%, #3d3a47 88%, #18161e 100%);
  box-shadow: inset 0 -9px 0 #0a090d, inset 1.5px 0 0 rgba(255, 255, 255, .1), inset -1.5px 0 0 rgba(0, 0, 0, .5), 3px 6px 8px rgba(0, 0, 0, .55);
  color: rgba(240, 230, 210, .55); font-size: 8.5px; font-weight: 600;
  transition: transform .14s var(--ease-out), box-shadow .14s, background .3s;
}
.key:not(:disabled):hover { filter: brightness(1.04); }
.white-key:not(:disabled):active, .white-key.is-down { transform: translateY(2px); box-shadow: inset 0 -3px 0 #d6c9ad, inset 0 -4px 0 #fffaf0, inset 0 12px 14px -10px rgba(0, 0, 0, .45), 0 1px 0 #29242f; }
.black-key:not(:disabled):active, .black-key.is-down { transform: translateY(2px); box-shadow: inset 0 -4px 0 #0a090d, inset 1.5px 0 0 rgba(255, 255, 255, .08), 1px 2px 3px rgba(0, 0, 0, .6); }
.keyboard button:disabled { opacity: 1; }
.white-key.target { background: linear-gradient(180deg, #e7c77f 0%, #fbe6b2 12%, #f6d892 75%, #e7c07a 100%); color: #5a3d0e; box-shadow: inset 0 -7px 0 #c9a45d, 0 0 26px 3px rgba(248, 210, 130, .5); animation: key-call 1.6s ease-in-out infinite; }
.black-key.target { background: linear-gradient(180deg, #7a5a22 0%, #c99a48 80%, #e7bf72 88%, #8c6828 100%); color: #fff3d6; box-shadow: inset 0 -9px 0 #5e4517, 0 0 22px 3px rgba(248, 210, 130, .5); animation: key-call 1.6s ease-in-out infinite; }
.white-key.pressed { background: linear-gradient(180deg, #a9dfc6 0%, #dff6ea 12%, #c6eeda 75%, #9fd9bd 100%); color: #12553f; transform: translateY(2px); animation: key-right .9s var(--ease-out) both; }
.black-key.pressed { background: linear-gradient(180deg, #13513f 0%, #2b8f6f 85%, #48b38f 90%, #1a5e49 100%); color: #e8fff5; transform: translateY(2px); animation: key-right .9s var(--ease-out) both; }
.key.wrong { background: linear-gradient(180deg, #e5a088 0%, #f8c7b4 12%, #f2b39d 75%, #df967c 100%); color: #6b2412; animation: key-wrong .55s var(--ease-out) both; }
.black-key.wrong { background: linear-gradient(180deg, #5d1d10 0%, #b4482c 85%, #d0674a 90%, #6d2615 100%); color: #ffe7de; }
.keyboard-foot { margin: 10px 0 0; text-align: center; font-size: 12px; line-height: 1.6; color: var(--text-faint); }
.keyboard-foot::before { content: ''; display: inline-block; width: 14px; height: 3px; margin: 0 8px 2px 0; border-radius: 3px; background: var(--green-line); box-shadow: 0 0 8px rgba(98, 211, 155, .7); vertical-align: middle; }
.practice-column > .keyboard-foot::before { display: none; }
@media (min-width: 701px) {
  /* Slimmer, real-piano proportions for the two-octave desktop keybed. */
  .black-key[style*="width:6.1%"] { width: 4% !important; margin-left: 1.05%; }
}

/* Microphone console */
.microphone-bar {
  display: flex; align-items: center; gap: 16px; max-width: 960px; margin-top: 18px; padding: 14px 16px 14px 14px;
  border: 1px solid var(--hair); border-radius: 18px; background: rgba(22, 22, 34, .74);
  font-size: 13px; line-height: 1.6; color: var(--text-soft);
}
.microphone-bar > svg {
  width: 44px; height: 44px; flex-shrink: 0; padding: 11px; border-radius: 50%;
  color: var(--gold); background: radial-gradient(circle, rgba(226, 184, 102, .14), rgba(226, 184, 102, .02)); box-shadow: inset 0 0 0 1px var(--hair-2);
}
.microphone-bar.is-listening > svg { color: #1b1408; background: var(--gold-grad); box-shadow: 0 0 0 6px rgba(226, 184, 102, .12), 0 0 24px rgba(226, 184, 102, .4); transform: scale(calc(1 + var(--level, 0) * .14)); animation: mic-breathe 2.8s ease-in-out infinite; transition: transform .12s; }
.microphone-bar p { margin: 0; min-width: 0; }
.microphone-bar strong { color: var(--text); font-weight: 600; }
.microphone-bar button { margin-left: auto; white-space: nowrap; }
#heard-note { color: var(--gold-hi); font-variant-numeric: tabular-nums; }
#heard-note, #debug-status { overflow-wrap: anywhere; }
#debug-status { font-size: 12px; color: var(--text-faint); }
.debug-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; max-width: 960px; padding: 10px 4px; font-size: 12px; color: var(--text-faint); }
.error-note { max-width: 960px; margin: 14px 0 0; padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(243, 144, 115, .35); background: rgba(243, 144, 115, .08); color: #ffc8b6; font-size: 13px; line-height: 1.7; animation: rise .6s var(--ease-out) both; }

/* Programme ribbon (today's practice) */
.side-panel { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; max-width: 960px; width: 100%; margin: 0 auto; }
.side-box {
  position: relative; min-width: 0; padding: 26px 28px;
  border: 1px solid var(--hair); border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 246, 225, .055) 0%, rgba(255, 246, 225, .015) 100%), rgba(13, 14, 23, .62);
  overflow: hidden;
}
.side-box h2 { margin: 0 0 18px; font-size: 10.5px; font-weight: 600; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); }
.side-box:first-child { display: grid; grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: auto repeat(3, auto) auto; column-gap: 28px; align-items: center; }
.side-box:first-child > h2 { grid-column: 1 / -1; grid-row: 1; }
.side-box:first-child > .goal-ring { grid-column: 1; grid-row: 2 / 5; }
.side-box:first-child > .stat-row { grid-column: 2; }
.side-box:first-child > .goal-text { grid-column: 1 / -1; grid-row: 5; }
.side-box:first-child > .divider { display: none; }
.goal-ring { position: relative; width: 128px; height: 128px; }
.goal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.goal-ring circle { fill: none; stroke: rgba(226, 190, 128, .12); stroke-width: 5; }
.goal-ring .ring-value { stroke: var(--gold); stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(248, 210, 130, .6)); transition: stroke-dashoffset 1.6s var(--ease-out); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label strong { font-family: var(--display); font-weight: 400; font-size: 36px; line-height: 1; color: var(--text); }
.ring-label strong span { color: var(--text-faint) !important; font-size: 18px !important; font-family: var(--display) !important; }
.ring-label > span { max-width: 74px; margin-top: 6px; font-size: 8px; font-weight: 600; line-height: 1.35; letter-spacing: .16em; text-align: center; text-transform: uppercase; color: var(--text-faint); }
.goal-text { margin: 18px 0 0; font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--text-soft); }
.divider { border: 0; height: 1px; background: var(--hair); margin: 16px 0; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13px; color: var(--text-soft); border-bottom: 1px solid rgba(226, 190, 128, .08); }
.stat-row:last-of-type { border-bottom: 0; }
.stat-row strong { font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--text); }
.mini-dot { display: inline-block; width: 7px; height: 7px; margin-right: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(226, 184, 102, .7); vertical-align: 1px; }
.mini-dot.blue { background: var(--verdigris); box-shadow: 0 0 8px rgba(116, 216, 176, .7); }
.mini-dot.gray { background: #b7a6d6; box-shadow: 0 0 8px rgba(183, 166, 214, .6); }
.method-box { display: flex; flex-direction: column; justify-content: center; }
.method-head { display: flex; align-items: center; gap: 12px; }
.tip-star { font-size: 26px; line-height: 1; color: var(--gold); display: inline-block; animation: spin-slow 18s linear infinite; }
.method-head strong { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.15; color: var(--text); }
.method-box p { margin: 14px 0 16px; font-family: var(--serif); font-style: italic; font-size: 15px; line-height: 1.7; color: var(--text-soft); }
.method-box .text-button { align-self: flex-start; }

/* ───────────── Buttons ───────────── */
.primary, .secondary, .danger-button, .text-button, .google-button { position: relative; overflow: hidden; }
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 13px 26px; border: 0; border-radius: 999px;
  background: var(--gold-grad); color: #1c1407;
  font-size: 14px; font-weight: 600; letter-spacing: .03em; text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 -2px 0 rgba(120, 80, 20, .25) inset, 0 14px 34px -14px rgba(226, 184, 102, .8);
  transition: transform .35s var(--ease-spring), box-shadow .35s, filter .35s;
}
.primary::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-150%) skewX(-20deg); animation: sheen 5.5s ease-in-out 2s infinite;
}
.primary svg { width: 18px; height: 18px; transition: transform .4s var(--ease-spring); }
.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 -2px 0 rgba(120, 80, 20, .25) inset, 0 20px 44px -14px rgba(226, 184, 102, .95); }
.primary:hover:not(:disabled) svg { transform: translateX(4px); }
.primary:active:not(:disabled) { transform: translateY(0) scale(.98); }
.primary:disabled { filter: grayscale(.5) brightness(.8); }
.practice-card .primary {
  background: linear-gradient(180deg, #2a2733 0%, #121018 100%); color: var(--gold-hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 1px rgba(226, 184, 102, .35), 0 16px 30px -14px rgba(20, 14, 6, .7);
}
.practice-card .primary::before { background: linear-gradient(100deg, transparent, rgba(255, 226, 160, .28), transparent); }
.practice-card .primary:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 1px rgba(226, 184, 102, .6), 0 22px 36px -14px rgba(20, 14, 6, .8); }
.start-overlay .primary { min-width: 260px; min-height: 54px; font-size: 15px; }
.secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border: 1px solid var(--hair-2); border-radius: 999px;
  background: var(--glass); color: var(--text); font-size: 13px; font-weight: 600; letter-spacing: .02em; text-decoration: none;
  transition: background .3s, border-color .3s, transform .35s var(--ease-spring), color .3s;
}
.secondary:hover:not(:disabled) { background: var(--glass-3); border-color: rgba(248, 226, 170, .55); transform: translateY(-1px); }
.secondary:disabled { opacity: .5; }
.practice-card .secondary { color: var(--ink); border-color: rgba(120, 90, 40, .3); background: rgba(255, 255, 255, .4); }
.text-button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 10px; margin: 0 -10px;
  border: 0; border-radius: 999px; background: none; color: var(--gold); font-size: 13px; font-weight: 600;
  transition: color .3s, background .3s;
}
.text-button svg { width: 17px; height: 17px; transition: transform .45s var(--ease-spring); }
.text-button:hover:not(:disabled) { background: var(--glass-2); color: var(--gold-hi); }
.text-button:hover:not(:disabled) svg { transform: scale(1.15) rotate(-6deg); }
.text-button:disabled { opacity: .4; }
.practice-card .text-button { color: var(--fg-soft); margin: 0; }
.practice-card .text-button:hover:not(:disabled) { color: var(--ink); background: rgba(120, 90, 40, .08); }
.danger-button {
  min-height: 44px; padding: 10px 20px; border: 1px solid rgba(243, 144, 115, .4); border-radius: 999px;
  background: rgba(243, 144, 115, .06); color: var(--ember); font-size: 13px; font-weight: 600;
  transition: background .3s, border-color .3s;
}
.danger-button:hover { background: rgba(243, 144, 115, .14); border-color: var(--ember); }
.button-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.ink-ripple {
  position: absolute; z-index: 0; border-radius: 50%; pointer-events: none;
  transform: translate(-50%, -50%) scale(0); background: radial-gradient(circle, rgba(255, 240, 200, .45) 0%, rgba(255, 240, 200, 0) 70%);
  animation: ripple .75s var(--ease-out) forwards;
}
.key .ink-ripple { background: radial-gradient(circle, rgba(226, 184, 102, .5) 0%, rgba(226, 184, 102, 0) 70%); }

/* ───────────── Programme pages ───────────── */
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 30px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.metric { position: relative; padding: 30px 24px 26px; text-align: center; transition: background .5s; }
.metric + .metric::before { content: ''; position: absolute; left: 0; top: 22%; bottom: 22%; width: 1px; background: linear-gradient(transparent, var(--hair-2), transparent); }
.metric:hover { background: radial-gradient(80% 90% at 50% 100%, rgba(226, 184, 102, .09), transparent 70%); }
.metric strong { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(42px, 5.2vw, 64px); line-height: 1; color: var(--text); font-variant-numeric: lining-nums; }
.metric span { display: block; margin-top: 12px; font-size: 10.5px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--text-faint); }
.page-card {
  position: relative; margin: 0 0 24px; padding: 32px 34px;
  border: 1px solid var(--hair); border-radius: 26px;
  background: linear-gradient(165deg, rgba(255, 246, 225, .05) 0%, rgba(255, 246, 225, .012) 100%), rgba(13, 14, 23, .62);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, .8);
}
.page-card::before { content: ''; position: absolute; left: 34px; right: 34px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(248, 226, 170, .45), transparent); }
.page-card h2 { margin: 0 0 8px; font-family: var(--display); font-weight: 400; font-size: clamp(26px, 3vw, 34px); line-height: 1.15; color: var(--text); }
.page-card > p, .page-card p { font-size: 14px; line-height: 1.75; color: var(--text-soft); }
.page-card h3 { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 19px; color: var(--text); }
.muted { color: var(--text-faint); }

.week-chart {
  display: flex; align-items: flex-end; gap: clamp(8px, 2vw, 22px); height: 176px; margin-top: 28px; padding: 0 4px;
  background: linear-gradient(90deg, transparent, var(--hair-2) 15%, var(--hair-2) 85%, transparent) no-repeat left 0 bottom 24px / 100% 1px;
}
.day-column { display: flex; flex: 1 1 0; min-width: 0; height: 100%; flex-direction: column; align-items: center; justify-content: flex-end; gap: 10px; font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--text-faint); }
.day-column > span:last-child { line-height: 14px; }
.day-count { font-family: var(--display); font-size: 20px; letter-spacing: 0; font-weight: 400; color: var(--text-soft); }
.day-bar {
  position: relative; width: 100%; max-width: 30px; min-height: 3px; border-radius: 30px 30px 3px 3px;
  background: linear-gradient(180deg, #fbe2a8 0%, #d8a650 40%, rgba(158, 118, 55, .25) 100%);
  box-shadow: 0 0 22px -4px rgba(248, 210, 130, .55);
  transform-origin: 50% 100%;
}
.day-bar::before {
  content: ''; position: absolute; left: 50%; top: -11px; width: 8px; height: 12px; margin-left: -4px; border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  background: radial-gradient(circle at 50% 70%, #fff6dc 0%, #ffd27a 45%, rgba(255, 150, 60, 0) 75%);
  opacity: .9; transform-origin: 50% 100%; animation: flicker 2.2s ease-in-out infinite;
}
.day-column:nth-child(2n) .day-bar::before { animation-delay: -.7s; }
.day-bar[style^="height:3px"] { background: rgba(226, 190, 128, .18); box-shadow: none; }
.day-bar[style^="height:3px"]::before { display: none; }
.day-column:nth-child(3n) .day-bar::before { animation-delay: -1.3s; }
.day-column:last-child .day-count { color: var(--gold-hi); }
.day-column:last-child { color: var(--gold); }

.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; margin: 18px -8px 0; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; white-space: nowrap; }
th { padding: 12px 14px; font-size: 10px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--hair-2); }
td { padding: 15px 14px; color: var(--text-soft); border-bottom: 1px solid rgba(226, 190, 128, .08); transition: background .3s, color .3s; }
td strong { font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--text); }
tbody tr { transition: background .3s; }
tbody tr:hover td { background: rgba(255, 246, 225, .035); color: var(--text); }
tbody tr:last-child td { border-bottom: 0; }
td .text-button { margin: 0; width: 38px; height: 38px; justify-content: center; padding: 0; border: 1px solid var(--hair-2); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .04em; background: rgba(116, 216, 176, .1); color: var(--verdigris); box-shadow: inset 0 0 0 1px rgba(116, 216, 176, .25); }
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pill.learning { background: rgba(226, 184, 102, .1); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(226, 184, 102, .28); }
.pill.new { background: rgba(255, 255, 255, .04); color: var(--text-faint); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.pill.new::before { box-shadow: none; }
.empty-state { padding: 40px 20px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.6; color: var(--text-soft); }
.empty-state a { font-family: var(--sans); font-style: normal; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--hair-2); padding-bottom: 2px; }
.library-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.library-tools select { width: auto; min-width: 220px; max-width: 100%; }
.library-tools .muted { font-size: 12px !important; letter-spacing: .14em; text-transform: uppercase; }

/* Forms */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.settings-grid .page-card { margin-bottom: 0; }
#settings-form > .primary { margin-top: 26px; }
.field { margin: 24px 0; }
.field label { display: block; margin-bottom: 10px; font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.field small { display: block; margin-top: 9px; font-size: 13px; line-height: 1.65; color: var(--text-faint); }
.field .text-button { color: var(--gold); }
select, input[type="number"], input[type="text"], input[type="email"] {
  width: 100%; min-height: 50px; padding: 12px 16px; border: 1px solid var(--hair-2); border-radius: 14px;
  background-color: rgba(6, 7, 13, .55); color: var(--text); font-size: 15px;
  transition: border-color .3s, box-shadow .4s, background-color .3s;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23e2b866' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
select option { background: var(--night-2); color: var(--text); }
select:hover, input:hover { border-color: rgba(248, 226, 170, .5); }
select:focus, input[type="number"]:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(226, 184, 102, .14), 0 0 30px -6px rgba(226, 184, 102, .4); background-color: rgba(6, 7, 13, .75); }
.check-row { display: flex; align-items: center; gap: 14px; min-height: 44px; font-size: 14px; line-height: 1.6; color: var(--text); cursor: pointer; }
.check-row input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; position: relative; flex-shrink: 0; width: 44px; height: 26px; margin: 0;
  border-radius: 999px; border: 1px solid var(--hair-2); background: rgba(6, 7, 13, .6); cursor: pointer;
  transition: background .4s, border-color .4s;
}
.check-row input[type="checkbox"]::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-faint); transition: transform .45s var(--ease-spring), background .4s, box-shadow .4s;
}
.check-row input[type="checkbox"]:checked { background: rgba(226, 184, 102, .22); border-color: var(--gold); }
.check-row input[type="checkbox"]:checked::after { transform: translateX(18px); background: var(--gold-hi); box-shadow: 0 0 12px rgba(248, 210, 130, .8); }
.settings-note { padding: 14px 16px; border-radius: 14px; background: var(--glass-2); font-size: 13px; line-height: 1.7; color: var(--text-soft); }
.privacy-copy { font-size: 13px; line-height: 1.8; color: var(--text-soft); }
details { margin-top: 20px; font-size: 13px; color: var(--text-soft); }
.page-card > details { margin: 0; padding: 8px 0; }
.page-card > details + details { border-top: 1px solid var(--hair); }
.page-card > details > p { margin: 4px 0 14px 34px; }
.page-card > details > .button-row { margin: 0 0 14px 34px; }
summary { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--gold); }
summary::-webkit-details-marker { display: none; }
summary::before { content: '+'; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--hair-2); font-weight: 400; transition: transform .45s var(--ease-spring); }
details[open] > summary::before { transform: rotate(135deg); }
details[open] > :not(summary) { animation: rise .55s var(--ease-out) both; }
details p { font-size: 13px; line-height: 1.85; }
.backup-options { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--hair); }
.page-card > .backup-options:first-child { margin-top: 0; padding-top: 8px; border-top: 0; }
.backup-options .button-row { justify-content: flex-start; margin-top: 14px; }
#settings-status { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 20px; margin: 22px 0 0; padding: 0; background: none; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--verdigris); }
#settings-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; animation: mic-breathe 2.4s ease-in-out infinite; }

/* ───────────── Dialogs ───────────── */
dialog {
  width: min(560px, calc(100% - 28px)); max-height: min(86dvh, 900px); padding: 42px 38px 34px;
  border: 1px solid var(--hair-2); border-radius: 28px; color: var(--text);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(226, 184, 102, .1) 0%, rgba(226, 184, 102, 0) 60%),
    linear-gradient(180deg, #171826 0%, #0d0e18 100%);
  box-shadow: 0 0 0 6px rgba(10, 11, 20, .6), 0 0 0 7px rgba(226, 184, 102, .12), 0 50px 120px -20px rgba(0, 0, 0, .9);
  opacity: 0; transform: translateY(28px) scale(.96);
  transition: opacity .35s var(--ease-out), transform .55s var(--ease-spring), overlay .4s allow-discrete, display .4s allow-discrete;
}
dialog[open] { opacity: 1; transform: none; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(28px) scale(.96); } }
dialog::backdrop { background-color: rgba(3, 3, 8, 0); transition: background-color .4s, overlay .4s allow-discrete, display .4s allow-discrete; }
dialog[open]::backdrop { background-color: rgba(3, 3, 8, .74); }
@starting-style { dialog[open]::backdrop { background-color: rgba(3, 3, 8, 0); } }
.modal-close {
  position: absolute; right: 16px; top: 16px; z-index: 2; display: grid; place-items: center; width: 42px; height: 42px; padding: 0 0 3px;
  border: 1px solid var(--hair); border-radius: 50%; background: var(--glass); color: var(--text-soft); font-size: 24px; font-weight: 300; line-height: 1;
  transition: transform .5s var(--ease-spring), color .3s, border-color .3s;
}
.modal-close:hover { transform: rotate(90deg); color: var(--gold-hi); border-color: var(--hair-2); }
#modal-body > * { animation: rise .6s var(--ease-out) both; }
#modal-body > *:nth-child(2) { animation-delay: .05s; } #modal-body > *:nth-child(3) { animation-delay: .1s; } #modal-body > *:nth-child(4) { animation-delay: .15s; } #modal-body > *:nth-child(5) { animation-delay: .2s; } #modal-body > *:nth-child(n+6) { animation-delay: .25s; }
.modal-title { margin: 10px 40px 14px 0; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 5vw, 40px); line-height: 1.08; color: var(--text); }
.modal-copy { font-size: 14px; line-height: 1.8; color: var(--text-soft); }
dialog .eyebrow::before { display: none; }
dialog .eyebrow { justify-content: flex-start; }
dialog .button-row { justify-content: flex-start; margin-top: 8px; }
.how-steps { list-style: none; padding: 0; margin: 26px 0; counter-reset: steps; }
.how-steps li { position: relative; counter-increment: steps; padding: 0 0 22px 62px; font-size: 14px; line-height: 1.75; color: var(--text-soft); animation: rise .7s var(--ease-out) both; }
.how-steps li:nth-child(2) { animation-delay: .12s; } .how-steps li:nth-child(3) { animation-delay: .24s; }
.how-steps li::before { content: counter(steps, upper-roman); position: absolute; left: 0; top: -4px; width: 44px; text-align: center; font-family: var(--display); font-style: italic; font-size: 30px; line-height: 1; color: var(--gold); }
.how-steps li::after { content: ''; position: absolute; left: 22px; top: 34px; bottom: 6px; width: 1px; background: linear-gradient(var(--hair-2), transparent); }
.how-steps li:last-child::after { display: none; }
.how-steps strong { display: block; margin-bottom: 2px; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 18px; color: var(--text); }

/* Octave guide */
.octave-guide { min-width: 0; font-size: 14px; line-height: 1.65; color: var(--text-soft); }
.octave-guide .modal-title { margin-right: 44px; }
.octave-guide p { margin: 0 0 14px; }
.octave-guide strong { color: var(--text); font-weight: 600; }
.octave-guide h3 { margin: 26px 0 8px; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 19px; color: var(--text); }
.octave-start { display: grid; gap: 4px; margin: 20px 0; padding: 16px 18px; border-radius: 16px; border: 1px solid rgba(226, 184, 102, .35); background: linear-gradient(135deg, rgba(226, 184, 102, .12), rgba(226, 184, 102, .03)); }
.octave-start strong { color: var(--gold-hi); }
.octave-start span { font-size: 13px; }
.octave-diagram { margin: 0; }
.octave-directions { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; letter-spacing: .06em; color: var(--text-faint); }
.octave-pair-label { width: 37.5%; margin: 12px 0 5px; text-align: center; font-size: 12px; color: var(--gold); }
.octave-piano { position: relative; display: flex; height: 120px; padding-top: 5px; border-radius: 6px 6px 10px 10px; background: #050407; overflow: hidden; box-shadow: 0 16px 30px -16px rgba(0, 0, 0, .9); }
.octave-piano::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; z-index: 3; background: linear-gradient(180deg, #a0303f, var(--felt)); }
.octave-white-key { display: flex; flex: 1 1 0; min-width: 0; align-items: flex-end; justify-content: center; margin-right: 1px; padding-bottom: 10px; border-radius: 0 0 5px 5px; background: linear-gradient(180deg, #e8dfcb 0%, #fbf6ea 10%, #efe5cf 100%); box-shadow: inset 0 -5px 0 #d6c9ad; color: var(--ink); font-size: 15px; font-weight: 700; }
.octave-white-key:last-child { margin-right: 0; }
.octave-anchor-key { background: linear-gradient(180deg, #e7c77f 0%, #fbe6b2 12%, #f0cf86 100%); box-shadow: inset 0 -5px 0 #c9a45d; animation: key-call 1.8s ease-in-out infinite; }
.octave-black-key { position: absolute; top: 5px; z-index: 2; width: 7.4%; height: 62%; border-radius: 0 0 4px 4px; background: linear-gradient(180deg, #121118 0%, #2a2833 85%, #18161e 100%); box-shadow: inset 0 -6px 0 #0a090d, 2px 4px 6px rgba(0, 0, 0, .5); }
.octave-diagram-labels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; font-size: 13px; }
.octave-diagram-labels > span { display: grid; align-content: start; }
.octave-diagram-labels > span:last-child { text-align: right; }
.octave-sounds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.octave-listen {
  position: relative; overflow: hidden; display: grid; align-content: start; gap: 4px; min-height: 78px; padding: 13px 14px;
  border: 1px solid var(--hair); border-radius: 16px; background: var(--glass); color: var(--text-soft);
  font-size: 13px; line-height: 1.4; text-align: left;
  transition: border-color .3s, background .3s, transform .4s var(--ease-spring);
}
.octave-listen:hover { border-color: rgba(248, 226, 170, .5); background: var(--glass-2); transform: translateY(-2px); }
.octave-listen:active { transform: scale(.98); }
.octave-listen-current { border-color: rgba(226, 184, 102, .55); background: linear-gradient(135deg, rgba(226, 184, 102, .14), rgba(226, 184, 102, .03)); }
.octave-listen-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.octave-listen-top strong { font-family: var(--display); font-weight: 400; font-size: 22px; }
.octave-listen-top svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--gold); }
.octave-guide .octave-reminder { margin: 18px 0 20px; font-family: var(--serif); font-style: italic; font-size: 15px; }
.octave-done { width: 100%; }

/* Account */
.account-panel { margin-top: 0; }
dialog:has(.saving-choices) { width: min(660px, calc(100% - 28px)); }
.account-note a, .account-panel a { color: var(--gold); text-underline-offset: 3px; text-decoration-color: var(--hair-2); }
.account-panel > h2 { margin: 6px 44px 10px 0; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 5vw, 38px); line-height: 1.1; color: var(--text); }
.account-panel > p, .saving-choice p { font-size: 14px; line-height: 1.7; color: var(--text-soft); }
.saving-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 22px 0 6px; }
.saving-choice {
  display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 22px 20px;
  border: 1px solid var(--hair); border-radius: 20px; background: var(--glass);
  transition: border-color .4s, transform .5s var(--ease-spring), background .4s;
}
.saving-choice:hover { transform: translateY(-3px); border-color: var(--hair-2); }
.saving-choice.is-selected { border-color: rgba(226, 184, 102, .55); background: linear-gradient(160deg, rgba(226, 184, 102, .12), rgba(226, 184, 102, .02)); }
.saving-choice h3 { margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 19px; color: var(--text); }
.saving-choice p { margin: 0 0 8px; }
.saving-choice .secondary, .saving-choice .google-button { width: 100%; margin-top: auto; }
.choice-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--gold); background: rgba(226, 184, 102, .1); box-shadow: inset 0 0 0 1px var(--hair-2); }
.choice-icon svg { width: 20px; height: 20px; }
.google-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 10px 16px;
  border: 1px solid #dadce0; border-radius: 999px; background: #fff; color: #1f1f1f; font-size: 14px; font-weight: 600;
  transition: transform .35s var(--ease-spring), box-shadow .35s;
}
.google-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px -14px rgba(255, 255, 255, .5); }
.google-button svg { width: 18px; height: 18px; flex: 0 0 18px; }
.google-button:disabled { opacity: .55; }
.account-state { display: flex; align-items: center; gap: 14px; margin: 20px 0; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--hair); background: var(--glass); overflow-wrap: anywhere; }
.account-initial { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; background: var(--gold-grad); color: #1c1407; font-family: var(--display); font-size: 22px; }
.account-state strong { display: block; font-size: 15px; color: var(--text); }
.account-state small { display: block; margin-top: 4px; font-size: 12px; color: var(--text-faint); }
.account-message { padding: 13px 16px; border-radius: 14px; border: 1px solid rgba(243, 144, 115, .3); background: rgba(243, 144, 115, .08); color: #ffcdbb; font-size: 13px; line-height: 1.65; }
.account-note { margin: 14px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--text-faint); }
.account-panel .button-row { justify-content: flex-start; }
.account-conflict { margin: 16px 0; padding: 18px; border-radius: 18px; border: 1px solid rgba(226, 184, 102, .35); background: rgba(226, 184, 102, .06); }
.account-conflict h3 { margin: 0 0 8px; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 18px; color: var(--text); }
.account-conflict p { font-size: 13px; line-height: 1.7; color: var(--text-soft); }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; max-width: calc(100% - 32px); overflow: hidden;
  padding: 15px 24px; border: 1px solid var(--hair-2); border-radius: 999px;
  background: rgba(18, 19, 31, .97);
  box-shadow: 0 20px 50px -16px rgba(0, 0, 0, .9), 0 0 40px -20px rgba(226, 184, 102, .6);
  color: var(--text); font-size: 14px; text-align: center;
  opacity: 0; pointer-events: none; transform: translate(-50%, 30px) scale(.94);
  transition: opacity .35s var(--ease-out), transform .6s var(--ease-spring);
}
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#toast::after { content: ''; position: absolute; left: 24px; right: 24px; bottom: 0; height: 2px; border-radius: 2px; background: var(--gold-grad); transform-origin: 0 50%; transform: scaleX(0); }
#toast.show::after { animation: toast-timer 4.2s linear forwards; }
#toast.is-fresh::after { animation: none; }

/* ───────────── Effects layer ───────────── */
.fx-layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden; }
.fx-ring { position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; border: 2px solid var(--c, var(--gold)); opacity: 0; animation: fx-ring 1.2s var(--ease-out) var(--delay, 0s) forwards; }
.fx-spark { position: absolute; width: var(--s, 6px); height: var(--s, 6px); margin: calc(var(--s, 6px) / -2) 0 0 calc(var(--s, 6px) / -2); border-radius: 50%; background: radial-gradient(circle, #fffbe9 0%, var(--c, #f2c76e) 45%, rgba(242, 199, 110, 0) 72%); animation: fx-burst var(--d, 1.1s) var(--ease-out) var(--delay, 0s) forwards; }
.fx-glyph { position: absolute; font-family: PianoRecallNotation; font-size: var(--size, 26px); line-height: 1; color: var(--c, var(--gold)); text-shadow: 0 0 12px rgba(248, 210, 130, .6); transform: translate(-50%, -50%); animation: fx-burst var(--d, 1.4s) var(--ease-out) var(--delay, 0s) forwards; }
.fx-confetti { position: absolute; font-family: PianoRecallNotation; font-size: var(--size, 24px); line-height: 1; color: var(--c, var(--gold)); text-shadow: 0 0 10px rgba(248, 210, 130, .5); animation: fx-fall var(--d, 3s) cubic-bezier(.3, .4, .5, 1) var(--delay, 0s) forwards; }

/* Choreography hooks (classes added by motion.js) */
.enter { animation: rise .9s var(--ease-out) calc(var(--enter, 0) * 75ms) both; }
.reveal-pending { opacity: 0; transform: translateY(26px); }
/* New note: staff, clef and note all ink in together, settled within ~0.55s. */
.ink-in .staff-svg > g:first-of-type line, .staff-svg.ink-in > g:first-of-type line { animation: ink-line .5s var(--ease-out) both; }
.staff-svg.ink-in > g:first-of-type line:nth-child(2) { animation-delay: .025s; } .staff-svg.ink-in > g:first-of-type line:nth-child(3) { animation-delay: .05s; } .staff-svg.ink-in > g:first-of-type line:nth-child(4) { animation-delay: .075s; } .staff-svg.ink-in > g:first-of-type line:nth-child(5) { animation-delay: .1s; } .staff-svg.ink-in > g:first-of-type line:nth-child(n+6) { animation-delay: .05s; animation-duration: .3s; }
.staff-svg.ink-in > text.music-glyph { transform-box: fill-box; transform-origin: 50% 60%; animation: clef-bloom .45s var(--ease-out) both; }
.staff-svg.ink-in .music-glyph[x="260"] { animation: note-drop .5s var(--ease-spring) both; }
.staff-svg.ink-in g[fill] .music-glyph:not([x="260"]) { transform-box: fill-box; transform-origin: 50% 50%; animation: pop-in .35s var(--ease-spring) .05s both; }
.staff-svg.ink-in > line { animation: stem-grow .3s var(--ease-out) .08s both; transform-box: fill-box; transform-origin: 50% 100%; }
.title-in { animation: title-in .45s var(--ease-out) both; }
.practice-card.is-celebrating::after { animation: glow-pulse 1.1s var(--ease-out); }
.practice-card.is-stumbling { animation: card-stumble .6s var(--ease-out); }
.practice-card.is-resting { animation: card-rest .7s var(--ease-out); }
.summary-card.enter-summary { animation: summary-in 1.1s var(--ease-spring) both; }
.week-chart.grow .day-bar { animation: bar-grow 1.2s var(--ease-spring) calc(var(--i, 0) * 80ms + 200ms) both; }
.week-chart.grow .day-count { animation: rise .7s var(--ease-out) calc(var(--i, 0) * 80ms + 700ms) both; }
tr.row-in { animation: row-in .6s var(--ease-out) calc(var(--r, 0) * 40ms) both; }
.metric.enter strong { animation: rise .9s var(--ease-out) calc(var(--enter, 0) * 75ms + 100ms) both; }

/* ───────────── Keyframes ───────────── */
@keyframes drift-a { to { transform: translate(18vmax, 12vmax) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-16vmax, 10vmax) scale(.9); } }
@keyframes drift-c { to { transform: translate(-10vmax, -14vmax) scale(1.2); } }
@keyframes spot-breathe { 50% { opacity: .72; transform: translateX(-50%) scaleX(1.06); } }
@keyframes mote-rise { 0% { opacity: 0; transform: translate(0, 0); } 12% { opacity: var(--o, .6); } 50% { transform: translate(var(--sway, 30px), -55vh); } 88% { opacity: var(--o, .6); } 100% { opacity: 0; transform: translate(calc(var(--sway, 30px) * -.6), -112vh); } }
@keyframes glyph-rise { 0% { opacity: 0; transform: translate(0, 0) rotate(var(--rot, 0deg)); } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--sway, 40px), -125vh) rotate(calc(var(--rot, 0deg) * -1)); } }
@keyframes fade-down { from { opacity: 0; transform: translateY(-16px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes note-wiggle { 0% { transform: rotate(0); } 30% { transform: rotate(-12deg) translateY(-2px); } 60% { transform: rotate(7deg); } 100% { transform: rotate(0); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes word-rise { from { opacity: 0; transform: translateY(.45em) rotate(2deg); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes title-in { from { opacity: 0; transform: translateY(10px); letter-spacing: .04em; filter: blur(4px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); opacity: .95; } 25% { transform: scale(1.06, .94) rotate(-3deg); } 50% { transform: scale(.95, 1.07) rotate(2deg); opacity: .8; } 75% { transform: scale(1.04, .97) rotate(-1deg); } }
@keyframes listen-ring { from { transform: scale(1); opacity: .9; } to { transform: scale(3.4); opacity: 0; } }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
@keyframes mic-breathe { 50% { filter: brightness(1.12); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes ink-line { from { stroke-dashoffset: 440; } to { stroke-dashoffset: 0; } }
@keyframes clef-bloom { from { opacity: 0; transform: scale(.82) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes note-drop { 0% { opacity: 0; transform: translateY(-30px) scale(.7) rotate(-12deg); } 45% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes stem-grow { from { opacity: 0; transform: scaleY(0); } to { opacity: 1; transform: scaleY(1); } }
@keyframes notehead-glow { 50% { filter: drop-shadow(0 0 14px rgba(35, 119, 92, .7)); } }
@keyframes glow-pulse { 30% { opacity: 1; } 100% { opacity: 0; } }
@keyframes card-stumble { 0%, 100% { transform: none; } 15% { transform: translateX(-9px) rotate(-.4deg); } 30% { transform: translateX(7px) rotate(.3deg); } 45% { transform: translateX(-5px); } 60% { transform: translateX(3px); } 75% { transform: translateX(-1px); } }
@keyframes card-rest { from { filter: brightness(1.06); } to { filter: none; } }
@keyframes summary-in { from { opacity: 0; transform: translateY(30px) scale(.95) rotateX(8deg); } to { opacity: 1; transform: none; } }
@keyframes key-call { 50% { filter: brightness(1.14); } }
@keyframes key-right { 0% { filter: brightness(1.5); } 100% { filter: brightness(1); } }
@keyframes key-wrong { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(1px); } }
@keyframes ripple { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
@keyframes bar-grow { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
@keyframes row-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes sheen { 0%, 70% { transform: translateX(-150%) skewX(-20deg); } 100% { transform: translateX(350%) skewX(-20deg); } }
@keyframes fx-ring { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(var(--scale, 6)); } }
@keyframes fx-burst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot, 0deg)); } }
@keyframes fx-fall { 0% { opacity: 0; transform: translate(0, 0) rotate(0); } 10% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--sway, 30px), 105vh) rotate(var(--rot, 180deg)); } }

/* ───────────── Responsive ───────────── */
@media (max-width: 1240px) { .rail { display: none; } }
@media (max-width: 1040px) {
  .marquee { grid-template-columns: 1fr auto; grid-template-rows: 64px auto; height: auto; row-gap: 0; padding-bottom: 8px; }
  .movements { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .marquee-actions { grid-column: 2; grid-row: 1; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3)::before { display: none; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--hair); }
  .side-panel { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  body { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .marquee { grid-template-columns: 1fr auto; grid-template-rows: 62px; height: 62px; padding: 0 12px 0 16px; gap: 10px; }
  .brand { gap: 9px; }
  .brand-mark { width: 34px; height: 34px; }
  .wordmark em { font-size: 23px; }
  .wordmark span { font-size: 7.5px; }
  .movements {
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; justify-self: stretch;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 6px;
    border: 1px solid var(--hair-2); border-radius: 26px;
    background: rgba(13, 14, 24, .96);
    box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .4);
    animation: dock-up .9s var(--ease-spring) .2s both;
  }
  .movements a { flex-direction: column; justify-content: center; gap: 4px; min-height: 58px; padding: 6px 2px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: .03em; }
  .movements a::before { display: none; }
  .movements a > span:first-child { display: flex; }
  .movements a > span:first-child svg { width: 22px; height: 22px; transition: transform .5s var(--ease-spring); }
  .movements a.active > span:first-child svg { transform: translateY(-2px) scale(1.08); }
  .nav-glider { border-radius: 20px; }
  .nav-glider::after { bottom: 3px; width: 16px; margin-left: -8px; }
  .marquee-actions { gap: 4px; }
  .account-button { max-width: 128px; min-height: 44px; padding: 8px 14px; font-size: 12px; overflow: hidden; }
  .quiet-label { display: none; }
  .quiet-button { width: 44px; height: 44px; justify-content: center; padding: 0; }
  .text-button { min-height: 44px; }
  td .text-button { width: 44px; height: 44px; }
  main { padding: 0 14px; }
  #view { padding: 26px 0 20px; min-height: calc(100dvh - 200px); }
  .intro-row { margin-bottom: 26px; }
  .intro-row h1 { font-size: clamp(36px, 11vw, 48px); margin: 12px 0 10px; }
  body[data-page="practice"] .intro-row h1 { font-size: clamp(34px, 10vw, 44px); }
  .intro-row p { font-size: 15px; }
  .eyebrow { font-size: 9.5px; letter-spacing: .3em; gap: 10px; }
  .eyebrow::before, .eyebrow::after { width: 20px; }
  .streak { margin-top: 14px; }
  .session-strip { font-size: 10px; letter-spacing: .16em; }
  .beginner-note { padding: 12px 10px 12px 18px; gap: 10px; }
  .beginner-note p { font-size: 12px; }
  .beginner-note strong { font-size: 15px; }
  .card-topline { padding-top: 26px; }
  .music-space { padding: 4px 10px 0; }
  .prompt-subtitle { font-size: 15px; }
  .staff-svg { height: 180px; margin-bottom: -10px; }
  .card-response { padding: 0 14px; font-size: 13px; }
  .start-overlay { padding: 0 16px 26px; }
  .start-overlay .primary { width: 100%; min-width: 0; }
  .card-actions { margin: 0 6px 6px; padding: 8px 10px; }
  .keyboard-area { margin-top: 22px; padding: 0 10px 10px; border-radius: 18px 18px 14px 14px; }
  .keyboard-head { padding: 12px 4px 10px; }
  .keyboard-head strong { font-size: 14px; }
  .keyboard-head > span { font-size: 8.5px; letter-spacing: .2em; }
  .keyboard { height: 150px; min-width: 0; }
  .white-key { font-size: 12px; padding-bottom: 13px; }
  .white-key small { font-size: 11px; max-width: 40px; }
  .microphone-bar { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px 14px; padding: 14px; font-size: 13px; }
  .microphone-bar > button { grid-column: 1 / -1; width: 100%; margin: 0; }
  .side-box { padding: 22px 20px; }
  .side-box:first-child { grid-template-columns: 104px minmax(0, 1fr); column-gap: 18px; }
  .goal-ring { width: 104px; height: 104px; }
  .ring-label strong { font-size: 30px; }
  .metric { padding: 24px 12px 20px; }
  .metric span { font-size: 9.5px; letter-spacing: .16em; }
  .page-card { padding: 26px 18px; border-radius: 22px; }
  .page-card::before { left: 20px; right: 20px; }
  .week-chart { height: 170px; gap: 8px; }
  .day-column { letter-spacing: .08em; }
  .settings-grid { gap: 16px; }
  select, input[type="number"] { font-size: 16px; min-height: 50px; }
  .check-row { font-size: 15px; }
  .summary-card { min-height: 360px; padding: 46px 18px 32px; }
  .summary-metrics > div { padding: 0 18px; }
  .summary-metrics strong { font-size: 38px; }
  dialog { padding: 34px 20px 24px; border-radius: 24px; max-height: calc(100dvh - 24px); }
  .modal-close { right: 10px; top: 10px; width: 44px; height: 44px; }
  .saving-choices { grid-template-columns: minmax(0, 1fr); }
  .account-panel .button-row > button { flex: 1 1 140px; }
  #toast { bottom: calc(100px + env(safe-area-inset-bottom)); border-radius: 18px; width: max-content; }
  .curtain-call { padding-bottom: 24px; }
}
@media (max-width: 400px) {
  .card-actions .input-chip { font-size: 0; gap: 6px; }
  .card-actions { gap: 4px; }
}
@media (max-width: 370px) {
  main { padding: 0 10px; }
  .wordmark em { font-size: 20px; }
  .wordmark span { letter-spacing: .45em; }
  .brand-mark { width: 30px; height: 30px; }
  .account-button { max-width: 104px; padding: 8px 10px; font-size: 11px; }
  .movements { left: 6px; right: 6px; }
  .side-box:first-child { grid-template-columns: minmax(0, 1fr); }
  .side-box:first-child > .goal-ring { grid-row: auto; margin: 0 auto 10px; }
  .summary-metrics > div { padding: 0 12px; }
  .octave-pair-label { width: 43%; margin-left: -2.5%; }
}
@media (max-width: 700px) and (orientation: landscape) { .staff-svg { height: 150px; } }
@media (hover: none) { .cursor-glow { display: none; } }

@keyframes dock-up { from { opacity: 0; transform: translateY(40px) scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .mote, .drift-glyph, .fx-layer { display: none; }
  .reveal-pending { opacity: 1; transform: none; }
}
