/* The course uses MIDI Aid's design language: values from midi-aid/codebase/design/tokens.json, rules from
   midi-aid/docs/design-system.md. System font, sentence case, one blue accent, white surfaces on light grey,
   hairline dividers, 6 px corners, light and dark. When the tokens change there, change them here. */

:root {
  color-scheme: light dark;
  --primary: #2463D1; --on-primary: #FFFFFF;
  --primary-container: #E6EEFC; --on-primary-container: #173F86;
  --background: #F2F3F5; --surface: #FFFFFF; --surface-variant: #F2F3F5;
  --on-surface: #1D1D1F; --on-surface-variant: #5F6066;
  --outline: #E1E2E6; --control-border: #8A8B92;
  --control: #FFFFFF; --row-stripe: #F8F8FA;
  --success: #1E7B3E; --error: #C0281C; --led-off: #B9BAC0;
  --event-note: #1E7B3E; --event-cc: #2463D1; --event-program: #A4480A;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #5B95F5; --on-primary: #061A3D;
    --primary-container: #22324E; --on-primary-container: #D2E2FF;
    --background: #18181A; --surface: #1F1F22; --surface-variant: #26262A;
    --on-surface: #ECECEE; --on-surface-variant: #A3A3AA;
    --outline: #35353A; --control-border: #75757D;
    --control: #2C2C30; --row-stripe: #232326;
    --success: #5BC983; --error: #FF7B70; --led-off: #4A4A50;
    --event-note: #5BC983; --event-cc: #7FAEF7; --event-program: #F0A262;
  }
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--background); color: var(--on-surface); font-family: var(--sans); line-height: 1.5; -webkit-font-smoothing: antialiased; }
header.page, main, footer.page { max-width: 52rem; margin: 0 auto; padding: 0 1rem; }
header.page { padding-top: 2rem; padding-bottom: 0.5rem; }
footer.page { padding-top: 1rem; padding-bottom: 3rem; color: var(--on-surface-variant); font-size: 0.75rem; }

h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 600; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.375rem; line-height: 1.25; font-weight: 600; margin: 0 0 0.75rem; }
h2 .n { display: block; font-size: 0.75rem; font-weight: 600; color: var(--on-surface-variant); margin-bottom: 0.125rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.25rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.kicker { font-size: 0.8125rem; color: var(--on-surface-variant); margin: 0; }
.lede { font-size: 1rem; max-width: 44rem; }
.note { font-size: 0.8125rem; color: var(--on-surface-variant); }
.key { font-size: 0.8125rem; font-weight: 500; background: var(--surface-variant); border: 1px solid var(--outline); border-radius: 4px; padding: 0.05rem 0.35rem; white-space: nowrap; }

/* Each part of a lesson is a panel: a white surface on the grey background */
main > section { background: var(--surface); border: 1px solid var(--outline); border-radius: 10px; padding: 1.5rem; margin: 1rem 0; }
main > section > :last-child { margin-bottom: 0; }
main > section p, main > section ol.steps { max-width: 44rem; }

dl.facts { font-size: 0.875rem; display: grid; grid-template-columns: 6rem 1fr; gap: 0.25rem 1rem; margin: 1rem 0; max-width: 44rem; }
dl.facts dt { color: var(--on-surface-variant); }
dl.facts dd { margin: 0; }

ol.steps { padding-left: 1.4rem; margin: 0.5rem 0 0.75rem; }
ol.steps li { margin: 0 0 0.25rem -0.4rem; padding: 0.3rem 0.4rem; border-radius: 6px; }
ol.steps li.lit { background: var(--primary-container); color: var(--on-primary-container); }
ol.steps li:focus-visible { outline: 2px solid var(--primary); }

/* Keys (buttons), as in MIDI Aid: bordered key, filled primary key, latch key with a check */
button, input { font: inherit; }
button { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; font-weight: 500; color: var(--on-surface); background: var(--control); border: 1px solid var(--control-border); border-radius: 6px; cursor: pointer; }
button:hover:not(:disabled) { background: var(--surface-variant); }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
button:disabled { opacity: 0.38; cursor: default; }
button.play { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.play:hover:not(:disabled) { background: var(--primary); filter: brightness(1.08); }
button.on { background: var(--primary-container); border-color: var(--primary); color: var(--on-primary-container); }
button.listen.on::before, button.hold.on::before { content: "✓ "; }

figure { margin: 1rem 0; }
figcaption { font-size: 0.75rem; color: var(--on-surface-variant); margin-top: 0.4rem; }

/* The signal path experiment */
.lab { border: 1px solid var(--outline); border-radius: 6px; background: var(--surface); padding: 1rem; font-size: 0.8125rem; }
.lab .chain { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.lab .stage h4 { margin: 0 0 0.4rem; font-size: 0.875rem; font-weight: 600; }
.lab .stage h4 span { color: var(--on-surface-variant); font-weight: 400; }
.lab canvas { width: 100%; height: 5.5rem; display: block; background: var(--surface-variant); border-radius: 4px; }
.lab label { display: grid; grid-template-columns: 4.6rem 1fr 3.6rem; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.lab label output { text-align: right; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.lab input[type=range] { width: 100%; accent-color: var(--primary); }
.lab .keys { display: flex; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--outline); align-items: flex-end; flex-wrap: wrap; }
.lab .keys button[data-note] { width: 2.75rem; height: 3.25rem; padding: 0 0 0.3rem; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.lab .keys button small { color: var(--on-surface-variant); font-size: 0.6875rem; font-weight: 400; }
.lab .keys button.on small { color: inherit; }
.lab .keys .gap { flex: 1; }
@media (max-width: 40rem) { .lab .chain { grid-template-columns: 1fr; } }

/* Device drawing */
.device { width: 100%; height: auto; display: block; }
.device text { font-family: var(--sans); font-size: 9px; fill: var(--on-surface-variant); }
.device .sec text.t { font-weight: 600; fill: var(--on-surface); }
.device .sec rect.frame { fill: none; stroke: var(--outline); }
.device .sec.lit rect.frame { fill: var(--primary-container); stroke: var(--primary); }
.device .sec.lit text.t { fill: var(--on-primary-container); }
.device .knob { fill: var(--control); stroke: var(--control-border); }
.device .knob.lit { fill: var(--primary); stroke: var(--primary); }
.device .pad { fill: var(--control); stroke: var(--control-border); }
.device .pad.black { fill: var(--control-border); stroke: var(--control-border); }
.device .pad.lit { fill: var(--primary); stroke: var(--primary); }
.device .body { fill: var(--surface-variant); stroke: var(--control-border); }

/* MIDI Aid status: a readout with a dot and a label, never colour alone */
.midi-aid { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.8125rem; background: var(--surface-variant); border-radius: 6px; padding: 0.4rem 0.75rem; margin: 0.75rem 0; color: var(--on-surface); max-width: none; }
.midi-aid::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--led-off); flex: none; }
.midi-aid.ready::before { background: var(--success); }
.midi-aid.missing::before { background: var(--error); }
.midi-aid .text { flex: 1; min-width: 14rem; }
.midi-aid button { height: 1.75rem; }

.example, .exercise { border-top: 1px solid var(--outline); padding: 1rem 0; }
.example:last-child, .exercise:last-child { padding-bottom: 0; }
.example h3, .exercise h3 { margin-top: 0; }
.controls { font-size: 0.8125rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.controls .state { color: var(--on-surface-variant); margin-left: 0.25rem; }
.controls .state.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--error); margin-right: 0.4rem; }
ul.checks { list-style: none; padding: 0; margin: 0.5rem 0 0.75rem; font-size: 0.875rem; border: 1px solid var(--outline); border-radius: 6px; max-width: 44rem; }
ul.checks li { display: flex; align-items: center; gap: 0.6rem; min-height: 2.25rem; padding: 0.25rem 0.75rem; color: var(--on-surface); }
ul.checks li + li { border-top: 1px solid var(--outline); }
ul.checks li:nth-child(even) { background: var(--row-stripe); }
ul.checks li::before { content: ""; flex: none; width: 1.125rem; height: 1.125rem; border: 1px solid var(--control-border); border-radius: 4px; font-size: 0.75rem; line-height: 1rem; text-align: center; color: var(--on-primary); }
ul.checks li.done::before { content: "✓"; background: var(--primary); border-color: var(--primary); }
ul.checks li .what { flex: 1; }
ul.checks li .kind { font-size: 0.75rem; font-weight: 600; }
ul.checks li .kind.note { color: var(--event-note); }
ul.checks li .kind.cc { color: var(--event-cc); }
ul.checks li .kind.program { color: var(--event-program); }
ul.checks li .seen { color: var(--on-surface-variant); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.result { font-size: 0.875rem; min-height: 1.3rem; margin: 0.5rem 0 0; }
.result.pass { color: var(--success); font-weight: 600; }
.result.pass::before { content: "✓ "; }

table.score { border-collapse: collapse; width: 100%; font-size: 0.875rem; margin: 0.75rem 0 1rem; }
table.score th, table.score td { text-align: left; vertical-align: top; padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--outline); }
table.score th { font-weight: 600; font-size: 0.75rem; color: var(--on-surface-variant); }
table.score tbody tr:nth-child(even) { background: var(--row-stripe); }
table.score td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

nav.lessons { font-size: 0.875rem; }
nav.lessons ol { list-style: none; padding: 0; margin: 0; border: 1px solid var(--outline); border-radius: 6px; counter-reset: lesson; }
nav.lessons li { counter-increment: lesson; min-height: 2.25rem; padding: 0.4rem 0.75rem; color: var(--on-surface-variant); display: flex; gap: 0.75rem; }
nav.lessons li::before { content: counter(lesson); width: 1rem; font-variant-numeric: tabular-nums; }
nav.lessons li + li { border-top: 1px solid var(--outline); }
nav.lessons li:nth-child(even) { background: var(--row-stripe); }

/* Labs of the later lessons: one, two or three stages, pickers, switches, the step sequencer */
.lab .chain.two { grid-template-columns: 1fr 1fr; }
.lab .chain.one { grid-template-columns: 1fr; }
.lab .chain + .chain { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--outline); }
.lab canvas.tall { height: 8rem; }
.lab label.pick, .lab label.switch { display: flex; grid-template-columns: none; align-items: center; gap: 0.5rem; }
.lab label.pick select { flex: 1; min-width: 0; }
.lab .controls label.pick select { flex: none; }
select { font: inherit; font-size: 0.8125rem; height: 2rem; padding: 0 0.5rem; color: var(--on-surface); background: var(--control); border: 1px solid var(--control-border); border-radius: 6px; }
select:focus-visible, input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.lab input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--primary); }
.lab .steps { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--outline); }
.lab .steps:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.lab .step-row { display: grid; grid-template-columns: repeat(16, 1fr); gap: 0.25rem; }
.lab .step-row button { height: 3rem; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.6875rem; position: relative; }
.lab .step-row button:nth-child(4n+1) small { font-weight: 700; color: var(--on-surface); }
.lab .step-row button small { font-size: 0.625rem; font-weight: 400; color: var(--on-surface-variant); }
.lab .step-row button.on small { color: inherit; }
.lab .step-row button.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.lab .step-row button.now { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.lab .step-row button.beyond { opacity: 0.38; }
.lab .step-row button i { position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--event-program); }
.lab .step-editor { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 0.75rem; }
.lab .step-editor label { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.lab .step-editor .which { min-width: 3.5rem; }
.lab .steps > .controls { margin-top: 0.75rem; }
@media (max-width: 40rem) { .lab .chain.two { grid-template-columns: 1fr; } .lab .step-row { grid-template-columns: repeat(8, 1fr); } }

.lab canvas.sketch { cursor: crosshair; touch-action: none; }
.lab .controls button[data-form] { margin-left: 0.4rem; }
.device text.f { font-size: 5.5px; }
.device .pad.beat { stroke: var(--on-surface-variant); }

/* Drum grid: one row of 16 steps per instrument */
.drumlab .drum-row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.drumlab .drum-row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.drumlab .drum-row.count .step-row div { text-align: center; font-size: 0.6875rem; color: var(--on-surface-variant); height: 1.25rem; line-height: 1.25rem; border-radius: 4px; }
.drumlab .drum-row.count .step-row div.beat { font-weight: 700; color: var(--on-surface); }
.drumlab .drum-row.count .step-row div.now { background: var(--primary); color: var(--on-primary); }
.drumlab .step-row button { height: 2.25rem; }
.drumlab .step-row button:nth-child(4n+1) { border-color: var(--on-surface-variant); }
.drumlab .step-row button.on { border-color: var(--primary); }
.drumlab .controls { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.drumlab .controls label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; }
@media (max-width: 40rem) { .drumlab .drum-row { grid-template-columns: 1fr; } }
.drumlab .controls output { white-space: nowrap; min-width: 9.5rem; }
.clocklab .machine { margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--outline); }
.clocklab .drum-row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.clocklab .drum-row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.clocklab .step-row div { text-align: center; font-size: 0.6875rem; color: var(--on-surface-variant); height: 1.5rem; line-height: 1.5rem; border-radius: 4px; border: 1px solid var(--outline); }
.clocklab .step-row div.beat { font-weight: 700; color: var(--on-surface); }
.clocklab .step-row div.now { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.clocklab .controls { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.clocklab .controls label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; }
.clocklab .controls output { font-size: 0.8125rem; min-width: 9.5rem; }
.clocklab .apart { font-weight: 600; color: var(--primary); }
.drumlab .drum-row.accent { margin-top: 0.6rem; }
.drumlab .drum-row button.mute { width: 100%; height: 2.25rem; text-align: left; font-size: 0.8125rem; padding: 0 0.5rem; }
.drumlab .drum-row button.mute[aria-pressed="true"] { text-decoration: line-through; color: var(--on-surface-variant); border-style: dashed; }
.drumlab .drum-row.muted .step-row { opacity: 0.35; }
.drumlab .drum-row.bass[data-bass="notes"], .drumlab .drum-row.picker { margin-top: 0.6rem; }
.drumlab .drum-row.bass[data-bass="notes"] button.on small { font-size: 0.6875rem; font-weight: 600; }
.drumlab .drum-row.picker .step-row { grid-template-columns: repeat(16, 1fr); }
.drumlab .drum-row.picker button { height: 1.75rem; font-size: 0.625rem; padding: 0; }
.drumlab .controls.bass-sound > span { width: 6.5rem; font-size: 0.8125rem; color: var(--on-surface-variant); }
.drumlab .drum-row.accent button.on { background: var(--primary); color: var(--on-primary); }
.drumlab .controls.shape > span { width: 6.5rem; font-size: 0.8125rem; color: var(--on-surface-variant); }
.drumlab .controls.shape output { min-width: 6rem; }
.device text.b { font-size: 6.5px; }
.drumlab .drum-row.names .step-row div { font-size: 0.5625rem; }

/* Contents bar of a course: fixed on the left on wide windows, a bar on top that opens on narrow ones */
nav.contents { font-size: 0.8125rem; }
nav.contents .toggle { display: none; }
nav.contents .list { padding: 1.25rem 0.75rem 2rem; }
nav.contents .course { margin: 0 0 1rem 0.5rem; }
nav.contents h2 { font-size: 1rem; margin: 0 0 0.5rem 0.5rem; }
nav.contents h2 span { display: block; font-size: 0.75rem; font-weight: 400; color: var(--on-surface-variant); }
nav.contents ol { list-style: none; margin: 0; padding: 0; }
nav.contents .lessons > li > a, nav.contents .lessons > li > span { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.3rem 0.5rem; border-radius: 6px; color: var(--on-surface); }
nav.contents .lessons > li > a:hover { background: var(--surface-variant); text-decoration: none; }
nav.contents b { min-width: 1.1rem; font-weight: 600; color: var(--on-surface-variant); }
nav.contents li.current > a { background: var(--primary-container); color: var(--on-primary-container); font-weight: 600; }
nav.contents li.current > a b { color: inherit; }
nav.contents li.planned span { color: var(--on-surface-variant); }
nav.contents li.planned small { margin-left: auto; font-size: 0.6875rem; }
nav.contents .parts { margin: 0.15rem 0 0.4rem 1.35rem; border-left: 1px solid var(--outline); }
nav.contents .parts a { display: block; padding: 0.2rem 0.6rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--on-surface-variant); }
nav.contents .parts a:hover { color: var(--on-surface); text-decoration: none; }
nav.contents .parts a.here { border-left-color: var(--primary); color: var(--primary); font-weight: 600; }
@media (min-width: 72rem) {
  /* The contents stand directly beside the content column, and the two are centred together, so that on a wide
     screen the list is not left behind at the edge of the window. */
  body.with-contents { --pair-left: max(0.5rem, calc(50% - 35.5rem)); }
  body.with-contents header.page, body.with-contents main, body.with-contents footer.page { margin-left: calc(var(--pair-left) + 18rem); margin-right: 0; }
  nav.contents { position: fixed; left: var(--pair-left); top: 1rem; bottom: 1rem; width: 17rem; overflow-y: auto; background: var(--surface); border: 1px solid var(--outline); border-radius: 10px; }
}
@media (max-width: 71.999rem) {
  nav.contents { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--outline); }
  nav.contents .toggle { display: block; width: 100%; height: 2.5rem; border: 0; border-radius: 0; background: none; text-align: left; padding: 0 1rem; font-weight: 600; }
  nav.contents .toggle::after { content: " ▾"; color: var(--on-surface-variant); }
  nav.contents .list { display: none; max-height: 75vh; overflow-y: auto; border-top: 1px solid var(--outline); }
  nav.contents.open .list { display: block; }
  main > section[id] { scroll-margin-top: 3rem; }
}

/* Sheet music under the drum grid, and the table of note values */
.drumlab .sheet { margin: 0.75rem 0 0 7rem; padding-top: 0.5rem; border-top: 1px solid var(--outline); }
.drumlab .sheet h4 { margin: 0 0 0.25rem; font-size: 0.8125rem; font-weight: 600; }
svg.notation { width: 100%; height: auto; display: block; color: var(--on-surface); }
svg.notation text.label { font-size: 13px; fill: var(--on-surface-variant); }
svg.notation text.meter { font-size: 21px; font-weight: 700; fill: currentColor; text-anchor: middle; font-family: Georgia, "Times New Roman", serif; }
table.values { border-collapse: collapse; font-size: 0.875rem; margin: 0.5rem 0 1rem; }
table.values th { text-align: left; font-weight: 600; color: var(--on-surface-variant); font-size: 0.75rem; }
table.values th, table.values td { padding: 0.35rem 1.25rem 0.35rem 0; border-bottom: 1px solid var(--outline); vertical-align: middle; }
table.values svg { width: 2.2rem; height: 2.6rem; display: block; color: var(--on-surface); }
@media (max-width: 40rem) { .drumlab .sheet { margin-left: 0; } }

/* The link to what people know from music lessons */
aside.school { border-left: 3px solid var(--primary); background: var(--surface-variant); border-radius: 0 8px 8px 0; padding: 0.75rem 1rem; margin: 1.25rem 0 0; max-width: 44rem; }
aside.school h3 { margin: 0 0 0.4rem; font-size: 0.9375rem; }
aside.school p { margin: 0.4rem 0; font-size: 0.9375rem; }
.device text.w { fill: var(--surface); }
.device circle.frame { fill: none; stroke: var(--control-border); }

/* Chord lab (J-6): a keyboard, the notes on paper, and one row per layer of a pattern */
.chordlab .play-area { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; align-items: start; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--outline); }
.chordlab .claviature { position: relative; display: flex; gap: 0.25rem; height: 8.5rem; }
.chordlab .claviature button.white { flex: 1; height: 100%; padding: 0 0 0.4rem; display: flex; align-items: flex-end; justify-content: center; }
.chordlab .claviature button.white small { font-size: 0.6875rem; color: var(--on-surface-variant); }
.chordlab .claviature button.black { position: absolute; top: 0; width: 8.5%; height: 58%; padding: 0; background: var(--on-surface); border-color: var(--on-surface); }
.chordlab .claviature button.on { background: var(--primary); border-color: var(--primary); }
.chordlab .claviature button.on small { color: var(--on-primary); }
.chordlab .sheet .paper { display: grid; gap: 0.4rem; color: var(--on-surface); }
.chordlab svg.staff { width: 100%; max-width: 15rem; height: auto; display: block; }
.chordlab svg.piano { width: 100%; max-width: 15rem; height: auto; display: block; }
.chordlab svg.piano .white { fill: var(--control); stroke: var(--control-border); }
.chordlab svg.piano .black { fill: var(--on-surface); }
.chordlab svg.piano .lit { fill: var(--primary); stroke: var(--primary); }
.chordlab .names { margin: 0.4rem 0 0; font-size: 0.8125rem; color: var(--on-surface-variant); }
.chordlab .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; min-height: 2rem; }
.chordlab .row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.chordlab .row select { height: 2rem; max-width: 22rem; font: inherit; font-size: 0.8125rem; color: var(--on-surface); background: var(--control); border: 1px solid var(--control-border); border-radius: 6px; padding: 0 0.5rem; }
.chordlab .row label.switch { margin: 0; }
.chordlab .sequence, .chordlab .slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem; max-width: 22rem; }
.chordlab .sequence button { height: 3rem; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.chordlab .sequence button small { font-size: 0.625rem; font-weight: 400; color: var(--on-surface-variant); }
.chordlab .sequence button b { font-size: 0.875rem; }
.chordlab .sequence button.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.chordlab .sequence button.now { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chordlab .sequence button.now small { color: inherit; }
.chordlab .controls { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--outline); display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.chordlab .controls label { display: flex; align-items: center; gap: 0.5rem; margin: 0; grid-template-columns: none; }
.chordlab .controls output { white-space: nowrap; min-width: 9.5rem; }
@media (max-width: 40rem) { .chordlab .play-area { grid-template-columns: 1fr; } .chordlab .row { grid-template-columns: 1fr; } }

/* The set guide: full screen, large type, read from a metre away while the hands are on the instrument */
.guide-open { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0.75rem 0; max-width: 44rem; }
.guide-open .state { flex: 1; min-width: 14rem; margin: 0; font-size: 0.8125rem; }
body.guiding { overflow: hidden; }
.guide[hidden] { display: none; }
.guide { position: fixed; inset: 0; z-index: 100; background: var(--background); color: var(--on-surface); display: grid; grid-template-rows: auto 1.3fr 1fr auto; gap: 2vh; padding: 3vh 4vw; }
.guide header { display: flex; align-items: center; gap: 3vw; font-size: 4.5vh; font-weight: 600; }
.guide header .where { font-variant-numeric: tabular-nums; }
.guide .dots { display: flex; gap: 1.2vw; flex: 1; }
.guide .dots i { width: 4.5vh; height: 4.5vh; border-radius: 50%; border: 0.4vh solid var(--control-border); }
.guide .dots i.on { background: var(--primary); border-color: var(--primary); }
.guide section { background: var(--surface); border: 1px solid var(--outline); border-radius: 2vh; padding: 3vh 3vw; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.guide section h2 { margin: 0 0 1vh; font-size: 3.4vh; font-weight: 600; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.guide section p { margin: 0; max-width: none; }
.guide .now .does { font-size: 7.5vh; line-height: 1.15; font-weight: 600; }
.guide .now .sounds { font-size: 3.6vh; color: var(--on-surface-variant); margin-top: 1.5vh; }
.guide .next .does { font-size: 5.5vh; line-height: 1.15; color: var(--on-surface-variant); }
.guide .next.soon { background: var(--primary-container); border-color: var(--primary); }
.guide .next.soon h2 { color: var(--primary); font-size: 5vh; }
.guide .next.soon .does { color: var(--on-primary-container); font-weight: 600; }
.guide footer { display: flex; align-items: center; gap: 2vw; min-height: 5vh; font-size: 2.6vh; color: var(--on-surface-variant); }
.guide footer button { height: 6vh; font-size: 2.8vh; padding: 0 2.5vh; }
.guide header .close { height: 5vh; font-size: 2.4vh; padding: 0 2vh; }

/* Chord builder (J-6 Lesson 2): a root and what is stacked on it */
.stacklab .play-area { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; align-items: start; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--outline); }
.stacklab .readout h4 { margin: 0 0 0.25rem; font-size: 1.25rem; font-weight: 600; }
.stacklab .readout p { margin: 0 0 0.25rem; font-size: 0.875rem; color: var(--on-surface-variant); }
.stacklab .readout .names { font-size: 1rem; color: var(--on-surface); font-weight: 600; }
.stacklab .distances { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 0.8125rem; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.stacklab .sheet .paper { display: grid; gap: 0.4rem; color: var(--on-surface); }
.stacklab svg.staff, .stacklab svg.piano { width: 100%; max-width: 15rem; height: auto; display: block; }
.stacklab svg.piano .white { fill: var(--control); stroke: var(--control-border); }
.stacklab svg.piano .black { fill: var(--on-surface); }
.stacklab svg.piano .lit { fill: var(--primary); stroke: var(--primary); }
.stacklab .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.stacklab .row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.stacklab .choices { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.stacklab .choices.roots button { min-width: 2.6rem; padding: 0 0.4rem; }
.stacklab .controls { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--outline); display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 40rem) { .stacklab .play-area { grid-template-columns: 1fr; } .stacklab .row { grid-template-columns: 1fr; } }

/* Key lab (J-6 Lesson 3): a scale, its seven chords and a progression */
.keylab .paper { color: var(--on-surface); margin: 0.5rem 0 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--outline); }
.keylab svg.staff-row { width: 100%; max-width: 34rem; height: auto; display: block; }
.keylab .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; min-height: 2rem; }
.keylab .row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.keylab .choices { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.keylab .choices.keys button { min-width: 2.6rem; padding: 0 0.4rem; }
.keylab .degrees button { height: 3rem; min-width: 3.4rem; padding: 0 0.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.keylab .degrees button small { font-size: 0.6875rem; font-weight: 400; color: var(--on-surface-variant); }
.keylab .sequence { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem; max-width: 22rem; }
.keylab .sequence button { height: 3rem; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.keylab .sequence button small { font-size: 0.6875rem; font-weight: 400; color: var(--on-surface-variant); }
.keylab .sequence button.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.keylab .sequence button.now { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.keylab .sequence button.now small { color: inherit; }
.keylab .row select { height: 2rem; max-width: 22rem; font: inherit; font-size: 0.8125rem; color: var(--on-surface); background: var(--control); border: 1px solid var(--control-border); border-radius: 6px; padding: 0 0.5rem; }
.keylab .row label.switch { margin: 0; }
.keylab .controls { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--outline); display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 40rem) { .keylab .row { grid-template-columns: 1fr; } }

/* Sequence lab (J-6 Lesson 4): shares the rows of the key lab */
.seqlab .paper { color: var(--on-surface); margin: 0.5rem 0 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--outline); }
.seqlab svg.staff-row { width: 100%; max-width: 34rem; height: auto; display: block; }
.seqlab .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; min-height: 2rem; }
.seqlab .row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.seqlab .choices { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.seqlab .degrees button { height: 3rem; min-width: 3.4rem; padding: 0 0.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.seqlab .degrees button small { font-size: 0.6875rem; font-weight: 400; color: var(--on-surface-variant); }
.seqlab .lasts button { min-width: 2.2rem; padding: 0 0.4rem; }
.seqlab .sequence { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.25rem; max-width: 34rem; }
.seqlab .sequence button { height: 3rem; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.seqlab .sequence button small { font-size: 0.6875rem; font-weight: 400; color: var(--on-surface-variant); }
.seqlab .sequence button.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.seqlab .sequence button.now { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.seqlab .sequence button.now small { color: inherit; }
.seqlab .sequence button.beyond { opacity: 0.35; }
.seqlab .controls { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--outline); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.seqlab .controls .state { font-size: 0.8125rem; color: var(--on-surface-variant); }
@media (max-width: 40rem) { .seqlab .row { grid-template-columns: 1fr; } }

/* Phrase lab (J-6 Lesson 5): one chord over a bar */
.phraselab .paper { color: var(--on-surface); margin: 0.5rem 0 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--outline); }
.phraselab svg.roll { width: 100%; max-width: 36rem; height: auto; display: block; }
.phraselab svg.roll .lane { fill: var(--control); }
.phraselab svg.roll .note { fill: var(--primary); }
.phraselab svg.roll .head { stroke: var(--on-surface); stroke-width: 2; }
.phraselab .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; min-height: 2rem; }
.phraselab .row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.phraselab .choices { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.phraselab .choices button { min-width: 2.6rem; padding: 0 0.6rem; }
.phraselab .choices label.switch { margin: 0 0 0 0.75rem; }
.phraselab .row label.switch { margin: 0; }
.phraselab .controls { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--outline); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.phraselab .controls .state { font-size: 0.8125rem; color: var(--on-surface-variant); }
@media (max-width: 40rem) { .phraselab .row { grid-template-columns: 1fr; } }

/* Sound lab (J-6 Lesson 6): a sound and six knobs */
.soundlab .paper { color: var(--on-surface); margin: 0.5rem 0 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--outline); }
.soundlab svg.shape { width: 100%; max-width: 34rem; height: auto; display: block; }
.soundlab .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; min-height: 2rem; }
.soundlab .row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.soundlab .row select { height: 2rem; max-width: 22rem; font: inherit; font-size: 0.8125rem; color: var(--on-surface); background: var(--control); border: 1px solid var(--control-border); border-radius: 6px; padding: 0 0.5rem; }
.soundlab .choices { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.soundlab .choices button { padding: 0 0.6rem; }
.soundlab label.slide { display: grid; grid-template-columns: 4.5rem minmax(6rem, 14rem) auto; gap: 0.5rem; align-items: center; margin: 0; }
.soundlab label.slide small { font-size: 0.75rem; color: var(--on-surface-variant); }
.soundlab label.slide small:first-child { text-align: right; }
.soundlab .controls { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--outline); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.soundlab .controls .state { font-size: 0.8125rem; color: var(--on-surface-variant); }
@media (max-width: 40rem) { .soundlab .row { grid-template-columns: 1fr; } }

/* Song lab (J-6 Lesson 7): patterns in an order */
.songlab .paper { color: var(--on-surface); margin: 0.5rem 0 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--outline); }
.songlab svg.staff-row { width: 100%; max-width: 24rem; height: auto; display: block; }
.songlab .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; min-height: 2rem; }
.songlab .row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.songlab .parts { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.songlab .part { display: flex; flex-direction: column; padding: 0.35rem 0.6rem; border: 1px solid var(--outline); border-radius: 6px; font-size: 0.8125rem; }
.songlab .part small { color: var(--on-surface-variant); font-size: 0.75rem; }
.songlab .sequence { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.25rem; max-width: 34rem; }
.songlab .sequence button { height: 3rem; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.songlab .sequence button small { font-size: 0.6875rem; font-weight: 400; color: var(--on-surface-variant); }
.songlab .sequence button.now { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.songlab .sequence button.now small { color: inherit; }
.songlab .row label.switch { margin: 0; }
.songlab label.slide { display: flex; gap: 0.75rem; align-items: center; margin: 0; font-size: 0.8125rem; color: var(--on-surface-variant); }
.songlab .controls { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--outline); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.songlab .controls .state { font-size: 0.8125rem; color: var(--on-surface-variant); }
@media (max-width: 40rem) { .songlab .row { grid-template-columns: 1fr; } }

/* Chord detective (J-6 tool): the chord MIDI Aid heard, named and drawn */
.detective .found { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; align-items: start; margin: 1rem 0; padding: 1rem 0; border-top: 1px solid var(--outline); border-bottom: 1px solid var(--outline); }
.detective .readout h3 { margin: 0 0 0.25rem; font-size: 1.75rem; font-weight: 600; }
.detective .readout p { margin: 0 0 0.25rem; font-size: 0.875rem; color: var(--on-surface-variant); }
.detective .readout .about { color: var(--on-surface); }
.detective .paper { display: grid; gap: 0.4rem; color: var(--on-surface); }
.detective svg.staff, .detective svg.piano { width: 100%; max-width: 15rem; height: auto; display: block; }
.detective svg.piano .white { fill: var(--control); stroke: var(--control-border); }
.detective svg.piano .black { fill: var(--on-surface); }
.detective svg.piano .lit { fill: var(--primary); stroke: var(--primary); }
.detective .row { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; align-items: center; }
.detective .row > span { font-size: 0.8125rem; color: var(--on-surface-variant); }
.detective .choices { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.detective .choices button { min-width: 2.6rem; padding: 0 0.4rem; }
.detective .controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
@media (max-width: 40rem) { .detective .found { grid-template-columns: 1fr; } .detective .row { grid-template-columns: 1fr; } }
.songlab label.slide input { width: 14rem; max-width: 100%; }
.songlab label.slide output { white-space: nowrap; }

/* The connection check on the getting-started page: what MIDI Aid heard stays on one line beside the Listen button. */
.start-check td { white-space: nowrap; }
.start-check .heard { margin-left: 0.6rem; }

/* The table of the three courses: names and counts are never broken, only the description wraps. */
table.courses td:not(:nth-child(3)), table.courses th { white-space: nowrap; }
