/* Overtone — "Obsidian Luthier" glass (Antigravity direction).
   Deep studio ink, three glass tiers (lens / card / dock), dark outer rims with a bright
   inner catchlight, jewel tones reserved for harmonic roles and the π/e traces. */

@property --lx { syntax: "<length>"; inherits: true; initial-value: -999px; }
@property --ly { syntax: "<length>"; inherits: true; initial-value: -999px; }
/* Live sound level written by glass.js only while audio is ringing (0 when idle). */
@property --amp { syntax: "<number>"; inherits: false; initial-value: 0; }

:root {
  color-scheme: dark;

  /* Surface */
  --bg-ink: #06080F;
  --pool-indigo: #1B1942;
  --pool-teal: #0A2B33;
  --glass-lens: rgba(9, 13, 24, 0.78);
  --glass-card: rgba(18, 24, 42, 0.56);
  --glass-dock: rgba(12, 16, 30, 0.68);
  --glass-pop: rgba(14, 19, 36, 0.86);
  --glass-blur: blur(28px) saturate(180%);
  --rim-dark: rgba(0, 0, 0, 0.68);
  --rim-spec: rgba(255, 255, 255, 0.32);
  --hair: rgba(148, 163, 184, 0.16);
  --hair-strong: rgba(148, 163, 184, 0.34);
  --case: #0A0D18; /* neck case + sticky neck columns (opaque so scrolled frets hide) */
  --card-solid: #0E1322; /* approximate card colour for rings that sit on a card */
  --slate: #111624; /* reduced-transparency surface */

  /* Ink */
  --ink-primary: #E8EDF7;
  --ink-secondary: #A3AEC2;
  --ink-on-jewel: #06080F;
  --frost-top: #F4F7FF;
  --frost-bottom: #C9D4EC;
  --danger: #FCA5A5;

  /* Harmonic roles (follow the interval from the root in every key) */
  --tone-root: #38BDF8;
  --tone-third: #F59E0B;
  --tone-fifth: #34D399;
  --tone-other: #FB7185;
  /* π / e traces and just-ratio references */
  --accent-math: #C084FC;
  /* Played / plucked / sounding */
  --accent-play: #F8FAFC;
  --focus-ring: #67E8F9;

  /* Plot tokens for the canvas lenses (plots.js reads these) */
  --plot-bg-solid: #090D18;
  --plot-hair: rgba(148, 163, 184, 0.16);
  --plot-axis: rgba(148, 163, 184, 0.5);

  /* Instrument materials */
  --ebony-top: #1A1613;
  --ebony-mid: #110E0C;
  --ebony-bottom: #0B0908;
  --nut-bone: #EAE5D9;
  --nut-shadow: #77736A;
  --nut-zone: #0F1320;

  --font-display: "Instrument Sans", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --gutter: 28px;
  --r-ctl: 12px;
  --r-card: 20px;
  --shadow-control: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-card: inset 0 1px 0 var(--rim-spec), inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 24px 48px -28px rgba(0, 0, 0, 0.8);

  /* Fretboard geometry */
  --label-w: 64px;
  --open-w: 64px;
  --fret-min: 48px;
  /* String rows scale with viewport height so the pinned dock leaves room to read:
     46px at 900px+ tall, ~38px at 720px, 28px floor in short landscape. svh keeps
     rows steady while mobile browser toolbars collapse during scroll. */
  --row-max: 46px;
  --row-h: clamp(28px, calc(3.4vh + 14px), var(--row-max));
  --tap: 44px;
}
@supports (height: 1svh) {
  :root { --row-h: clamp(28px, calc(3.4svh + 14px), var(--row-max)); }
}

/* Role colour hooks: app.js sets data-degree on cells, ladder rows and the lesson. */
[data-degree="root"] { --role: var(--tone-root); }
[data-degree="third"] { --role: var(--tone-third); }
[data-degree="fifth"] { --role: var(--tone-fifth); }
[data-degree="other"] { --role: var(--tone-other); }

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

html { -webkit-text-size-adjust: 100%; background: var(--bg-ink); }

body {
  margin: 0;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
/* Ambient pools: one fixed, unblurred gradient layer (soft by construction, never repainted on scroll). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(70vmax 52vmax at 6% -12%, var(--pool-indigo), transparent 64%),
    radial-gradient(58vmax 46vmax at 106% 34%, var(--pool-teal), transparent 62%),
    radial-gradient(64vmax 40vmax at 34% 114%, rgba(27, 25, 66, 0.6), transparent 66%),
    var(--bg-ink);
}

h1, h2, h3, p { margin: 0; }

/* Components set their own display; the hidden attribute must still win. */
[hidden] { display: none !important; }

.container { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  background: var(--slate); color: var(--ink-primary); padding: var(--s-2) var(--s-4);
  border: 1px solid var(--hair-strong); border-radius: var(--r-ctl); font-weight: 600;
}
.skip-link:focus { top: var(--s-2); }

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

.mono, .math { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.section-title {
  font-family: var(--font-display); font-size: 20px; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em;
}
.section-title:focus { outline: none; }

.caption { font-size: 14px; line-height: 1.5; color: var(--ink-secondary); }

/* ------------------------------------------------------- specular rim */

/* A tight catchlight that follows a fine pointer around the bevel (glass.js writes
   --lx/--ly in element pixels). Masked to the 1px rim so it never covers text. */
.btn, .seg, .pill, .card { position: relative; }
.btn::before, .seg::before, .pill::before, .card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: radial-gradient(var(--spec-r, 64px) circle at var(--lx) var(--ly),
    rgba(255, 255, 255, 0.95), rgba(186, 230, 253, 0.35) 38%, transparent 72%);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity 220ms ease;
}
.card { --spec-r: 150px; }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover::before, .seg:hover::before, .pill:hover::before, .card:hover::before { opacity: 1; }
}

/* ------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tap); padding: 0 var(--s-4);
  color: var(--ink-primary);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.02)) rgba(20, 26, 46, 0.62);
  border: 1px solid var(--rim-dark); border-radius: var(--r-ctl);
  font: 600 14px/1.35 var(--font-sans);
  box-shadow: var(--shadow-control); cursor: pointer;
  transition: background-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 90ms ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .btn:hover:not(:disabled) {
    background-color: rgba(38, 47, 78, 0.75);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.45);
  }
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Frosted primary and pressed toggles: luminous, neutral (no role colour). */
.btn-primary,
.btn-toggle[aria-pressed="true"],
.seg[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--frost-top), var(--frost-bottom));
  color: var(--ink-on-jewel); border-color: rgba(0, 0, 0, 0.72);
  box-shadow: inset 0 1px 0 #FFFFFF, inset 0 -1px 0 rgba(6, 8, 15, 0.18), 0 6px 18px -8px rgba(199, 210, 254, 0.55);
}
@media (hover: hover) {
  .btn-primary:hover:not(:disabled),
  .btn-toggle[aria-pressed="true"]:hover:not(:disabled) {
    background: linear-gradient(180deg, #FFFFFF, #D8E1F4);
    box-shadow: inset 0 1px 0 #FFFFFF, inset 0 -1px 0 rgba(6, 8, 15, 0.18), 0 8px 22px -8px rgba(199, 210, 254, 0.7);
  }
}
.btn-primary:active:not(:disabled) { color: var(--ink-on-jewel); }
/* The chosen root carries the root role colour. */
.btn-root[aria-pressed="true"],
.btn-root[aria-pressed="true"]:hover:not(:disabled) {
  background: linear-gradient(180deg, color-mix(in oklab, var(--tone-root), white 28%), var(--tone-root));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 6px 18px -8px color-mix(in oklab, var(--tone-root) 70%, transparent);
}
.btn-small { min-height: var(--tap); padding: 0 var(--s-3); }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: rgba(6, 8, 15, 0.55); border: 1px solid var(--rim-dark); border-radius: 999px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.06);
}
.seg {
  min-height: 38px; padding: 0 var(--s-4); border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--ink-secondary); font: 600 14px/1.35 var(--font-sans); cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.seg:not([aria-pressed="true"]):hover { color: var(--ink-primary); background: rgba(255, 255, 255, 0.05); }

/* -------------------------------------------------------------- header */

/* The masthead scrolls away normally; the instrument dock below it is what stays pinned. */
.header-inner { padding-top: 10px; padding-bottom: 10px; }
.brand { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.mark { flex: none; width: 24px; height: 24px; }
.mark-rim { fill: rgba(255, 255, 255, 0.04); stroke: rgba(255, 255, 255, 0.24); stroke-width: 1; }
.mark-nut { stroke: var(--nut-bone); stroke-width: 1.6; stroke-linecap: round; fill: none; }
.mark-strings path { stroke: #CBD5E1; stroke-linecap: round; fill: none; }
.mark-root { fill: var(--tone-root); }
.mark-third { fill: var(--tone-third); }
.mark-fifth { fill: var(--tone-fifth); }
.wordmark { font-family: var(--font-display); font-size: 22px; font-weight: 650; line-height: 1.2; letter-spacing: -0.015em; }
.subtitle { font-size: 14px; color: var(--ink-secondary); line-height: 1.35; }

/* ------------------------------------------------------- instrument dock */

/* One sticky glass dock: bar + neck. Sizes adapt with media queries (no scroll JS), and
   its height never changes on scroll. --dock-h is measured by a ResizeObserver and used
   for scroll-margin on page content. */
.dock {
  position: sticky; top: 0; z-index: 30;
  background: var(--glass-dock);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--rim-dark);
  border-bottom: 1px solid var(--rim-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(255, 255, 255, 0.07);
  padding: var(--s-2) 0 6px;
}
/* Scroll-driven lens depth: as sections pass beneath, the dock tint deepens and a contact
   shadow appears. Opacity only, on the compositor; nothing resizes. */
.dock::before, .dock::after { content: ""; position: absolute; pointer-events: none; opacity: 0; }
.dock::before { inset: 0; z-index: -1; background: rgba(6, 8, 15, 0.42); }
.dock::after { left: 0; right: 0; top: 100%; height: 26px; background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent); }
@supports (animation-timeline: scroll()) {
  .dock::before, .dock::after {
    animation: dock-depth linear both;
    animation-timeline: scroll(root block);
    animation-range: 0 240px;
  }
}
@keyframes dock-depth { to { opacity: 1; } }

.dock-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); }
.dock-inner > .neck-frame { min-width: 0; }
.dock-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3);
}
.dock-title {
  font-family: var(--font-display); font-size: 17px; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em;
  margin-right: auto;
}
.dock-title:focus { outline: none; }
.dock-title:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.transport-buttons { display: flex; gap: var(--s-2); }
.ico { flex: none; width: 11px; height: 11px; margin-right: 4px; fill: currentColor; }
#play-arpeggio .ico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.ico-set { width: 16px; height: 16px; margin-right: 2px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
/* Words hidden on compact bars stay in the accessible name ("Play Chord", "Settings"). */
.qs-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Settings disclosure: the panel overlays the neck instead of growing the dock. */
.dock-settings { position: relative; }
.dock-settings > summary { list-style: none; gap: 6px; user-select: none; }
.dock-settings > summary::-webkit-details-marker { display: none; }
.dock-settings > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform 160ms ease;
}
.dock-settings[open] > summary { background-color: rgba(38, 47, 78, 0.8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.dock-settings[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.settings-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: max-content; max-width: min(360px, calc(100vw - 2 * var(--s-4)));
  max-height: calc(100svh - 120px); overflow-y: auto;
  display: grid; gap: var(--s-3); padding: var(--s-4);
  background: var(--glass-pop);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--rim-dark); border-radius: 16px;
  box-shadow: inset 0 1px 0 var(--rim-spec), inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 22px 50px -14px rgba(0, 0, 0, 0.85);
  transform-origin: top right;
}
.setting { display: grid; gap: 6px; justify-items: start; }
/* Fret-range jumps: only needed while the neck scrolls sideways (below 1024px). */
.setting-frets { justify-items: stretch; }
.quick-scroll { display: grid; grid-template-columns: repeat(3, minmax(56px, 1fr)); gap: 6px; }
.quick-scroll .btn { padding: 0 var(--s-2); font-family: var(--font-mono); }
@media (min-width: 1024px) { .setting-frets { display: none; } }
.setting-label { font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--ink-secondary); letter-spacing: 0.01em; }
.volume { justify-items: stretch; }
.volume-row { display: flex; align-items: center; gap: var(--s-2); }
.volume input[type="range"] { flex: 1; min-width: 140px; min-height: var(--tap); accent-color: var(--frost-bottom); margin: 0; }
.volume output { font-family: var(--font-mono); font-variant-numeric: tabular-nums; min-width: 4.5ch; text-align: right; font-size: 14px; }
.audio-status { font-size: 14px; color: var(--danger); font-weight: 600; }

/* Page content under the dock: hash links, focus and scrollIntoView land below it. */
main *, .site-footer * { scroll-margin-top: calc(var(--dock-h, 0px) + var(--s-3)); }

/* ------------------------------------------------------------ fretboard */

.band-neck { padding: var(--s-4) 0 var(--s-5); }

.neck-caption {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5); margin-bottom: var(--s-3);
}
.tuning { font-size: 14px; color: var(--ink-secondary); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); list-style: none; margin: 0; padding: 0; font-size: 14px; font-weight: 500; }
.legend li { display: inline-flex; align-items: center; gap: var(--s-2); }
.swatch { width: 16px; height: 16px; border-radius: 999px; display: inline-block; flex: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.swatch-root { background: var(--tone-root); box-shadow: 0 0 0 2px var(--bg-ink), 0 0 0 3.5px var(--tone-root); }
.swatch-third { background: var(--tone-third); }
.swatch-fifth { background: var(--tone-fifth); }
.swatch-other { background: var(--tone-other); }
.swatch-octave { border: 2px solid var(--ink-secondary); background: rgba(163, 174, 194, 0.14); box-shadow: none; }
.swatch-play { border: 2px solid var(--accent-play); background: transparent; box-shadow: 0 0 8px 1px rgba(248, 250, 252, 0.5); }

.pluck-readout {
  display: inline-block; padding: var(--s-2) var(--s-3);
  background: var(--glass-card); border: 1px solid var(--rim-dark); border-radius: var(--r-ctl);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-size: 14px; line-height: 1.45; min-height: var(--tap);
}

/* Neck case: a recessed panel, so the opaque sticky columns match it exactly. */
.neck-frame {
  position: relative;
  background: var(--case);
  border: 1px solid var(--rim-dark); border-radius: var(--r-ctl);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 2px 10px rgba(0, 0, 0, 0.6);
  padding: 4px 6px 2px;
}
.neck-frame::after {
  content: ""; position: absolute; top: 1px; right: 1px; bottom: 1px; width: 32px; pointer-events: none;
  background: linear-gradient(90deg, rgba(10, 13, 24, 0), rgba(10, 13, 24, 0.85));
  opacity: 0; transition: opacity 160ms ease; border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
}
.neck-frame.can-scroll::after { opacity: 1; }

.neck-scroll {
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain; padding-bottom: var(--s-1);
  scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
.neck-inner { position: relative; min-width: var(--neck-min); }

.neck-row { display: grid; grid-template-columns: var(--neck-cols); position: relative; }

.neck-head .head-cell {
  font: 600 14px/1.35 var(--font-mono); color: var(--ink-secondary); text-align: center;
  padding: 0 0 var(--s-1); font-variant-numeric: tabular-nums;
}
.neck-head .head-label, .neck-head .head-open { position: sticky; z-index: 6; background: var(--case); }
.neck-head .head-label { left: 0; text-align: left; font-family: var(--font-sans); font-size: 13px; }
.neck-head .head-open { left: var(--label-w); padding-right: 8px; }

/* Smoked ebony: lengthwise grain, a soft top sheen and a darker lower edge. */
.board {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.35)),
    repeating-linear-gradient(180deg, rgba(255, 232, 205, 0.022) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.14) 0 2px, transparent 2px 17px),
    linear-gradient(180deg, var(--ebony-top), var(--ebony-mid) 55%, var(--ebony-bottom));
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 12px 24px -10px rgba(0, 0, 0, 0.9);
}

.string-label {
  position: sticky; left: 0; z-index: 6;
  display: flex; flex-direction: column; justify-content: center; padding-left: var(--s-1);
  background: var(--case); line-height: 1.2;
}
.sl-note { font: 700 14px/1.2 var(--font-mono); }
.sl-num { font-size: 13px; color: var(--ink-secondary); }

.cell {
  position: relative; height: var(--row-h);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none;
}
/* the string segment: polished nickel with a faint phosphor halo */
.cell::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: var(--thick);
  transform: translateY(-50%); z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, #FFFFFF 0%, #C9D2DE 45%, #7A8494 100%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.75), 0 0 4px rgba(186, 230, 253, 0.16);
}
.wound .cell::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0.45)),
    repeating-linear-gradient(90deg, #D7DEE8 0 1.5px, #6B7484 1.5px 2.6px);
}
/* nickel fret wire on the bridge side of each space */
.cell:not(.cell-open)::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: -1.5px; width: 3px; z-index: 0; pointer-events: none;
  background: linear-gradient(90deg, #474E5B 0%, #F2F5F9 42%, #B5BECA 62%, #535B68 100%);
  box-shadow: 1px 0 1px rgba(0, 0, 0, 0.7), -1px 0 0 rgba(0, 0, 0, 0.35);
}
.cell-open {
  position: sticky; left: var(--label-w); z-index: 5;
  background: var(--nut-zone); padding-right: 8px;
}
.cell-open::before { right: 8px; }
/* bone nut */
.cell-open::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 8px; z-index: 2;
  background: linear-gradient(90deg, var(--nut-bone) 0 5px, #A8A397 5px 6.5px, var(--nut-shadow) 6.5px 8px);
}

.inlay {
  position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; margin-left: -5px;
  border-radius: 999px; z-index: 0; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #EEF2F7, #9AA3B2 55%, #5C6472);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55); opacity: 0.8;
}

/* Audio-synchronised string shimmer (glass.js): above strings and frets, under the
   finger beads and the pinned columns. Empty and idle unless audio is ringing. */
.string-shimmer { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; }

/* pitch markers: jewel finger beads */
.node {
  position: relative; z-index: 3; pointer-events: none;
  min-width: 28px; height: 28px; padding: 0 5px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 14px/1 var(--font-sans); color: var(--ink-on-jewel); letter-spacing: -0.01em;
  transition: box-shadow 160ms ease;
}
.node:empty {
  min-width: 14px; width: 14px; height: 14px; padding: 0;
  background: rgba(248, 250, 252, 0.22); opacity: 0;
}
.cell:hover .node:empty { opacity: 1; }

.cell[data-role="root"] .node,
.cell[data-role="stack"] .node {
  background: radial-gradient(circle at 50% 28%, color-mix(in oklab, var(--role), white 38%), var(--role) 68%);
}
.cell[data-role="root"] .node { box-shadow: 0 0 0 2px var(--ebony-mid), 0 0 0 4px var(--role), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.cell[data-role="stack"] .node { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.cell[data-role^="octave"] .node {
  background: color-mix(in oklab, var(--role) 16%, rgba(6, 8, 15, 0.72));
  border: 2px solid var(--role); color: var(--ink-primary);
}

.cell.is-inspected .node { outline: 2px dashed var(--accent-play); outline-offset: 3px; }
.cell.is-inspected .node:empty { opacity: 1; background: var(--accent-play); }

/* Sounding: a white halo whose bloom follows the real envelope (--amp) while it rings. */
.cell.is-playing .node {
  box-shadow: 0 0 0 2px var(--accent-play),
    0 0 calc(10px + var(--amp) * 14px) calc(2px + var(--amp) * 4px) rgb(248 250 252 / calc(0.4 + var(--amp) * 0.4));
}
.cell.is-playing .node:empty { opacity: 1; background: var(--accent-play); }

.cell:focus-visible {
  z-index: 7; outline: 2px solid var(--focus-ring); outline-offset: -2px;
  box-shadow: inset 0 0 0 4px rgba(6, 8, 15, 0.85);
}
.cell-open:focus-visible { z-index: 7; }

.vibrating .cell::before { animation: string-vibrate 520ms ease-out; }
@keyframes string-vibrate {
  0% { transform: translateY(calc(-50% - 2px)); }
  15% { transform: translateY(calc(-50% + 2px)); }
  30% { transform: translateY(calc(-50% - 1.5px)); }
  45% { transform: translateY(calc(-50% + 1px)); }
  60% { transform: translateY(calc(-50% - 0.6px)); }
  80% { transform: translateY(calc(-50% + 0.3px)); }
  100% { transform: translateY(-50%); }
}

.scale-bar { display: grid; grid-template-columns: var(--neck-cols); margin-top: var(--s-2); }
.scale-label, .scale-cell {
  font: 500 14px/1.35 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-secondary);
  padding-top: 6px; text-align: center; border-top: 1px solid color-mix(in oklab, var(--accent-math) 70%, transparent); position: relative;
}
.scale-cell::before {
  content: ""; position: absolute; right: -1px; top: -1px; width: 1px; height: 7px; background: var(--accent-math);
}
.scale-label { text-align: left; position: sticky; left: 0; z-index: 4; background: var(--case); padding-left: var(--s-1); font-family: var(--font-sans); font-size: 13px; }
.scale-open { position: sticky; left: var(--label-w); z-index: 4; background: var(--case); padding-right: 8px; }
.band-neck .caption { margin-top: var(--s-3); max-width: 75ch; }

/* --------------------------------------------------------------- cards */

.card {
  background: var(--glass-card);
  border: 1px solid var(--rim-dark); border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: var(--s-5);
  min-width: 0;
}

/* ------------------------------------------------------------ workbench */

.band-work { padding: var(--s-6) 0; }

.guide {
  list-style: none; margin: var(--s-3) 0 var(--s-5); padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3) var(--s-5);
  font-size: 14px; line-height: 1.45;
}
.guide li { display: flex; align-items: flex-start; gap: var(--s-2); }
.guide strong { white-space: nowrap; margin-right: 2px; }
.step {
  flex: none; width: 24px; height: 24px; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--ink-primary);
  font: 700 13px/1 var(--font-mono);
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--rim-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Guided entry: the first thing under the instrument; the lesson card opens in its place. */
.entry-band { padding-top: var(--s-4); }
.entry { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.entry-link {
  font-size: 14px; font-weight: 600; color: var(--ink-primary);
  text-decoration: underline; text-decoration-color: rgba(232, 237, 247, 0.4); text-underline-offset: 3px;
  display: inline-flex; align-items: center; min-height: var(--tap);
}
.entry-link:hover { text-decoration-color: currentColor; }

/* Guided lesson: a glass card whose inner rim takes the current step's role colour. */
.lesson {
  margin: 0; padding: var(--s-5);
  box-shadow: var(--shadow-card), inset 0 0 0 1px color-mix(in oklab, var(--role, transparent) 38%, transparent);
}
.lesson-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--s-1) var(--s-3); margin-bottom: var(--s-3);
}
.lesson-title { font-family: var(--font-display); font-size: 18px; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; }
.lesson-title:focus { outline: none; }
.lesson-title:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.lesson-progress { font: 600 14px/1.35 var(--font-mono); color: var(--ink-secondary); }
.lesson-facts {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin: 0 0 var(--s-3);
  padding-bottom: var(--s-3); border-bottom: 1px solid var(--hair);
}
.lesson-facts dt { font-size: 13px; font-weight: 500; line-height: 1.35; color: var(--ink-secondary); }
.lesson-facts dd { margin: 0; font: 700 16px/1.35 var(--font-mono); font-variant-numeric: tabular-nums; }
.lesson-role dd { font-family: var(--font-sans); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.lesson-role dd::before {
  content: ""; width: 12px; height: 12px; border-radius: 999px; flex: none;
  background: var(--role); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.lesson-teach { max-width: 75ch; }
.lesson-cue {
  margin-top: var(--s-2); max-width: 75ch; font-size: 14px; line-height: 1.45; color: var(--ink-secondary);
  padding-left: var(--s-3); border-left: 2px solid rgba(248, 250, 252, 0.45);
}
.lesson-controls {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-top: var(--s-4);
}
.lesson-listen, .lesson-nav { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
@media (min-width: 1024px) {
  .workbench { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .workbench.is-lesson { grid-template-columns: minmax(0, 1fr); }
  /* The builder column is fixed by the 1040px layout: three presets per row read best. */
  .preset-row { grid-template-columns: repeat(3, 1fr); }
}

.field { margin-bottom: var(--s-5); }
.field-label { font-size: 14px; font-weight: 600; line-height: 1.35; margin-bottom: var(--s-2); font-family: var(--font-sans); }

.root-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.root-grid .btn { padding: 0; font-family: var(--font-mono); }
.octave-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.preset-row .btn { padding: 0 var(--s-1); }
.interval-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.btn-interval { padding: 0 var(--s-1); flex-wrap: wrap; }
.iv-name { font-family: var(--font-mono); }
.iv-step { font-family: var(--font-mono); font-weight: 500; color: var(--ink-secondary); }
.limit-message:not(:empty) {
  margin-top: var(--s-2); padding: var(--s-2) var(--s-3); font-size: 14px; line-height: 1.45;
  border-left: 2px solid rgba(248, 250, 252, 0.5); border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, 0.04); color: var(--ink-primary);
}
.stack-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-4); }
.stack-count { font: 500 14px/1.35 var(--font-mono); color: var(--ink-secondary); font-variant-numeric: tabular-nums; }
.framing-note { font-size: 14px; line-height: 1.5; color: var(--ink-secondary); }

/* pitch ladder */
.ladder-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.35; }
.ladder-table th, .ladder-table td {
  text-align: left; vertical-align: middle; padding: var(--s-2) var(--s-2);
  border-bottom: 1px solid var(--hair);
}
.ladder-table thead th { font-weight: 600; color: var(--ink-secondary); border-bottom: 1px solid var(--hair-strong); vertical-align: bottom; }
.ladder-table thead .math { font-weight: 500; }
.th-just { color: var(--accent-math) !important; }
/* While a row's pitch rings, its edge glows in its role colour with the real envelope. */
.ladder-row { box-shadow: inset 2px 0 0 color-mix(in oklab, var(--role) calc(var(--amp) * 100%), transparent); }
.ladder-row th { font-weight: 500; }
.ladder-row.is-playing {
  background: rgb(248 250 252 / calc(0.05 + var(--amp) * 0.06));
  box-shadow: inset 3px 0 0 var(--accent-play);
}
.ladder { container-type: inline-size; }
.td-tone { min-width: 9.5rem; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 56px; min-height: 40px; padding: 0 var(--s-3);
  border-radius: 999px; border: 1px solid rgba(0, 0, 0, 0.72); color: var(--ink-on-jewel);
  background: linear-gradient(180deg, color-mix(in oklab, var(--role), white 32%), var(--role));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 12px -6px color-mix(in oklab, var(--role) 70%, transparent);
  font: 700 14px/1 var(--font-mono); cursor: pointer; margin-right: var(--s-2);
  transition: transform 90ms ease;
}
.pill:active { transform: translateY(1px); }
.pill-root { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 0 2px var(--card-solid), 0 0 0 3.5px var(--role); }
.ladder-row.is-playing .pill { outline: 2px solid var(--accent-play); outline-offset: 3px; }
.tone-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag {
  font: 600 13px/1.25 var(--font-mono); padding: 2px 7px; border: 1px solid var(--hair-strong); border-radius: 6px;
  background: rgba(255, 255, 255, 0.05); white-space: nowrap;
}
.tag-top { font-family: var(--font-sans); border-style: dashed; }
.tag-off { font-family: var(--font-sans); font-weight: 500; color: var(--ink-secondary); }
.sub { display: block; color: var(--ink-secondary); font-size: 13px; }
.td-just { color: var(--accent-math); }
.just-badge { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.td-just .sub { font-family: var(--font-sans); }
.just-caption { margin-top: var(--s-3); padding-left: var(--s-3); border-left: 2px solid var(--accent-math); }

/* --------------------------------------------------------------- lenses */

.band-math { padding: var(--s-6) 0 var(--s-7); }
.lens-source { font-size: 14px; color: var(--ink-secondary); margin: var(--s-1) 0 var(--s-4); }
.lenses { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
.lens > p { margin-bottom: var(--s-3); font-size: 15px; line-height: 1.55; }
.lens-sound {
  box-shadow: var(--shadow-card),
    0 0 0 1px rgb(192 132 252 / calc(var(--amp) * 0.5)),
    0 0 calc(var(--amp) * 26px) rgb(192 132 252 / calc(var(--amp) * 0.16));
}
.lens-title { font-family: var(--font-mono); font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--accent-math); margin-bottom: var(--s-2); }
/* Dark matte lens: transparent canvas over a recessed glass well. */
.plot {
  display: block; width: 100%; height: 150px; background: var(--glass-lens);
  border: 1px solid var(--rim-dark); border-radius: var(--r-ctl);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 3px 14px rgba(0, 0, 0, 0.55);
}
.plot-key { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); margin: var(--s-2) 0; padding: 0; font-size: 14px; color: var(--ink-secondary); }
.plot-key li { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; flex: none; }
.key-root { width: 12px; height: 12px; background: var(--tone-root); }
.key-stack { width: 12px; height: 12px; border-radius: 999px; background: conic-gradient(var(--tone-third) 0 33.3%, var(--tone-fifth) 0 66.6%, var(--tone-other) 0); }
.key-just { width: 0; height: 16px; border-left: 2px dashed var(--accent-math); }
.key-pluck { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 10px solid var(--accent-play); }
.key-line-root, .key-line-stack, .key-line-pluck, .key-line-amp, .key-line-energy { width: 24px; height: 0; }
.key-line-root { border-top: 2px dashed var(--tone-root); }
.key-line-stack { border-top: 2px solid var(--accent-math); }
.key-line-pluck { border-top: 3px dotted var(--accent-play); }
.key-line-amp { border-top: 3px solid var(--accent-math); }
.key-line-energy { border-top: 2px dashed var(--ink-secondary); }
.illustration-note { font-size: 14px; line-height: 1.45; color: var(--ink-secondary); font-style: italic; margin-bottom: var(--s-2); }
.readout { border-top: 1px solid var(--hair); padding-top: var(--s-2); }
.readout p { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }

@media (min-width: 1024px) {
  .lenses { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lens { padding: var(--s-4); }
}

.site-footer { padding: var(--s-5) 0; font-size: 14px; color: var(--ink-secondary); border-top: 1px solid var(--hair); }
.noscript { padding: var(--s-4); text-align: center; }

/* ---------------------------------------------------------- tablet */

@media (max-width: 1023px) {
  :root { --fret-min: 46px; }
}

/* ---------------------------------------------------------- narrow mobile */

@media (max-width: 639px) {
  :root { --label-w: 48px; --open-w: 56px; --fret-min: 44px; --row-max: 44px; --gutter: 16px; }
  .wordmark { font-size: 20px; }
  .header-inner { padding-top: var(--s-2); padding-bottom: var(--s-2); }
  .seg { padding: 0 var(--s-3); min-height: 40px; }
  .neck-frame { padding: 3px 4px 1px; }
  /* The title stays for assistive tech (it labels the grid). */
  .dock-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  .entry-band { padding-top: var(--s-3); }
  .entry { gap: var(--s-2) var(--s-3); }
  .neck-caption { gap: var(--s-2); }

  .guide { grid-template-columns: 1fr; }
  .card { padding: var(--s-4); border-radius: 16px; }

  /* Lesson fits one phone viewport: 2-column facts, full-width primary step button. */
  .lesson { padding: var(--s-3) var(--s-4); }
  .lesson-head { margin-bottom: var(--s-2); }
  .lesson-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2) var(--s-3); padding-bottom: var(--s-2); margin-bottom: var(--s-2); }
  .lesson-role { grid-column: 1 / -1; }
  .lesson-teach { font-size: 15px; line-height: 1.5; }
  .lesson-controls { display: grid; gap: var(--s-2); margin-top: var(--s-3); }
  .lesson-listen { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .lesson-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lesson-nav .lesson-next { grid-column: 1 / -1; }
  .lesson-controls .btn { padding: 0 var(--s-2); }
  .root-grid { grid-template-columns: repeat(6, 1fr); }
  .preset-row { grid-template-columns: repeat(3, 1fr); }
  .interval-grid { grid-template-columns: repeat(3, 1fr); }
  .pill { min-height: var(--tap); }
}

/* Phone portrait: one frosted toolbar row (Chord · Arpeggio · Stop · Settings icon) over
   six compact strings, so the dock is about 300–320px and the guided entry sits right
   below it. Rows scale with the small viewport height: 34px at 844 tall, 30px at 667. */
@media (max-width: 639px) and (min-height: 501px), (max-width: 559px) {
  :root { --row-h: clamp(30px, calc(2.2vh + 16px), 34px); }
  @supports (height: 1svh) {
    :root { --row-h: clamp(30px, calc(2.2svh + 16px), 34px); }
  }
  .dock { padding: 6px 0 4px; }
  .dock-inner { gap: 6px; }
  .dock-bar { flex-wrap: nowrap; gap: 6px; }
  .transport-buttons { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .transport-buttons .btn { padding: 0 6px; min-height: var(--tap); }
  .tw, .set-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dock-settings > summary { width: var(--tap); min-height: var(--tap); padding: 0; }
  .dock-settings > summary::after { display: none; }
  .ico-set { width: 18px; height: 18px; margin: 0; }
  .node { min-width: min(28px, calc(var(--row-h) - 6px)); height: min(28px, calc(var(--row-h) - 6px)); padding: 0 4px; font-size: 13px; }
  .neck-head .head-cell { line-height: 1.2; padding-bottom: 2px; }
  .neck-scroll { padding-bottom: 2px; }
  .scale-bar { margin-top: var(--s-1); }
  .scale-label, .scale-cell { padding-top: 2px; font-size: 13px; line-height: 1.25; }
  .sl-note, .sl-num { line-height: 1.1; }
}

/* ---------------------------------------------------------- short viewports */

/* Laptops and phones in portrait: trim the neck's chrome, keep the strings playable. */
@media (max-height: 820px) {
  .dock { padding-top: 6px; }
  .dock-inner { gap: 6px; }
  .neck-head .head-cell { padding-bottom: 2px; }
  .scale-bar { margin-top: var(--s-1); }
  .scale-label, .scale-cell { padding-top: 2px; line-height: 1.25; }
  .sl-note, .sl-num { line-height: 1.1; }
}

/* Short landscape (phones on their side, small split windows): a four-button rail of
   40px controls beside a compact neck keeps the dock under ~195px (about half of a
   375–430px tall screen). Rows stay 24–26px with 22px markers, so cells remain distinct. */
@media (max-height: 500px) {
  :root { --row-h: clamp(24px, calc(3.4vh + 12px), 26px); }
  @supports (height: 1svh) {
    :root { --row-h: clamp(24px, calc(3.4svh + 12px), 26px); }
  }
  .dock { padding: var(--s-1) 0 2px; }
  .dock-bar .btn { min-height: 40px; }
  .seg { min-height: 38px; }
  .node { min-width: 22px; height: 22px; padding: 0 4px; font-size: 12px; }
  .sl-num { display: none; }
  .sl-note { font-size: 13px; }
  .neck-head .head-cell { font-size: 12px; line-height: 1.1; padding-bottom: 1px; }
  .neck-frame { padding: 2px 4px 0; }
  .neck-scroll { padding-bottom: 0; }
  .scale-bar { margin-top: 2px; }
  .scale-label, .scale-cell { padding-top: 1px; font-size: 12px; line-height: 1.1; }
}
@media (max-height: 500px) and (min-width: 560px) {
  .dock-inner { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--s-1) var(--s-3); }
  /* Explicit placement so a visible audio-error line never pushes the neck below the rail. */
  .audio-status { grid-column: 1 / -1; grid-row: 1; }
  .dock-inner > .neck-frame { grid-column: 2; grid-row: 2; }
  .dock-bar {
    grid-column: 1; grid-row: 2;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: var(--s-1);
    width: 148px;
  }
  .dock-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .transport-buttons { flex: none; display: grid; grid-template-columns: 1fr; gap: var(--s-1); }
  .transport-buttons .btn, .dock-settings > summary { padding: 0 var(--s-2); width: 100%; }
  /* Opens beside the rail, over the neck, in two columns so it fits the short screen. */
  .dock-bar { position: relative; }
  .dock-settings { position: static; }
  .settings-panel {
    left: calc(100% + var(--s-2)); right: auto; top: 0; bottom: auto;
    grid-template-columns: repeat(2, auto); gap: var(--s-3) var(--s-4); padding: var(--s-3);
    max-width: calc(100vw - 148px - 2 * var(--gutter) - var(--s-4));
    max-height: calc(100svh - 16px); transform-origin: top left;
  }
}

/* Ladder: compact stacked entries whenever its column is too narrow for five
   table columns (phones, tablets, and the desktop two-column workbench). */
@container (max-width: 639px) {
  .ladder-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ladder-table, .ladder-table tbody { display: block; }
  .ladder-row {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: "tone tone tone" "semis freq ratio" "just just just";
    padding: var(--s-2) 0; border-bottom: 1px solid var(--hair);
  }
  .ladder-table .ladder-row > * { border: 0; padding: 4px var(--s-1); min-width: 0; }
  .ladder-row > :nth-child(1) { grid-area: tone; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .ladder-row > :nth-child(2) { grid-area: semis; }
  .ladder-row > :nth-child(3) { grid-area: freq; }
  .ladder-row > :nth-child(4) { grid-area: ratio; }
  .ladder-row > :nth-child(5) { grid-area: just; }
  .ladder-row > :nth-child(1) .tone-tags { margin-top: 0; }
  .ladder-row > td::before {
    content: attr(data-label); display: block; font: 500 13px/1.3 var(--font-sans); color: var(--ink-secondary);
  }
  .ladder-row .sub { display: inline; margin-left: 6px; }
  .ladder-row .td-just .sub { display: block; margin-left: 0; }
}

/* ---------------------------------------------------- reduced transparency */

/* Glass becomes opaque slate with crisp borders; highlights and roles are unchanged. */
@media (prefers-reduced-transparency: reduce) {
  body::before { background: var(--bg-ink); }
  .dock, .settings-panel, .card, .pluck-readout {
    background: var(--slate);
    -webkit-backdrop-filter: none; backdrop-filter: none;
    border-color: rgba(148, 163, 184, 0.42);
  }
  .dock::before, .dock::after { display: none; }
  .btn:not(.btn-primary):not([aria-pressed="true"]) { background: #1A2134; border-color: rgba(148, 163, 184, 0.42); }
  .segmented { background: #0B0F1A; border-color: rgba(148, 163, 184, 0.42); }
  .plot { background: var(--plot-bg-solid); border-color: rgba(148, 163, 184, 0.42); }
  .neck-frame { border-color: rgba(148, 163, 184, 0.42); }
  .tag { background: #161C2C; }
}

/* ---------------------------------------------------------- reduced motion */

/* No caustics, springs or wave motion; static harmonic and playing highlights remain. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .btn:active:not(:disabled), .pill:active { transform: none; }
  .btn::before, .seg::before, .pill::before, .card::before { display: none; }
}

@media (forced-colors: active) {
  .node, .pill, .swatch, .step { forced-color-adjust: none; }
  .cell:focus-visible { outline-color: Highlight; }
  .string-shimmer, .btn::before, .seg::before, .pill::before, .card::before, .dock::before, .dock::after { display: none; }
}
