/* Singelo — pen over pencil.
   The melody is pencil on manuscript paper; your voice is ballpoint ink.
   Ink blue belongs to the singer only: live mic, your trail, your hits. */

:root {
  --paper: #e4e8e3;      /* cool manuscript stock */
  --paper-2: #d6ddd6;    /* sheet beneath the controls */
  --staff: #b5bfb8;      /* printed staff lines */
  --graphite: #4b535a;   /* the written melody */
  --print: #1c2530;      /* text and transport */
  --muted: #5a646a;
  --pen: #2742d3;        /* the singer */
  --take: #a8432b;       /* red pencil: a take being played back */
  --staff-sing: #8fa0ee; /* the ruled lines while you sing */
  --staff-hear: #d99a88; /* and while a take plays back */
  --pen-wash: rgba(39, 66, 211, 0.12);
  --rule: rgba(28, 37, 48, 0.14);

  --serif: 'Alegreya', 'Iowan Old Style', Georgia, serif;
  --sans: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;

  /* classic scale: 12 14 16 18 21 24 36 48 */
  --t-xs: 0.75rem; --t-s: 0.875rem; --t-m: 1rem; --t-l: 1.125rem;
  --t-xl: 1.3125rem; --t-2: 1.5rem; --t-3: 2.25rem; --t-4: 3rem;

  --gap: 1rem;
  --edge: 1.25rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141a23;
    --paper-2: #1b2330;
    --staff: #2b3644;
    --graphite: #a6b0ba;
    --print: #e6eaee;
    --muted: #96a0aa;
    --pen: #8aa3ff;
    --take: #f0a58f;
    --staff-sing: #44558f;
    --staff-hear: #7a4a3d;
    --pen-wash: rgba(138, 163, 255, 0.16);
    --rule: rgba(230, 234, 238, 0.12);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--print);
  font: 400 var(--t-m) / 1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--print); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { min-height: 100dvh; max-width: 36rem; margin: 0 auto; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.bar {
  display: flex; align-items: center; gap: 0.5rem;
  padding: calc(var(--safe-t) + 0.75rem) var(--edge) 0.5rem;
  min-height: 3.5rem;
}
.bar-title { flex: 1; min-width: 0; margin: 0; }
.wordmark { font: 700 var(--t-2) / 1 var(--serif); }
/* the song list's header: a large wordmark, underlined by one pen stroke that ends in a dot */
.home-bar { align-items: flex-start; padding-top: calc(var(--safe-t) + 1.75rem); padding-bottom: 0.625rem; }
.home-mark { flex: 1; min-width: 0; }
.home-bar .wordmark { margin: 0; font-size: var(--t-4); letter-spacing: -0.015em; }
.home-stroke { display: block; margin-top: 0.125rem; color: var(--pen); }
.home-stroke svg { display: block; width: 13.125rem; height: 1.625rem; }
.home-stroke path { stroke-dasharray: 1; animation: home-draw 1.2s 0.15s cubic-bezier(0.6, 0, 0.2, 1) both; }
.home-stroke circle { transform-box: fill-box; transform-origin: center; animation: home-dot 0.45s 1.25s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes home-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes home-dot { from { transform: scale(0); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .home-stroke path, .home-stroke circle { animation: none; } }
.icon-btn {
  width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
  background: transparent; display: grid; place-items: center; color: var(--print);
}
.icon-btn:active { background: var(--rule); }
.icon-btn svg { width: 1.375rem; height: 1.375rem; }

/* ---------- library ---------- */
.library { flex: 1; padding: 0 var(--edge) 7rem; }
/* the song list: sort chips, then a row per song */
.sort-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.375rem 0 0.875rem; }
.sort-chip { min-height: 2.5rem; padding: 0 0.875rem; border: 1.5px solid var(--staff); border-radius: 1.125rem; background: none; color: var(--print); font-size: var(--t-s); font-weight: 500; }
.sort-chip[aria-pressed='true'] { background: var(--print); border-color: var(--print); color: var(--paper); font-weight: 700; }
.songs { border-bottom: 1px solid var(--staff); }
.song-row { display: flex; align-items: center; gap: 0.25rem; min-height: 4.125rem; border-top: 1px solid var(--staff); }
.song-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.75rem; padding: 0.5625rem 0; border: 0; background: none; text-align: left; }
.song-text { flex: 1; min-width: 0; }
.song-title { display: block; font: 600 var(--t-l)/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-sub { display: block; font-size: 0.8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-sub.is-error { color: var(--print); }
.song-mini { flex: none; display: block; width: 3.5rem; height: 1.5rem; }
.song-best { flex: none; min-width: 2.25rem; text-align: right; color: var(--pen); font-size: 0.9375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.songs.is-roomy .song-row { align-items: flex-start; }
.songs.is-roomy .song-open { gap: 0.875rem; padding: 0.875rem 0; }
.songs.is-roomy .song-more { margin-top: 0.5rem; }
.songs.is-roomy .song-line { display: flex; align-items: baseline; gap: 0.5rem; }
.songs.is-roomy .song-title { flex: 1; min-width: 0; font-size: var(--t-xl); line-height: 1.15; white-space: normal; overflow-wrap: anywhere; }
.songs.is-roomy .song-best { font-size: 1.0625rem; }
.songs.is-roomy .song-sub { margin-top: 0.125rem; white-space: normal; }
.songs.is-roomy .song-mini { width: 100%; height: 1.375rem; margin-top: 0.625rem; }
.cover { flex: none; display: block; overflow: hidden; background: var(--paper-2); }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover.is-blank { display: grid; place-items: center; border: 1px solid var(--staff); }
.cover.is-blank canvas { display: block; width: 78%; height: 42%; }
.cover-m { width: 3rem; height: 3rem; }
.cover-l { width: 5.25rem; height: 5.25rem; }
.song-more { flex: none; margin-right: -0.75rem; }
.song-status { margin: 0.25rem 0 0; font-size: var(--t-s); color: var(--muted); }
.preview-note { margin: 0.25rem 0 0.5rem; padding: 0.75rem 0.875rem; border-left: 2px solid var(--staff); font-size: var(--t-s); color: var(--muted); max-width: 46ch; }

.empty { padding: 3rem 0 0; max-width: 26rem; }
.empty h2 { font: 600 var(--t-3) / 1.1 var(--serif); margin: 0 0 1rem; }
.empty p { margin: 0 0 1.5rem; color: var(--muted); max-width: 32ch; }
.empty-staff { display: block; width: 100%; height: 5.5rem; margin: 0 0 1.75rem; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.3);
  padding: 0.875rem var(--edge) calc(var(--safe-b) + 1.125rem);
  background: #171e28; border-radius: 1.375rem 1.375rem 0 0;
  display: flex; justify-content: center;
}
.dock .btn-solid { background: #eef1ed; border-color: #eef1ed; color: #171e28; font-weight: 700; }
.dock :focus-visible { outline-color: #eef1ed; }
@media (prefers-color-scheme: dark) { .dock { background: #0b1017; } }
.dock-inner { width: 100%; max-width: 33.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.dock-note { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: var(--t-s); color: #a9b3bd; }
.dock-note svg, .sheet-foot svg, .writing-note svg { flex: none; width: 1.125rem; height: 1.125rem; }

/* ---------- buttons ---------- */
.btn {
  min-height: 3rem; padding: 0 1.25rem; border-radius: 1.5rem;
  border: 1.5px solid var(--print); background: transparent;
  font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn-solid { background: var(--print); color: var(--paper); }
.btn-wide { flex: 1; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn svg { width: 1.125rem; height: 1.125rem; }
.link { border: 0; background: none; padding: 0.5rem 0; text-decoration: underline; text-underline-offset: 3px; color: var(--print); }

/* ---------- sheet (bottom drawer) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 20, 0.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 36rem; margin: 0 auto;
  background: var(--paper); border-radius: 1.25rem 1.25rem 0 0;
  padding: 0.5rem var(--edge) calc(var(--safe-b) + 1.25rem);
  box-shadow: 0 -1px 0 var(--rule);
  animation: rise 180ms ease-out;
}
.sheet::before { content: ''; display: block; width: 2.5rem; height: 4px; border-radius: 2px; background: var(--staff); margin: 0 auto 1rem; }
.sheet h3 { font: italic 500 var(--t-xl) / 1.2 var(--serif); margin: 0 0 0.75rem; }
.sheet-option {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 0.875rem 0; border-top: 1px solid var(--rule);
}
.sheet-option strong { display: block; font-weight: 500; }
.sheet-option span { display: block; font-size: var(--t-s); color: var(--muted); }
@keyframes rise { from { transform: translateY(1.5rem); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

/* ---------- processing ---------- */
.stage { font-size: var(--t-l); margin: 0; }
.stage-detail { margin: 0.25rem 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.note { margin: 1.5rem 0 0; color: var(--muted); font-size: var(--t-s); max-width: 34ch; }

/* ---------- practice ---------- */
.practice { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; overflow: clip; } /* clip: nothing may scroll the desk back into view while the gear's panel has slid it away */
.practice .bar { padding-bottom: 0.25rem; }
.practice .bar-title { font: 600 var(--t-xl) / 1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-wrap { flex: 1; position: relative; min-height: 12rem; touch-action: none; }
.graph { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.deck { background: var(--paper-2); padding: 0.75rem var(--edge) calc(var(--safe-b) + 0.875rem); }
.mini { width: 100%; height: 2.75rem; display: block; touch-action: none; }
.times { display: flex; justify-content: space-between; font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; margin: 0.25rem 0 0.5rem; }
.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.5rem; }
.play {
  width: 4rem; height: 4rem; border-radius: 50%; border: 0;
  background: var(--print); color: var(--paper); display: grid; place-items: center;
}
.play svg { width: 1.75rem; height: 1.75rem; }
.side { display: flex; }
.side-end { justify-content: flex-end; }
.chip {
  min-height: 2.75rem; padding: 0 0.875rem; border-radius: 1.375rem;
  border: 1.5px solid var(--staff); background: transparent;
  display: inline-flex; align-items: center; gap: 0.375rem; font-size: var(--t-s); font-weight: 500;
}
.chip svg { width: 1.125rem; height: 1.125rem; }
.chip[aria-pressed='true'] { border-color: var(--print); background: var(--paper); }

.mixer { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 1.25rem; margin-top: 0.75rem; }
.fader { display: flex; flex-direction: column; font-size: var(--t-s); color: var(--muted); }
.fader input { width: 100%; margin: 0.125rem 0 0; accent-color: var(--print); height: 1.75rem; }

.looprow { display: flex; gap: 0.5rem; margin-top: 0.75rem; align-items: center; }
.looprow .chip { flex: 1; justify-content: center; padding: 0 0.5rem; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--staff); border-radius: 1.375rem; overflow: hidden; }
.stepper button { border: 0; background: transparent; width: 2.375rem; min-height: 2.75rem; font-size: var(--t-l); }
.stepper button:active { background: var(--rule); }
.step-val { min-width: 3.25rem; text-align: center; font-size: var(--t-s); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.countin {
  position: absolute; left: 0; right: 0; top: 0.125rem; text-align: center; pointer-events: none;
  font: italic 600 4.25rem / 1 var(--serif); color: var(--print); opacity: 0.9;
}
.sheet-row { padding: 0.625rem 0; border-top: 1px solid var(--rule); }
.sheet-row-label { display: block; font-size: var(--t-s); color: var(--muted); margin-bottom: 0.375rem; }
.sheet-row.toggle { display: flex; margin-bottom: 0.75rem; }
.chiprow { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chiprow .chip { min-width: 2.75rem; justify-content: center; }
.sheet-note { margin: 0 0 0.75rem; color: var(--muted); font-size: var(--t-s); }
.sheet { max-height: 88dvh; overflow-y: auto; }
.options { display: flex; gap: 0.5rem; margin-top: 0.625rem; }
.options .chip { flex: 1; justify-content: center; font-variant-numeric: tabular-nums; padding: 0 0.375rem; white-space: nowrap; }
.choice {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  border: 0; border-top: 1px solid var(--rule); background: none; padding: 0.875rem 0; text-align: left;
}
.choice[aria-checked='true']::after { content: ''; width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--print); }
.seg { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin-top: 0.5rem; font-size: var(--t-s); color: var(--muted); }
.seg-group { display: inline-flex; border: 1.5px solid var(--staff); border-radius: 1.25rem; overflow: hidden; }
.seg-group button {
  border: 0; background: transparent; min-height: 2.5rem; min-width: 2.75rem; padding: 0 0.625rem;
  font-size: var(--t-s); font-variant-numeric: tabular-nums;
}
.seg-group button[aria-pressed='true'] { background: var(--print); color: var(--paper); }
.seg-label { margin-left: 0.25rem; }
.seg-spacer { flex: 1; }

/* ---------- settings ---------- */
.field { padding: 0.875rem 0; border-bottom: 1px solid var(--rule); }
.field-name { display: block; font-weight: 500; }
.field p { margin: 0.125rem 0 0.5rem; font-size: var(--t-s); color: var(--muted); max-width: 40ch; }
.field input[type='range'] { width: 100%; accent-color: var(--print); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.toggle input { width: 1.375rem; height: 1.375rem; accent-color: var(--print); }
.report { margin: 0.75rem 0 0; padding: 0.875rem 1rem; background: var(--paper-2); border-radius: 0.75rem; font-size: var(--t-s); }
.report dl { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin: 0; }
.report dt { color: var(--muted); }
.report dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.verdict { font: 600 var(--t-l) / 1.3 var(--serif); margin: 0 0 0.75rem; }

.toast {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 3.75rem); transform: translateX(-50%); text-align: center;
  background: var(--print); color: var(--paper); padding: 0.625rem 1rem; border-radius: 1.25rem;
  font-size: var(--t-s); z-index: 30; max-width: calc(100% - 2.5rem);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================= practice deck: the desk under the sheet =================
   The graph is paper; the controls sit on a dark desk below it, in thumb reach.
   Inside the deck the colour tokens flip, so every control inherits the dark set. */
.deck {
  --paper: #171e28; --paper-2: #232c39; --staff: #3b4757; --graphite: #a9b3bd;
  --print: #eef1ed; --muted: #97a2ad; --pen: #8ea6ff; --rule: rgba(238, 241, 237, 0.13);
  background: var(--paper); color: var(--print);
  border-radius: 1.375rem 1.375rem 0 0;
  padding: 0.875rem var(--edge) calc(var(--safe-b) + 0.5rem);
  position: relative; z-index: 1;
}
@media (prefers-color-scheme: dark) {
  .deck { --paper: #0b1017; --paper-2: #18202b; --staff: #2c3745; }
}
.deck :focus-visible { outline-color: var(--print); }
.mini { height: 2.875rem; }
.times { margin: 0.25rem 0 0.375rem; }

.transport { display: flex; align-items: flex-start; justify-content: space-between; gap: 0; margin-top: 0.125rem; }
.play {
  width: 4.5rem; height: 4.5rem; border-radius: 50%; border: 0; flex: none;
  background: var(--print); color: var(--paper); display: grid; place-items: center;
}
.play svg { width: 2rem; height: 2rem; }
.play:active { transform: scale(0.96); }
.skip {
  width: 3.25rem; height: 4.5rem; border: 0; background: none; color: var(--print);
  display: grid; place-items: center; flex: none; border-radius: 1rem;
}
.skip svg { width: 1.625rem; height: 1.625rem; }
.skip:active { background: var(--rule); }
.skip-small { width: 2.75rem; height: 2.75rem; border-radius: 50%; }
.skip-small svg { width: 1.25rem; height: 1.25rem; }
.round {
  width: 4.75rem; border: 0; background: none; color: var(--print); padding: 0.5rem 0 0;
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem; flex: none;
}
.round-disc {
  width: 3.25rem; height: 3.25rem; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--staff); color: var(--muted);
}
.round-disc svg { width: 1.375rem; height: 1.375rem; }
.round-cap { font-size: var(--t-xs); color: var(--muted); white-space: nowrap; }
.round[aria-pressed='true'] .round-disc { background: var(--paper-2); border-color: var(--print); color: var(--print); }
.round.mic[aria-pressed='true'] .round-disc { background: var(--pen); border-color: var(--pen); color: var(--paper); }
.round[aria-pressed='true'] .round-cap { color: var(--print); }
/* the microphone hears something: rings spread from its icon, out past the button */
.round-disc { position: relative; }
.mic-ripple {
  /* two tones, so a ring shows on the pen-blue disc and on the desk around it */
  position: absolute; inset: -1.5px; border-radius: 50%; border: 1.5px solid var(--pen); box-shadow: inset 0 0 0 1.5px currentColor;
  pointer-events: none; opacity: 0; animation: mic-ripple 950ms ease-out forwards;
}
@keyframes mic-ripple { from { transform: scale(0.3); opacity: 0.6; } to { transform: scale(var(--to, 1.8)); opacity: 0; } }

.pill {
  min-height: 2.75rem; padding: 0 0.875rem; border-radius: 1.375rem; white-space: nowrap;
  border: 1.5px solid var(--staff); background: none; color: var(--print); font-size: var(--t-s); font-weight: 500;
}
.pill[aria-pressed='true'] { background: var(--print); border-color: var(--print); color: var(--paper); }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0.375rem -0.5rem 0; border-top: 1px solid var(--rule); }
.tab {
  border: 0; background: none; color: var(--print); padding: 0.5rem 0 0.375rem; min-height: 3.25rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.0625rem; position: relative;
}
.tab-cap { font-size: var(--t-xs); color: var(--muted); }
.tab-val { font-size: var(--t-s); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; max-width: 100%; padding: 0 0.25rem; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; }
.tab.is-on .tab-val { color: var(--pen); }
.tab:active { background: var(--rule); }

.practice .bar { min-height: 3rem; padding-top: calc(var(--safe-t) + 0.375rem); padding-bottom: 0; }
.stage-wrap { margin-bottom: -1.375rem; }
@media (prefers-reduced-motion: no-preference) { .play, .round-disc { transition: transform 90ms ease, background-color 120ms ease; } }

/* ---- ruler: a scale that rises from a tab. Press the tab and slide, or tap and drag the scale ---- */
.ruler-scrim { position: fixed; inset: 0; z-index: 5; touch-action: none; }
.deck.is-ruling > :not(.tabs):not(.ruler-pop):not(.ruler-scrim):not(.ladder):not(.tab-card), .deck.is-ruling .tab:not(.is-open) { opacity: 0.28; }
.tab.is-open { z-index: 6; }
.tab.is-open .tab-val { color: var(--pen); }
.tab { touch-action: none; -webkit-user-select: none; user-select: none; }
.ruler-pop {
  position: fixed; z-index: 7; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem;
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.ruler-row { display: flex; gap: 0.5rem; }
.ruler {
  position: relative; width: 5.25rem; padding: 1.375rem 0; border-radius: 1.25rem; cursor: ns-resize;
  background: var(--paper-2); border: 1px solid var(--staff); box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}
.ruler-cap { position: absolute; top: 0.5rem; left: 0; right: 0; text-align: center; font-size: var(--t-xs); line-height: 1.2; color: var(--muted); }
.ruler-cap-val { display: block; font-size: 1.0625rem; font-weight: 700; color: var(--print); font-variant-numeric: tabular-nums; }
.ruler.is-active .ruler-cap-val { color: var(--pen); }
.ruler:has(.ruler-cap) { padding-top: 3.75rem; }
.ruler-scale { position: relative; }
.ruler-axis { position: absolute; left: 1.625rem; top: 0; bottom: 0; width: 0; }
.ruler-tick { position: absolute; left: 1.125rem; width: 1rem; height: 1.25px; margin-bottom: -0.625px; background: var(--print); opacity: 0.45; }
.ruler-tick.is-major { left: 0.75rem; width: 1.75rem; opacity: 1; }
.ruler-n { position: absolute; left: 3.125rem; transform: translateY(50%); font-size: var(--t-xs); line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.ruler-thumb { position: absolute; left: 0.375rem; width: 2.5rem; height: 3px; margin-bottom: -1.5px; border-radius: 1.5px; background: var(--pen); }
.ruler-bubble {
  position: absolute; right: calc(100% + 1.25rem); top: 50%; transform: translateY(-50%);
  min-width: 4rem; height: 2.375rem; padding: 0 0.75rem; border-radius: 1.1875rem; display: grid; place-items: center;
  background: var(--pen); color: var(--paper); font-size: 1.0625rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ruler-bubble::after {
  content: ''; position: absolute; left: calc(100% - 1px); top: 50%; margin-top: -0.5rem;
  border: 0.5rem solid transparent; border-left-color: var(--pen); border-right-width: 0;
}
.ruler.bubble-right .ruler-bubble { right: auto; left: calc(100% + 3.375rem); }
.ruler.bubble-right .ruler-bubble::after { left: auto; right: calc(100% - 1px); border-left: 0; border-right: 0.5rem solid var(--pen); }
.ruler:not(.is-active) .ruler-bubble { display: none; }
.ruler:not(.is-active) .ruler-thumb { background: var(--print); }
.ruler:focus { outline: none; }
.ruler:focus-visible { border-color: var(--print); }
.ruler-extra {
  min-height: 2.75rem; padding: 0 1rem; border-radius: 1.375rem; white-space: nowrap;
  border: 1px solid var(--staff); background: var(--paper-2); color: var(--print); font-size: var(--t-s); font-weight: 500;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}
@media (prefers-reduced-motion: no-preference) {
  .ruler-pop { animation: ruler-up 140ms ease-out; transform-origin: 50% 100%; }
  .deck > *, .tab { transition: opacity 140ms ease; }
}
@keyframes ruler-up { from { opacity: 0; transform: translateY(0.75rem) scale(0.96); } }
.ruler:has(.ruler-cap) .ruler-bubble { display: none; }

/* ---- octave ladder: rises from the Octave tab ---- */
.ladder {
  position: fixed; z-index: 7; width: 13.5rem; padding: 0.5rem; border-radius: 1.25rem; display: flex; flex-direction: column; gap: 0.125rem;
  background: var(--paper-2); border: 1px solid var(--staff); box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}
.rung, .rung-auto {
  display: flex; align-items: center; gap: 0.625rem; width: 100%; min-height: 3.25rem; padding: 0.4375rem 0.75rem 0.4375rem 0.5rem;
  border: 0; border-radius: 0.875rem; background: none; color: var(--print); text-align: left;
}
.rung[aria-checked='true'] { background: var(--print); color: var(--paper); }
.rung-text { display: flex; flex-direction: column; }
.rung-text b { font-size: 0.9375rem; font-weight: 700; line-height: 1.15; }
.rung-text small { font-size: var(--t-xs); line-height: 1.25; opacity: 0.7; }
.rung-ico { flex: none; width: 2.125rem; height: 2.125rem; display: flex; flex-direction: column; justify-content: space-around; padding: 0.25rem 0.1875rem; box-sizing: border-box; }
.rung-ico i { display: block; height: 1px; border-radius: 2px; background: currentColor; opacity: 0.35; }
.rung-ico.at-0 i:nth-child(1), .rung-ico.at-1 i:nth-child(2), .rung-ico.at-2 i:nth-child(3) { height: 3.5px; opacity: 1; }
.rung-auto { justify-content: space-between; margin-top: 0.375rem; padding: 0.625rem 0.625rem 0.375rem; border-top: 1px solid var(--staff); border-radius: 0 0 0.875rem 0.875rem; }
.switch { flex: none; width: 2.75rem; height: 1.625rem; border-radius: 0.8125rem; background: var(--staff); position: relative; }
.switch::after { content: ''; position: absolute; left: 0.1875rem; top: 0.1875rem; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--print); }
[aria-checked='true'] > .switch { background: var(--pen); }
[aria-checked='true'] > .switch::after { left: 1.3125rem; }
@media (prefers-reduced-motion: no-preference) {
  .ladder { animation: ruler-up 140ms ease-out; }
  .switch::after { transition: left 120ms ease; }
}

/* ---- "you're an octave off" chip on the sheet ---- */
.oct-chip {
  position: absolute; right: 0.75rem; bottom: 6.5rem; z-index: 2; display: flex; align-items: center; gap: 0.5rem;
  max-width: calc(100% - 1.5rem); padding: 0.3125rem 0.25rem 0.3125rem 1rem; border-radius: 1.5rem;
  background: var(--print); color: var(--paper); font-size: var(--t-s); font-weight: 500; box-shadow: 0 0.375rem 1.125rem rgba(0, 0, 0, 0.2);
}
.oct-chip[hidden] { display: none; }
.oct-match { min-height: 2.25rem; padding: 0 0.875rem; border: 0; border-radius: 1.125rem; background: var(--paper); color: var(--print); font-size: var(--t-s); font-weight: 700; white-space: nowrap; }
.oct-close { width: 2.25rem; height: 2.25rem; border: 0; background: none; color: var(--paper); opacity: 0.7; font-size: 1.25rem; line-height: 1; }
@media (prefers-reduced-motion: no-preference) { .oct-chip { animation: ruler-up 180ms ease-out; } }

/* ---- chips that sit on the sheet, stacked from just above the loop and skip chips ---- */
.chip-stack {
  position: absolute; left: 0.75rem; right: 0.75rem; bottom: 1.875rem; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 0.5rem;
}
.chip-stack > * { pointer-events: auto; }
.chip-stack .oct-chip { position: static; max-width: 100%; }
.tip-chip {
  display: flex; align-items: center; gap: 0.5rem; max-width: 100%; padding: 0.3125rem 0.25rem 0.3125rem 0.875rem; border-radius: 1.5rem;
  background: var(--print); color: var(--paper); font-size: clamp(0.6875rem, 3vw, 0.8125rem); font-weight: 500; line-height: 1.2; white-space: nowrap;
  box-shadow: 0 0.375rem 1.125rem rgba(0, 0, 0, 0.2);
}
.tip-chip > span { overflow: hidden; text-overflow: ellipsis; }
.tip-chip[hidden] { display: none; }
.tip-chip svg { width: 1.125rem; height: 1.125rem; flex: none; }
@media (prefers-reduced-motion: no-preference) { .tip-chip { animation: ruler-up 180ms ease-out; } }

/* ---- warning on the Sing button, and the card it opens ---- */
.mic-wrap { position: relative; flex: none; }
.mic-badge {
  position: absolute; right: 0.125rem; top: 0; width: 1.875rem; height: 1.875rem; border-radius: 50%; padding: 0;
  display: grid; place-items: center; background: #f2c14e; color: #171e28; border: 2px solid var(--paper);
}
.mic-badge[hidden] { display: none; }
/* the headphones tip: a bubble in the warning's yellow, its tail on the warning */
.tip-bubble {
  position: absolute; right: 0; bottom: calc(100% + 0.5rem); z-index: 3; box-sizing: border-box;
  display: flex; align-items: center; width: max-content; max-width: calc(100vw - 2 * var(--edge)); min-height: 2.5rem; padding: 0.25rem 0 0.25rem 0.875rem;
  border-radius: 0.875rem; background: #f2c14e; color: #171e28; font: 500 clamp(0.6875rem, 3vw, 0.8125rem)/1.25 var(--sans);
  box-shadow: 0 0.375rem 1.125rem rgba(0, 0, 0, 0.35);
}
.tip-bubble[hidden] { display: none; }
.tip-bubble::after { content: ''; position: absolute; right: 0.71875rem; bottom: -0.3125rem; width: 0.6875rem; height: 0.6875rem; border-radius: 0 0 0.125rem 0; background: inherit; transform: rotate(45deg); }
.tip-close { flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; border: 0; background: none; color: inherit; opacity: 0.75; }
.tip-close svg { width: 0.875rem; height: 0.875rem; stroke-width: 2.25; }
@media (prefers-reduced-motion: no-preference) { .tip-bubble { animation: ruler-up 180ms ease-out; transform-origin: 90% 100%; } }
/* by default the badge is the quiet way in to the microphone list; the warning takes it over */
.mic-row { display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 3rem; padding: 0.375rem 0.125rem; border: 0; border-top: 1px solid var(--staff); background: none; color: inherit; font: inherit; text-align: left; }
.mic-row:first-child { border-top: 0; }
.mic-dot { flex: none; width: 1.25rem; height: 1.25rem; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--muted); }
.mic-row[aria-checked="true"] .mic-dot { border: 0.375rem solid var(--pen); }
.mic-name { flex: 1; min-width: 0; font: 500 1rem/1.2 var(--sans); }
.mic-tag { flex: none; padding: 0.1875rem 0.5625rem; border-radius: 0.625rem; background: var(--paper); font-size: var(--t-xs); font-weight: 500; }
.mic-row[aria-checked="true"] .mic-name { font-weight: 700; }
.mic-lag { display: flex; align-items: center; gap: 0.625rem; margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--staff); }
.mic-lag-name { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; font-size: var(--t-s); font-weight: 500; }
.mic-lag-val { flex: none; min-width: 3.625rem; text-align: center; font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mic-auto { position: relative; min-height: 1.5rem; padding: 0 0.5625rem; border: 1px solid var(--staff); border-radius: 0.75rem; background: none; color: var(--print); font: 500 var(--t-xs)/1 var(--sans); }
.mic-auto::before { content: ''; position: absolute; inset: -0.625rem -0.5rem; }
.mic-auto[aria-pressed='true'] { background: var(--print); border-color: var(--print); color: var(--paper); font-weight: 700; }
.mic-meter { flex: none; position: relative; width: 4rem; height: 0.375rem; border-radius: 0.1875rem; background: var(--staff); overflow: hidden; }
.mic-meter span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 0.125rem; background: var(--pen); }
.mic-badge::before { content: ''; position: absolute; inset: -0.5rem; }
.mic-badge svg { display: block; width: 1.125rem; height: 1.125rem; position: relative; top: -0.0625rem; } /* a triangle's weight sits low: nudge it up */
.mic-card { width: 19rem; padding: 0.875rem; gap: 0; }
.mic-title { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.25; }
.mic-title svg { width: 1.25rem; height: 1.25rem; flex: none; color: #f2c14e; }
.mic-text { margin: 0.375rem 0 0; font-size: var(--t-s); line-height: 1.4; color: var(--muted); }
.mic-best { display: flex; align-items: center; gap: 0.5rem; margin: 0.625rem 0 0; padding: 0.625rem 0.75rem; border-radius: 0.875rem; background: var(--paper); font-size: var(--t-s); font-weight: 500; }
.mic-best svg { width: 1.125rem; height: 1.125rem; flex: none; color: #f2c14e; }

.ruler-note {
  width: 11.5rem; margin: 0; padding: 0.625rem 0.75rem; border-radius: 0.875rem; background: var(--paper-2); border: 1px solid var(--staff);
  font-size: var(--t-xs); line-height: 1.35; color: var(--muted); box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35); white-space: normal;
}

/* ---- the gear in the player's header, and the panel it opens: layers, their settings, the song ---- */
/* The panel opens under the header, on the paper. The desk slides down to make room for it (a negative
   margin set in the script), so the sheet moves down and stays in full view while a setting is changed. */
.gear-panel {
  flex: 0 1 auto; min-height: 0; display: grid; grid-template-rows: 0fr; position: relative; z-index: 2;
  border-bottom: 1px solid var(--staff); box-shadow: 0 0.5rem 0.75rem -0.625rem rgba(0, 0, 0, 0.3);
}
.gear-panel.is-open { grid-template-rows: 1fr; }
.layers-card { min-height: 0; overflow-y: auto; padding: calc(var(--safe-t) + 0.5rem) var(--edge) 0.875rem; touch-action: pan-y; }
/* the panel's top line: the layer tiles (or, on a row's page, the way back) and the way out, where the gear was */
.gear-top { display: flex; align-items: flex-start; gap: 0.5rem; }
.gear-top .layer-tiles { flex: 1; min-width: 0; }
.gear-close { flex: none; margin-right: -0.5rem; background: var(--print); color: var(--paper); border-radius: 50%; }
.gear-back { display: flex; align-items: center; gap: 0.375rem; min-height: 2.75rem; margin: 0 auto 0.375rem -0.25rem; padding: 0 0.75rem 0 0; border: 0; background: none; color: var(--print); font-size: var(--t-l); font-weight: 700; }
.gear-back svg { width: 1.25rem; height: 1.25rem; }
/* the microphone's page sits on paper here, not on the desk */
.mic-page .mic-tag, .mic-page .mic-best { background: var(--paper-2); }
.mic-page .mic-best svg { color: var(--print); }
.gear-line { display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; }
.gear-line + .gear-line { border-top: 1px solid var(--rule); }
.gear-line-name { flex: none; width: 3.75rem; font-size: var(--t-s); font-weight: 500; }
.gear-line .seg { flex: 1; min-width: 0; margin-top: 0; }
.gear-line ~ .fold-act-quiet { margin-top: 0.125rem; }
@media (prefers-reduced-motion: no-preference) {
  .gear-panel { transition: grid-template-rows 200ms ease; }
  .practice .deck { transition: margin-bottom 200ms ease; }
}
/* the song's own actions wait at the foot of the screen, on a short dark bar where the desk was */
.gear-dock {
  --paper: #171e28; --staff: #5a6676; --print: #eef1ed; --take: #f0a58f; --rule: rgba(238, 241, 237, 0.13);
  position: relative; z-index: 1; background: var(--paper); border-radius: 1.375rem 1.375rem 0 0;
  padding: 0.875rem var(--edge) calc(var(--safe-b) + 0.875rem);
}
@media (prefers-color-scheme: dark) { .gear-dock { --paper: #0b1017; } }
@media (prefers-reduced-motion: no-preference) { .gear-dock { animation: rise 200ms ease-out; } }
.gear-dock :focus-visible { outline-color: var(--print); }
.gear-foot { display: flex; flex-wrap: wrap; gap: 0.625rem; }
.gear-act { flex: 1 1 9rem; min-height: 2.875rem; padding: 0 1rem; border: 1.5px solid var(--staff); border-radius: 1.4375rem; background: none; color: var(--print); font-size: 0.9375rem; font-weight: 500; }
.gear-act.is-danger { color: var(--take); }
.gear-act:active { background: var(--rule); }
.layer-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.25rem; }
.layer-tile { display: flex; flex-direction: column; align-items: center; gap: 0.3125rem; padding: 0; border: 0; background: none; color: var(--print); font-size: var(--t-xs); font-weight: 500; }
.layer-pic { width: 3.375rem; height: 3.375rem; border-radius: 0.8125rem; border: 1.5px solid var(--staff); display: grid; place-items: center; overflow: hidden; opacity: 0.55; }
.layer-pic svg { width: 3rem; height: 3rem; }
.layer-tile[aria-pressed='true'] { color: var(--pen); font-weight: 700; }
.layer-tile[aria-pressed='true'] .layer-pic { border: 2.5px solid var(--pen); opacity: 1; }
.layer-tile:disabled { opacity: 0.4; }
/* a song with backing voices has a sixth layer */
.layer-tiles.has-six { grid-template-columns: repeat(6, 1fr); gap: 0.125rem; }
.layer-tiles.has-six .layer-pic { width: 2.875rem; height: 2.875rem; border-radius: 0.6875rem; }
.layer-tiles.has-six .layer-pic svg { width: 2.5rem; height: 2.5rem; }
.layer-tiles.has-six .layer-tile { font-size: 0.6875rem; white-space: nowrap; }
.layers-lyrics:not(:empty) { border-top: 1px solid var(--staff); margin-top: 0.875rem; }
.layers-sub { margin: 0.75rem 0.125rem 0; font-size: var(--t-s); font-weight: 700; }
.layers-label { margin: 0.75rem 0.125rem 0.375rem; font-size: var(--t-xs); color: var(--muted); }
.layers-none { margin: 0.75rem 0.125rem 0; font-size: var(--t-s); color: var(--muted); }
.seg { display: flex; gap: 0.125rem; padding: 0.1875rem; border-radius: 0.8125rem; background: var(--rule); }
.seg button { flex: 1; min-height: 2.25rem; border: 0; border-radius: 0.6875rem; background: none; color: var(--print); font-size: 0.8125rem; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.seg button[aria-checked='true'], .seg .seg-mid { background: var(--print); color: var(--paper); font-weight: 700; }
.seg button:active { opacity: 0.7; }

/* lyrics on top: a fixed pair of lines above the staff */
.lyric-top {
  position: absolute; left: 0; right: 0; top: 0.375rem; z-index: 1; padding: 0 3.75rem; text-align: center; pointer-events: none;
  opacity: 0; transform: translateY(0.375rem);
}
.lyric-top.is-shown { opacity: 1; transform: none; }
.lyric-top p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lyric-top p { will-change: transform, opacity; }
.lyric-top .lyric-now { font: 700 1.3125rem/1.2 var(--sans); color: var(--print); }
.lyric-top.is-upcoming .lyric-now { color: var(--muted); }
.lyric-top .lyric-next { font: 500 0.9375rem/1.3 var(--sans); color: var(--muted); }
.lyric-top.size-s .lyric-now { font-size: 1.0625rem; } .lyric-top.size-s .lyric-next { font-size: 0.8125rem; }
.lyric-top.size-l .lyric-now { font-size: 1.625rem; } .lyric-top.size-l .lyric-next { font-size: 1.125rem; }
@media (prefers-reduced-motion: no-preference) {
  .lyric-top { transition: opacity 320ms ease, transform 320ms ease; }
}

/* ================= one pattern each: tab cards, chips, folding rows ================= */
/* a dark card that rises from a tab (or the Sing warning), with the tab's name on it */
.tab-card {
  position: fixed; z-index: 7; width: 15rem; box-sizing: border-box; padding: 0.75rem;
  background: var(--paper-2); border: 1px solid var(--staff); border-radius: 1.25rem; box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}
.tab-card-title { margin: 0 0.125rem 0.625rem; font: 600 1.125rem/1.2 var(--serif); }
/* Mix in a song with backing voices: three faders and the part you sing */
.tab-card.mix-card { width: 17rem; }
.mix-part { display: flex; align-items: center; gap: 0.75rem; margin: 0.25rem 0.125rem 0; padding-top: 0.625rem; border-top: 1px solid var(--staff); font-size: var(--t-xs); color: var(--muted); }
.mix-part .seg { flex: 1; }
.slide { display: block; margin: 0 0.125rem 0.75rem; }
.slide:last-child { margin-bottom: 0.25rem; }
.slide-top { display: flex; justify-content: space-between; font-size: var(--t-xs); color: var(--muted); }
.slide-top output { color: var(--print); font-weight: 700; font-variant-numeric: tabular-nums; }
.slide input { display: block; width: 100%; height: 2.25rem; margin: 0; accent-color: var(--print); touch-action: pan-y; }
.presets { display: flex; gap: 0.375rem; }
.presets button { flex: 1; min-height: 2.25rem; border: 0; border-radius: 0.6875rem; background: var(--paper); color: var(--print); font-size: 0.8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.presets button[aria-pressed='true'] { background: var(--print); color: var(--paper); font-weight: 700; }
.opts { display: flex; flex-direction: column; gap: 0.125rem; }
.opt { display: flex; flex-direction: column; width: 100%; padding: 0.5rem 0.75rem; border: 0; border-radius: 0.8125rem; background: none; color: var(--print); text-align: left; }
.opt b { font-size: 0.875rem; line-height: 1.15; }
.opt small { font-size: var(--t-xs); line-height: 1.25; opacity: 0.7; }
.opt[aria-checked='true'] { background: var(--print); color: var(--paper); }

/* chips: the app talking to you. Always this dark pill, always in the strip above the player */
.chip-stack { gap: 0.375rem; }
.pill-chip {
  display: flex; align-items: center; gap: 0.5rem; max-width: 100%; min-height: 2.5rem; box-sizing: border-box; margin: 0;
  padding: 0.3125rem 0.875rem; border: 0; border-radius: 1.25rem; background: var(--print); color: var(--paper);
  font: 500 clamp(0.6875rem, 3vw, 0.8125rem)/1.2 var(--sans); white-space: nowrap; box-shadow: 0 0.25rem 0.875rem rgba(0, 0, 0, 0.18);
}
.pill-chip[hidden] { display: none; }
.pill-chip > span { overflow: hidden; text-overflow: ellipsis; }
.pill-chip svg { width: 1rem; height: 1rem; flex: none; }
div.pill-chip { padding-right: 0.25rem; }
.pill-chip .oct-match { min-height: 1.875rem; padding: 0 0.75rem; border: 0; border-radius: 0.9375rem; background: var(--paper); color: var(--print); font: inherit; font-weight: 700; }
.pill-chip .oct-close { width: 1.875rem; height: 1.875rem; padding: 0; border: 0; background: none; color: var(--paper); opacity: 0.7; font-size: 1.125rem; line-height: 1; }
button.pill-chip:active { opacity: 0.8; }
@media (prefers-reduced-motion: no-preference) { .pill-chip, .loop-group { animation: ruler-up 180ms ease-out; } }

/* rows that open inside the gear sheet */
.layers-rows { margin-top: 0.875rem; }
.layers-rows + .layers-rows { margin-top: 0; }
.fold { border-top: 1px solid var(--staff); }
.fold summary, .fold-flat { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 2.75rem; padding: 0 0.125rem; font-size: var(--t-s); font-weight: 500; list-style: none; cursor: pointer; }
.fold summary::-webkit-details-marker { display: none; }
.fold-val { color: var(--muted); font-weight: 400; text-align: right; }
.fold summary .fold-val::after { content: ' ›'; }
.fold[open] summary .fold-val::after { content: ' ⌄'; }
.fold-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 2.75rem; padding: 0 0.125rem; border: 0; border-top: 1px solid var(--staff); background: none; color: var(--print); font-size: var(--t-s); font-weight: 500; text-align: left; }
.fold-row .fold-val::after { content: ' ›'; }
.fold-row:active { background: var(--rule); }
.fold-body { padding: 0; }
.fold-body .layers-label:first-child { margin-top: 0.25rem; }
.fold-act { min-height: 2.25rem; padding: 0 0.875rem; border: 1.5px solid var(--staff); border-radius: 1.125rem; background: none; color: var(--print); font-size: 0.8125rem; font-weight: 500; }
.fold-act[hidden] { display: none; }
.fold-act-quiet { margin-top: 0.75rem; border: 0; padding: 0 0.125rem; color: var(--muted); text-decoration: underline; }
.layers-card .slide-top { color: var(--muted); }

/* a loop's passes: the last few as little bars, this one's score, and how it compares */
.pass-chip { gap: 0.625rem; }
div.pass-chip { padding-right: 0.875rem; }
.pass-bars { display: flex; align-items: flex-end; gap: 0.1875rem; height: 1.125rem; overflow: visible; }
.pass-bars i { width: 0.3125rem; border-radius: 0.125rem; background: var(--paper); opacity: 0.45; }
.pass-bars i.is-last { opacity: 1; }
.pass-chip b { font-weight: 700; }
.pass-up { color: #a9bbff; font-weight: 700; }
.pass-down { opacity: 0.7; }
.pass-best { opacity: 0.7; }
@media (prefers-color-scheme: dark) { .pass-up { color: #2742d3; } }

/* how that take went: a card on the sheet when you pause */
.take-card {
  position: absolute; left: 0.75rem; right: 0.75rem; bottom: 1.875rem; z-index: 4; box-sizing: border-box;
  padding: 0.875rem 1rem 0.5rem; border-radius: 1.25rem; background: var(--paper); border: 1px solid var(--staff);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.18);
}
.take-head { display: flex; align-items: center; justify-content: space-between; margin: -0.25rem 0 0.25rem; }
.take-title { margin: 0; font: italic 600 1.25rem/1.2 var(--serif); }
.take-close { width: 2.5rem; height: 2.5rem; margin-right: -0.625rem; border: 0; background: none; color: var(--muted); font-size: 1.375rem; line-height: 1; }
.take-score { display: flex; align-items: baseline; gap: 0.625rem; margin-bottom: 0.5rem; }
.take-score b { font: 700 2.5rem/1 var(--sans); color: var(--pen); font-variant-numeric: tabular-nums; }
.take-score span { font-size: 0.8125rem; line-height: 1.3; color: var(--muted); }
.take-row { display: flex; align-items: center; gap: 0.625rem; padding: 0.5625rem 0.125rem; border-top: 1px solid var(--staff); }
.take-row > div { flex: 1; min-width: 0; }
.take-row small { display: block; font-size: 0.75rem; line-height: 1.25; color: var(--muted); }
.take-row strong { display: block; font-size: 0.9375rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.take-loop { flex: none; min-height: 2.25rem; padding: 0 0.875rem; border: 0; border-radius: 1.125rem; background: var(--print); color: var(--paper); font: 700 0.8125rem/1 var(--sans); }
@media (prefers-reduced-motion: no-preference) { .take-card { animation: ruler-up 180ms ease-out; } }

/* renaming a part */
.name-note { margin: -0.25rem 0 0.75rem; font-size: var(--t-s); color: var(--muted); }
.name-input { width: 100%; box-sizing: border-box; min-height: 2.75rem; padding: 0 0.875rem; border: 1.5px solid var(--staff); border-radius: 0.75rem; background: var(--paper); color: var(--print); font: italic 500 1.125rem var(--serif); }
.name-input:focus { outline: 2px solid var(--pen); outline-offset: 1px; }
.name-picks { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0.75rem 0 1rem; }
.name-picks button { min-height: 2.25rem; padding: 0 0.875rem; border: 1.5px solid var(--staff); border-radius: 1.125rem; background: none; color: var(--print); font: 500 0.875rem/1 var(--sans); }
.pass-bars[hidden] { display: none; }

/* Loop what? A drawer from the left, over the player. The player behind it drifts a little right and down. */
.practice { transform-origin: 50% 50%; }
.practice.is-drawn { transform: translate(0.875rem, 0.5rem) scale(0.975); border-radius: 1.5rem; }
@media (prefers-reduced-motion: no-preference) { .practice { transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), border-radius 320ms ease; } }
.drawer-scrim { position: fixed; inset: 0; z-index: 20; background: rgba(10, 14, 20, 0.4); touch-action: none; }
.loop-drawer {
  --drawer: #f3f5f1; --on-pen: #ffffff;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 21; width: min(17.5rem, calc(100vw - 4.5rem));
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 0.5rem) 0.75rem calc(var(--safe-b) + 1rem) 0.75rem;
  background: var(--drawer); color: var(--print);
  border-radius: 0 1.75rem 1.75rem 0; box-shadow: 0.75rem 0 2.5rem rgba(0, 0, 0, 0.3);
}
@media (prefers-color-scheme: dark) { .loop-drawer { --drawer: var(--paper-2); --on-pen: #141a23; } }
@keyframes drawer-in { from { transform: translateX(-100%); } }
@media (prefers-reduced-motion: no-preference) {
  .loop-drawer { animation: drawer-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .drawer-scrim { animation: fade-in 200ms ease-out; }
}
@keyframes fade-in { from { opacity: 0; } }
.drawer-head { flex: none; display: flex; align-items: center; justify-content: space-between; min-height: 2.75rem; padding-left: 0.25rem; }
.drawer-head h3 { margin: 0; font: 700 var(--t-2) / 1.2 var(--serif); }
.drawer-close { width: 2.75rem; height: 2.75rem; margin-right: -0.25rem; border: 0; background: none; color: var(--print); display: grid; place-items: center; }
.drawer-close svg { width: 1.25rem; height: 1.25rem; stroke-width: 2.25; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.375rem 0 0.75rem 1rem; }
/* the map: one block per part, in song order, on a line that runs down the song */
.map { position: relative; display: flex; flex-direction: column; gap: 0.25rem; }
.map::before { content: ''; position: absolute; left: -0.6875rem; top: 0; bottom: 0; width: 2px; border-radius: 1px; background: var(--staff); }
.map-part { position: relative; display: flex; flex-direction: column; border-radius: 0.625rem; background: var(--paper); }
.map-part.is-quiet { background: none; box-shadow: inset 0 0 0 1.5px var(--staff); }
.map-part.is-here::before { content: ''; position: absolute; left: -1rem; top: 1rem; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--print); }
.map-head { flex: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; width: 100%; min-height: 2.75rem; padding: 0.6875rem 0.75rem; border: 0; border-radius: inherit; background: none; color: inherit; font: 500 var(--t-m) / 1.3 var(--sans); text-align: left; }
.map-name { min-width: 0; overflow-wrap: anywhere; }
.map-name b { margin-left: 0.375rem; font-size: var(--t-xs); font-weight: 700; color: var(--pen); }
.map-bars { flex: none; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-part.is-open { background: var(--pen); color: var(--on-pen); box-shadow: none; }
.map-part.is-open .map-head { flex: none; font-weight: 700; }
.map-part.is-open .map-name b, .map-part.is-open .map-bars { color: inherit; }
.map-part.is-open :focus-visible { outline-color: var(--on-pen); }
.map-strip { display: flex; gap: 2px; height: 2.75rem; margin: 0 0.75rem; touch-action: none; }
.map-bar { flex: 1; min-width: 0; padding: 0; border: 0; background: color-mix(in srgb, var(--on-pen) 24%, transparent); }
.map-bar:first-child { border-radius: 0.375rem 0 0 0.375rem; }
.map-bar:last-child { border-radius: 0 0.375rem 0.375rem 0; }
.map-bar[aria-pressed='true'] { background: var(--on-pen); }
.map-note { margin: 0; padding: 0.5rem 0.75rem 0.75rem; font-size: 0.8125rem; line-height: 1.3; }
.map-around { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; width: 100%; min-height: 2.75rem; margin-top: 0.75rem; padding: 0 0.75rem; border: 1.5px solid var(--staff); border-radius: 0.625rem; background: none; color: var(--print); font: 500 0.875rem/1.2 var(--sans); text-align: left; }
.map-around span { flex: none; color: var(--muted); font-weight: 400; }
.drawer-foot { flex: none; padding: 0.75rem 0 0 0.25rem; border-top: 1px solid var(--rule); }
.drawer-label { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.375rem; font-size: var(--t-m); }
.drawer-label svg { width: 1.25rem; height: 1.25rem; }
.drawer-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.25rem; padding: 0.25rem; border-radius: 0.875rem; background: var(--paper); }
.drawer-seg button { min-height: 2.75rem; border: 0; border-radius: 0.625rem; background: none; color: var(--print); font: 400 0.9375rem/1 var(--sans); }
.drawer-seg button[aria-pressed='true'] { background: var(--print); color: var(--paper); font-weight: 700; }

/* hear your take: one chip after you sing, centred on the sheet */
.hear-chip { padding-left: 0.25rem; gap: 0; }
div.hear-chip { padding-right: 0; }
.hear-chip .oct-match { margin: 0 0.25rem 0 0.375rem; }
.hear-play { display: flex; align-items: center; gap: 0.5rem; min-height: 1.875rem; padding: 0 0.75rem; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; }
.hear-play small { font-size: inherit; opacity: 0.7; font-weight: 400; }
/* the chip also saves the take: a download button on its end, and a line that fills while the file is written */
.hear-chip { position: relative; overflow: hidden; }
.hear-save { display: grid; place-items: center; align-self: stretch; width: 2.75rem; margin: -0.3125rem 0; padding: 0; border: 0; border-left: 1px solid color-mix(in srgb, currentColor 30%, transparent); background: none; color: inherit; }
.hear-save[hidden], .hear-chip .oct-match[hidden] { display: none; }
.hear-save:disabled { opacity: 0.4; }
.hear-save:active { opacity: 0.7; }
.hear-chip.is-saving::after { content: ''; position: absolute; left: 0; bottom: 0; height: 0.1875rem; width: calc(var(--p, 0) * 100%); background: currentColor; }
.hear-chip.is-playing { background: var(--take); color: #fff; }
.hear-chip.is-playing .oct-close { color: #fff; }
@media (prefers-color-scheme: dark) { .hear-chip.is-playing, .hear-chip.is-playing .oct-close { color: #171e28; } }

/* key: five tabs now, the fit picture, and the steps */
.tabs { grid-template-columns: repeat(5, 1fr); }
.key-card { width: min(18.5rem, calc(100vw - 1rem)); }
.key-card .tab-card-title { margin: 0; }
.key-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0.125rem 0.25rem; }
.key-orig { min-height: 2rem; padding: 0 0.75rem; border: 1px solid var(--staff); border-radius: 1rem; background: none; color: inherit; font: 500 0.8125rem/1 var(--sans); }
.key-orig:disabled { opacity: 0.35; }
.key-now { flex: 1; text-align: center; min-width: 0; }
.key-now b { display: block; font: 600 1.25rem/1.15 var(--serif); }
.key-now small { display: block; font-size: var(--t-xs); line-height: 1.3; opacity: 0.7; }
.key-card .key-now { padding: 0.375rem 0 0.5rem; }
.key-card .key-now b { font: 700 2.5rem/1 var(--sans); font-variant-numeric: tabular-nums; }
.key-card .key-now small { margin-top: 0.125rem; opacity: 1; color: var(--muted); }
.key-scale { padding: 0 0.75rem; touch-action: none; -webkit-user-select: none; user-select: none; border-radius: 0.75rem; }
.key-track { position: relative; height: 4.75rem; }
.key-track i { position: absolute; display: block; }
.key-line { left: 0; right: 0; top: 1.875rem; height: 1px; background: currentColor; opacity: 0.3; }
.key-tick { top: 1.5rem; width: 1.5px; height: 0.8125rem; margin-left: -0.75px; border-radius: 1px; background: currentColor; opacity: 0.55; }
.key-tick.is-zero { top: 1rem; height: 1.8125rem; }
.key-fit { top: 3rem; height: 0.3125rem; border-radius: 0.1875rem; background: var(--pen); }
.key-knob { top: 1.25rem; width: 1.25rem; height: 1.25rem; margin-left: -0.625rem; border-radius: 50%; background: radial-gradient(circle, var(--paper-2) 0 0.1875rem, var(--print) 0.25rem); }
.key-mark { position: absolute; top: 3.625rem; transform: translateX(-50%); font-size: var(--t-xs); font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; margin-top: 0.5rem; }
.key-step { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1.5px solid color-mix(in srgb, currentColor 30%, transparent); background: none; color: inherit; font: 500 1.375rem/1 var(--sans); }
.key-step:disabled { opacity: 0.3; }
.key-legend { display: flex; align-items: center; gap: 0.375rem; font-size: var(--t-xs); color: var(--muted); }
.key-legend i { width: 1rem; height: 0.3125rem; border-radius: 0.1875rem; background: var(--pen); }
@media (prefers-reduced-motion: no-preference) { .key-knob { transition: left 120ms ease-out; } }
.key-spin { width: 0.875rem; height: 0.875rem; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--paper) 35%, transparent); border-top-color: var(--paper); }
div.key-busy { padding-right: 1rem; }
@media (prefers-reduced-motion: no-preference) { .key-spin { animation: key-spin 0.9s linear infinite; } }
@keyframes key-spin { to { transform: rotate(360deg); } }

/* loop mode: the Loop tab is a filled pill, and the loop's controls are one chip of three marks: the whole part, the count-in, end.
   It shares one centred row with the take chip */
.chip-pair { display: flex; flex-wrap: wrap-reverse; justify-content: center; align-self: center; gap: 0.375rem; max-width: 100%; }
.chip-pair[hidden] { display: none; }
.tab-loop.is-on::before { content: ''; position: absolute; inset: 0.3125rem 0.5rem 0.1875rem; border-radius: 0.75rem; background: var(--pen); }
.tab-loop.is-on > * { position: relative; }
.tab-loop.is-on .tab-cap, .tab-loop.is-on .tab-val { color: var(--paper); }
.tab-loop.is-on .tab-val { font-weight: 700; }
.loop-group {
  display: flex; align-items: stretch; flex: none; max-width: 100%; min-height: 2.5rem; box-sizing: border-box; overflow: hidden;
  border-radius: 1.25rem; background: var(--print); color: var(--paper);
  font: 500 clamp(0.6875rem, 3vw, 0.8125rem)/1.2 var(--sans); white-space: nowrap; box-shadow: 0 0.25rem 0.875rem rgba(0, 0, 0, 0.18);
}
.loop-group[hidden], .loop-group [hidden] { display: none; }
.loop-group button { display: flex; align-items: center; justify-content: center; gap: 0.25rem; flex: none; min-width: 2.75rem; margin: 0; padding: 0 0.625rem; border: 0; background: none; color: inherit; font: inherit; }
.loop-group button:active { opacity: 0.7; }
.loop-group svg { width: 1.125rem; height: 1.125rem; flex: none; }
.loop-group .part-offer { padding: 0 0.625rem 0 0.75rem; background: var(--pen); color: #fff; }
.loop-group .loop-count { font-weight: 700; }
.loop-group .loop-end { border-left: 1px solid color-mix(in srgb, currentColor 30%, transparent); }

/* ---- opening a song: the practice screen in its final shape, with a hairline that fills ---- */
.bar-cover { width: 2rem; height: 2rem; }
.load-line { flex: none; height: 3px; margin-top: 0.375rem; background: var(--staff); }
.load-line i { display: block; width: 0; height: 100%; background: var(--print); }
@media (prefers-reduced-motion: no-preference) { .load-line i { transition: width 220ms ease-out; } }
.load-sheet::before {
  content: ''; position: absolute; inset: 0 0 0 2.5rem; opacity: 0.6;
  border-left: 1px solid color-mix(in srgb, var(--graphite) 55%, transparent);
  background: repeating-linear-gradient(to bottom, transparent 0 0.875rem, var(--staff) 0.875rem calc(0.875rem + 1px));
}
.load-deck > * { opacity: 0.22; }
.load-mini { height: 2.875rem; border-radius: 0.375rem; background: var(--paper-2); opacity: 0.7 !important; }
.load-deck .transport { align-items: center; padding: 0 0.875rem; min-height: 5.125rem; }
.load-ring { width: 3rem; height: 3rem; border-radius: 50%; border: 1.5px solid var(--graphite); }
.load-ring.is-play { width: 4.5rem; height: 4.5rem; border: 0; background: var(--print); }

/* ---------- adding a song: the desk rises ---------- */
.sheet.is-desk {
  background: #171e28; color: #eef1ed; box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.3);
  --print: #eef1ed; --paper: #171e28; --muted: #a9b3bd; --staff: #5a6676; --rule: rgba(238, 241, 237, 0.16);
}
@media (prefers-color-scheme: dark) { .sheet.is-desk { background: #0b1017; --paper: #0b1017; } }
.sheet.is-desk h3 { font: 600 var(--t-2) / 1.2 var(--serif); margin-bottom: 1rem; }
.sheet.is-desk :focus-visible { outline-color: #eef1ed; }
.sheet-pick {
  display: flex; align-items: center; gap: 0.875rem; width: 100%; min-height: 4rem; padding: 0 1.125rem;
  border: 0; border-radius: 0.875rem; background: #eef1ed; color: #171e28; text-align: left;
}
.sheet-pick svg { flex: none; width: 1.625rem; height: 1.625rem; }
.sheet-pick strong { display: block; font-size: var(--t-l); font-weight: 700; }
.sheet-pick span span { display: block; font-size: var(--t-s); color: #4b535a; }
.sheet-foot { display: flex; align-items: center; gap: 0.5rem; margin: 0.875rem 0 0; font-size: var(--t-s); color: var(--muted); }
.sheet-file { margin: -0.625rem 0 0.875rem; font-size: var(--t-s); color: var(--muted); overflow-wrap: anywhere; }
.field { display: block; margin-bottom: 0.875rem; }
.field span { display: block; margin-bottom: 0.375rem; font-size: var(--t-s); color: var(--muted); }
.field input {
  width: 100%; height: 3.25rem; padding: 0 0.875rem; border: 1px solid #5a6676; border-radius: 0.75rem;
  background: #232c39; color: #eef1ed; font-size: var(--t-l); font-weight: 500;
}
.field input::placeholder { color: #a9b3bd; }
.sheet-actions { display: flex; gap: 0.625rem; margin-top: 1rem; }

/* ---------- a song still being written ---------- */
.song-left { flex: none; min-width: 2.75rem; text-align: right; font-size: 0.8125rem; line-height: 1.15; color: var(--muted); }
.song-left strong { display: block; font: 600 var(--t-l) / 1 var(--serif); color: var(--print); white-space: nowrap; }
.songs.is-roomy .song-left strong { display: inline; }
.song-act { flex: none; min-height: 2.75rem; padding: 0 1rem; border-radius: 0.75rem; }
.songs.is-roomy .song-act { margin-top: 0.5rem; }
.writing { flex: none; padding: 0 var(--edge) 0.375rem; }
.writing .load-line { height: 4px; margin: 0.375rem 0 0.5rem; border-radius: 2px; }
.writing .load-line i { border-radius: 2px; }
.writing-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 1.5rem; }
.writing-row strong { font-weight: 700; }
.writing-pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.writing-note { display: flex; align-items: center; gap: 0.375rem; min-width: 0; font-size: var(--t-s); color: var(--muted); }
.writing-btn { margin-left: auto; min-height: 2.75rem; padding: 0 1rem; border-radius: 0.75rem; }
/* while a song is written, light sweeps across its row on the slant */
.song-row.is-writing { position: relative; overflow: hidden; }
.song-row.is-writing::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 38%, var(--sheen, rgba(255, 255, 255, 0.6)) 50%, transparent 62%) 100% 0 / 250% 100% no-repeat;
}
@media (prefers-color-scheme: dark) { .song-row.is-writing::after { --sheen: rgba(255, 255, 255, 0.08); } }
@media (prefers-reduced-motion: no-preference) { .song-row.is-writing::after { animation: sheen 1.8s ease-in-out infinite; } }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
/* a song still being written: a bar where its melody will go */
.songs .song-bar, .songs.is-roomy .song-bar { height: 4px; border-radius: 2px; background: var(--staff); overflow: hidden; }
.songs.is-roomy .song-bar { margin-top: 0.875rem; }
.song-bar i { display: block; width: 0; height: 100%; border-radius: 2px; background: var(--print); }
@media (prefers-reduced-motion: no-preference) { .song-bar i { transition: width 300ms ease-out; } }
/* while a song is written: a rounded highlighter-yellow banner that stays at the top of the list */
.keep-bar {
  position: sticky; top: calc(var(--safe-t) + 0.5rem); z-index: 5; flex: none;
  display: flex; align-items: center; gap: 0.75rem;
  margin: calc(var(--safe-t) + 0.5rem) var(--edge) 0; padding: 0.75rem 1rem;
  background: #f2d35b; color: #1c2530; border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.keep-bar svg { flex: none; width: 1.625rem; height: 1.625rem; }
.keep-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.keep-text strong { font-size: 1.0625rem; font-weight: 700; }
.keep-text span { font-size: var(--t-s); color: #3a3418; font-variant-numeric: tabular-nums; }
.keep-bar:not([hidden]) + .bar { padding-top: 0.5rem; }
/* the maker's line at the foot of the song list */
.credit { margin: 2.25rem 0 0; text-align: center; font-size: var(--t-s); color: var(--muted); }
.credit p { margin: 0; display: flex; align-items: center; justify-content: center; gap: 0.375rem; }
.credit svg { width: 1.375rem; height: 1.375rem; color: var(--print); overflow: visible; }
.credit a { display: inline-block; margin: 0 -0.5rem; padding: 0.75rem 0.5rem; color: var(--print); font-weight: 500; text-underline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .credit .steam { animation: steam 2.4s ease-in-out infinite; }
  .credit .steam + .steam { animation-delay: 1.2s; }
}
@keyframes steam { 0% { transform: translateY(2px); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(-3px); opacity: 0; } }

/* ================= settings: a ledger =================
   One ruled list, each row showing what it is set to. On pitch and Headphone delay open a study:
   an example on the paper, the control on the desk. The other rows open a desk sheet. */
.ledger-title { font: 500 var(--t-xl) / 1.2 var(--serif); }
.ledger { flex: 1; display: flex; flex-direction: column; padding-bottom: calc(var(--safe-b) + 1.25rem); }
.ledger h2 {
  margin: 1.625rem 0 0; padding: 0 var(--edge) 0.375rem; border-bottom: 1px solid var(--print);
  font: 700 0.8125rem / 1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--graphite);
}
.ledger h2:first-child { margin-top: 0.875rem; }
.ledger-row {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 3.5rem; padding: 0.375rem var(--edge);
  border: 0; border-bottom: 1px solid var(--staff); background: none; text-align: left; font-size: 1.0625rem;
}
.ledger-row:active { background: var(--rule); }
.ledger-name { flex: 1; min-width: 0; font-weight: 500; }
.ledger-name small { display: block; font-size: var(--t-s); font-weight: 400; color: var(--graphite); }
.ledger-val { color: var(--graphite); text-align: right; font-variant-numeric: tabular-nums; }
.ledger-row svg { flex: none; width: 1rem; height: 1rem; color: var(--graphite); }
.ledger-row > .switch { background: none; box-shadow: inset 0 0 0 1.5px var(--graphite); }
.ledger-row > .switch::after { background: var(--graphite); }
.ledger-row[aria-checked='true'] > .switch { background: var(--print); box-shadow: none; }
.ledger-row[aria-checked='true'] > .switch::after { background: var(--paper); }
.ledger-foot { margin: auto 0 0; padding: 1.5rem var(--edge) 0; font-size: var(--t-s); color: var(--graphite); }
.sheet.is-desk .report { background: #232c39; }

.app.is-study { height: 100dvh; }
.study-read {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; min-height: 1.75rem;
  padding: 0.25rem var(--edge) 0; font-size: 0.9375rem; color: var(--graphite);
}
.study-read strong { color: var(--print); text-align: right; }
.study-note { font: italic 500 var(--t-2) / 1 var(--serif); color: var(--pen); margin-right: 0.375rem; }
.study-paper { flex: 1; min-height: 0; display: flex; }
.study-fig { flex: 1; min-width: 0; min-height: 0; }
.study-fig svg { display: block; width: 100%; height: 100%; }
.ex-staff { stroke: var(--staff); stroke-width: 1; }
.ex-bar { stroke: var(--graphite); stroke-width: 1; opacity: 0.55; }
.ex-leap { stroke: var(--graphite); stroke-width: 1; }
.ex-pencil { stroke: var(--graphite); }
.ex-pen { stroke: var(--pen); }
.ex-dots { stroke-width: 2; stroke-dasharray: 1 6; }
.ex-now { stroke: var(--print); stroke-width: 1.4; }
.ex-nib { fill: var(--pen); }
.ex-nib.is-off { fill: var(--paper); stroke: var(--pen); stroke-width: 1.8; }
.ex-names { font: italic 15px var(--serif); fill: var(--graphite); }
.ex-label { font: 700 15px var(--sans); fill: var(--print); }

.study-desk {
  flex: none; display: flex; flex-direction: column; gap: 1rem;
  padding: 1.125rem var(--edge) calc(var(--safe-b) + 1.25rem); border-radius: 1.375rem 1.375rem 0 0;
  background: #171e28; color: #eef1ed;
  --print: #eef1ed; --paper: #171e28; --muted: #a9b3bd; --staff: #5a6676; --rule: rgba(238, 241, 237, 0.16);
}
@media (prefers-color-scheme: dark) { .study-desk { background: #0b1017; --paper: #0b1017; } }
.study-desk :focus-visible { outline-color: #eef1ed; }
.study-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 2.75rem; }
.study-head h2 { margin: 0; font: 500 var(--t-xl) / 1.2 var(--serif); }
.study-head > span { font-size: 0.9375rem; color: var(--muted); text-align: right; }
.study-opts { display: flex; gap: 0.5rem; }
.study-opt {
  flex: 1; min-height: 3.5rem; padding: 0; border: 1px solid var(--staff); border-radius: 0.75rem; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.study-opt b { font-weight: 500; }
.study-opt small { font-size: var(--t-s); color: var(--muted); }
.study-opt[aria-pressed='true'] { background: var(--print); border-color: var(--print); color: var(--paper); }
.study-opt[aria-pressed='true'] b { font-weight: 700; }
.study-opt[aria-pressed='true'] small { color: #3a4554; }
.delay-rule { position: relative; }
.delay-rule svg { display: block; width: 100%; height: auto; }
.delay-rule input { position: absolute; left: 0; top: 0; width: 100%; height: 3rem; margin: 0; opacity: 0; }
.delay-rule:has(input:focus-visible) { outline: 2px solid var(--print); outline-offset: 4px; border-radius: 0.5rem; }
.rule-line { stroke: var(--print); stroke-width: 1.4; }
.rule-minor { stroke: var(--muted); stroke-width: 1; }
.rule-mark { stroke: var(--muted); stroke-width: 3; }
.rule-knob { fill: var(--print); }
.rule-text { font: 14px var(--sans); fill: var(--muted); }
