/* Orpheus · css/ma.css
   The components of the Ma design, copied from orpheus-design/09-ma/design.css
   without its Base section (now in style.css) and without the component-sheet
   block (.sys-*). Frozen: only the foundation agent edits this file. Rules the
   app needs beyond the previews go at the end under "App states" or into the
   area files (css/components.css, lesson.css, theory.css, learn.css,
   stats.css, settings.css, auth.css). No literal colour here: all colours are
   tokens from style.css.

   Component classes
   Base ........ (in style.css) .page .grid .display .h2 .h3 .muted .sr .link .sprite .ic .pic .pic--lg .h .here-dot .acc
   Bar ......... .bar .bar__in .bar__brand .mark .brand .chev .nav .nav__list .nav__item .nav__dot
   Footer ...... .footer .footer__in .footer__links .footer__link
   Form ........ .form .form__sheet .form__field .form__label .field__input .field__textarea .field__select .form__status .form__actions
   Prose ....... .prose .credits .credits__item
                 .bar__end .sound .sound--off
   Buttons ..... .btn .btn--primary .btn--secondary .btn--danger .btn--quiet .btn--lg .tool .ctl .ctl__label (.lg .sm) .kbd .dots
   Choices ..... .seg .seg--sm .seg__opt .choices .choices--list .choice .choice--inst .choice__row .choice__radio
                 .choice__title .choice__note .choice__sample .choice__text .swatch .nodeline .toggle .switchrow
                 .sep .sep__pic .sep__track .sep__ticks .ruler .ruler__line .ruler__fill .ruler__zero .ruler__stop
   Lesson ...... .lesson .lesson--keys .lesson__head .lesson__title .lv-id .lv-title .lesson__tools .lesson__status
                 .lesson__count .lesson__stages .progress .p .count .timing .stations .stage-name .context .sepdot
                 .stage .stage--liss .liss .liss--a .liss--b .liss__fig .liss__axis .liss__cap .liss__ic .answer__fig
                 .staff .staff--mini .prompt .prompt--hint .hint .entry .slots .slot .answers .answers--row
                 .answer .answer__name .answer__sub .answer__mark .answer__play .answer__home .piano-wrap .piano
                 .controls .controls__tools .sep-row
   Levels ...... .node .node__mark .node__id (states .is-locked .is-available .is-learning .is-passed .is-mastered
                 .is-review .is-here .is-exam) .page-head .tracklist .track .track__head .track__title .track__id
                 .track__name .track__end .track__count .track__after .track__body .track__sum .levels
                 .levels--locked .module .track__now
   Folds ....... .fold .fold__body .fold--table .table .keys
   Learn ....... .today__meta .today__go .next .next__label .next__lv .plan .plan__stop .plan__dot .plan__name
                 .plan__meta .plan__time .tiles .tile .tile__num .tile__label .tile__pic .sec .sec__head .sec__note
                 .legend .legend__item .legend__dep .map .map--wide .map--narrow
   Stats ....... .heat .heat__scroll .heat__key .heat__today .week .wrow .wrow--head .wrow__lv .wrow__title
                 .wrow__chart .wrow__val .db .db__axis .db__link .db__last .db__now .db__mark .week__key .strip-key
                 .stuck .stuck__lv .stuck__pair .stuck__names .stuck__meter .stuck__act .meter .meter__axis
                 .meter__fill .meter__mark .meter__text .reviews .reviews__cal .reviews__text .lvhead .lvrows .lvrow
                 .lvrow__sum .lvrow__title .lvrow__acc .c-lv .c-title .c-strip .c-acc .c-conds .strip .conds
                 .conds--pics .cond .detail .detail__grid .checks .check .check__val .boxes .inst .confusion .confusion__scroll
                 .pairline .pairbox .slope .slope__key .detail__act .foot
   Settings .... .set .set__h .set__body .field .field__label .field__ctl .field__note .field__note--warn .src
                 .src__name .warnmark .account
   Result ...... .result .result__score .result__bar .result__unmet .result__actions
   Speedrun .... .countin .runclock .runend .runend--fail .runend__line .runend__sub .runend__detail .runend__time
                 .runend__best .runend__facts .runend__save .splits .splits__bar (.is-wrong .is-none) .is-off
   Leaderboard . .nav__ic .nav__word .boardpick .seg--wrap .boards .board .board__h .board__list .board__row .board__rank
                 .board__name .board__time .board__row.is-me .board__me .board__empty
*/

/* ---------- Bar: the six sections, always shown ---------- */
.bar { position: relative; z-index: 20; min-height: var(--bar-h); background: var(--bg); border-bottom: var(--hair) solid var(--rule); }
.bar__in {
  display: flex; align-items: center; gap: var(--s-5); height: var(--bar-h);
  max-width: calc(var(--page-max) + 2 * var(--page-pad)); margin: 0 auto; padding: 0 var(--page-pad);
}
.bar__brand { display: flex; align-items: center; gap: var(--s-3); flex: none; color: var(--fg); }
.mark { width: 20px; height: 20px; flex: none; color: var(--fg); }
.brand { font-size: var(--fs-body); line-height: 20px; font-weight: var(--w-label); letter-spacing: 0.06em; }
.chev { width: 12px; height: 12px; color: var(--muted); flex: none; }
.nav { flex: 1; min-width: 0; padding-left: var(--s-3); border-left: var(--hair) solid var(--rule); }
.nav__list { display: flex; align-items: center; gap: var(--s-1); margin: 0; padding: 0; list-style: none; }
.nav__item {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-width: var(--touch); height: var(--touch); padding: 0 var(--s-2); border-radius: var(--r-1);
  font-size: var(--fs-body); line-height: 20px; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.nav__item:hover { color: var(--fg); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.nav__item.is-here { color: var(--fg); font-weight: var(--w-label); }
.nav__dot { position: absolute; left: 50%; bottom: 1px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--home); }
.bar__end { margin-left: auto; display: flex; align-items: center; flex: none; }

.sound { display: inline-flex; align-items: center; gap: var(--s-2); height: var(--ctrl); font-size: var(--fs-small); color: var(--muted); white-space: nowrap; }
.sound .ic { width: 18px; height: 18px; }
.sound--off { padding: 0 var(--s-3); border: var(--hair) solid var(--line); border-radius: var(--r-1); color: var(--fg); font-weight: var(--w-label); }
.sound--off:hover { background: var(--surface); }

/* ---------- Keycap ---------- */
.kbd {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: var(--kbd-h); height: var(--kbd-h); padding: 0 5px 1px;
  border-radius: var(--r-2); background: var(--kbd-bg); color: var(--muted);
  font-family: var(--font-text); font-size: var(--fs-micro); line-height: 1; font-weight: var(--w-label);
  letter-spacing: var(--ls-micro);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-3);
  height: var(--ctrl); padding: 0 var(--s-4);
  border: var(--hair) solid transparent; border-radius: var(--r-1);
  font-size: var(--fs-label); line-height: 1; font-weight: var(--w-label); letter-spacing: var(--ls-label);
  text-decoration: none; white-space: nowrap;
}
.btn .ic { width: 16px; height: 16px; }
.btn--primary { height: var(--ctrl-lg); padding: 0 var(--s-5); background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-size: var(--fs-body); }
.btn--primary .kbd { background: var(--kbd-on-ink); color: var(--on-ink-muted); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--primary:disabled, .btn--primary[aria-disabled="true"] { background: var(--bg); border-color: var(--faint); color: var(--muted); }
.btn--primary:disabled .kbd { background: var(--kbd-bg); color: var(--muted); }
.btn--secondary { background: var(--bg); border-color: var(--line); color: var(--fg); }
.btn--secondary:hover { background: var(--surface); }
/* Danger: a secondary button for an action that destroys data (reset progress). Red is rare in Ma, so the
   button is red only in its text and edge, and asks for confirmation before it acts. */
.btn--danger { background: var(--bg); border-color: var(--bad); color: var(--bad); }
.btn--danger:hover { background: var(--surface); }
.btn--danger:disabled { border-color: var(--faint); color: var(--muted); }
.btn--quiet { padding: 0 var(--s-2); color: var(--fg); }
.btn--quiet:hover { background: var(--surface); }
.btn--lg { height: var(--ctrl-lg); }

/* Tool buttons: icon buttons in the lesson head */
.tool {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-width: var(--ctrl); height: var(--ctrl); padding: 0 var(--s-2);
  border-radius: var(--r-1); color: var(--fg); font-size: var(--fs-label); font-weight: var(--w-label);
}
.tool:hover { background: var(--surface); }

/* Quiet lesson controls: text and keycap, one row */
.ctl {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--ctrl-lg); padding: 0 var(--s-2); border-radius: var(--r-1);
  font-size: var(--fs-label); line-height: 1; font-weight: var(--w-label); letter-spacing: var(--ls-label);
  color: var(--fg); white-space: nowrap; position: relative;
}
.ctl .ic { display: none; }
.ctl__label.sm { display: none; }
.ctl:hover:not(:disabled) .ctl__label { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.ctl:disabled { color: var(--faint); }
.ctl:disabled .kbd { color: var(--faint); }
.ctl[aria-pressed="true"]::after { content: ""; position: absolute; left: var(--s-2); right: var(--s-2); bottom: 6px; height: 2px; background: var(--fg); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--fg); }
.dots i.is-used { background: none; box-sizing: border-box; border: var(--hair) solid var(--faint); }

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; height: var(--ctrl); border: var(--hair) solid var(--line); border-radius: var(--r-1); }
.seg__opt {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 0 var(--s-3); font-size: var(--fs-label); line-height: 1; font-weight: var(--w-label);
  color: var(--fg);
}
.seg__opt + .seg__opt { border-left: var(--hair) solid var(--line); }
.seg__opt .ic { width: 16px; height: 16px; }
.seg__opt[aria-checked="true"] { background: var(--fg); color: var(--on-ink); }
.seg__opt[aria-checked="true"] .kbd { background: var(--kbd-on-ink); color: var(--on-ink-muted); }
.seg--sm { height: 32px; }
.seg--sm .seg__opt { font-size: var(--fs-small); padding: 0 var(--s-3); }

/* ---------- Separation control (Break up) ---------- */
.sep { display: inline-flex; align-items: center; gap: var(--s-2); height: var(--ctrl-lg); color: var(--fg); }
.sep__pic { width: 20px; height: 20px; color: var(--muted); }
.sep__track { position: relative; width: 96px; height: var(--touch); flex: none; }
.sep__ticks { position: absolute; left: 7px; right: 7px; top: 50%; height: 7px; margin-top: -3px; display: flex; justify-content: space-between; pointer-events: none; }
.sep__ticks i { width: 1px; height: 7px; background: var(--faint); }
.sep input[type="range"] { -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent; cursor: pointer; }
.sep input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--line); }
.sep input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6.5px; border: 0; border-radius: 50%; background: var(--fg); }
.sep input[type="range"]::-moz-range-track { height: 1px; background: var(--line); }
.sep input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--fg); }
.sep output { min-width: 4ch; font-size: var(--fs-small); color: var(--muted); }

/* ---------- Level node (shared by Ear, Theory, Learn legend) ---------- */
.node__mark {
  position: relative; display: block; width: var(--node); height: var(--node);
  border: 1.5px solid var(--fg); border-radius: 50%; background: var(--mark-bg, var(--bg)); overflow: hidden;
}
.is-exam > .node__mark { border-radius: 1px; }
.is-learning > .node__mark::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: var(--fg); }
.is-passed > .node__mark::after { content: ""; position: absolute; inset: 2px; border-radius: inherit; background: var(--fg); }
.is-mastered > .node__mark { background: var(--fg); }
.is-review > .node__mark { background: var(--fg); overflow: visible; }
.is-review > .node__mark::after { content: ""; position: absolute; inset: -5px; border: var(--hair) dashed var(--fg); border-radius: 50%; }
.is-exam.is-review > .node__mark::after { border-radius: 2px; }
.is-locked > .node__mark { border-color: transparent; background: transparent; }
.is-locked > .node__mark::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--faint); }
.is-here > .node__mark { border-color: var(--home); background: var(--home); }
.is-here > .node__mark::after { display: none; }

/* ---------- Lesson ---------- */
.lesson { padding-top: var(--s-5); padding-bottom: var(--s-7); }
.lesson__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); height: var(--ctrl); }
.lesson__title { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.lv-id { font-size: var(--fs-body); line-height: 20px; font-weight: var(--w-label); letter-spacing: 0.04em; flex: none; }
.lv-title { font-size: var(--fs-body); line-height: 20px; font-weight: var(--w-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson__tools { display: flex; align-items: center; gap: var(--s-1); flex: none; }
.lesson__status { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); height: var(--s-5); margin-top: var(--s-2); }
.lesson__count { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.lesson__status .timing { margin-right: auto; }
/* The cells wrap when the row is too long for its place. The extra questions start a new row after a
   `.progress__break`, so the planned set and the extra questions are two rows of dots. `--n` is the
   longest row in cells: it keeps the row as wide as its cells, so the count sits right after them. */
.progress { --p: 8px; --gap: var(--s-1); display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap); flex: 0 1 auto; min-width: 0; max-width: calc(var(--n, 30) * (var(--p) + var(--gap)) - var(--gap)); }
.progress__break { flex-basis: 100%; height: 0; }
.p { position: relative; width: var(--p); height: var(--p); flex: none; }
.p::before { content: ""; position: absolute; inset: 1px; border-radius: 50%; border: var(--hair) solid var(--faint); }
.p.is-right::before { background: var(--fg); border-color: var(--fg); }
.p.is-help::before { border-color: var(--fg); }
.p.is-dk::before { inset: 2.5px; border: 0; background: var(--faint); }
.p.is-extra::before { border-style: dashed; }
.p.is-now::before { inset: 0; border: 0; background: var(--home); }
.p.is-wrong::before, .p.is-wrong::after { content: ""; position: absolute; inset: auto; left: 3.25px; top: -0.5px; width: 1.5px; height: 9px; border: 0; border-radius: 0; background: var(--bad); transform: rotate(45deg); }
.p.is-wrong::after { transform: rotate(-45deg); }
.count, .timing { font-size: var(--fs-small); line-height: 20px; color: var(--muted); white-space: nowrap; }
.timing.is-off { visibility: hidden; }
.lesson__stages { display: flex; align-items: center; gap: var(--s-3); flex: none; }
.stations { display: block; height: 12px; overflow: visible; }
.stations .ln { stroke: var(--faint); stroke-width: 1; }
.stations .done { fill: var(--fg); }
.stations .now { fill: var(--bg); stroke: var(--fg); stroke-width: 1.5; }
.stations .now-c { fill: var(--fg); }
.stations .later { fill: var(--bg); stroke: var(--faint); stroke-width: 1; }
.stage-name { font-size: var(--fs-small); line-height: 20px; color: var(--fg); white-space: nowrap; }
.context { display: flex; align-items: center; gap: var(--s-3); height: 20px; margin-top: var(--s-1); font-size: var(--fs-small); line-height: 20px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.context .ic { width: 16px; height: 16px; }
.context b { font-weight: var(--w-label); color: var(--fg); }
.context .sepdot { color: var(--faint); }

.stage { position: relative; display: grid; place-items: center; height: var(--stage-h); margin-top: var(--s-6); }
.staff { display: block; width: calc(30 * var(--staff-space)); height: calc(10 * var(--staff-space)); overflow: visible; color: var(--fg); fill: currentColor; }
/* A drawing taller than the frame (a ledger note with its label): the frame grows from the stage's edge down to
   the content and keeps the staff lines in place (the SVG is top-aligned). Taller than the stage, it scales down. */
.staff--tall { height: var(--stage-h); }
.staff .sl { fill: var(--fg); }
.staff .is-right { fill: var(--ok); }
.staff .is-wrong { fill: var(--bad); }
.staff .is-home { fill: var(--home); }
.staff text { font-family: var(--font-text); font-size: 1.2px; font-weight: var(--w-label); text-anchor: middle; }
.staff .mk { fill: none; stroke-width: 0.16; stroke-linecap: round; stroke-linejoin: round; }
.staff .mk.is-right { stroke: var(--ok); }
.staff .mk.is-wrong { stroke: var(--bad); }
.staff--mini { width: calc(13 * 8px); height: calc(10 * 8px); }

/* Lissajous figure: one thin ink line on each side of the staff (right answer left, yours right).
   Paths come from _shared/tools/lissajous.py, stroke only, constant line weight. */
.stage--liss { grid-template-columns: 1fr auto 1fr; grid-template-areas: "a staff b"; column-gap: var(--s-7); }
.stage--liss > .staff { grid-area: staff; }
.liss { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.liss--a { grid-area: a; justify-self: end; }
.liss--b { grid-area: b; justify-self: start; }
.liss__fig { display: block; width: 96px; height: 96px; overflow: visible; fill: none; stroke: var(--ok); stroke-width: 1.5px; stroke-linejoin: round; }
.liss.is-wrong .liss__fig { stroke: var(--bad); }
.liss__axis { stroke: var(--rule); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.liss__cap { display: flex; align-items: center; gap: var(--s-1); min-height: 20px; font-size: var(--fs-small); line-height: 20px; color: var(--muted); white-space: nowrap; }
.liss__cap b { color: var(--fg); font-weight: var(--w-label); }
.liss.is-wrong .liss__cap b, .liss.is-wrong .liss__ic { color: var(--bad); }
.liss__ic { width: 14px; height: 14px; color: var(--fg); }
.answer__fig { position: absolute; left: var(--s-2); bottom: var(--s-2); width: 28px; height: 28px; overflow: visible; visibility: hidden; fill: none; stroke: currentColor; stroke-width: 1px; stroke-linejoin: round; }
.answers.is-compare .answer__fig { visibility: visible; }
.answer.is-wrong .answer__fig { stroke: var(--bad); }

.prompt { display: flex; align-items: center; justify-content: center; gap: var(--s-3); height: var(--s-6); margin-top: var(--s-2); font-size: var(--fs-body); line-height: var(--lh-body); color: var(--muted); text-align: center; }
.hint { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--fg); font-size: var(--fs-small); }
.hint svg { width: 44px; height: 44px; }
.prompt--hint { height: 44px; }

.entry { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); height: var(--ctrl); margin-top: var(--s-5); }
.slots { display: flex; align-items: center; gap: var(--s-2); }
.slot { display: grid; place-items: center; width: var(--ctrl); height: var(--ctrl); border-bottom: var(--hair) solid var(--line); font-size: var(--fs-h2); font-weight: var(--w-text); }
.slot.is-empty::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }

.answers { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: var(--gutter); margin-top: var(--s-6); }
.answer {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-1);
  height: var(--answer-h); min-width: 0;
  border: var(--hair) solid var(--line); border-radius: var(--r-1); background: var(--bg); color: var(--fg);
}
.answer:hover:not(:disabled) { background: var(--surface); }
.answer__name { display: block; font-size: var(--fs-answer); line-height: var(--lh-answer); font-weight: var(--w-light); letter-spacing: 0.01em; white-space: nowrap; }
.answer__sub { display: block; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); white-space: nowrap; }
.answer > .kbd { position: absolute; top: var(--s-2); left: var(--s-2); }
.answer__mark { position: absolute; top: var(--s-2); right: var(--s-2); width: var(--ic); height: var(--ic); visibility: hidden; }
.answer__play { position: absolute; right: var(--s-2); bottom: var(--s-2); width: 16px; height: 16px; visibility: hidden; color: inherit; }
.answers.is-compare .answer__play { visibility: visible; }
.answer__home { position: absolute; top: calc(50% - 22px); left: calc(50% + 12px); width: 8px; height: 8px; border-radius: 50%; background: var(--home); }
.answer.is-right { background: var(--fg); border-color: var(--fg); color: var(--on-ink); }
.answer.is-right .answer__sub { color: var(--on-ink-muted); }
.answer.is-right .answer__mark { visibility: visible; }
.answer.is-right > .kbd { background: var(--kbd-on-ink); color: var(--on-ink-muted); }
.answer.is-wrong::after { content: ""; position: absolute; inset: -1px; border: 2px solid var(--bad); border-radius: var(--r-1); pointer-events: none; }
.answer.is-wrong .answer__mark { visibility: visible; color: var(--bad); }
.answer.is-dim { border-color: var(--faint); color: var(--muted); }
.lesson--keys { --stage-h: 136px; --staff-space: 12px; }
.lesson--keys .stage { margin-top: var(--s-5); }
.lesson--keys .answers { margin-top: var(--s-4); }
.lesson--keys .controls { margin-top: var(--s-5); }
.answers--row .answer { flex-direction: row; align-items: baseline; gap: var(--s-2); height: 64px; padding-top: 6px; }
.answers--row .answer__sub { font-size: var(--fs-body); }
.answers--row .answer__home { top: 14px; left: auto; right: calc(50% - 4px); }

.piano-wrap { margin-top: var(--s-5); display: flex; justify-content: center; }
.piano { display: block; flex: none; width: calc(15 * 42px); height: auto; }
.piano .kw { fill: var(--key-white); stroke: var(--key-line); stroke-width: 1; }
.piano .kb { fill: var(--key-black); stroke: var(--key-line); stroke-width: 1; }
.piano .kl { fill: var(--key-label); font-family: var(--font-text); font-size: 12px; font-weight: var(--w-label); text-anchor: middle; }
.piano .home { fill: var(--home); stroke: var(--home-halo); stroke-width: 2; }

.controls { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-6); padding-top: var(--s-4); border-top: var(--hair) solid var(--rule); }
.controls__tools { display: flex; align-items: center; gap: var(--s-1); min-width: 0; margin-left: calc(-1 * var(--s-2)); }
.controls .btn--primary { min-width: 160px; }
.sep-row { display: none; }

/* ---------- Page head, tracks, level lines ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); padding-bottom: var(--s-6); }
.page-head__sub { margin-top: var(--s-2); font-size: var(--fs-label); color: var(--muted); }
/* Open and locked at a glance. An open track is a sheet that stands off the paper: a light fill and a thin
   solid edge. A locked track has no fill (the paper shows), a dashed faint edge and muted text. */
.tracklist { display: grid; gap: var(--s-2); }
.track { --mark-bg: var(--sheet); margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-4); border: var(--hair) solid var(--sheet-edge); border-radius: var(--r-1); background: var(--sheet); }
.track.is-locked { --mark-bg: var(--bg); border: var(--hair) dashed var(--faint); background: transparent; }
.track__head {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter);
  align-items: center; min-height: 72px;
}
.track__head > .pic { grid-column: 1 / 2; width: var(--pic-lg); height: var(--pic-lg); }
.track__title { grid-column: 2 / 10; display: flex; align-items: center; gap: var(--s-4); min-width: 0; }
.track__id { width: 28px; flex: none; font-size: var(--fs-body); font-weight: var(--w-label); letter-spacing: 0.04em; }
.track__name { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--w-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track__end { grid-column: 10 / -1; display: flex; align-items: center; justify-content: flex-end; gap: var(--s-4); }
.track__count { font-size: var(--fs-label); color: var(--fg); white-space: nowrap; }
.track__count small { font-size: var(--fs-small); color: var(--muted); }
.track__after { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-small); color: var(--muted); white-space: nowrap; }
.track__after::before { content: ""; width: 12px; height: 1px; border-top: var(--hair) dotted var(--muted); }
.track__head .chev { width: 14px; height: 14px; transition: transform var(--t-fast) var(--ease); }
.track[open] > .track__head .chev { transform: rotate(180deg); }
.track__head:hover .track__name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.track__body { padding: 0 0 var(--s-6) calc((100% - (var(--cols) - 1) * var(--gutter)) / var(--cols) + var(--gutter)); }
.track__sum { max-width: 60ch; font-size: var(--fs-label); line-height: var(--lh-label); color: var(--muted); }
.track__now { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin-top: var(--s-4); font-size: var(--fs-label); line-height: var(--lh-label); }
.track__now span { display: inline-flex; align-items: center; gap: var(--s-2); }
.track__now b { font-weight: var(--w-label); }
.track__now .node__mark { width: 10px; height: 10px; }
.track.is-locked .track__name, .track.is-locked .track__id, .track.is-locked .track__count { color: var(--muted); }
.track.is-locked .pic { color: var(--muted); }

.levels { display: flex; flex-wrap: wrap; row-gap: var(--s-3); margin-top: var(--s-5); }
.module { position: relative; display: flex; padding-right: var(--s-4); margin-right: var(--s-4); }
.node::before, .node::after { content: ""; position: absolute; z-index: -1; top: 14px; border-top: var(--hair) dashed var(--faint); }
.node::before { left: 0; right: 50%; }
.node::after { left: 50%; right: 0; }
.levels > .module:first-child > .node:first-child::before { display: none; }
.module > .node:last-child::after { right: calc(-1 * var(--s-4)); }
.node:not(.is-locked) + .node:not(.is-locked)::before,
.node:not(.is-locked):has(+ .node:not(.is-locked))::after,
.module:has(> .node:last-child:not(.is-locked)) + .module > .node:first-child:not(.is-locked)::before,
.module:has(+ .module > .node:first-child:not(.is-locked)) > .node:last-child:not(.is-locked)::after { border-top-style: solid; border-top-color: var(--line); }
.module:has(> .node:last-child.is-locked)::after { background: var(--faint); }
.module:last-child:has(> .node:last-child.is-locked)::after { background: none; border-color: var(--faint); }
.module::after { content: ""; position: absolute; right: 0; top: 6px; width: 1px; height: 17px; background: var(--line); }
.module:last-child { margin-right: 0; }
.module:last-child::after { width: 4px; border-left: var(--hair) solid var(--line); border-right: 2px solid var(--line); background: none; }
.levels--locked .module::after { background: var(--faint); }
.levels--locked .module:last-child::after { background: none; border-color: var(--faint); }
.node { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: var(--node-pitch); padding-top: 8px; text-decoration: none; border-radius: var(--r-1); }
.node:hover .node__id { color: var(--fg); text-decoration: underline; }
.node__id { margin-top: var(--s-2); font-size: var(--fs-micro); line-height: var(--lh-micro); font-weight: var(--w-label); letter-spacing: 0.02em; color: var(--fg); white-space: nowrap; }
.node.is-here .node__id { color: var(--fg); }
.node.is-locked .node__id { color: var(--muted); font-weight: var(--w-text); }

/* ---------- Folds and tables ---------- */
.fold { margin-top: var(--s-5); }
.fold > summary { display: inline-flex; align-items: center; gap: var(--s-3); height: var(--ctrl); font-size: var(--fs-label); font-weight: var(--w-label); color: var(--fg); border-radius: var(--r-1); }
.fold > summary::before { content: ""; width: 7px; height: 7px; margin: 0 2px; border-right: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg); transform: rotate(-45deg); }
.fold[open] > summary::before { transform: rotate(45deg); margin-top: -4px; }
.fold > summary:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.fold__body { padding: var(--s-2) 0 var(--s-4) var(--s-5); max-width: 64ch; font-size: var(--fs-label); line-height: var(--lh-label); color: var(--muted); }
.fold__body p + p { margin-top: var(--s-2); }
.fold--table { margin-top: var(--s-3); }
.fold--table > summary { height: 32px; font-size: var(--fs-small); color: var(--muted); }
.fold--table > summary::before { border-color: var(--muted); }
.fold--table > .fold__body { max-width: none; overflow-x: auto; }   /* a table keeps its columns and scrolls sideways in the fold */
.table { border-collapse: collapse; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--fg); }
.table th { font-weight: var(--w-label); color: var(--muted); text-align: left; }
.table th, .table td { padding: var(--s-1) var(--s-5) var(--s-1) 0; border-bottom: var(--hair) solid var(--rule); white-space: nowrap; }
.table .n { text-align: right; }
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2) var(--gutter); color: var(--fg); }
.keys li { display: flex; align-items: center; gap: var(--s-3); min-height: 28px; }
.keys .kbd { min-width: 44px; }

/* ---------- Learn ---------- */
.today__meta { margin-top: var(--s-2); font-size: var(--fs-body); color: var(--muted); }
.today__go { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); align-items: center; margin-top: var(--s-6); }
.today__go .btn--primary { grid-column: 1 / 4; }
.next { grid-column: 4 / -1; display: flex; align-items: center; gap: var(--s-3); min-width: 0; min-height: var(--ctrl-lg); }
.next__label { font-size: var(--fs-small); color: var(--muted); }
.next__lv { display: inline-flex; align-items: center; gap: var(--s-2); min-width: 0; text-decoration: none; font-size: var(--fs-body); }
.next__lv b { font-weight: var(--w-label); }
.next__lv span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next .btn--quiet { margin-left: auto; }

.plan { display: flex; margin-top: var(--s-7); }
.plan__stop { position: relative; flex: var(--w) 1 0; min-width: 120px; padding-top: 28px; padding-right: var(--s-3); }
.plan__stop::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 1px; background: var(--line); }
.plan__stop.is-now::before { height: 2px; top: 6.5px; }
.plan__stop:last-child::before { right: auto; width: 100%; }
.plan__stop:last-child::after { content: ""; position: absolute; top: 0; right: 0; width: 1px; height: 15px; background: var(--line); }
.plan__dot { position: absolute; z-index: 1; top: 1px; left: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--fg); }
.plan__stop.is-now .plan__dot { background: var(--home); border-color: var(--home); }
.plan__stop.is-none .plan__dot { border: var(--hair) dashed var(--faint); }
.plan__name { display: block; font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--w-label); }
.plan__meta { display: block; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.plan__stop.is-none .plan__name { color: var(--muted); font-weight: var(--w-text); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); margin-top: var(--s-7); }
.tile { display: flex; flex-direction: column; min-width: 0; padding-left: var(--s-4); border-left: var(--hair) solid var(--rule); }
.tile__num { font-size: var(--fs-num); line-height: var(--lh-num); font-weight: var(--w-light); }
.tile__num small { font-size: var(--fs-body); color: var(--muted); font-weight: var(--w-text); margin-left: var(--s-1); }
.tile__label { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.tile__pic { display: block; height: 44px; width: auto; margin-bottom: var(--s-3); overflow: visible; }
.tile__pic .ink { fill: var(--fg); }
.tile__pic .off { fill: var(--heat-empty); }
.tile__pic .ring { fill: none; stroke: var(--fg); stroke-width: 1.25; }
.tile__pic .faint-ring { fill: none; stroke: var(--faint); stroke-width: 1; }
.tile__pic .today { fill: none; stroke: var(--home); stroke-width: 1.5; }
.tile__pic .up { fill: var(--fg); }
.tile__pic .down { fill: var(--bad); }
.tile__pic .base { fill: var(--rule); }

.sec { margin-top: var(--s-8); }
.sec__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); padding-bottom: var(--s-4); border-bottom: var(--hair) solid var(--rule); }
.sec__head .h2 { font-weight: var(--w-light); font-size: 24px; line-height: 32px; }
.sec__note { font-size: var(--fs-small); color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5); margin-top: var(--s-4); font-size: var(--fs-small); color: var(--muted); }
.legend__item { display: inline-flex; align-items: center; gap: var(--s-2); }
.legend__item .node__mark { width: 10px; height: 10px; }
.legend .is-review > .node__mark::after { inset: -4px; }
.legend__item > .is-locked { position: relative; display: inline-flex; padding: 0 6px; }
.legend__item > .is-locked::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: var(--hair) dashed var(--faint); }

.map { display: block; width: 100%; height: auto; margin-top: var(--s-5); overflow: visible; }
.map--narrow { display: none; }
.map text { font-family: var(--font-text); fill: var(--fg); }
.map .t-id { font-size: 13px; font-weight: var(--w-label); letter-spacing: 0.04em; }
.map .t-name { font-size: 13px; fill: var(--muted); }
.map .t-group { font-size: 12px; font-weight: var(--w-label); letter-spacing: 0.08em; fill: var(--muted); }
.map .trk { stroke: var(--line); stroke-width: 1; fill: none; }
.map .trk-lock { stroke: var(--faint); stroke-dasharray: 3 3; }
.map .trk-end { stroke-dasharray: none; }
.map .t-lock { fill: var(--muted); }
.map .pic-g.t-lock { color: var(--muted); }
.map .halo { stroke: var(--bg); stroke-width: 7; fill: none; }
.map .pre { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 1 3; fill: none; }
.map .dep { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1 3; fill: none; }
.map .jn { fill: var(--muted); }
.map .n-av { fill: var(--bg); stroke: var(--fg); stroke-width: 1.5; }
.map .n-fill { fill: var(--fg); }
.map .n-lock { fill: var(--faint); }
.map .n-here { fill: var(--home); }
.map .n-ring { fill: none; stroke: var(--fg); stroke-width: 1; stroke-dasharray: 2 2; }
.map .pic-g { color: var(--fg); }
.map .row-hit { fill: transparent; }
.map a:hover .t-name { fill: var(--fg); }
.map a:focus-visible { outline: none; }
.map a:focus-visible .row-hit { stroke: var(--focus); stroke-width: 2; }

/* ---------- Stats ---------- */
.heat { margin-top: var(--s-6); }
.heat svg { display: block; width: 100%; height: auto; overflow: visible; }
.heat text { font-family: var(--font-text); font-size: 12px; fill: var(--muted); }
.heat .d0 { fill: var(--heat-empty); }
.heat .d1 { fill: var(--fg); }
.heat .today { fill: none; stroke: var(--home); stroke-width: 1.5; }
.heat__key { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-3); font-size: var(--fs-small); color: var(--muted); }
.heat__key svg { width: auto; height: 14px; }

.week { margin-top: var(--s-5); }
.wrow { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); align-items: center; min-height: 48px; border-bottom: var(--hair) solid var(--rule); }
.wrow__lv { grid-column: 1 / 6; display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.wrow__lv .lv-id { width: 64px; font-size: var(--fs-label); }
.wrow__title { font-size: var(--fs-label); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrow__chart { grid-column: 6 / 11; }
.wrow__val { grid-column: 11 / -1; display: flex; align-items: baseline; justify-content: flex-end; gap: var(--s-2); white-space: nowrap; }
.wrow__val b { font-size: var(--fs-h2); font-weight: var(--w-text); }
.wrow__val small { font-size: var(--fs-small); color: var(--muted); }
.wrow--head { min-height: 32px; font-size: var(--fs-micro); color: var(--muted); letter-spacing: var(--ls-micro); }
.wrow--head .wrow__chart { display: flex; justify-content: space-between; }
.db { position: relative; display: block; height: 24px; }
.db__axis { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--rule); }
.db__link { position: absolute; top: calc(50% - 1px); height: 2px; background: var(--fg); left: calc(min(var(--a), var(--b)) * 1%); width: calc((max(var(--a), var(--b)) - min(var(--a), var(--b))) * 1%); }
.db__last { position: absolute; top: calc(50% - 5px); left: calc(var(--a) * 1% - 5px); width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--fg); background: var(--bg); }
.db__now { position: absolute; top: calc(50% - 6px); left: calc(var(--b) * 1% - 6px); width: 12px; height: 12px; border-radius: 50%; background: var(--fg); }
.db__now.is-few { background: var(--bg); border: 1.5px dashed var(--fg); }
.db__mark { position: absolute; top: 2px; bottom: 2px; left: calc(var(--m) * 1%); width: 1px; background: var(--fg); }
.week__key { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5); margin-top: var(--s-3); font-size: var(--fs-small); color: var(--muted); }
.week__key span { display: inline-flex; align-items: center; gap: var(--s-2); }
.k-last { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--fg); }
.k-now { width: 12px; height: 12px; border-radius: 50%; background: var(--fg); }
.k-few { width: 12px; height: 12px; border-radius: 50%; border: 1.5px dashed var(--fg); }
.k-mark { width: 1px; height: 14px; background: var(--fg); }

.stuck { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); align-items: center; margin-top: var(--s-6); padding: var(--s-4) 0; border-top: var(--hair) solid var(--rule); border-bottom: var(--hair) solid var(--rule); }
.stuck__lv { grid-column: 1 / 3; }
.stuck__lv .h3 { display: block; color: var(--muted); font-weight: var(--w-text); font-size: var(--fs-small); }
.stuck__lv .lv-id { display: block; margin-top: var(--s-1); }
.stuck__pair { grid-column: 3 / 6; display: flex; align-items: center; gap: var(--s-3); }
.stuck__pair .staff { color: var(--fg); }
.stuck__names { font-size: var(--fs-body); }
.stuck__meter { grid-column: 6 / 10; }
.stuck__act { grid-column: 10 / -1; display: flex; justify-content: flex-end; }
.meter { position: relative; display: block; height: 24px; }
.meter__axis { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--rule); }
.meter__fill { position: absolute; left: 0; top: calc(50% - 2px); height: 4px; width: calc(var(--v) * 1%); background: var(--fg); }
.meter__fill.is-over { background: var(--bad); }
.meter__mark { position: absolute; top: 2px; bottom: 2px; left: calc(var(--m) * 1%); width: 1px; background: var(--fg); }
.meter__text { display: flex; justify-content: space-between; font-size: var(--fs-small); color: var(--muted); }
.meter__text b { color: var(--fg); font-weight: var(--w-label); }

.reviews { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); align-items: center; margin-top: var(--s-5); }
.reviews__cal { grid-column: 1 / 4; }
.reviews__cal svg { display: block; width: 100%; max-width: 200px; height: auto; overflow: visible; }
.reviews__cal text { font-family: var(--font-text); font-size: 10.5px;   /* drawn at 1.19: shows as 12.5 px */ fill: var(--muted); }
.reviews__cal .d0 { fill: var(--heat-empty); }
.reviews__cal .today { fill: none; stroke: var(--home); stroke-width: 1.5; }
.reviews__text { grid-column: 4 / -1; font-size: var(--fs-label); color: var(--muted); }
.reviews__text b { display: block; color: var(--fg); font-weight: var(--w-label); }

.lvhead, .lvrow__sum {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter); align-items: center;
}
.c-lv { grid-column: 1 / 3; display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.c-title { grid-column: 3 / 7; min-width: 0; }
.c-strip { grid-column: 7 / 10; }
.c-acc { grid-column: 10 / 11; text-align: right; }
.c-conds { grid-column: 11 / -1; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.c-conds .conds { width: 112px; }
.lvhead { min-height: 40px; font-size: var(--fs-micro); color: var(--muted); letter-spacing: var(--ls-micro); }
.lvhead .conds { color: var(--fg); }
.lvrow { border-top: var(--hair) solid var(--rule); }
.lvrow:last-child { border-bottom: var(--hair) solid var(--rule); }
.lvrow__sum { min-height: 56px; }
.lvrow__sum .lv-id { font-size: var(--fs-label); }
.lvrow__title { font-size: var(--fs-label); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvrow__acc { font-size: var(--fs-h2); font-weight: var(--w-text); text-align: right; }
.lvrow__sum .chev { width: 14px; height: 14px; }
.lvrow[open] > .lvrow__sum .chev { transform: rotate(180deg); }
.strip { display: block; width: 184px; height: 32px; overflow: visible; }
.strip .base { fill: var(--rule); }
.strip .up { fill: var(--fg); }
.strip .down { fill: var(--bad); }
.strip .help { fill: var(--faint); }
.strip .dk { fill: var(--faint); }
.strip .none { fill: var(--heat-empty); }
.conds { display: flex; justify-content: space-between; }
.cond { position: relative; display: block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--fg); }
.cond.is-met { background: var(--fg); }
.conds--pics { color: var(--fg); }
.conds--pics svg { width: 14px; height: 14px; margin: 0 -2px; }

.detail { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); padding: var(--s-2) 0 var(--s-7); }
.detail > * { grid-column: 3 / -1; }
.detail .tiles { margin-top: var(--s-3); }
.detail__grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--s-7) var(--gutter); margin-top: var(--s-7); }
.detail__grid > :nth-child(odd) { grid-column: 1 / 6; }
.detail__grid > :nth-child(even) { grid-column: 6 / -1; }
.detail__grid .h3 { margin-bottom: var(--s-3); }
.checks { display: grid; row-gap: 0; }
.check { display: grid; grid-template-columns: 16px 88px minmax(0, 1fr) auto; column-gap: var(--s-3); align-items: center; min-height: 36px; border-bottom: var(--hair) solid var(--rule); font-size: var(--fs-label); }
.check .cond { width: 10px; height: 10px; }
.check__val { font-size: var(--fs-small); color: var(--muted); text-align: right; white-space: nowrap; }
.check__val b { color: var(--fg); font-weight: var(--w-label); }
.check .meter { height: 20px; }
.boxes { display: flex; gap: 3px; }
.boxes i { width: 9px; height: 9px; border: var(--hair) solid var(--fg); }
.boxes i.is-on { background: var(--fg); }
.boxes i.is-need { border-style: dashed; }
.inst { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-5); font-size: var(--fs-small); color: var(--muted); }
.inst .meter { flex: 1; }
.detail__grid > * { min-width: 0; }   /* a wide grid or table scrolls in its own box, so the column never grows for it */
.confusion__scroll { overflow-x: auto; }   /* a grid wider than the column keeps its size and scrolls sideways in this box */
.confusion svg { display: block; width: auto; max-width: none; height: auto; overflow: visible; }   /* its own width and height: every level's grid at the same scale */
.confusion text { font-family: var(--font-text); font-size: 12.5px; fill: var(--muted); }   /* drawn at 1: shows as 12.5 px */
.confusion .gl { stroke: var(--rule); stroke-width: 1; }
.confusion .hit { fill: var(--fg); }
.confusion .miss { fill: var(--faint); }
.confusion .pair { fill: none; stroke: var(--home); stroke-width: 1.5; }
.confusion .tot { font-size: 12.5px; }
.pairline { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-3); font-size: var(--fs-label); }
.pairline .pairbox { display: inline-flex; align-items: center; height: 28px; padding: 0 var(--s-2); border: 1.5px solid var(--home); border-radius: var(--r-1); white-space: nowrap; }
.pairline .muted { font-size: var(--fs-small); }
.slope svg { display: block; width: 100%; max-width: 386px; height: auto; overflow: visible; }
.slope text { font-family: var(--font-text); font-size: 11px; fill: var(--muted); }
.slope .val { fill: var(--fg); font-size: 12px; font-weight: var(--w-label); }
.slope .ax { stroke: var(--rule); stroke-width: 1; }
.slope .goal { stroke: var(--fg); stroke-width: 1; stroke-dasharray: 3 3; }
.slope .ln { stroke: var(--fg); stroke-width: 1.5; fill: none; }
.slope .ln2 { stroke: var(--faint); stroke-width: 1.5; fill: none; stroke-dasharray: 5 3; }
.slope .pt { fill: var(--fg); }
.slope .pt2 { fill: var(--bg); stroke: var(--faint); stroke-width: 1.5; }
.slope .bar { fill: var(--fg); }
.slope .bar-old { fill: none; stroke: var(--fg); stroke-width: 1.25; }
.slope__key { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-top: var(--s-2); font-size: var(--fs-small); color: var(--muted); }
.slope__key span { display: inline-flex; align-items: center; gap: var(--s-2); }
.k-line { width: 18px; height: 0; border-top: 1.5px solid var(--fg); }
.k-dash { width: 18px; height: 0; border-top: 1.5px dashed var(--faint); }
.k-goal { width: 18px; height: 0; border-top: 1px dashed var(--fg); }
.detail__act { display: flex; align-items: center; gap: var(--s-4); margin-top: var(--s-6); }
.foot { margin-top: var(--s-6); font-size: var(--fs-small); color: var(--muted); }

/* ---------- Settings ---------- */
.set { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); padding: var(--s-6) 0; border-top: var(--hair) solid var(--rule); }
/* The last group ends without a rule: the footer's rule closes the page. */
.set__h { grid-column: 1 / 4; font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--w-text); padding-top: 6px; }
.set__body { grid-column: 4 / -1; display: grid; row-gap: var(--s-5); }
.field { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); column-gap: var(--gutter); align-items: start; }
.field__label { grid-column: 1 / 3; padding-top: 10px; font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--w-label); }
.field__ctl { grid-column: 3 / -1; min-width: 0; }
.field__note { display: block; margin-top: var(--s-2); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.field__note--warn { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--warn); }
.choices { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.choice {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: var(--s-2);
  min-height: var(--ctrl); min-width: 112px; padding: var(--s-3) var(--s-4);
  border: var(--hair) solid var(--line); border-radius: var(--r-1); background: var(--bg); text-align: left;
}
.choice:hover { background: var(--surface); }
.choice[aria-checked="true"]::after { content: ""; position: absolute; inset: -1px; border: 2px solid var(--fg); border-radius: var(--r-1); pointer-events: none; }
.choice:disabled, .choice[aria-disabled="true"] { border-color: var(--faint); color: var(--muted); }
.choice__row { display: flex; align-items: center; gap: var(--s-2); }
.choice__radio { position: relative; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--fg); flex: none; }
.choice[aria-checked="true"] .choice__radio::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--fg); }
.choice__title { font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--w-label); }
.choice__note { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.choice__sample { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--w-text); letter-spacing: 0.02em; white-space: nowrap; }
.choice__sample .tonic { position: relative; }
.choice__sample .tonic::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--home); }
.choice .pic { width: var(--pic-lg); height: var(--pic-lg); }
.choice--inst { min-width: 148px; flex-direction: row; align-items: center; gap: var(--s-3); }
.choice--inst .choice__text { display: flex; flex-direction: column; margin-right: auto; }
.swatch { display: block; width: 56px; height: 36px; overflow: visible; }
.swatch .pl { fill: var(--sw-paper-light); }
.swatch .il { fill: var(--sw-ink-light); }
.swatch .pd { fill: var(--sw-paper-dark); }
.swatch .id { fill: var(--sw-ink-dark); }
.swatch .edge { fill: none; stroke: var(--line); stroke-width: 1; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; border: var(--hair) solid var(--line); border-radius: 12px; background: var(--bg); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--fg); }
.toggle[aria-checked="true"] { background: var(--fg); border-color: var(--fg); }
.toggle[aria-checked="true"]::after { left: 23px; background: var(--bg); }
.toggle[aria-disabled="true"] { border-color: var(--faint); }
.toggle[aria-disabled="true"]::after { background: var(--faint); }
.switchrow { display: flex; align-items: center; gap: var(--s-4); min-height: var(--touch); font-size: var(--fs-label); text-align: left; }
.ruler { position: relative; height: 72px; max-width: 480px; margin: 0 22px; }
.ruler__line { position: absolute; left: 0; right: 0; top: 21px; height: 1px; background: var(--faint); }
.ruler__fill { position: absolute; left: 0; top: 20px; height: 3px; width: calc(var(--v) / 45 * 100%); background: var(--fg); }
.ruler__zero { position: absolute; left: 0; top: 14px; width: 1px; height: 15px; background: var(--fg); }
.ruler__stop { position: absolute; top: 0; left: calc(var(--v) / 45 * 100%); width: 64px; margin-left: -32px; height: 72px; display: flex; flex-direction: column; align-items: center; gap: var(--s-1); padding-top: 14px; border-radius: var(--r-1); }
.ruler__stop i { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--fg); background: var(--bg); }
.ruler__stop[aria-checked="true"] i { background: var(--fg); }
.ruler__stop b { font-size: var(--fs-label); font-weight: var(--w-label); line-height: 20px; }
.ruler__stop small { font-size: var(--fs-micro); line-height: var(--lh-micro); color: var(--muted); white-space: nowrap; }
.src { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--s-4); min-height: 48px; border-bottom: var(--hair) solid var(--rule); font-size: var(--fs-label); }
.src:first-child { border-top: var(--hair) solid var(--rule); }
.src__name { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.src__name b { font-weight: var(--w-label); }
.src__name span { color: var(--muted); font-size: var(--fs-small); }
.warnmark { width: 16px; height: 16px; color: var(--warn); }
.account { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
/* The name takes the room, the buttons (Sign out, Reset progress) sit together at the right. The status
   line under the row has a reserved height, so the row never moves. */
.account b { font-weight: var(--w-label); flex: 1 1 auto; min-width: 0; }
.account__status { min-height: calc(var(--s-2) + var(--lh-small)); }


/* ---------- Result card (end of a set) ---------- */
.result { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-4); padding: var(--s-6) 0; border-top: var(--hair) solid var(--line); border-bottom: var(--hair) solid var(--line); }
.result__score { grid-column: 1 / 5; font-size: 64px; line-height: 72px; font-weight: var(--w-light); }
.result__score small { display: block; font-size: var(--fs-label); line-height: var(--lh-label); color: var(--muted); }
.result__bar { grid-column: 5 / -1; align-self: center; }
.result__unmet { grid-column: 5 / -1; display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-label); }
.result__actions { grid-column: 1 / -1; display: flex; gap: var(--s-3); }

/* ---------- Footer: one quiet row at the end of every page ---------- */
/* A hairline over it, 13 px muted text: the copyright line at the left, the links at the right. */
.footer { border-top: var(--hair) solid var(--rule); }
.footer__in {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  max-width: calc(var(--page-max) + 2 * var(--page-pad)); margin: 0 auto; padding: var(--s-4) var(--page-pad);
  font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted);
}
.footer__links { display: flex; align-items: center; gap: var(--s-4); }
.footer__link { color: var(--muted); text-decoration: none; }
.footer__link:hover { color: var(--fg); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- Form: labelled fields on a sheet, one centred column (sign in, register, contact) ---------- */
.form { max-width: calc(var(--page-max) / 2); margin: 0 auto; }
.form__sheet {
  display: grid; row-gap: var(--s-5); padding: var(--s-6);
  background: var(--sheet); border: var(--hair) solid var(--sheet-edge); border-radius: var(--r-1);
}
.form__label { display: block; margin-bottom: var(--s-2); font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--w-label); }
/* Text field: 40 px (44 on a phone), 1 px --line edge, radius 2, paper fill, 16 px text, 12 px side padding.
   The focus ring is the base :focus-visible rule. The text area is six lines high and grows by hand. */
.field__input, .field__textarea {
  display: block; width: 100%; padding: 0 var(--s-3);
  border: var(--hair) solid var(--line); border-radius: var(--r-1);
  background: var(--bg); color: var(--fg);
  font-size: var(--fs-body); line-height: var(--lh-body);
}
.field__input { height: var(--ctrl); }
.field__textarea { min-height: calc(6 * var(--lh-body) + 2 * var(--s-2)); padding: var(--s-2) var(--s-3); resize: vertical; }
.field__input:disabled, .field__textarea:disabled { border-color: var(--faint); color: var(--muted); }
.field__input::placeholder, .field__textarea::placeholder { color: var(--muted); }
/* A browser that fills the field itself paints its own colour. Keep paper and ink. */
.field__input:-webkit-autofill { -webkit-text-fill-color: var(--fg); box-shadow: inset 0 0 0 var(--ctrl) var(--bg); }
/* Select: the text field's frame with the browser's own arrow; in Settings as wide as a list of cards (360 px). */
.field__select {
  display: block; width: 100%; max-width: 360px; height: var(--ctrl); padding: 0 var(--s-3);
  border: var(--hair) solid var(--line); border-radius: var(--r-1);
  background: var(--bg); color: var(--fg);
  font-size: var(--fs-body); line-height: var(--lh-body);
}
.field__select:disabled { border-color: var(--faint); color: var(--muted); }
/* The status or the error line has a reserved slot of two lines, so the form never moves. */
.form__status { min-height: calc(2 * var(--lh-small)); }
.form__status .field__note { margin-top: 0; }
.form__actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-3); }

/* ---------- Prose and credits: the running text of a text page (About) ---------- */
.prose { max-width: 60ch; }
.prose p + p, .prose p + ul, .prose ul + p, .prose p + .btn, .prose p + a { margin-top: var(--s-4); }
.prose ul { list-style: disc; padding-left: var(--s-5); }
.prose li + li { margin-top: var(--s-2); }
.prose .btn { margin-top: var(--s-4); }
/* Credits: one row per source. The thing at the left, who made it and the links at the right. */
.credits { display: grid; }
.credits__item {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: var(--gutter); align-items: baseline;
  padding: var(--s-3) 0; border-bottom: var(--hair) solid var(--rule); font-size: var(--fs-label); line-height: var(--lh-label);
}
.credits__item:first-child { border-top: var(--hair) solid var(--rule); }
.credits__item b { font-weight: var(--w-label); }
.credits__item span { color: var(--muted); }
.credits__item .link { color: var(--fg); }
@media (max-width: 599px) {
  .form__sheet { padding: var(--s-4); }
  .credits__item { grid-template-columns: 1fr; row-gap: var(--s-1); }
  .account { flex-wrap: wrap; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .answer, .btn, .seg__opt, .choice, .tool, .ctl { transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
  .toggle::after { transition: left var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
  .p::before { transition: background-color var(--t-med) var(--ease), transform var(--t-med) var(--ease); }
  .sound .wave { animation: ma-fade var(--t-med) var(--ease); }
  @keyframes ma-fade { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- Tablet ---------- */
@media (max-width: 1023px) {
  /* The compact bar: without it the sound button lies on top of Stats and Settings from 600 to 755 px. */
  .brand { display: none; }
  .sound > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sound--off { width: var(--touch); height: var(--touch); padding: 0; justify-content: center; }
  /* The heat-map keeps its own size (12 px labels) and scrolls in its box, starting at today. */
  .heat__scroll { direction: rtl; margin: 0 calc(-1 * var(--page-pad)); padding: 0 var(--page-pad); }
  .heat__scroll svg { direction: ltr; width: auto; max-width: none; height: 141px; }
  .track__title { grid-column: 2 / 6; }
  .track__end { grid-column: 6 / -1; }
  .today__go .btn--primary { grid-column: 1 / 3; }
  .next { grid-column: 3 / -1; }
  .wrow__lv { grid-column: 1 / 4; }
  .wrow__chart { grid-column: 4 / 7; }
  .wrow__val { grid-column: 7 / -1; }
  .stuck__lv { grid-column: 1 / 3; } .stuck__pair { grid-column: 3 / 6; } .stuck__meter { grid-column: 1 / 6; margin-top: var(--s-3); } .stuck__act { grid-column: 6 / -1; }
  .set__h { grid-column: 1 / -1; padding-bottom: var(--s-4); }
  .set__body { grid-column: 1 / -1; }
  .detail__grid { grid-template-columns: 1fr; }
  .detail__grid > :nth-child(odd), .detail__grid > :nth-child(even) { grid-column: 1 / -1; }
}

/* ---------- Phone ---------- */
@media (max-width: 599px) {
  .page { padding-top: var(--s-6); padding-bottom: var(--s-8); }
  /* Six sections and the sound status in one line from 360 px wide: the items keep 40 px of width but no side
     padding, the list spreads them, and the bar's gaps are 4 px. */
  .bar__in { gap: var(--s-1); }
  .nav { padding-left: 0; border-left: 0; }
  .nav__list { gap: 0; justify-content: space-between; }
  .nav__item { min-width: 40px; padding: 0; font-size: var(--fs-label); }
  .kbd { display: none; }
  .seg__opt .kbd { display: none; }
  /* An option with a glyph shows the glyph alone: the word is for wide screens. */
  .seg__label.lg { display: none; }

  .lesson { padding-top: var(--s-3); padding-bottom: var(--s-5); }
  .lesson__head { height: var(--touch); }
  .lesson__tools .tool__label { display: none; }
  .tool { min-width: var(--touch); height: var(--touch); }
  .lesson__status { margin-top: var(--s-1); flex-wrap: wrap; height: auto; row-gap: var(--s-1); }
  .lesson__count { flex: 1 0 100%; flex-wrap: wrap; }
  .lesson__stages { order: 2; }
  .lesson__status .timing { order: 3; margin: 0 0 0 auto; }
  .ctl__label.lg { display: none; }
  .ctl__label.sm { display: inline; }
  .progress { --gap: 3px; }
  .p { width: 8px; height: 8px; }
  .stage { margin-top: var(--s-3); }
  .stage--liss { height: auto; min-height: var(--stage-h); grid-template-columns: auto auto; grid-template-areas: "staff staff" "a b"; justify-content: center; column-gap: var(--s-7); row-gap: var(--s-2); }
  .liss--a, .liss--b { justify-self: center; }
  .liss__fig { width: 72px; height: 72px; stroke-width: 1.25px; }
  .prompt { margin-top: 0; font-size: var(--fs-label); }
  .answers { margin-top: var(--s-3); grid-template-columns: repeat(var(--n-phone, 2), minmax(0, 1fr)); }
  .answers--7 .answer:nth-child(n+5) { }
  .answer__sub { font-size: 12px; line-height: 16px; }
  /* The entry row wraps: three slots, Undo and the Buttons | Piano control (or the accidental tools and Undo) are wider than a phone. */
  .entry { margin-top: var(--s-3); height: auto; min-height: var(--touch); flex-wrap: wrap; row-gap: var(--s-2); }
  .slot { width: var(--touch); height: var(--touch); }
  /* Seven degree answers in two rows of 48 px (label and name side by side), so that Next stays on the first screen with the piano. */
  .lesson--keys .answers { margin-top: var(--s-3); }
  .lesson--keys .answers .answer { flex-direction: row; align-items: baseline; gap: var(--s-2); height: 48px; padding-top: 0; }
  .lesson--keys .answers .answer__sub { font-size: var(--fs-small); line-height: 16px; }
  .lesson--keys .answers .answer__home { top: 6px; left: auto; right: calc(50% - 4px); }
  .lesson--keys .piano-wrap { margin-top: var(--s-3); }
  .piano-wrap { margin-top: var(--s-4); justify-content: flex-start; overflow-x: auto; margin-left: calc(-1 * var(--page-pad)); margin-right: calc(-1 * var(--page-pad)); padding: 0 var(--page-pad); }
  .piano { width: calc(15 * 44px); }
  .lesson--keys { --stage-h: 112px; --staff-space: 10px; }
  .sep-row { display: flex; align-items: center; gap: var(--s-3); height: var(--touch); margin-top: var(--s-3); font-size: var(--fs-small); color: var(--muted); }
  .sep-row .sep { flex: 1; height: var(--touch); }
  .sep-row .sep__track { flex: 1; width: auto; }
  .controls { margin-top: var(--s-3); padding-top: var(--s-2); flex-direction: column; align-items: stretch; gap: var(--s-2); }
  .controls__tools { margin-left: 0; display: grid; grid-template-columns: repeat(var(--tools, 5), minmax(0, 1fr)); gap: var(--s-1); }
  .controls__tools .sep { display: none; }
  .ctl { flex-direction: column; gap: 4px; height: 56px; padding: 0; font-size: 12px; letter-spacing: 0; }
  .ctl .ic { display: block; }
  .ctl .dots { position: absolute; top: 9px; left: calc(50% + 13px); }
  .ctl[aria-pressed="true"]::after { bottom: 2px; left: 25%; right: 25%; }
  .controls .btn--primary { width: 100%; }

  /* The action goes under the title and its line when the two do not fit in one line. */
  .page-head { flex-wrap: wrap; padding-bottom: var(--s-5); }
  .track { margin: 0 calc(-1 * var(--s-2)); padding: 0 var(--s-2); }
  .track__head { grid-template-columns: var(--pic) auto minmax(0, 1fr) auto 14px; column-gap: var(--s-3); row-gap: 2px; min-height: 64px; padding: var(--s-3) 0; }
  .track__title, .track__end { display: contents; }
  .track__head > .pic { grid-column: auto; width: var(--pic); height: var(--pic); }
  .track__id { width: auto; }
  .track__name { font-size: var(--fs-body); }
  .track__after { grid-column: 3 / 4; grid-row: 2; }
  .track__after::before { display: none; }
  .track__count small { display: none; }
  .track__body { padding-left: 0; }
  .module { padding-right: var(--s-2); margin-right: var(--s-2); }
  .module > .node:last-child::after { right: calc(-1 * var(--s-2)); }

  .today__go { display: flex; flex-direction: column; align-items: stretch; gap: var(--s-4); }
  .today__go .btn--primary { width: 100%; }
  .next { flex-wrap: wrap; }
  .next .btn--quiet { margin-left: 0; }
  .plan { flex-direction: column; margin-top: var(--s-6); }
  .plan__stop { min-width: 0; padding: 0 0 var(--s-4) var(--s-6); min-height: 56px; }
  .plan__stop::before, .plan__stop.is-now::before { top: 7px; bottom: -7px; left: 6px; right: auto; width: 1px; height: auto; }
  .plan__stop.is-now::before { width: 2px; left: 5.5px; }
  .plan__stop:last-child::before { display: none; }
  .plan__stop:last-child::after { display: none; }
  .plan__name, .plan__meta { display: inline; }
  .plan__meta { margin-left: var(--s-2); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--s-5); margin-top: var(--s-6); }
  .map--wide { display: none; }
  .map--narrow { display: block; }
  .keys { grid-template-columns: 1fr; }

  .wrow { grid-template-columns: minmax(0, 1fr) auto; row-gap: var(--s-1); padding: var(--s-3) 0; }
  .wrow__lv { grid-column: 1 / 2; }
  .wrow__val { grid-column: 2 / 3; }
  .wrow__chart { grid-column: 1 / -1; }
  .wrow--head { display: none; }
  .stuck { grid-template-columns: 1fr auto; row-gap: var(--s-3); }
  .stuck__lv { grid-column: 1 / 2; } .stuck__pair { grid-column: 1 / -1; } .stuck__meter { grid-column: 1 / -1; margin: 0; } .stuck__act { grid-column: 2 / 3; grid-row: 1; }
  .reviews { grid-template-columns: 1fr; row-gap: var(--s-3); }
  .reviews__cal, .reviews__text { grid-column: 1 / -1; }
  .lvhead { display: none; }
  .lvrow__sum { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "lv title" "strip acc" "conds conds"; row-gap: var(--s-2); column-gap: var(--s-3); padding: var(--s-3) 0; }
  .c-lv { grid-area: lv; } .c-title { grid-area: title; } .c-strip { grid-area: strip; } .c-acc { grid-area: acc; } .c-conds { grid-area: conds; }
  .detail > * { grid-column: 1 / -1; }
  .detail__grid { gap: var(--s-6); margin-top: var(--s-6); }
  .check { grid-template-columns: 16px 80px minmax(0, 1fr); }
  .check__val { grid-column: 2 / -1; text-align: left; padding-bottom: var(--s-2); }

  .set { padding: var(--s-5) 0; }
  .field { grid-template-columns: 1fr; row-gap: var(--s-2); }
  .field__label, .field__ctl { grid-column: 1 / -1; padding-top: 0; }
  .choices { display: grid; grid-template-columns: repeat(var(--cn, 2), minmax(0, 1fr)); }
  .choice { min-width: 0; }
  .ruler { margin: 0 26px; }
}

/* ---------- Additions ---------- */
.legend__dep { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1 3; fill: none; }
.legend__item .is-exam > .node__mark { border-radius: 1px; }
.heat__today { display: inline-flex; align-items: center; gap: var(--s-2); margin-left: var(--s-4); }
.heat__today i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--home); }
.heat__scroll { overflow-x: auto; }
.staff--mini { width: 96px; height: 80px; }
.strip-key svg { display: block; }
.strip-key .k-up { fill: var(--fg); }
.strip-key .k-down { fill: var(--bad); }
.strip-key .k-help { fill: var(--faint); }
.strip-key .k-base { fill: var(--rule); }
.k-bar { width: 10px; height: 12px; background: var(--fg); }
.k-bar-old { width: 10px; height: 12px; border: 1.25px solid var(--fg); }
.btn--secondary .ic, .btn--quiet .ic { width: 16px; height: 16px; }
.plan__time { margin-top: 0; }
.set .sep { height: var(--touch); }
.set .sep__track { width: 240px; }
@media (max-width: 599px) {
  .plan__time::before { content: "· "; }
  .plan__meta { margin-left: var(--s-2); }
  .set .sep__track { width: auto; flex: 1; }
  .set .sep { display: flex; }
}
.nodeline { position: relative; display: inline-flex; justify-content: center; align-items: center; width: 48px; height: 16px; }
.nodeline::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.nodeline > span { position: relative; }
.choices--list { display: grid; grid-template-columns: minmax(0, 360px); }
.choices--list .choice { width: 100%; }
@media (max-width: 599px) { .choices--list { grid-template-columns: minmax(0, 1fr); } }
.tile__pic .dl { font-family: var(--font-text); font-size: 12px; fill: var(--muted); }

/* Reference figure in the key lesson (added 31 Oct): the tonic against itself, 1:1, a circle in the home red.
   Desktop: in the right slot, 48 px from the staff. Phone: one 56 px figure beside the staff, no caption. */
.liss.is-home .liss__fig { stroke: var(--home); }
.liss__note { color: var(--muted); }
@media (max-width: 599px) {
  .lesson--keys .stage--liss { grid-template-columns: auto auto; grid-template-areas: "staff b"; column-gap: var(--s-4); row-gap: 0; }
  .lesson--keys .liss--a { display: none; }
  .lesson--keys .liss--b { justify-self: start; align-self: center; }
  .lesson--keys .liss__fig { width: 56px; height: 56px; stroke-width: 1.25px; }
  .lesson--keys .liss__cap { display: none; }
  /* A frame deeper than the stage (five ledger lines): more height, so the labels stay 12 px. */
  .staff--deep { height: calc(var(--stage-h) + var(--s-6)); }
}

/* ---------- Speedrun and leaderboard (added 21 Nov 2026) ---------- */
/* Bar: a section that shows a glyph in place of its word in the compact bar (under 1024 px). The word stays for
   screen readers, as the words of the sound status do. Leaderboard is the one section with a glyph. */
.nav__ic { display: none; width: var(--ic); height: var(--ic); }
/* The Speedrunning switch: the game-controller glyph sits 8 px from its word, not 16 px. */
.switchrow > .ic { margin-right: calc(var(--s-2) - var(--s-4)); }
/* A switch row that cannot be used (Speedrunning while nobody is signed in): muted words, a faint toggle. */
.switchrow:disabled, .switchrow[aria-disabled="true"] { color: var(--muted); }
.switchrow:disabled .toggle, .switchrow[aria-disabled="true"] .toggle { border-color: var(--faint); background: var(--bg); }
.switchrow:disabled .toggle::after, .switchrow[aria-disabled="true"] .toggle::after { background: var(--faint); }

/* Count-in: one large numeral over the stage. It covers the stage and the question frame under it, so the frame
   keeps its height while the numeral changes and when the first question arrives. */
.countin {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center;
  background: var(--bg); color: var(--fg);
  font-size: calc(var(--stage-h) / 2); line-height: 1; font-weight: var(--w-light); font-variant-numeric: tabular-nums;
}

/* Run clock: the time of a run at the right end of the status row. The box is wide enough for "60:00.0" and the
   digits are tabular, so nothing in the row moves while the clock runs. */
.runclock {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--s-2); flex: none; min-width: 9ch; margin-left: auto;
  font-size: var(--fs-h2); line-height: 1; font-weight: var(--w-text); font-variant-numeric: tabular-nums;
  color: var(--fg); white-space: nowrap;
}
.runclock .ic { width: var(--s-4); height: var(--s-4); }

/* Run end: the card that replaces the question area at the end of a run. It is the result card (4.26): the time is
   the one large figure, the splits take the place of the meter, and the facts take the place of the verdict line. A fact
   that is not known yet keeps its place (.is-off), so the card does not move when the server answers. */
.runend__time { grid-row: span 2; font-variant-numeric: tabular-nums; }
.runend__best { color: var(--fg); font-weight: var(--w-label); }
.runend__best.is-off, .runend__facts .is-off { visibility: hidden; }
.runend__facts {
  grid-column: 5 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5);
  min-height: var(--ctrl); font-size: var(--fs-label); line-height: var(--lh-label); color: var(--muted);
}
.runend__facts li { display: inline-flex; align-items: baseline; gap: var(--s-2); }
.runend__facts b { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--w-text); color: var(--fg); font-variant-numeric: tabular-nums; }
.runend__facts .runend__save { flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.runend__save .field__note { margin-top: 0; }
/* The fail card: the line in the display size, a second line under it, the detail and the splits, in one centred
   column. It has no picture. */
.runend--fail { display: flex; flex-direction: column; align-items: center; row-gap: var(--s-2); text-align: center; }
.runend__line { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: var(--w-light); letter-spacing: var(--ls-display); }
.runend__sub { margin-bottom: var(--s-3); font-size: var(--fs-body); line-height: var(--lh-body); color: var(--muted); }
.runend__detail { font-size: var(--fs-label); line-height: var(--lh-label); color: var(--muted); }
.runend--fail .splits { margin-top: var(--s-3); }
.runend--fail .result__actions { justify-content: center; margin-top: var(--s-3); }

/* Splits: one bar per question of a run, on a base line. The height of a bar is the time of its question (--v,
   percent of the longest). The wrong answer that ended a run is a red tick down, as in the answer strip. A
   question that the run did not reach is a faint dot on the line. */
.splits { display: flex; width: max-content; align-items: flex-end; gap: var(--s-2); height: var(--s-7); border-bottom: var(--hair) solid var(--rule); }
.splits__bar { flex: none; width: var(--s-3); height: calc(var(--v) * 1%); background: var(--fg); }
.splits__bar.is-wrong { height: var(--s-4); background: var(--bad); transform: translateY(calc(100% + var(--hair))); }
.splits:has(> .is-wrong) { margin-bottom: calc(var(--s-4) + var(--hair)); }   /* room for the tick under the line */
.splits__bar.is-none { width: var(--s-1); height: var(--s-1); margin: 0 var(--s-1); border-radius: 50%; background: var(--faint); transform: translateY(calc(50% + var(--hair) / 2)); }

/* Leaderboard: the choice of section and kind, then the three boards of the kind side by side. A row is rank,
   name and time. The signed-in user's row has the red dot (you are here). When the user is not in the first
   ten, the user's row follows the list, set apart by space. */
.boardpick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); }
.boards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-7) var(--gutter); margin-top: var(--s-6); }
.board { min-width: 0; }
.board__h { padding-bottom: var(--s-2); border-bottom: var(--hair) solid var(--rule); font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--w-text); }
.board__row {
  display: grid; grid-template-columns: 3ch minmax(0, 1fr) auto; column-gap: var(--s-3); align-items: baseline;
  padding: var(--s-2) 0; border-bottom: var(--hair) solid var(--rule);
  font-size: var(--fs-label); line-height: var(--lh-label); font-variant-numeric: tabular-nums;
}
.board__rank { color: var(--muted); text-align: right; }
.board__name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.board__time { text-align: right; }
.board__row.is-me { font-weight: var(--w-label); }
.board__row.is-me .board__name::before { content: ""; display: inline-block; width: var(--s-2); height: var(--s-2); margin-right: var(--s-2); border-radius: 50%; background: var(--home); vertical-align: middle; }
.board__me { margin-top: var(--s-3); border-top: var(--hair) solid var(--rule); }
.board__empty { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.board__empty::before { content: ""; flex: none; width: var(--node); height: var(--node); border: var(--hair) dashed var(--faint); border-radius: 50%; }

@media (max-width: 1023px) {
  .nav__ic { display: block; }
  .nav__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 599px) {
  /* The clock shares the first line of the status row with the progress dots, and stays last after the timing. */
  .lesson__status:has(> .runclock) .lesson__count { flex: 1 1 auto; }
  .lesson__status > .runclock { order: 4; }
  .result.runend > * { grid-column: 1 / -1; grid-row: auto; }
  .boardpick > .seg { width: 100%; }
  .boardpick .seg__opt { flex: 1 1 0; }
  /* A segmented control with more options than a phone line holds: a grid of two columns. The lines between the
     options stay: each option has its own edge, drawn over the edge of its neighbour. An odd last option spans
     the row. */
  .seg--wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); height: auto; padding: 0 var(--hair) var(--hair) 0; border: 0; }
  .seg--wrap .seg__opt { height: var(--ctrl); margin: 0 calc(-1 * var(--hair)) calc(-1 * var(--hair)) 0; border: var(--hair) solid var(--line); }
  .seg--wrap .seg__opt:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .boards { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- App states (not in the previews) ---------- */
/* The previews put both classes on <main class="page lesson">. In the app the
   lesson frame is a child of main.page, so the page gives up its padding and
   the lesson keeps its own (24 px top, 48 px bottom; 12 and 24 on a phone). */
.page:has(.lesson) { padding-top: 0; padding-bottom: 0; }
/* The brand is a link to the start page in the app. */
a.bar__brand { text-decoration: none; }
/* The bar end holds the sound status and the session control (two items, the preview has one). */
.bar__end { gap: var(--s-4); }
/* One quiet line at the top of the page while nobody is signed in: practice stores nothing. */
.signed-out { margin-bottom: var(--s-5); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.page:has(.lesson) > .signed-out { padding-top: var(--s-3); margin-bottom: 0; }
