/* Guitar Trainer, look "Soft color", in the colors of Catppuccin (MIT): Mocha for the dark theme, Latte for
   the light one. The setting sets data-theme on <html>. A surface is a fill with no border, and what is not
   in play is dim. Peach is the root note and a chosen item. Other color means music: the degree of a note
   (root, third, fifth, seventh, other), the kind of a chord (major green, minor blue, diminished red), the
   CAGED shape, the chord or beat that sounds, and a right or wrong answer. The kind of a chord shows only in
   the Library, so in a drill green always means right. The neck is a flat diagram: dark frets and quiet
   strings, so the notes are the picture. */
@font-face { font-family: "Geist"; src: url("../fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
/* The large name of a chord, a key or a scale is set in a serif, as in printed music. The file holds only the
   characters of those names. optional: a slow first load keeps Geist, so the name never changes its width in view. */
@font-face { font-family: "Literata"; src: url("../fonts/literata-names.woff2") format("woff2"); font-weight: 700; font-display: optional; }
:root {
  color-scheme: dark;
  --bg: #1e1e2e;
  --surface: #181825;
  --surface-2: #313244;
  --surface-3: #45475a;
  --raised: #585b70;
  --line: #313244;
  --line-strong: #45475a;
  --line-hover: #6c7086;
  --text: #cdd6f4;
  --muted: #a6adc8;
  --faint: #9399b2;
  --accent: #fab387;
  /* The accent drawn on the neck. */
  --accent-line: #fab387;
  --accent-ink: #11111b;
  --accent-soft: rgba(250, 179, 135, .13);
  --accent-soft-2: rgba(250, 179, 135, .22);
  --accent-text: #fab387;
  --ok: #a6e3a1;
  --ok-text: #a6e3a1;
  --ok-soft: rgba(166, 227, 161, .11);
  --ok-edge: rgba(166, 227, 161, .42);
  --bad: #f38ba8;
  --bad-soft: rgba(243, 139, 168, .11);
  --bad-edge: rgba(243, 139, 168, .42);
  /* Notes on the neck. The root is the accent. Tones outside the chord are quiet. */
  --root: #fab387;
  /* The ink on the root, and on the other note colors that are light: the seventh, a slow and a right answer. */
  --root-ink: #11111b;
  --third: #89b4fa;
  --fifth: #cba6f7;
  --seventh: #f5c2e7;
  --other: #45475a;
  --other-edge: #6c7086;
  --other-ink: #cdd6f4;
  --slow: #f9e2af;
  /* The kind of a chord, on the circle of fifths and on chord buttons. */
  --q-major: #a6e3a1;
  --q-minor: #89b4fa;
  --q-dim: #eba0ac;
  --q-mix: 45%;
  --q-text: #ffffff;
  --q-ink: #11111b;
  /* The neck: a board a little lighter than the page, dark frets, quiet strings. */
  --board: #28283a;
  --fret: #11111b;
  --nut: #a6adc8;
  --inlay: #313244;
  --string: #4b4d62;
  --dot-ink: #11111b;
  --target: #cdd6f4;
  --shade: #1e1e2e;
  --ghost-edge: #6c7086;
  --ghost-ink: #a6adc8;
  --link-shape: #cdd6f4;
  --pkey-white: #cdd6f4;
  --pkey-black: #11111b;
  --pkey-edge: #1e1e2e;
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a6adc8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
  /* CAGED shapes, one color each. */
  --shape-c: #f38ba8;
  --shape-a: #f9e2af;
  --shape-g: #a6e3a1;
  --shape-e: #74c7ec;
  --shape-d: #cba6f7;
  /* The circle of fifths: the keys outside the key. */
  --ring-major: #1b1b29;
  --ring-minor: #191926;
  --ring-gap: #1e1e2e;
  /* The chord or beat that sounds now. */
  --live: #f9e2af;
  /* Only things that float over the page have a shadow. */
  --shadow: 0 14px 34px -10px rgba(0, 0, 0, .6);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a6adc8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eff1f5;
  --surface: #e6e9ef;
  --surface-2: #dce0e8;
  --surface-3: #ccd0da;
  --raised: #bcc0cc;
  --line: #dce0e8;
  --line-strong: #ccd0da;
  --line-hover: #9ca0b0;
  --text: #4c4f69;
  --muted: #5c5f77;
  --faint: #5f627a;
  --accent: #fe640b;
  --accent-line: #fe640b;
  --accent-ink: #11111b;
  --accent-soft: rgba(254, 100, 11, .10);
  --accent-soft-2: rgba(254, 100, 11, .18);
  /* Every fill is a Latte color. Two things are not: the dark ink on peach, pink, yellow and green, which is the
     crust of Mocha, and small colored text, which takes a darker peach and green so it stays readable. */
  --accent-text: #983f08;
  --ok: #40a02b;
  --ok-text: #27781a;
  --ok-soft: rgba(64, 160, 43, .13);
  --ok-edge: rgba(64, 160, 43, .5);
  --bad: #d20f39;
  --bad-soft: rgba(210, 15, 57, .09);
  --bad-edge: rgba(210, 15, 57, .4);
  --root: #fe640b;
  --root-ink: #11111b;
  --third: #1e66f5;
  --fifth: #8839ef;
  --seventh: #ea76cb;
  --other: #ccd0da;
  --other-edge: #8c8fa1;
  --other-ink: #4c4f69;
  --slow: #df8e1d;
  --q-major: #40a02b;
  --q-minor: #1e66f5;
  --q-dim: #e64553;
  --q-mix: 30%;
  --q-text: #4c4f69;
  --q-ink: #11111b;
  --board: #e6e9ef;
  --fret: #9ca0b0;
  --nut: #5c5f77;
  --inlay: #dce0e8;
  --string: #bcc0cc;
  --dot-ink: #eff1f5;
  --target: #4c4f69;
  --shade: #eff1f5;
  --ghost-edge: #9ca0b0;
  --ghost-ink: #5c5f77;
  --link-shape: #4c4f69;
  --faint-stroke: .6;
  --faint-label: .85;
  --pkey-white: #eff1f5;
  --pkey-black: #4c4f69;
  --pkey-edge: #acb0be;
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c5f77' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
  --shape-c: #d20f39;
  --shape-a: #df8e1d;
  --shape-g: #40a02b;
  --shape-e: #1e66f5;
  --shape-d: #8839ef;
  --ring-major: #dce0e8;
  --ring-minor: #e6e9ef;
  --ring-gap: #eff1f5;
  --live: #983f08;
  --shadow: 0 10px 28px -12px rgba(76, 79, 105, .35);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c5f77' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font: 16px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--text); text-decoration-color: var(--line-hover); text-decoration-thickness: 1px; text-underline-offset: 3px; }
@media (hover: hover) { a:hover { text-decoration-color: var(--accent); } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -.035em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.noscript { padding: 40px 20px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Top bar. On a phone the four sections move to a tab bar at the bottom. */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left)); height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.topbar nav { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface); }
.topbar nav a { display: flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; padding: 6px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; transition: color .15s, background-color .15s; }
@media (hover: hover) { .topbar nav a:hover { color: var(--text); } }
.topbar nav a[aria-current="true"] { color: var(--text); background: var(--surface-3); }
/* The sound switch: a speaker with waves, or with a cross when the sound is off. */
.topbar-side { display: flex; align-items: center; gap: 10px; }
.sound-btn, .metro-btn { flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); color: var(--muted); transition: color .15s, border-color .15s, background-color .15s; }
@media (hover: hover) { .sound-btn:hover, .metro-btn:hover { color: var(--text); border-color: var(--line-hover); } }
.sound-btn .icon, .metro-btn .icon { width: 19px; height: 19px; stroke-width: 1.9; }
/* The metronome button of the top bar is lit while the metronome bar is open. */
.metro-btn .icon { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.metro-btn[aria-pressed="true"] { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft-2); }
.metro-btn[hidden] { display: none; }
.sound-btn .snd-off { display: none; }
.sound-btn[aria-pressed="true"] { color: var(--bad); border-color: var(--bad-edge); background: var(--bad-soft); }
.sound-btn.is-asked { animation: asked .55s ease-out; }
@keyframes asked { 35% { transform: scale(1.28); box-shadow: 0 0 0 7px var(--bad-soft); } }
.sound-btn[aria-pressed="true"] .snd-on { display: none; }
.sound-btn[aria-pressed="true"] .snd-off { display: inline; }
/* The same message when the switch is out of view, far up the page: a note at the top that turns the sound on. */
.sound-note { position: fixed; z-index: 40; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); min-height: 40px; padding: 8px 16px; border: 1px solid var(--bad-edge); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.nav-icon { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 1200px; margin: 0 auto; padding: 30px max(24px, env(safe-area-inset-right)) 90px max(24px, env(safe-area-inset-left)); }
main:focus, main:focus-visible { outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { color: var(--muted); margin-top: 8px; max-width: 64ch; }
.crumb { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.crumb a { color: var(--muted); }

/* Buttons and choices */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); font-weight: 600; font-size: 15px; text-decoration: none; color: var(--text); transition: background-color .15s, border-color .15s, transform .1s; }
.btn[aria-expanded="true"] { background: var(--surface-3); border-color: var(--line-hover); }
@media (hover: hover) { .btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-hover); } }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
@media (hover: hover) { .btn-primary:hover:not(:disabled) { background: var(--accent); border-color: transparent; filter: brightness(1.06); } }
.btn-big { min-height: 48px; padding: 10px 22px; font-size: 16px; border-radius: var(--radius-sm); }
.btn-icon { width: 40px; padding: 0; }
.kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; font-size: 12px; line-height: 18px; text-align: center; color: var(--muted); font-weight: 600; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.btn .kbd { margin-left: 2px; }
.btn-primary .kbd { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent-ink) 30%, transparent); background: transparent; }

/* A segmented control: the chosen part is lighter than the track. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 12px; }
.seg button { min-width: 36px; border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); min-height: 34px; transition: color .15s, background-color .15s; }
@media (hover: hover) { .seg button:hover { color: var(--text); } }
.seg button[aria-checked="true"] { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); color: var(--text); }
/* A row that would wrap is a grid of even rows (core.js sets the columns), so no choice stands alone. */
.seg.is-grid { display: grid; width: 100%; justify-self: stretch; }
.seg.is-grid button { min-height: 40px; }
.seg button:disabled { opacity: .3; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid transparent; background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm); padding: 5px 12px; font-size: 14px; min-height: 34px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; transition: background-color .15s, border-color .15s; }
@media (hover: hover) { a.chip:not([aria-current="true"]):hover, button.chip:not([aria-pressed="true"]):not([aria-checked="true"]):hover { border-color: var(--line-hover); background: var(--surface-3); } }
.chip small { color: var(--muted); font-size: 12px; }
/* A chosen item: a tinted block with an edge in the accent. */
.chip[aria-current="true"], .chip[aria-pressed="true"], .chip[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 30%, var(--surface)); font-weight: 700; }
/* A switch that is on, such as Swing or Click: a check mark, not the accent of a choice or of Play. */
.chip.chip-toggle[aria-pressed="true"] { background: var(--raised); color: var(--text); border-color: transparent; font-weight: 600; }
.chip.chip-toggle[aria-pressed="true"]::before { content: '✓'; margin-right: 5px; color: var(--accent-text); }

/* A chord name as in print: the sharp or flat is raised, and the kind of the chord is smaller. */
.acc { position: relative; top: -.45em; font-size: .62em; line-height: 0; vertical-align: baseline; }
.kind { font-size: max(.8em, 12px); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; color: var(--muted); font-weight: 600; }
.field > .seg, .field > select { justify-self: start; max-width: 100%; }
.field > input[type="range"] { width: min(100%, 320px); }
.row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; margin: 16px 0; }
select { min-height: 40px; background: var(--surface-2) var(--chevron) no-repeat right 10px center / 16px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 6px 36px 6px 12px; font-weight: 600; -webkit-appearance: none; appearance: none; max-width: 100%; }
@media (hover: hover) { select:hover { border-color: var(--line-hover); } }
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }

/* The control panel above a neck: every choice of the page in one place, one tap each. */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin: 16px 0 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); }
.ctl { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ctl-wide { flex: 1 1 100%; }
.ctl-label { font-size: 13px; color: var(--muted); font-weight: 600; flex: none; }
.ctl-quiet .ctl-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Root: seven letters, then flat, natural or sharp. */
.letters { display: grid; grid-template-columns: repeat(7, 42px); gap: 5px; }
.letters .chip, .grid-chips .chip { justify-content: center; padding: 5px 0; min-height: 38px; border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; }
.accs button { min-width: 38px; font-size: 16px; padding: 4px 8px; }
/* Types: the common ones as chips, the rest in a list that fills the row. */
.types { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.types .chip { min-height: 38px; padding: 5px 14px; }
.types .more { flex: 1 1 170px; min-width: 0; max-width: 320px; min-height: 38px; border-radius: var(--radius-sm); font-size: 14px; padding: 5px 34px 5px 14px; color: var(--muted); }
.types .more.is-on { border-color: var(--accent); background-color: var(--accent-soft-2); color: var(--text); }
/* A grid of short chips: 13 intervals or 12 notes in even rows. */
.grid-chips { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 52px)); gap: 5px; flex: 1; min-width: 0; }
/* Many chips of about the same length, such as the open chords: equal tiles. */
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.chip-grid .chip { justify-content: center; padding: 5px 4px; border-radius: var(--radius-sm); }
/* The chords you fill in, in one row. */
.slots { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 16px; max-width: 420px; }
.slots .chip { justify-content: center; min-width: 0; padding: 5px 4px; font-weight: 700; font-size: 16px; white-space: nowrap; }

/* Fretboard: a flat diagram. A long flat neck scrolls sideways inside .neck-scroll. */
.neck { position: relative; min-width: 0; max-width: 100%; padding: 4px 0 8px; }
.neck-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
/* A neck that scrolls fades at the side where more of it waits. */
.neck.is-scrolling .neck-scroll { -webkit-mask-image: linear-gradient(to right, transparent, #000 26px, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to right, transparent, #000 26px, #000 calc(100% - 26px), transparent); }
.neck.is-scrolling.at-start .neck-scroll { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); }
.neck.is-scrolling.at-end .neck-scroll { -webkit-mask-image: linear-gradient(to right, transparent, #000 26px); mask-image: linear-gradient(to right, transparent, #000 26px); }
.neck svg.fb { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.neck svg.fb-vertical { max-width: min(100%, 400px); }
/* The row under the neck: chips that switch faint layers on and off, then the switch between flat and upright. */
.neck-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.neck-tools:first-child { margin: 0 0 8px; }
.neck-tools .chip { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.neck-turn { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; padding: 5px 11px; min-height: 32px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; }
.neck-turn .icon { width: 15px; height: 15px; }
.turn-short { display: none; }
@media (max-width: 340px) { .turn-long { display: none; } .turn-short { display: inline; } }
/* String names pinned to the side of a neck that scrolls. */
/* The pinned names sit in the page margin beside the neck, so they cover no note. */
.neck-names { position: absolute; left: -16px; width: 15px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.neck.is-left .neck-names { left: auto; right: -16px; }
.neck.is-scrolling:not(.at-start):not(.is-left) .neck-names, .neck.is-scrolling.is-left:not(.at-end) .neck-names { opacity: 1; }
.neck-names span { position: absolute; left: 0; width: 15px; transform: translateY(-50%); text-align: center; font-size: 12px; line-height: 17px; font-weight: 700; color: var(--text); background: var(--surface-3); border-radius: 6px; }
.fb-board { fill: var(--board); }
.fb-shade { fill: var(--shade); opacity: .62; }
.fb-fret { stroke: var(--fret); stroke-width: 2; }
.fb-nut { stroke: var(--nut); stroke-width: 6; stroke-linecap: round; }
.fb-capo { stroke: var(--accent); stroke-width: 9; }
.fb-inlay { fill: var(--inlay); }
.fb-string { stroke: var(--string); stroke-linecap: round; }
.fb-num { fill: var(--faint); font-size: 12px; font-weight: 600; }
.fb-num-strong { fill: var(--text); font-weight: 700; }
.fb-strname { fill: var(--muted); font-size: 13px; font-weight: 700; }
.fb-hit { fill: transparent; }
.fb-pos, .pkey { --c: var(--other); --ink: var(--other-ink); --edge: var(--other-edge); }
.fb-pos[role="button"] { cursor: pointer; outline: none; }
@media (hover: hover) { .fb-pos[role="button"]:hover .fb-hit { fill: color-mix(in srgb, var(--accent) 14%, transparent); } }
.fb-pos[role="button"]:focus-visible .fb-hit { stroke: var(--accent-line); stroke-width: 2; }
.fb-root { --c: var(--root); --ink: var(--root-ink); --edge: var(--board); }
.fb-third { --c: var(--third); --ink: var(--dot-ink); --edge: var(--board); }
.fb-fifth { --c: var(--fifth); --ink: var(--dot-ink); --edge: var(--board); }
.fb-seventh { --c: var(--seventh); --ink: var(--root-ink); --edge: var(--board); }
.fb-correct { --c: var(--ok); --ink: var(--root-ink); --edge: var(--board); }
.fb-wrong { --c: var(--bad); --ink: var(--dot-ink); --edge: var(--board); }
.fb-slow { --c: var(--slow); --ink: var(--root-ink); --edge: var(--board); }
.fb-target { --c: var(--target); --ink: var(--board); --edge: var(--board); }
.fb-dot { fill: var(--c); stroke: var(--edge); stroke-width: 1.6; }
.fb-ring { fill: none; stroke: var(--c); stroke-width: 2; stroke-dasharray: 3 2.5; }
.fb-label { fill: var(--ink); font-size: 12.5px; font-weight: 700; pointer-events: none; }
.fb-label-long { font-size: 10.5px; }
.fb-small .fb-label, .fb-small .fb-label-long { font-size: 9.5px; }
.fb-ghost .fb-dot { fill: var(--board); stroke: var(--ghost-edge); stroke-width: 1.2; }
.fb-ghost .fb-label { fill: var(--ghost-ink); font-weight: 600; }
.fb-hint .fb-dot { fill: var(--board); stroke: var(--accent-line); stroke-width: 2.5; stroke-dasharray: 4 3; }
.fb-hint .fb-label { fill: var(--accent-line); }
.fb-dim { opacity: .3; }
.fb-mute { fill: var(--muted); font-size: 18px; font-weight: 700; }
/* A small chord chart: larger text, because the whole picture is drawn small. */
.fb-mini .fb-label { font-size: 15px; }
.fb-mini .fb-label-long { font-size: 12px; }
.fb-mini .fb-num { font-size: 14px; }
.fb-mini .fb-mute { font-size: 19px; }
/* A note that sounds now: a short, small swell, and a ring that spreads from it and fades. */
.fb-dot { transition: transform .1s ease-out, stroke-width .1s ease-out; }
.fb-pos.is-lit .fb-dot, .fb-pos.is-playing .fb-dot { transform: scale(1.14); stroke: var(--live); stroke-width: 3; }
.fb-pulse { fill: none; stroke: var(--live); stroke-width: 2.2; vector-effect: non-scaling-stroke; pointer-events: none; animation: pulse .5s ease-out forwards; }
/* A change of a choice in the Library: the notes and shapes of the new neck fade in, fast. */
.lib-stage .fb-pos, .lib-stage .fb-regions, .lib-stage .fb-link, .lib-stage .fb-region-label { animation: note-in .12s ease-out; }
@keyframes note-in { from { opacity: 0; } }
/* Name it draws the neck again on every tap, so it has no fade. */
.lib-stage-taps .fb-pos, .lib-stage-taps .fb-regions, .lib-stage-taps .fb-link, .lib-stage-taps .fb-region-label { animation: none; }
@keyframes pulse { from { transform: scale(1); opacity: .95; } to { transform: scale(2.1); opacity: 0; } }
/* Lines between notes and outlines of shapes. */
.fb-link { fill: none; stroke: var(--link-shape); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.fb-link.is-answer { stroke: var(--accent-line); stroke-width: 3.5; stroke-dasharray: 7 6; }
.fb-region { --rc: var(--accent); fill: var(--rc); fill-opacity: .13; stroke: var(--rc); stroke-opacity: .75; stroke-width: 1.8; }
.fb-region.is-near { fill-opacity: .06; stroke-opacity: .5; stroke-dasharray: 6 5; }
.fb-region.is-current { fill-opacity: .16; stroke-width: 2.4; }
.fb-region-label { --rc: var(--accent); }
.fb-region-label circle { fill: var(--rc); }
.fb-region-label text { fill: var(--dot-ink); font-size: 12px; font-weight: 800; text-anchor: middle; }
.fb-region-label.shape-A text, .fb-region-label.shape-G text { fill: var(--root-ink); }
.fb-region-label.is-near { opacity: .65; }
/* A faint layer behind the main picture: the CAGED shapes around a triad or a scale. */
.fb-region.is-faint { fill-opacity: .05; stroke-opacity: var(--faint-stroke, .4); stroke-width: 1.4; }
.fb-region-label.is-faint { opacity: var(--faint-label, .5); }
.shape-C { --rc: var(--shape-c); }
.shape-A { --rc: var(--shape-a); }
.shape-G { --rc: var(--shape-g); }
.shape-E { --rc: var(--shape-e); }
.shape-D { --rc: var(--shape-d); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px var(--other-edge); }
.legend i.is-root { border-radius: 3px; box-shadow: none; }

/* Library */
.lib { display: grid; gap: 18px; }
.lib-tabs { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 4px; margin: -4px; }
.lib-tabs::-webkit-scrollbar { display: none; }
/* A row wider than the screen fades at the side where more items hide, so no item looks cut by mistake. */
.lib-tabs.fade-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px); mask-image: linear-gradient(to right, transparent, #000 32px); }
.lib-tabs.fade-right { -webkit-mask-image: linear-gradient(to left, transparent, #000 32px); mask-image: linear-gradient(to left, transparent, #000 32px); }
.lib-tabs.fade-left.fade-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.lib-tabs a { flex: none; color: var(--muted); text-decoration: none; padding: 8px 15px; border-radius: var(--radius-sm); font-weight: 600; font-size: 15px; border: 1px solid transparent; transition: color .15s, background-color .15s; }
@media (hover: hover) { .lib-tabs a:hover { color: var(--text); background: var(--surface-2); } }
.lib-tabs a[aria-current="true"] { color: var(--text); background: var(--surface-2); }
/* The search button stands before the topics, so it stays in view while they scroll. */
.lib-nav { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lib-nav .lib-tabs { flex: 1; min-width: 0; }
.lib-home-link { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid transparent; color: var(--text); background: var(--surface-2); transition: background-color .15s, border-color .15s; }
@media (hover: hover) { .lib-home-link:hover { background: var(--surface-2); border-color: var(--line-hover); } }
/* The first tab of a group: a thin line sets the group apart. */
.lib-tabs .lib-tool-link { margin-left: 8px; position: relative; }
/* The tools follow the topics after one line, not a line between each tool. */
.lib-tabs .lib-tool-link + .lib-tool-link { margin-left: 0; }
.lib-tabs .lib-tool-link + .lib-tool-link::before { display: none; }
.lib-tabs .lib-tool-link::before { content: ""; position: absolute; left: -5px; top: 9px; bottom: 9px; width: 1px; background: var(--line-strong); }
.lib-stage { min-width: 0; }
/* The Library has two rows of tabs: the search button and the shelves, then the pages of one shelf under them. */
.lib-nav-two { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; }
.lib-nav-two .lib-pages { grid-column: 1 / -1; }
.lib-pages a { font-size: 14px; padding: 6px 13px; }
.lib-pages a[aria-current="true"] { color: var(--accent-text); background: var(--accent-soft-2); }
/* Links from a topic to its drills. */
.practice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.practice-label { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.practice-label .icon { width: 16px; height: 16px; }
.practice .chip { background: var(--accent-soft); }
@media (hover: hover) { .practice .chip:hover { border-color: var(--accent); background: var(--accent-soft-2); } }
.lib-main { min-width: 0; }
.lib-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; }
.lib-title h1 { font-size: 40px; }
.lib-sub { margin-top: 6px; max-width: 62ch; }
.lib-play { gap: 8px; }
.lib-note { margin-top: 10px; max-width: 72ch; }
/* The tones of a scale or chord, as equal tiles. The row is the color key of the neck. */
.formula { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 62px)); gap: 6px; margin-top: 12px; }
.tone { display: grid; justify-items: center; min-width: 0; padding: 7px 3px; border-radius: 12px; background: var(--surface); border: 1px solid transparent; cursor: pointer; transition: border-color .15s, background-color .15s; }
@media (hover: hover) { .tone:hover { border-color: var(--line-hover); } }
.tone.is-still { cursor: default; }
@media (hover: hover) { .tone.is-still:hover { border-color: transparent; } }
.tone b { font-size: 15px; }
.tone span { font-size: 13px; color: var(--muted); }
.tone[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tone .swatch { width: 9px; height: 9px; border-radius: 50%; margin-bottom: 3px; box-shadow: inset 0 0 0 1px var(--other-edge); }
.tone .swatch.is-root { border-radius: 3px; box-shadow: none; }
.lib-section { margin-top: 36px; container-type: inline-size; }
.lib-section > h2 { margin-bottom: 12px; }
.lib-section > p { color: var(--muted); margin-bottom: 14px; max-width: 70ch; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid transparent; border-radius: var(--radius); padding: 14px; transition: border-color .15s, transform .15s; }
.card h3 { font-size: 16px; margin-bottom: 2px; }
.card p { color: var(--muted); font-size: 14px; }
button.card { text-align: left; width: 100%; }
@media (hover: hover) { button.card:hover, a.card:hover { border-color: var(--line-hover); transform: translateY(-2px); } }
a.card[aria-current="true"], button.card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fb-link.is-off { opacity: .22; }
.card.is-correct { border-color: var(--ok); }
.card.is-wrong { border-color: var(--bad); }
.card .neck { padding: 6px 0 0; }
.chord-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@container (min-width: 680px) { .chord-row { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
/* The seven chords of a key or scale in one row, like the seven degrees. */
.chord-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
/* A chord button is tinted by the kind of its chord. */
.kind-major { --q: var(--q-major); }
.kind-minor { --q: var(--q-minor); }
.kind-dim { --q: var(--q-dim); }
.chord-btn { display: grid; gap: 2px; min-width: 0; padding: 9px 11px; border-radius: 12px; border: 1px solid transparent; background: color-mix(in srgb, var(--q, var(--surface)) 20%, var(--surface)); text-align: left; text-decoration: none; color: inherit; transition: border-color .15s, background-color .15s; }
@media (hover: hover) { .chord-btn:hover { border-color: var(--line-hover); } }
.chord-btn small { color: color-mix(in srgb, var(--q, var(--accent-text)) 70%, var(--text)); font-size: 13px; font-weight: 600; }
.chord-btn b { font-size: 16px; overflow-wrap: anywhere; }
.chord-strip .chord-btn { justify-items: center; text-align: center; padding: 9px 2px; }
.chord-btn[aria-pressed="true"] { border-color: var(--q, var(--accent)); background: color-mix(in srgb, var(--q, var(--accent)) var(--q-mix), var(--surface)); color: var(--q-text); }
.chord-btn[aria-pressed="true"] small { color: inherit; }
.chord-btn.is-playing { border-color: var(--live); box-shadow: 0 0 0 2px color-mix(in srgb, var(--live) 30%, transparent); }
.chord-panel { display: flex; align-items: center; gap: 16px; margin-top: 10px; padding: 14px; border-radius: var(--radius); background: var(--surface); }
.chord-panel-text { flex: 1; min-width: 0; display: grid; gap: 8px; }
.chord-panel-text h3 { font-size: 20px; }
.chord-panel-text h3 small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.chord-panel-text p { color: var(--muted); font-size: 14px; }
.chord-panel-text .row { gap: 6px; }
.chord-panel .neck { flex: 0 0 170px; padding: 0; }
.prog-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.prog { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid transparent; background: var(--surface); transition: border-color .15s, background-color .15s; }
@media (hover: hover) { .prog:hover { background: var(--surface-2); border-color: var(--line-hover); } }
.prog[aria-pressed="true"] { border-color: var(--live); background: color-mix(in srgb, var(--live) 9%, var(--surface)); }
/* A triangle to start, a square to stop. */
.prog-play { grid-row: span 2; width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent var(--accent-text); }
[aria-pressed="true"] > .prog-play { width: 11px; height: 11px; border: 0; border-radius: 2px; background: var(--live); }
.prog b { font-size: 15px; }
.prog-chords { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0 12px; color: var(--muted); font-size: 14px; }
.prog-chords .is-now { color: var(--live); font-weight: 700; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.tempo { display: inline-flex; align-items: center; gap: 4px; }
.tempo .btn { min-height: 36px; width: 36px; font-size: 18px; }
.tempo output { min-width: 72px; text-align: center; font-size: 14px; font-weight: 600; }
.backing-row { gap: 10px 16px; margin-bottom: 10px; }
/* The backings of a scale: two or three of them, one under the other. */
.prog-stack { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
.drone { gap: 10px; }
.drone .prog-play { grid-row: auto; }
.drone[aria-pressed="true"] { border-color: var(--live); background: color-mix(in srgb, var(--live) 9%, var(--surface-2)); }
/* Name these notes: the answers under the neck. */
.named { margin-top: 14px; max-width: 640px; }
.named h2 { font-size: 16px; margin: 22px 0 8px; }
.named .found-list { margin-top: 0; }
.named .formula { margin-top: 0; }
.named-note { margin: 12px 0 8px; }
.named .btn { margin-top: 8px; }
.found-text { display: grid; gap: 1px; min-width: 0; }
.found-text small { color: var(--muted); font-size: 13px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* The keyboard: folded away until you open it. */
.piano-box { margin-top: 14px; padding: 0 14px; border-radius: var(--radius); background: var(--surface); max-width: 560px; }
.piano-box summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 14px; color: var(--muted); }
.piano-box[open] { padding-bottom: 12px; }
.piano-box[open] summary { color: var(--text); }
.piano-box p { margin-top: 8px; }
.piano-wrap { overflow-x: auto; }
.piano { display: block; width: 100%; min-width: 290px; height: auto; }
.pkey { cursor: pointer; outline: none; }
.pkey > rect:first-child { stroke: var(--pkey-edge); stroke-width: 1; }
.pkey.white > rect:first-child { fill: var(--pkey-white); }
.pkey.black > rect:first-child { fill: var(--pkey-black); }
.pkey:focus-visible > rect:first-child { stroke: var(--accent); stroke-width: 2.5; }
.pdot { fill: var(--c); stroke: var(--edge); stroke-width: 1.2; }
.plabel { fill: var(--ink); font-size: 9.5px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.plabel-long { font-size: 7.6px; }
.pkey.fb-ghost .pdot { fill: none; stroke: none; }
.pkey.fb-ghost .plabel { fill: #eef1f6; font-weight: 600; }

/* Library start page */
.search-box { max-width: 640px; margin-bottom: 28px; }
.search { width: 100%; min-height: 52px; padding: 10px 16px 10px 48px; border-radius: var(--radius); border: 1px solid transparent; background: var(--surface-2) var(--search-icon) no-repeat 16px center / 20px; font-size: 16px; -webkit-appearance: none; appearance: none; }
.search::placeholder { color: var(--faint); }
.search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: var(--radius); }
.search-hint { margin-top: 8px; }
.found-list { display: grid; gap: 4px; margin-top: 10px; }
.found-list:empty { display: none; }
.found-group { display: grid; }
.found-also { margin: 6px 14px 8px; font-size: 13px; color: var(--muted); }
.found { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; background: var(--surface); border: 1px solid transparent; text-decoration: none; }
.found:hover, .found:focus-visible { border-color: var(--accent); }
.found > span:last-child:not(.found-text) { color: var(--muted); font-size: 13px; text-align: right; }
/* The Library start page: five shelves. A shelf is a name and its pages. */
.shelves { display: grid; gap: 22px; }
.shelf-name { margin: 0 0 10px; font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.topics { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.topic { display: flex; align-items: center; gap: 18px; height: 100%; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid transparent; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
@media (hover: hover) { .topic:hover { border-color: var(--line-hover); transform: translateY(-1px); } }
.topic-thumb { flex: 0 0 150px; pointer-events: none; }
.topic-thumb svg { display: block; width: 100%; height: auto; }
.thumb-circle { max-width: 104px; margin: 0 auto; }
.thumb-circle circle { fill: var(--surface-3); }
.thumb-circle .in-key { fill: color-mix(in srgb, var(--q-major) var(--q-mix), var(--surface-3)); }
.thumb-circle .is-tonic { fill: var(--q-major); }
.topic-text { min-width: 0; }
.topic-text h3 { margin: 0; font-size: 18px; font-weight: 700; }
.topic-no { flex: none; display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0; }
.topic-start { display: inline-block; margin-top: 6px; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft-2); color: var(--accent-text); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.topic-text p { margin-top: 5px; color: var(--muted); font-size: 14px; }
.topic-text .topic-last { color: var(--accent-text); font-size: 14px; }
/* A card has a short line for a small tile and a full line for the rest. */
.topic-text .topic-short { display: none; }

/* Circle of fifths. The wheel turns the chosen key to the top; the words turn back so they stay upright.
   The seven chords of the key are filled with the color of their kind. The other keys are dim. */
.circle-wrap { display: grid; grid-template-columns: minmax(280px, 440px) minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 18px; }
.keys-main > .lib-section:first-child { margin-top: 0; }
.keys-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.circle { width: 100%; height: auto; display: block; }
.circle .wheel { transform: rotate(var(--turn, 0deg)); transition: transform .55s cubic-bezier(.3, .7, .2, 1); }
.circle .cell-text { transform: rotate(calc(-1 * var(--turn, 0deg))); transition: transform .55s cubic-bezier(.3, .7, .2, 1); }
.circle-note { margin-top: 10px; font-size: 14px; color: var(--muted); max-width: 44ch; }
.circle .cell path { fill: var(--ring-major); stroke: var(--ring-gap); stroke-width: 2; transition: fill .15s; }
.circle .ring-minor path { fill: var(--ring-minor); }
.circle .in-key path { fill: color-mix(in srgb, var(--q, var(--accent)) var(--q-mix), var(--bg)); }
.circle .is-tonic path { fill: var(--q, var(--accent)); }
.circle .cell[role="link"] { cursor: pointer; outline: none; }
.circle .cell[role="link"]:not(.in-key):hover path, .circle .cell[role="link"]:not(.in-key):focus-visible path { fill: var(--surface-3); }
.circle .in-key[role="link"]:not(.is-tonic):hover path, .circle .in-key[role="link"]:not(.is-tonic):focus-visible path { fill: color-mix(in srgb, var(--q, var(--accent)) 62%, var(--bg)); }
.circle .cell[role="link"]:focus-visible path { stroke: var(--accent); stroke-width: 3; }
.circle .is-tonic[role="link"]:focus-visible path { stroke: var(--text); stroke-width: 4; stroke-dasharray: 7 4; }
.circle text { pointer-events: none; text-anchor: middle; }
.circle .t-name { fill: var(--text); font-size: 21px; font-weight: 700; }
.circle .ring-minor .t-name { fill: var(--muted); font-size: 17.5px; font-weight: 600; }
.circle .in-key .t-name { fill: var(--q-text); font-weight: 700; }
.circle:not(.is-intervals) .cell:not(.in-key) .t-name { fill: var(--faint); opacity: .6; }
.circle:not(.is-intervals) .cell:not(.in-key) .t-sig { opacity: 0; }
.circle .t-num { fill: var(--q-text); opacity: .8; font-size: 13.5px; font-weight: 700; }
.circle .t-sig { fill: var(--faint); font-size: 13px; }
/* A held cell plays its chord: no menu, no text selection, no zoom on a double tap. */
.circle { touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.circle .in-key .t-sig { fill: var(--q-text); opacity: .65; }
.circle .is-tonic .t-name, .circle .is-tonic .t-num, .circle .is-tonic .t-sig { fill: var(--q-ink); opacity: 1; }
/* The tonic of a minor key is blue, and blue takes the ink of a blue note. */
.circle .ring-minor.is-tonic .t-name, .circle .ring-minor.is-tonic .t-num { fill: var(--dot-ink); }
.circle .hub { fill: var(--bg); }
.circle .t-hub { fill: var(--text); font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.circle .t-hub-sub { fill: var(--muted); font-size: 13.5px; }
.circle .t-hub-sig { fill: var(--accent-text); font-size: 13.5px; font-weight: 700; }
.circle .hot { fill: color-mix(in srgb, var(--live) 24%, transparent); stroke: var(--live); stroke-width: 3.5; stroke-linejoin: round; pointer-events: none; }

/* Train hub */
.today { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; padding: 20px 22px; border-radius: var(--radius); background: var(--surface); }
.today-goal { flex: 1 1 300px; min-width: 0; display: grid; gap: 10px; }
.today-goal b { font-size: 28px; line-height: 1.1; margin-right: 6px; letter-spacing: -.02em; }
.today-goal span { font-size: 14px; color: var(--muted); }
.goal-neck { display: block; width: 100%; height: auto; }
.goal-dot { fill: var(--accent); stroke: var(--board); stroke-width: 2; }
.goal-neck.is-done .goal-dot { fill: var(--ok); }
.today .stat b { font-size: 28px; display: block; line-height: 1.1; letter-spacing: -.02em; }
.today .stat span { font-size: 13px; color: var(--muted); }
.today-section { margin-top: 30px; }
.drill-row .drill-why { color: var(--accent-text); font-size: 13px; font-weight: 600; }
/* Today: Next up in one row on a wide screen, and the four tracks as cards. */
@media (min-width: 700px) { .next-list { grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); } }
.track-cards { margin-top: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.track-card { align-content: start; }
.track-card .meter-bar { flex: 1 1 auto; }
@media (max-width: 699px) { .track-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* A track page on a wide screen: its drills in two columns that fill top to bottom, so no card stands alone on a row. */
@media (min-width: 700px) { .drill-list.track-page { display: block; columns: 2; column-gap: 8px; } .track-page > .drill-row { break-inside: avoid; margin-bottom: 6px; } }
.track-intro { color: var(--muted); font-size: 14px; margin-top: 4px; }
.drill-list { margin-top: 12px; display: grid; gap: 6px; }
.drill-row { display: grid; gap: 4px; padding: 13px 14px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s, background-color .15s; }
@media (hover: hover) { .drill-row:hover { border-color: var(--line-hover); transform: translateY(-1px); } }
.drill-row h3 { font-size: 16px; }
.drill-row p { color: var(--muted); font-size: 14px; }
.drill-row .meter { margin-top: 4px; }
.meter { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.meter-bar { flex: 0 1 96px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.empty { display: grid; gap: 14px; justify-items: start; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; }
.empty p { color: var(--muted); max-width: 60ch; }

/* Drill screen */
.drill { max-width: 980px; }
.drill-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.drill-bar .btn .icon { width: 17px; height: 17px; }
.drill-stats { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.drill-stats span { padding: 5px 11px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid transparent; }
.drill-stats b { color: var(--text); font-size: 14px; margin-right: 5px; }
.drill-stats .is-hot { border-color: var(--accent); background: var(--accent-soft); }
.drill-stats .is-hot b { color: var(--accent-text); }
.prompt { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; }
.prompt-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.prompt h2 { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.prompt .sub { color: var(--muted); margin-top: 4px; }
.prompt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Answers: large tiles. After an answer the right one gets a check, a wrong choice a cross. */
.answers { --min: 124px; --cols: 6; --gap: 8px; display: flex; flex-wrap: wrap; gap: var(--gap); margin-top: 18px; }
.answers > .answer { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); min-width: 0; }
/* A last row that is not full sits in the middle. */
.answers[data-rows="many"] { justify-content: center; }
.answer { display: grid; gap: 1px; justify-items: start; align-content: center; padding: 11px 13px; min-height: 66px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); text-align: left; position: relative; transition: background-color .15s, border-color .15s, transform .1s, opacity .2s; }
@media (hover: hover) { .answer:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-hover); transform: translateY(-1px); } }
.answer:active:not(:disabled) { transform: translateY(1px); }
.answer b { font-size: 18px; letter-spacing: -.01em; }
.answer span { font-size: 13px; color: var(--muted); }
.answer .kbd { position: absolute; top: 8px; right: 8px; }
.answer[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.answer.is-playing { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft-2); background: var(--accent-soft); }
.answer:disabled { opacity: .42; cursor: default; }
.answer.is-correct, .answer.is-wrong { opacity: 1; }
.answer.is-correct { border-color: var(--ok); background: var(--ok-soft); animation: pop .32s ease-out; }
.answer.is-wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .32s ease-out; }
.answer.is-correct .kbd, .answer.is-wrong .kbd { display: none; }
.answer-mark { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; padding: 3px; border-radius: 50%; stroke-width: 3; color: var(--accent-ink); }
.is-correct .answer-mark { background: var(--ok); }
.is-wrong .answer-mark { background: var(--bad); }
@keyframes pop { 40% { transform: scale(1.04); } }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
/* Before an answer the box holds only a tip. After it, a result box. */
.feedback { margin-top: 14px; min-height: 50px; }
.feedback:not(.result) { padding: 4px 2px; color: var(--muted); }
/* A new question comes in with a short fade. */
.prompt-wrap .q-new { animation: note-in .12s ease-out; }
.result { position: relative; overflow: hidden; display: grid; gap: 12px; padding: 16px 18px; border-radius: 18px; border: 1px solid transparent; background: var(--surface); animation: rise .22s ease-out; }
.result.ok { border-color: var(--ok-edge); background: linear-gradient(180deg, var(--ok-soft), transparent 70%), var(--surface); }
.result.bad { border-color: var(--bad-edge); background: linear-gradient(180deg, var(--bad-soft), transparent 70%), var(--surface); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.result-head { display: flex; align-items: flex-start; gap: 12px; }
.result-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; color: var(--accent-ink); }
.result-icon .icon { width: 20px; height: 20px; stroke-width: 3; }
.ok .result-icon { background: var(--ok); }
.bad .result-icon { background: var(--bad); }
.result-say { display: grid; gap: 1px; min-width: 0; }
.result-verdict { font-size: 14px; font-weight: 700; }
.ok .result-verdict { color: var(--ok-text); }
.bad .result-verdict { color: var(--bad); }
.result-answer { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.result-sub { font-size: 14px; color: var(--muted); }
.result-text { color: var(--muted); max-width: 72ch; }
.result-new { display: inline-flex; align-items: center; gap: 8px; justify-self: start; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 14px; }
.result-new .icon { width: 16px; height: 16px; stroke-width: 2.6; }
.result-visual { border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid transparent; padding: 6px 8px 2px; }
.result .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.result-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--ok) 18%, transparent); }
.result-timer i { display: block; height: 100%; background: var(--ok); transform-origin: left; animation: countdown linear forwards; }
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.drill-help { margin-top: 20px; color: var(--muted); font-size: 14px; }
.drill-help summary { cursor: pointer; color: var(--text); font-weight: 600; }
.drill-help[open] summary { margin-bottom: 8px; }
.drill-help p + p { margin-top: 8px; }
.settings-panel { margin: 0 0 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; display: grid; gap: 14px; }
.settings-panel[hidden] { display: none; }
/* Drill options sit in rows: short controls side by side, long pick lists on their own line. */
.opts { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: flex-start; }
.opts > .field:has(.pickset), .opts > .field:has(.chips) { flex-basis: 100%; }
.opts > label.row { align-self: flex-end; min-height: 40px; font-size: 15px; }
.opts > p { flex-basis: 100%; margin-top: -4px; }
/* Pick lists are chips with a check box inside, so many choices stay compact. */
/* Even rows: the script sets --cols from the width, the same way as for the answers. */
.pickset { --min: 138px; --cols: 6; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; max-width: calc(var(--cols) * 176px); }
/* A wide list has long names. On a phone the second name is not shown, so only a long first name counts there. */
.pickset[data-wide="true"] { --min: 200px; --cols: 4; max-width: calc(var(--cols) * 240px); }
.pickset label { white-space: nowrap; overflow: hidden; }
/* An odd last item takes its whole row, so it does not stand alone. */
.pickset[data-lone="true"] > label:last-child { grid-column: 1 / -1; }
.pickset label { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 9px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background-color .15s; }
@media (hover: hover) { .pickset label:hover { border-color: var(--line-hover); } }
.pickset label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pickset input[type="checkbox"] { width: 15px; height: 15px; margin: 0; }
.pickset b { font-weight: 600; }
.pickset .muted { font-size: 13px; }
.timer { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 14px; overflow: hidden; }
.timer i { display: block; height: 100%; width: 0; background: var(--accent); }
/* The end of a session comes in as the result card does. */
.done-panel { text-align: center; padding: 36px 20px; animation: rise .25s ease-out; }
.done-panel h2 { font-size: 28px; margin-bottom: 8px; }
.done-panel .stats-row { display: flex; justify-content: center; gap: 30px; margin: 18px 0; flex-wrap: wrap; }
.done-panel .stats-row b { display: block; font-size: 28px; letter-spacing: -.02em; }
.done-panel .stats-row span { color: var(--muted); font-size: 13px; }
.missed { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0 20px; }
.missed-visual { margin: 0 0 20px; text-align: left; }
.done-actions { justify-content: center; gap: 10px; }
.start-sound { margin: 2px 0; }

/* Tools */
.tempo-row { display: flex; align-items: center; gap: 12px; width: min(460px, 100%); }
.tempo-row input { flex: 1; min-width: 0; }
.bpm { display: block; font-size: 60px; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
input.bpm { width: 3.2ch; margin: 0 auto; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--text); font-family: inherit; text-align: center; -moz-appearance: textfield; appearance: textfield; }
input.bpm::-webkit-outer-spin-button, input.bpm::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.bpm:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.beats { display: flex; gap: 12px; }
.beats i { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); }
.beats i.on { background: var(--text); }
.beats i.on.first { background: var(--live); }

/* Settings page */
.settings { max-width: 760px; }
@media (min-width: 661px) { .settings .field { grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 6px 16px; } }

/* Progress table */
.table { width: 100%; max-width: 900px; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; }
.heat { display: inline-block; width: 46px; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.heat i { display: block; height: 100%; }

/* Narrow screens */
/* Four practice links fit one row only when their label has a line of its own. */
@media (max-width: 760px) { .practice-label { flex-basis: 100%; } }
@media (max-width: 980px) {
  .circle-wrap { grid-template-columns: minmax(0, 1fr); }
  .circle-col { max-width: 440px; width: 100%; margin: 0 auto; }
  .keys-more { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 660px) {
  /* The bar scrolls away with the page, so a neck that stays in view has the room. A filter on the bar would hold the
     fixed tab bar inside it, so the bar is solid. A strip covers the status bar of an installed app. */
  .topbar { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  body::before { content: ""; position: fixed; z-index: 21; left: 0; right: 0; top: 0; height: env(safe-area-inset-top); background: var(--bg); }
  .topbar-inner { padding: 0 16px; height: 54px; }
  /* The sections become a tab bar that floats at the bottom, in reach of the thumb. The page fades out under it. */
  .topbar nav { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); justify-content: space-around; gap: 0; padding: 5px; border-radius: var(--radius); background: color-mix(in srgb, var(--surface-2) 86%, transparent); box-shadow: var(--shadow); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
  .topbar nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 12px; border-radius: var(--radius-sm); }
  .topbar nav a[aria-current="true"] { background: var(--surface-3); color: var(--accent-text); }
  .nav-icon { display: block; }
  body::after { content: ""; position: fixed; z-index: 19; left: 0; right: 0; bottom: 0; height: calc(104px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 45%, transparent); pointer-events: none; }
  main { padding: 20px 16px calc(104px + env(safe-area-inset-bottom)); }
  h1, .lib-title h1 { font-size: 28px; }
  .page-head h1 { font-size: 40px; letter-spacing: -.04em; }
  /* The name of a chord, a key or a triad is large. A subtitle stands beside its name when it fits. */
  .lib-title h1[data-big] { font-size: 46px; line-height: 1; font-weight: 800; letter-spacing: -.045em; }
  .lib-title { align-items: center; }
  .lib-title > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
  .lib-title .lib-sub { margin-top: 0; }
  /* The topics are one row that scrolls to the screen edge. */
  .lib { gap: 14px; }
  .lib-tabs { margin: -4px -16px -4px -4px; padding: 4px 16px 4px 4px; gap: 2px; }
  .lib-tabs a { padding: 7px 11px; font-size: 14px; }
  /* On a phone the five shelves take the whole first row, and the search button stands at the end of the second. */
  .lib-nav-two { grid-template-columns: minmax(0, 1fr) auto; }
  .lib-nav-two .lib-shelves { grid-column: 1 / -1; grid-row: 1; margin-left: -4px; }
  .lib-nav-two .lib-shelves a { padding: 7px 8px; }
  .lib-nav-two .lib-pages { grid-column: 1; grid-row: 2; margin-left: -4px; margin-right: 0; padding-right: 4px; }
  .lib-nav-two .lib-home-link { grid-column: 2; grid-row: 2; }
  .lib-play .btn { min-height: 38px; padding: 6px 12px; font-size: 14px; }
  /* The neck comes first and the choices follow it, in reach of the thumb. The choices have no box here. */
  .lib-stage:has(svg.fb-horizontal) { display: flex; flex-direction: column-reverse; }
  /* A flat neck stays at the top of the screen while the choices scroll under it, so you see what a choice changes. */
  .lib-stage > :not(.controls):has(svg.fb-horizontal) { position: sticky; z-index: 5; top: env(safe-area-inset-top); background: var(--bg); }
  /* A choice fades as it goes under the neck. */
  .lib-stage > :not(.controls):has(svg.fb-horizontal)::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; background: linear-gradient(var(--bg), transparent); pointer-events: none; }
  /* The choices: letters, then sharp or flat beside the labels, then the types and the position. */
  .controls { margin: 12px 0 4px; padding: 0; gap: 10px 12px; background: none; }
  .ctl { flex-direction: column; align-items: stretch; gap: 5px; }
  .ctl-plain .ctl-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ctl-root, .ctl-wide { flex: 1 1 100%; }
  .ctl-wide-only { display: none; }
  .ctl > .seg { align-self: flex-start; }
  .letters { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .letters .chip, .grid-chips .chip { min-height: 40px; }
  .grid-chips { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
  .seg button { padding: 6px 8px; }
  .slots { gap: 5px; }
  .slots .chip { font-size: 15px; }
  .types .chip { padding: 5px 10px; }
  .types .more { max-width: none; flex: 1 1 136px; width: 136px; min-width: 136px; }
  .formula { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); max-width: calc(var(--cols) * 70px); }
  .chord-strip .chord-btn b { font-size: 14px; }
  .chord-strip .chord-btn small { font-size: 12px; }
  .chord-panel { align-items: flex-start; padding: 12px; gap: 12px; }
  .chord-panel .neck { flex-basis: 150px; }
  .topic { padding: 12px; gap: 14px; }
  .topic-thumb { flex-basis: 108px; }
  .topic-text h3 { font-size: 16px; }
  .shelves { gap: 18px; }
  .shelf-name { margin-bottom: 8px; }
  /* The Library start page: tiles, two in a row, with the picture above the name and no line of text.
     An odd last page of a shelf takes the whole row and keeps its text, so no tile stands alone. */
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* The tiles say what the page holds, so its opening line gives them its room. */
  .lib-home .page-head { margin-bottom: 16px; }
  .lib-home .lede-more { display: none; }
  .topics > li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .topics > li:not(:last-child:nth-child(odd)) .topic { flex-direction: column; align-items: stretch; gap: 10px; }
  .topics > li:not(:last-child:nth-child(odd)) .topic-thumb { flex: none; height: 66px; display: flex; align-items: center; justify-content: center; }
  .topics > li:not(:last-child:nth-child(odd)) .topic-thumb .neck-scroll { height: 100%; display: flex; justify-content: center; overflow: visible; }
  .topics > li:not(:last-child:nth-child(odd)) .topic-thumb svg { width: auto; height: 100%; max-width: 100%; }
  .topics > li:not(:last-child:nth-child(odd)) .topic-text .topic-line { display: none; }
  .topics > li:not(:last-child:nth-child(odd)) .topic-text .topic-short { display: block; margin-top: 3px; font-size: 13px; line-height: 1.3; }
  .prompt { padding: 16px; border-radius: var(--radius); }
  .prompt h2 { font-size: 22px; }
  /* Three sound buttons fit one row: the key hints go, a phone has no keys. */
  .prompt-actions { gap: 6px; }
  .prompt-actions .btn { padding: 8px 11px; font-size: 14px; }
  .prompt-actions .kbd { display: none; }
  .answers { --min: 58px; --cols: 4; --gap: 6px; }
  .answers[data-long="true"] { --min: 104px; --cols: 3; }
  .answer { min-height: 54px; padding: 8px 10px; }
  /* The second line stays on a phone, small: "M3" alone says nothing to a new player. */
  .answer span:not(.kbd) { font-size: 11px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .answer .kbd { display: none; }
  .answer-mark { top: 6px; right: 6px; width: 18px; height: 18px; }
  .result { padding: 14px; scroll-margin-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .result-answer { font-size: 20px; }
  .result .actions .btn-primary { flex: 1 1 100%; min-height: 48px; }
  /* Four stats in one row, the number over its name. */
  /* Pick lists become a grid of short tiles. The fill shows what is chosen, so the check box is not drawn. */
  .pickset, .pickset[data-wide="true"] { --min: 44px; --cols: 5; gap: 5px; max-width: none; }
  .pickset[data-long="true"] { --min: 130px; --cols: 2; }
  /* A long name takes two lines; it is not cut. */
  .pickset[data-long="true"] label { white-space: normal; line-height: 1.2; }
  .pickset label { justify-content: center; min-height: 40px; padding: 8px 4px; border-radius: var(--radius-sm); position: relative; text-align: center; }
  .pickset input[type="checkbox"] { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; }
  .pickset label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .pickset .muted { display: none; }
  /* The drill name and Options on one line, the score boxes under them. */
  .drill-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .drill-bar > .row { display: contents; }
  .drill-bar { gap: 6px 12px; margin-bottom: 10px; }
  .drill-bar h1 { font-size: 24px; }
  /* The counters are one quiet line, so the question starts higher. */
  .drill-stats { display: flex; flex-wrap: nowrap; justify-content: space-between; grid-column: 1 / -1; grid-row: 2; gap: 10px; }
  .drill-stats span { display: inline-flex; align-items: baseline; gap: 4px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; font-size: 12px; white-space: nowrap; }
  .drill-stats b { margin: 0; font-size: 14px; }
  .drill-stats .is-hot { background: none; color: var(--accent-text); }
  .drill-stats .stat-long { display: none; }
  /* A narrow phone has room for three counters: the typical time goes. */
  @media (max-width: 389px) { .drill-stats span:nth-child(3) { display: none; } }
  /* Cards are one row that you swipe: one in view and most of the next, so the chart in a card stays readable. */
  .cards { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 10px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .cards::-webkit-scrollbar { display: none; }
  .cards > * { flex: 0 0 56%; min-width: 0; scroll-snap-align: start; scroll-margin-left: 16px; }
  .cards > :first-child:nth-last-child(2), .cards > :first-child:nth-last-child(2) ~ * { flex-basis: calc(50% - 4px); }
  .card { padding: 10px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  /* Two links in a row, so two or four of them fill their rows. */
  .practice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .practice-label { grid-column: 1 / -1; }
  /* Three links take three columns, so none is left alone on a row. */
  .practice[data-n="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .practice .chip { justify-content: center; text-align: center; border-radius: 12px; padding: 6px 8px; line-height: 1.25; }
  .named .formula { max-width: none; }
  .done-actions .btn { flex: 1 1 100%; }
  /* A results table becomes rows: the name, then its numbers side by side, each under its label. */
  .table-stack, .table-stack tbody { display: block; max-width: none; }
  .table-stack thead { display: none; }
  .table-stack tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 8px; padding: 11px 0; border-bottom: 1px solid var(--line); }
  .table-stack td { display: block; padding: 0; border: 0; font-size: 14px; }
  .table-stack td:first-child { grid-column: 1 / -1; font-size: 15px; font-weight: 600; }
  .table-stack td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; line-height: 1.3; color: var(--muted); }
}
/* A long chip in the panel drops its second word, so it keeps its row. */
@media (max-width: 350px) {
  .seg button { padding: 6px 6px; font-size: 14px; }
  .types .chip { padding: 5px 8px; font-size: 14px; }
  .seg-word { display: none; }
}
/* A phone held sideways: wide but low. The bar scrolls away, and the neck comes before the choices. */
@media (orientation: landscape) and (max-height: 500px) {
  .topbar { position: static; }
  .topbar-inner { height: 46px; }
  .topbar nav { position: static; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  body::before, body::after { display: none; }
  .topbar nav a { flex: none; flex-direction: row; gap: 7px; padding: 4px 11px; font-size: 14px; border-radius: var(--radius-sm); }
  .topbar nav a[aria-current="true"] { color: var(--text); background: var(--surface-3); }
  .nav-icon { display: none; }
  main { padding-top: 10px; padding-bottom: 40px; }
  h1, .page-head h1, .lib-title h1, .lib-title h1[data-big] { font-size: 22px; font-weight: 700; letter-spacing: -.035em; }
  .lib { gap: 8px; }
  .lib-tabs a { padding: 5px 11px; font-size: 14px; }
  .lib-home-link { width: 32px; height: 32px; }
  .lib-title { align-items: center; }
  .lib-title { flex-wrap: nowrap; }
  .lib-title > div:first-child { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 12px; flex: 1 1 0; min-width: 0; overflow: hidden; }
  .lib-title h1 { flex: none; }
  .lib-sub { margin-top: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lib-title > .seg, .lib-play { flex: none; flex-wrap: nowrap; }
  /* The circle beside the chords of the key, as large as the screen is high. */
  .circle-wrap { grid-template-columns: minmax(0, max(260px, calc(100vh - 110px))) minmax(0, 1fr); grid-template-columns: minmax(0, max(260px, calc(100dvh - 110px))) minmax(0, 1fr); gap: 20px; margin-top: 8px; }
  .circle-col { max-width: none; margin: 0; }
  .circle-note { display: none; }
  .lib-play .btn { min-height: 32px; padding: 4px 11px; font-size: 14px; }
  .lib-stage { display: flex; flex-direction: column-reverse; }
  .lib-stage .controls { margin: 8px 0 0; padding: 14px 16px; background: var(--surface); }
  .lib-stage .neck { padding: 2px 0 4px; }
  .lib-stage > :not(.controls):has(svg.fb-horizontal) { position: relative; }
  .lib-stage > :not(.controls):has(svg.fb-horizontal)::after { display: none; }
  .lib-stage svg.fb-horizontal { max-height: max(150px, calc(100vh - 142px)); max-height: max(150px, calc(100dvh - 142px)); }
  /* The row of layer chips under the neck stays on the screen too. */
  .lib-stage .neck:has(.neck-tools) svg.fb-horizontal { max-height: max(150px, calc(100vh - 182px)); max-height: max(150px, calc(100dvh - 182px)); }
  /* A drill: the neck on the left, the question and its answers on the right. */
  .drill .crumb, .drill .page-subnav { display: none; }
  .drill-bar { display: flex; margin-bottom: 8px; gap: 6px 12px; }
  .drill-bar > .row { display: flex; width: auto; }
  .drill-stats { display: flex; flex: none; }
  .drill-stats span { display: inline; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 13px; }
  .drill-stats b { margin-right: 5px; font-size: 14px; }
  /* Two numbers, so the title, the numbers and the options stay in one row. */
  .drill-stats span:nth-child(n+3) { display: none; }
  .drill-bar, .drill-bar > .row { flex-wrap: nowrap; }
  .drill-bar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .prompt { padding: 12px 14px; }
  .prompt h2 { font-size: 20px; }
  .prompt .neck { padding: 2px 0 4px; }
  .prompt-board svg.fb-horizontal { max-height: max(150px, calc(100vh - 178px)); max-height: max(150px, calc(100dvh - 178px)); }
  /* The card is the whole box here: the neck on the left; the question, the answers and the result on the right.
     So the neck stays in view when the result comes. */
  .prompt-wrap:has(.prompt-board:not(:empty)):has(.answers:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "board top" "board answers" "board feedback"; column-gap: 16px; align-items: start; padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 1px solid transparent; }
  .prompt-wrap:has(.prompt-board:not(:empty)):has(.answers:not([hidden])) .prompt { display: contents; }
  .prompt-wrap:has(.prompt-board:not(:empty)):has(.answers:not([hidden])) .prompt-top { grid-area: top; }
  .prompt-wrap:has(.prompt-board:not(:empty)):has(.answers:not([hidden])) .prompt-board { grid-area: board; min-width: 0; }
  /* A short neck fits its column, so it does not scroll here. */
  .prompt-wrap:has(.prompt-board:not(:empty)):has(.answers:not([hidden])) .prompt-board svg.fb { min-width: 0 !important; }
  .prompt-wrap:has(.prompt-board:not(:empty)):has(.answers:not([hidden])) .answers { grid-area: answers; margin-top: 10px; }
  .prompt-wrap:has(.prompt-board:not(:empty)):has(.answers:not([hidden])) .feedback { grid-area: feedback; margin-top: 8px; min-height: 0; }
  .prompt-wrap:has(.prompt-board:not(:empty)):has(.answers:not([hidden])) .result { padding: 10px 12px; gap: 8px; box-shadow: none; border-radius: var(--radius-sm); }
  /* No tab bar at the bottom here, so the result needs no room for it. */
  .result { scroll-margin-bottom: 8px; }
  .result-icon { width: 28px; height: 28px; }
  .result-icon .icon { width: 16px; height: 16px; }
  .result-answer { font-size: 18px; }
  .result-text { font-size: 14px; }
  .answers { --min: 58px; --gap: 6px; }
  .answers[data-long="true"] { --min: 104px; }
  .answer { min-height: 46px; padding: 7px 10px; }
  .answer span:not(.kbd) { display: none; }
}
/* Key hints help only with a keyboard. */
@media (hover: none) and (pointer: coarse) { .drill-keys, .kbd, .mouse-only { display: none; } }

/* Settings: one note picker for each string of a custom tuning, low string first. */
.tuning-edit { display: grid; grid-template-columns: repeat(var(--strings, 6), minmax(0, 1fr)); gap: 6px; }
.tuning-edit label { display: grid; gap: 2px; justify-items: center; }
.tuning-edit select { width: 100%; min-width: 0; padding-left: 4px; padding-right: 4px; }
/* The smallest phones: the choices and the start of the neck share the first screen. The subtitle goes and the
   panel is tighter. Buttons keep their size. */
@media (max-width: 360px) {
  .lib-title { flex-wrap: nowrap; align-items: center; }
  .lib-sub { display: none; }
  .lib-title h1 { font-size: 24px; }
  .lib-title h1[data-big] { font-size: 34px; }
  .controls { gap: 8px 8px; margin: 8px 0 4px; }
  .lib-nav { margin-bottom: 4px; }
}

/* Keys: chords from outside the key, in small groups under the chords of the key. */
.outside { display: grid; gap: 10px; margin-top: 10px; }
.outside-group p { margin: 0 0 6px; }
/* Chords: the pickers of the drop voicings sit side by side above their cards. */
.drop-pick { gap: 8px; margin: 4px 0 12px; }

/* Scales for chords: the add row and the list of chords, each with a remove button. */
/* How to read the pictures: the points under each picture, the two chord diagrams and the tab with its button. */
.read-list { display: grid; gap: 6px; max-width: 72ch; margin: 12px 0 0; padding-left: 20px; }
.read-cards { max-width: 520px; }
.read-tab { align-items: center; gap: 12px; }
/* Scales for chords: a line to type chords in, and under it the chips to tap them. */
.fit-form { display: flex; align-items: center; gap: 8px; max-width: 640px; margin-top: 14px; }
.fit-typed { flex: 1; min-width: 0; min-height: 46px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; -webkit-appearance: none; appearance: none; }
.fit-typed::placeholder { color: var(--faint); }
.fit-typed:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fit-said { margin: 6px 0 0; }
.fit-said:empty { display: none; }
.fit-add .controls { margin-top: 10px; }
/* The chord types: one row on a wide screen. On a phone eight types make two rows of four, and six two rows of three. */
@media (max-width: 660px) { .fit-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); } .fit-types[style*="--n:6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); } .fit-types .chip { justify-content: center; padding-inline: 4px; } }
/* Links to scales: the modes from bright to dark, and every scale in its group. */
.scale-links .chip small { margin-left: 6px; color: var(--accent-text); font-weight: 700; }
.scale-links .chip[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft-2); }
.scale-group { margin-top: 12px; }
.scale-group .ctl-label { display: block; margin-bottom: 6px; }
/* Ready progressions: a fold with the chips of two keys. */
.fit-ready { margin-top: 10px; }
.fit-ready summary { width: fit-content; padding: 6px 0; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.fit-ready .ctl { align-items: flex-start; margin-top: 8px; }
.fit-ready .ctl-label { min-width: 62px; padding-top: 10px; }
/* Chord to chord: the row of your chords, the neck with one step, and the words for that step. */
.changes-strip { margin: 0 0 4px; }
.changes-pick { border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; flex: 1; }
.fit-chord[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft-2); }
.changes-step { margin: 6px 0 0; min-height: 1.5em; }
.changes-steps { gap: 8px; margin-top: 8px; }
.fb-link.is-move { stroke: var(--accent-line); stroke-width: 2.6; }
.fb-arrow { fill: var(--accent-line); }
/* The answer: the one scale to play, in large type, and the notes that change. */
.fit-answer { margin: 14px 0 4px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); }
.fit-answer p { margin: 0 0 8px; }
.fit-answer > :last-child { margin-bottom: 0; }
.fit-answer .fit-play { font-size: 20px; line-height: 1.3; }
.fit-play b { color: var(--accent-text); }
.fit-changes ul { margin: 0 0 8px; padding-left: 20px; }
.fit-chords { margin: 4px 0 12px; }
.lib-title + .fit-chords { margin-top: 14px; }
.fit-chord { padding-right: 4px; }
.fit-remove { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; min-width: 28px; min-height: 28px; border-radius: 999px; }
.fit-remove:focus-visible { outline: 2px solid var(--accent); }
/* The line on the Library start page that names the site for the other instrument. */
.lib-other { margin-top: 26px; }
/* Bass line: the three switches of the band stay on one row. */
.band-parts { gap: 6px; flex-wrap: nowrap; }
/* Bass line: the two buttons for the chord you tapped. The switch for half a bar is orange when it is on. */
.line-chord { align-items: center; gap: 6px; margin-top: 4px; }
.line-half[aria-pressed="true"] { color: var(--accent); }

/* Share: a small menu under the share button of a page. */
.share { position: relative; }
.share > summary { list-style: none; cursor: pointer; }
.share > summary::-webkit-details-marker { display: none; }
/* The share button of a Library page sits in the top bar, beside the sound switch, and looks like it. */
.page-tools { display: flex; }
.page-tools:empty { display: none; }
.page-tools .share > summary { display: grid; place-items: center; width: 38px; height: 38px; min-height: 0; padding: 0; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); color: var(--muted); }
.page-tools .share[open] > summary { color: var(--text); border-color: var(--line-hover); }
@media (hover: hover) { .page-tools .share > summary:hover { color: var(--text); border-color: var(--line-hover); } }
.share-menu { position: absolute; right: 0; top: calc(100% + 10px); z-index: 20; display: grid; gap: 6px; padding: 8px; min-width: 230px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.share-menu .btn { justify-content: flex-start; white-space: nowrap; }
/* Print: the title, the neck and the facts of a page, without the menus and the choices. */
@media print {
  .topbar, .bottom-nav, nav, .lib-nav, .controls, .neck-tools, .neck-turn, .neck-names, .practice, .lib-play, .piano-box, .backing-row, .prog-list, .drone, .share, .search-box { display: none !important; }
  body { background: #fff; }
  .neck-scroll { overflow: visible !important; -webkit-mask-image: none !important; mask-image: none !important; }
  .neck svg.fb { min-width: 0 !important; width: 100% !important; max-height: none !important; }
  .lib-section, .card, .neck { break-inside: avoid; }
  /* Hints to tap and loops to play do nothing on paper. */
  .lib-main p[aria-live], .lib-section:has(.prog-list), .lib-section:has(.backing-row) { display: none !important; }
}

/* Drums beside the tempo. */
.tempo .chip { margin-left: 6px; }
/* Compare: the notes of the second scale are dashed rings. */
.fb-compare .fb-dot { fill: var(--board); stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3.5 2.5; }
.fb-compare .fb-label { fill: var(--accent-text); font-weight: 700; }
/* A scale position as tab. */
.tab { width: fit-content; max-width: 100%; margin: 0; padding: 12px 14px; overflow-x: auto; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid transparent; font: 600 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); }

/* Read the staff: a treble staff above the neck. */
.staff { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto 6px; }
.staff-line { stroke: var(--text); stroke-width: 1.2; opacity: .75; }
.staff-clef { fill: var(--text); font-size: 64px; font-family: "Noto Music", "Bravura", "Apple Symbols", "Segoe UI Symbol", serif; }
/* The bass clef is a smaller sign than the treble clef: its two dots sit around the fourth line. */
.staff-clef-bass { font-size: 44px; }
.staff-acc { fill: var(--text); font-size: 17px; font-weight: 700; }
.staff-note { fill: var(--text); }

/* Tuner: a gauge from 50 cents low to 50 cents high, the note, and the strings of the tuning. */
.tuner { display: grid; justify-items: center; gap: 10px; margin: 12px 0; padding: 18px 16px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; max-width: 520px; }
.tuner-gauge { width: min(340px, 100%); height: auto; overflow: visible; }
.tuner-arc { fill: none; stroke: var(--line-strong); stroke-width: 10; stroke-linecap: round; }
.tuner-zone { fill: none; stroke: var(--ok); stroke-width: 10; opacity: .55; }
.tuner.is-in .tuner-zone { opacity: 1; }
.tuner-tick { stroke: var(--faint); stroke-width: 1.5; }
.tuner-tick.is-big { stroke: var(--muted); stroke-width: 2.5; }
.tuner-end { font-size: 22px; font-weight: 700; fill: var(--muted); text-anchor: middle; }
.tuner-needle { stroke: var(--faint); stroke-width: 4; stroke-linecap: round; transition: transform .12s ease-out; }
.tuner.is-on .tuner-needle { stroke: var(--accent); }
.tuner.is-near .tuner-needle { stroke: var(--slow); }
.tuner.is-in .tuner-needle { stroke: var(--ok); }
.tuner-hub { fill: var(--text); }
.tuner-name { font-size: 54px; line-height: 1; font-weight: 800; letter-spacing: -.02em; margin-top: -26px; font-variant-numeric: tabular-nums; }
.tuner.is-in .tuner-name { color: var(--ok-text); }
.tuner-detail { text-align: center; min-height: 2.9em; margin: 0; color: var(--muted); max-width: 34ch; }
.tuner.is-in .tuner-detail { color: var(--ok-text); }
/* A thin bar shows that the microphone hears something. */
.tuner-level { width: min(240px, 80%); height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.tuner-level i { display: block; height: 100%; width: 0; background: var(--muted); transition: width .09s linear; }
.tuner.is-on .tuner-level i { background: var(--accent); }
.tuner-strings { display: grid; grid-template-columns: repeat(var(--strings, 6), minmax(0, 1fr)); gap: 6px; width: 100%; }
.tuner-string { position: relative; display: grid; justify-items: center; gap: 1px; padding: 7px 2px 8px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); color: var(--text); cursor: pointer; transition: border-color .15s, background-color .15s; }
.tuner-string small { font-size: 12px; color: var(--faint); font-weight: 600; }
.tuner-string b { font-size: 20px; line-height: 1.1; }
.tuner-string.is-heard { border-color: var(--accent); background: var(--accent-soft); }
.tuner.is-in .tuner-string.is-heard { border-color: var(--ok-edge); background: var(--ok-soft); }
.tuner-check { position: absolute; top: 3px; right: 5px; font-size: 12px; font-weight: 800; color: var(--ok-text); visibility: hidden; }
.tuner-string.is-tuned .tuner-check { visibility: visible; }
@media (hover: hover) { .tuner-string:hover { border-color: var(--line-hover); } }
.tuner-start { width: 100%; justify-content: center; min-height: 48px; font-size: 16px; margin-top: 4px; }

/* Keys: the chords from outside the key fill even rows. */
.outside .chord-row { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 6px; }
/* Scales for chords: the examples fill two columns on a phone. */
@media (max-width: 560px) { .fit-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } .fit-examples .chip { justify-content: center; } }

/* Circle of fifths, intervals view: the inner rings give way to the interval of each note from the key. */
.circle-switches { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 10px; margin: 0 auto 12px; }
.circle.is-intervals .ring-minor, .circle.is-intervals .hot { opacity: 0; pointer-events: none; }
.circle.is-intervals .t-num, .circle.is-intervals .t-sig, .circle.is-intervals .t-hub, .circle.is-intervals .t-hub-sub, .circle.is-intervals .t-hub-sig { opacity: 0; }
.circle.is-intervals .in-key path { fill: var(--ring-major); }
.circle.is-intervals .is-tonic path { fill: var(--accent); }
.iv-cell { cursor: pointer; outline: none; }
.iv-cell path { fill: var(--ring-minor); stroke: var(--ring-gap); stroke-width: 2; transition: fill .2s; }
.iv-cell .t-iv { font-size: 15px; font-weight: 800; fill: var(--muted); pointer-events: none; text-anchor: middle; transition: fill .2s; }
.iv-cell.kind-root .t-iv { fill: var(--root); } .iv-cell.kind-third .t-iv { fill: var(--third); } .iv-cell.kind-fifth .t-iv { fill: var(--fifth); } .iv-cell.kind-seventh .t-iv { fill: var(--seventh); }
.iv-cell[aria-pressed="true"] path { fill: color-mix(in srgb, var(--accent) 16%, var(--ring-minor)); }
.iv-cell.kind-third[aria-pressed="true"] path { fill: color-mix(in srgb, var(--third) 22%, var(--ring-minor)); }
.iv-cell.kind-fifth[aria-pressed="true"] path { fill: color-mix(in srgb, var(--fifth) 22%, var(--ring-minor)); }
.iv-cell.kind-seventh[aria-pressed="true"] path { fill: color-mix(in srgb, var(--seventh) 22%, var(--ring-minor)); }
.iv-cell.kind-other[aria-pressed="true"] path { fill: color-mix(in srgb, var(--muted) 22%, var(--ring-minor)); }
.iv-cell:focus-visible path { stroke: var(--accent); stroke-width: 3; }
@media (hover: hover) { .iv-cell:hover path { fill: var(--surface-3); } }
.iv-shape { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; transform-origin: 0 0; }
.iv-shape.is-open { fill: none; }
.iv-shape.is-new { animation: iv-in .35s cubic-bezier(.3, .7, .2, 1); }
@keyframes iv-in { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: scale(1); } }
.iv-dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.iv-dot.kind-root { fill: var(--root); } .iv-dot.kind-third { fill: var(--third); } .iv-dot.kind-fifth { fill: var(--fifth); } .iv-dot.kind-seventh { fill: var(--seventh); } .iv-dot.kind-other { fill: var(--muted); }
@media (prefers-reduced-motion: reduce) { .iv-shape.is-new { animation: none; } }

.iv-readout { display: grid; gap: 2px; justify-items: center; text-align: center; margin: 8px 0 0; min-height: 3.2em; }
.iv-actions { justify-content: center; gap: 10px; margin-top: 8px; }
.iv-readout b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.iv-readout span { color: var(--muted); font-size: 14px; }
.circle.is-intervals .is-key path { fill: var(--accent); }
.circle.is-intervals .is-key .t-name { fill: var(--accent-ink); }
.circle.is-intervals .is-tonic:not(.is-key) path { fill: var(--ring-major); }
.circle.is-intervals .is-tonic:not(.is-key) .t-name { fill: var(--text); }
/* The smallest phones: three play buttons, such as Up, Down and Together, do not fit beside the title.
   They take the line under it, all three in one row. */
@media (max-width: 360px) {
  .lib-play { flex-wrap: nowrap; }
  .lib-title:has(.lib-play > :nth-child(3)) { flex-wrap: wrap; }
  .lib-play .btn { padding-left: 10px; padding-right: 10px; }
}
/* Play the note: what the microphone hears, under the question. */
.listen { display: grid; gap: 10px; justify-items: center; padding: 12px 0 4px; }
.listen-row { display: flex; align-items: center; gap: 20px; margin: 4px 0; }
.listen-note { font-size: 56px; line-height: 1; font-weight: 800; min-width: 2.6ch; text-align: center; font-variant-numeric: tabular-nums; }
/* The ring around the heard note. It takes no room of its own. */
.listen-note { position: relative; }
.listen-ring { position: absolute; left: -9px; top: -6px; width: calc(100% + 18px); height: calc(100% + 12px); overflow: visible; pointer-events: none; }
.listen-ring rect { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 100; stroke-dashoffset: var(--open, 100); transition: stroke-dashoffset .09s linear; }
/* The note to play, large enough to read from the guitar with the phone on a stand or a table. */
.ask-note { display: grid; justify-items: center; gap: 4px; padding: 6px 0 2px; }
.ask-note b { font-size: clamp(96px, 34vw, 168px); line-height: .95; font-weight: 800; letter-spacing: -.04em; }
.ask-note span { font-size: clamp(28px, 9vw, 44px); line-height: 1.1; font-weight: 700; color: var(--muted); }
.staff.staff-big { max-width: 400px; }
@media (orientation: landscape) and (max-height: 500px) {
  .ask-note { display: flex; justify-content: center; align-items: baseline; gap: 20px; padding: 0; }
  .ask-note b { font-size: 92px; }
  .ask-note span { font-size: 34px; }
  .listen-note { font-size: 44px; }
}
.listen-level { width: 90px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.listen-level i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .09s linear; }
.listen-say { margin: 0; text-align: center; color: var(--muted); font-size: 14px; max-width: 40ch; min-height: 1.5em; }
.mic-pick { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.mic-pick select { min-width: 0; max-width: 250px; }
.listen-octaves { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.listen-octave { padding: 5px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); color: var(--muted); font-weight: 700; font-size: 15px; }
.listen-octave.is-found { border-color: var(--ok-edge); background: var(--ok-soft); color: var(--ok-text); }
/* A phone held sideways: the two switches of the circle keep one row above it. */
@media (orientation: landscape) and (max-height: 500px) {
  .circle-switches { gap: 6px; margin-bottom: 8px; }
  .circle-switches .seg button { padding: 4px 9px; font-size: 14px; min-height: 32px; }
}
/* Settings: the version of the files in use, small and dim. */
.about-links { gap: 8px; }
.site-version { color: var(--faint); font-size: 13px; margin-top: 14px; }
.site-version a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
/* Progress: a bar for each of the last 14 days, with its minutes on top. */
.day-bars { display: flex; align-items: flex-end; gap: 6px; padding: 14px 12px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; }
.day-bar { flex: 1; display: grid; justify-items: center; gap: 4px; min-width: 0; }
.day-bar i { display: block; width: 100%; max-width: 28px; border-radius: 4px; background: var(--surface-3); }
.day-bar.is-some i { background: var(--muted); }
.day-bar.is-goal i { background: var(--ok); }
.day-min { font-size: 12px; font-weight: 700; color: var(--muted); min-height: 1.3em; font-variant-numeric: tabular-nums; }
.day-bar.is-goal .day-min { color: var(--ok-text); }

/* Rhythm: one bar on a single line, as rhythm parts are written. */
.rhythm { display: block; width: 100%; height: auto; }
.rh-line { stroke: var(--line-strong); stroke-width: 1.5; }
.rh-bar { stroke: var(--muted); stroke-width: 1.5; }
.rh-sig { fill: var(--text); font-size: 19px; font-weight: 800; text-anchor: middle; }
.rh-head { fill: var(--text); stroke: var(--text); stroke-width: 1.4; }
.rh-head.is-hollow { fill: var(--surface); }
.rh-stem { stroke: var(--text); stroke-width: 1.6; }
.rh-ink { fill: var(--text); }
.rh-rest-stem { fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; }
.rh-tie { fill: none; stroke: var(--text); stroke-width: 1.5; }
.rh-tuplet { fill: var(--muted); font-size: 12px; font-weight: 700; text-anchor: middle; }
.rh-count { fill: var(--muted); font-size: 12.5px; font-weight: 600; text-anchor: middle; }
.rh-ev.is-on .rh-head, .rh-ev.is-on .rh-stem { fill: var(--accent); stroke: var(--accent); }
.rh-ev.is-on .rh-ink, .rh-ev.is-on .rh-count { fill: var(--accent); }
.rh-ev.is-on .rh-rest-stem { stroke: var(--accent); }
.lesson-text { max-width: 64ch; margin-top: 14px; }
.lesson-text p { margin: 0 0 8px; }
.rhythm-examples { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
@media (max-width: 760px) { .rhythm-examples { grid-template-columns: minmax(0, 1fr); } }
.lesson-chips { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 560px) { .lesson-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); } .lesson-chips .chip { justify-content: center; } }
.rhythm-card { display: grid; gap: 4px; padding: 12px 12px 6px; }
.rhythm-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
/* Strumming: the count over the strokes, one column for each slot of the bar. */
.strum-stage { padding: 14px 10px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; }
.strum-grid { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.strum-cell { display: grid; justify-items: center; gap: 2px; padding: 4px 0 6px; border-radius: 8px; transition: background-color .08s; }
button.strum-cell { font: inherit; color: inherit; background: none; border: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
button.strum-cell:hover { background: var(--surface-2); }
.stroke-tools { display: grid; grid-template-columns: repeat(var(--tools, 5), minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.stroke-tool { display: grid; justify-items: center; gap: 0; padding: 5px 2px 6px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); color: var(--muted); font: 600 12.5px/1.2 var(--font); cursor: pointer; touch-action: manipulation; }
.stroke-tool b { font-size: 18px; line-height: 1.1; color: var(--text); }
/* Six tools in a row, on the bass site: smaller words, so they fit a phone of 320 px. */
.stroke-tools.is-many { gap: 4px; }
.stroke-tools.is-many .stroke-tool { font-size: 11px; padding-left: 0; padding-right: 0; }
.stroke-tool.is-chuck b { color: var(--seventh); } .stroke-tool.is-bass b { color: var(--root); } .stroke-tool.is-accent b { color: var(--accent); } .stroke-tool.is-miss b { color: var(--line-hover); }
.stroke-tool[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft-2); color: var(--text); }
.strum-cell.is-beat { box-shadow: inset 1px 0 0 var(--line); }
.strum-cell:first-child { box-shadow: none; }
.strum-acc { min-height: 1.1em; font-size: 14px; font-weight: 800; color: var(--accent-text); line-height: 1; }
.strum-stroke { font-size: 28px; line-height: 1; font-weight: 800; color: var(--text); }
.strum-grid[style*="--n:16"] .strum-stroke { font-size: 20px; }
/* Sixteenths on a phone: two rows of two beats, so each cell stays big enough to tap. */
@media (max-width: 560px) {
  .strum-grid[style*="--n:16"] { grid-template-columns: repeat(8, minmax(0, 1fr)); row-gap: 8px; }
  .strum-grid[style*="--n:16"] .strum-cell:nth-child(9) { box-shadow: none; }
  .strum-grid[style*="--n:16"] .strum-stroke { font-size: 24px; }
}
.strum-cell.is-ghost .strum-stroke { color: var(--line-hover); font-weight: 400; }
.strum-cell.is-chuck .strum-stroke { color: var(--seventh); }
.strum-cell.is-bass .strum-stroke { color: var(--root); font-size: 22px; }
.strum-cell.is-accent .strum-stroke { color: var(--accent); }
.strum-count { font-size: 13px; font-weight: 700; color: var(--muted); }
.strum-cell.is-beat .strum-count { color: var(--text); }
.strum-cell.is-on { background: var(--accent-soft-2); }
.strum-notes { margin: 6px auto 0; max-width: 520px; }
.strum-chords { display: flex; justify-content: center; align-items: baseline; gap: 16px; margin-top: 8px; color: var(--muted); font-size: 14px; }
.strum-chords b { font-size: 16px; color: var(--muted); transition: color .08s; }
.strum-chords b.is-now { color: var(--accent-text); }
.strum-chords-pick { gap: 8px; flex-wrap: nowrap; }
.strum-mine { gap: 8px; flex-wrap: nowrap; }
.strum-mine select { flex: 1 1 0; min-width: 0; }
.strum-howto { margin: 12px 0 8px; }
.strum-select { min-width: 0; width: auto; }
.strum-chords-edit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-width: 420px; min-width: 0; }
.strum-chord-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.strum-chord-grid > select.more { width: 100%; min-width: 0; max-width: none; flex: none; padding-left: 9px; padding-right: 20px; background-position: right 4px center; background-size: 14px; }
.strum-prog { display: flex; gap: 8px; align-items: center; }
.strum-prog > select.more { flex: 1 1 0; width: auto; min-width: 0; max-width: none; }
.strum-prog > :not(select) { flex: none; flex-wrap: nowrap; white-space: nowrap; }
.strum-shapes { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 150px)); gap: 10px; }
@media (max-width: 560px) { .strum-shapes[style*="--n:4"] { grid-template-columns: repeat(2, minmax(0, 150px)); } }
.strum-shapes .card { display: grid; gap: 6px; padding: 10px; }
.thumb-strum { width: 100%; height: auto; }
.thumb-strum line, .thumb-strum path { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.thumb-strum .is-down { stroke: var(--accent); }
.thumb-strum .is-up { stroke: var(--third); }
.thumb-strum .is-ghost { stroke: var(--line-strong); }
.thumb-strum .is-dot { stroke: none; }
.thumb-strum .is-dot.is-down { fill: var(--accent); }
.thumb-strum .is-dot.is-up { fill: var(--third); }
/* Metronome: a silent beat shows as a hollow dot, so the beat stays visible through a gap. */
.beats i.on.is-silent { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.metro-modes { margin-top: 10px; }

/* Rhythm drills: notation as answers, and the tap pad. */
.answers-rhythm { display: grid !important; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 700px) { .answers-rhythm { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.answers-rhythm .answer { padding: 4px 8px; min-height: 0; }
.answers-rhythm .answer b { display: block; width: 100%; }
.answers-rhythm .rhythm { width: 100%; }
.tap-box { display: grid; gap: 12px; justify-items: center; margin-top: 8px; }
.tap-box .rhythm { max-width: 420px; }
.tap-say { margin: 0; text-align: center; color: var(--muted); min-height: 1.5em; }
.tap-pad { width: min(100%, 360px); height: 132px; border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface-2); color: var(--muted); font-size: 22px; font-weight: 800; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.tap-pad.is-hit { animation: tap-hit .16s ease-out; }
@keyframes tap-hit { from { background: var(--accent-soft-2); border-color: var(--accent); } to { background: var(--surface-2); border-color: var(--line-strong); } }
.rh-mark.is-good { fill: var(--ok); }
.rh-mark.is-loose { fill: var(--slow); }
.rh-mark.is-miss { fill: var(--bad); }

/* Touch screens: every control is at least 40 px high, so a thumb hits it. A phone held sideways keeps the top row
   at 36 px, because its height is short. */
@media (pointer: coarse) {
  .chip, .types .chip, .letters .chip, .grid-chips .chip, .seg button, .neck-tools .chip, .neck-turn, .circle-switches .seg button { min-height: 40px; }
  .tempo .btn { min-height: 40px; width: 40px; }
  .fit-remove { min-width: 40px; min-height: 40px; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .lib-play .btn { min-height: 36px; }
  .lib-home-link { width: 36px; height: 36px; }
}

/* The play bar: the backing that plays, its chord and Stop, above the tab bar of a phone. */
.play-bar { position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 24px); padding: 6px 6px 6px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .5); font-size: 14px; }
.play-bar[hidden] { display: none; }
.play-bar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; animation: play-dot 1s ease-in-out infinite alternate; }
@keyframes play-dot { to { opacity: .35; } }
.play-bar-name { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-bar-chord { color: var(--live); font-size: 16px; min-width: 2.5em; }
.play-bar .btn { min-height: 36px; padding: 6px 14px; border-radius: var(--radius-sm); }
body.has-play-bar main, body.has-click-bar main, body.has-routine main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
/* The bar of a routine sits above the bar of a loop or of the metronome. */
.routine-bar-name { min-width: 0; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
.routine-bar .btn-icon { min-width: 36px; padding: 6px 0; }
body.has-play-bar .routine-bar, body.has-click-bar .routine-bar { bottom: calc(72px + env(safe-area-inset-bottom)); }
@media (max-width: 660px) { body.has-play-bar .routine-bar, body.has-click-bar .routine-bar { bottom: calc(138px + env(safe-area-inset-bottom)); } }
/* The routine page: its steps in a list, each with its minutes and the buttons to move and remove it. */
.routine-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.routine-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; }
.routine-step[aria-current="true"] { border-color: var(--accent); }
.routine-step-name { flex: 1 1 200px; min-width: 0; display: grid; color: inherit; text-decoration: none; }
.routine-step-name small { font-size: 13px; }
.routine-step-tools { display: flex; gap: 4px; }
.routine-row { align-items: center; gap: 10px 14px; }
.routine-row p { flex: 1 1 240px; margin: 0; }
.routine-group { margin-top: 14px; }
.routine-group h3 { margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.routine-empty { display: grid; gap: 12px; justify-items: start; }
/* The metronome bar: a dot that flashes on the beat, start and pause, the tempo, the page with all settings, close. */
.click-bar { padding: 6px 6px 6px 12px; gap: 6px; }
.click-bar .btn-icon { width: 36px; min-height: 36px; padding: 6px 0; display: grid; place-items: center; }
.click-bar .btn.click-toggle { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.click-bar.is-paused .btn.click-toggle { background: var(--surface-3); color: var(--text); }
.click-toggle .icon { stroke-width: 3; }
.click-toggle .is-filled { fill: currentColor; stroke-width: 1.5; }
.click-bar .play-bar-dot { animation: none; opacity: .3; }
.click-bar .play-bar-dot.is-beat { animation: click-beat .2s ease-out; }
.click-bar .play-bar-dot.is-first { background: var(--accent); }
.click-bar.is-paused .play-bar-dot { opacity: .18; }
@keyframes click-beat { from { transform: scale(2); opacity: 1; } to { transform: scale(1); opacity: .3; } }
@media (max-width: 660px) { .play-bar { bottom: calc(82px + env(safe-area-inset-bottom)); } }
@media (prefers-reduced-motion: reduce) { .play-bar-dot { animation: none; } }
/* A row that needs its name on a phone, such as the boxes of a scale. */
@media (max-width: 660px) { .ctl-plain.ctl-named .ctl-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: nowrap; } .ctl-named { flex-direction: row; align-items: center; } }
.fit-chord small, .fit-more small { color: var(--accent-text); font-weight: 700; }
.fit-chords { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); max-width: calc(var(--cols, 4) * 140px); }
.fit-chords .chip { justify-content: space-between; min-width: 0; padding-right: 4px; }
@media (max-width: 400px) { .fit-chords[style*="--cols:4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.seq-pick { margin: 4px 0 10px; }
.seq-picks { gap: 0 10px; }
.seq-row { gap: 8px 10px; margin-bottom: 6px; }
.seq-actions { gap: 8px; flex-wrap: nowrap; }
.fit-chord-name { display: grid; line-height: 1.15; min-width: 0; padding: 2px 0; }
.fit-chord-name > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fit-chord-name small { font-size: 12px; }

/* Slow down: the player. */
.thumb-wave { width: 100%; height: auto; }
.thumb-wave line { stroke-width: 3; stroke-linecap: round; }
.thumb-wave .is-out { stroke: var(--muted); }
.thumb-wave .is-in { stroke: var(--accent); }
.thumb-wave .is-loop { fill: var(--accent-soft-2); }
.player-source { display: grid; gap: 10px; }
/* With a song open, the box to open another one folds into one button. */
.player-fold > summary { display: none; }
/* With a song open, the title of the page goes and the box to open a song is behind the "Other song" button. */
.player-page.has-song > .lib-title { display: none; }
.player-page.has-song > .player-now { margin-top: 12px; }
.player-fold.is-folded > .controls { margin: 4px 0 14px; }
/* Your songs: the name of a song, and under it what it is. */
.player-recent { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.player-recent:empty { display: none; }
.player-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player-recent-head b { color: var(--text); }
.player-recent-head .btn { flex: none; }
.player-recent-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.player-recent-list li { display: flex; gap: 6px; align-items: center; }
.player-recent-list .player-mark { flex-direction: column; align-items: flex-start; gap: 0; padding-block: 6px; text-align: left; }
.player-recent-list .player-mark b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-recent-list .player-mark-t { font-size: 13px; font-weight: 400; }
.player-recent-list .player-mark[aria-current] { border-color: var(--accent); }
.player-more { justify-self: start; }
/* The dock while Play is off the screen. */
.player-dock { padding: 6px; gap: 6px; }
.player-dock-time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: center; }
.player-dock .chip { min-height: 36px; }
.player-blocked { display: grid; gap: 12px; justify-items: start; }
.player-blocked p { margin: 0; }
.player-open { gap: 8px 10px; align-items: center; }
.player-link { flex: 1 1 260px; min-width: 0; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; }
/* A line in Slow down that says what the page does now, or what went wrong. Busy has a ring that turns, a failure
   has the color of a wrong answer. */
.say { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); scroll-margin: 76px 0 12px; overflow-wrap: anywhere; }
.say[hidden] { display: none; }
.say-text { flex: 1 1 200px; min-width: 0; }
.say.is-bad { border-color: var(--bad-edge); background: var(--bad-soft); }
.say.is-bad .say-text { font-weight: 600; }
.say-turn { flex: none; align-self: center; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: turn .8s linear infinite; }
.say-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.say-close { flex: none; align-self: flex-start; min-height: 32px; width: 32px; padding: 0; margin: -4px -6px -4px 0; }
@keyframes turn { to { transform: rotate(360deg); } }
.player-say { margin: 8px 0 10px; }
/* Download: the panel with the command for your computer, and the steps of the first install. */
.player-get { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; margin: 10px 0; scroll-margin: 76px 0 100px; }
.player-get > .seg { justify-self: start; }
/* In the box to open a song the panel is a part of that box. */
.player-source > .player-get { margin: 6px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line-strong); border-radius: 0; background: none; }
.player-source > .player-get .say-close { margin-right: 0; }
.player-on-computer { margin-top: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.player-on-computer > .seg { justify-self: start; }
.player-on-computer > p { margin: 0; }
.player-get[hidden] { display: none; }
.player-get > p { margin: 0; }
.player-get-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; font-size: 16px; }
.player-get ol { margin: 0; padding-left: 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.player-get li > p { margin: 8px 0 0; }
.player-cmd { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
.player-cmd pre { flex: 1 1 0; min-width: 0; margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-x: auto; user-select: all; -webkit-user-select: all; }
.player-cmd .btn { flex: none; }
.player-cmd code span { white-space: nowrap; }
.player-get code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .93em; overflow-wrap: anywhere; }
.player-install { margin-top: 4px; }
.player-install > ol { margin: 8px 0; }
.player-now { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 8px; font-size: 16px; }
.player-now:empty { display: none; }
.player-now .player-name { flex: 1 1 0; }
.player-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 12px 0 0; }
.player-tabs + .player-controls { margin-top: 8px; }
.player-tap { min-width: 96px; min-height: 48px; }
.player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-media { display: grid; gap: 10px; }
.player-yt iframe { display: block; width: 100%; height: auto; max-height: 60vh; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius-sm); }
.player-video { display: block; width: 100%; max-height: 50vh; border-radius: var(--radius-sm); background: #000; }
/* The waveform and, under it, the strip with the whole song. The colors of both drawings are set here. */
.player-wave, .player-over { display: block; width: 100%; border-radius: var(--radius-sm); background: var(--surface); touch-action: pan-y; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  --wave-wave: var(--line-hover); --wave-played: var(--accent); --wave-loop: var(--accent-soft-2); --wave-mark: var(--seventh); --wave-head: var(--text);
  --wave-edge: var(--accent); --wave-ink: var(--accent-ink); --wave-text: var(--muted); --wave-box: color-mix(in srgb, var(--surface) 68%, transparent); }
.player-wave { height: 138px; }
.player-zoom { display: flex; align-items: center; gap: 6px; }
.player-over { flex: 1 1 0; min-width: 0; height: 36px; }
.player-zoom .btn { min-height: 36px; font-size: 16px; }
.player-zoom .btn-icon { width: 36px; }
.player-fit { min-width: 56px; padding: 6px 10px; font-size: 14px; }
/* The notes at the playhead: twelve cells, one for each note name, so the row never changes its width. */
.player-live { display: grid; gap: 8px; }
.player-live > p { margin: 0; }
.player-pcs { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.player-pc { display: grid; place-items: center; min-width: 0; height: 32px; border-radius: 8px; background: var(--surface); color: var(--faint); font-size: 13px; font-weight: 600; }
.player-pc.is-on { background: var(--accent); background: color-mix(in srgb, var(--accent) calc(var(--s, 1) * 100%), var(--surface-2)); color: var(--accent-ink); }
.player-pc.is-bass { box-shadow: inset 0 0 0 2px var(--text); }
.player-live-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
/* The chord of this moment, large, and under it the next chord with the time to it. */
.player-chord { display: grid; min-width: 0; }
.player-chord b { font-weight: 700; }
.player-chord-now { font-size: 22px; line-height: 1.25; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-chord-now .muted { font-size: 14px; }
.player-chord-next { font-size: 14px; white-space: nowrap; }
.player-chord-next b, .player-loop-chords b { color: var(--text); }
.player-loop-chords { flex: 1 1 100%; margin: 0; }
.player-loop-chords b { white-space: pre-wrap; }
/* The key of the song and how far the recording is from the usual pitch, with the switch that tunes it. */
.player-about { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.player-about[hidden], .player-about [hidden] { display: none; }
/* On a phone the key has its own row, so the switch stands beside the words that it belongs to. */
@media (max-width: 560px) { .player-about-key { flex: 1 1 100%; } }
.player-neck { margin: 0; }
.player-seek { width: 100%; accent-color: var(--accent); }
.player-transport { gap: 8px; align-items: center; margin: 4px 0; }
.player-play { min-width: 104px; }
.player-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 14px; }
.player-controls { display: grid; gap: 14px; }
.player-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.player-label { min-width: 72px; font-size: 13px; font-weight: 600; color: var(--muted); }
.player-field input[type="range"] { flex: 1 1 150px; min-width: 0; accent-color: var(--accent); }
.player-rate { min-width: 3.4em; font-weight: 700; font-variant-numeric: tabular-nums; }
.player-chips { gap: 6px; }
/* The speeds of a video: equal chips in one row, or in two equal rows when YouTube gives more than six. */
.player-speeds { flex: 1 1 100%; display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 72px)); gap: 6px; }
.player-speeds .chip { justify-content: center; padding-inline: 4px; }
/* A choice with its name: the two stay on one line. */
.player-pair { display: inline-flex; align-items: center; gap: 10px; }
.player-pair .player-label { flex: none; min-width: 104px; }
.player-pair.is-short .player-label { min-width: 52px; }
.player-help { margin: 12px 0 0; }
.player-help + .drill-keys { margin-top: 10px; }
.player-help p { margin: 0; }
.player-help b { color: var(--text); font-weight: 600; }
.player-key { min-width: 7.5em; text-align: center; }
/* The loop: each end has its time between a minus and a plus. */
.player-edges { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.player-edge { display: flex; gap: 3px; }
.player-edge-set { min-width: 96px; padding: 8px 10px; font-variant-numeric: tabular-nums; }
.player-loop .player-chips .btn-icon { font-size: 15px; }
.player-hint { flex: 1 1 100%; margin: 0; }
.player-reset { justify-content: flex-end; }
.player-marks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; flex: 1 1 100%; }
/* A part: its name, and its time under the name. */
.player-marks .player-mark { flex-direction: column; align-items: flex-start; gap: 0; padding-block: 6px; text-align: left; }
.player-marks .player-mark b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-marks .player-mark-t { font-size: 13px; font-weight: 400; }
.player-marks li { display: flex; gap: 6px; align-items: center; }
.player-mark { flex: 1; justify-content: flex-start; gap: 10px; min-width: 0; }
.player-mark-t { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .player-label { flex-basis: 100%; }
  .player-wave { height: 110px; }
  .player-tabs { margin-top: 6px; }
  /* Both ends of the loop on one line of a phone. */
  .player-edges { gap: 8px; flex-wrap: nowrap; flex: 1 1 100%; }
  .player-edge { flex: 1 1 0; min-width: 0; }
  .player-edge .btn-icon { flex: none; width: 38px; }
  .player-edge-set { flex: 1 1 0; min-width: 0; padding: 8px 2px; white-space: nowrap; }
}
/* Hold stays in the row of Play. The narrowest phones have no room for that, so the row breaks there. */
@media (min-width: 340px) and (max-width: 560px) {
  .player-transport { gap: 6px; flex-wrap: nowrap; }
  .player-transport .btn:not(.btn-icon):not(.player-play) { padding-inline: 10px; white-space: nowrap; }
  .player-transport .chip { white-space: nowrap; }
  .player-play { flex: 1 1 0; min-width: 84px; }
}
@media (max-width: 339px) { .player-edge-set { font-size: 13px; } }

/* The Tools tab: three cards in a row. */
.tool-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .tool-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Slow down on the Tools page: one wide card above the shelves, with a line in the accent color. */
.tool-feature { height: auto; margin-bottom: 22px; border-color: var(--line-strong); }
.tool-feature .topic-thumb { flex-basis: 200px; }
.tool-feature h2 { font-size: 22px; }
.tool-feature .topic-text p { max-width: 62ch; font-size: 15px; }
@media (max-width: 660px) { .tool-feature { margin-bottom: 18px; } .tool-feature .topic-thumb { flex-basis: 96px; } .tool-feature h2 { font-size: 18px; } .tool-feature .topic-text p { font-size: 14px; } }
/* One-minute changes: the two chord charts, the clock and the chips of the open chords. */
.minute-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 190px)); gap: 12px; margin: 16px 0; }
.minute-chart h3 { font-size: 18px; }
.minute-box { display: grid; gap: 12px; justify-items: center; text-align: center; }
.minute-say { margin: 0; min-height: 1.5em; }
.minute-result { justify-content: center; align-items: center; gap: 10px; }
.minute-result[hidden] { display: none; }
.minute-ask { display: flex; align-items: center; gap: 8px; }
.minute-count { width: 4ch; padding: 6px 4px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); text-align: center; font-size: 18px; }
/* 28 open chords: four rows of seven, and on a phone seven rows of four. */
.minute-picks { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 640px; }
.minute-picks .chip { justify-content: center; padding-inline: 4px; }
@media (max-width: 660px) { .minute-picks { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.play-bar-next { font-size: 13px; white-space: nowrap; }
/* A phone: one card in each row, so three tools do not leave one alone. */
@media (max-width: 560px) { .tool-cards { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.tool-card { display: grid; align-content: start; gap: 6px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid transparent; color: inherit; text-decoration: none; transition: border-color .15s, background-color .15s; }
@media (hover: hover) { .tool-card:hover { border-color: var(--line-hover); background: var(--surface-2); } }
.tool-card h2 { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 16px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.tool-icon { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.today-goal p { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 0; }
.today-progress { margin-left: auto; font-size: 14px; }

/* The Library start page on a computer: the five shelves stand side by side, each a column of cards with the
   picture on top. The shelves share their rows, so the cards of one row have one height. */
@media (min-width: 1000px) {
  .shelves { grid-template-columns: repeat(var(--shelves, 3), minmax(0, 1fr)); gap: 12px; }
  .shelf { display: grid; grid-template-rows: subgrid; grid-row: span calc(var(--n) + 1); }
  .shelf-name { margin: 0; padding-left: 4px; }
  .topics { grid-template-columns: minmax(0, 1fr); grid-template-rows: subgrid; grid-row: span var(--n); }
  .topics .topic { flex-direction: column; align-items: stretch; gap: 14px; }
  .topics .topic-thumb { flex: none; height: 118px; display: flex; align-items: center; justify-content: center; }
  .topics .topic-thumb .neck-scroll { height: 100%; display: flex; justify-content: center; overflow: visible; }
  .topics .topic-thumb svg { width: auto; height: 100%; max-width: 100%; }
}
/* A submenu row on top of a page that has no Library frame, such as Train and Progress. */
.page-subnav { margin-bottom: 18px; }
@media (max-width: 560px) {
  .page-subnav .lib-tabs, .tools-subnav .lib-tabs { gap: 2px; }
  .page-subnav .lib-tabs a, .tools-subnav .lib-tabs a { padding: 8px 7.5px; font-size: 14px; }
  .page-subnav .lib-tabs .lib-tool-link { margin-left: 6px; }
}
.track-page { margin-top: 4px; }

/* ---------- Reach and reading ---------- */
/* A keyboard user skips the bar: the link shows when it has the focus. */
.skip-link { position: fixed; z-index: 40; left: 12px; top: -80px; padding: 10px 14px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: calc(8px + env(safe-area-inset-top)); }
.drill-stats .stat-long { font: inherit; }
.opts-done { justify-self: end; min-width: 120px; }
/* The numeral of a chord tile: more of the text ink in the light theme, so it reads on the tinted tile. */
:root[data-theme="light"] .chord-btn small { color: color-mix(in srgb, var(--q, var(--accent-text)) 15%, var(--text)); }
/* Light theme: a switch that is on, and the tab you are on, get a little more contrast. */
:root[data-theme="light"] .chip.chip-toggle[aria-pressed="true"] { background: var(--surface-3); }
:root[data-theme="light"] .topbar nav a[aria-current="true"] { color: color-mix(in srgb, var(--accent-text) 80%, #000); }
/* The tuner: what it shows and what you tap. One column on a phone, two on a wide screen and on a phone held sideways. */
.tuner-read, .tuner-act { display: grid; justify-items: center; gap: 10px; width: 100%; min-width: 0; }
@media (min-width: 760px), (orientation: landscape) and (max-height: 500px) {
  .tuner { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); align-items: center; column-gap: 28px; max-width: 860px; }
}
@media (orientation: landscape) and (max-height: 500px) { .tuner-gauge { width: min(230px, 100%); } }
@media (min-width: 661px) { .strum-play2 { display: none; } }

/* A finger needs about 44 px. The small controls keep their look and get a larger area to tap. */
@media (max-width: 660px), (pointer: coarse) {
  .seg button, .chip, .neck-turn, .tempo .btn, .sound-btn, .metro-btn, .lib-home-link, .lib-tabs a, .btn:not(.btn-big), .drill-help summary, .share > .btn { position: relative; }
  .seg button::after, .chip::after, .neck-turn::after, .tempo .btn::after, .sound-btn::after, .metro-btn::after, .lib-home-link::after, .lib-tabs a::after, .btn:not(.btn-big)::after, .drill-help summary::after, .share > .btn::after { content: ""; position: absolute; inset: var(--reach, -5px) 0; }
  .neck-tools .chip, .neck-turn { --reach: -6px; }
  .tempo .btn { --reach: -4px; }
  .sound-btn, .metro-btn, .lib-home-link, .lib-tabs a, .btn:not(.btn-big) { --reach: -3px; }
  .sound-btn::after, .metro-btn::after, .lib-home-link::after, .tempo .btn::after { inset: var(--reach); }
  .drill-help summary { --reach: -11px; }
  /* A slider keeps its place and gets the height of a finger. */
  .field > input[type="range"], .tempo-row input[type="range"] { height: 44px; margin: -14px 0; }
  /* A link in a line of text: a little more to tap, above and below. */
  main p a, main li a { padding-block: 4px; }
}
/* A phone has no keys: the key hints go. */
@media (max-width: 660px), (hover: none) and (pointer: coarse) {
  .kbd, .drill-keys { display: none; }
}
@media (max-width: 660px) {
  /* The question stays in view while a long neck scrolls under it. */
  .prompt-top { position: sticky; top: env(safe-area-inset-top); z-index: 6; background: var(--surface); margin: -16px -16px 0; padding: 16px 16px 8px; border-radius: 18px 18px 0 0; }
}
/* The two parts of the Rhythm page, above the title. */
.rhythm-parts { margin-bottom: 10px; }

/* ---------- The neck stays for the whole page (phone, flat neck) ---------- */
/* The neck and the choices become rows of the page itself, so the neck sticks until the end of the page:
   a tap far down the page changes a neck that you still see. A phone held sideways keeps its own layout. */
@media (max-width: 660px) and (orientation: portrait) {
  .lib-main:has(> .lib-stage svg.fb-horizontal) { display: flex; flex-direction: column; }
  .lib-main:has(> .lib-stage svg.fb-horizontal) > .lib-stage { display: contents; }
  .lib-main:has(> .lib-stage svg.fb-horizontal) > .lib-stage > .controls { order: 1; }
  .lib-main:has(> .lib-stage svg.fb-horizontal) > .lib-stage ~ * { order: 2; }
}

/* ---------- Names in a serif ---------- */
.lib-title h1[data-big], .lib-title h1[data-name] { font-family: "Literata", var(--font); font-weight: 700; letter-spacing: -.015em; }
/* A long scale name keeps the Play button beside it on a phone. */
@media (max-width: 660px) { .lib-title h1[data-name] { font-size: 24px; } }

/* ---------- The kinds of control ----------
   Each kind of control has one look on every page, so its shape says what it does.
   - The main action of a block is the peach button (.btn-primary).
   - An action that plays, starts, opens or makes something is a grey box (.btn).
   - An action that takes back or tidies (Undo, Clear, Rename, Reset) is text with a line under it (.btn-text).
   - A switch is a round pill with a dot: hollow when off, peach when on (.chip-toggle).
   - A choice of one is a track (.seg). With many options it is a row of chips, the chosen one in peach (.chip).
   - A value with steps is one joined box (.stepper).
   - The tabs of a panel are words with a peach line under the open one (.player-tabs).
   The tap area of a touch screen is in ::after of these controls, so the marks here use ::before and borders. */
.btn.btn-text { padding-inline: 6px; background: none; border-color: transparent; text-decoration: underline; text-decoration-color: var(--line-hover); text-decoration-thickness: 2px; text-underline-offset: 6px; }
@media (hover: hover) { .btn.btn-text:hover:not(:disabled) { background: none; border-color: transparent; text-decoration-color: var(--accent); } }

.chip.chip-toggle { padding-inline: 10px 14px; border-radius: 999px; border-color: var(--line-strong); background: none; color: var(--muted); font-weight: 600; }
.chip.chip-toggle::before { content: ''; flex: none; width: 10px; height: 10px; margin: 0; border-radius: 50%; border: 2px solid var(--faint); }
.chip.chip-toggle[aria-pressed="true"] { border-color: transparent; background: var(--surface-3); color: var(--text); }
.chip.chip-toggle[aria-pressed="true"]::before { content: ''; margin: 0; border-color: var(--accent); background: var(--accent); }
/* Under a neck the row is tight: the switches there are a little smaller, so the row stays one line on a small phone. */
.neck-tools .chip.chip-toggle { gap: 5px; padding-inline: 8px 10px; }
.neck-tools .chip.chip-toggle::before { width: 8px; height: 8px; }
.tempo { flex-wrap: wrap; row-gap: 6px; }
.tempo .stepper output { min-width: 62px; padding: 0 4px; }
/* The tempo as a number you can type, with its unit beside it. */
.tempo-box { display: flex; align-items: center; gap: 4px; padding: 0 10px 0 8px; cursor: text; }
.tempo-box span { color: var(--muted); font-size: 14px; }
.tempo-num { width: 3.2ch; padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; text-align: right; -moz-appearance: textfield; appearance: textfield; }
.tempo-num::-webkit-outer-spin-button, .tempo-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tempo-num:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
/* The smallest phones: every switch is a little tighter, and a named row of switches puts its name above them. */
@media (max-width: 389px) {
  .player-pair.is-short { flex-wrap: wrap; }
  .player-pair.is-short .player-label { flex-basis: 100%; }
}
@media (max-width: 374px) {
  .chip.chip-toggle, .neck-tools .chip.chip-toggle { gap: 4px; padding-inline: 7px 9px; }
  .neck-tools { gap: 4px; }
  .neck-tools .neck-turn { padding-inline: 7px; }
  .tempo { gap: 3px; }
}

.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.stepper > .btn { border-width: 0; border-radius: 0; background: none; }
.stepper > :first-child { border-radius: calc(var(--radius-sm) - 1px) 0 0 calc(var(--radius-sm) - 1px); }
.stepper > :last-child { border-radius: 0 calc(var(--radius-sm) - 1px) calc(var(--radius-sm) - 1px) 0; }
.stepper > :not(:first-child) { border-left: 1px solid var(--line-strong); }
.stepper > output { display: grid; place-items: center; padding: 0 10px; }
.stepper > .btn:active:not(:disabled) { transform: none; }

.seg.player-tabs { gap: 0; padding: 0; border-radius: 0; background: none; border-bottom: 1px solid var(--line-strong); }
.seg.player-tabs button { min-height: 40px; margin-bottom: -1px; border-radius: 0; border-bottom: 3px solid transparent; background: none; }
.seg.player-tabs button[aria-checked="true"] { background: none; border-bottom-color: var(--accent); color: var(--text); }
