/* EB Garamond (OFL, Google Fonts) — the "Engraved Serif" chart face
   (chosen from the style proposal): an italic serif reads as a typeset,
   hand-engraved fakebook page rather than a screen UI. Bundled and served
   from this binary (static/fonts/EBGaramond*.ttf via go:embed) so the app
   stays fully offline-capable, no CDN fetch. Used only for chord
   symbols/section labels on the chart, not UI chrome — general UI text
   stays on the neutral system stack per --font-ui. */
@font-face {
  font-family: "EB Garamond";
  src: url("/static/fonts/EBGaramond.ttf") format("truetype-variations"), url("/static/fonts/EBGaramond.ttf") format("truetype");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/static/fonts/EBGaramond-Italic.ttf") format("truetype-variations"), url("/static/fonts/EBGaramond-Italic.ttf") format("truetype");
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}

/* ---- Design tokens -----------------------------------------------------
   System font stacks for UI text — no network font loading, consistent
   with a single-binary, works-offline app. Light/dark follows the OS by
   default (`color-scheme` + `prefers-color-scheme`); `data-theme` on
   <body> is an explicit per-viewer override set by the theme-toggle
   button. */
/* Palette: "Larkin Poe" — terracotta + mustard gold, sampled live from
   larkinpoe.com (one of three real band/artist sites reviewed against this
   app's own blues/rock/soul catalogue — jbonamassa.com and raycharles.com
   were the other two candidates) and approved over the earlier "Stage"
   (plain amber) palette. --accent is the terracotta; --ok repurposes the
   palette's mustard gold as the secondary/positive accent (its own ink
   tone is deliberately darker than the raw gold hex, since gold alone
   fails body-text contrast — see --ok/--ok-bg below, gold is a background/
   underline color here, never a text color). --danger is pulled slightly
   toward pure red (away from orange) so it stays visually distinct from
   the now-terracotta --accent, which the old --danger hex sat too close
   to in hue. Same variable NAMES as before (just new values, plus the new
   --sidebar-* set for the desktop nav) so every existing selector in this
   file retones automatically — don't reintroduce a parallel set of color
   variables. */
:root {
  color-scheme: light dark;
  --gap: 1rem;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-chart: "EB Garamond", Georgia, "Times New Roman", serif;

  --bg: #f6f1e7;
  --bg-raised: #ffffff;
  --bg-sunken: #efe6d3;
  --fg: #241e18;
  --fg-muted: #5f554a;
  /* --fg-faint, --ok, and --warn below are darkened from their original
     hues (audit, Nov 2026 — computed WCAG contrast against their own
     backgrounds came in at 3.02:1 / 3.56:1 / 2.94:1, all failing AA's
     4.5:1 normal-text minimum). Each is a straight lightness reduction
     in HSV with hue/saturation untouched, so the palette's character
     — terracotta/mustard-gold warmth — survives; only the "how pale can
     this get before stage lighting eats it" margin changed. All three
     now clear 4.5:1 against their paired *-bg token. */
  --fg-faint: #6f675b;
  --border: #e7dfcf;
  --border-strong: #241e18;
  --accent: #af4e39;
  --accent-bg: #f3ddd4;
  --accent-ink: #8a3d2c;
  --accent-contrast: #ffffff;
  --current-bg: #f2ebc6;
  --current-fg: #4a3f14;
  --danger: #a52f2f;
  --danger-bg: #f7e0dc;
  --ok: #685c23;
  --ok-bg: #f2ebc6;
  --warn: #8a5920;
  --warn-bg: #f5e3c4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 22, 12, 0.06), 0 4px 14px rgba(28, 22, 12, 0.06);

  /* Documented spacing scale (audit, Nov 2026): most of the file already
     converges on these seven values by convention — this just names them
     so the next page built picks one instead of inventing an eighth. Not
     a hard requirement everywhere (the chart/tab-bar layouts have their
     own geometry-driven numbers that don't belong on this scale), but
     the default for ordinary padding/margin/gap. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Breakpoint inventory (audit, Nov 2026): 16 @media rules use 8 raw
     pixel values across the file — 480/560/600/640/760/761/900/901/1150.
     Confirmed by direct read: every "mobile" rule in the 900-tier
     consistently uses max-width:900px and every "desktop" rule uses
     min-width:901px (no accidental 899/900/901 mix), same for the
     760/761 pair — so none of this is a latent bug, just more distinct
     numbers than the three conceptual tiers below actually need:
       - ~600px  — "this one dense component needs its own mobile
                    treatment" (.table-stack/.passkeys-table at 600,
                    the gig/setlist row grids at 560, the toolbar's
                    duration row at 480 — all narrower special cases
                    nested inside the tier below, not a fourth tier).
       - ~760px  — chart/editor "tablet-and-up gets the richer layout"
                    boundary (.sheet-section multicol at 761, the edit
                    drawer/toolbar at 760).
       - ~900px  — app-chrome "desktop sidebar vs. mobile tab bar"
                    boundary (.form-with-list, .view-tabs, the editor
                    drawer's second breakpoint, the 901px desktop-nav
                    rules) — this is the one that matches icons.html's
                    own documented nav-architecture split.
       - 1150px  — one standalone widescreen enhancement (2-column
                    chart layout on very wide viewports), intentionally
                    outside the three tiers above, not a drift case.
     Not merged into literal shared numbers in this pass — each of
     these was tuned against where its own layout actually breaks
     (confirmed by its own in-file comment in most cases), and forcing
     them onto one shared pixel value without re-testing every affected
     component's content-driven breakpoint risks trading a documented,
     intentional number for an undocumented coincidence. Recorded here
     so the next page reaches for one of 480/600/760/900/1150 instead
     of inventing a ninth. */

  /* Desktop sidebar: a dark surface on purpose, distinct from the rest of
     the (light) app — see .desktop-sidebar's own comment. Not swapped by
     light/dark mode below; the sidebar stays dark in both, like a band
     site's header bar. */
  --sidebar-bg: #201b17;
  --sidebar-fg: #f2e9dd;
  --sidebar-border: #3a322b;
  --sidebar-active-bg: #352c20;
  --sidebar-active-fg: #e2d165;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1712;
    --bg-raised: #241d16;
    --bg-sunken: #140f0b;
    --fg: #f2e9dd;
    --fg-muted: #c4b8a0;
    --fg-faint: #9c8f78;
    --border: #3a322b;
    --border-strong: #f2e9dd;
    --accent: #d9684a;
    --accent-bg: #3a221a;
    --accent-ink: #f0a98c;
    --accent-contrast: #fff8f0;
    --current-bg: #e2d165;
    --current-fg: #241c08;
    /* --danger brightened from #d9584f (audit: 4.08:1 against
       --danger-bg, failing AA) to #ef6157 — same hue, raised value —
       now 4.87:1. --ok/--warn/--fg-faint's dark-mode pairs already
       cleared AA (7.4:1 / 6.2:1 / 5.6:1) and are untouched. */
    --danger: #ef6157;
    --danger-bg: #3a1a15;
    --ok: #cdbb63;
    --ok-bg: #2f2a17;
    --warn: #e0a24f;
    --warn-bg: #3a2a12;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 18px rgba(0, 0, 0, 0.45);
  }
}

/* Both explicit-override blocks below mirror the :root/@media values
   above exactly — same post-audit contrast fixes apply here too, since
   these win over prefers-color-scheme whenever a viewer picks a theme
   explicitly via the toggle button. */
/* The choice is set on <html> before the page draws (pwa-head reads it
   from localStorage), so every page follows it, not just the song page. */
:root[data-theme="light"], body[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f1e7; --bg-raised: #fff; --bg-sunken: #efe6d3; --fg: #241e18; --fg-muted: #5f554a; --fg-faint: #6f675b;
  --border: #e7dfcf; --border-strong: #241e18; --accent: #af4e39; --accent-bg: #f3ddd4; --accent-ink: #8a3d2c; --accent-contrast: #ffffff;
  --current-bg: #f2ebc6; --current-fg: #4a3f14;
  --danger: #a52f2f; --danger-bg: #f7e0dc; --ok: #685c23; --ok-bg: #f2ebc6; --warn: #8a5920; --warn-bg: #f5e3c4;
}
:root[data-theme="dark"], body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d1712; --bg-raised: #241d16; --bg-sunken: #140f0b; --fg: #f2e9dd; --fg-muted: #c4b8a0; --fg-faint: #9c8f78;
  --border: #3a322b; --border-strong: #f2e9dd; --accent: #d9684a; --accent-bg: #3a221a; --accent-ink: #f0a98c; --accent-contrast: #fff8f0;
  --current-bg: #e2d165; --current-fg: #241c08;
  --danger: #ef6157; --danger-bg: #3a1a15; --ok: #cdbb63; --ok-bg: #2f2a17; --warn: #e0a24f; --warn-bg: #3a2a12;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-ui);
  margin: 0;
  line-height: 1.4;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  /* Defense in depth, not the actual fix: every known source of
     horizontal page overflow found in this pass (the chart's own bar
     grid, .content-row's cross-axis sizing, auto-layout data tables) was
     fixed at its own root cause — see their own CSS comments — so this
     should never actually trigger. It's here as a backstop against the
     NEXT one: a clipped few px of page-level horizontal scroll (and the
     rubber-band sideways pan it invites on a touch device) reads as a
     much worse bug than a locally clipped element, so if some future
     addition reintroduces a stray overflow source, this keeps it from
     taking the whole page down with it. */
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* General keyboard-focus ring (audit, Nov 2026): before this, only 4
   :focus-visible rules existed, each scoped to one specific component —
   everywhere else fell back to each browser's own default outline,
   which is fine on a plain rectangular control but looks clipped/odd
   on anything with border-radius:999px (.icon-btn, .segmented, pill
   buttons generally — modern browsers round the native outline to the
   element's own border-radius, but inconsistently across engines).
   One rule here covers every focusable element by default; a component
   with its own more specific :focus-visible rule (the real-chart
   editing-cell outline this pattern borrows from, line ~3097) still
   wins by specificity, so this is a floor, not an override. */
:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---- Widgets: buttons, selects, segmented controls, cards --------------- */
button, select, input { font-family: inherit; color: inherit; font-size: 0.9rem; }
button {
  cursor: pointer; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.45rem 0.8rem; transition: background 0.1s, border-color 0.1s;
  /* Audit (Nov 2026): the base rule computed to ~36-37px tall with
     default line-height — under the 44pt/48dp Apple/Material baselines
     this app's users (musicians glancing at a phone mid-song) actually
     carry expectations from, and the single most error-prone place for
     that shortfall to live since every button in the app — including
     .primary/.danger, which only override color/weight, not size —
     inherits it. min-height (not height) so a button with wrapped or
     larger text still grows instead of clipping. */
  min-height: 2.75rem;
}
button:hover:not(:disabled) { border-color: var(--border-strong); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); font-weight: 700; }
button.ghost-btn { background: transparent; color: var(--fg-muted); }
/* button.danger: the one other weighted button variant — destructive,
   hard-to-undo actions (delete a band, reject a proposal/submission,
   remove a member, veto a song) need to read as different from a plain
   neutral button and from .primary's "go" accent at a glance, not just
   be discoverable by reading the label. Outlined rather than solid-filled
   by default so a row of actions doesn't turn into two competing "loud"
   buttons — it still gets a solid fill on hover/focus, where the person
   is already committing to the click. */
button.danger { color: var(--danger); border-color: var(--danger); background: var(--bg-raised); }
button.danger:hover:not(:disabled), button.danger:focus-visible { background: var(--danger); color: var(--accent-contrast); border-color: var(--danger); }
/* 2.3rem (36.8px) was under both touch-target baselines and this is the
   single most-used interactive control in the app (close/more/edit/
   metronome icons across icons.html's shared nav partials, plus 18+
   template call sites) — raised to 2.75rem/44px, matching the base
   button rule above. min-height/min-width (not height/width) in case a
   future call site's content forces it larger; square at the floor. */
button.icon-btn { width: 2.75rem; height: 2.75rem; min-width: 2.75rem; min-height: 2.75rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 1.05rem; }

/* Shared loading indicator (audit, Nov 2026): no spinner/in-progress
   component existed anywhere in the file — every real async action
   (YouTube audio download, passkey registration, PDF export) either had
   no visual feedback beyond a disabled button, or rolled its own ad hoc
   text swap. One small CSS-only spinner (a rotating ring, no JS/SVG
   asset needed) plus a `.btn-loading` button modifier that hides the
   button's own label text behind it without changing the button's size
   — wire both onto a button during an in-flight fetch instead of a new
   one-off pattern per feature. */
.spinner {
  display: inline-block; width: 1em; height: 1em; flex: none;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; opacity: 0.65;
  animation: spinner-rotate 0.7s linear infinite;
}
@keyframes spinner-rotate { to { transform: rotate(360deg); } }
button.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
button.btn-loading .spinner {
  position: absolute; top: 50%; left: 50%; margin: -0.5em 0 0 -0.5em;
  color: var(--fg-muted);
}
button.primary.btn-loading .spinner { color: var(--accent-contrast); }
button.danger.btn-loading .spinner { color: var(--danger); }

/* In-house SVG icons (templates/icons.html + the JS-built-row duplicates in
   song.js/setlist.js) — sized to sit on the text baseline inside a button,
   colored by the button's own text color so active/disabled states are
   free. */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
button .icon { margin-right: 0.35em; }
button.icon-btn .icon { margin-right: 0; width: 1.15em; height: 1.15em; }
.back-link { display: inline-flex; align-items: center; gap: 0.3em; }
.back-link .icon { margin-right: 0; }
select {
  background: var(--bg-raised); color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.4rem 0.6rem; min-height: 2.75rem;
  /* A native <select> sizes to its LONGEST <option> text by default, with
     no wrapping possible — a verbose option ("new song (add an existing
     variant to the repertoire)", the band-proposal kind picker) can be
     wider than an entire phone viewport on its own, pushing the whole
     page into horizontal overflow with nothing else involved. max-width
     caps it at its container's width instead; the select's own closed
     state still shows as much of the text as fits (native truncation),
     and the full option text is always there once it's opened. */
  max-width: 100%;
}
/* input[type="search"] included here (it wasn't before — an oversight
   that left every search box, e.g. a repertoire's search-this-list
   field, with zero styling of its own: no border/background/radius,
   and critically no min-height, so it sat visibly shorter than the
   button beside it). min-height matches the base `button` rule's own
   2.75rem touch-target floor, so an input/select next to a button in a
   toolbar lines up instead of looking like two different widget sets. */
/* email/password added here (they weren't before — the same oversight
   as search above, just not caught yet: every account-creation and
   login form's email/password boxes rendered with zero styling of
   their own — default browser chrome, no border-radius, no
   min-height — right next to a styled username field, which is what
   made the invite/login forms look broken rather than merely plain). */
input[type="text"], input[type="url"], input[type="date"], input[type="number"], input[type="search"], input[type="email"], input[type="password"] {
  background: var(--bg-raised); color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.4rem 0.6rem; min-height: 2.75rem;
  max-width: 100%; /* same reasoning as select's own max-width, above */
}

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--bg-raised); gap: 2px; }
.segmented button {
  border: none; background: none; border-radius: 999px; padding: 0.3rem 0.8rem;
  font-size: 0.82rem; color: var(--fg-muted);
  /* Not part of the audit's button/icon-btn touch-target fix — a
     segmented control's compact pill shape is deliberate, and
     min-height:2.75rem from the base `button` rule above would
     otherwise bloat it past its own design. */
  min-height: 0;
}
.segmented button.active { background: var(--fg); color: var(--bg); font-weight: 600; }

/* Visually hidden but still in the accessibility tree — used on the
   view-mode icons below, where the tooltip/title carries the sighted
   label and this carries it for screen readers. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* #mode-segmented: icon-only, not text — see the template comment. Square
   touch targets sized for a thumb, not a text button's loose padding. */
#mode-segmented button {
  display: flex; align-items: center; justify-content: center;
  width: 2.1rem; height: 2.1rem; min-height: 0; padding: 0;
}
#mode-segmented .icon { width: 1.05rem; height: 1.05rem; }

.card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.5rem; }
/* A <table class="card"> keeps its own cell padding, so the card's own
   block padding above would just double it up around the table's
   edges — cancel it there, the table element already fills its card. */
table.card { padding: 0; }
.card h2, .card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.card > *:last-child { margin-bottom: 0; }
/* A single short form (a settings/identity card, an "add one thing" card)
   reads better capped well short of the page's full width than full-
   bleed — two near-identical hardcoded `style="max-width:...px"` values
   had drifted onto individual cards (admin.html, admin_person.html)
   instead of a class; named modifiers here so a future narrow card reuses
   one of these two instead of inventing a third pixel value. */
.card--narrow { max-width: 420px; }
.card--narrow-lg { max-width: 480px; }
.card--md { max-width: 560px; }
/* A row of same-purpose cards (the band repertoire's "new original" /
   "add by id" pair, the members page's three add-people methods) —
   side by side on a wide screen, stacked on a phone, instead of each
   full-bleed one under the other. */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.25rem; align-items: start; margin-bottom: 1.5rem; }

/* ---- Single-column forms ---------------------------------------------
   Phase 29: a reusable stacked-label form layout, applied to every real
   data-entry form in the app (invites, proposals, member management,
   setlist creation...). Research-backed: single column over side-by-side
   fields, a persistent <label> above its input rather than placeholder
   text standing in for one (placeholder disappears the moment someone
   types, which is both a readability and an accessibility problem).
   Deliberately scoped to .form-stack rather than a global `label` rule —
   this app also has plenty of inline checkbox/radio labels ("show past
   members", instrument-icon toggles) that must stay inline, not stacked,
   so this never touches bare <label> outside a form that opts in. */
.form-stack { display: flex; flex-direction: column; gap: 1rem; max-width: 26rem; }
.form-stack .field { display: flex; flex-direction: column; gap: 0.3rem; }
.form-stack .field > label { font-size: 0.82rem; font-weight: 600; color: var(--fg-muted); }
.form-stack .field input, .form-stack .field select, .form-stack .field textarea { width: 100%; }
.form-stack .form-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.1rem; }
/* A form-stack that's one of several named subsections inside a single
   wider card (e.g. band.html's "add people" card) — a small heading plus
   a top border separating it from the previous subsection, instead of
   each being its own full card (which read as unrelated actions rather
   than alternative ways to do the same thing). */
.form-subsection { padding-top: 1.1rem; margin-top: 1.1rem; border-top: 1px solid var(--border); }
.form-subsection:first-of-type { padding-top: 0; margin-top: 0; border-top: none; }
.form-subsection h3 { margin: 0 0 0.3rem; font-size: 0.95rem; }
/* Two-column page layout for a page whose primary content is "a form to
   create something" alongside "a list of what already exists" (band
   proposals today) — form stays a fixed, readable single-column width;
   the list gets the remaining space instead of the page sitting mostly
   empty beside a narrow centered card. Collapses to one column under the
   existing app-wide mobile breakpoint. */
.form-with-list { display: grid; grid-template-columns: minmax(20rem, 26rem) 1fr; gap: 1.5rem; align-items: start; }
.form-with-list .form-stack { max-width: none; }
@media (max-width: 900px) {
  .form-with-list { grid-template-columns: 1fr; }
}

/* ---- Form conventions (forms pass, Nov 2026) ----------------------------
   One pattern for every form, used with static/js/forms.js:
   - a visible <label for> above each control; placeholders only ever show
     an example, never stand in for the label;
   - optional fields say "(optional)" in the label; required ones carry
     `required` and no asterisk;
   - help text sits under the label (.field-hint, tied with
     aria-describedby), the error under the control (.field-error, which
     forms.js writes and ties the same way, with aria-invalid);
   - one .form-status line per form for the outcome (role="status");
   - related radios/checkboxes in a <fieldset class="field-group"> whose
     <legend> reads like a label. */
.field-optional { font-weight: 400; color: var(--fg-muted); }
.field-hint { margin: 0; font-size: 0.82rem; color: var(--fg-muted); }
.field-error { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--danger); }
.field-error:empty { display: none; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger);
}
.form-status { margin: 0; font-size: 0.88rem; color: var(--fg-muted); }
.form-status:empty { display: none; }
.form-status.is-error { color: var(--danger); font-weight: 600; }
.form-status.is-ok { color: var(--accent); font-weight: 600; }
fieldset.field-group { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
fieldset.field-group > legend { padding: 0; margin-bottom: 0.3rem; font-size: 0.82rem; font-weight: 600; color: var(--fg-muted); }
/* An inline checkbox or radio with its label: the whole row is the
   target, at least as tall as a button. */
label.check { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; margin: 0; flex: none; }
input[type="tel"], input[type="datetime-local"], input[type="time"] {
  background: var(--bg-raised); color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.4rem 0.6rem; min-height: 2.75rem; max-width: 100%;
}
textarea { min-height: 5.5rem; resize: vertical; }
textarea.prose { font-family: inherit; }
/* iOS zooms the page into any field under 16px when it takes focus, and
   doesn't zoom back out: on touch screens every field is 16px. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 1rem; }
}

/* Every data table in the app (catalog, band/community rosters and
   repertoire, admin, notifications, submissions...) is `width:100%` with
   ordinary (auto) table layout — on a phone, a handful of columns (even
   just Title/Artist/Project/Visibility) easily need more min-content
   width than that, and auto table layout treats width:100% as a floor,
   not a cap: it grows PAST its container to fit that content instead of
   wrapping or shrinking, pushing the whole page wider than the viewport
   (the same class of bug as the chart's own bar grid, just for a table
   instead of bars). Wrapping each table in this scoped scroll container
   — not a page-wide overflow guard — keeps the table's own real layout
   (columns still line up) while confining the overflow to a horizontal
   scroll of just that table, the same move the song-structure-strip
   ticker already makes for its own nowrap row. */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Profile → Passkeys list: 4 columns (name+rename form, added, last used,
   remove) is too dense for a phone screen even with .table-scroll's
   horizontal-scroll fallback — a settings page shouldn't need side-
   scrolling to rename or remove a passkey. Below 600px each row becomes
   its own stacked block instead, each cell's own label (data-label)
   printed inline before its content (a well-known plain-CSS technique for
   turning a table into a mobile list without a second markup/JS path) —
   scoped to this one table, not every .table-scroll table in the app,
   since most of those are denser data grids (member/song lists) where
   horizontal scroll is the better tradeoff, not a short settings list. */
/* .table-stack — the same technique, generalized to a reusable class
   (admin.html's five tables: People, Communities, Pending accounts,
   Band & community invite links, Single-use invites — reported back as
   still unusable on mobile even with .table-scroll's horizontal-scroll
   fallback, since side-scrolling a dense admin table on a phone is
   real friction, not just a visual nit). Any `<td>` needs its own
   `data-label="Column Name"` for the stacked view's inline label; a
   cell with genuinely no useful label (an actions column, say) can
   omit it and just render its buttons with no heading. */
@media (max-width: 600px) {
  .passkeys-table thead, .table-stack thead { display: none; }
  .passkeys-table, .passkeys-table tbody, .passkeys-table tr, .passkeys-table td,
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td {
    display: block; width: 100%;
  }
  .passkeys-table tr, .table-stack tr {
    border-bottom: 1px solid var(--border); padding: 0.6rem 0; margin-bottom: 0.4rem;
  }
  .passkeys-table tr:last-child, .table-stack tr:last-child { border-bottom: none; }
  .passkeys-table td, .table-stack td { padding: 0.2rem 0; }
  .passkeys-table td[data-label]::before, .table-stack td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: 0.8rem; font-weight: 600; color: var(--fg-muted); margin-bottom: 0.15rem;
  }
}

/* ---- App chrome ---------------------------------------------------------- */
.app-header {
  display: flex; align-items: center; gap: var(--gap);
  padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap;
  background: var(--bg-raised);
}
.app-header h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.band-name-row { display: flex; align-items: center; gap: 0.4rem; }
/* Click-to-rename title — same affordance Notion/Linear/Trello use for an
   inline title (no separate pencil button): cursor:text signals it's
   editable, a dashed underline only on hover/focus (not permanently, so
   the page doesn't read as "half-finished" at rest) is the whole cue. */
#band-name-display {
  cursor: text; border-radius: 4px; padding: 0.1rem 0.3rem; margin: 0 -0.3rem;
  border-bottom: 1px dashed transparent;
}
#band-name-display:hover, #band-name-display:focus-visible {
  border-bottom-color: var(--border-strong); background: var(--bg-sunken);
}
/* The background tint above is the hover cue, but alone it's a weak
   focus signal for a keyboard user (audit, Nov 2026: outline:none here
   previously had nothing real replacing it) — layer the standard
   focus ring from the global :focus-visible rule below back on top,
   inset so it doesn't collide with the dashed underline cue. */
#band-name-display:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.band-name-input {
  margin: 0; font-size: 1.25rem; font-weight: 700; font-family: inherit; color: inherit;
  background: var(--bg-sunken); border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 0.1rem 0.4rem; min-width: 14ch;
}
.song-nav { margin-left: auto; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.music-type-select {
  font-size: 0.8rem; color: var(--text-secondary); background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem 0.5rem;
}
.album-group-heading { font-size: 1.05rem; margin: 0 0 0.2rem; }
.album-group-heading-row { display: flex; align-items: center; gap: 0.7rem; margin: 1.4rem 0 0.6rem; }
.album-group-heading-row:first-of-type { margin-top: 0; }
.album-group-heading-row[hidden] { display: none; } /* its own display:flex would otherwise beat the [hidden] UA rule */
.album-group-cover { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.album-group-year { font-weight: 400; color: var(--fg-faint); }
.album-group-credit { margin: 0.1rem 0 0; }

/* ---- Desktop sidebar (>=901px) ------------------------------------------
   Hidden by default/on mobile (the global bottom tab bar is the only nav
   there); shown and laid out as a flex sibling of .app-content only inside
   the >=901px media query at the bottom of this file, the same "default
   off, switched on past the breakpoint" convention .global-tabbar/
   .song-context-bar use in reverse for the <=900px case. A dark surface
   deliberately distinct from the rest of the (light/paper) app, matching
   the approved nav proposal -- the one dark element in an otherwise light
   UI, same way a band site's header bar often reads as a dark anchor
   against a lighter page. */
.desktop-sidebar {
  display: none;
  flex: 0 0 220px; width: 220px; box-sizing: border-box;
  flex-direction: column; gap: 1.4rem; padding: 1.1rem 0.85rem;
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.5rem; padding: 0 0.3rem;
  color: var(--sidebar-fg); font-weight: 700; font-size: 1.02rem; text-decoration: none;
}
.sidebar-brand .icon.logo-mark { width: 1.4rem; height: 1.4rem; opacity: 1; }
.sidebar-crumb { padding: 0.3rem 0.3rem 0.1rem; }
.sidebar-crumb a {
  /* A long songbook/band/community name used to wrap onto 2+ lines
     with the back-icon vertically centered against the WHOLE block —
     the icon ends up floating at the midpoint between lines instead of
     sitting next to the first one, and the extra wrapped lines compete
     for attention with the primary nav right below. Truncating to one
     line (title attr gives the full name back on hover) keeps this a
     quiet, secondary "back" affordance the way every other sidebar row
     already is, regardless of how long the destination's name is. */
  display: flex; align-items: flex-start; gap: 0.4rem; text-decoration: none;
  color: var(--accent); font-size: 0.82rem; font-weight: 600;
  overflow: hidden;
}
.sidebar-crumb a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-crumb a .icon { width: 0.9rem; height: 0.9rem; flex: none; margin-top: 0.1rem; }
.sidebar-primary, .sidebar-secondary { display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar-primary a, .sidebar-secondary a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.6rem; border-radius: 10px; text-decoration: none;
  color: var(--sidebar-fg); font-size: 0.88rem; font-weight: 500;
}
.sidebar-primary a .icon { width: 1.1rem; height: 1.1rem; flex: none; }
.sidebar-primary a.active, .sidebar-secondary a.active {
  background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); font-weight: 600;
}
.sidebar-primary a:not(.active):hover, .sidebar-secondary a:not(.active):hover {
  background: color-mix(in srgb, var(--sidebar-fg) 10%, transparent);
}
.sidebar-secondary {
  margin-top: auto; padding-top: 0.9rem; border-top: 1px solid var(--sidebar-border);
  font-size: 0.82rem;
}
.sidebar-secondary a { font-weight: 500; color: color-mix(in srgb, var(--sidebar-fg) 78%, transparent); }
.sidebar-account {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem;
  border-radius: 10px; text-decoration: none; color: var(--sidebar-fg); font-size: 0.85rem;
  background: color-mix(in srgb, var(--sidebar-fg) 7%, transparent);
}
.sidebar-account-avatar {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--accent-ink); font-weight: 700; font-size: 0.8rem;
}

/* ---- Play page's own "This song" sidebar group (Phase 44) ---------------
   Reuses .sidebar-secondary for the same divider/spacing/font-size as the
   Admin/Metronome/My-songbook group below it, plus this group-specific
   label and row styling — the view-mode switcher (#mode-segmented, shared
   with the topbar's pre-Phase-44 pill) and the PDF/notes/versions/history/
   reference buttons all move in here unchanged (see play.html), just
   restyled from a horizontal icon row into a vertical labeled list to
   match the rest of the sidebar. */
.sidebar-group-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: color-mix(in srgb, var(--sidebar-fg) 60%, transparent);
  padding: 0 0.6rem; margin-bottom: 0.3rem;
}
/* .sidebar-secondary's own `margin-top: auto` is right for the shared
   sidebar's genuinely-secondary utility links (Metronome, My songbook)
   that belong pinned low, above the account chip. A page's own "This
   band"/"This community"/"This song" action group (.sidebar-song-group)
   is not that — it's the primary thing to do on that page, and pinning
   it to the bottom buried it below a tall gap on any page with more
   than a couple of primary-nav rows (reported: "THIS BAND" actions easy
   to miss). Cancel the auto-margin so it sits right under the primary
   nav list instead. */
.sidebar-secondary.sidebar-song-group { margin-top: 0; }
.sidebar-song-group #mode-segmented {
  display: flex; flex-direction: column; gap: 0.15rem;
  border: none; background: none; padding: 0; border-radius: 0; margin-bottom: 0.3rem;
}
.sidebar-song-group #mode-segmented button {
  /* #mode-segmented button's own base rule (shared with the old desktop
     icon pill, still used by nothing now but kept in case this group ever
     needs the compact form again) fixes a 2.1rem square width/height for
     its icon-only design — override both explicitly, a stretch/auto width
     alone won't beat a sibling rule that already names this exact
     property. */
  display: flex; align-items: center; gap: 0.55rem; justify-content: flex-start;
  width: 100%; height: auto; padding: 0.5rem 0.6rem; border-radius: 10px;
  color: var(--sidebar-fg); font-size: 0.82rem; font-weight: 500; background: none; line-height: 1.25;
  text-align: left;
}
.sidebar-song-group #mode-segmented button .icon { width: 1.1rem; height: 1.1rem; flex: none; }
/* The topbar pill carried these labels as screen-reader-only (icon tooltip
   was enough in a horizontal row); here, in a vertical sidebar list, the
   label is exactly what a reader scans for — make it visible instead of
   overriding the generic .sr-only utility itself (used elsewhere for
   genuinely icon-only controls). */
.sidebar-song-group #mode-segmented button .sr-only {
  position: static; width: auto; height: auto; padding: 0; margin: 0;
  overflow: visible; clip: auto; white-space: normal;
}
.sidebar-song-group #mode-segmented button.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); font-weight: 600; }
.sidebar-song-group #mode-segmented button:not(.active):hover { background: color-mix(in srgb, var(--sidebar-fg) 10%, transparent); }
.sidebar-song-row {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.55rem 0.6rem; border-radius: 10px; border: none; background: none;
  color: var(--sidebar-fg); font-size: 0.88rem; font-weight: 500; text-decoration: none; text-align: left;
}
.sidebar-song-row:hover { background: color-mix(in srgb, var(--sidebar-fg) 10%, transparent); text-decoration: none; }
.sidebar-song-row .icon { width: 1.1rem; height: 1.1rem; flex: none; }
.sidebar-song-row[hidden], .stack-sheet-row[hidden] { display: none; } /* no Edit on a song that can't be copied */
.sidebar-song-group .pdf-mode-row { display: flex; flex-direction: column; gap: 0.35rem; }
.sidebar-song-group .pdf-mode-select {
  margin: 0 0.6rem; background: color-mix(in srgb, var(--sidebar-fg) 10%, transparent);
  color: var(--sidebar-fg); border: 1px solid var(--sidebar-border); border-radius: 6px;
  padding: 0.3rem 0.4rem; font-size: 0.82rem;
}
.sidebar-song-group .pdf-notes-label {
  display: flex; align-items: center; gap: 0.4rem; margin: 0 0.6rem;
  color: color-mix(in srgb, var(--sidebar-fg) 85%, transparent); font-size: 0.82rem;
}

/* ---- Notification bell -------------------------------------------------- */
.notif-bell { position: relative; display: inline-flex; align-items: center; color: inherit; }
.notif-badge {
  position: absolute; top: -0.4rem; right: -0.6rem;
  background: var(--danger); color: var(--accent-contrast); border-radius: 999px;
  font-size: 0.65rem; font-weight: 700; line-height: 1;
  padding: 0.15rem 0.4rem; min-width: 1.1rem; text-align: center;
}
tr.unread { font-weight: 600; }

main { padding: 1.1rem; max-width: 68rem; margin: 0 auto; }

/* ---- Tempo / time-signature badge --------------------------------------- */
.time-sig { display: flex; flex-direction: column; line-height: 0.85; font-weight: 700; font-size: 1.15rem; }

/* ---- Index / book browser ------------------------------------------------ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
.project-card {
  display: block; padding: 1.1rem 1.2rem; color: var(--fg); transition: transform 0.1s, box-shadow 0.1s;
}
.project-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20,16,8,0.08), 0 8px 20px rgba(20,16,8,0.1); }
.project-card h2 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.project-stats { display: flex; gap: 0.7rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--fg-muted); }

.book-card { margin-bottom: 1.5rem; padding: 1rem 1.2rem; }
.book-card h2 { margin: 0 0 0.6rem; display: flex; align-items: center; gap: 0.6rem; }
.new-setlist-form .structure-actions { margin-top: 0; flex-wrap: wrap; }
.new-setlist-form label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--fg-muted); }
.set-group { margin-bottom: 0.7rem; }
.set-group h3 { margin: 0 0 0.3rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); }
.song-list { list-style: none; padding: 0; margin: 0; }
/* Gig-mode-ready: alternating row backgrounds and a hover state, same
   striping as the actual gig view (.gig-row) — this is a book's own
   songbook, meant to be glanced down at speed, same as a setlist. */
.song-list li {
  display: flex; gap: 0.6rem; align-items: baseline; padding: 0.4rem 0.6rem; flex-wrap: wrap;
  border-radius: 4px;
}
.song-list li:nth-child(odd) { background: var(--bg-sunken); }
.song-list li:hover { background: color-mix(in srgb, var(--accent) 12%, var(--bg-sunken)); }
/* Read-only by default: no drag handle, no delete icon — Edit order
   reveals both. Hidden with display:none, not just opacity, so a
   misclick/drag can't hit them while they're not meant to be there.
   catalog-drag-handle, NOT the shared .drag-handle class used by the
   Structure/setlist chip editors — those are meant to stay always-visible,
   so hiding .drag-handle itself by default would have broken them.
   button.remove-song-btn, not just .remove-song-btn: the button is also
   .icon-btn, and button.icon-btn (element+class) outranks a plain single-
   class selector regardless of source order — a plain .remove-song-btn
   rule here was silently losing to it, which is why the trash icon
   showed even outside edit mode. */
button.remove-song-btn, .catalog-drag-handle { display: none; }
.catalog-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; }
#catalog-edit-toggle.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
#catalog-section.editing button.remove-song-btn {
  display: flex; margin-left: auto; font-size: 0.7rem; padding: 0.3rem 0.5rem; color: var(--fg-muted);
}
#catalog-section.editing .catalog-drag-handle {
  display: flex; align-items: center; color: var(--fg-muted); cursor: grab; touch-action: none;
}
#catalog-section.editing .song-list li.dragging { opacity: 0.4; }
#catalog-section.editing .song-list li.drag-over { border-top: 2px solid var(--accent); }
.song-num { color: var(--fg-muted); font-variant-numeric: tabular-nums; min-width: 1.6rem; text-align: right; font-size: 0.85rem; }
.song-link { font-weight: 600; flex: 1; display: flex; align-items: baseline; gap: 0.6rem; min-width: 0; }
.song-link .song-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-link .song-meta { font-weight: 400; font-size: 0.8rem; color: var(--fg-muted); white-space: nowrap; margin-left: auto; }
.song-link-sub { font-size: 0.78rem; color: var(--fg-muted); }
.add-row { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.6rem; flex-wrap: wrap; }

/* ---- New-song wizard (native <dialog>) ------------------------------------ */
#song-wizard {
  width: min(560px, 92vw); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem 1.4rem; background: var(--bg-raised); color: var(--fg); box-shadow: var(--shadow);
}
#song-wizard::backdrop { background: rgba(10, 8, 4, 0.45); }
#song-wizard h2 { margin: 0 0 0.3rem; }
.wizard-fields { display: flex; gap: 0.8rem; margin: 0.8rem 0; flex-wrap: wrap; }
.wizard-fields label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--fg-muted); flex: 1; min-width: 10rem; }
.wizard-preview { width: 100%; margin-top: 0.4rem; font-family: var(--font-mono); font-size: 0.82rem; }
.wizard-actions { display: flex; align-items: center; gap: 0.7rem; margin-top: 1rem; }
.wizard-actions .hint { margin-left: 0.2rem; }
.wizard-steps { display: flex; gap: 0.4rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.wizard-step-dot {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--fg-muted); padding: 0.25rem 0.6rem; border-radius: 999px; background: var(--bg-sunken);
}
.wizard-step-dot.active { background: var(--accent); color: var(--accent-contrast); }
.wizard-panel .reference-embed { margin-top: 0.6rem; }

.ug-preview-sections { display: flex; flex-direction: column; gap: 0.6rem; max-height: 50vh; overflow-y: auto; margin-top: 0.6rem; }
.ug-preview-section { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.8rem; background: var(--bg-sunken); border-radius: 8px; cursor: pointer; }
.ug-preview-section-body { flex: 1; min-width: 0; }
.ug-preview-section-label { font-weight: 600; font-size: 0.85rem; }
.ug-preview-section-grid { display: block; font-size: 0.78rem; color: var(--fg-muted); margin: 0.2rem 0; }
.ug-preview-section-lyrics { font-size: 0.78rem; color: var(--fg-muted); white-space: pre-wrap; margin: 0.2rem 0 0; font-family: var(--font-mono); }

#key-transposed { color: var(--accent); font-weight: 600; }
#key-transposed::before { content: "\2192"; margin: 0 0.3em; color: var(--fg-muted); font-weight: 400; }
.transpose-control { display: flex; align-items: center; gap: 0.3rem; }
.transpose-control button {
  width: 1.6rem; height: 1.6rem; padding: 0; border-radius: 5px; font: inherit; line-height: 1;
  background: var(--bg-sunken); border: none; color: var(--fg);
}
.transpose-control button:hover { color: var(--accent); }
#transpose-amount { min-width: 1.4rem; text-align: center; font-variant-numeric: tabular-nums; }

/* Top bar: width split into 4 columns, given to prev/current/next as
   1-2-1 — the current song (title, artist, key, tempo) gets the wide
   center cell so it's the thing you actually see, with prev/next either
   side of it rather than as a separate, easy-to-miss row underneath. */
/* Phase 46: one shared "sunken" cream background for both rows (title +
   view-tabs) — ties the top panel visually to the sidebar's own dark
   column without the heavy contrast of actually matching its colour. */
.song-topzone { background: var(--bg-sunken); border-bottom: 1px solid var(--border); }
.topbar-utility-mobile { padding: 0.5rem 1.1rem 0; }
.topbar-utility-mobile .back-link { padding: 0.2rem 0; font-size: 0.78rem; }
/* Desktop has its own copy of this link in the sidebar (.sidebar-crumb);
   mobile has its own copy now too — the Up entry in .song-context-bar's
   bottom bar (clearer "go back a level" icon, at the bottom where the
   rest of this page's navigation already lives, instead of a small text
   link competing with the title at the very top). Showing this too would
   be redundant on both. */
.topbar-utility-mobile { display: none; }
.song-topbar {
  display: grid; grid-template-columns: 1fr 2fr 1fr; grid-template-rows: auto; gap: 0.3rem 0.6rem;
  padding: 0.7rem 1.1rem 0.5rem;
}
/* A real pill-tab track (same pattern as .band-tabs), not an underline row
   — the underline style read as plain text on this already-sunken topzone
   background, not as a tab bar at all. Centered, own bg-raised track so it
   visibly pops off .song-topzone's sunken background, active tab filled
   solid with the accent colour so "which view am I on" is unambiguous. */
.view-tabs {
  display: inline-flex; flex-wrap: wrap; justify-content: center;
  margin: 0.6rem auto 0.7rem; padding: 0.25rem; gap: 0.15rem;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 999px;
}
/* The parent needs text-align:center for an inline-flex child to actually
   center itself; .song-topbar/.topbar-utility-mobile aren't centered text,
   so this rule is scoped to .song-topzone alone. */
.song-topzone { text-align: center; }
.song-topzone .song-topbar, .song-topzone .topbar-utility-mobile { text-align: left; }
/* #mode-segmented.view-tabs, not just .view-tabs: the plain #mode-segmented
   button rule above (icon-only square touch targets, used on mobile's
   hidden copy of this same element) is an ID selector and would otherwise
   win over a class-only rule here, squashing these text tabs back down to
   2.1rem squares. */
#mode-segmented.view-tabs button {
  display: flex; align-items: center; width: auto; height: auto; min-height: 0;
  background: none; border: none; border-radius: 999px;
  padding: 0.5rem 0.9rem; font-size: 0.85rem; color: var(--fg-muted); cursor: pointer;
}
.view-tabs button:hover { color: var(--fg); }
.view-tabs button.active { background: var(--accent); color: var(--bg-raised); font-weight: 600; }
#mode-segmented.view-tabs .icon { width: 0.95rem; height: 0.95rem; margin-right: 0.3em; vertical-align: -0.15em; }
@media (max-width: 900px) {
  /* Mobile already has its own mode switcher (the "View" entry in
     .song-context-bar below) — this full-width tab row is a desktop-only
     addition, not a second way to do the same thing here. Moved to AFTER
     every unconditional .view-tabs rule above: a media-qualified rule and
     an unconditional rule of equal specificity resolve by SOURCE ORDER
     when both match, so this needs to be last, not first, to actually
     win on a narrow viewport — it previously sat above those rules and
     was silently outranked by them, leaving the whole pill (Reference
     included) visible on mobile as a row of near-illegible icon squares
     (a direct report, matching a live screenshot). */
  .view-tabs { display: none; }
  #instrument-picker { display: none; }
}
/* Instrument picker (#instrument-picker, play.html) — same pill-of-icon-
   buttons look as #mode-segmented just above (was a plain native
   <select>: taller than the mode row, easy to miss entirely, which hid
   real GP-imported notation behind the default "Chords" view — a direct
   report). Still its own, smaller row rather than merged into
   #mode-segmented itself: it's a one-off choice that only exists at all
   for a song with more than one melodic track, unlike the always-present
   view-mode row, so it doesn't earn the same permanent chrome. Sits
   beside .view-tabs (same inline-flex/text-align:center parent,
   .song-topzone) rather than inside it — the ID-qualified selectors
   mirror #mode-segmented.view-tabs's own (see that rule's comment for
   why the ID is needed: #mode-segmented's plain icon-square rule,
   mobile's hidden copy of the view-mode row, would otherwise win on
   specificity over a class-only rule here). */
#instrument-picker.view-tabs button,
#source-preview-instruments.view-tabs button {
  display: flex; align-items: center; width: auto; height: auto; min-height: 0;
  background: none; border: none; border-radius: 999px;
  padding: 0.5rem 0.9rem; font-size: 0.85rem; color: var(--fg-muted); cursor: pointer;
}
#instrument-picker.view-tabs .icon,
#source-preview-instruments.view-tabs .icon { width: 0.95rem; height: 0.95rem; margin-right: 0.3em; vertical-align: -0.15em; }
.topbar-cell { display: flex; align-items: center; gap: 0.5rem; min-width: 0; color: var(--fg); }
.topbar-cell.empty { visibility: hidden; }
a.topbar-cell { padding: 0.5rem 0.8rem; border-radius: 8px; border: 1px solid var(--border); }
a.topbar-cell:hover { border-color: var(--border-strong); text-decoration: none; }
.topbar-next { justify-content: flex-end; text-align: right; }
.topbar-nav-info { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar-nav-info small { color: var(--fg-muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; }
.topbar-nav-info strong { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-current {
  flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  text-align: center; padding: 0.3rem 0;
}
.topbar-current h1 { margin: 0; font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.topbar-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; font-size: 0.88rem; color: var(--fg-muted); }
.topbar-artist { font-weight: 500; }
/* A separator before every meta item except whichever one happens to be
   first (artist, key or tempo can each be absent independently) — the
   adjacent-sibling pattern handles that without caring which one it is. */
.topbar-meta > * + *::before { content: "\00b7"; margin-right: 0.5rem; }
.gp-source-badge { display: inline-flex; align-items: center; gap: 0.3em; color: var(--fg-muted); }
.gp-source-badge:hover { color: var(--fg); }
.gp-source-badge .icon { width: 0.85rem; height: 0.85rem; }
.topbar-current .segmented { margin-top: 0.5rem; flex-wrap: wrap; justify-content: center; }
@media (max-width: 640px) {
  .song-topbar { grid-template-columns: 1fr; }
  .topbar-prev, .topbar-next { display: none; }
}

/* ---- Song structure strip — a minimal tick timeline: one thin progress
   line, one tick + label per section (weighted by its own bar count,
   bar count printed small beside the name). Lives inside .content-main
   (see the template), so it's scoped to the chart's own width, not the
   full page — stretching edge-to-edge behind the sidebar too was the
   "awful" complaint this replaces. Chosen over three other mocked
   options (a narrowed version of the old shared-staff look, a chip/pill
   row, and compact wrapping bricks) — lightest visual weight of the
   four, reads as a scrubber rather than another staff. */
.song-structure-strip {
  position: relative; padding: 1.5rem 0.2rem 0.6rem; margin-bottom: 0.4rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.structure-line {
  position: absolute; left: 0.2rem; right: 0.2rem; top: 1.65rem; height: 2px;
  background: var(--border-strong); border-radius: 2px;
}
.structure-fill {
  position: absolute; left: 0.2rem; top: 1.65rem; height: 2px; width: 0;
  background: var(--accent); border-radius: 2px; z-index: 1; transition: width 0.2s linear;
}
.structure-row { display: flex; gap: 0; position: relative; z-index: 2; }
.structure-seg {
  flex: var(--bars, 1) 1 2.4rem; min-width: 2.4rem; display: flex; flex-direction: column;
  align-items: flex-start; position: relative; background: none; border: none; text-align: left;
  padding: 0 0.3rem 0 0;
}
.structure-seg-chords {
  font-size: 0.62rem; font-family: var(--font-mono, monospace); color: var(--fg-muted); opacity: 0.85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; margin-bottom: 0.15rem;
}
.structure-seg.current .structure-seg-chords { color: var(--accent); opacity: 1; }
.structure-seg-tick { width: 2px; height: 10px; background: var(--border-strong); margin-bottom: 0.3rem; border-radius: 1px; }
.structure-seg-label {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.structure-seg-bars { font-weight: 400; opacity: 0.75; margin-left: 0.25em; }
.structure-seg.is-reference .structure-seg-label { font-style: italic; font-weight: 400; opacity: 0.8; }
.structure-seg.current .structure-seg-tick { background: var(--accent); }
.structure-seg.current .structure-seg-label { color: var(--accent); font-weight: 700; }
.structure-seg.done .structure-seg-label { opacity: 0.45; }
.structure-seg:hover .structure-seg-label { color: var(--fg); }

/* ---- Reference-audio player (app/docs/mp3-reference-audio.md §3/§4) ----- */
.audio-player {
  margin: 0 0 1rem; padding: 0.6rem 0.8rem; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 10px;
  --waveform-color: color-mix(in srgb, var(--accent) 55%, var(--fg-muted));
}
.audio-empty-state:not([hidden]) { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.85rem; padding: 0.3rem 0; }
/* The toggle between the two reference categories (visible only when a
   song actually has both) — same pill-track visual language as
   .band-tabs/.admin-tabs, kept small since it's a secondary control
   sitting above the waveform, not a primary nav. */
.audio-category-toggle:not([hidden]) {
  display: inline-flex; gap: 0.15rem; margin-bottom: 0.5rem;
  background: var(--bg-sunken); border-radius: 999px; padding: 0.2rem;
}
.audio-category-toggle button {
  padding: 0.3rem 0.7rem; border-radius: 999px; border: none; background: none;
  color: var(--fg-muted); font-size: 0.78rem; font-weight: 500; cursor: pointer;
}
.audio-category-toggle button.active { background: var(--bg-raised); color: var(--fg); font-weight: 600; }
/* A button with a TEXT label, not the icon-only circular .icon-btn (fixed
   2.3rem width, fine for a single glyph, but wraps "Add reference audio
   (MP3)" into four lines when reused for one) — auto width, no wrap.
   :not([hidden]) — same class-vs-attribute-selector specificity issue
   fixed repeatedly elsewhere this session (.setlist-overview-reorder-
   btns, .real-chart-host-readonly, .audio-empty-state): a bare class
   rule's `display` outranks the `[hidden]` attribute's own UA default,
   so replace/remove buttons meant to start hidden showed immediately. */
.audio-pill-btn:not([hidden]) {
  display: inline-flex; align-items: center; gap: 0.3em; white-space: nowrap; flex: 0 0 auto;
  padding: 0.35rem 0.7rem; font-size: 0.82rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--fg); cursor: pointer;
}
.audio-pill-btn:hover { border-color: var(--border-strong); }
.audio-pill-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
/* Practice player (audio-player.js): GarageBand-style control bar on
   top — transport, LCD, then Cycle / Count-in / Click / Speed / Trainer —
   and the waveform under a ruler that carries bar numbers, section names
   and the yellow cycle range. */
.audio-player { --waveform-color: color-mix(in srgb, var(--fg-muted) 45%, transparent); --waveform-played: var(--accent); --cycle: #e9b500; }
.audio-transport { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.45rem; position: relative; }
.audio-buttons { display: flex; align-items: center; gap: 0.15rem; }
.audio-buttons .icon-btn { width: 2.1rem; height: 2.1rem; }
.audio-play-btn { width: 2.5rem !important; height: 2.5rem !important; background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.audio-play-btn:hover { background: var(--accent-ink); }
.audio-lcd {
  display: flex; align-items: baseline; gap: 0.5rem; min-width: 11rem;
  padding: 0.25rem 0.7rem; border-radius: 8px; background: var(--bg-sunken);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.audio-lcd-pos { font-size: 1.15rem; font-weight: 700; min-width: 3.2ch; }
.audio-lcd-section { font-size: 0.82rem; font-weight: 600; color: var(--accent-ink); max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-lcd-time { font-size: 0.75rem; color: var(--fg-muted); margin-left: auto; white-space: nowrap; }
.audio-opts { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; margin-left: auto; }
.audio-transport .audio-opts-btn { display: none; margin-left: auto; }
.audio-toggle {
  display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap;
  padding: 0 0.55rem; height: 1.75rem; box-sizing: border-box; font-size: 0.78rem; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--fg-muted); cursor: pointer;
}
.audio-toggle:hover { border-color: var(--border-strong); color: var(--fg); }
.audio-toggle.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
#audio-cycle-btn.active { background: color-mix(in srgb, var(--cycle) 30%, var(--bg-raised)); border-color: var(--cycle); color: var(--fg); }
.audio-toggle:disabled { opacity: 0.45; cursor: default; }
.audio-speed { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--fg-muted); }
.audio-speed select { font-size: 0.78rem; height: 1.75rem; box-sizing: border-box; padding: 0 0.3rem; border-radius: 4px; }
.audio-speed-bpm { font-variant-numeric: tabular-nums; font-size: 0.75rem; }
/* Split buttons: the option toggles, with a ▾ opening their panel. */
.audio-split { display: inline-flex; align-items: stretch; }
.audio-split .audio-toggle { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.audio-toggle .icon { width: 0.9rem; height: 0.9rem; }
.audio-caret {
  display: inline-flex; align-items: center; padding: 0 0.35rem; margin-left: -1px; cursor: pointer;
  height: 1.75rem; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 0 4px 4px 0; background: var(--bg-raised); color: var(--fg-muted);
}
.audio-caret .icon { width: 0.85rem; height: 0.85rem; }
.audio-caret[aria-expanded="true"], .audio-caret:hover { color: var(--fg); border-color: var(--border-strong); }
.audio-trainer-btn { position: relative; overflow: hidden; }
.audio-trainer-meter { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--accent); transition: width 0.3s; }
/* Option panels: a card under the control bar, aligned under the button
   that opened it. */
.audio-player { position: relative; }
.audio-pop:not([hidden]) {
  display: flex; flex-direction: column; gap: 0.6rem; position: absolute; z-index: 15;
  top: var(--pop-top, 3.4rem); left: var(--pop-left, 0.8rem); width: max-content; max-width: calc(100% - 1.6rem);
  padding: 0.75rem 0.9rem; border-radius: 10px; background: var(--bg-raised);
  border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 0.85rem;
}
.audio-pop-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.audio-pop-head strong { font-size: 0.95rem; }
.audio-pop-head .hint { font-size: 0.78rem; }
.audio-pop-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.audio-seg { display: inline-flex; gap: 0.15rem; padding: 0.15rem; border-radius: 5px; background: var(--bg-sunken); align-self: flex-start; }
.audio-seg button {
  display: inline-flex; align-items: center; gap: 0.3rem; border: none; background: none; cursor: pointer;
  padding: 0.3rem 0.7rem; border-radius: 3px; color: var(--fg-muted); font-size: 0.8rem;
}
.audio-seg button .icon { width: 0.9rem; height: 0.9rem; }
.audio-seg button.active { background: var(--bg-raised); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.audio-check, .audio-range { display: inline-flex; align-items: center; gap: 0.45rem; }
.audio-range input { width: 10rem; }
.audio-switch { display: inline-flex; align-items: center; gap: 0.4rem; margin-left: auto; font-weight: 600; cursor: pointer; }
.audio-switch input { position: absolute; opacity: 0; }
.audio-switch span { width: 2.2rem; height: 1.25rem; border-radius: 999px; background: var(--border-strong); position: relative; transition: background 0.2s; opacity: 0.5; }
.audio-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.25rem - 4px); height: calc(1.25rem - 4px); border-radius: 50%; background: #fff; transition: transform 0.2s; }
.audio-switch input:checked + span { background: var(--accent); opacity: 1; }
.audio-switch input:checked + span::after { transform: translateX(0.95rem); }
.audio-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.audio-trainer-grid { display: grid; grid-template-columns: repeat(4, auto); gap: 0.5rem 1rem; }
.audio-stepper { display: grid; grid-template-columns: 2.2rem minmax(4.6rem, auto) 2.2rem; grid-template-rows: auto auto; align-items: center; gap: 0.15rem 0.25rem; }
.audio-stepper-label { grid-column: 1 / -1; font-size: 0.75rem; color: var(--fg-muted); text-align: center; }
.audio-stepper button {
  height: 2.2rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-raised);
  font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--fg);
}
.audio-stepper button:hover { border-color: var(--border-strong); }
.audio-stepper output { text-align: center; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.audio-stairs { display: flex; align-items: flex-end; gap: 3px; height: 3.2rem; padding-top: 0.2rem; }
.audio-stair {
  flex: 1; min-width: 1rem; position: relative; border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--fg-muted) 25%, transparent);
}
.audio-stair span { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 0.62rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.audio-stair.reached { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.audio-stair.reached span { color: var(--accent-ink); }
.audio-stair.now { background: var(--accent); }
.audio-stair.now span { color: var(--accent-contrast); font-weight: 700; }
.audio-pop .audio-pill-btn:not([hidden]), .audio-pop .primary { border-radius: 4px; padding: 0 0.6rem; height: 1.75rem; font-size: 0.78rem; box-sizing: border-box; }
.audio-stepper button { border-radius: 4px; }
/* The app's 44px touch minimum is for phones (restored below); on a
   desktop these are compact, Logic-style controls. */
.audio-toggle, .audio-caret, .audio-seg button, .audio-stepper button, .audio-speed select,
.audio-pop .audio-pill-btn, .audio-pop .primary { min-height: 0; }
.audio-trainer-summary { margin: 0; font-size: 0.82rem; color: var(--fg-muted); }
@media (max-width: 720px) {
  .audio-pop:not([hidden]) { left: 0.5rem; right: 0.5rem; width: auto; max-width: none; }
  .audio-trainer-grid { grid-template-columns: repeat(2, auto); justify-content: space-between; }
  .audio-split { width: 100%; }
  .audio-split .audio-toggle { flex: 1; }
}
.audio-waveform-wrap { position: relative; user-select: none; -webkit-user-select: none; }
.audio-ruler {
  position: relative; height: 1.25rem; border-bottom: 1px solid var(--border);
  cursor: crosshair; touch-action: none; overflow: hidden;
}
.audio-ruler-marks { position: absolute; inset: 0; pointer-events: none; }
.audio-ruler-bar, .audio-ruler-section {
  position: absolute; bottom: 2px; padding-left: 3px; white-space: nowrap;
  font-size: 0.65rem; line-height: 1; color: var(--fg-muted); font-variant-numeric: tabular-nums;
}
.audio-ruler-section {
  pointer-events: auto; cursor: pointer; font-weight: 700; color: var(--fg); top: 2px; bottom: auto;
  border-left: 2px solid var(--accent); padding: 1px 4px; background: var(--bg-raised); z-index: 2;
}
.audio-ruler-section:hover { color: var(--accent-ink); }
.audio-cycle {
  position: absolute; top: 2px; bottom: 2px; border-radius: 3px; z-index: 1; cursor: grab;
  background: color-mix(in srgb, var(--fg-muted) 30%, transparent);
}
.audio-cycle.on { background: color-mix(in srgb, var(--cycle) 75%, transparent); }
.audio-cycle-edge { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.audio-cycle-edge.start { left: -3px; }
.audio-cycle-edge.end { right: -3px; }
.audio-wave { position: relative; height: 64px; cursor: pointer; touch-action: none; }
.audio-waveform { width: 100%; height: 100%; display: block; }
.audio-played { position: absolute; top: 0; bottom: 0; left: 0; width: 0; overflow: hidden; pointer-events: none; }
.audio-played .audio-waveform { width: auto; max-width: none; }
.audio-cycle-shade { position: absolute; top: 0; bottom: 0; pointer-events: none; background: color-mix(in srgb, var(--cycle) 14%, transparent); border-left: 1px solid var(--cycle); border-right: 1px solid var(--cycle); }
.audio-playhead {
  position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px;
  background: var(--fg); pointer-events: none; z-index: 2;
}
.audio-bargrid { position: absolute; inset: 0; pointer-events: none; }
.audio-bargrid-tick {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--border-strong); opacity: 0.18; pointer-events: none;
}
.audio-bargrid-tick.section { opacity: 0.6; background: var(--accent); }
.audio-hover:not([hidden]) { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 3; }
.audio-hover-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--fg-muted); opacity: 0.6; }
.audio-hover-label {
  position: absolute; top: 2px; left: 5px; white-space: nowrap; font-size: 0.7rem; padding: 1px 5px;
  border-radius: 4px; background: var(--fg); color: var(--bg-raised); font-variant-numeric: tabular-nums;
}
.audio-hover.flip .audio-hover-label { left: auto; right: 5px; }
/* Narrow screens: transport and LCD stay; every practice option folds
   into the ⋯ panel, with roomier touch targets. */
@media (max-width: 720px) {
  .audio-transport .audio-opts-btn { display: inline-flex; }
  .audio-opts { display: none; }
  .audio-opts.open {
    display: flex; position: absolute; right: 0; top: calc(100% + 0.3rem); z-index: 20;
    flex-direction: column; align-items: stretch; gap: 0.4rem; padding: 0.6rem;
    background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  }
  .audio-toggle, .audio-caret, .audio-speed select { height: 2.75rem; min-height: 2.75rem; }
  .audio-buttons .icon-btn { width: 2.75rem; height: 2.75rem; }
  .audio-lcd { order: 3; flex: 1 1 100%; min-width: 0; }
  .audio-wave { height: 56px; }
  .audio-ruler { height: 1.5rem; }
}

/* ---- Transport -------------------------------------------------------------
   Lives inside the structure rail (.timeline), not floating above the chart
   on its own, and carries the song's metadata (tempo/key/capo/reference)
   too — playback controls, "what song is this" and "where am I in it" are
   all the same concern, a narrow vertical panel rather than three separate
   horizontal bars competing for space above the chart. Jazz fullscreen
   pulls it back out with position:fixed (see its own block below). */
.transport {
  display: flex; flex-direction: column; gap: 0.55rem;
  padding: 0.7rem 0.7rem; margin-bottom: 0.9rem; border-radius: var(--radius);
  background: var(--bg-raised); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.transport-controls { display: flex; gap: 0.4rem; }
.transport-controls button { flex: 1; min-width: 0; }

/* A small row of dots, one per beat, lit as the clock ticks through the bar
   — visual feedback for the beat that doesn't depend on any audio being on
   at all, which matters now that "no click" is the default. */
.beat-dots { display: flex; gap: 0.35rem; justify-content: center; }
.beat-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--border); transition: background 0.05s, transform 0.05s; }
.beat-dot.lit { background: var(--accent); transform: scale(1.25); }
.beat-dot.downbeat { width: 0.6rem; height: 0.6rem; }
/* Compound meter (6/8, 9/8, 12/8): each dot IS a dotted-quarter pulse —
   three eighth notes — so it's drawn as a tiny cluster of 3 sub-ticks
   instead of one plain dot, and the active sub-tick within the current
   pulse lights up as the clock moves through it. Not used for simple
   meters (3/4, 4/4), where one beat is just one plain beat. */
.beat-dot.compound {
  width: auto; height: auto; background: none; border-radius: 0;
  display: flex; align-items: flex-end; gap: 0.12rem; padding: 0.05rem;
}
.beat-dot.compound.lit { transform: none; }
.beat-subtick { width: 0.24rem; height: 0.24rem; border-radius: 50%; background: var(--border); transition: background 0.05s, transform 0.05s; }
.beat-dot.compound.downbeat .beat-subtick { width: 0.28rem; height: 0.28rem; }
.beat-subtick.lit { background: var(--accent); transform: scale(1.3); }

/* ---- Standalone practice metronome (/metronome) --------------------------
   A self-contained practice tool, not tied to any song — big tempo
   readout, tap tempo, and a per-beat accent picker so a backbeat (2 & 4)
   or any custom groove pattern can be set directly, not just inferred
   from a time signature. */
.metronome-standalone { max-width: 26rem; margin: 1.5rem auto; padding: 1.6rem; display: flex; flex-direction: column; gap: 1.1rem; }
.metro-bpm-row { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.metro-bpm-display { display: flex; flex-direction: column; align-items: center; }
.metro-bpm-display #bpm-input { width: 5.5rem; font-size: 3rem; font-weight: 700; text-align: center; border: none; background: none; padding: 0; }
/* :focus, not :focus-visible, since this is the metronome's own huge
   BPM number — the ring below (same fix as #band-name-display above)
   joins the existing background tint instead of replacing it; outline:
   none previously left only the tint as the focus cue. */
.metro-bpm-display #bpm-input:focus { background: var(--bg-sunken); border-radius: 6px; outline: 2px solid var(--accent); outline-offset: 2px; }
.metro-bpm-display .bpm-unit { font-size: 0.8rem; color: var(--fg-muted); }
.metro-bpm-row .icon-btn { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; }
.metro-beat-dots { gap: 0.6rem; padding: 0.3rem 0; }
.metro-beat-dots .beat-dot { width: 0.8rem; height: 0.8rem; }
.metro-beat-dots .beat-dot.downbeat { width: 0.95rem; height: 0.95rem; }
.metro-transport-controls { display: flex; justify-content: center; gap: 0.8rem; }
.metro-transport-controls .icon-btn { width: 3.4rem; height: 3.4rem; font-size: 1.4rem; }
.metro-transport-controls #play-pause-btn { width: 4rem; height: 4rem; font-size: 1.6rem; }
.metro-section h3 { margin: 0 0 0.4rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); }
.metro-section .metro-icon-row { flex-wrap: wrap; }
.metro-beat-picker { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* Setlist click-track mode (Phase 32): a "now playing" strip above the
   same metronome widget, plus an explicit break step between sets. */
.clicktrack-now-playing { text-align: center; }
.clicktrack-position { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); margin-bottom: 0.3rem; }
.clicktrack-now-playing h2 { margin: 0 0 0.3rem; }
.clicktrack-meta { color: var(--fg-muted); font-size: 0.9rem; margin-bottom: 0.9rem; }
.clicktrack-nav { display: flex; justify-content: center; gap: 0.8rem; }
.clicktrack-nav-btn {
  display: inline-flex; align-items: center; gap: 0.35rem; width: auto; height: auto;
  padding: 0.5rem 1.1rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-raised); color: inherit; font-size: 0.88rem; font-weight: 600;
}
.clicktrack-nav-btn:disabled { opacity: 0.4; }
.clicktrack-nav-btn .icon { width: 1em; height: 1em; }
.clicktrack-break { text-align: center; }
.clicktrack-break h2 { margin: 0 0 0.4rem; }
.clicktrack-break .hint { margin-bottom: 1rem; }
.clicktrack-note {
  margin: 0 auto 0.9rem; max-width: 30rem; font-style: italic; color: var(--fg-muted);
  background: var(--bg-sunken); border-radius: var(--radius); padding: 0.5rem 0.9rem;
}

/* ---- Click-track's own compact metronome — deliberately smaller than
   the standalone tool's control surface (no practice-technique/accent/
   sound-pattern tabs), but every control sits flat on the page: no
   popup/menu/disclosure anywhere. A drummer glancing down at a phone
   propped up mid-gig needs every option visible and one tap away, not
   behind a "..." they'd have to stop playing to find and open.
   data-size on the section scales the beat dots for across-the-room
   visibility; .mc-landscape switches to a wide, row-based layout for a
   phone propped sideways. */
.metronome-compact { max-width: 30rem; margin: 1.2rem auto; padding: 1.3rem; display: flex; flex-direction: column; gap: 1rem; }
.mc-row { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.mc-bpm-display { display: flex; align-items: baseline; gap: 0.3rem; font-weight: 700; }
#mc-bpm-value { font-size: 2.2rem; }
.mc-bpm-display .bpm-unit { font-size: 0.8rem; color: var(--fg-muted); font-weight: 400; }
.mc-row .icon-btn { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; }
.mc-beat-dots { gap: 0.5rem; padding: 0.2rem 0; flex-wrap: wrap; }
.mc-beat-dots .beat-dot { width: 0.7rem; height: 0.7rem; }
.mc-beat-dots .beat-dot.downbeat { width: 0.85rem; height: 0.85rem; }
.metronome-compact[data-size="sm"] .mc-beat-dots .beat-dot { width: 0.45rem; height: 0.45rem; }
.metronome-compact[data-size="sm"] .mc-beat-dots .beat-dot.downbeat { width: 0.58rem; height: 0.58rem; }
.metronome-compact[data-size="lg"] .mc-beat-dots { gap: 0.8rem; }
.metronome-compact[data-size="lg"] .mc-beat-dots .beat-dot { width: 1.3rem; height: 1.3rem; }
.metronome-compact[data-size="lg"] .mc-beat-dots .beat-dot.downbeat { width: 1.6rem; height: 1.6rem; }
/* Flat options: every row always rendered, always visible, no disclosure
   — label on the left, segmented buttons filling the rest of the row so
   each is still a large, easy-to-hit target. */
.mc-options-flat { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 0.3rem; border-top: 1px solid var(--border); }
.mc-opt-row { display: flex; align-items: center; gap: 0.7rem; }
.mc-opt-label { flex: 0 0 4rem; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); }
.mc-opt-row .metro-icon-row { flex: 1; }
.mc-opt-row .metro-icon-row button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.3rem; }
/* Landscape layout: a phone propped sideways on a stand — the beat dots
   become the whole point of the page, transport rides along a single
   row beneath; the options rows stay stacked underneath, still fully
   visible, just not competing with the dots for the top of the screen. */
.metronome-compact.mc-landscape { max-width: none; }
.metronome-compact.mc-landscape .mc-beat-dots { justify-content: center; }
.metronome-compact.mc-landscape[data-size="md"] .mc-beat-dots .beat-dot,
.metronome-compact.mc-landscape[data-size="sm"] .mc-beat-dots .beat-dot { width: 1.1rem; height: 1.1rem; }
.metronome-compact.mc-landscape[data-size="md"] .mc-beat-dots .beat-dot.downbeat,
.metronome-compact.mc-landscape[data-size="sm"] .mc-beat-dots .beat-dot.downbeat { width: 1.35rem; height: 1.35rem; }
.metro-beat-picker button {
  width: 2.1rem; height: 2.1rem; border-radius: 50%; padding: 0; font-weight: 700;
}
.metro-beat-picker button.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

.metro-bpm-marking { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.metro-bpm-slider { width: 100%; accent-color: var(--accent); }

/* Pulse / Practice / Forms — one tool, one engine underneath (clock.js),
   three control surfaces. Pill tabs rather than the prep-editor's
   rectangular ones, to read as "modes of the same dial" above it, not as
   separate documents. */
.metro-tabs { display: flex; gap: 0.4rem; justify-content: center; border-bottom: 1px solid var(--border); padding-bottom: 0.8rem; }
.metro-tab { padding: 0.4rem 1rem; border-radius: 999px; background: none; border: 1px solid transparent; color: var(--fg-muted); font-weight: 600; font-size: 0.85rem; }
.metro-tab.active { background: var(--accent-bg, var(--bg-sunken)); color: var(--accent); border-color: var(--accent); }
.metro-tab-panel { display: flex; flex-direction: column; gap: 1.1rem; }
.metro-tab-panel[hidden] { display: none; }

.metro-field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.metro-field-row label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: var(--fg-muted); flex: 1; min-width: 8rem; }
.metro-field-row input { font: inherit; font-size: 1rem; color: var(--fg); padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }

.metro-slider-row { display: grid; grid-template-columns: 7rem 1fr 3rem; align-items: center; gap: 0.6rem; font-size: 0.82rem; color: var(--fg-muted); }
.metro-slider-row input[type="range"] { accent-color: var(--accent); }
.metro-slider-row span { text-align: right; font-variant-numeric: tabular-nums; color: var(--fg); }

/* Song page mini metronome — a very small always-visible complement to the
   full transport/metronome sheet (reachable via the Metronome stack icon),
   not a replacement: just "give me the tempo" without opening anything. */
.mini-metro { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 0.3rem; }
/* Phase 46: #mini-metro now carries the HTML `hidden` attribute (its
   play/fade/tap buttons stay in the DOM for jumpToSection()/setPlaying(),
   but are no longer shown here — see the template comment) — the rule
   above has the same specificity as the UA [hidden] default and was
   winning by source order, so the "hidden" trio was rendering anyway. */
.mini-metro[hidden] { display: none; }
.mini-metro button, .mini-metro a { width: 1.9rem; height: 1.9rem; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--fg-muted); text-decoration: none; }
.mini-metro button:hover, .mini-metro a:hover { color: var(--accent); }
.mini-metro button.active { color: var(--accent); background: var(--accent-bg, var(--bg-sunken)); }
.mini-metro .icon { width: 0.95rem; height: 0.95rem; }

.tempo-row { display: flex; align-items: baseline; gap: 0.4rem; font-family: var(--font-chart); }
.tempo-row input {
  width: 3.2rem; border: none; background: none; font: inherit; font-size: 1.3rem; font-weight: 700; color: var(--fg);
  border-bottom: 1px dashed var(--border); text-align: center; padding: 0 0.1rem;
}
.bpm-unit { font-size: 0.78rem; color: var(--fg-muted); }

.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; color: var(--fg-muted); }

.reference-block { margin: 0.5rem 0; }
.reference-row { display: flex; align-items: center; gap: 0.4rem; }
.reference-row .meta-row { flex: 1; justify-content: flex-start; }
.reference-edit-row { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.reference-edit-row input { flex: 1; min-width: 0; }
.reference-embed { margin-top: 0.5rem; }
.reference-embed:empty { display: none; }
.reference-embed iframe {
  width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--border);
  border-radius: 6px; display: block;
}
.reference-section-head {
  margin: 1.2rem 0 0.4rem; padding-top: 1rem; border-top: 1px solid var(--border);
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--fg-muted);
}
.reference-section-head:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.audio-category-upload { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }

/* A segmented row of equal-width icon buttons — the sound/mode/intro-length
   pickers, replacing what used to be <select> dropdowns: a dropdown hides
   the other options behind a click and a tiny icon-less label, where a
   touring musician wants every choice visible and tappable at a glance. */
.metro-icon-row { display: flex; gap: 0.25rem; background: var(--bg-sunken); border-radius: 8px; padding: 0.2rem; }
.metro-icon-row button {
  flex: 1; min-width: 0; padding: 0.35rem 0.3rem; border-radius: 6px; background: none; border: none;
  color: var(--fg-muted); font-size: 0.72rem; display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
}
.metro-icon-row button .icon { margin: 0; }
.metro-icon-row button.active { background: var(--bg-raised); color: var(--accent); box-shadow: var(--shadow); }
.metro-icon-row button:hover:not(.active) { color: var(--fg); }
/* Always visible, not a collapsed <details> — see the template comment:
   count-in length and click sound are settings a drummer glances at and
   sets before counting the band in, not an "advanced" afterthought. */
.metro-advanced { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.35rem; }
.metro-advanced-label { font-size: 0.72rem; padding: 0; }

/* ---- View/layout controls row -------------------------------------------- */

/* ---- Sheet (chords + lyrics) ---------------------------------------------- */
.sheet { display: block; }
/* Reference mode hides the chart entirely rather than hiding pieces of
   it the way jazz/lyrics/map do — a video/audio reference page has
   nothing in common with the chart layout underneath it. */
#sheet[data-render-mode="reference"] { display: none; }
#sheet[data-render-mode="mixer"] { display: none; }
#sheet[data-render-mode="score"] { display: none; }

/* ---- Reference page (app/docs/mp3-reference-audio.md) ---------------------
   A plain sibling of #sheet (see play.html's own comment on why), shown
   only when #sheet carries that mode via the general sibling combinator —
   the mirror image of the rule just above. */
.reference-page { display: none; max-width: 42rem; margin: 0 auto; padding: 1rem 0; }
#sheet[data-render-mode="reference"] ~ .reference-page { display: block; }

/* ---- Mixer (DAW view) ----------------------------------------------------
   Same sibling convention as .reference-page. Layout and palette follow
   Audacity 4's own (src/projectscene QML + light.cfg): light track
   headers, a dark track canvas, a beats-and-measures ruler, colored
   clips with a 20px header, a pentagon playhead; mute/solo follow the
   Logic/GarageBand blue/yellow convention. The structure strip and the
   reference player are hidden here: both live on this timeline instead. */
/* ---- Guitar Pro file (docs/gp-file-model.md §5) --------------------------
   .gp-score: a section's "gp[Track]: bars" drawn from the song's file,
   in the Song view only (like .alphatab-row). .gp-score-page: the whole
   file, the Score view, a sibling of #sheet like the Mixer. */
.gp-score { margin: 0.6rem 0 0.4rem; }
.gp-score-label { font-size: 0.8rem; color: var(--fg-muted); margin: 0 0 0.2rem; }
.gp-score-error { font-size: 0.85rem; color: var(--danger, #b3261e); margin: 0.2rem 0; }
.gp-score-range + .gp-score-range { margin-top: 0.4rem; }
.gp-score-body svg { max-width: 100%; height: auto; }
#sheet:not([data-render-mode="normal"]) .gp-score { display: none; }

.gp-drift { margin: 0.4rem 0 0.8rem; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; padding: 0.5rem 0.8rem; background: var(--bg-raised, var(--bg)); }
.gp-drift:not([open]) { border-left-color: var(--border); }
.gp-drift summary { cursor: pointer; font-weight: 600; }
.gp-drift-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.gp-drift-item { display: grid; gap: 0.2rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.gp-drift-item.is-kept { opacity: 0.65; }
.gp-drift-values { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; font-size: 0.9rem; color: var(--fg-muted); }
.gp-drift-values code { color: var(--fg); }
.gp-drift-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.gp-drift-actions button { padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.gp-drift-hint, .gp-drift-kept { font-size: 0.85rem; color: var(--fg-muted); }
.gp-drift-error { color: var(--danger); font-size: 0.85rem; }

/* ---- The Guitar Pro file editor (gp_edit.html; gp-editor.js, gp-palette.js,
   gp-ui.js) ------------------------------------------------------------------
   A workbench in three zones, like Guitar Pro 8: the top bar, the palette
   rail beside a paper page, the status bar. Voice colours follow Guitar
   Pro's (ink, blue, green, amber) and colour the cursor; track colours come
   from the file. An "on" tile is tinted, not filled: the solid accent is
   Save's. Musical symbols are Bravura, the SMuFL font alphaTab ships. */
@font-face { font-family: "Bravura"; src: url("/static/js/vendor/alphatab/font/Bravura.woff2") format("woff2"); font-display: swap; }
.gpe-shell {
  --gpe-v1: var(--fg); --gpe-v2: #2f6fb5; --gpe-v3: #4f7d1c; --gpe-v4: #b06a12;
  /* The app's card pattern: white chrome and a white page on the app's
     page colour (a darker desk in dark mode, so the page still lifts). */
  --gpe-desk: var(--bg); --gpe-paper: var(--bg-raised); --gpe-chrome: var(--bg-raised);
  --gpe-tile: var(--bg-raised); --gpe-tile-hover: var(--bg); --gpe-on: var(--accent-bg); --gpe-on-ink: var(--accent-ink);
  display: flex; flex-direction: column; min-height: 100vh; background: var(--gpe-desk);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gpe-shell { --gpe-v2: #6aa7ea; --gpe-v3: #8cbf55; --gpe-v4: #e0a24f; --gpe-desk: var(--bg-sunken); --gpe-tile: var(--bg); --gpe-tile-hover: var(--bg-sunken); }
}
:root[data-theme="dark"] .gpe-shell { --gpe-v2: #6aa7ea; --gpe-v3: #8cbf55; --gpe-v4: #e0a24f; --gpe-desk: var(--bg-sunken); --gpe-tile: var(--bg); --gpe-tile-hover: var(--bg-sunken); }
.gpe-shell .icon { width: 1.15rem; height: 1.15rem; flex: none; }

/* Top bar */
.gpe-top { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.9rem; background: var(--gpe-chrome); border-bottom: 1px solid var(--border); }
.gpe-back { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 8px; color: var(--fg-muted); }
.gpe-back:hover { background: var(--gpe-tile-hover); color: var(--fg); }
.gpe-doc { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.gpe-song { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16rem; }
.gpe-file { font-size: 0.8rem; color: var(--fg-muted); display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16rem; }
.gpe-dirty { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--warn); flex: none; }
.gpe-dirty[hidden] { display: none; }
.gpe-tabs { flex: 1; display: flex; justify-content: center; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; }
.gpe-tab { --tc: var(--fg-muted); display: inline-flex; align-items: center; gap: 0.4rem; height: 2.1rem; padding: 0 0.8rem; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--fg-muted); font: inherit; font-size: 0.9rem; white-space: nowrap; cursor: pointer; }
.gpe-tab .sw { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--tc); flex: none; }
.gpe-tab:hover { background: var(--gpe-tile-hover); color: var(--fg); }
.gpe-tab.on { color: var(--fg); border-color: var(--tc); background: color-mix(in srgb, var(--tc) 12%, var(--bg-raised)); font-weight: 600; }
.gpe-tab .more { display: inline-flex; margin-right: -0.3rem; color: var(--fg-muted); }
.gpe-tab.add { border-style: dashed; padding: 0 0.55rem; }
.gpe-actions { display: flex; align-items: center; gap: 0.3rem; }
.gpe-ib { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; min-width: 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--fg-muted); }
.gpe-ib:hover:not(:disabled) { background: var(--gpe-tile-hover); color: var(--fg); }
.gpe-ib[aria-pressed="true"] { background: var(--gpe-on); color: var(--gpe-on-ink); }
.gpe-ib:disabled { opacity: 0.4; }
.gpe-save { min-height: 2.2rem; padding: 0 1.1rem; }
.gpe-note { margin: 0.6rem 1rem 0; font-size: 0.9rem; color: var(--fg-muted); }

/* Body: rail beside the paper. (The app's page rules centre <main> in a
   reading column; this one takes the whole width.) */
.gpe-shell > main.gpe { max-width: none; width: 100%; margin: 0; padding: 0; align-self: stretch; }
.gpe { flex: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0; align-items: start; }
.gpe-stage { padding: 1rem 1.2rem 1.5rem; min-width: 0; }
.gpe-paper { position: relative; background: var(--gpe-paper); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); padding: 1.2rem 1.4rem 2rem; min-height: 60vh; outline: none; }
.gpe-paper:focus-visible { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
.gpe-cursor { position: absolute; border: 2px solid var(--gpe-vc); border-radius: 4px; pointer-events: none; background: color-mix(in srgb, var(--gpe-vc) 14%, transparent); transition: left 80ms ease-out, top 80ms ease-out; }
.gpe-bar-hl { position: absolute; pointer-events: none; background: color-mix(in srgb, var(--gpe-vc) 5%, transparent); border-radius: 4px; }
.gpe[data-voice="1"] { --gpe-vc: var(--accent); }
.gpe[data-voice="2"] { --gpe-vc: var(--gpe-v2); }
.gpe[data-voice="3"] { --gpe-vc: var(--gpe-v3); }
.gpe[data-voice="4"] { --gpe-vc: var(--gpe-v4); }
.gpe-paper .at-cursor-bar { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.gpe-paper .at-cursor-beat { background: var(--accent); width: 3px; }

/* The palette rail */
.gpe-rail { position: sticky; top: 3.4rem; align-self: start; width: 13.75rem; max-height: calc(100vh - 6.6rem); overflow-y: auto; background: var(--gpe-chrome); border-right: 1px solid var(--border); padding: 0.4rem 0.55rem 1rem; scrollbar-width: thin; }
.gpe-rail-head { display: flex; align-items: center; justify-content: space-between; padding: 0.15rem 0.1rem 0.3rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-faint); }
.gpe-rail-fold { display: inline-flex; width: 1.9rem; height: 1.9rem; min-width: 0; padding: 0; align-items: center; justify-content: center; border: 0; background: none; color: var(--fg-muted); border-radius: 6px; }
.gpe-rail-fold:hover { background: var(--gpe-tile-hover); }
.gpe-rail-tabs { display: none; }
.gpe-pal-group { margin-top: 0.25rem; }
.gpe-pal-group[hidden] { display: none; }
.gpe-pal-head { display: flex; align-items: center; gap: 0.45rem; width: 100%; min-height: 0; padding: 0.35rem 0.25rem; border: 0; background: none; color: var(--fg-muted); font: inherit; font-size: 0.78rem; font-weight: 600; text-align: left; border-radius: 6px; }
.gpe-pal-head:hover { color: var(--fg); background: var(--gpe-tile-hover); }
.gpe-pal-head::after { content: ""; margin-left: auto; width: 0.4rem; height: 0.4rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); opacity: 0.6; }
.gpe-pal-group.closed .gpe-pal-head::after { transform: rotate(-45deg); }
.gpe-pal-group.closed .gpe-pal-grid { display: none; }
.gpe-pal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 0.1rem 0 0.35rem; }
.gpe-tile { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 2.35rem; padding: 0; border: 1px solid transparent; border-radius: 6px; background: var(--gpe-tile); color: var(--fg); font: inherit; font-size: 0.8rem; line-height: 1; white-space: nowrap; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.gpe-tile:hover { background: var(--gpe-tile-hover); }
.gpe-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.gpe-tile[hidden] { display: none; }
.gpe-tile.smufl { font-family: "Bravura", serif; font-size: 1.45rem; line-height: 1; padding-bottom: 0.15rem; }
.gpe-tile.perf { font-family: var(--font-chart); font-style: italic; font-size: 0.92rem; }
.gpe-tile.chordname { font-family: var(--font-chart); font-style: italic; font-weight: 600; font-size: 0.95rem; }
.gpe-tile.rehearsal { font-weight: 700; }
.gpe-tile.rehearsal::before { content: ""; position: absolute; inset: 0.55rem 0.8rem; border: 1.5px solid currentColor; border-radius: 2px; }
.gpe-tile.kit { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; }
.gpe-tile.kit.current { box-shadow: inset 0 0 0 2px var(--gpe-vc, var(--accent)); }
.gpe-tile[aria-pressed="true"] { background: var(--gpe-on); color: var(--gpe-on-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.gpe-tile[aria-pressed="true"]::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 3px; height: 2px; border-radius: 2px; background: var(--accent); }
.gpe-tile.has-more::before { content: ""; position: absolute; right: 2px; bottom: 2px; border: 3px solid transparent; border-right-color: var(--fg-faint); border-bottom-color: var(--fg-faint); }
.gpe-tile.voice { font-weight: 700; color: var(--v); }
.gpe-tile.voice[aria-pressed="true"] { background: color-mix(in srgb, var(--v) 14%, var(--bg-raised)); color: var(--v); box-shadow: inset 0 0 0 1.5px var(--v); }
.gpe-tile.voice[aria-pressed="true"]::after { background: var(--v); }
.gpe-pal-group[data-group="voice"] .gpe-pal-grid { grid-template-columns: repeat(4, 1fr); }
.gpe-tile.voice:nth-child(1) { --v: var(--gpe-v1); }

/* Folded rail: only the group icons, each opening its group beside it. */
.gpe-rail.folded { width: 3.4rem; padding: 0.4rem 0.3rem; }
.gpe-rail.folded .gpe-rail-head span, .gpe-rail.folded .gpe-pal-grid, .gpe-rail.folded .gpe-pal-head span, .gpe-rail.folded .gpe-pal-head::after { display: none; }
.gpe-rail.folded .gpe-rail-head { justify-content: center; }
.gpe-rail.folded .gpe-pal-head { justify-content: center; padding: 0.55rem 0; }
.gpe-rail.folded .gpe-pal-head .icon { width: 1.35rem; height: 1.35rem; }

/* Popovers, forms, tooltips (gp-ui.js) */
.gpe-pop { position: absolute; z-index: 320; min-width: 12rem; max-width: min(24rem, calc(100vw - 16px)); background: var(--bg-raised); color: var(--fg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(28, 22, 12, 0.18), 0 2px 6px rgba(28, 22, 12, 0.08); padding: 0.6rem; animation: gpe-pop 120ms ease-out; }
@keyframes gpe-pop { from { opacity: 0; transform: translateY(-3px); } }
.gpe-pop-title { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; font-weight: 600; color: var(--fg-muted); margin: 0 0 0.45rem; }
.gpe-pop-title kbd, .gpe-tip kbd, .gpe-keys-list kbd { font-family: var(--font-mono); font-size: 0.72rem; padding: 0.05rem 0.35rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); color: var(--fg-muted); }
.gpe-pop-flyout .gpe-pal-grid { grid-template-columns: repeat(6, 2.6rem); }
.gpe-choose { display: grid; gap: 3px; }
.gpe-choose button { min-width: 2.6rem; min-height: 2.3rem; padding: 0 0.6rem; font-size: 0.85rem; border-radius: 6px; }
.gpe-choose button.smufl { font-family: "Bravura", serif; font-size: 1.4rem; }
.gpe-choose button.on { background: var(--gpe-on); color: var(--gpe-on-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.gpe-form { display: grid; gap: 0.5rem; min-width: 14rem; }
.gpe-form label { display: grid; gap: 0.2rem; font-size: 0.82rem; color: var(--fg-muted); }
.gpe-form input, .gpe-form select { font-size: 1rem; }
.gpe-form small, .gpe-form-hint { font-size: 0.8rem; color: var(--fg-faint); margin: 0; }
.gpe-form-error { color: var(--danger); font-size: 0.82rem; margin: 0; }
.gpe-form-error[hidden] { display: none; }
.gpe-form-actions { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.2rem; }
.gpe-tip { position: absolute; z-index: 330; max-width: 18rem; padding: 0.35rem 0.55rem; border-radius: 6px; background: var(--fg); color: var(--bg); font-size: 0.8rem; line-height: 1.35; pointer-events: none; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.gpe-tip[hidden] { display: none; }
.gpe-tip kbd { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.gpe-tip small { flex-basis: 100%; opacity: 0.75; }
.gpe-pop-keys { max-height: 70vh; overflow-y: auto; }
.gpe-keys-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.8rem; margin: 0 0 0.5rem; font-size: 0.85rem; }
.gpe-keys-list dd { margin: 0; }

/* Status bar */
.gpe-statusbar { position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.3rem 0.9rem; background: var(--gpe-chrome); border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.gpe-st-where, .gpe-st-tools { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.gpe-st-where { flex: 1; flex-wrap: wrap; row-gap: 0.1rem; }
.gpe-st-tools { flex: none; gap: 0.35rem; }
.gpe-st-tools select { font-size: 0.85rem; min-height: 2rem; padding: 0 0.4rem; }
.gpe-voicechip { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--fg); }
.gpe-voicechip .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--gpe-vc); }
.gpe-shell:has(.gpe[data-voice="1"]) .gpe-voicechip .dot { background: var(--gpe-v1); }
.gpe-shell:has(.gpe[data-voice="2"]) .gpe-voicechip .dot { background: var(--gpe-v2); }
.gpe-shell:has(.gpe[data-voice="3"]) .gpe-voicechip .dot { background: var(--gpe-v3); }
.gpe-shell:has(.gpe[data-voice="4"]) .gpe-voicechip .dot { background: var(--gpe-v4); }
.gpe-secchip { flex: none; padding: 0.1rem 0.5rem; border-radius: 4px; background: var(--current-bg); color: var(--current-fg); font-weight: 600; font-size: 0.8rem; }
.gpe-secchip[hidden] { display: none; }
.gpe-msg { color: var(--fg); }
.gpe-msg.bad { color: var(--danger); }
.gpe-msg.ok { color: var(--ok); }
.gpe-msg.hint { color: var(--warn); }
.gpe-fill { display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.gpe-fill .bar { width: 4rem; height: 0.4rem; border-radius: 999px; background: var(--border); overflow: hidden; }
.gpe-fill .bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ok); transition: width 120ms ease-out; }
.gpe-fill[data-state="under"] .bar > span { background: var(--warn); }
.gpe-fill[data-state="over"] .bar > span { width: 100% !important; background: var(--danger); }
.gpe-fill[data-state="over"] .txt { color: var(--danger); }
.gpe-sep { width: 1px; height: 1.4rem; background: var(--border); }
.gpe-play { color: var(--fg); }
.gpe-play.loading { opacity: 0.45; }
.gpe-touch { display: none; }
@media (pointer: coarse) { .gpe-touch { display: inline-flex; } }
.gpe-keypad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 0.4rem 0.6rem; background: var(--gpe-chrome); border-top: 1px solid var(--border); grid-column: 1 / -1; }
.gpe-keypad[hidden] { display: none; }
.gpe-keypad button { min-height: 2.8rem; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* Bars selected in the file editor, for a section of the song */
.gpe-sel-layer { position: absolute; inset: 0; pointer-events: none; }
.gpe-sel { position: absolute; border-radius: 4px; background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.gpe-selbar { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.1rem 0.25rem 0.1rem 0.6rem; border-radius: 999px; background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
.gpe-selbar[hidden] { display: none; }
.gpe-usefor { min-height: 1.8rem; padding: 0 0.7rem; border-radius: 999px; font-size: 0.8rem; }

/* The bar picker (gp-bar-picker.js): a strip of the file's bars, each
   section's bars as a band under it, the current choice in the accent. */
.gpbp-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(28, 22, 12, 0.35); display: flex; align-items: center; justify-content: center; padding: 1rem; }
body.gpbp-open { overflow: hidden; }
.gpbp { width: min(64rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--bg-raised); color: var(--fg); border-radius: 12px; box-shadow: 0 18px 50px rgba(28, 22, 12, 0.25); padding: 0.9rem 1.1rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.gpbp-head { display: flex; align-items: center; justify-content: space-between; }
.gpbp-head h2 { margin: 0; font-size: 1.05rem; }
.gpbp-x { min-width: 2.2rem; min-height: 2.2rem; padding: 0; border: 0; background: none; font-size: 1.5rem; color: var(--fg-muted); }
.gpbp-sections { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.2rem; scrollbar-width: thin; }
.gpbp-sec { flex: none; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2rem; padding: 0 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--fg); font: inherit; font-size: 0.88rem; }
.gpbp-sec .n { color: var(--fg-faint); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.gpbp-sec.none { border-style: dashed; color: var(--fg-muted); }
.gpbp-sec[aria-selected="true"] { border: 1.5px solid var(--accent); background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
.gpbp-striptools { display: flex; align-items: center; gap: 0.4rem; }
.gpbp-hint { flex: 1; font-size: 0.8rem; color: var(--fg-faint); }
.gpbp-ghost { min-height: 1.9rem; padding: 0 0.7rem; border-radius: 6px; font-size: 0.85rem; background: none; }
.gpbp-stripwrap { overflow-x: auto; padding: 0.3rem 0.4rem 0.4rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-raised); scrollbar-width: thin; }
.gpbp-strip { position: relative; min-width: 100%; user-select: none; }
.gpbp-strip.loading { min-height: 9rem; background: repeating-linear-gradient(90deg, transparent 0 7rem, var(--border) 7rem calc(7rem + 1px)); }
.gpbp-ruler { position: relative; height: 1.1rem; }
.gpbp-num { position: absolute; top: 0; font-size: 0.7rem; font-variant-numeric: tabular-nums; color: var(--fg-faint); padding-left: 0.2rem; border-left: 1px solid var(--border); line-height: 1.1rem; }
.gpbp-score { min-height: 6rem; }
.gpbp-score svg { max-width: none; }
.gpbp-over { position: absolute; inset: 0; cursor: pointer; }
.gpbp-sel { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: color-mix(in srgb, var(--accent) 13%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent); pointer-events: none; }
.gpbp-sel.pending { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); outline: 1.5px dashed color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: -4px; }
.gpbp-start { position: absolute; top: 0; bottom: 0; border-left: 3px solid var(--accent); border-radius: 4px 0 0 4px; background: color-mix(in srgb, var(--accent) 16%, transparent); pointer-events: none; }
.gpbp-range { display: inline-flex; align-items: center; gap: 0.25rem; min-height: 1.9rem; padding: 0 0.65rem; border-radius: 999px; background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.gpbp-range-x { min-width: 1.3rem; min-height: 1.3rem; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 1rem; line-height: 1; }
.gpbp-range-x:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.gpbp-ghost.on { background: var(--accent-bg); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.gpbp-bands { position: relative; margin-top: 0.3rem; min-height: 18px; }
.gpbp-band { position: absolute; height: 15px; padding: 0 0.35rem; border-radius: 4px; background: var(--bg-sunken); color: var(--fg-muted); font-size: 0.68rem; line-height: 15px; white-space: nowrap; overflow: hidden; cursor: pointer; }
.gpbp-band.cur { background: var(--accent); color: var(--accent-contrast); cursor: default; }
.gpbp-pick { display: grid; gap: 0.5rem; }
.gpbp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.gpbp-lbl { font-size: 0.82rem; color: var(--fg-muted); margin-right: 0.2rem; }
.gpbp-chip { min-height: 1.9rem; padding: 0 0.7rem; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--fg-muted); font: inherit; font-size: 0.85rem; }
.gpbp-chip.on { background: var(--accent-bg); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-ink); font-weight: 600; }
.gpbp-notation { margin-left: auto; font-size: 0.85rem; }
.gpbp-check { font-size: 0.88rem; }
.gpbp-check.ok { color: var(--ok); }
.gpbp-check.warn { color: var(--warn); }
.gpbp-check.muted { color: var(--fg-faint); }
.gpbp-line { justify-self: start; font-family: var(--font-mono); font-size: 0.85rem; padding: 0.2rem 0.5rem; border-radius: 4px; background: var(--bg-sunken); }
.gpbp-line:empty { display: none; }
.gpbp-foot { position: sticky; bottom: -1rem; display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; padding: 0.6rem 0 0; background: var(--bg-raised); border-top: 1px solid var(--border); }
.gpbp-status { flex: 1; font-size: 0.85rem; color: var(--fg-muted); }
@media (max-width: 760px) {
  .gpbp-overlay { align-items: flex-end; padding: 0; }
  .gpbp { width: 100%; max-height: 88vh; border-radius: 14px 14px 0 0; padding: 0.7rem 0.8rem 0.8rem; }
  .gpbp-hint { display: none; }
  .gpbp-notation { margin-left: 0; }
}

/* The Chart tab's "Bars from the file" row */
.gp-bars-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.4rem 0 0.6rem; }
.gp-bars-label { font-size: 0.82rem; color: var(--fg-muted); }
.gp-bars-chip { min-height: 1.9rem; padding: 0 0.7rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-bg); color: var(--accent-ink); font: inherit; font-size: 0.85rem; }
.gp-bars-pick { min-height: 1.9rem; padding: 0 0.7rem; border-radius: 999px; border-style: dashed; font-size: 0.85rem; }

/* Song page links into the editor */
.gp-score-add { margin: 0.4rem 0; font-size: 0.85rem; }
button.link-like { border: 0; background: none; padding: 0; min-height: 0; min-width: 0; color: var(--accent-ink); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.gp-score-edit { margin-left: 0.4rem; font-size: 0.8rem; }
.gp-drift-open { font-size: 0.85rem; margin-left: auto; }

/* Phone: the score fills the screen; the palette is a sheet at the
   bottom, one group at a time, with the keypad over the status bar. */
@media (max-width: 760px) {
  body:has(.gpe-shell) .global-tabbar { display: none; }
  .gpe-shell { height: 100dvh; min-height: 0; }
  .gpe-top { padding: 0.35rem 0.5rem; gap: 0.4rem; }
  .gpe-doc .gpe-file { display: none; }
  .gpe-song { max-width: 7rem; font-size: 0.95rem; }
  .gpe-tabs { justify-content: flex-start; }
  .gpe-tab .icon, .gpe-tab .nm { display: none; }
  .gpe-tab.on .nm { display: inline; max-width: 6rem; overflow: hidden; text-overflow: ellipsis; }
  .gpe { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: stretch; }
  .gpe > * { min-width: 0; }
  .gpe-stage { order: 1; flex: 1; min-height: 0; overflow: auto; padding: 0.5rem; }
  .gpe-paper { min-height: 0; padding: 0.6rem; }
  .gpe-keypad { order: 2; }
  .gpe-rail { order: 3; position: static; align-self: stretch; width: auto; max-height: 34vh; border-right: 0; border-top: 1px solid var(--border); padding: 0 0.5rem 0.4rem; }
  .gpe-rail.folded { width: auto; }
  .gpe-rail-head { display: none; }
  .gpe-rail-tabs { display: flex; gap: 0.2rem; overflow-x: auto; position: sticky; top: 0; z-index: 1; background: var(--gpe-chrome); padding: 0.35rem 0 0.3rem; scrollbar-width: none; }
  .gpe-rail-tabs button { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 2.2rem; padding: 0 0.65rem; border: 0; border-radius: 999px; background: none; color: var(--fg-muted); font: inherit; font-size: 0.85rem; white-space: nowrap; }
  .gpe-rail-tabs button[aria-selected="true"] { background: var(--gpe-on); color: var(--gpe-on-ink); font-weight: 600; }
  .gpe-rail-tabs button[hidden] { display: none; }
  .gpe-pal-group { display: none; margin: 0; }
  .gpe-pal-group.active { display: block; }
  .gpe-pal-group.active .gpe-pal-grid, .gpe-rail.folded .gpe-pal-group.active .gpe-pal-grid { display: grid; }
  .gpe-pal-head { display: none; }
  .gpe-pal-grid { grid-template-columns: repeat(auto-fill, minmax(2.75rem, 1fr)); gap: 4px; }
  .gpe-tile { min-height: 2.75rem; }
  .gpe-statusbar { padding: 0.25rem 0.5rem; gap: 0.4rem; font-size: 0.78rem; }
  .gpe-st-where #gpe-what, .gpe-st-where .gpe-voicechip, .gpe-st-tools select, .gpe-st-tools .gpe-sep, #gpe-countin, #gpe-metronome, #gpe-help { display: none; }
  .gpe-st-where { flex-wrap: nowrap; overflow: hidden; gap: 0.4rem; }
  .gpe-st-where #gpe-pos { white-space: nowrap; flex: none; }
  .gpe-pos-more { display: none; }
  .gpe-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #gpe-redo, .gpe-tab .more { display: none; }
  .gpe-song { max-width: 6rem; }
}
.scores-gp { margin-bottom: 1.2rem; }
.scores-gp .gp-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.gp-score-page { display: none; padding: 0.4rem 0 1rem; }
#sheet[data-render-mode="score"] ~ .gp-score-page { display: block; }
/* The Score view's control bar: the practice player's (.audio-transport),
   in its card, kept in view while the score scrolls. */
.gp-toolbar { position: sticky; top: 0; z-index: 2; margin: 0 0 0.5rem; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
.gp-toolbar .gp-lcd { min-width: 9rem; }
.gp-opts { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; margin-left: auto; }
.gp-opts .audio-toggle .icon, .gp-opts .audio-speed .icon { margin: 0; width: 0.95rem; height: 0.95rem; }
.gp-view-opts { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0 0 0.6rem; font-size: 0.88rem; }
.gp-view-opts .gp-tracks { margin: 0; }
.gp-view-opts .gp-tracks:not(:has(.gp-track-chip + .gp-track-chip)) { display: none; }
.gp-view-opts .gp-opt select { font-size: 0.85rem; }
.gp-link { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--fg-muted); text-decoration: none; }
.gp-link:hover { color: var(--fg); text-decoration: underline; }
.gp-view-opts .gp-link:first-of-type { margin-left: auto; }
.gp-hint { color: var(--fg-faint); font-size: 0.8rem; }
@media (max-width: 720px) { .gp-hint { display: none; } }
/* With the file's own recording, the score plays it: the practice player
   and the structure strip above would play the same, without the score. */
body.gp-own-audio:has(#sheet[data-render-mode="score"]) #song-structure-strip,
body.gp-own-audio:has(#sheet[data-render-mode="score"]) #audio-player { display: none !important; }
.gp-btn { min-width: 2.4rem; min-height: 2.2rem; padding: 0.2rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-control, 6px); background: var(--bg-elev, var(--bg)); color: var(--fg); font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.gp-btn:disabled { opacity: 0.5; cursor: default; }
.gp-time { font-variant-numeric: tabular-nums; color: var(--fg-muted); min-width: 6.5rem; }
.gp-opt { display: inline-flex; gap: 0.3rem; align-items: center; font-size: 0.9rem; }
.gp-tracks { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.2rem 0 0.6rem; }
.gp-track-chip { border: 1px solid var(--border); border-radius: 999px; padding: 0.25rem 0.75rem; background: none; color: var(--fg-muted); font: inherit; font-size: 0.9rem; cursor: pointer; }
.gp-track-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg, #fff); }
.gp-score-viewport { overflow: auto; max-height: calc(100vh - 9rem); }
.gp-score-canvas .at-cursor-bar { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.gp-score-canvas .at-cursor-beat { background: var(--accent); width: 3px; }
.gp-score-canvas .at-selection div { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.gp-score-canvas .at-highlight * { fill: var(--accent); stroke: var(--accent); }
@media (max-width: 720px) {
  .gp-toolbar .gp-lcd { order: 0; flex: 1 1 auto; min-width: 0; }
  .gp-opts { flex: 1 1 100%; margin-left: 0; }
  .gp-opts > * { flex: 1 1 auto; justify-content: center; }
  .gp-opts .audio-speed select { width: 100%; }
  .gp-score-viewport { max-height: none; overflow: visible; }
}

.mixer-page { display: none; padding: 0.4rem 0 1rem; }
#sheet[data-render-mode="mixer"] ~ .mixer-page { display: block; }
body:has(#sheet[data-render-mode="mixer"]) #song-structure-strip,
body:has(#sheet[data-render-mode="mixer"]) #audio-player { display: none !important; }

.daw {
  --daw-bg: #F8F8F9; --daw-header: #EEEEF1; --daw-header-hover: #F3F3F5; --daw-sep: #E3E3E7;
  --daw-stroke: #D4D5D9; --daw-text: #14151A; --daw-muted: #5B5E6B;
  --daw-ruler: #DFDFE3; --daw-ruler-stroke: #BFC0C5; --daw-lane-light: #E9E9EE;
  --daw-canvas: #212433; --daw-accent: #A09EEF; --daw-play: #18A999;
  --daw-mute: #4A8FE7; --daw-solo: #F2C744;
  border: 1px solid var(--daw-stroke); border-radius: 8px; overflow: hidden;
  background: var(--daw-bg); color: var(--daw-text); font-family: var(--font-ui); font-size: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .daw {
    --daw-bg: #1B1D29; --daw-header: #262938; --daw-header-hover: #2C3042; --daw-sep: #33374A;
    --daw-stroke: #3A3E52; --daw-text: #E6E7EE; --daw-muted: #A4A7B8;
    --daw-ruler: #2C2F40; --daw-ruler-stroke: #45495E; --daw-lane-light: #262938; --daw-canvas: #15171F;
  }
}
:root[data-theme="dark"] .daw {
  --daw-bg: #1B1D29; --daw-header: #262938; --daw-header-hover: #2C3042; --daw-sep: #33374A;
  --daw-stroke: #3A3E52; --daw-text: #E6E7EE; --daw-muted: #A4A7B8;
  --daw-ruler: #2C2F40; --daw-ruler-stroke: #45495E; --daw-lane-light: #262938; --daw-canvas: #15171F;
}
.daw .icon { width: 16px; height: 16px; }
/* A desktop DAW is dense by design: opt out of the app-wide 44px touch
   minimum for buttons and fields inside it. */
.daw button, .daw select { min-height: 0; margin: 0; font-size: 12px; line-height: 1; }
.daw select { height: 22px; padding: 0 4px; border-radius: 4px; border: 1px solid var(--daw-stroke); background: var(--daw-bg); color: var(--daw-text); }
.daw-align-bar[hidden] { display: none; }
.daw-toolbar { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--daw-stroke); flex-wrap: wrap; }
.daw-tb-group { display: flex; align-items: center; gap: 2px; }
.daw-btn {
  width: 28px; height: 28px; padding: 0; border: none; border-radius: 4px; background: transparent;
  color: var(--daw-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.daw-btn:hover { background: rgba(127, 127, 140, 0.16); }
.daw-btn.daw-play { color: var(--daw-play); }
.daw-btn.daw-play .icon { width: 20px; height: 20px; }
.daw-btn[aria-pressed="true"] { background: var(--daw-accent); color: #fff; }
.daw-btn-sm { width: 22px; height: 22px; font-size: 15px; line-height: 1; }
.daw-lcd {
  display: flex; flex-direction: column; justify-content: center; min-width: 6.5rem; padding: 2px 10px; border-radius: 4px;
  background: #212433; color: #DCE9FF; font-family: var(--font-mono); line-height: 1.15;
}
.daw-lcd-main { font-size: 15px; letter-spacing: 0.02em; }
.daw-lcd-sub { font-size: 10.5px; opacity: 0.7; }
.daw-meta span { padding: 0 8px; color: var(--daw-muted); font-variant-numeric: tabular-nums; }
.daw-meta span + span { border-left: 1px solid var(--daw-stroke); }
.daw-speed { display: flex; align-items: center; gap: 5px; color: var(--daw-muted); }

.daw-tb-spacer { flex: 1; }
.daw-btn-text {
  height: 28px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--daw-stroke);
  background: var(--daw-header); color: var(--daw-text); font-size: 12px; cursor: pointer;
}
.daw-btn-text[aria-pressed="true"] { background: var(--daw-accent); border-color: var(--daw-accent); color: #fff; }
.daw-zoom { display: flex; align-items: center; gap: 4px; }

.daw-align-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px;
  background: rgba(160, 158, 239, 0.18); border-bottom: 1px solid var(--daw-stroke);
}
.daw-align-bar kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--daw-stroke); border-radius: 3px; padding: 0 3px; }
.daw-align-status { color: var(--daw-muted); }
.daw-status { margin: 0; padding: 6px 10px; color: var(--daw-muted); border-top: 1px solid var(--daw-stroke); }
.daw-status:empty { display: none; }

.daw-main { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.daw-headers { background: var(--daw-header); border-right: 1px solid var(--daw-stroke); }
.daw-scroll { overflow-x: auto; overflow-y: hidden; background: var(--daw-canvas); }
.daw-content { position: relative; }

/* Header cells and lanes share one fixed height per row (set by mixer.js). */
.daw-hdr { display: flex; box-sizing: border-box; border-bottom: 1px solid var(--daw-sep); position: relative; }
.daw-hdr:hover { background: var(--daw-header-hover); }
.daw-hdr.is-meta { background: var(--daw-ruler); color: var(--daw-muted); font-size: 11px; align-items: center; padding: 0 10px; gap: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.daw-hdr-stripe { width: 6px; flex: none; }
.daw-hdr-body { flex: 1; min-width: 0; padding: 7px 8px 6px 9px; display: flex; flex-direction: column; gap: 7px; }
.daw-hdr-top, .daw-hdr-row { display: flex; align-items: center; gap: 6px; }
.daw-hdr-icon { width: 16px; height: 16px; flex: none; color: var(--daw-muted); }
.daw-hdr-name { flex: 1; min-width: 0; font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daw-hdr-sub:empty { display: none; }
.daw-hdr-sub { font-size: 10.5px; color: var(--daw-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daw-hdr select { font-size: 11px; max-width: 100%; }
.daw-hdr .daw-notation { position: static; margin: 0; min-height: 0; height: 20px; padding: 0 4px; border-radius: 4px; }
.daw-ms {
  width: 20px; height: 20px; padding: 0; border-radius: 4px; border: 1px solid #C2C4CF; background: #fff;
  color: #3A3D4A; font-size: 10.5px; font-weight: 700; line-height: 18px; cursor: pointer; flex: none;
}
.daw-ms.is-mute[aria-pressed="true"] { background: var(--daw-mute); border-color: var(--daw-mute); color: #fff; }
.daw-ms.is-solo[aria-pressed="true"] { background: var(--daw-solo); border-color: #D9AE2B; color: #14151A; }
.daw-vol { flex: 1; min-width: 0; height: 14px; accent-color: var(--daw-muted); }
.daw-vol-label { font-size: 10px; color: var(--daw-muted); width: 2.4em; text-align: right; font-variant-numeric: tabular-nums; }

/* Mixer click lane: a mark per beat, taller on the downbeat. */
.daw-lane.is-click { background: #EDEDF3; }
.daw-section-grip { position: absolute; left: 0; top: 0; bottom: 0; width: 10px; cursor: ew-resize; background: linear-gradient(90deg, rgba(0,0,0,.35) 0 3px, transparent 3px); }
.daw-section-grip:hover { background: linear-gradient(90deg, rgba(0,0,0,.6) 0 4px, transparent 4px); }
.daw-lane .daw-clip { cursor: grab; }
.daw-lane.is-sliding, .daw-lane.is-sliding .daw-clip { cursor: grabbing; }
.daw-section.is-dragging { cursor: grabbing; outline: 2px solid #14151A; }
.daw-click-beat { position: absolute; top: 38%; height: 24%; width: 2px; margin-left: -1px; border-radius: 1px; background: #A0A0B4; }
.daw-click-beat.is-down { top: 22%; height: 56%; width: 3px; background: #5E5E78; }
.daw-lane { position: relative; box-sizing: border-box; border-bottom: 1px solid rgba(0, 0, 0, 0.35); }
.daw-lane.is-meta { background: var(--daw-lane-light); border-bottom-color: var(--daw-stroke); }
.daw-lane.is-ruler { background: var(--daw-ruler); border-bottom-color: var(--daw-ruler-stroke); cursor: pointer; }
.daw-lane.is-dimmed > .daw-clip, .daw-lane.is-dimmed > .daw-notation { opacity: 0.4; }

.daw-tick { position: absolute; bottom: 0; width: 1px; background: var(--daw-text); opacity: 0.55; pointer-events: none; }
.daw-tick.is-bar { height: 15px; opacity: 0.8; }
.daw-tick.is-beat { height: 6px; opacity: 0.35; }
.daw-tick-label { position: absolute; top: 5px; font-size: 11px; font-variant-numeric: tabular-nums; transform: translateX(3px); pointer-events: none; white-space: nowrap; }
.daw-tick-label.is-time { top: auto; bottom: 17px; font-size: 9.5px; color: var(--daw-muted); }
.daw-loop-region { position: absolute; top: 0; height: 9px; background: #D0D0D7; pointer-events: none; }
.daw.is-looping .daw-loop-region { background: #A0A9DC; }

.daw-section {
  position: absolute; top: 3px; bottom: 3px; box-sizing: border-box; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.28);
  color: #14151A; font-size: 11.5px; font-weight: 600; line-height: 20px; padding: 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.daw-section .daw-section-bars { font-weight: 400; opacity: 0.65; margin-left: 4px; }
.daw-section.is-selected { box-shadow: inset 0 0 0 2px #14151A; }
.daw-chord {
  position: absolute; top: 3px; bottom: 3px; box-sizing: border-box; border-left: 2px solid #6E6BD8;
  padding-left: 5px; font-family: var(--font-chart); font-style: italic; font-size: 15px; line-height: 21px;
  white-space: nowrap; overflow: hidden; background: rgba(160, 158, 239, 0.14); color: var(--daw-text);
}
.daw-chord:nth-child(even) { background: rgba(160, 158, 239, 0.26); }

.daw-grid { position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 1; }
.daw-gl { position: absolute; top: 0; bottom: 0; width: 1px; }
.daw-gl.is-bar { background: rgba(255, 255, 255, 0.10); }
.daw-gl.is-beat { background: rgba(255, 255, 255, 0.05); }
.daw-gl.is-section { background: rgba(255, 255, 255, 0.30); }

.daw-clip { position: absolute; top: 3px; bottom: 3px; box-sizing: border-box; border-radius: 4px; border: 1px solid #000; overflow: hidden; z-index: 2; }
.daw-clip-hdr { height: 20px; line-height: 20px; font-size: 11px; font-weight: 600; color: #14151A; white-space: nowrap; overflow: hidden; }
.daw-clip-hdr span { position: sticky; left: 0; padding: 0 6px; }
.daw-clip-body { position: absolute; top: 20px; left: 0; right: 0; bottom: 0; }
.daw-wave { position: absolute; top: 23px; height: calc(100% - 26px); pointer-events: none; z-index: 3; }
.daw-notation { position: absolute; left: 0; overflow: hidden; pointer-events: none; z-index: 3; }
.daw-notation .at-surface, .daw-notation svg { pointer-events: none; }
.daw-lane-empty { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: rgba(255, 255, 255, 0.55); font-size: 12px; z-index: 3; }

.daw-playhead {
  position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; box-sizing: border-box; z-index: 20;
  background: #fff; border-left: 1px solid #000; border-right: 1px solid #000; pointer-events: none;
}
.daw-playhead-head { position: absolute; top: 0; width: 13px; height: 16px; margin-left: -6px; z-index: 21; pointer-events: none; }

.daw-anchor { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #FF9E65; z-index: 15; cursor: ew-resize; }
.daw-anchor::before { content: ''; position: absolute; top: 0; bottom: 0; left: -6px; width: 14px; }
.daw-anchor.is-estimated { background: repeating-linear-gradient(#FF9E65 0 5px, transparent 5px 9px); }
.daw-anchor-flag {
  position: absolute; top: 2px; left: 0; padding: 1px 6px; border-radius: 0 3px 3px 0; background: #FF9E65; color: #14151A;
  font-size: 10.5px; font-weight: 700; white-space: nowrap; cursor: ew-resize; user-select: none;
}
.daw-anchor.is-estimated .daw-anchor-flag { background: #FFD0A8; }
.daw-anchor.is-dragging .daw-anchor-flag { background: #fff; outline: 2px solid #FF9E65; }

/* Layout is automatic, not a manual toggle: the viewport decides.
   - Below 761px: single stacked column (chords above lyrics) — the only
     thing that reads cleanly on a phone.
   - 761px and up: each section shows chords-left/lyrics-right internally.
   - 1150px and up: there's room for two full newspaper-style page columns
     (like the printed songbook), so #sheet itself splits via CSS multicol.
   Jazz mode overrides all of this to force single column (see its own
   block below) — multicol needs a block container, not flex/grid, which
   is why .sheet stays display:block throughout. */
@media (min-width: 761px) {
  .sheet-section { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0.3rem 2.2rem; }
  /* .grid.spans-full (true to its name) already occupies the section's
     FULL width, not just the "left" 1.1fr track the two-column template
     above still declares — so .lyrics sitting in its own implicit single
     track (whichever one is left after h3/grid/multi-rest-row claim both)
     rendered at roughly HALF the chart's own width, wrapping lines that
     had plenty of room on the shared width above them. .lyrics shares the
     same "staff width" every bar-row already spans (see viewerLine's own
     doc comment) — it belongs in this full-span list too, not its own
     narrower column. */
  .sheet-section h3, .sheet-section .grid.spans-full, .sheet-section .multi-rest-row, .sheet-section .lyrics, .sheet-section .gp-score { grid-column: 1 / -1; }
}
@media (min-width: 1150px) {
  #sheet { column-count: 2; column-gap: 2.4rem; }
  #sheet .sheet-section { break-inside: avoid; }
  /* The newspaper-style 2-column split earns its keep for a chord+lyrics
     chart: several short sections (chords left, lyrics right) stack
     neatly into two half-width pages. A chart with no lyrics at all
     (a GP import, with no section markers either — see internal/tab's
     GP-import path) is just one continuous run of tab/chord rows with
     nothing proportioned for a half-width column, so it gets squeezed
     into one narrow column with the other left empty. Use the full
     chart width instead whenever the sheet has no lyrics anywhere. */
  #sheet:not(:has(.lyrics)) { column-count: 1; }
}

.sheet-section { padding: 0.9rem 0; scroll-margin-top: 6rem; }
.sheet-section h3 { margin: 0 0 0.6rem; display: flex; align-items: center; gap: 0.5rem; }
.section-jump {
  background: var(--bg-sunken); border: none; padding: 0.2rem 0.7rem; font: inherit;
  font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em;
  text-align: left; border-radius: 5px; color: var(--fg-muted);
}
.section-jump:not(:disabled):hover { color: var(--accent); }
.sheet-section.current-section > h3 .section-jump { color: var(--accent-contrast); background: var(--accent); }

/* Rehearsal-mark badge — iReal Pro's own convention (a single letter, A/B/
   C..., assigned per distinct section label in order of first appearance;
   see assignRehearsalMarks in handlers_pages.go): a small square badge
   placed in FRONT of this app's own, richer section name, not a
   replacement for it — iReal's compact "go back to B" shorthand plus the
   descriptive label, rather than picking one over the other. */
.rehearsal-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15em; height: 1.15em; margin-right: 0.4em; flex: 0 0 auto;
  background: var(--danger); color: var(--accent-contrast); border-radius: 2px;
  font-family: var(--font-ui, sans-serif); font-style: normal; font-weight: 800;
  font-variant: normal; letter-spacing: 0; font-size: 0.72em; line-height: 1;
}
.sheet-section.current-section > h3 .rehearsal-mark { background: var(--accent); }

/* Chart style: Engraved Serif — section labels on the chart itself (not
   the sidebar timeline, which keeps its own plain nav look) read as a
   typeset small-caps heading instead of a UI pill, matching a printed
   fakebook page. */
.sheet-section h3 .section-jump {
  background: none; border-radius: 0; padding: 0.1rem 0;
  font-family: var(--font-chart); font-style: italic; font-weight: 600;
  font-variant: small-caps; letter-spacing: 0.05em; text-transform: none;
  font-size: 0.95rem; border-bottom: 1px solid var(--border);
}
.sheet-section.current-section > h3 .section-jump {
  color: var(--accent); background: none; border-bottom-color: var(--accent);
}

.sheet-section .grid { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.6rem; font-family: var(--font-chart); }
.sheet-section .lyrics { font-size: 1.05rem; color: var(--fg); }

/* A duplicate-grid section (GridDuplicateOf, handlers_pages.go): the exact
   same chord grid an earlier section already printed, so it's shown once
   via a repeat mark instead of a second identical copy — see that field's
   own doc comment. Styled like the repeat-suffix text next to a reference
   section's heading (muted, small-caps-adjacent), not like a real chord
   row, so it reads as "nothing new here" at a glance. */
.grid-duplicate-note {
  font-family: var(--font-chart); font-style: italic; font-size: 0.85rem;
  color: var(--fg-muted); margin-bottom: 0.6rem;
}
.grid-duplicate-note .repeat-barline { font-style: normal; font-size: 1.1em; }

/* A "staff line" is one chart system/row, engraved-notation style: a single
   thin rhythm-staff line runs under each bar, crossed by a slash mark per
   beat (LilyPond/Real Book rhythmic-slash convention) — a chord symbol sits
   above only the beat where it actually starts; later beats of the same
   chord are blank slashes (ties), never a repeated or dashed label. No
   boxes, no fill — that reads as a spreadsheet, not a chart. */
/* 3.3em clears the tallest thing that can float above a bar: a volta
   bracket sits 2.3em above the bar's top plus its own 0.5em height —
   independent of the time signature now, since the time-sig cell is a
   plain sibling of the bars, not nested inside the first one anymore.
   em, not rem: the whole staff's geometry (this, the staff lines, bar
   height, time-sig cell...) scales off #sheet's own font-size, which is
   the one thing applyPageBox()'s jazz-mode fit loop actually adjusts —
   rem would hold the staff at a fixed real-world height no matter how far
   the font shrank, so a long song could never fit however small the text
   got (the loop could shrink chord labels but never the staff rows
   themselves, which is why jazz mode kept falling back to scrolling even
   with plenty of width available). */
.staff-line { display: flex; align-items: flex-end; padding-top: 3.3em; position: relative; }
/* A tab-only row rendered by the vendored alphaTab JS library (see
   alphatab-tab.js) is a single block container alphaTab draws its own
   SVG into directly — opt out of .staff-line's flex/align-items (meant
   for laying out several .bar children side by side), which would
   otherwise apply to alphaTab's injected SVG root as a flex item. */
/* transform: translateZ(0) promotes this row to its own GPU compositing
   layer — the standard, well-documented mitigation for a real WebKit/
   Safari bug class where tall, complex SVG content scrolled off-screen
   and back fails to repaint (confirmed this session, iPad-only,
   reload-only fix, not reproducible on a desktop browser, and NOT a DOM
   content loss — resize/rotation/zoom, which would recover real DOM
   loss via alphatab-tab.js's own resize-vanish guard, do nothing here).
   Keeping the content in its own layer is reported to prevent WebKit
   from ever dropping the paint in the first place, rather than needing
   to recover after the fact. */
.staff-line.alphatab-row { display: block; padding-top: 0; width: 100%; transform: translateZ(0); }
.staff-line.alphatab-row svg { max-width: 100%; height: auto; }
.alphatab-render-failed { color: var(--fg-muted); font-size: 0.85rem; font-style: italic; padding: 0.5rem 0; }
/* Real tab notation is a "normal" mode thing only — jazz/map/lyrics
   never showed it (jazz is deliberately staff-less, see above; map and
   lyrics have their own simpler conventions) — but a FULLY tab-only
   line had NOTHING ELSE at all outside normal mode until this pair of
   rules: the per-bar chord-label fallback (.tab-only-chords-fallback,
   play.html) that every OTHER tab-covered bar already gets via
   chart-bar's own .tab-only-chords never ran for a line that skipped
   straight to the single alphaTab mount. Confirmed live: a GP-imported
   song (one giant tab-only section, no lyrics/sections of its own) had
   a completely empty Jazz chart and Song Map — not a rendering bug,
   nothing was ever emitted for those modes to show. Scoped to
   .sheet-section (where this melodic overlay actually lives), NOT a
   bare ".alphatab-row" — Drummer view's own rows (.drum-map, a sibling
   of .sheet-section, never inside one) carry that same class for an
   unrelated reason and must stay visible in "drummer" mode specifically,
   which this rule's un-scoped first version blocked outright (confirmed
   live at merge time: a bare selector here hid every Drummer row too,
   leaving only its section labels on screen). */
#sheet:not([data-render-mode="normal"]) .sheet-section .alphatab-row { display: none; }
#sheet[data-render-mode="normal"] .tab-only-chords-fallback { display: none; }
/* Same base layout .staff-line itself declares (flex row, bars aligned
   to the baseline, room above for a chord label) — deliberately
   repeated under its own class rather than also given the "staff-line"
   class, which song.js's reflow logic scans for independently of this
   row's own mode-gated visibility (see the comment above and in
   play.html). */
/* width: 100% unconditionally, not just for map mode: a wrapping flex
   container with no explicit width shrink-to-fits to the narrowest
   width that still satisfies its children, which for a flex-wrap row
   collapses toward one bar per line — confirmed live in jazz mode as a
   columnar pile-up (each "row" one bar tall, wrapping into new columns
   instead of flowing left-to-right across the real row width) once the
   bars themselves stopped being 100%/--cap-wide and switched to
   content-sized (see the jazz .bar override below). */
.tab-only-chords-fallback { display: flex; align-items: flex-end; padding-top: 3.3em; position: relative; width: 100%; }
/* Real chord rows (reflowStaffLines' output) get one .staff-line PER
   visual row, each carrying its own 3.3em padding-top — originally
   sized for a floating .chord-label, but in jazz mode (.chord-label is
   position:static there) it's mostly unused slack that happens to
   double as row spacing. This fallback is ONE flex-wrap container for
   all its bars, not one element per row, so that padding-top only ever
   applies once, above the first row — every wrapped row after it had
   zero spacing, so taller glyphs (jazz's bold root + superscript
   extension) visibly bled into the row below. row-gap gives every
   wrapped row the same breathing room a real .staff-line gets. */
#sheet[data-render-mode="jazz"] .tab-only-chords-fallback { flex-wrap: wrap; row-gap: 1.2em; }
/* ---- One staff-drawing engine, reused everywhere a chart actually wants
   a 5-line staff (normal/chords+lyrics mode and Song Map; jazz is
   deliberately staff-less by its own real-iReal-Pro-fidelity convention,
   confirmed earlier, see --staff-5lines' non-use there).
   History: this used to be THREE separate implementations — a row-level
   single hairline (.staff-line::before), a row-level 5-line variant
   layered on top of it for normal/map, and a fully duplicated 5-line
   rule on .multi-rest-row for compact/recall sections, which don't sit
   inside a .bar at all. The row-level versions anchor to the ROW
   container, position:absolute, bottom:0 — fine as long as a row's bars
   never CSS-wrap. Chords+lyrics never does (reflowStaffLines, song.js,
   computes each row's exact bar count so it always fits); Song Map DOES
   (no per-device JS pass — it falls back to flex-wrap on narrow
   screens), and a wrapped row only has ONE bottom edge for that one
   absolutely-positioned background to anchor to — every wrapped sub-line
   above the last one rendered with NO staff under it at all (the
   "Chorus 1 has no staff lines" bug, reported directly against a live
   screenshot).
   Fix: draw the staff PER CELL instead — every .bar's .bar-body and the
   leading .staff-timesig-cell each paint their own identical slice (same
   height, same five y-offsets), so adjacent cells' lines land on the
   same y-position and read as one continuous staff regardless of where a
   row happens to wrap, with no dependency on a single row's own box ever
   staying unwrapped. --staff-5lines holds the one gradient-image list
   every staff-drawing rule below references via var() — change the
   look of a staff in exactly one place, not three.
   On .bar-body, not .bar itself: .bar's own ::before is already spoken
   for by the repeat-barline accent strip (.bar-open::before/.bar-close
   ::after, further down) — a SECOND rule targeting the same pseudo-
   element on the same node doesn't layer, it fights it property by
   property (confirmed live: a repeat-open bar's solid accent-strip
   background-color painted over this rule's gradient, and its own width
   won out over this rule's left/right, collapsing the staff to a
   sliver). .bar-body is a real, uncontested child element, with no
   competing ::before/::after rule anywhere else — left/right bleed by
   .bar's own 0.5em horizontal padding so adjacent cells' slices still
   touch seamlessly at the bar boundary, same as drawing directly on
   .bar would have. */
:root { --staff-5lines:
    linear-gradient(var(--fg-muted), var(--fg-muted)),
    linear-gradient(var(--fg-muted), var(--fg-muted)),
    linear-gradient(var(--fg-muted), var(--fg-muted)),
    linear-gradient(var(--fg-muted), var(--fg-muted)),
    linear-gradient(var(--fg-muted), var(--fg-muted));
}
#sheet[data-render-mode="normal"] .bar-body:not(.bar-body-tab-only)::before,
#sheet[data-render-mode="normal"] .staff-timesig-cell::before,
#sheet[data-render-mode="map"] .bar-body::before,
#sheet[data-render-mode="map"] .staff-timesig-cell::before {
  content: ""; position: absolute; left: -0.5em; right: -0.5em; bottom: 0; height: 1.7em; z-index: 0;
  background-image: var(--staff-5lines);
  background-size: 100% 1px;
  background-position: 0 0%, 0 25%, 0 50%, 0 75%, 0 100%;
  background-repeat: no-repeat;
  opacity: 0.5;
}
/* A tab-only row's own leading time-sig cell shouldn't paint a staff
   slice either — "either tabs or staff, not both" applies to the WHOLE
   row, not just the per-bar content. */
#sheet .staff-line:has(.bar-body-tab-only) .staff-timesig-cell::before { background-image: none; }
/* A repeat barline's own bar (.bar-open/.bar-close) carries extra padding
   (0.7em, not the base .bar's 0.5em — see ".bar-open"/".bar-close" below)
   to make room for its dots + thick accent strip. The staff-line bleed
   above is a flat 0.5em, matching the common case only — on an open/close
   bar that left a bare 0.2em strip with no staff lines under the repeat
   sign itself, reading as the barline sitting AFTER the staff rather than
   being drawn on it (real engraving: the barline is part of the staff).
   Bleed further on exactly the side that owns the extra padding. */
#sheet[data-render-mode="normal"] .bar-open .bar-body::before,
#sheet[data-render-mode="map"] .bar-open .bar-body::before { left: -0.7em; }
#sheet[data-render-mode="normal"] .bar-close .bar-body::before,
#sheet[data-render-mode="map"] .bar-close .bar-body::before { right: -0.7em; }
/* GP-synced playback only (audio-player.js's wireBarClickToPlay) — a
   bar is clickable to seek exactly when its real audio timestamp is
   known, which the other two reference-audio categories never have. */
#sheet.bar-click-to-play .bar { cursor: pointer; }
#sheet.bar-click-to-play .bar:hover { background: var(--bg-sunken); }

.bar {
  display: flex; align-items: flex-end;
  /* Fixed per-bar width, from the ROW's intended capacity (--cap, set
     server-side from BarsPerLine) — not the count of bars actually present
     in this row. Without this, a short trailing row (e.g. 2 bars when
     every other row holds 4) stretched its few bars to fill the row's
     full width, each bar ending up visibly wider than every other bar in
     the chart and reading as if it were a different, longer measure.
     min-width is a real floor, not 0: .chord-label is position:absolute,
     so it never contributes to flex sizing or to the overflow check
     applyPageBox() uses (scrollWidth) — without a floor, a narrow jazz
     column could squeeze a bar to a few px while its absolutely-positioned
     chord text still rendered at full size, bleeding into neighboring
     bars with no overflow ever being detected. */
  /* The floor itself: max(a flat readable minimum, enough for every one
     of this bar's OWN beat-slots at THEIR min-width — see .beat-slot
     below, 0.9em each). --slots (template-side, per bar) is the real
     rhythmic-slot count; a plain quarter-note 4/4 bar is 4, a 6/8 is 2 —
     the flat 2.6em alone covers a typical ~3-slot bar but let a busier
     one (more mid-bar chord changes, e.g. "Gm . . Cm") get squeezed
     below what its own slots need once reflowStaffLines() (song.js)
     narrows a row down TO this floor on a phone — not overflowing (the
     floor still held) but colliding: slash/chord-label content from
     neighboring slots crowded into less room than it needs. */
  flex: 0 0 calc(100% / var(--cap, 4)); min-width: max(2.6em, calc(var(--slots, 3) * 0.9em));
  padding: 0 0.5em; position: relative; font-family: var(--font-chart);
  z-index: 1;
}
/* The very first row of the whole song also carries .staff-timesig-cell
   (the clef/time-sig, --cap-independent fixed width: 2.1em + 0.4em
   margin = 2.5em) as an extra flex sibling ahead of the bars — but each
   bar's own basis above is computed as a share of the row's FULL width
   (100%), with nothing held back for that cell. The two together always
   summed to MORE than 100%, so the row overflowed by a constant ~2.5em
   on every viewport, desktop included — just small enough there to go
   unnoticed (or show as a sliver of horizontal scroll), but enough on a
   phone-width column to push the last bar of that row off-screen (the
   reported "D bar clipped" bug: the song's Intro/first row). Subtracting
   the cell's own footprint from the 100% pool before dividing by --cap
   on exactly the row that carries it fixes the sum at the root, instead
   of papering over it with a narrower min-width or smaller font. */
.staff-line:has(.staff-timesig-cell) .bar {
  flex-basis: calc((100% - 2.5em) / var(--cap, 4));
}
/* Ragged-right chart rows, normal/map/lyrics modes only — a deliberate,
   explicit choice (confirmed live against the lyric column, which is
   itself ragged-right prose), tuned in two passes:
   Pass 1 stretched bars to 100%/--cap (the base rule above) — a short
   trailing row stretched its few bars edge-to-edge, as wide as a full
   row, reading as a different, longer measure than its neighbors.
   Pass 2 (flex: 0 0 auto, shrink-to-content) over-corrected: a bar's own
   content is just a root+quality label and a couple of slash marks, far
   narrower than a typical lyric line, so a 4-bar row rendered visibly
   SHORTER than the lyric text beside it — confirmed live, it read as
   broken/incomplete, not merely "ragged."
   This is pass 3: --bar-w is a flat, typeset-style width (7.2em ≈ 115px
   at a 16px base — close to, but under, a typical lyric line's own
   length, the same number reflowStaffLines' minBarPx now uses as its
   floor, see song.js), used as the bar's flex-basis — not the row's
   100% share (pass 1), not the bar's own glyph width (pass 2). A row
   still only takes up as much TOTAL width as its bars need (width:
   fit-content on .staff-line), so a short row still ends short, same
   ragged-right intent as pass 2 — it just no longer collapses each bar
   down to near-nothing to do it. min-width still floors a busy bar (more
   --slots) up past --bar-w when its own content genuinely needs more
   room, same floor the base rule and reflowStaffLines() both use.
   Row-BREAKING (how many bars land on one line) is untouched — that
   decision is still groupMeasures/reflowStaffLines' own capacity math,
   now keyed to this same --bar-w instead of the old flat 2.6em. Jazz
   mode keeps the base rule's justified-to-100% behavior unchanged —
   that's iReal Pro's own convention, not this one, and already shipped/
   approved separately. #sheet (ID) in the selector outranks both the
   base .bar rule and the .staff-timesig-cell one above without needing
   !important. */
/* Lyrics-only is the one remaining mode with this ragged-right, flat-
   typeset-width treatment — map now shares normal mode's justified engine
   instead (below), so it's excluded here too. Drummer excluded as well:
   its OWN ".drum-grid .staff-line { width: 100% }" rule (further down)
   needs to win over this one for its alphaTab rows specifically — an
   alphaTab row that measures 0 width (this rule's own fit-content,
   before alphaTab has painted anything into it) never renders at all
   ("AlphaTab skipped rendering because of width=0", confirmed live) and
   never recovers on its own once it does have content. The plain .grid
   rows this mode also carries (hidden here, chord/lyric content) don't
   care either way. */
#sheet:not([data-render-mode="jazz"]):not([data-render-mode="normal"]):not([data-render-mode="map"]):not([data-render-mode="drummer"]) .staff-line {
  width: fit-content; max-width: 100%; align-self: flex-start;
}
#sheet:not([data-render-mode="jazz"]):not([data-render-mode="normal"]):not([data-render-mode="map"]) .bar,
#sheet:not([data-render-mode="jazz"]):not([data-render-mode="normal"]):not([data-render-mode="map"]) .staff-line:has(.staff-timesig-cell) .bar {
  flex: 0 0 var(--bar-w, 7.2em);
}
/* A repeat-only bar (just a simile mark, no chord label) has nothing to
   typeset at chord-label width — giving it the same 7.2em as a real chord
   bar is what makes a row mixing the two read as sparse/gappy ("badly
   broken") even though the row-grouping itself is correct. Narrower here;
   reflowStaffLines()'s capacity math still budgets every bar at the wider
   7.2em floor (unchanged), so a row can end up with a little unused width
   rather than ever overflow — the safe direction for a CSS-only fix.
   Lyrics-only only now: excluding map here too, not just jazz/normal —
   map's bars are justified (--cap-based, below) like normal mode's, and
   this rule's two :not() clauses give it HIGHER specificity than that
   justified rule despite being defined first, so without the exclusion
   it silently overrode map's bar-pct cells back down to a flat 3.2em,
   which is exactly what made some rows end short of the row's own full
   width (a repeat-mark cell not stretching to its justified share). */
#sheet:not([data-render-mode="jazz"]):not([data-render-mode="normal"]):not([data-render-mode="map"]) .bar.bar-pct {
  flex: 0 0 3.2em;
}
/* Chords+lyrics (and now Song Map too — same engine, not a second one):
   justified, like a real engraved score — every staff-line row in the
   chart stretches to the SAME full column width, same technique jazz
   mode already uses (the base .bar rule below, percentage-of-cap, is
   exactly that — jazz just never got excluded from it). A sparser row
   (fewer bars, or a short trailing row) gets WIDER bars that fill the
   row, not fixed-width bars leaving ragged trailing blank space —
   exactly why Song Map's rows used to come out visibly different
   lengths from each other (flat per-bar width, no justification) next
   to Chords+lyrics' own uniform-width rows. This supersedes the old
   fixed-7.2em/fit-content treatment above (kept for lyrics-only,
   untouched) at the user's explicit request, comparing favorably against
   the multi-rest block (which already fills its own row) and real
   printed charts, where every system justifies to the same page width. */
#sheet[data-render-mode="normal"] .staff-line,
#sheet[data-render-mode="map"] .staff-line { width: 100%; }
#sheet[data-render-mode="normal"] .bar,
#sheet[data-render-mode="map"] .bar {
  flex: 0 0 calc(100% / var(--cap, 4));
}
/* The very first row also needs the clef-cell-width subtraction (see
   .staff-line:has(.staff-timesig-cell) .bar's own comment above, "D bar
   clipped") — but that rule has no #sheet ID in its selector, so the
   plain justified rule just above it (which DOES have one) silently
   outranked it for flex-basis specifically, on ID alone, regardless of
   source order. Confirmed live: a clef row's bars still computed at the
   plain 25% share, 2.5em too wide in total, overflowing its row by
   exactly that amount — reported directly as "the first line is longer
   than all the other ones." Re-declared here at the SAME #sheet-scoped
   specificity as the plain rule, so normal cascade order (this comes
   after) decides it correctly instead of ID count short-circuiting the
   comparison. */
#sheet[data-render-mode="normal"] .staff-line:has(.staff-timesig-cell) .bar,
#sheet[data-render-mode="map"] .staff-line:has(.staff-timesig-cell) .bar {
  flex-basis: calc((100% - 2.5em) / var(--cap, 4));
}
/* Measure (bar) divider — LilyPond/Guitar Pro both draw this as a crisp,
   clearly visible thin line (not a faint UI hairline like --border, which
   at ~90% contrast with the page background read as "almost invisible"
   per direct user feedback). Same color family as the staff lines
   (--fg-muted) but full opacity, since a barline is structural content,
   not decoration. */
.bar + .bar { border-left: 1px solid var(--fg-muted); }
/* System boundary barlines — LilyPond/Guitar Pro/real printed lead
   sheets all bound every SYSTEM (row), not just every bar WITHIN a row:
   a barline right after the clef (or at the row's own left edge when
   there's no clef on that row) opens it, and one closes it at the last
   bar, the same as the divider between any two ordinary bars — a
   measure boundary doesn't stop being one just because it happens to
   fall at a line break. Previously only the .bar+.bar divider existed,
   so a row's first and last bar had an open edge, reported directly:
   "end of line should have a bar separator, and probably start of line
   too." Skipped on a bar that's already .bar-open/.bar-close — those
   already draw their own, more prominent thick-barline+dots repeat
   bracket in the same place, and a second line there would double up.
   Scoped to normal/map (the two shared-engine "paper" modes); jazz
   already has its own equivalent (:first-of-type/:last-of-type, see its
   own section below) checked against real iReal Pro exports. */
#sheet[data-render-mode="normal"] .staff-line > .bar:first-child:not(.bar-open),
#sheet[data-render-mode="normal"] .staff-line > .staff-timesig-cell + .bar:not(.bar-open),
#sheet[data-render-mode="map"] .staff-line > .bar:first-child:not(.bar-open),
#sheet[data-render-mode="map"] .staff-line > .staff-timesig-cell + .bar:not(.bar-open) {
  border-left: 1px solid var(--fg-muted);
}
#sheet[data-render-mode="normal"] .staff-line > .bar:last-child:not(.bar-close),
#sheet[data-render-mode="map"] .staff-line > .bar:last-child:not(.bar-close) {
  border-right: 1px solid var(--fg-muted);
}
/* Repeat barline — LilyPond/Guitar Pro convention: a THIN line next to the
   music and a THICK line outside it (away from the repeated material),
   never two equal-weight lines (that's a plain section-divider double
   bar, a different symbol). The thin line is the real CSS border, sitting
   exactly at the bar's own edge, closest to the notes; the thick line is
   a separate absolutely-positioned strip just outside it. Repeat dots
   (below) sit further in still, between the thin line and the music. */
/* Thin:thick ratio per LilyPond's own default (scm/define-grobs.scm,
   BarLine: hair-thickness 1.9, thick-thickness 6.0 — a real ~3.2:1 ratio,
   not the ~2:1 this was before, which read as barely different weights. */
.bar-open {
  border-left: 1.5px solid var(--border-strong) !important; padding-left: 0.7em;
}
.bar-open::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -0.35em; width: 0.3em;
  background: var(--border-strong);
}
.bar-close {
  border-right: 1.5px solid var(--border-strong) !important; padding-right: 0.7em;
}
.bar-close::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: -0.35em; width: 0.3em;
  background: var(--border-strong);
}
.bar.current .chord-label { color: var(--current-fg); }
.bar.current .simile-mark, .bar.current .simile-count { color: var(--current-fg); }
.bar.current { background: color-mix(in srgb, #f2c400 22%, transparent); border-radius: 3px; }
/* The beat line sweeping the playing bar (song.js sets --playhead, 0..1).
   Drawn as a background so it can't collide with the barline glyphs'
   own ::before/::after. */
.bar.playhead {
  --ph: calc(var(--playhead, 0) * 100%);
  background-image: linear-gradient(to right, transparent calc(var(--ph) - 1px), var(--accent) calc(var(--ph) - 1px), var(--accent) calc(var(--ph) + 1px), transparent calc(var(--ph) + 1px));
}
/* The player's cycle range on the chart (audio-player.js): yellow like
   Logic's cycle area, stronger while a drag is selecting bars. */
.bar.range-cycle { box-shadow: inset 0 -3px 0 #e9b500, inset 0 0 0 1px color-mix(in srgb, #e9b500 45%, transparent); }
.bar.range-select { background-color: color-mix(in srgb, #e9b500 30%, transparent); }
.tab-range { position: absolute; pointer-events: none; z-index: 0; border-radius: 2px; }
.tab-range.cycle { background: color-mix(in srgb, #e9b500 12%, transparent); border-bottom: 3px solid #e9b500; }
.tab-range.select { background: color-mix(in srgb, #e9b500 30%, transparent); }
/* Tab rows' playback cursor (alphatab-tab.js tabCursor), Guitar Pro style:
   the playing bar tinted like .bar.current, a line sweeping its beats. */
.alphatab-row[data-first-bar] { position: relative; }
.tab-cursor-bar, .tab-cursor-beat { position: absolute; pointer-events: none; z-index: 1; }
.tab-cursor-bar { background: color-mix(in srgb, #f2c400 22%, transparent); border-radius: 3px; }
.tab-cursor-beat { width: 2px; margin-left: -1px; background: var(--accent); opacity: 0.85; border-radius: 1px; }
.tab-cursor-bar[hidden], .tab-cursor-beat[hidden] { display: none; }

/* A real 5-line staff, not a single rule — drawn per bar-body as five 1px
   lines at 0/25/50/75/100% of a fixed height. Every bar-body shares the
   same height, so the lines land at identical y-positions bar to bar and
   read as one continuous staff across the row, the same way a Real Book
   rhythm-slash chart actually looks (slashes centered on the middle
   line), without needing to measure/position a single staff spanning the
   whole row separately from the bars sitting on it. */
.bar-body {
  display: flex; flex: 1; min-width: 0; position: relative; height: 1.7em;
}
.beat-slot { flex: 1 1 0; min-width: 0.9em; text-align: center; position: relative; display: flex; align-items: center; justify-content: center; height: 100%; }
.chord-label { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 0.35em; white-space: nowrap; font-style: italic; }

/* A bar's "score:" riff (internal/tab) — note-level tab notation
   overlaid above that same bar's normal chord/slash row. Child of .bar
   (already position:relative — see .bar's own comment), same anchoring
   technique as .chord-label/.map-sec-badge, just spanning the bar's
   full width instead of one beat-slot. Height is string count * a fixed
   line spacing, so a 4-string bass riff takes less vertical room than a
   6-string guitar one. */
.tab-block {
  position: absolute; bottom: 100%; left: 0; right: 0;
  height: calc(var(--strings) * 1.1em); margin-bottom: 0.3em;
  font-family: var(--font-chart);
}
.tab-line {
  position: absolute; left: 0; right: 0; top: calc(var(--string) * 1.1em);
  border-top: 1px solid var(--fg-muted);
}
.tab-beats { position: absolute; inset: 0; display: flex; }
.tab-beat { flex: 1 1 0; min-width: 0; position: relative; }
.tab-fret {
  position: absolute; left: 50%; top: calc((var(--string) - 1) * 1.1em);
  transform: translate(-50%, -50%);
  background: var(--bg); padding: 0 0.15em; font-size: 0.75em; line-height: 1;
  font-weight: normal; /* real LilyPond/engraved tab numbers are plain upright digits, not bold */
}

/* Tab-only rows: when a WHOLE display row's bars all have "score:" note
   data (viewerLine.TabOnly), the tab staff REPLACES that row's normal
   5-line staff/slashes instead of overlaying above it — real tab
   notation, not an annotation on a staff, matching how a printed tab
   chart actually looks. Chord names stay anchored in the same spot
   (.chord-label, floating via the row's own .tab-only-slot row) a
   normal bar's chord names already use. */
.bar-body-tab-only {
  height: calc(var(--strings) * 1.1em + 0.9em) !important;
}
/* The chord-label-only fallback (.tab-only-chords-fallback — jazz/map/
   lyrics modes, no .tab-block at all) reuses .bar-body-tab-only just to
   drop the normal 5-line staff background, but never sets --strings —
   that's only ever written per-bar for a REAL tab riff. var(--strings)
   with nothing set is the guaranteed-invalid value, making the whole
   calc() above invalid at compute time; since height isn't inherited,
   that resets it to 'auto', not a graceful fallback to the plain
   .bar-body rule's 1.7em — and 'auto' on a flex item whose only content
   is position:absolute (.tab-only-chords, contributing nothing to
   intrinsic height) measured as literally 0px live. Give the no-riff
   case back a real height explicitly. */
.bar-body-tab-only:not(:has(.tab-block)) {
  height: 1.7em !important;
}
.tab-only-chords { position: absolute; inset: 0; display: flex; z-index: 1; }
.tab-only-slot { flex: 1 1 0; min-width: 0; position: relative; }
.tab-block.tab-replaces-staff {
  position: relative; bottom: auto; left: auto; right: auto;
  flex: 1 1 auto; width: 100%; height: 100%; margin-bottom: 0;
}
/* Proportional-to-duration spacing (real engraving: a half note gets
   twice a quarter's horizontal room) — grid-template-columns is set
   inline per bar from viewerTabBar.GridCols, one "<weight>fr" term per
   beat. Overlay mode (.tab-block without .tab-replaces-staff) keeps the
   simpler equal-width flex row above; only the tab-only/replaces-staff
   case reaches for proportional spacing, since that's the one meant to
   read as real notation rather than a small annotation. */
.tab-block.tab-replaces-staff .tab-beats { display: grid; grid-auto-flow: column; }
.tab-block.tab-replaces-staff .tab-beat { position: relative; min-width: 0; }
/* Song Map is an OVERVIEW — chords and structure, the same reduced
   detail every other section already gets there (a 5-line staff behind
   chords/slashes, no actual notes), never real fretted note-by-note
   notation. A GP-imported bar's .tab-block.tab-replaces-staff (real tab
   notation, correct and wanted in "normal" mode) was rendering
   unconditionally in every mode including map, showing fret-by-fret
   detail nothing else on the map does — confirmed live, a single-track
   GP import's Song Map was a dense grid of real tab numbers instead of
   the chord-progression overview every other song's map already is.
   Hide the real notation and extend the same 5-line-staff background
   every normal bar gets (the :not(.bar-body-tab-only) exclusion right
   above this block is for "normal" mode only) so a tab-only bar reads
   exactly like any other bar here: chords over a staff. */
#sheet[data-render-mode="map"] .tab-block.tab-replaces-staff { display: none; }
/* .bar-body-tab-only's height formula (calc(var(--strings) * 1.1em +
   0.9em)) sizes the box to fit the real fret-by-fret .tab-block hidden
   above — tall enough for a 6-string guitar (~7.5em) — so with that
   block hidden in map mode, every TabOnly bar still rendered as a
   near-empty ~120px-tall box, just the chord label floating at the top
   and the rest filled only by the "current bar" playhead tint (a stray
   oversized colored rectangle, confirmed live). Collapse it back to the
   same flat height every normal chord bar already uses here. */
#sheet[data-render-mode="map"] .bar-body-tab-only { height: 1.7em !important; }

/* Beamed runs: 2+ consecutive eighth/sixteenth notes joined by a shared
   horizontal bar instead of each drawing its own hooked flag — standard
   notation practice, reviewed against real LilyPond \tabFullNotation
   output. One .tab-beam grid item per run, grid-column spanning from
   its first to its last beamed note (viewerTabBeam.StartCol/EndCol).
   Sits at the same row as the beats themselves (one implicit grid row),
   positioned by its own height so it lines up with where an unbeamed
   note's stem top would be. */
.tab-beam { position: relative; height: 100%; }
.tab-beam-bar {
  position: absolute; left: 0; right: 0; bottom: 0.55em; height: 1.4px;
  background: var(--fg-muted);
}
.tab-beam-bar:nth-child(2) { bottom: 0.4em; }

/* Rhythm marks under each beat's fret numbers — the "how long does this
   note last" information real tab/Guitar-Pro/LilyPond \tabFullNotation
   notation always carries alongside the fret number itself. A bare stem
   for a quarter note or longer (no flag), one flag per eighth-note
   halving (8th=1, 16th=2...), a dot for a dotted duration, a dedicated
   rest glyph instead of a stem when the beat is silent. Sits below the
   lowest string line, inside the row's own tabH reserve. */
.tab-stem {
  position: absolute; bottom: 0.1em; left: 50%; transform: translateX(-50%);
  width: 1px; height: 0.5em; background: var(--fg-muted);
}
.tab-stem::after {
  content: ""; position: absolute; bottom: 0; left: 0; width: 0.35em; height: 0.35em;
  border-bottom: 1px solid var(--fg-muted); border-right: 1px solid var(--fg-muted);
  border-radius: 0 0 60% 0; opacity: 0; /* overridden per flag below */
}
.tab-flag {
  position: absolute; bottom: 0.1em; left: 50%; width: 0.4em; height: 0.3em;
  border-bottom: 1.4px solid var(--fg-muted); border-right: 1.4px solid var(--fg-muted);
  border-radius: 0 0 70% 0; transform: translateX(-1px);
}
.tab-stem .tab-flag:nth-child(1) { bottom: 0.1em; }
.tab-stem .tab-flag:nth-child(2) { bottom: 0.25em; }
.tab-stem.dotted::before {
  content: "."; position: absolute; bottom: 0; left: 0.45em; color: var(--fg-muted); font-weight: bold;
}
.tab-rest {
  position: absolute; bottom: 0.1em; left: 50%; transform: translateX(-50%);
  width: 0.45em; height: 0.45em; border-radius: 50%; border: 1.4px solid var(--fg-muted);
}
.slash { display: inline-block; font-size: 1.3em; color: var(--fg); transform: rotate(10deg); }
.beat-slot.tie .slash { color: var(--fg-muted); opacity: 0.55; }
/* Simile ("bar repeat") sign — Real Book / LilyPond convention, ported
   from v2/lib/staff.typ's own simile(): a hollow diagonal slash the full
   height of the staff, flanked by two dots offset diagonally from its
   ends (NOT stacked vertically — that's the different, repeat-BARLINE
   dot pair below). Drawn as a real SVG (a true diagonal line + two round
   circles, proper anti-aliased curves) rather than CSS div/border/
   border-radius tricks, which never quite rendered the dots as circular
   or the line as a clean stroke at small sizes — this is the "drawn
   ugly" feedback, fixed by drawing the actual shapes instead of faking
   them with box primitives. currentColor + inherited `color` lets the
   current-bar and placeholder-bar states recolor it with one rule each,
   same as any other text content. */
/* NOT flex:1 — a repeat bar has no sibling beat-slots to share space
   with, so flex:1 let it stretch to the bar's FULL width (confirmed: a
   129x27px box, ~4.7:1). The slash+dot positions below assume a roughly
   square glyph (LilyPond's own PercentRepeat is sized off one staff-
   space, not a bar's whole width), so a wide box spread the dots far
   from the slash instead of flanking it — this was the "% looks broken"
   report, present in every mode, not something the jazz redesign
   introduced. Fixed width (matching the bar's own height) + auto margins
   keeps it a true square, centered in whatever the bar's real width is. */
/* Box sized from the REAL glyph's own proportions this time, not a square
   guess — LilyPond's x_percent() stencil (lily/percent-repeat-
   interface.cc) assembles slash width (w) + its end-cap width
   (x_width = hypot(thickness, thickness/slope)) for total width ≈2.68
   staff-spaces against a height of only ≈2.0 — i.e. noticeably WIDER
   than tall, not square. Centered in the bar on BOTH axes now (it no
   longer fills the bar's own height) via align-self, since height:100%
   was forcing the glyph to the full 4-staff-space staff height when the
   real mark only spans about half that. */
.simile-mark {
  flex: 0 0 auto; width: 1.9em; height: 1.4em; margin: 0 auto; align-self: center;
  position: relative; overflow: hidden; color: var(--fg-muted);
}
/* Plain CSS shapes — a rotated div for the slash, two border-radius:50%
   divs for the dots. No replaced element, no intrinsic aspect ratio, no
   viewBox: a div's box is exactly the width/height given, full stop, the
   same in every engine — see the template comment for why this replaced
   an SVG version.

   Geometry re-derived from a REAL rendered reference, not hand-algebra
   from the C++ source: compiled `\repeat percent 4 { d4 f a d }` with the
   locally installed LilyPond 2.26.0 and measured the PNG pixel-for-pixel
   (staff-space = 20.75px there). Two bugs in every earlier attempt this
   round: (1) the slash was rotated the WRONG WAY — `rotate(-45deg)` draws
   "\", but the real glyph is "/" (rises lower-left to upper-right); (2)
   the slash was drawn far too SHORT relative to the dots' offset, so the
   dots read as disconnected from it. Measured against the real PNG: the
   dots sit symmetric about the glyph's center at ±0.82 staff-space
   horizontally / ±0.51 staff-space vertically (i.e. in the stave spaces
   immediately above/below the middle line), the slash's full diagonal
   length is ≈2.59 staff-spaces (so each axis projects ≈1.83 staff-spaces
   peak-to-peak), and its thickness is 0.48 staff-space — matching
   scm/define-grobs.scm's thickness constant exactly, a good sanity check
   on the measurement. Converted via this app's own 0.425em-per-staff-space
   convention (see the .simile-mark comment above) so the ratio stays
   pinned to something checkable, not a re-guessed percentage. */
.simile-slash {
  position: absolute; left: 50%; top: 50%; width: 0.2em; height: 1.1em;
  background: currentColor; transform: translate(-50%, -50%) rotate(45deg);
}
.simile-dot {
  position: absolute; width: 0.2em; height: 0.2em; border-radius: 50%;
  background: currentColor; transform: translate(-50%, -50%);
}
/* Dot center offsets, in em, from the real-PNG measurement above:
   ±0.82 staff-space horizontal ≈ ±0.35em, ±0.51 staff-space vertical ≈
   ±0.22em. Dot-a sits upper-LEFT (same side the slash's lower end points
   toward), dot-b sits lower-RIGHT (same side the slash's upper end points
   toward) — the two dots flank the "/" on its open sides, same as the
   real glyph. */
.simile-dot-a { left: calc(50% - 0.35em); top: calc(50% - 0.22em); }
.simile-dot-b { left: calc(50% + 0.35em); top: calc(50% + 0.22em); }
.simile-count {
  position: absolute; left: 50%; bottom: 100%; margin-bottom: 0.1em;
  transform: translateX(-50%); font-weight: 700; font-size: 0.85em; color: var(--fg-muted);
}
.bar-placeholder .simile-mark { opacity: 0.3; }
.simile-wide .simile-slash { width: 0.26em; }

/* Whole-bar rest ("R") — standard notation: a filled block hanging BELOW
   the staff's 2nd line (counting from the top), proportioned per
   v2/lib/staff.typ's own rest(): width ~1.1 staff-spaces, height ~0.32
   staff-space. The staff is 4 spaces tall (5 lines) at 1.7em, so one
   space is 0.425em; width/height below are that ratio directly. */
.rest-mark { flex: 1; position: relative; height: 100%; }
.rest-mark::before {
  content: ""; position: absolute; left: 50%; top: 25%; width: 0.47em; height: 0.14em;
  background: var(--fg); transform: translateX(-50%);
}
.bar.current .rest-mark::before { background: var(--current-fg); }
.bar-placeholder .rest-mark::before { opacity: 0.3; }

/* A "Solo" section's inferred placeholder bars — real page space, not real
   chord data. Every bar draws its own identical staff slice (see
   --staff-5lines), so placeholder-ness reads through the slashes alone
   rather than by dimming a per-bar staff fragment. */
.bar-placeholder .slash { opacity: 0.3; }

/* Time signature, engraved on the staff — LilyPond/standard practice: it
   lives in the space before the opening barline, not as a heading above
   it. This cell shares the bar-body's own staff background so the 5
   lines run unbroken from here into the first real bar, with the
   numerator/denominator each centered in their own half of the staff
   height (digits land near the 2nd/4th lines, the conventional spot). */
.staff-timesig-cell {
  display: flex; flex-direction: column; position: relative; z-index: 1;
  height: 1.7em; width: 2.1em; margin-right: 0.4em;
}
/* Real engraving draws time-signature digits large — each numeral fills
   close to its own half of the staff height (LilyPond's default glyphs
   span roughly 2 staff-spaces each), not a small centered number. 1.05em
   read as a timid afterthought next to the staff. 1.5em (tried next)
   overcorrected: a font's own line-box (ascent+descent) runs noticeably
   taller than its nominal font-size, so at 1.5em the digits actually
   overflowed the 0.85em-tall half-cell they're centered in, top and
   bottom. 1.1em leaves enough headroom for that overhead while still
   reading as deliberately large, not timid. */
/* flex:1 alone isn't a hard constraint: a child's line box (font-size ×
   line-height) is its content-driven minimum height, and a flex column
   lets that win over its 0.85em flex-basis share when the two disagree —
   which is exactly what was happening at 1.1em (a 1.1em line box inside
   an 0.85em half), pushing the second digit's line box past the cell's
   own bottom edge even though the cell's OWN box (height: 1.7em) never
   grew to show it. height + overflow:hidden on each half makes the
   0.85em-per-half split a real hard clip instead of a target the flex
   model can silently miss. */
.staff-timesig-cell .tsnum, .staff-timesig-cell .tsden {
  flex: 1 0 0.85em; height: 0.85em; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-chart); font-size: 1em; line-height: 1;
}
/* The tempo mark is the one thing that genuinely belongs above the staff
   — positioned over this cell specifically, so it no longer shares an
   anchor (and a collision risk) with the first bar's own chord label. */
/* Centered over the time-sig cell, not anchored to either edge: the cell
   is the very first thing in its row, squeezed between the page's own
   left margin and the first bar's chord label — anchoring right (grow
   left) ran the tempo text into the page margin/section spine and got
   it clipped there; the earlier anchor-left attempt ran it into the
   chord label instead. Centered growth splits the overflow risk roughly
   evenly instead of dumping all of it on one neighbor. */
.tempo-mark-inline {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 0.3em;
  font-size: 0.85em; color: var(--fg-muted); white-space: nowrap;
}
.tempo-mark-inline .note { font-size: 1em; position: relative; }
.aug-dot { font-size: 0.55em; position: absolute; top: -0.1em; right: -0.55em; }

/* The volta bracket gets its own clear row, well above the chord-label row
   — previously it sat almost exactly where chord labels do and visibly
   cut through them. The horizontal line is a plain border-top; the first
   bar of a run additionally gets a short downstroke tick at its left edge
   (the classic "1." ending bracket shape), via its own fixed height. */
.volta { position: absolute; top: -2.3em; left: 0; right: 0; border-top: 1.5px solid var(--fg); height: 0.5em; }
.volta-num {
  position: absolute; top: -1.3em; left: 0.3em; font-size: 0.7em; font-weight: 700;
  color: var(--fg-muted); background: var(--bg-raised); padding: 0 0.3em;
}
/* A multi-bar ending reads as one continuous bracket: only the first bar
   draws the bracket's left downstroke, and the bar-divider between two
   bars sharing the same ending is dropped so the bracket's top line isn't
   visibly broken into segments. */
.has-volta:not(.volta-continues) .volta { border-left: 1.5px solid var(--fg); left: -1px; }
.volta-continues { border-left: none !important; }

/* Repeat-barline dots — LilyPond/Guitar Pro convention: two dots stacked
   VERTICALLY (same x), straddling the middle staff line, one in the space
   above it and one in the space below (not centered-with-gap via flex,
   which drifted off-center once the staff became a shared background —
   positioned here directly against the bar's own box, which spans exactly
   the staff height per .staff-line::before). Sits just inside the thin
   barline, between it and the music, per convention. */
.repeat-dots { position: absolute; top: 0; bottom: 0; width: 0.3em; pointer-events: none; }
.bar-open .repeat-dots { left: 0.2em; }
.bar-close .repeat-dots { right: 0.2em; }
/* A STATED repeat count ("x4"), printed on the CLOSE bar — see the
   template's own comment on .bracket-repeat-count for why the end side,
   not the start. Measured and found overlapping the chord name below
   it (a bottom:100% + margin-bottom stack, same idea as .chord-label's
   own anchor, landed mid-way through the chord glyph's own box — its
   actual rendered height runs taller than a flat em-based margin
   guessed), so this instead copies .volta's own proven pattern: a flat
   `top: -Nem` offset from the BAR's own top edge (not relative to the
   chord label's box at all), the same fixed height every repeat count
   sits at regardless of which chord happens to be under it — real
   engraving (LilyPond) puts this annotation in its own clear band above
   the staff, not stacked relative to the chord name. -4.4em (vs.
   .volta's -2.3em) because a volta marker's own bracket line sits right
   at the barline; this needs to additionally clear the chord label that
   volta doesn't have to — measured live against a real chord glyph's
   own box, not just guessed from .volta's offset.
   Horizontally: right-anchored to the bar's own right edge (where the
   close dots + thick accent strip live — see .bar-close .repeat-dots/
   .bar-close::after just above/below), NOT centered over the whole bar
   — real engraving sits a repeat count directly over the END barline
   itself, not over the repeated span's midpoint (that's what the volta
   bracket's own full-width span is for; this is a distinct, narrower
   mark). Centering it read as floating over whichever chord happened to
   fall mid-bar, not tied to the barline it actually describes. */
.bracket-repeat-count {
  position: absolute; right: 0; top: -4.4em;
  font-weight: 700; font-size: 0.85em; color: var(--fg-muted); white-space: nowrap;
}
.repeat-dots::before, .repeat-dots::after {
  content: ""; position: absolute; left: 50%; width: 0.28em; height: 0.28em;
  border-radius: 50%; background: var(--fg); transform: translate(-50%, -50%);
}
.repeat-dots::before { top: 37.5%; }
.repeat-dots::after { top: 62.5%; }
.repeat-suffix { font-style: italic; font-weight: 400; text-transform: none; letter-spacing: normal; margin-left: 0.2em; }
.inferred-note { font-size: 0.75rem; font-weight: 400; font-style: italic; color: var(--fg-muted); margin-left: 0.5rem; }

/* ---- Section notes — free-text performance/arrangement directions (see
   the template comment and song.Section.Notes). Deliberately NOT styled
   like a lyric line (no chord parsing, no current-line highlight) — this
   is instructions ABOUT the music, not words sung to it. */
.section-notes { margin: 0.3em 0; }
.section-note {
  margin: 0.1em 0; font-size: 0.82em; font-style: italic; color: var(--fg-muted);
}
#sheet[data-render-mode="jazz"] .section-note { font-size: 0.8em; }
#sheet[data-render-mode="map"] .section-notes,
#sheet[data-render-mode="map"] .section-note { display: none; } /* an overview chart has no room for prose */

.lyrics .lyric-line { margin: 0.25rem 0; }
.lyric-line.current { background: var(--current-bg); color: var(--current-fg); border-radius: 3px; }
/* A chord-bearing segment stacks its chord directly above the word it
   attaches to (two-row inline-flex column), matching both the PDF
   export's own placement (internal/pdfnative/lyrics.go's drawChordSymbol
   call, same x as the word beneath it) and the LaTeX "songs" package's
   own convention this app's [Chord]word syntax was modeled on — a chord
   mark raised above its syllable, never read inline before it on the
   same line. A chordless segment stays a plain inline run so it still
   wraps normally mid-phrase. */
.lyric-seg { display: inline; }
.lyric-seg.has-chord {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  vertical-align: bottom; margin-right: 0.15em;
}
.inline-chord {
  font-size: 0.78em; font-style: italic; line-height: 1.1;
  margin-bottom: 0.05em; white-space: nowrap;
}
/* Lyrics-only mode is read by the singer, not the player — chords are
   pure visual noise there (the "jazz chart"/"song" modes are where a
   player wants them); strip them entirely rather than just de-emphasize
   them. */
#sheet[data-render-mode="lyrics"] .inline-chord { display: none; }

/* ---- Shared structure/bar-count header ------------------------------------
   The "Intro 4 / Couplet 8 / Refrain 2" road-map convention (per a real
   cover-band chart: bold section name, big bold bar count underneath).
   Hidden by default (normal reading view doesn't need it); jazz, song-map
   and lyrics-only modes each turn it on below, since all three are read
   "at a glance" rather than line-by-line. */
.section-map-chip { display: none; }
.chip-label {
  font-family: var(--font-chart); font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; font-size: 0.8rem; color: var(--fg-muted); white-space: nowrap;
}
.chip-bars { font-size: 1.9rem; font-weight: 800; line-height: 1.15; margin-top: 0.15rem; }

/* ---- View modes: jazz chart / lyrics-only / song map ---------------------- */
#sheet[data-render-mode="jazz"] .lyrics,
#sheet[data-render-mode="lyrics"] .grid,
#sheet[data-render-mode="map"] .lyrics { display: none; }
#sheet[data-render-mode="jazz"] .sheet-section,
#sheet[data-render-mode="lyrics"] .sheet-section { display: block; }
/* Song Map renders its own separate continuous-score block (.map-score,
   built from .MapLines) instead of one independent chart per section —
   see the matching CSS further down and buildMapLines in
   handlers_pages.go. The old per-section markup is still emitted (shared
   by every mode) but stays hidden in this mode. */
#sheet[data-render-mode="map"] .sheet-section { display: none; }
.map-score { display: none; }
/* ---- Drummer view: one continuous, full-width chart, like Song Map --
   Same design Song Map already settled on for the chord grid (bars flow
   continuously, nothing independently boxed): ONE sheet, every line the
   same width AND the same height, with its clef and time signature drawn
   exactly ONCE per line. .drum-map (built from .DrumMap — see
   buildDrumMap, handlers_pages.go) is a column of ROWS (.drum-row),
   EVERY one of them exactly one alphaTab mount at the full line width —
   even a row a section boundary falls mid-line of (see buildDrumMap's
   own doc comment for the two earlier, each-wrong-differently versions
   this replaces: one mount per section always drew a separate clef per
   section, read as disconnected chips stapled together, not one
   continuous staff — confirmed directly: "that looks like a patchwork to
   me"; one mount per line but split into several per-section cells
   sharing a row via CSS percentages fixed THAT but kept the same
   patchwork look and needed three separate, increasingly narrow CSS
   fixes before the cells even packed correctly). A boundary only ever
   adds a floated .drum-row-label (position:absolute, LeftPct from Go) —
   never a second mount, so there's never a sibling cell in the row to
   share width or wrap against, and none of the CSS machinery either
   earlier version needed (gap-vs-percentage math, a min-width override)
   has anything left to do here. HEIGHT is pinned to exactly one system
   line via settings.display.barsPerRow (alphatab-tab.js, data-bars), so
   a line compresses its notes horizontally on a narrow viewport rather
   than wrapping to a second internal line. The old per-section markup
   (chip, grid, lyrics — shared by every mode) stays hidden in this mode
   entirely, same as it already is for Song Map. */
#sheet[data-render-mode="drummer"] .sheet-section { display: none; }
.drum-map { display: none; }
#sheet[data-render-mode="drummer"] .drum-map {
  display: flex; flex-direction: column; gap: 0.9rem;
  /* No horizontal scroll, ever: this app is read hands-off while
     actually playing (band practice, a gig) — nobody can stop to swipe
     a chart sideways mid-song. A row's own legibility-floor width
     (alphatab-tab.js) is capped at its own container's measured width
     before it's ever applied, so a row that would otherwise want more
     room than the viewport has compresses to fit instead of growing
     past it. overflow-x stays hidden as the hard backstop for that
     guarantee (a sub-pixel rounding case, not the normal path), rather
     than auto: a scrollbar here would be an escape hatch back into the
     exact thing this is meant to prevent. */
  overflow-x: hidden;
}
.drum-row { position: relative; }
/* Same overlay technique as Song Map's own .map-sec-badge (floats above
   a single bar at left:0, relative to that bar's own cell): there's no
   per-bar cell here to anchor to (the row is one alphaTab mount, not a
   grid of per-bar elements), so LeftPct (buildDrumMap) is the boundary
   bar's own position as a percentage of the WHOLE row instead. */
.drum-row-label {
  position: absolute; bottom: 100%; margin-bottom: 0.3em;
  font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 0.8em; color: var(--accent);
  white-space: nowrap;
}
.drum-row-label .rehearsal-mark { margin-right: 0.35em; }
/* No extra width rule needed here: the global ".staff-line.alphatab-row
   { width: 100% }" rule (unscoped — applies in every render mode)
   already fills the row. An alphaTab row with NO width at all measures 0
   and alphaTab silently skips rendering into it ("width=0 (element
   invisible)") even though its parent is visible — confirmed live
   earlier this session — which is what that global rule exists to
   prevent. */
/* "every line the same height" (this section's own opening comment)
   needs an explicit floor: alphaTab renders a plain consolidated rest
   noticeably SHORTER than a line carrying real notes, chord labels and
   a dynamic marking (confirmed live: 135px vs. 166px, a ~23% jump) —
   confirmed directly as a real visual break, not a nitpick: a bare rest
   line sitting right next to a busier one reads as a shorter, oddly
   sized line rather than a uniform sheet. 11rem (176px) clears the
   tallest case measured live with a small margin for a busier riff than
   this app's own demo content (more beamed 16ths, a crash cymbal). */
.drum-row .staff-line.alphatab-row { min-height: 11rem; }

#sheet[data-render-mode="map"] .chord-legend { display: none; }
.chord-legend {
  display: flex; flex-wrap: wrap; gap: 1.2em;
  margin: 0 0 1.2em;
}
.chord-diagram-name { font: 700 0.85rem/1 inherit; fill: var(--fg); }
.chord-diagram-nut { stroke: var(--fg); stroke-width: 2.5; }
.chord-diagram-fretline { stroke: var(--fg-muted); stroke-width: 1; }
.chord-diagram-string { stroke: var(--fg-muted); stroke-width: 1; }
.chord-diagram-barre { stroke: var(--fg); }
.chord-diagram-dot { fill: var(--fg); }
.chord-diagram-open { fill: none; stroke: var(--fg); stroke-width: 1.5; }
.chord-diagram-muted line { stroke: var(--fg); stroke-width: 1.5; }
.chord-diagram-fretnum { font: 0.7rem/1 inherit; fill: var(--fg-muted); }
#sheet[data-render-mode="jazz"] .bar { padding: 0.25em 0.7em; }
#sheet[data-render-mode="jazz"] .csym-root { font-size: 1.2em; }
/* Chord symbols, sans-serif and bold — verified against real iReal Pro
   screenshots (irealpro.com marketing/learn pages: "Chelsea Bridge",
   the Editor screenshot on /learn/edit-a-song): iReal's chord font is a
   clean bold sans digit-and-letter face, never the serif/italic
   "engraved" treatment this chart's other modes use on purpose. Scoped
   to jazz only — normal/map/lyrics keep their own look. */
#sheet[data-render-mode="jazz"] .csym { font-family: var(--font-ui); font-weight: 700; }
#sheet[data-render-mode="jazz"] .csym-plain { font-style: normal; }
/* Two chord-symbol renderings sit in the DOM for every beat (chart-bar,
   play.html: .chord-std from {{chord}}, .chord-jazz from {{chordJazz}})
   — CSS picks the right one per mode instead of threading a mode flag
   through the shared chart-bar template every other mode also uses.
   Verified against real iReal Pro PDF exports (not memory): minor is
   always "-" (never "m", never dropped below the baseline the way the
   other modes' engraved style does it), and a half-diminished chord is
   spelled out literally ("B-7♭5"), never substituted with a ø glyph —
   RenderJazz (internal/chordsym) implements that distinct decomposition. */
.chord-jazz { display: none; }
#sheet[data-render-mode="jazz"] .chord-std { display: none; }
#sheet[data-render-mode="jazz"] .chord-jazz { display: inline-block; position: relative; }
/* Bass note stacked below-right of the main symbol, smaller — not
   inline ("D-7/G" as one run of text) the way the other modes render a
   slash chord. Confirmed against Still Got The Blues' real export
   ("D-7" over "/G", "A-" over "/B"/"/C"). */
#sheet[data-render-mode="jazz"] .chord-jazz .csym { position: relative; padding-bottom: 0.3em; }
#sheet[data-render-mode="jazz"] .chord-jazz .csym-bass {
  position: absolute; left: 0.05em; bottom: -0.15em;
  font-size: 0.62em; font-weight: 700;
}
#sheet[data-render-mode="jazz"] .chord-jazz .csym-bass > span { font-weight: 700; }
/* Section marker: REVERSES an earlier explicit choice in this codebase
   to keep the full Verse/Chorus/Bridge word next to the letter in jazz
   mode (see the removed comment this replaced) — confirmed against the
   same real iReal Pro screenshots that a rehearsal mark there is NEVER
   more than the bare boxed letter (A/B/C), sitting tight against the
   corner of the staff, no section name spelled out anywhere on the
   chart itself. Flagging this reversal explicitly since it was a
   previous deliberate call, not an oversight — the user's current,
   explicit ask ("exactly like iReal Pro", for real interop with
   bandmates still on iReal Pro) is more specific and more recent, so
   this fork follows it, but it's worth the user confirming they're
   fine overriding that earlier decision.
   font-size:0 / reset-on-the-span is the standard "keep one inline
   child visible, collapse the rest of this element's own text" trick —
   .section-jump's template unconditionally prints the label as plain
   text after .rehearsal-mark with no wrapping span of its own to
   target directly. */
#sheet[data-render-mode="jazz"] .section-jump {
  font-size: 0; background: none; color: inherit;
  border: none; border-radius: 0; padding: 0; font-style: normal;
  font-variant: normal; letter-spacing: 0;
}
#sheet[data-render-mode="jazz"] .section-jump .rehearsal-mark {
  font-size: 0.78rem; margin-right: 0;
}
#sheet[data-render-mode="jazz"] .sheet-section.current-section > h3 .section-jump .rehearsal-mark {
  background: var(--accent); color: var(--accent-contrast); filter: brightness(1.15);
}
#sheet[data-render-mode="jazz"] .sheet-section.is-compact .section-jump .rehearsal-mark {
  background: var(--fg-muted);
}
/* Section chrome (padding, header margin) also needs to shrink with the
   fit loop's font-size, same reasoning as the staff geometry above — these
   repeat once per section and add up across a long song. Scoped to jazz
   mode only; the normal reading view keeps its fixed rem spacing. */
#sheet[data-render-mode="jazz"] .sheet-section { padding-top: 0.6em; padding-bottom: 0.6em; }
/* Badge sits at the LEFT MARGIN of the section's own first row, not as a
   separate heading line above the chart — confirmed in all four real
   exports (the boxed letter sits tight against the left edge, inline
   with that row's top, never on its own line). .sheet-section reserves
   a left gutter the same width as the badge would otherwise take, and
   h3 is pulled into it via position:absolute — same "overlay the real
   chart, zero footprint on its own layout" technique already used for
   Song Map's .map-sec-badge. */
#sheet[data-render-mode="jazz"] .sheet-section { position: relative; padding-left: 1.6em; }
#sheet[data-render-mode="jazz"] .sheet-section h3 {
  position: absolute; left: 0; top: 0.6em; margin: 0; z-index: 1;
}
/* A section with no grid and nothing inferred about it (no repeat
   reference, no Solo duration note) really is just noise on a chords-only
   chart — hide it. A compact one (.is-compact: an inferred repeat
   reference, or the Solo duration note) carries real structural
   information instead, so it stays — see the compact-reference styling
   below for how little room it actually takes. */
#sheet[data-render-mode="jazz"] .sheet-section:not(.is-compact):not(:has(.grid)) { display: none; }
/* is-compact now also covers a Solo whose grid is only inferred
   placeholder bars (see the template comment) — it should read exactly
   like any other "nothing new, N bars" section (the multi-rest bar
   below), not get a whole expanded dimmed grid that reads as real
   content — that dimmed 2-3-row grid was the "ugly" normal-mode Solo
   rendering. Applies everywhere except lyrics mode, which already has
   its own proportional-height treatment for a compact section and never
   shows chords at all. */
#sheet:not([data-render-mode="lyrics"]) .sheet-section.is-compact .grid { display: none; }

/* Jazz chart: NO staff. A real printed "chords only" fake-book page never
   draws a 5-line staff for a rhythm-slash-only chart — it's chord symbols
   over a plain grid, exactly the swiss-jazz.ch / Real Book references this
   mode is modeled on. The shared staff engine (.bar::before/
   .staff-timesig-cell::before, see --staff-5lines above) is only ever
   defined for normal/map in the first place, so jazz simply never draws
   one — nothing to hide here. */
#sheet[data-render-mode="jazz"] .staff-timesig-cell {
  border: none; height: auto; width: auto; margin-right: 0.6em; align-self: center;
}
#sheet[data-render-mode="jazz"] .tsnum, #sheet[data-render-mode="jazz"] .tsden { font-size: 0.85em; }
/* .section-jump (the h3 button above, already styled as a solid accent
   pill — the real "boxed letter" iReal Pro convention) is jazz mode's
   ONE section header; .section-map-chip (built for song-map/normal's
   own "label + bar count" summary row) duplicated it entirely — same
   letter, same name, rendered a second time directly underneath,
   reading as a garbled double layout (confirmed live, both desktop and
   mobile widths; not a mobile-only bug). Jazz keeps only .chip-bars
   from that chip — the one piece of information .section-jump doesn't
   already carry, needed so a compact/reference section's multi-rest
   row (below) still shows its bar count. */
#sheet[data-render-mode="jazz"] .section-map-chip {
  display: flex; align-items: baseline; gap: 0.4em; margin-bottom: 0.3em;
}
#sheet[data-render-mode="jazz"] .section-map-chip .rehearsal-mark,
#sheet[data-render-mode="jazz"] .section-map-chip .chip-label {
  display: none;
}
#sheet[data-render-mode="jazz"] .chip-bars { font-size: 1.1em; margin-top: 0; }
#sheet[data-render-mode="jazz"] .sheet-section.is-compact .chip-bars { color: var(--fg-muted); }
/* Normal mode's compact sections get the same "label + bar count" chip
   as jazz/map — the multi-rest bar alone said "there are some bars here"
   but not how many; non-compact sections keep just their plain heading,
   no redundant second label. */
#sheet[data-render-mode="normal"] .sheet-section.is-compact .section-map-chip {
  display: flex; align-items: baseline; gap: 0.4em; margin-top: 0.1rem;
}
#sheet[data-render-mode="normal"] .sheet-section.is-compact .chip-label { display: none; }
#sheet[data-render-mode="normal"] .sheet-section.is-compact .chip-bars { font-size: 1.1rem; margin-top: 0; color: var(--fg-muted); }
/* A "compact" section that still carries its own real lyrics (chords
   repeat an earlier section, but the words are new — e.g. a second
   Verse) is real content to read, not a structural placeholder: the
   multi-rest bar / bar-count chip is only useful when there's truly
   nothing else on the page for that section (a Solo, an instrumental
   Outro). Scoped to normal ("chords + lyrics") mode only — jazz/map stay
   chords-only overviews where every section is chip+bar-count regardless
   of lyrics. */
#sheet[data-render-mode="normal"] .sheet-section.is-compact[data-has-lyrics="true"] {
  padding: 0.9rem 0;
}
#sheet[data-render-mode="normal"] .sheet-section.is-compact[data-has-lyrics="true"] h3 {
  margin: 0 0 0.6rem;
}
/* A Solo section is the one case that overrides the rule directly above:
   it still wants the chip + multi-rest "N bars" marker even when it
   carries real lyrics of its own (a sung ad-lib over the solo) — without
   it, a defined Solo section (real grid/lyrics, not the bare/inferred
   placeholder case) rendered identically to a plain Verse, reading as
   the vocalist singing straight through the solo instead of the solo
   being its own, structurally distinct section (direct user report).
   [data-is-solo] is independent of is-compact — it fires whether or not
   this Solo also happens to be compact/bare, and layers the marker
   ALONGSIDE whatever real content (grid, lyrics) the section has, not
   instead of it. !important: this one narrow case needs to beat the
   has-lyrics hide rule above regardless of selector order, rather than
   adding yet another specificity fight to this file's history of them. */
/* :not(:has(.grid)) — a Solo that already states its OWN real chord grid
   (e.g. "[Solo]\ngrid: | Gm | Eb | F | Gm |") doesn't need this forced
   badge at all: the grid itself already reads as visually distinct from
   a plain Verse (no lyrics under it), so forcing the badge on top of it
   just duplicated a blank rest-bar directly under a populated one — a
   direct report ("the song is buggy"). This rule is for the case the
   comment above actually describes: a Solo with NO grid of its own
   (lyrics-only, or nothing at all), which otherwise has nothing marking
   it as a Solo rather than a Verse. */
#sheet[data-render-mode="normal"] .sheet-section[data-is-solo="true"]:not(:has(.grid)) .section-map-chip {
  display: flex !important; align-items: baseline; gap: 0.4em; margin-top: 0.1rem;
}
#sheet[data-render-mode="normal"] .sheet-section[data-is-solo="true"]:not(:has(.grid)) .multi-rest-row {
  display: flex !important; align-items: center; height: 1.7em; margin: 0.3em 0 0.8em; position: relative;
}
#sheet[data-render-mode="lyrics"] .sheet-section[data-is-solo="true"] .section-map-chip {
  display: flex !important; align-items: baseline; gap: 0.5em; margin-bottom: 0.4rem;
}
#sheet[data-render-mode="lyrics"] .sheet-section[data-is-solo="true"] .multi-rest-row {
  display: flex !important; align-items: center; height: 1.3em; margin: 1em 0 0.4em; position: relative;
}
#sheet[data-render-mode="normal"] .sheet-section.is-compact[data-has-lyrics="true"] .section-map-chip,
#sheet[data-render-mode="normal"] .sheet-section.is-compact[data-has-lyrics="true"] .multi-rest-row {
  display: none;
}

/* ---- Jazz chart, iReal Pro style — a plain vertical divider between
   bars, NOT a bordered box.
   A previous pass here claimed real iReal Pro draws a complete 4-sided
   grid cell per bar and cited its own marketing screenshots for that —
   checked directly against four real iReal Pro PDF EXPORTS the user
   supplied (Banshee, Ticket To Ride 3, Still Got The Blues, Whisper in
   a Hurricane — actual exported output, not a marketing page) and that
   claim doesn't hold: there is no border-top or border-bottom anywhere
   on the chart at all, only a single thin vertical line between bars
   (and the row's own left/right outer edges) — reverted. */
#sheet[data-render-mode="jazz"] .bar:first-of-type { border-left: 1px solid var(--fg-muted); }
#sheet[data-render-mode="jazz"] .bar:last-of-type { border-right: 1px solid var(--fg-muted); }
/* Repeat bracket — iReal Pro's own swirled-bracket-with-dots convention
   (confirmed in all four real exports), not the LilyPond thick/thin
   barline-with-dots this app's other modes correctly use (that one stays
   untouched there). Reuses the exact 𝄆/𝄇 glyphs (U+1D106/U+1D107,
   MUSICAL SYMBOL REPEAT LEFT/RIGHT WING) this codebase already renders
   elsewhere for the same semantic ("repeat this span") — see
   .grid-duplicate-note's &#x1D106;/&#x1D107; in play.html — rather than
   hand-drawing a new shape. No repeat-count ("4x") label: the measure
   data model (open/close/volta) carries no repeat-count field to read
   one from, so this doesn't fabricate a number. */
#sheet[data-render-mode="jazz"] .bar-open,
#sheet[data-render-mode="jazz"] .bar-close {
  border-left: none !important; border-right: none !important;
}
#sheet[data-render-mode="jazz"] .bar-open::before,
#sheet[data-render-mode="jazz"] .bar-close::after {
  background: none; width: auto; top: 50%; transform: translateY(-50%);
  font-size: 1.5em; line-height: 1; color: var(--fg);
}
#sheet[data-render-mode="jazz"] .bar-open::before { content: "𝄆"; left: -0.5em; }
#sheet[data-render-mode="jazz"] .bar-close::after { content: "𝄇"; right: -0.5em; }
#sheet[data-render-mode="jazz"] .repeat-dots { display: none; }
#sheet[data-render-mode="jazz"] .slash { display: none; }
/* A tied (sustained) beat-slot carries no chord of its own — collapsing
   it out of the flex row instead of just hiding its slash is what makes
   the real chord(s) fill the cell evenly rather than being squeezed into
   one of four fixed quarter-beat slots regardless of how many chords the
   bar actually has. */
#sheet[data-render-mode="jazz"] .beat-slot.tie { display: none; }
/* Bars are a FIXED 100%/--cap share of the row everywhere else (base
   .bar rule) — right for a chart where every bar holds one sustained
   chord, wrong for jazz: a bar with two or three real chords genuinely
   needs more room than a one-chord bar, confirmed directly in the real
   exports ("D-9 A♭Δ7" visibly wider than a neighboring single-chord
   bar). Content-sized instead (flex:0 0 auto), so multiple chords in
   one bar push it wider rather than being squeezed/overlapping into an
   equal share — this was a REAL bug on the first pass here (verified
   live: multi-chord bars rendered as illegibly overlapping text) that
   building against desktop-only screenshots hadn't caught the first
   time, not just a stylistic choice. */
/* A TabOnly bar's chord content lives in .tab-only-chords, which is
   position:absolute (see its own rule below) so it can overlay several
   beat-slots — meaning it never contributes to this bar's auto-width
   sizing the way a real jazz bar's in-flow .chord-label does just above.
   Zeroing the floor the same way for these bars collapsed every one of
   them to ~0 width, piling all their chord text on top of itself at the
   row's left edge (confirmed live on a GP-imported single-track song).
   Keep the base .bar rule's real min-width floor for them specifically. */
#sheet[data-render-mode="jazz"] .bar:not(.tab-only) { flex: 0 0 auto; width: auto; min-width: 0; }
#sheet[data-render-mode="jazz"] .bar.tab-only { flex: 0 0 auto; width: auto; }
#sheet[data-render-mode="jazz"] .beat-slot { flex: 0 0 auto; padding: 0 0.3em; }
#sheet[data-render-mode="jazz"] .beat-slot:first-child { padding-left: 0; }
#sheet[data-render-mode="jazz"] .beat-slot:last-child { padding-right: 0; }
#sheet[data-render-mode="jazz"] .chord-label {
  position: static; transform: none; margin: 0; bottom: auto; left: auto;
}
/* The shared .csym-minor treatment (0.6em, dropped below the baseline)
   is sized for the letter "m" — at that size a plain dash is nearly
   invisible, confirmed live (rendered as a barely-visible dot, not a
   readable "-"). iReal Pro's minor dash sits close to full root height,
   just slightly raised, not shrunk-and-dropped. */
#sheet[data-render-mode="jazz"] .chord-jazz .csym-minor {
  font-size: 0.85em; vertical-align: 0.1em; margin: 0 0.02em;
}
/* Bigger, more dominant repeat sign — iReal's own "%" reads as the single
   thing in the cell, not a small notation detail sharing space with a
   staff that no longer exists here. */
#sheet[data-render-mode="jazz"] .simile-mark { width: 2.3em; height: 1.7em; }
#sheet[data-render-mode="jazz"] .simile-slash { width: 0.24em; height: 1.34em; }
#sheet[data-render-mode="jazz"] .simile-dot { width: 0.24em; height: 0.24em; }
/* Same ratios as the base .simile-dot-a/-b, scaled by the 1.7/1.4 mark
   height bump above. */
#sheet[data-render-mode="jazz"] .simile-dot-a { left: calc(50% - 0.42em); top: calc(50% - 0.27em); }
#sheet[data-render-mode="jazz"] .simile-dot-b { left: calc(50% + 0.42em); top: calc(50% + 0.27em); }

/* Jazz: a centered, print-page-proportioned "page" (short width, tall —
   actual A4 proportions, not just whatever fills the window) that must
   never need scrolling — hands are on an instrument, not a scrollbar.
   JS (applyPageBox in song.js) fits that A4-ratio box into the available
   height first, THEN, only inside that fixed shape, searches column count
   (1-3) and font size so a longer tune fits without the page itself
   changing shape — the same move a real fake book makes for a longer
   tune: page columns, not a wider page. This is deliberately narrow even
   on a wide monitor — the point is to look like a printed page, not to
   fill the screen. */
#sheet[data-render-mode="jazz"] {
  overflow: auto; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 4px; box-shadow: var(--shadow); padding: 1.6rem 1.4rem;
  column-gap: 1.6rem; column-count: 1; /* JS (applyPageBox) raises this as needed */
}
#sheet[data-render-mode="jazz"] .sheet-section { break-inside: avoid; }

/* Lyrics-only: a reading mode, not a performance one — scrolling while
   singing is normal, so no page-box/fit search here (see applyPageBox).
   Structure headers + proportional section height (below) are what make
   this useful on its own, not just a smaller font of the normal view. */
#sheet[data-render-mode="lyrics"] {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 4px; box-shadow: var(--shadow); padding: 2rem 1.8rem;
  column-count: 1; /* overrides the generic wide-viewport #sheet{column-count:2} */
}
/* Lyrics are the whole point of this mode — "phone propped on a stand,
   read the words while singing" is the core mobile use case the app is
   built around (see the play.html template's own design notes) — so the
   words themselves get real emphasis here, not the same 1.05rem used
   where lyrics are a secondary column next to a chord grid (.sheet-section
   .lyrics above). Larger size + generous line-height for legibility at
   arm's length, and a touch more weight for contrast against the page. */
#sheet[data-render-mode="lyrics"] .lyrics { font-size: 1.35rem; line-height: 1.55; font-weight: 500; }
#sheet[data-render-mode="lyrics"] .lyric-line { margin: 0.4rem 0; }
#sheet[data-render-mode="lyrics"] .section-map-chip {
  display: flex; align-items: baseline; gap: 0.5em; margin-bottom: 0.4rem;
}
#sheet[data-render-mode="lyrics"] .chip-bars { font-size: 1.1em; margin-top: 0; }
/* An instrumental section (Intro, Solo, Outro — anything with bars but no
   words) used to get BLANK space proportional to its bar count, on the
   theory that it should occupy roughly the room it takes to play. In
   practice that's just an empty gap the singer stares at — no visual
   content at all — and for a long instrumental it was the single biggest
   reason this "avoid scrolling" reading mode scrolled anyway. A compact
   multi-rest bar (same component the rest of the chart already uses for
   "N bars, nothing new") says the same thing in a fraction of the
   height. GRID is still hidden in favour of this (lyrics mode shows
   words, not chords).
   Every is-compact section gets it now, not only a lyrics-free one — a
   repeated Verse/Chorus carries its own duplicated lyrics now (see
   annotateStructure, handlers_pages.go) and still wants the same "N
   bars" staff glyph next to its bar count that every other section
   shows (explicit user preference: "I like the Intro 18 one... would be
   good to have for the other sections"), with the actual words simply
   following below it rather than the glyph being dropped once lyrics
   exist. */
#sheet[data-render-mode="lyrics"] .sheet-section.is-compact .multi-rest-row {
  display: flex; align-items: center; height: 1.3em; margin: 1em 0 0.4em; position: relative;
}

/* ---- Song map: chords + staff + structure, no lyrics — "what's the form
   AND the changes," as ONE continuous engraved score, not one independent
   chart per section. Shares its ENTIRE sizing/justification engine with
   Chords+lyrics mode now, not a separate ragged/fixed-width treatment of
   its own: same width:100% justified .staff-line, same flex:0 0 calc(100%
   / var(--cap)) .bar rule (just below — unscoped from "normal" to include
   map), same reflow pass (reflowMapLines, song.js, sibling to
   reflowStaffLines using identical capacity math) recomputing each row's
   real bar count against the actual viewport instead of a server-fixed
   8-cells/line default. A recall cell (.bar-recall) carries class "bar"
   and intentionally gets NO width rule of its own below — it's simply
   another column at the row's shared width, the same way a real
   multi-measure rest in engraved notation is a fixed-width glyph with a
   number above it, not sized proportionally to its own bar count. */
#sheet[data-render-mode="map"] {
  column-count: 1; /* overrides the generic wide-viewport #sheet{column-count:2} —
    a continuous score can't split into two side-by-side newspaper columns
    without reintroducing exactly the "forced break" this mode exists to
    remove, just at the column boundary instead of a section boundary. */
}
#sheet[data-render-mode="map"] .map-score { display: flex; flex-direction: column; }
#sheet[data-render-mode="map"] .bar-recall {
  padding: 0 0.5em; position: relative;
}
#sheet[data-render-mode="map"] .bar-recall .bar-body {
  display: flex; align-items: center; justify-content: center; position: relative;
}
/* Same offset/anchor as a real bar's .chord-label (bottom:100%, directly
   above the staff) — the bar count IS this cell's "chord label". */
.bar-recall .chip-bars {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 0.35em; white-space: nowrap;
  font-size: 0.95em; font-weight: 700; color: var(--fg-muted);
}
.bar-recall .multi-rest-row {
  display: flex; align-items: center; justify-content: center; position: relative; width: 80%; height: 100%; margin: 0;
}
/* "= Intro" now rides on the section badge itself (see play.html) instead
   of as a second line of text below the bar — no real engraved multi-rest
   carries a caption underneath it. */
.map-sec-badge .recall-of { font-style: normal; font-weight: 400; opacity: 0.75; }
/* Section-name annotation — a CHILD of the bar it anchors to (see
   play.html's chart-bar/MapAnnotate), floated above it with zero footprint
   in the row's own flow (same overlay technique as .bar.editing::after).
   Sits above the chord-label's own space (.chord-label is bottom:100% on
   the SAME .bar), so it needs more clearance, not the same offset. */
.map-sec-badge {
  position: absolute; left: 0; bottom: 100%; margin-bottom: 1.5em;
  display: flex; align-items: center; gap: 0.35em; white-space: nowrap;
  font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 0.8em; color: var(--accent);
}
/* This clearance is for what stacks above a SINGLE bar (badge + chord-
   label/chip-bars) — unchanged from before (reducing it reopened the
   badge/chord-label collision this value was originally tuned against).
   The fix for the "disconnected floating chip" complaint is the row-to-
   row gap above (.map-score), not this. */
#sheet[data-render-mode="map"] .map-score .staff-line { padding-top: 5.2em; }
/* Every recall in Song Map gets its multi-rest glyph, not just the ones
   carrying an inferred note (e.g. a Solo's duration) — that's the whole
   point of the LilyPond convention this mode is built around: "N bars,
   same as before" reads as a bar-and-staff glyph, every time, the way a
   real chart recalls a repeated passage. (Previously suppressed for the
   plain case, which is what made every ordinary repeated Verse/Chorus
   render as a bare text line instead of the approved multi-rest block —
   reverted.) */

/* Multi-measure rest bar — LilyPond's own convention for "N bars, nothing
   new to show" (checked against scm/define-grobs.scm's MultiMeasureRest:
   thick-thickness 6.6 vs a barline's own 6.0 — essentially the same bold
   weight — centered on the staff). Used here for a compact/reference
   section in jazz/song-map mode: one bold bar spanning the row instead of
   rendering nothing, with the bar count already shown by the chip above
   doing the job LilyPond's MultiMeasureRestNumber does above its bar. */
/* Now emitted for every section (see the template comment), so showing
   it must be scoped to .is-compact specifically — a defining section
   (real grid, real content) never shows its multi-rest-row, only a
   compact/reference/inferred-placeholder one does. */
.multi-rest-row { display: none; }
#sheet:not([data-render-mode="lyrics"]) .sheet-section.is-compact .multi-rest-row {
  display: flex; align-items: stretch; height: 1.7em; margin: 0.3em 0; position: relative;
}
/* Lyrics-only's rest glyph stays compact (nothing else on that row needs
   full width either). Normal/Song mode now matches every other staff
   row's own full line length instead — a compact rest bar next to
   full-width real-bar rows read as a different, shorter kind of system,
   not "the same music sheet" the rest of the chart uses. */
#sheet[data-render-mode="lyrics"] .sheet-section.is-compact .multi-rest-row {
  width: min(16em, 70%);
}
#sheet[data-render-mode="normal"] .sheet-section.is-compact .multi-rest-row {
  width: 100%;
}
/* Drummer view never shows this CSS-built rest block at all — its own
   .sheet-section is hidden entirely in that mode (see the "Drummer
   view: ONE continuous drum staff" rule above), same as Song Map's. */
/* Normal mode and song map keep the real staff under the rest bar (per
   the "keep the staff, use the multi-bar visual on it" correction) —
   jazz mode has no staff at all by design, so it gets none here either;
   drummer mode never shows this component at all any more (see its own
   rule above). This cell isn't a .bar (an is-compact section's
   multi-rest-row is a standalone block, not a flex item inside a
   .staff-line), so it can't share the .bar::before SELECTOR above — but
   it draws the exact same lines via the same --staff-5lines custom
   property (defined once, near .staff-line), not a second copy of the
   gradient list. */
#sheet[data-render-mode="normal"] .multi-rest-row::before,
#sheet[data-render-mode="map"] .multi-rest-row::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--staff-5lines);
  background-size: 100% 1px;
  background-position: 0 0%, 0 25%, 0 50%, 0 75%, 0 100%;
  background-repeat: no-repeat;
  opacity: 0.5;
}
/* A recall cell's .multi-rest-row sits inside a .bar already (.bar-recall
   has class "bar"), which paints its own full-width staff slice via
   .bar::before above — without this override the rule just above also
   matched it, drawing a second staff confined to the glyph's own
   narrower, centered width, visibly misaligned against the wider one. */
.bar-recall .multi-rest-row::before { content: none; }
/* Each glyph lives in its own measure: thin barlines at both ends (same
   convention the real chord grid's own .bar boundaries use — see the
   first/last-child barline rules near .staff-line above), equal share of
   the row's width, the glyph centered inside with clear margin from the
   barlines — not a symbol stretched flush edge-to-edge, which read as a
   plain stripe rather than "a bar containing a rest". */
.multi-rest-measure {
  flex: 1 1 0; min-width: 0; height: 100%; position: relative;
  display: flex; align-items: center; justify-content: center;
  border-left: 1px solid var(--fg-muted);
}
.multi-rest-row .multi-rest-measure:last-child { border-right: 1px solid var(--fg-muted); }
/* The bar count, printed ABOVE its own glyph — LilyPond's
   MultiMeasureRestNumber, checked against scm/define-grobs.scm (it sits
   centered over the rest, not beside it). Floats above the measure's own
   box (bottom:100%, same technique .chip-bars already uses) so it never
   competes for the glyph's vertical centering. */
.multi-rest-count {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 0.15em; white-space: nowrap;
  font-size: 0.85em; font-weight: 700; color: var(--fg-muted);
}
/* End ticks — checked against the real stencil code, lily/multi-measure-
   rest.cc's big_rest(): the main bar is the thick horizontal block
   (thick-thickness, ~6.6 line-units tall), and at EACH end there's a
   separate, TALLER vertical post — hair-thickness wide, 2 full
   staff-spaces tall (Box (Interval(-0.5,0.5)*ythick, Interval(-ss,ss))) —
   i.e. almost the full staff height, centered on the bar. These are the
   glyph's OWN short end-posts, distinct from (and inset from) the
   measure's own barlines above — a real engraved multi-rest has both: a
   normal barline bounding the measure, and the rest glyph's own narrower
   end-posts floating inside it. */
.multi-rest-bar { width: min(70%, 6em); height: 0.16em; background: var(--fg); border-radius: 1px; position: relative; z-index: 1; }
.multi-rest-bar::before, .multi-rest-bar::after {
  content: ""; position: absolute; top: 50%; width: 0.1em; height: 0.85em;
  background: var(--fg); transform: translateY(-50%);
}
.multi-rest-bar::before { left: 0; }
.multi-rest-bar::after { right: 0; }

/* Jazz chart: lean entirely on real repeat/structure notation (the chip's
   own bar count, plus simile/repeat marks inside a grid) rather than ALSO
   drawing a multi-rest bar for every compact/reference section — jazz
   notation already treats the song's own structure as the repeat, so a
   second "N bars, nothing new" bar is redundant weight that costs the
   vertical space this mode most needs to stay on one page. */
#sheet[data-render-mode="jazz"] .sheet-section.is-compact .multi-rest-row { display: none; }

/* ---- Segno / D.S. al Coda / Coda — jazz mode only. A genuinely
   multi-section repeated run (detectSegnoRepeat, handlers_pages.go,
   modeled on LilyPond's \repeat segno — see that function's own doc
   comment) collapses to one "D.S. al Coda" marker instead of being
   re-rendered section by section; a single repeated SECTION still gets
   the existing 𝄆𝄇 bracket treatment above, untouched. */
/* The run's own later occurrences (every JazzHidden section after the
   first) are fully hidden — their content isn't wrong to render, it's
   just redundant once the marker names the whole span. Every other
   mode ignores .jazz-hidden entirely and shows these sections normally. */
#sheet[data-render-mode="jazz"] .sheet-section.jazz-hidden { display: none; }
/* The jazz-ds section's own normal content (chip/grid/multi-rest-row)
   still renders in the DOM (every other mode needs it) — hidden here,
   replaced by .jazz-ds-mark below. */
#sheet[data-render-mode="jazz"] .sheet-section.jazz-ds > .section-map-chip,
#sheet[data-render-mode="jazz"] .sheet-section.jazz-ds > .grid,
#sheet[data-render-mode="jazz"] .sheet-section.jazz-ds > .grid-duplicate-note,
#sheet[data-render-mode="jazz"] .sheet-section.jazz-ds > .multi-rest-row {
  display: none;
}
.jazz-ds-mark { display: none; }
#sheet[data-render-mode="jazz"] .jazz-ds-mark {
  display: block; font-family: var(--font-ui); font-weight: 700; font-style: italic;
  font-size: 1.1em; margin: 0.3em 0;
}
/* Segno and Coda — hand-drawn SVG (icon-segno/icon-coda, icons.html),
   not the real Unicode glyphs (U+1D10B/U+1D10C). Those were the first
   choice here (same Musical Symbols block as the 𝄆/𝄇 repeat-bracket
   glyphs already used above and confirmed rendering) but measured
   directly against this app's own font stack as TRUE tofu — rendered
   width identical to a guaranteed-unassigned codepoint, confirmed live
   (a solid striped box, not even an ugly fallback character) — so an
   SVG icon is the only reliable option, same as every other icon in
   this app. */
.jazz-segno-mark, .jazz-coda-mark { display: none; }
#sheet[data-render-mode="jazz"] .jazz-segno-mark,
#sheet[data-render-mode="jazz"] .jazz-coda-mark {
  display: inline-flex; align-items: center; margin-right: 0.3em; color: var(--fg);
}
#sheet[data-render-mode="jazz"] .jazz-segno-mark .icon,
#sheet[data-render-mode="jazz"] .jazz-coda-mark .icon {
  width: 1.5em; height: 1.5em;
}

/* ---- Compact section reference — the "call site, not re-inlined" case:
   a bare section whose content was already written out once earlier (an
   inferred or explicit repeat) renders as a single slim line, not a
   full-height empty block. This is what keeps "Verse Chorus Verse Chorus
   Bridge Chorus" from costing 6 chart blocks when only 3 are ever actually
   defined. */
.sheet-section.is-compact { padding: 0.35rem 0 0.35rem 0.8rem; }
.sheet-section.is-compact h3 { margin: 0; }
.sheet-section.is-compact .section-jump { font-size: 0.72rem; padding: 0.15rem 0.6rem; }

/* ---- Jazz mode: an inline view like any other, not a full-screen popup —
   the header, sidebar/timeline and view-mode tabs all stay exactly where
   they are; only #sheet itself changes (narrow print-page box, no staff —
   see the data-render-mode="jazz" rules above). */

/* ---- Structure timeline: a vertical rail, not an inline PDF-style strip -
   this is a web app, so "where am I in the song" gets a persistent,
   always-visible nav, not a row of pills competing with the toolbar. */
.content-row { display: flex; align-items: flex-start; gap: 1.6rem; padding: 0.6rem 1.1rem 0; }
.content-main { flex: 1; min-width: 0; }
/* The full transport/tempo/time-sig/key-transpose/click-sound panel that
   used to render here (first in-flow, briefly as a slide-over) is gone —
   #transport/#beat-dots above are now just hidden data holders (see
   play.html), never a visible panel at any width. Settings live only on
   the dedicated /metronome page, same as mobile. Any remaining
   .timeline/.mobile-controls-fab/.timeline-backdrop rules below this
   point are dead (no such elements exist any more) and are left as
   harmless unused CSS rather than hunted down across every historical
   media query — safe to prune later, not a functional risk now. */

@media (max-width: 900px) {
  /* align-items: flex-start (the desktop row layout's own cross-axis
     rule, needed there so the sticky .timeline rail doesn't stretch to
     the chart's full height) carries over into this column layout too,
     where "cross axis" is now WIDTH, not height — flex-start there means
     each item sizes to its own content (shrink-to-fit) instead of
     stretching to the container's width. .content-main's own min-width:0
     only ever mattered for the ROW layout's horizontal main axis; here it
     does nothing, so .content-main silently sized itself to its widest
     nowrap descendant (the bar grid, the structure-strip ticker) instead
     of the actual (narrow) viewport — the real root cause of the chart
     and structure strip both running off the right edge on a phone,
     underneath and independent of the bar-grid's own reflow fix (that
     fix only controls overflow WITHIN a staff-line row at a given
     container width; it can't help if the container itself never
     shrinks to the viewport in the first place). stretch here is exactly
     what a single stacked column needs: every child full width. */
  .content-row { flex-direction: column; align-items: stretch; gap: 0; }
  /* The sidebar (transport + structure rail) used to sit ABOVE the chart
     in normal document flow on a phone — on a longer song that was 800+px
     of controls to scroll past before the chart itself even appeared (see
     applyPageBox's own notes on jazz mode never fitting one screen
     because of exactly this). It's now an off-canvas sheet instead: the
     chart is full-screen by default, and a single floating button pulls
     the controls up over it on demand. Lyrics mode keeps its own existing
     always-visible compact rail (see the body:has() block below) — this
     block is for every other mode. */
  .timeline {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 55;
    max-height: 75vh; width: auto; flex: none;
    background: var(--bg); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg, var(--shadow));
    padding: 0.6rem 0.3rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    transform: translateY(calc(100% - 2.6rem));
    transition: transform 0.25s ease;
  }
  /* Collapsed, the sheet's own drag-handle strip still peeks above the
     bottom edge — a visible affordance that something is there to pull
     up, not a control that's vanished entirely. */
  .timeline::before {
    content: ""; display: block; width: 2.4rem; height: 0.3rem; border-radius: 999px;
    background: var(--border-strong); margin: 0 auto 0.5rem;
  }
  .timeline.open { transform: translateY(0); }
  .timeline .transport { margin: 0 0.3rem 0.5rem; }
  .mobile-controls-fab {
    display: flex; position: fixed; right: 1rem; bottom: 1rem; z-index: 56;
    width: 3rem; height: 3rem; border-radius: 50%; background: var(--accent); color: var(--accent-contrast);
    align-items: center; justify-content: center; box-shadow: var(--shadow-lg, var(--shadow));
  }
  .mobile-controls-fab .icon { width: 1.3rem; height: 1.3rem; }
  .timeline-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 54;
  }
  .timeline.open ~ .timeline-backdrop, .timeline-backdrop.open { display: block; }

  /* Lyrics-only on a phone used to keep its own always-visible 72px-wide
     vertical rail instead of the off-canvas sheet every other mode gets
     (see the removed body:has() block this comment replaces) — the idea
     being "a reading mode wants where-am-I beside the text, not above
     it". In practice the full transport (play/stop/tap, beat dots, tempo,
     metronome row) does not fit in 72px: it wrapped/overflowed into a
     garbled vertical strip that overlapped the lyrics text, and the
     floating FAB below was ALSO still showing on top of it (the FAB was
     only ever meant for the off-canvas mechanism, but nothing scoped it
     OFF for lyrics mode) — two overlapping control surfaces, one of them
     unreadable. Lyrics mode now gets the exact same off-canvas bottom
     sheet + single FAB as jazz/normal/map: lyrics fill the full width by
     default (this is THE core "phone on a stand, reading lyrics while
     singing" use case the whole app is for), and the one FAB pulls up
     the full transport on demand, same gesture as every other mode. The
     song-structure-strip at the top of .content-main (not .timeline) is
     unaffected by this and keeps doing its "where am I" job, now across
     the full phone width instead of squeezed beside the old rail. */

  /* The structure strip's per-segment text label ("INTRO", "VERSE 1"...)
     has nowhere near enough room per segment on a phone to stay legible —
     it was truncating to "INT…"/"VER…"/"VER…", indistinguishable from
     each other. A singer glancing at it mid-performance needs "what
     section am I in" at a glance, not a row of unreadable ellipses, and
     lyrics mode already prints that same label TWICE, large and
     unambiguous, right at the top of each section's own lyrics (the
     italic section heading and the bold "VERSE 1 · 16 bars" chip right
     below it) — so on a phone, in lyrics mode specifically, the strip
     drops its text and keeps only the tick marks + progress fill: a
     lightweight scrubber showing shape and position (how far into the
     song, how many sections left) without repeating text that already
     reads better inline with the lyrics themselves. Ticks stay tappable
     (title attribute still carries the full label for anyone who taps
     one). Unscoped to lyrics mode elsewhere (desktop, and normal/jazz/map
     on a phone) — those keep the label text as before. */
  body:has(#sheet[data-render-mode="lyrics"]) .structure-seg-label { display: none; }
  body:has(#sheet[data-render-mode="lyrics"]) .song-structure-strip { padding-top: 0.6rem; }

  /* ---- Global bottom tab bar (site-wide nav) + Play page's own
     "view"/"metronome" icon stacks -----------------------------------
     Phase 23: every page now gets ONE persistent, always-reachable
     bottom tab bar (.global-tabbar, below) -- the site's actual
     navigation (Home/Catalog/Bands/Setlists/Profile), present even on
     the Play page. That page previously used THIS SAME fixed-bottom-bar
     slot for its own 5-way view switcher (#mode-segmented); that would
     now collide with the global bar occupying the same strip, and
     "which view of this song" isn't site navigation anyway. So on a
     phone #mode-segmented no longer renders itself as a bar at all --
     it's hidden (desktop keeps the original pill, untouched, see the
     non-mobile rule) -- and Play instead shows one small "View" icon
     (.song-context-bar below) that opens a bottom sheet (.view-stack)
     listing the same 5 modes; selecting a row forwards a real click to
     the hidden #mode-segmented button of the same data-value, so every
     bit of existing JS wiring (wireSegmented, the saved-default
     localStorage logic, the edit-toggle special case) keeps working
     completely untouched -- this is pure addition, not a rewire. The
     metronome/transport sidebar (.timeline) already had an off-canvas
     mobile sheet of its own; its trigger just moves from a floating
     corner FAB into the same context bar, right next to View, so both
     "page tools" live in one slim strip docked just above the (always
     visible) global tab bar instead of one floating circle plus a full
     tab bar of view buttons. --tabbar-h / --context-h are read by both
     bars' content-clearance math below so they all stay in lock-step if
     either height ever changes. */
  /* --context-h now matches --tabbar-h: .song-context-bar switched from a
     horizontal icon+label row to .tabbar's vertical icon-over-label
     layout (see .song-context-bar below), so it needs the same height a
     native tab bar actually uses, not the old shorter single-row figure. */
  :root { --tabbar-h: 3.4rem; --context-h: 3.4rem; }

  /* .tabbar: the generic fixed-bottom-bar component, shared by the
     global nav bar and (structurally, via the same selectors) anything
     else that wants the native-app tab-bar look. Icon-only children
     (<a> or <button>) get a short label generated from data-label --
     checked at 320-375px: five text labels this short never wrap, five
     full action names (as #mode-segmented tried, desktop-only) would. */
  .tabbar {
    position: fixed; left: 0; right: 0; z-index: 60;
    display: flex; flex-wrap: nowrap; margin: 0; width: auto; height: var(--tabbar-h);
    border: none; border-top: 1px solid var(--border); border-radius: 0;
    background: var(--bg-raised); padding: 0 0 env(safe-area-inset-bottom, 0px);
    box-shadow: var(--shadow-lg, var(--shadow)); list-style: none;
  }
  .tabbar > a, .tabbar > button {
    flex: 1 1 0; width: auto; height: 100%; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
    border-radius: 0; font-size: 0.62rem; color: var(--fg-muted); text-decoration: none;
    background: none; border: none;
  }
  .tabbar .icon { width: 1.35rem; height: 1.35rem; }
  .tabbar > a::after, .tabbar > button::after { content: attr(data-label); display: block; line-height: 1; }
  /* Active state: color + a top indicator bar, the same "accent color +
     accent bar" convention already used for the current section
     elsewhere (.structure-seg's own tick+label, .sheet-section's
     current-section underline) -- a solid fill-swap would paint one of
     five equal-width tabs as a jarring full-height block here. */
  .tabbar > a.active, .tabbar > button.active { color: var(--accent); font-weight: 600; }
  .tabbar > a.active::before, .tabbar > button.active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 1.6rem; height: 0.15rem; border-radius: 0 0 999px 999px; background: var(--accent);
  }

  .global-tabbar { bottom: 0; }

  /* Notes moves into the View stack's own row on mobile (#notes-stack-row
     below) -- the top-bar button is desktop-only. */
  button.topbar-notes-btn { display: none; }
  /* Reference moves into the View stack's own row on mobile
     (#reference-stack-row) -- same reasoning as Notes above. */
  button.topbar-reference-btn { display: none; }

  /* Phase 41: the PDF export mode-picker row, "versions" and "history" --
     all three used to render inline in the mobile top bar with no
     treatment of their own, visually colliding with the phone's status
     bar (a real reported bug, screenshot-confirmed: looked like
     unstyled debug output dropped at the top of the page). They now
     have a proper mobile home inside #song-stack (below); this one
     class just removes their desktop-only top-bar instance from mobile
     entirely, the same "hide, don't awkwardly reflow" treatment
     .topbar-notes-btn/.topbar-reference-btn above already use. */
  /* .song-topbar prefix, not a bare .topbar-desktop-only class selector:
     .pdf-mode-row's own unconditional `display: inline-flex` rule lives
     LATER in this file (it's shared with other pages' PDF-export links),
     so a same-specificity single-class rule here lost the cascade at
     this exact viewport despite the media query matching -- confirmed
     live (computed display stayed "flex") before landing on this fix. */
  .song-topbar .topbar-desktop-only { display: none; }

  /* Phase 41: on the Play page specifically, .global-tabbar is replaced
     by the new "..." full-page nav entry in .song-context-bar -- a
     whole permanently-visible bar of site nav competed for screen height
     against this page's own "song actions" bar, which the user asked to
     consolidate. Scoped to pages that actually render .song-context-bar
     (only play.html) via :has(), so every other page's .global-tabbar
     (home, catalog, bands, etc.) is completely unaffected -- confirmed
     by checking: nothing else in this codebase renders
     .song-context-bar. */
  body:has(.song-context-bar) .global-tabbar { display: none; }

  /* #mode-segmented: no longer a bar on mobile -- see the comment block
     above. The desktop pill (the default, non-mobile rule) is completely
     untouched; this only applies inside the 900px breakpoint. */
  #mode-segmented { display: none; }

  /* Song Map now reflows through the exact same JS pass as Chords+lyrics
     (reflowMapLines, song.js — sibling to reflowStaffLines, same capacity
     math) instead of a separate CSS-only flex-wrap fallback: every row is
     already rebuilt, client-side, at exactly the bar count this viewport
     can hold, so there is nothing left for mobile-only CSS to do here. */

  /* Jazz chart: bars are content-sized now (flex:0 0 auto, see the real-
     iReal-Pro-fidelity pass — a bar with 3 chords is genuinely wider
     than a 1-chord bar), which applyPageBox's own font-shrink/column-
     search (song.js) can't always resolve down to zero overflow on a
     narrow phone — its own documented fallback at that point is
     overflow-x:auto on #sheet itself, i.e. a horizontally-scrollable
     ROW inside the card. That's a bad touch interaction on mobile
     (confirmed live: a row visibly cut off mid-bar, scrollable only by
     noticing and swiping sideways within the card) — real iReal Pro's
     own mobile app just shows fewer bars on that line instead. Letting
     the row wrap here means a line that doesn't fit continues onto its
     own next line within the card, same fallback already used for Song
     Map, rather than hiding content behind a silent side-scroll. */
  #sheet[data-render-mode="jazz"] .staff-line {
    flex-wrap: wrap;
  }

  /* ---- Song context bar: View + Metronome + Song + More, THE bottom bar
     on this page — .global-tabbar is hidden here (see body:has() rule
     below), so this docks at the real bottom (bottom: 0), not floating
     above a now-nonexistent second bar. Styled like .tabbar (icon over
     label, no column dividers) so it reads as a native app tab bar, not
     a different one-off control. */
  .song-context-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 59;
    display: flex; height: var(--context-h);
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    background: var(--bg-raised); border-top: 1px solid var(--border);
    box-shadow: var(--shadow-lg, var(--shadow));
  }
  .song-context-bar button, .song-context-bar a, .song-context-bar .context-bar-disabled {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
    background: none; border: none;
    color: var(--fg-muted); font-size: 0.58rem; font-weight: 600;
    text-decoration: none; white-space: nowrap;
  }
  .song-context-bar button.active, .song-context-bar a.active { color: var(--accent); }
  .song-context-bar .icon { width: 1.3rem; height: 1.3rem; }
  /* No next song (last song in the book/setlist) — stays in place as a
     disabled slot rather than disappearing, so the bar keeps its 6 even
     columns instead of the remaining items reflowing wider. */
  .song-context-bar .context-bar-disabled { opacity: 0.35; }

  /* ---- View stack: a bottom sheet listing the 5 view modes ---------- */
  .stack-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 61;
  }
  .stack-backdrop.open { display: block; }
  .stack-sheet {
    position: fixed; left: 0; right: 0; bottom: var(--context-h); z-index: 62;
    /* Closed state must clear its own height PLUS the "bottom" offset
       above (.song-context-bar, the one fixed bar it's docked above —
       .global-tabbar is hidden on this page, so there's no second bar's
       height to add here any more) to land fully off-screen — 110% of
       its own height alone isn't enough once that offset is non-trivial,
       unlike .timeline (anchored at bottom: 0 in its own closed/peek
       state, where a plain percentage is enough). */
    transform: translateY(calc(100% + var(--context-h) + env(safe-area-inset-bottom, 0px) + 1rem));
    transition: transform 0.2s ease;
    background: var(--bg); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg, var(--shadow));
    padding: 0.6rem 0 calc(0.6rem + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - var(--context-h) - 2.5rem); overflow-y: auto; overscroll-behavior: contain;
  }
  .stack-sheet.open { transform: translateY(0); }
  .stack-sheet-row {
    display: flex; align-items: center; gap: 0.8rem; width: 100%;
    padding: 0.7rem 1.1rem; background: none; border: none; text-align: left;
    font-size: 0.95rem; color: var(--fg);
  }
  .stack-sheet-row.active { color: var(--accent); font-weight: 600; }
  .stack-sheet-label {
    padding: 0.7rem 1.1rem 0.3rem; border-top: 1px solid var(--border); margin-top: 0.3rem;
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-faint);
  }
  .stack-sheet-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.2rem 1.1rem 0.4rem; }
  .stack-sheet-chips button { display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 999px; padding: 0.4rem 0.8rem; font-size: 0.88rem; text-transform: capitalize; }
  .stack-sheet-chips button.active { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-bg); font-weight: 600; }
  .stack-sheet-notation .notation-pickers { justify-content: flex-start; padding: 0.3rem 1.1rem 0.4rem; margin: 0; flex-wrap: wrap; font-size: 0.9rem; }
  .stack-sheet-notation:empty { display: none; }
  .stack-sheet-row.stage-mode-toggle { border-top: 1px solid var(--border); margin-top: 0.3rem; }
  /* The inline tab/staff pickers move into the View sheet on phones. */
  .song-topzone .notation-pickers { display: none; }
  /* The structure strip on a phone: section names and bar counts, big
     enough to tap; the chord list under each is too small to read. */
  .structure-seg-chords { display: none; }
  .song-structure-strip { padding-top: 0.6rem; }
  .structure-line, .structure-fill { top: 0.75rem; }
  .structure-seg { flex: var(--bars, 1) 0 auto; min-width: max-content; min-height: 2.6rem; padding-right: 0.8rem; }
  .structure-seg-label { overflow: visible; }
  .structure-seg-label { font-size: 0.74rem; }
  .stack-sheet-row .icon { width: 1.25rem; height: 1.25rem; flex: none; }
  /* #song-stack reuses .stack-sheet-row for its versions/history <a>
     rows, but its PDF-export row is a <div> wrapper around three
     different controls (link/select/checkbox), not one tappable row --
     give it room to wrap instead of forcing everything onto one line. */
  .stack-sheet-row.pdf-mode-row { flex-wrap: wrap; }
  .stack-sheet-row.pdf-mode-row .pdf-export-link {
    display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--accent);
  }
  .stack-sheet-row.pdf-mode-row .icon { width: 1.1rem; height: 1.1rem; }

  /* ---- "..." full-page site navigation (Phase 41) -------------------
     A genuine full-screen takeover, not another bottom sheet -- it has
     no "closed resting position" transform math (unlike .stack-sheet):
     plain display:none/.open, since it fills the whole viewport outright
     rather than sliding up from an edge. Sits above everything else on
     the page (z-index higher than .stack-sheet's 62). */
  .site-nav-fullpage {
    display: none; position: fixed; inset: 0; z-index: 80;
    flex-direction: column; background: var(--bg);
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  }
  .site-nav-fullpage.open { display: flex; }
  .site-nav-fullpage-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.2rem; border-bottom: 1px solid var(--border);
  }
  .site-nav-fullpage-header h2 { margin: 0; font-size: 1.15rem; }
  .site-nav-fullpage-row {
    display: flex; align-items: center; gap: 1rem; width: 100%;
    padding: 1.1rem 1.3rem; text-decoration: none; color: var(--fg);
    font-size: 1.05rem; font-weight: 600; border-bottom: 1px solid var(--border);
  }
  .site-nav-fullpage-row .icon { width: 1.5rem; height: 1.5rem; flex: none; color: var(--accent); }
  .site-nav-fullpage-row[hidden] { display: none; } /* its own display:flex would otherwise beat the [hidden] UA rule */
  .site-nav-fullpage-theme {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.3rem; font-weight: 600; color: var(--fg);
  }
  .site-nav-fullpage-theme > span { display: flex; align-items: center; gap: 1rem; }
  .site-nav-fullpage-theme > span .icon { width: 1.5rem; height: 1.5rem; color: var(--accent); }

  /* The transport FAB is retired on mobile -- its old role (open the
     .timeline sheet) is now the Metronome button in .song-context-bar,
     which sits in-flow in that bar rather than floating. */
  .mobile-controls-fab { display: none !important; }

  /* The .song-context-bar's Metronome entry is now a plain link to the
     dedicated /metronome page (see play.html), not a trigger for this
     sheet -- nothing on mobile opens .timeline any more, so hide it
     outright rather than relying on its "closed" translateY state. That
     state was never fully off-screen anyway: .timeline sits at
     `bottom: <tabbar-h + context-h>` (below), so translateY(100%) -- 100%
     of its OWN height -- stops short by exactly that bottom offset,
     leaving a real sliver of the play/stop/tap row visible above the
     bottom bars even "closed". That's the actual root cause of the
     peeking-panel bug reported earlier this session (misdiagnosed then
     as a stale-cache artifact); real fix on mobile is to not render the
     sheet at all, since it's unreachable now anyway. */
  .timeline { display: none !important; }

  /* The .timeline sheet's resting position (and the view-stack's,
     above) must clear BOTH fixed bars now, not just one. */
  .timeline { bottom: calc(var(--tabbar-h) + var(--context-h) + env(safe-area-inset-bottom, 0px)); }

  /* .timeline's own collapsed state (translateY(calc(100% - 2.6rem)),
     above) was tuned back when the sheet sat flush against the real
     bottom edge of the viewport and its own peeking drag-handle was the
     only way to discover it was there. Now that it's anchored above the
     context bar + tab bar instead, that same 2.6rem peek floats mid-page
     -- a visible sliver of drag-handle and the top of the play/stop/tap
     buttons sitting over the chart content, not at a screen edge, which
     reads as broken rather than as an affordance. Discovery is now the
     explicit Metronome button in .song-context-bar, so the peek is
     redundant as well as broken: fully hide the sheet when closed. */
  .timeline { transform: translateY(100%); }
  .timeline.open { transform: translateY(0); }

  /* Content clearance: every mode's scrollable content (chart grid,
     lyrics, song map) must never end up hidden behind the two fixed
     bars -- the same class of overlap bug already flagged twice this
     session (the chart overflow, the lyrics-mode sidebar), so checked
     explicitly here for all four modes at 375px, scrolled to a song's
     last line. */
  .content-main { padding-bottom: calc(var(--context-h) + env(safe-area-inset-bottom, 0px) + 1rem); }
  body:not(:has(#sheet)) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
}

@media (min-width: 901px) {
  /* .site-nav-fullpage included here too: its only base rule is the
     mobile-breakpoint display:none (it has no .open-only trigger on
     desktop, since .song-context-bar/the "..." button that opens it are
     already hidden here) -- without an explicit desktop rule it fell
     back to the browser's default display:block and showed permanently
     on every Play page at desktop width, confirmed live before writing
     this fix. */
  .global-tabbar, .song-context-bar, .stack-sheet, .stack-backdrop, .site-nav-fullpage { display: none; }

  /* ---- Desktop sidebar shell -------------------------------------------
     Every top-level authenticated page now renders {{template
     "desktop-sidebar"}} as the first child of <body>, immediately followed
     by a <div class="app-content"> wrapping that page's existing
     <header class="app-header">/<main> — see the Phase 28 brief. Below
     900px, body stays plain block flow (unchanged from Phase 27) and the
     sidebar renders nothing (display:none from its own base rule above);
     here, body becomes a flex row so the sidebar and .app-content sit side
     by side, sidebar fixed width, content filling the rest. Pages that
     don't use this wrapper (Play's own already-redesigned chrome from
     Phases 23-25, and unauthenticated/jam pages that never render the
     sidebar partial at all) are simply unaffected — .app-content only
     matters on pages that have it. */
  body:has(> .desktop-sidebar) { display: flex; align-items: stretch; min-height: 100vh; }
  .desktop-sidebar { display: flex; }
  .app-content { flex: 1 1 auto; min-width: 0; }

  /* The old flat text-link header nav duplicates what the sidebar now
     covers (Home/Catalog/Bands/Setlists/Profile/Admin as sidebar items;
     the home-link "&larr; Songbooks" partial as sidebar's own Home). Hide
     exactly those, by exact href match, rather than hiding .song-nav/
     .app-header wholesale — every page's OTHER header content (page
     title, a contextual back-link to a parent resource, action buttons
     like Import/+project/PDF export, the notif bell) is not a nav
     duplicate and stays visible, so .app-header keeps working as each
     page's own slim utility strip above its content. */
  .back-link[href="/"] { display: none; }
  .song-nav a[href="/metronome"],
  .song-nav a[href="/setlists"],
  .song-nav a[href="/catalog"],
  .song-nav a[href="/bands"],
  .song-nav a[href="/profile"],
  .song-nav a[href="/admin"] { display: none; }
}

/* Editor sidebar coexistence: while the desktop editor is open
   (body.drawer-open, the same class the dirty-tracking/history logic
   already toggles), the sidebar's global nav/"This song" group/account row
   step aside for one "← Back to Play" row — Guitar Pro 8 hides its own
   side panels to focus the toolbar+workspace at this 1/3+2/3 split, and a
   full 5-item nav plus a 7-row "This song" group would be cramped and
   redundant next to an editor that already has its own save/close
   controls. The brand/logo link stays, so site identity doesn't vanish
   mid-edit. Hidden by default (including on mobile, which has no
   .desktop-sidebar to begin with); shown only under the condition below. */
.sidebar-back-to-play { display: none; }
/* The GP8-style toolbox (sections list + chord/beat entry) that fills this
   slot while editing — see #sidebar-toolbox in play.html and
   renderFocusEditor/renderMatrix in song.js, which populate it directly;
   this file only shows/hides and themes it. Hidden outside drawer-open
   (and always on the <901px/mobile editor, which uses renderBlocksList's
   inline toolbar instead — see song.js's focusModeActive). */
.sidebar-toolbox { display: none; }
@media (min-width: 901px) {
  body.drawer-open .sidebar-crumb,
  body.drawer-open .sidebar-primary,
  body.drawer-open .sidebar-secondary,
  body.drawer-open .sidebar-song-group,
  body.drawer-open .sidebar-account { display: none; }
  body.drawer-open .sidebar-back-to-play {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem;
    margin: 0.4rem 0.6rem; border-radius: 6px; font-weight: 600;
  }
  body.drawer-open .sidebar-back-to-play:hover { background: var(--bg-sunken); }
  body.drawer-open .sidebar-toolbox {
    display: flex; flex-direction: column; min-height: 0; flex: 1; overflow-y: auto;
    padding: 0 0 0.6rem;
  }
}

/* ---- Sidebar toolbox theming — same dark rail vars every other sidebar
   row already uses (--sidebar-fg/bg/border/active-*), not the light-app
   --bg-sunken/--border the toolbar/matrix-tools were built with for their
   OTHER home (mobile's inline white card). Scoped under .sidebar-toolbox
   so that other, unrelated use of .chord-toolbar/.toolbar-btn (mobile,
   and the plain .bar-matrix used by block-body on narrower drawers) is
   untouched. ------------------------------------------------------------ */
.toolbox-sections { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.5rem; }
.tbx-sec-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.4rem 1rem; color: var(--sidebar-fg); font-size: 0.85rem; text-align: left;
  background: none; border-radius: 0;
}
.tbx-sec-row:hover { background: color-mix(in srgb, var(--sidebar-fg) 10%, transparent); }
/* Stronger than the plain nav-row active state (--sidebar-active-bg is a
   subtle dark-on-dark shift, barely readable as "this one, not those" when
   every row in the list is a similar short word like "Verse"/"Verse"/
   "Verse" — confirmed hard to spot live). A solid accent left bar + the
   accent color itself on the text, not just a background tint. */
.tbx-sec-row.active {
  background: var(--sidebar-active-bg); color: var(--accent); font-weight: 700;
  border-left: 3px solid var(--accent); padding-left: calc(1rem - 3px);
}
.tbx-sec-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbx-sec-count { flex: none; opacity: 0.65; font-size: 0.78rem; }
.tbx-sec-add {
  padding: 0.4rem 1rem; color: color-mix(in srgb, var(--sidebar-fg) 65%, transparent);
  font-size: 0.8rem; text-align: left; background: none;
}
.tbx-sec-add:hover { color: var(--sidebar-fg); }
.sidebar-toolbox .chord-toolbar {
  border-top: 1px solid var(--sidebar-border); padding: 0.7rem 1rem 0.2rem; margin: 0;
  background: none; position: static;
}
.sidebar-toolbox .chord-toolbar-meta,
.sidebar-toolbox .toolbar-slot-label { color: color-mix(in srgb, var(--sidebar-fg) 70%, transparent); }
/* The light-theme pill (--bg-sunken background, light border) was never
   overridden for the dark sidebar — pale text (--sidebar-fg) on a pale
   background, unreadable (confirmed live). It also reads as a second
   editable field next to the real song-level time/tempo inputs (#song-
   header-fields, the one true input location), which it isn't: this is
   a read-only context readout. Dropped the pill/border entirely in
   favor of plain muted text, so it neither hides itself nor gets
   mistaken for an input. */
.sidebar-toolbox .toolbar-meta-chip {
  color: var(--sidebar-fg); background: none; border: none; padding: 0; font-weight: 600;
}
.sidebar-toolbox .toolbar-btn {
  background: color-mix(in srgb, var(--sidebar-fg) 8%, transparent);
  border: 1px solid var(--sidebar-border); color: var(--sidebar-fg);
}
.sidebar-toolbox .toolbar-btn:hover { background: color-mix(in srgb, var(--sidebar-fg) 16%, transparent); }
.sidebar-toolbox .toolbar-btn.active, .sidebar-toolbox .toolbar-btn.pending {
  background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); border-color: var(--sidebar-active-bg);
}
.sidebar-toolbox .chord-toolbar.no-selection .toolbar-row .toolbar-btn:not(.toolbar-acc) { opacity: 0.45; }
.sidebar-toolbox .matrix-tools { padding: 0.5rem 1rem 0.8rem; border-top: 1px solid var(--sidebar-border); margin: 0; }
.sidebar-toolbox .matrix-tools summary { color: color-mix(in srgb, var(--sidebar-fg) 75%, transparent); }
.sidebar-toolbox .matrix-toolbar { color: var(--sidebar-fg); }
.sidebar-toolbox .matrix-toolbar button {
  background: color-mix(in srgb, var(--sidebar-fg) 8%, transparent);
  border: 1px solid var(--sidebar-border); color: var(--sidebar-fg);
}
.sidebar-toolbox .matrix-toolbar input {
  background: color-mix(in srgb, var(--sidebar-fg) 8%, transparent);
  border: 1px solid var(--sidebar-border); color: var(--sidebar-fg);
}

/* Chord symbol typesetting — Brandt & Roemer style (see internal/chordsym):
   bold root, small raised quality, triangle for maj7, minor below the
   baseline, real flat/sharp glyphs. */
.csym { font-weight: 400; white-space: nowrap; font-family: var(--font-chart); font-size: 1.4rem; }
.csym-plain { font-style: italic; }
.csym-root { font-weight: 700; }
.csym-triangle { font-size: 0.62em; font-weight: 700; vertical-align: 0.5em; margin: 0 0.02em; }
.csym-minor { font-size: 0.6em; font-weight: 700; vertical-align: -0.15em; margin: 0 0.02em; }
.csym-ext { font-size: 0.62em; font-weight: 700; vertical-align: 0.5em; margin-left: 0.02em; }
.csym-dim { font-size: 0.62em; font-weight: 700; vertical-align: 0.5em; margin: 0 0.02em; }
.csym-bass { font-size: 0.9em; margin-left: 0.04em; }

/* ---- Edit drawer (merged prep/play) --------------------------------------- */
/* "Edit" opens the source/structure editor as a near-fullscreen modal, not
   an inline drawer competing with the chart for page space — the user
   asked for this explicitly ("almost full screen, with a textarea and a
   toolbar"), matching the #song-wizard dialog already used elsewhere in
   the app for a similar "big focused editing surface" moment. */
.edit-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 99;
}
body.drawer-open { overflow: hidden; }
/* :not([hidden]) for the same reason as .prep-panel below — an author
   class rule has the same specificity as the UA [hidden]{display:none}
   rule and would otherwise win the tie, showing the modal on every page
   load regardless of the hidden attribute. */
.edit-drawer:not([hidden]) {
  position: fixed; inset: 3vh 4vw; margin: 0; z-index: 100;
  display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
/* On a phone, the editor is a real in-place full-screen VIEW, not a
   dialog floating over a dimmed page — iReal Pro's own editor is a mode
   the chart switches into, never a popup. The backdrop stays in the DOM
   (closing logic/ARIA are unchanged) but is fully covered and invisible
   once the drawer itself fills the viewport, so nothing reads as "a card
   over a dimmed background" any more. */
@media (max-width: 760px) {
  .edit-drawer:not([hidden]) {
    inset: 0; border-radius: 0; box-shadow: none;
  }
}
/* Desktop (≥901px, the same threshold the sidebar/global-tab-bar split
   already uses): editing used to be a fullscreen VIEW the same way mobile
   is — but a `position:fixed;inset:0` overlay sits ABOVE the real
   `.desktop-sidebar` (z-index 100 vs. the sidebar's own stacking context),
   so opening the editor hid the site's nav chrome entirely and replaced it
   with nothing, rather than the "editor fits in the nav bar design,
   integrated back into the website" the user asked for. `.edit-drawer` is
   already a sibling of `.song-topbar`/`.content-row` INSIDE `.app-content`
   (see play.html) — `.app-content` itself already sits beside
   `.desktop-sidebar` in the page's normal flex-row layout, so the fix is
   simply to stop escaping that flow here: no `position:fixed`, fill
   `.app-content`'s own box instead of the viewport. The real sidebar
   stays exactly where it already was; only its CONTENT changes while
   editing (see `.sidebar-back-to-play` below). The 761–900px tablet band
   keeps the original floating-card behavior — the user's own spec only
   named "desktop" and "mobile". */
@media (min-width: 901px) {
  .edit-drawer:not([hidden]) {
    position: static; inset: auto; height: 100vh; border-radius: 0; box-shadow: none;
  }
  .edit-drawer-backdrop { display: none; }
  /* The chart/topbar this editor replaces — hidden while editing so the
     static-flow drawer above doesn't just stack on top of them (nothing
     else here pulls them out of flow for us now that the drawer no longer
     does via position:fixed). */
  body.drawer-open .song-topzone,
  body.drawer-open .content-row { display: none; }
}
/* Same cream "sunken" band as the read-only song page's .song-topzone —
   title + obvious Save/Discard first, the Chart/Source tab row directly
   below it, matching the song view's title-row-then-tabs layout rather
   than a bare icon strip. Not literally `.song-topzone` itself: that
   class is force-hidden by `body.drawer-open .song-topzone` (the real
   topbar underneath the drawer), which would also hide this one. */
.edit-topzone { background: var(--bg-sunken); border-bottom: 1px solid var(--border); }
.edit-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.7rem 1rem 0.5rem; flex-wrap: wrap; }
.edit-title-main { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.edit-title-main h2 { margin: 0; font-size: 1.1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-title-actions { display: flex; align-items: center; gap: 0.5rem; }
.edit-topzone .prep-tabs { display: inline-flex; flex-wrap: wrap; justify-content: center; margin: 0 auto 0.7rem; gap: 0.15rem; }
.edit-topzone { text-align: center; }
.edit-title-row, .edit-drawer-body { text-align: left; }
.edit-topzone .prep-tab { background: none; border: none; border-radius: 999px; padding: 0.5rem 0.9rem; font-size: 0.85rem; color: var(--fg-muted); }
.edit-topzone .prep-tab:hover { color: var(--fg); }
.edit-topzone .prep-tab.active { background: var(--accent); color: var(--bg-raised); border-color: transparent; font-weight: 600; }
.edit-drawer-body { padding: 1rem; flex: 1; overflow: auto; display: flex; flex-direction: column; min-height: 0; }
/* Notes drawer (play.html): the drawer header's own <h2> and the per-
   section notes blocks had their layout as four one-off inline `style=`
   attributes instead of rules here — moved onto named classes so a
   future spacing-scale pass can reach them. */
.edit-drawer-head h2 { margin: 0; }
.notes-section { display: block; padding: 0.75em 0; border-bottom: 1px solid var(--border); }
.notes-section h3 { margin: 0.25em 0; }
.note-body { width: 100%; }
/* Tucked away and collapsed by default, well below Save — this erases
   lyrics/chords (not the song itself), which the old icon-only trash
   button in the top bar read as "delete the song" at a glance. */
.danger-zone { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); flex: none; }
.danger-zone summary { cursor: pointer; color: var(--fg-muted); font-size: 0.85rem; }
.danger-zone p.hint { margin: 0.5rem 0; }
/* :not([hidden]) — a bare class selector here would have the same
   specificity as the UA stylesheet's own [hidden] { display: none }, and
   as an AUTHOR rule it would win the tie, silently un-hiding whichever
   prep-panel isn't the active tab (both panels rendering stacked at once
   was the actual bug this caused). */
.edit-drawer-body .prep-panel:not([hidden]) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.edit-drawer-body .code-editor { flex: 1; min-height: 0; }
.edit-drawer-body #raw-text, .edit-drawer-body .code-backdrop { height: 100%; }
.prep-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.prep-tab { padding: 0.4rem 0.9rem; border-radius: 999px; }
.prep-tab.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* Import wizard — find (auto or manual) / review, one step visible at a
   time. Ultimate-Guitar-only (see song.js's own doc comment on
   wireImportWizard) — the old pick-lyrics-vs-chords step and its two
   buttons are gone; "find" opens straight on the one-click automatic
   path, with the manual search-link+paste-URL fallback tucked behind
   a <details> disclosure instead of competing for attention. */
.import-wizard { gap: 0; }
.import-step { max-width: 34rem; }
.import-manual-details { margin-top: 1rem; font-size: 0.9rem; }
.import-manual-details summary { cursor: pointer; color: var(--fg-muted); }
.import-manual-details summary:hover { color: var(--fg); }
.import-manual-details[open] summary { margin-bottom: 0.5rem; }
.import-back { background: none; border: none; padding: 0.2rem 0; margin-bottom: 0.6rem; color: var(--fg-muted); display: inline-flex; align-items: center; gap: 0.3em; }
.import-back:hover { color: var(--fg); }
.import-back .icon { width: 0.9em; height: 0.9em; }
.import-search-links { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.5rem 0 1rem; }
.import-search-link {
  display: inline-block; padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-sunken); font-size: 0.85rem;
}
.import-search-link:hover { border-color: var(--border-strong); }
.import-url-label { display: block; font-size: 0.85rem; color: var(--fg-muted); margin-bottom: 0.3rem; }
.import-url-label input[type="url"] { display: block; width: 100%; margin-top: 0.3rem; }
.import-row { display: flex; align-items: center; gap: 0.75rem; margin: 0.75rem 0 0; flex-wrap: wrap; }
/* admin_person.html's membership rows ("band: The Thing  [role v] [remove]")
   need their label column to line up down the list — scoped to this one
   row shape rather than widening every .import-row's <strong> (band_events/
   event/project reuse .import-row for plain one-off rows with no column to
   align). */
.membership-row-label { min-width: 9rem; }
.import-review-text { font-family: var(--font-mono); font-size: 0.9rem; }
.import-strip-chords-label { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; font-size: 0.9rem; color: var(--fg-muted); }

.import-ireal-block { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px dashed var(--border); }
.import-ireal-candidates { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.import-ireal-candidate { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.75rem; background: var(--bg-sunken); }
.import-ireal-candidate.is-safe { border-color: var(--border-strong); }
.import-ireal-candidate-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.import-ireal-candidate-label { font-weight: 600; }
.import-ireal-candidate-flag { font-size: 0.8rem; color: var(--fg-muted); }
.import-ireal-candidate-flag.is-safe { color: var(--accent); }
.import-ireal-candidate-grids { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0.4rem 0; font-family: var(--font-mono); font-size: 0.85rem; }
.import-ireal-candidate-grids > div { overflow-wrap: anywhere; }
.import-ireal-candidate-grids .label { display: block; font-family: var(--font-sans); font-size: 0.75rem; color: var(--fg-muted); margin-bottom: 0.15rem; }
.import-ireal-candidate-actions { display: flex; align-items: center; gap: 0.5rem; }
.import-ireal-candidate-actions label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; }

textarea {
  width: 100%; font-family: var(--font-mono); font-size: 0.95rem;
  background: var(--bg-raised); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem;
}

/* ---- Syntax-highlighted raw editor (toolbar + textarea-over-<pre>) ------- */
.code-toolbar { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; align-items: flex-start; position: relative; }
.toolbar-menu { position: relative; }
.toolbar-menu > summary {
  list-style: none; cursor: pointer; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.3rem 0.6rem; font-size: 0.85rem; background: var(--bg-raised); color: var(--fg);
}
.toolbar-menu > summary::-webkit-details-marker { display: none; }
.toolbar-menu[open] > summary { border-color: var(--accent); }
.toolbar-menu-body {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 0.15rem; min-width: 10rem;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.35rem; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.toolbar-menu-body button { text-align: left; border: none; background: none; padding: 0.35rem 0.5rem; border-radius: 5px; font-size: 0.85rem; }
.toolbar-menu-body button:hover { background: var(--bg-sunken); }
.toolbar-menu-custom { display: flex; gap: 0.25rem; margin-top: 0.25rem; padding-top: 0.35rem; border-top: 1px solid var(--border); }
.toolbar-menu-custom input { flex: 1; min-width: 0; font-size: 0.85rem; padding: 0.25rem 0.4rem; border: 1px solid var(--border); border-radius: 5px; }
.code-toolbar-help { margin-left: auto; font-size: 0.82rem; color: var(--fg-muted); white-space: nowrap; }
.code-toolbar-help:hover { color: var(--fg); }
.code-toolbar button { font-size: 0.78rem; padding: 0.3rem 0.6rem; font-family: var(--font-mono); }
.code-editor { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.code-editor textarea, .code-backdrop {
  margin: 0; padding: 0.75rem; font-family: var(--font-mono); font-size: 0.95rem; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word;
}
.code-editor textarea {
  position: relative; width: 100%; border: none; border-radius: 0; background: transparent;
  color: transparent; caret-color: var(--fg); resize: vertical; z-index: 1;
}
.code-backdrop {
  position: absolute; inset: 0; margin: 0; overflow: auto; background: var(--bg-raised);
  color: var(--fg); pointer-events: none; z-index: 0;
}
.code-backdrop code { font-family: inherit; white-space: inherit; }
/* One <div> per source line (see song.js's renderHighlight) instead of
   one big innerHTML string joined by "\n" — needed for incremental
   per-line patching, so each div must occupy exactly the space a real
   line break did, no default block margin added. */
.code-backdrop code > div { margin: 0; min-height: 1em; }
/* Color only — no font-weight/font-style on any token. This overlay works
   by rendering the real <textarea>'s text fully transparent and drawing
   the highlighted copy in a <pre> sitting exactly behind it (code-backdrop
   above): the two only stay pixel-aligned, cursor included, as long as
   every character in the backdrop occupies EXACTLY the advance width its
   invisible twin in the textarea does. A bold or italic span can widen a
   "monospace" font's glyphs just enough to drift the backdrop out from
   under the real cursor a few characters later on the line — a direct
   report ("the editor gets easily confused with where the cursor is
   editing vs displayed"), worse the longer a highlighted token's line
   gets. Color changes a glyph's paint, never its advance width, so this
   is the one styling axis this technique can use safely. */
.tok-header-key { color: var(--accent); }
.tok-section { color: var(--accent); }
.tok-keyword { color: var(--ok); }
.tok-chord { color: var(--accent); }
.tok-comment { color: var(--fg-muted); }
.editor-actions, .structure-actions { margin-top: 0.75rem; display: flex; gap: 1rem; align-items: center; }
.hint { color: var(--fg-muted); font-size: 0.88rem; }

/* Two-pane Source editor (desktop only — a narrow viewport has no room
   for a real second column, so it stacks there instead, same as the
   .code-editor above it already does at phone width). */
.code-editor-row { display: flex; flex-direction: column; gap: 0.75rem; min-height: 0; flex: 1; }
.source-preview-pane { display: none; flex-direction: column; gap: 0.4rem; min-width: 0; }
.source-preview-pane #source-preview-instruments { margin: 0; align-self: flex-start; }
.source-preview {
  flex: 1; overflow: auto; padding: 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-sunken); /* matches #sheet's own
    real background (.song-topzone) — was --bg-raised (card white),
    visibly wrong next to the real chart's cream, a direct report. */
}
@media (min-width: 960px) {
  .code-editor-row { flex-direction: row; }
  .code-editor-row .code-editor { flex: 1 1 50%; min-width: 0; }
  .source-preview-pane { display: flex; flex: 1 1 50%; min-width: 0; }
}

/* Scores tab: per-section score editor + chord-diagram builder. */
.score-section { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.6rem; padding: 0.5rem 0.75rem; }
.score-section summary { cursor: pointer; font-weight: 600; }
.score-section-body { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.score-source { width: 100%; font-family: var(--font-mono); font-size: 0.9rem; padding: 0.5rem; }
.score-section-preview:not(:empty) { padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-raised); overflow-x: auto; }
.score-section-actions { display: flex; gap: 0.75rem; align-items: center; }
/* One of these per track a multi-track score contains (see
   tab.ParseScoreTracks) — the label is what tells an editor "yes, that
   second staff was recognized as drums," not just a second riff that
   happens to look similar. */
.score-track-preview + .score-track-preview { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--border); }
.score-track-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 0.3rem; }

/* Tab editor (tab-editor.js): Guitar Pro–style cursor on an alphaTab
   rendering. The cursor and bar highlight are absolutely placed from
   alphaTab's own bounds lookup, in the canvas's coordinates. */
.tab-editor { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.5rem; }
.te-head { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; flex-direction: column; gap: 0.5rem; padding: 0.4rem 0; }
.te-pickers { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.te-pickers label { display: flex; gap: 0.4rem; align-items: center; font-size: 0.85rem; color: var(--fg-muted); }
.te-pickers select, .te-pickers button { min-height: 0; padding: 0.3rem 0.5rem; font-size: 0.85rem; }
.te-quiet { background: none; border: 1px solid var(--border); border-radius: 3px; color: var(--fg-muted); cursor: pointer; }
.te-gp-link { font-size: 0.85rem; margin-left: auto; }
.te-notice { background: var(--warn-bg); color: var(--fg); padding: 0.4rem 0.6rem; border-radius: 3px; }
.te-toolbar { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.te-toolbar button {
  min-height: 0; padding: 0.25rem 0.5rem; font-size: 0.8rem; line-height: 1.2;
  border: 1px solid var(--border); border-radius: 3px; background: var(--bg-raised); color: var(--fg); cursor: pointer;
}
.te-toolbar button.active { background: var(--accent); color: var(--accent-contrast, var(--bg)); border-color: var(--accent); }
.te-toolbar button:disabled { opacity: 0.45; cursor: default; }
.te-toolbar button.te-selected:not(.active) { border-color: var(--accent); }
.te-pattern { font-size: 0.85rem; color: var(--fg-muted); display: flex; gap: 0.3rem; align-items: center; }
.te-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 0.3rem; }
.te-canvas-wrap {
  position: relative; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-raised);
  padding: 0.25rem; min-height: 8rem; cursor: text; outline: none;
}
.te-canvas-wrap.focused { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.te-canvas-wrap > #te-canvas { position: relative; }
.te-bar-hl { position: absolute; pointer-events: none; background: var(--accent-bg); opacity: 0.45; border-radius: 2px; margin: 0.25rem; }
.te-bar-hl.over { background: var(--danger-bg); opacity: 0.7; }
.te-cursor { position: absolute; pointer-events: none; border: 2px solid var(--accent); border-radius: 2px; margin: 0.25rem; }
.te-canvas-wrap:not(.focused) .te-cursor { opacity: 0.5; }
.te-statusline { font-size: 0.8rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.te-status.warn { color: var(--warn); }
.te-status.err { color: var(--danger); }
.te-note { color: var(--ok); }
.te-pad { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); gap: 0.35rem; padding: 0.5rem; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 4px; }
.te-pad button { min-height: 2.75rem; font-size: 1.1rem; font-variant-numeric: tabular-nums; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-raised); color: var(--fg); touch-action: manipulation; }
.te-pad button.te-pad-move { background: var(--bg); }
#te-pad-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
/* A phone has no room for a pinned header and a pinned keypad: the
   header scrolls away, the keypad stays, in one or two compact rows. */
@media (max-width: 700px) {
  .te-head { position: static; }
  .te-pad { grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); gap: 0.25rem; padding: 0.35rem; }
  .te-pad button { min-height: 2.5rem; }
}
.te-keys summary { cursor: pointer; font-size: 0.85rem; color: var(--fg-muted); }
.te-keys dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; font-size: 0.8rem; margin: 0.5rem 0 0; }
.te-keys dt { font-family: var(--font-mono); color: var(--fg); }
.te-keys dd { margin: 0; color: var(--fg-muted); }

.chord-diagram-editor { display: flex; flex-direction: column; gap: 0.75rem; max-width: 32rem; }
.cde-controls { display: flex; gap: 1rem; flex-wrap: wrap; }
.cde-controls label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--fg-muted); }
.cde-controls input { width: 6rem; }
.cde-grid { display: flex; gap: 0.3rem; }
.cde-col { display: flex; flex-direction: column; gap: 0.2rem; }
.cde-cell {
  width: 2rem; height: 2rem; font-family: var(--font-mono); font-size: 0.85rem;
  border: 1px solid var(--border); border-radius: 4px; background: var(--bg-raised); cursor: pointer;
}
.cde-cell.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.cde-preview:not(:empty) { max-width: 10rem; }
.cde-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.cde-actions code { font-family: var(--font-mono); font-size: 0.85rem; color: var(--fg-muted); }

.gpimport-mapping-table { border-collapse: collapse; margin: 0.75rem 0; }
.gpimport-mapping-table th, .gpimport-mapping-table td { padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; }
.gpimport-step h3 { margin: 0 0 0.5rem; }
/* The align step's OWN content preview — real notation from the GP
   file's native parsed Score (api.renderScore, gp-import.js's own
   renderNotationPreview), not this app's Riff/alphaTeX conversion —
   see that function's doc comment for why. Capped height + scroll
   rather than left to grow to the file's full length unbounded: a
   multi-page score here would otherwise push the actual alignment UI
   (the waveform/boundaries below it) far down the panel. */
#gpimport-content-preview-wrap { margin: 0.5rem 0 1rem; }
#gpimport-content-preview { max-height: 20rem; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; background: var(--bg-raised); }
#gpimport-content-preview .at-surface { cursor: pointer; }

#gpimport-preview { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-raised); max-height: 16rem; overflow-y: auto; }
.gpimport-bar-card { border: 1px solid var(--border); border-radius: 6px; padding: 0.3rem; cursor: pointer; min-width: 5.5rem; transition: background 0.1s; }
.gpimport-bar-card:hover { background: var(--bg-sunken); }
.gpimport-bar-label { font-size: 0.72rem; color: var(--fg-muted); text-align: center; margin-bottom: 0.2rem; }
/* One of these per included section, inside #gpimport-preview's own flex-
   wrap row — real notation, not just the bar-count mapping table step 3
   already showed (see play.html's own comment on #gpimport-preview for
   why). min-width gives alphaTab's own mount real room to lay out a
   short riff legibly; growing lets a section with more bars take more
   of the row instead of every card forcing the same fixed width. */
.gpimport-preview-row { flex: 1 1 18rem; min-width: 18rem; border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; background: var(--bg); }
.gpimport-preview-row .hint { margin: 0 0 0.3rem; font-weight: 600; }
.gpimport-preview-row .alphatab-row { min-height: 6rem; }

/* ---- GP import: Audacity-style align timeline --------------------------
   Deliberately NOT this app's own cream/light chart styling — a dark
   waveform (Audacity's own convention, kept because a direct comparison
   against Guitar Pro's and Audacity's own audio views found it reads
   better than a light one for picking out transients) with a bright
   waveform trace and a bracket-labeled region lane underneath. */
.gpimport-toolbar { display: flex; align-items: center; gap: 0.6rem; margin: 0.5rem 0; flex-wrap: wrap; }
.gpimport-zoom-label { font-family: var(--font-mono); font-size: 0.8rem; color: var(--fg-muted); min-width: 3.2em; text-align: center; }
.gpimport-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.gpimport-timeline { position: relative; height: 200px; background: #201c16; }
#gpimport-waveform { display: block; width: 100%; height: 150px; }
.gpimport-bargrid { position: absolute; top: 0; height: 150px; left: 0; right: 0; pointer-events: none; }
/* Plain .beat1 (this wizard's own estimate — interpolated/extrapolated,
   no real sync data at this exact bar) stays dim; .synced (a REAL GP
   sync point, syncedPositions/buildBarTimes) is the one solid, full-
   opacity line — same "which of these is real file data vs. a guess"
   distinction Guitar Pro's own tempo-map editor draws. */
.gpimport-bargrid .beat1 { position: absolute; top: 0; bottom: 0; width: 1px; background: #c0392b; opacity: 0.45; }
.gpimport-bargrid .beat1.synced { opacity: 1; width: 2px; box-shadow: 0 0 2px rgba(192,57,43,0.8); }
.gpimport-bargrid .beatN { position: absolute; top: 0; bottom: 0; width: 1px; border-left: 1px dashed #d4ac0d; opacity: 0.55; }
.gpimport-bargrid .barnum { position: absolute; top: 2px; font-family: var(--font-mono); font-size: 9.5px; color: #cabb9a; }
.gpimport-bargrid .collapsed-block { position: absolute; top: 0; bottom: 0; background: rgba(255,255,255,0.04); border-left: 1px solid rgba(255,255,255,0.15); border-right: 1px solid rgba(255,255,255,0.15); }
/* The GP file's own section marker (masterBar.section) — a real
   reference point, styled to stand out from the plain bar-number ticks
   it sits alongside rather than blending in with them. */
.gpimport-bargrid .gpimport-gp-marker { position: absolute; bottom: 2px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: #9fe870; white-space: nowrap; transform: translateX(2px); }
.gpimport-playhead { position: absolute; top: 0; height: 150px; width: 2px; background: var(--accent); z-index: 6; pointer-events: none; }
.gpimport-labeltrack { position: absolute; top: 150px; left: 0; right: 0; height: 50px; background: #2b2b2b; border-top: 1px solid #484848; }
.gpimport-section-block { position: absolute; top: 4px; bottom: 4px; display: flex; align-items: center; padding: 0 7px; font-size: 11.5px; font-family: var(--font-mono); color: #eafee0; white-space: nowrap; overflow: hidden; border-left: 2px solid #9fe870; border-right: 2px solid #9fe870; background: rgba(159,232,112,0.12); }
.gpimport-section-block.mismatch { border-color: #e0a858; background: rgba(224,168,88,0.14); color: #ffe9c6; }
.gpimport-boundaries { position: absolute; top: 0; left: 0; right: 0; height: 200px; pointer-events: none; }
.gpimport-boundary { position: absolute; top: 0; height: 200px; width: 10px; margin-left: -5px; cursor: ew-resize; pointer-events: auto; }
.gpimport-boundary::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 2px; background: #9fe870; }
.gpimport-boundary:hover::before, .gpimport-boundary.dragging::before { background: #fff; width: 3px; left: 3.5px; }

.chip-list { display: flex; flex-direction: column; gap: 0.5rem; }
.chip {
  display: flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem;
  background: var(--bg-raised);
}
.chip input[type="text"] { font-size: 1rem; flex: 1; min-width: 6rem; }
.chip .chip-badge { font-size: 0.75rem; color: var(--fg-muted); }
.chip button { font-size: 0.85rem; }
.chip-badge-btn { background: var(--bg-sunken); border-radius: 999px; padding: 0.2rem 0.6rem; }

/* ---- Setlist drag-to-reorder + soft remove -------------------------------
   A hamburger handle is the one thing that starts a drag (not the row
   itself — a note input or the song link would otherwise fight with it).
   The remove button stays nearly invisible until the row is hovered or
   focused, and is small/off to the side, so it's never the thing a stray
   click lands on while reordering or editing a note. */
.drag-handle {
  display: flex; align-items: center; color: var(--fg-muted); cursor: grab;
  padding: 0.2rem; flex: none; touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
.chip.dragging, .set-block.dragging { opacity: 0.4; }
.row-remove {
  margin-left: auto; flex: none; opacity: 0; transition: opacity 0.15s;
  color: var(--fg-muted); padding: 0.3rem; border-radius: 6px; background: none;
}
.chip:hover .row-remove, .chip:focus-within .row-remove,
.set-header:hover .row-remove, .set-header:focus-within .row-remove,
.row-remove:focus-visible {
  opacity: 0.7;
}
.row-remove:hover { opacity: 1 !important; color: var(--danger); background: var(--bg-sunken); }

/* ---- Song header fields (time signature / tempo), editable inline, same
   row as the structure hint — see song.js's renderHeaderFields. --------- */
.song-header-fields { margin-bottom: 0.75rem; }
/* Title/artist get their own full-width, prominent row — the song's
   actual identity, not a same-sized peer of a 3-digit tempo field (the
   old flat row used one 4.5rem centered input for every field, which
   made a real title like "While My Guitar Gently Weeps" illegible;
   direct report). */
.song-title-artist-fields { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.9rem; }
.song-title-artist-fields .header-field { display: flex; flex-direction: column; align-items: stretch; gap: 0.2rem; color: var(--fg-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
#song-title-input { font-size: 1.3rem; font-weight: 700; padding: 0.4rem 0.6rem; width: 100%; text-align: left; color: var(--fg); }
#song-artist-input { font-size: 1rem; padding: 0.3rem 0.6rem; width: 100%; text-align: left; color: var(--fg); }
/* The compact chips row (time/tempo/genre) keeps the old small-input
   treatment — these genuinely are short, fixed-width values. */
.song-meta-chips-row { display: flex; gap: 1rem; font-size: 0.85rem; flex-wrap: wrap; }
.song-meta-chips-row .header-field { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--fg-muted); }
.header-field-input { width: 4.5rem; padding: 0.25rem 0.4rem; text-align: center; }

/* ---- Bar-matrix chord grid editor (iReal-Pro-inspired) ------------------- */
.chip-wrap { margin-bottom: 0.5rem; }
.bar-matrix { border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; padding: 0.75rem; background: var(--bg-sunken); }
.matrix-tools { margin-bottom: 0.75rem; }
.matrix-tools summary { cursor: pointer; font-size: 0.8rem; color: var(--fg-muted); padding: 0.3rem 0; list-style: none; }
.matrix-tools summary::-webkit-details-marker { display: none; }
.matrix-tools summary::before { content: '▸ '; }
.matrix-tools[open] summary::before { content: '▾ '; }
.matrix-toolbar { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0.5rem 0 0.75rem; font-size: 0.85rem; }
.matrix-toolbar input { padding: 0.25rem 0.4rem; }
/* The actual editable chart — a real 5-line staff runs behind every row
   of bars (the same gradient trick play.html's own read-only chart uses
   for .staff-line::before: one shared background per row, not per bar,
   so the lines read as continuous across barlines instead of a strip of
   disconnected boxes). This directly answers "I see no staff line where
   to write the chords" — the bars sit ON a staff now, the same staff the
   printed/played chart uses, instead of floating in blank bordered cards. */
.matrix-row {
  display: flex; gap: 0; margin-bottom: 1.1rem; flex-wrap: wrap;
  align-items: flex-end; padding-top: 1.1em; position: relative;
}
.matrix-row::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0.55em; height: 1.7em;
  background-image:
    linear-gradient(var(--border), var(--border)),
    linear-gradient(var(--border), var(--border)),
    linear-gradient(var(--border), var(--border)),
    linear-gradient(var(--border), var(--border)),
    linear-gradient(var(--border), var(--border));
  background-size: 100% 1px;
  background-position: 0 0%, 0 25%, 0 50%, 0 75%, 0 100%;
  background-repeat: no-repeat;
}
/* Bars are measures ON the staff, not bordered cards floating above it —
   a plain divider between consecutive bars (like the real chart's own
   `.bar + .bar`), no per-cell background/border/radius. */
.matrix-cell {
  flex: 1 1 7rem; min-width: 7rem; padding: 0.4rem 0.5rem 0.3rem; position: relative;
  display: flex; flex-direction: column; gap: 0.3rem; z-index: 1;
}
.matrix-cell + .matrix-cell { border-left: 1px solid var(--border); }
/* Repeat barlines — a double rule plus two "dots", the same visual
   convention iReal Pro/real charts use for |: and :| so the grid reads as
   an actual chart at a glance, not a bordered form field with a checkbox
   explaining what it means. */
.matrix-cell.cell-open { border-left: 5px double var(--border-strong) !important; }
.matrix-cell.cell-close { border-right: 5px double var(--border-strong); }
.matrix-cell.cell-open::before, .matrix-cell.cell-open::after,
.matrix-cell.cell-close::before, .matrix-cell.cell-close::after {
  content: ''; position: absolute; width: 0.3rem; height: 0.3rem; border-radius: 50%;
  background: var(--border-strong); top: 50%;
}
/* Dots sit just inside the double rule (not poking out past it) — the
   earlier -0.65rem offset could get clipped by the drawer's own scroll
   container at a bar hard against the grid's right edge; a few px inside
   the border reads the same way without that risk. */
.matrix-cell.cell-open::before { left: 0.35rem; transform: translateY(-0.5rem); }
.matrix-cell.cell-open::after { left: 0.35rem; transform: translateY(0.2rem); }
.matrix-cell.cell-close::before { right: 0.35rem; transform: translateY(-0.5rem); }
.matrix-cell.cell-close::after { right: 0.35rem; transform: translateY(0.2rem); }
/* The currently selected bar slot — the chord toolbar above acts on this
   one. Needs to be unmistakable at a glance, including on a phone
   screenshot, so it's both a background tint and a solid accent ring,
   not just a subtle border-color change. */
.matrix-cell.cell-selected { box-shadow: 0 0 0 3px var(--accent); background: var(--bg-sunken); position: relative; }
/* The cursor itself — a small solid triangle above the selected cell, the
   same role a caret plays in a text editor or MuseScore's own note-input
   cursor: one unambiguous "you are here" mark, not a sentence you have to
   read (see toolbar-slot-label's own comment — that text is now a terse
   fallback, this triangle is the primary cue). */
.matrix-cell.cell-selected::before {
  content: ''; position: absolute; top: -0.55rem; left: 50%; transform: translateX(-50%);
  border-left: 0.4rem solid transparent; border-right: 0.4rem solid transparent;
  border-top: 0.45rem solid var(--accent);
}
.matrix-slot-row.slot-selected .matrix-slot { background: var(--accent); color: var(--accent-contrast); }
/* Focus mode's real-chart canvas (song.js renderRealChart) — the chart
   itself is the UNCHANGED real "sheet-body" markup, pixel-identical to
   the read-only Play view; this is purely an overlay on top: a dashed
   selection ring + a blinking text-caret, no fill/background/layout
   change to the bar or beat-slot it's drawn on. */
/* Stronger than a dashed outline alone (that was the whole visible cue
   before, easy to miss at a glance — confirmed live, "I click around and
   can't tell anything got selected") — a filled accent tint on the slot
   itself, same idea as the mobile box-grid's .slot-selected background,
   so the selected bar/beat reads as unmistakable even before you notice
   the ring. */
/* An "advanced syntax" section's chart: real markup, but no click-to-
   select overlay is ever wired onto it (readOnly in renderRealChart) —
   dimmed + a plain cursor so it reads as "look, don't touch" rather than
   a chart that's simply unresponsive to clicks. */
.real-chart-host-readonly { opacity: 0.82; cursor: default; pointer-events: none; }

.real-chart-host .matrix-slot.editing {
  outline: 2px dashed var(--accent); outline-offset: 3px; border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.real-chart-host .bar.editing { position: relative; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.real-chart-host .bar.editing::after {
  content: ''; position: absolute; left: 0.1em; top: 0.15em; width: 1px; height: 1.1em;
  background: var(--accent); animation: real-chart-caret-blink 1s step-end infinite;
}
@keyframes real-chart-caret-blink { 50% { opacity: 0; } }
/* Bar-fullness feedback (Guitar Pro-style "does this measure balance?") —
   solid green border once every slot holds a chord or a sustain, dashed
   amber while something's still blank. */
.matrix-cell.bar-complete { border-color: var(--ok); }
.matrix-cell.bar-underfull { border-style: dashed; border-color: var(--warn); }
.matrix-cell-top { display: flex; align-items: center; justify-content: space-between; gap: 0.3rem; }
.matrix-bar-no { font-size: 0.7rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.matrix-fullness { font-size: 0.7rem; font-variant-numeric: tabular-nums; color: var(--fg-muted); }
.matrix-cell.bar-complete .matrix-fullness { color: var(--ok); }
.matrix-cell.bar-underfull .matrix-fullness { color: var(--warn); }
.density-select { font-size: 0.7rem; padding: 0.1rem 0.2rem; border-radius: 4px; }
/* flex-wrap: wrap — a bar split into several beat-slots (density > 1) needs
   real room per slot for its chord text and ♪ button; wrapping onto a
   second line inside the cell beats squeezing every slot down to an
   unreadable sliver, which is what a plain nowrap row did here before. */
.matrix-slots { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.matrix-slots > div { flex: 1 1 5rem; min-width: 5rem; }
/* Transparent by default — the chord is typed straight onto the staff
   itself (the .matrix-row::before lines show through), the same way a
   chord symbol sits directly over the music in a real chart rather than
   inside an opaque form field. A visible box only appears on hover/focus
   (so it's still discoverable as a tappable field) or once selected
   (.slot-selected below), never as permanent chrome sitting over the
   staff lines. */
/* input.matrix-slot (not just .matrix-slot) — needs to out-specificity
   the global input[type="text"] rule above (an attribute selector, same
   specificity weight as a class, but it would otherwise win on being an
   element+attribute match), which is what was silently forcing this
   back to an opaque white box regardless of the transparent background
   below. */
input.matrix-slot {
  width: 100%; min-width: 0; text-align: center; font-family: var(--font-chart); font-weight: 700;
  padding: 0.3rem 0.1rem; border-radius: 4px; background: transparent; border: 1px solid transparent;
}
input.matrix-slot:hover, input.matrix-slot:focus {
  background: var(--bg-raised); border-color: var(--border);
}
.matrix-cell-bottom { display: flex; gap: 0.3rem; align-items: center; justify-content: flex-end; }
.matrix-cell-bottom button { padding: 0.1rem 0.4rem; font-size: 0.75rem; }
.matrix-repeat-toggle { display: inline-flex; align-items: center; gap: 0.3rem; }
.matrix-repeat-toggle input[type="checkbox"] { margin: 0; }

/* ---- Alternative endings — LilyPond's \alternative, see the JS comment
   on renderAlternatives for the full model. Visually grouped as sibling
   boxes under one shared top rule, echoing the real volta bracket (a
   horizontal line over each ending, numbered at its left) without trying
   to reproduce the engraved bracket glyph itself in a form editor. */
.alt-endings-panel { margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px dashed var(--border); }
.alt-endings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.alt-add-btn { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; padding: 0.2rem 0.5rem; }
.alt-add-btn .icon { width: 0.8em; height: 0.8em; }
.alt-endings-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.alt-ending {
  flex: 1 1 10rem; min-width: 9rem; border: 1px solid var(--border); border-radius: 0 0 8px 8px;
  padding: 0.7rem 0.5rem 0.5rem; background: var(--bg-sunken); position: relative; margin-top: 0.55rem;
}
/* A real volta/ending bracket — a horizontal line over the box with short
   downward ticks at each end, the actual printed-music convention, not
   just a bordered box with a text label saying what it is. */
.alt-ending::before {
  content: ''; position: absolute; left: 0; right: 0; top: -0.55rem; height: 0.55rem;
  border: 2px solid var(--border-strong); border-bottom: none; border-radius: 4px 4px 0 0;
}
.alt-ending-head { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.alt-ending-head .hint { white-space: nowrap; }
.alt-label-input { flex: 1; min-width: 0; font-size: 0.82rem; font-weight: 700; padding: 0.2rem 0.4rem; }
.alt-ending-cells { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.alt-ending-cell { display: flex; align-items: center; gap: 0.15rem; }
.alt-ending-cell input {
  width: 7rem; text-align: center; font-family: var(--font-chart); font-weight: 700;
  padding: 0.3rem 0.2rem; border-radius: 4px;
}
.alt-ending-cell button { padding: 0.1rem 0.3rem; }
.alt-add-bar { font-size: 0.75rem; padding: 0.2rem 0.5rem; }

/* ---- Blocks editor (Notion/ProseMirror-style flowing document) -----------
   Deliberately NOT a stack of bordered cards: sections flow continuously,
   one after another, with no permanent border/shadow/background — exactly
   like a Notion page where blocks are plain content and the only chrome is
   a left-margin gutter (drag handle + "+") that appears when you hover
   that specific row. A real ProseMirror/ContentEditable document wasn't
   pulled in here — this app has no JS bundler/dependency story anywhere
   else (hand-written CSS/JS, go:embed, single binary), so this hand-rolled
   DOM version earns the same feel without a new build-time dependency. */
/* ---- Desktop focus editor (Guitar Pro-inspired) ------------------------
   One section at a time, its chart shown as the real read-only chart
   (renderRealChart) with a thin click-to-edit overlay. The chord-entry
   toolbar and section list live in the real sidebar rail now (see
   #sidebar-toolbox above) — renderMatrix/buildChordToolbar are unchanged,
   they just hand their DOM to a different parent when focusModeActive.
   Mobile never renders any of these classes (renderBlocksList doesn't use
   them). */
.focus-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 0.9rem; }
.focus-main { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; }
.focus-section-head { display: flex; align-items: center; gap: 0.6rem; }
.focus-section-head .block-label { font-size: 1.1rem; font-weight: 600; flex: 1; max-width: 22rem; }
.focus-lyrics-notes { display: flex; flex-direction: column; gap: 0.6rem; max-width: 46rem; }

/* Infinite staff line: one continuous row the user scrolls horizontally,
   not wrapped into short print-width rows (renderMatrix's own chunk-size
   override, see focusModeActive there) — cells keep a fixed width rather
   than shrinking to fit, since the row can simply extend sideways. The
   toolbar no longer lives inside this element (see above), so it's back
   to a plain block, not the old toolbar-left/canvas-right CSS grid. */
.bar-matrix.focus-mode { border: none; background: none; padding: 0; }
.bar-matrix.focus-mode .matrix-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.6rem; }
.bar-matrix.focus-mode .matrix-cell { flex: 0 0 7rem; }

.block-row {
  position: relative; padding: 0.3rem 0 0.3rem 1.9rem; margin: 0;
  border-radius: 6px; transition: background 0.1s;
}
.block-row:hover, .block-row:focus-within { background: var(--bg-sunken); }
.block-row.dragging { opacity: 0.35; }
.block-row.drag-over { box-shadow: inset 0 2px 0 var(--accent); }
.block-gutter {
  position: absolute; left: 0; top: 0.35rem; display: flex; align-items: center; gap: 0.1rem;
  opacity: 0; transition: opacity 0.1s;
}
.block-row:hover .block-gutter, .block-row:focus-within .block-gutter { opacity: 1; }
.block-handle, .block-add-btn {
  display: flex; align-items: center; justify-content: center; width: 1.3rem; height: 1.3rem;
  color: var(--fg-muted); border-radius: 4px; flex: none;
}
.block-handle { cursor: grab; touch-action: none; }
.block-handle:active { cursor: grabbing; }
.block-add-btn:hover, .block-handle:hover { background: var(--border); color: var(--fg); }
.block-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.block-label {
  font-size: 1.15rem; font-weight: 700; flex: 1; min-width: 5rem; background: none;
  border: none; padding: 0.1rem 0.2rem; border-radius: 4px;
}
.block-label:focus { background: var(--bg-raised); box-shadow: 0 0 0 1px var(--border); }
.block-repeat-toggle {
  font-size: 0.7rem; color: var(--fg-muted); background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.6rem; flex: none; white-space: nowrap;
}
.block-bars-badge { font-size: 0.75rem; color: var(--fg-muted); flex: none; }
.block-row-actions { display: flex; gap: 0.1rem; opacity: 0; transition: opacity 0.1s; flex: none; }
.block-row:hover .block-row-actions, .block-row:focus-within .block-row-actions { opacity: 1; }
.block-row-actions .icon-btn { padding: 0.25rem; }
.block-body { padding: 0.3rem 0 0.1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.block-chord-toggle {
  align-self: flex-start; font-size: 0.82rem; color: var(--fg-muted); background: none;
  padding: 0.1rem 0;
}
.block-chord-toggle:hover { color: var(--fg); }
.block-body .bar-matrix { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-raised); }
.block-lyrics-label { margin-bottom: -0.25rem; }
.block-lyrics {
  width: 100%; resize: vertical; font-family: inherit; font-size: 0.95rem;
  line-height: 1.5; padding: 0.4rem 0.5rem; border-radius: 6px;
  border: 1px solid transparent; background: none;
}
.block-lyrics:hover, .block-lyrics:focus { border-color: var(--border); background: var(--bg-raised); }
.block-notes {
  width: 100%; resize: vertical; font-family: inherit; font-size: 0.85rem; font-style: italic;
  line-height: 1.4; padding: 0.35rem 0.5rem; border-radius: 6px; color: var(--fg-muted);
  border: 1px solid var(--border); background: var(--bg-sunken); margin-bottom: 0.2rem;
}
.block-notes:focus { color: var(--fg); background: var(--bg-raised); }
/* The seam between two rows: a thin hover band, not its own visible block —
   matches Notion's near-invisible-until-hovered insertion line rather than
   a permanently visible button in every gap. */
.block-seam { display: flex; justify-content: center; align-items: center; height: 0.7rem; position: relative; }
.block-seam-btn {
  display: flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem;
  border-radius: 999px; background: var(--bg-sunken); color: var(--fg-muted); opacity: 0;
  transition: opacity 0.12s; position: relative; z-index: 1;
}
.block-seam:hover .block-seam-btn, .block-seam-btn:focus-visible { opacity: 1; }
.block-seam-btn:hover { background: var(--accent); color: var(--accent-contrast); }
.block-seam-btn .icon { width: 0.85em; height: 0.85em; }

/* ---- Insert / content-type popup menu ------------------------------------
   One small menu reused for both the seam "+" (new section, with common
   labels one tap away — Kit/Notion's own "+" opens a block-type picker the
   same way) and the body-level "+" (add chords or lyrics to a section that
   doesn't have them yet). */
.insert-menu {
  /* Above .edit-drawer's z-index: 100 — this menu (the section-insert
     picker and the iReal-style chord quick-pick) is only ever opened from
     inside that drawer, and at the old z-index: 60 it rendered invisibly
     behind it: a real, pre-existing bug that made the chord palette
     unusable from its only call site. */
  position: fixed; z-index: 110; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-lg, var(--shadow)); padding: 0.3rem;
  min-width: 11rem; max-height: 70vh; overflow-y: auto;
}
.insert-menu-group-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted);
  padding: 0.35rem 0.5rem 0.15rem;
}
.insert-menu-item {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left;
  padding: 0.4rem 0.5rem; border-radius: 5px; font-size: 0.88rem; background: none;
}
.insert-menu-item:hover, .insert-menu-item.active { background: var(--bg-sunken); }
.insert-menu-item .icon { width: 1em; height: 1em; color: var(--fg-muted); flex: none; }
.insert-menu-grid, .toolbar-menu-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 0.1rem; }
.insert-menu-custom { display: block; width: calc(100% - 0.6rem); margin: 0.25rem 0.3rem; font-size: 0.85rem; padding: 0.3rem 0.45rem; border: 1px solid var(--border); border-radius: 5px; }
.insert-menu-sep { height: 1px; background: var(--border); margin: 0.3rem 0.2rem; }

/* ---- Bar-matrix beat labels -----------------------------------------------
   A bar split into several chords (density > 1) needs to say WHICH beat
   each one lands on, not just "chord N of the bar" — the whole point of a
   mid-bar change (e.g. a I chord on beat 1 moving to IV on beat 3, the
   classic soul/R&B move) is lost if the grid reads as two anonymous
   slots. Computed from the song's own time signature (compound meters
   label by pulse — "1"/"4" — matching the dotted-quarter convention used
   everywhere else in this app, not the raw eighth-note count). */
/* Muted to near-invisible by default — real notation software never shows
   its own internal beat/slot bookkeeping as permanent on-chart chrome (the
   old "beat 1"/"beat 3" labels reading as data leakage was a specific
   complaint). Still present for anyone who needs it (hover, or the
   selected slot), just no longer competing with the chord symbols for
   attention on first glance. */
.matrix-beat-label {
  font-size: 0.6rem; color: var(--fg-faint); text-align: center;
  font-variant-numeric: tabular-nums; opacity: 0.35; transition: opacity 0.15s;
}
.matrix-cell:hover .matrix-beat-label,
.matrix-cell.cell-selected .matrix-beat-label { opacity: 1; }

.matrix-slot-row { display: flex; gap: 0.2rem; align-items: center; }

/* ---- The "more qualities" overflow menu — a plain popup is fine here
   since it's genuinely secondary (the primary 10 qualities live on the
   always-visible toolbar below); unlike the old per-slot "♪" button this
   is reached from the toolbar itself, not required for ordinary editing. */
.chord-pick-menu { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.4rem; min-width: 13rem; }
.chord-pick-row { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.chord-pick-row button {
  flex: 1 1 2rem; min-width: 2rem; padding: 0.3rem 0.2rem; font-size: 0.82rem; font-weight: 700;
  border-radius: 5px; background: var(--bg-sunken); border: 1px solid var(--border);
}
.chord-pick-row button:hover { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.chord-pick-row.quality button { font-weight: 400; font-size: 0.76rem; }

/* ---- Persistent chord toolbar — the actual iReal Pro/Guitar Pro borrow:
   a root row (A-G + flat/sharp), a quality grid, a bass toggle and a
   duration/placement row, all ALWAYS visible above a section's bar grid
   (not a popup you have to summon per-cell, which is what the previous
   "♪" button gave — see the removed chord-pick-btn/openChordPicker). It
   reflects the currently selected slot (.active/.pending button states,
   set by refreshToolbarHighlight) and every tap writes straight into
   that slot via the same code path typing does. */
.chord-toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0.6rem 0.6rem 0.7rem; margin: -0.75rem -0.75rem 0.75rem; border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.chord-toolbar-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.78rem; }
.toolbar-meta-chip {
  font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--bg-sunken);
  border: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.toolbar-meta-tempo:empty { display: none; }
/* Terse fallback only — the cell's own caret (.cell-selected::before) is
   the primary "you are here" cue now; this just adds the chord's actual
   text content (not useful to show visually, since the slot itself already
   displays it) for anyone on a screen reader or without room to see the
   chart. Kept deliberately short, not a full sentence. */
.toolbar-slot-label { color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.72rem; }
.chord-toolbar.no-selection .toolbar-slot-label { font-style: italic; }
/* Unsaved-changes indicator — a persistent, impossible-to-miss badge, not
   a toast that fades: closing/navigating away with this showing should
   never feel like a surprise. */
.edit-dirty-indicator {
  font-size: 0.78rem; font-weight: 600; color: var(--warn); white-space: nowrap;
  padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--warn-bg);
  border: 1px solid var(--warn);
}
.toolbar-row { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.toolbar-btn {
  flex: 1 1 2rem; min-width: 2rem; padding: 0.35rem 0.3rem; font-size: 0.85rem; font-weight: 700;
  border-radius: 5px; background: var(--bg-sunken); border: 1px solid var(--border);
}
.toolbar-btn:hover { background: var(--border); }
.toolbar-btn.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.toolbar-btn.pending { box-shadow: inset 0 0 0 2px var(--accent); }
.toolbar-roots .toolbar-root { flex: 1 1 2rem; }
.toolbar-roots .toolbar-acc { flex: 0 1 2.2rem; color: var(--fg-muted); }
.toolbar-qualities .toolbar-quality { font-weight: 400; font-size: 0.78rem; }
.toolbar-qualities .toolbar-more { font-weight: 400; font-size: 0.78rem; color: var(--fg-muted); }
.toolbar-util .toolbar-bass-btn { flex: 1 1 4rem; }
.toolbar-util .toolbar-clear { flex: 1 1 4rem; color: var(--danger); }
/* Disabled-looking (but still clickable, so a tap always gets an
   explanatory nothing-happened rather than a dead control) until a slot
   is actually selected. */
.chord-toolbar.no-selection .toolbar-row .toolbar-btn:not(.toolbar-acc) { opacity: 0.55; }

.toolbar-split-label { white-space: nowrap; margin-right: 0.2rem; }
.toolbar-split-btn { flex: 0 1 2.4rem; }

@media (max-width: 760px) {
  /* Phone width: the toolbar can't rely on desktop's roomy flex-wrap —
     force the duration/util row to tighter columns. When this section's
     grid is the one actually being edited (dockToolbar, song.js), the
     toolbar is DOCKED to the real bottom of the viewport instead of
     sitting inline above the grid — iReal Pro's own on-screen keyboard
     stays fixed below the chart rather than scrolling away with it, and
     the chart stays scrollable and visible above it the whole time. A
     plain inline toolbar (not yet docked — nothing selected, or docking
     hasn't run) still just scrolls with the grid, same as before. */
  .chord-toolbar { position: static; margin: 0 0 0.6rem; border-radius: 6px; border: 1px solid var(--border); }
  .chord-toolbar.toolbar-docked {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0; z-index: 150;
    border: none; border-top: 1px solid var(--border); border-radius: 0;
    max-height: 46vh; overflow-y: auto; box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.3);
  }
  .toolbar-btn { flex: 1 1 2.6rem; font-size: 0.8rem; padding: 0.4rem 0.2rem; }
  .toolbar-roots .toolbar-root { flex: 1 1 2.2rem; }
  /* Leaves real scroll room above the docked keyboard so the last bar(s)
     of the chart aren't permanently hidden behind it. */
  .edit-drawer-body.has-docked-toolbar { padding-bottom: 46vh; }

  /* Smaller, phone-adjusted bars — iReal Pro's own phone layout runs
     noticeably more compact measures than its iPad one; the desktop
     7rem/4.6rem-per-slot floor (buildMatrixCell, song.js) was sized for a
     mouse-width drawer and left room for only 2-3 bars per row on an
     actual phone. */
  .matrix-cell { min-width: 4.4rem !important; flex-basis: 4.4rem !important; padding: 0.3rem 0.35rem 0.2rem; }
  .matrix-slots > div { flex: 1 1 3.4rem; min-width: 3.4rem; }
  .matrix-slot { font-size: 0.85rem; padding: 0.25rem 0.1rem; }
  .matrix-row { gap: 0; margin-bottom: 0.9rem; }
  .matrix-bar-no, .matrix-fullness, .matrix-beat-label { font-size: 0.62rem; }
}

.advanced-syntax-notice { padding: 0.5rem 0.65rem; border: 1px dashed var(--border); border-radius: 6px; background: var(--bg-sunken); }

.setlist-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.setlist-meta label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--fg-muted); }
.set-block { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; margin-bottom: 1rem; background: var(--bg-raised); }
.set-header { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.set-header input { font-size: 1.1rem; font-weight: 700; flex: 1; }
.song-picker { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.6rem; flex-wrap: wrap; }

.ok { color: var(--ok); }
.err { color: var(--danger); }

/* ---- Home page hero -------------------------------------------------------
   A confident neutral surface, no gradient/clipart, no "one colored border
   on every card" tic — the accent earns its place on the logo mark and
   interactive controls, not as decoration on static containers. */
.hero {
  border-radius: var(--radius); margin-bottom: 1.5rem; background: var(--bg-raised);
  border: 1px solid var(--border); padding: 2.4rem 1.6rem;
  display: flex; align-items: center; gap: 1.2rem;
}

/* Standalone auth pages (login, invite-accept, "check your email", an
   expired-link notice) — no sidebar, no app chrome, just this. Every
   competitor worth checking (GitHub, Google, Stripe dashboard) centers
   this kind of page in a single fixed-width column rather than letting
   it stretch edge to edge or sit flush left; this had neither — no CSS
   targeted .index at all, so these pages rendered as a plain, left-
   aligned, flush, full-width block with zero gap between the stacked
   cards. Scoped to this new class, not the bare .index main.html already
   uses for OTHER pages (e.g. the getting-started wizard, which lives
   inside the normal sidebar'd app chrome and should stay as it is) —
   reusing .index itself would have centered those too. */
.auth-page {
  max-width: 440px; margin: 3.5rem auto; padding: 0 1.2rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.auth-page .hero { margin-bottom: 0; text-align: center; }
.auth-page .hero > div { width: 100%; }
.hero-mark { flex: none; color: var(--accent); font-size: 3.2rem; }
.hero h2 { margin: 0; font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.hero p { margin: 0.4rem 0 0; color: var(--fg-muted); font-size: 0.98rem; }

/* ---- Small screens: tighten padding, keep transport usable one-handed --- */
@media (max-width: 480px) {
  main { padding: 0.6rem; }
  .timeline .transport { margin: 0 0.3rem 0.5rem; padding: 0.5rem; }
  .app-header { padding: 0.6rem 0.75rem; }
}

/* ---- Gig view: the one page meant to be read from arm's length under
   stage lighting, not edited. Modeled directly on the band's own LaTeX
   titlepage set-list tables (big numbered rows, striped, key + tempo as
   fixed columns) rather than anything web-app-shaped — no drag handles, no
   note inputs, no delete buttons, just the running order. */
.gig-link {
  margin-left: auto; font-size: 0.8rem; color: var(--fg-muted); display: inline-flex;
  align-items: center; gap: 0.3rem;
}
.gig-meta {
  display: flex; gap: 1rem; justify-content: center; padding: 0 1.1rem 0.6rem;
  color: var(--fg-muted); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.gig-sets { max-width: 860px; margin: 0 auto; padding: 0.5rem 1.1rem 3rem; }
.gig-set { margin-bottom: 2.2rem; }
.gig-set h2 {
  font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent);
  border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; margin: 0 0 0.3rem;
}
.gig-table { display: flex; flex-direction: column; }
.gig-row {
  display: grid; grid-template-columns: 2.6rem 1fr 4.5rem 4rem; align-items: center;
  gap: 0.8rem; padding: 0.9rem 0.7rem; border-radius: 6px; color: var(--fg);
}
.gig-row:nth-child(odd) { background: var(--bg-sunken); }
.gig-row:hover { background: color-mix(in srgb, var(--accent) 12%, var(--bg-sunken)); }
.gig-row.current { background: color-mix(in srgb, var(--accent) 20%, var(--bg-sunken)); }
.gig-row.current .gig-title { color: var(--accent); }
.gig-num { font-variant-numeric: tabular-nums; color: var(--fg-muted); font-size: 1.1rem; text-align: right; }
.gig-title { display: flex; flex-direction: column; gap: 0.1rem; font-size: 1.25rem; font-weight: 700; }
.gig-note { font-size: 0.78rem; font-weight: 400; font-style: italic; color: var(--fg-muted); }
.gig-key, .gig-tempo { font-variant-numeric: tabular-nums; color: var(--fg-muted); font-size: 1.05rem; text-align: right; }

/* The setlist overview's own row — same visual language as the gig
   view's .gig-row, extended with two more columns for a per-song "play
   it" link (reference: URL, when set) and the reorder up/down buttons
   that only appear once "reorder" mode is toggled on. */
.setlist-overview-row { grid-template-columns: 2.6rem 1fr 3.5rem 3rem 2.9rem 3.2rem; }
.setlist-overview-play { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; color: var(--fg-muted); }
.setlist-overview-play .icon { width: 1.1rem; height: 1.1rem; }
/* The song playing in the set list's player (rec-player). */
.gig-row.playing { background: var(--accent-bg); }
.gig-row.playing .gig-title { color: var(--accent); }
.gig-row .rec-play { justify-self: end; }
.setlist-overview-reorder-btns:not([hidden]) { display: flex; gap: 0.15rem; }
#reorder-toggle.active { background: var(--accent); color: var(--bg); }

/* The band Repertoire tab's own row — same visual language as the gig
   view's .gig-row (a repertoire should read like a setlist, not a data
   table), no running number (it's not an ordered set), artist as the
   .gig-title's second line (reusing the same stacked-line slot .gig-note
   already defines), and a trailing kebab menu for the provenance/admin
   actions (visibility, who added it, all-versions/history, remove) that
   matter occasionally, not on every glance. */
.repertoire-row { grid-template-columns: 1fr 3.4rem 3.4rem 2.2rem; }
.repertoire-row[hidden] { display: none; } /* .gig-row's own display:grid would otherwise beat the [hidden] UA rule */
.repertoire-artist { font-size: 0.85rem; font-weight: 400; color: var(--fg-muted); }
.row-menu { position: relative; justify-self: end; }
.row-menu > summary { list-style: none; cursor: pointer; padding: 0.2rem 0.5rem; border-radius: 5px; color: var(--fg-muted); }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary:hover { background: var(--bg-sunken); color: var(--fg); }
.row-menu[open] > summary { background: var(--bg-sunken); }
.row-menu-panel {
  position: absolute; right: 0; top: 100%; z-index: 5; min-width: 11rem; margin-top: 0.2rem;
  display: flex; flex-direction: column; padding: 0.4rem; gap: 0.1rem;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
}
.row-menu-panel a, .row-menu-panel button {
  display: block; width: 100%; text-align: left; padding: 0.4rem 0.6rem; border-radius: 5px;
  font: inherit; background: none; border: none; color: var(--fg); text-decoration: none; cursor: pointer;
}
.row-menu-panel a:hover, .row-menu-panel button:hover { background: var(--bg-sunken); }
.row-menu-panel .hint { padding: 0.2rem 0.6rem 0.3rem; margin: 0; }

/* Search box above the list, same card-adjacent look the catalog page's
   own filter form uses, just client-side (a repertoire is small enough
   to filter in the browser — no round trip, instant as you type). */
.repertoire-toolbar { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.8rem; flex-wrap: wrap; }
.repertoire-toolbar input[type="search"] { flex: 1; min-width: 10rem; max-width: 24rem; }
.repertoire-empty-filtered { display: none; }

@media (max-width: 560px) {
  .gig-row { grid-template-columns: 2rem 1fr 3.4rem; }
  .setlist-overview-row { grid-template-columns: 2rem 1fr 3.4rem 2.9rem 2.8rem; }
  .repertoire-row { grid-template-columns: 1fr 3.4rem 2.2rem; }
  .gig-tempo { display: none; } /* key matters more than tempo at a glance on a phone */
  .gig-title { font-size: 1.1rem; }
}

/* "+ Add song" dialog — three alternative methods as tabs (not a linear
   wizard's numbered steps, so a distinct tab look from .wizard-step-dot
   even though it borrows #song-wizard's own dialog chrome below). */
#add-song-dialog {
  width: min(560px, 92vw); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem 1.4rem; background: var(--bg-raised); color: var(--fg); box-shadow: var(--shadow);
}
#add-song-dialog::backdrop { background: rgba(10, 8, 4, 0.45); }
#add-song-dialog h2 { margin: 0 0 0.8rem; }
.add-song-tabs { display: flex; gap: 0.3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.add-song-tab {
  font: inherit; background: none; border: none; cursor: pointer; padding: 0.5rem 0.2rem;
  color: var(--fg-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.add-song-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.add-song-panel[hidden] { display: none; }

.link-button {
  background: none; border: none; padding: 0; font: inherit; color: var(--accent);
  text-decoration: underline; cursor: pointer;
}

/* Icon-based instrument picker (profile, jam signup, jam song-pick,
   jam add-song instrument-limit form) — a row of small tappable
   buttons for the common instruments, falling back to a plain text
   input for anything else. Shared across all four locations so the
   look stays consistent. */
.instrument-icon-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0; }
.instrument-icon-btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.15rem;
  padding: 0.4rem 0.7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-sunken); cursor: pointer; font-size: 1.3rem; line-height: 1;
  user-select: none;
}
.instrument-icon-btn .instrument-icon-label { font-size: 0.65rem; color: var(--fg-muted); text-transform: capitalize; }
.instrument-icon-btn:hover { background: color-mix(in srgb, var(--accent) 12%, var(--bg-sunken)); }
.instrument-icon-btn.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--bg-sunken)); }
.instrument-icon-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Phase 26: home page redesign + catalog genre filter/mobile ----- */

.home-greeting { margin: 0 0 1.4rem; }
.home-greeting h2 { margin: 0 0 0.2rem; font-size: 1.7rem; font-weight: 700; }
.home-greeting p { margin: 0; color: var(--fg-muted); }

/* Phase 39: the band home page's "create activity" shortcuts — clear
   actionable buttons, not more links buried in a sub-nav. Same pill/icon
   language as .band-card-actions a.votes, just larger (these are the
   primary calls to action on the page, not a secondary per-card link). */
.home-shortcuts { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.shortcut-btn {
  display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; font-weight: 500;
  padding: 0.55rem 0.9rem; border: 1px solid var(--accent); border-radius: 999px;
  background: var(--accent-bg); color: var(--accent-ink);
}
.shortcut-btn:hover { background: var(--accent); color: var(--bg-raised); }
.shortcut-btn .icon { width: 1em; height: 1em; }

.home-section { margin: 0 0 2rem; }
.home-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.home-section-head h3 { margin: 0; font-size: 1.1rem; }
.home-section-head .count { font-size: 0.82rem; color: var(--fg-faint); }

.attention-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.attention-filters button {
  font-size: 0.82rem; padding: 0.35rem 0.75rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-raised); color: var(--fg-muted); cursor: pointer;
}
.attention-filters button.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-ink); }

.attention-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-raised); }
.album-preview-list.attention-list { border: none; background: none; gap: 0.9rem; }
.album-preview-group { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-raised); }
.album-preview-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); background: var(--bg-sunken); }
.album-preview-cover { width: 28px; height: 28px; border-radius: 3px; object-fit: cover; flex: none; }
.album-preview-name { font-weight: 600; font-size: 0.88rem; }
.album-preview-year { font-weight: 400; color: var(--fg-faint); }
.attention-row {
  display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border); color: var(--fg);
}
.attention-row:last-child { border-bottom: none; }
.attention-row:hover { background: var(--bg-sunken); }
.attention-row .attention-title { font-size: 0.95rem; font-weight: 500; }
.attention-row .attention-subtitle { font-size: 0.8rem; color: var(--fg-faint); margin-top: 0.1rem; }
.attention-row .attention-when { margin-left: auto; font-size: 0.78rem; color: var(--fg-faint); white-space: nowrap; flex: none; }
.attention-empty { padding: 1rem; color: var(--fg-faint); font-size: 0.88rem; }

/* Fluid grid — auto-fit/minmax, same convention .project-grid already
   uses, NOT a fixed column count with a separate mobile override: the
   correction this phase was explicitly asked to make ("vertical band
   list doesn't work on mobile"). Reflows to 1 column on a phone with no
   breakpoint needed. */
.band-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.band-card {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised);
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.7rem;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.band-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07); }
.band-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.band-card-head h4 { margin: 0; font-size: 1.05rem; }
/* Stretched-link pattern: the title is a real <a> covering the WHOLE
   card via its own ::after (so the whole card is clickable, not just
   the title text), while the quick-action links below stay real,
   independently-clickable links by sitting above it in z-index — no JS,
   no nested-interactive-content a11y problem. */
.band-card-title-link { color: var(--accent-ink); font-weight: 700; }
.band-card-title-link::after { content: ""; position: absolute; inset: 0; }
.band-card-members { font-size: 0.78rem; color: var(--fg-faint); }
.band-card-digest { font-size: 0.85rem; padding: 0.5rem 0.65rem; background: var(--bg-sunken); border-radius: 8px; }
.band-card-gig { font-size: 0.82rem; position: relative; z-index: 1; }
.band-card-gig a { color: var(--accent-ink); font-weight: 600; }
.band-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; position: relative; z-index: 1; }
.band-card-actions a { font-size: 0.78rem; padding: 0.3rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-raised); }
.band-card-actions a.votes { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-ink); }

/* Set list rows (cards.html "setlist-row"): the title opens the running
   order; Click track as a pill; exports folded. */
.setlist-rows { list-style: none; margin: 0; padding: 0; }
.setlist-rows > li { padding: 0.7rem 0; border-top: 1px solid var(--border); }
.setlist-rows > li:first-child { border-top: none; padding-top: 0.2rem; }
.setlist-row { display: flex; flex-direction: column; gap: 0.45rem; }
.setlist-row-title { font-weight: 600; font-size: 1.02rem; color: var(--fg); }
.setlist-row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip-link {
  display: inline-flex; align-items: center; gap: 0.3rem; min-height: 2.2rem; padding: 0.3rem 0.75rem;
  font-size: 0.85rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-raised); color: var(--accent-ink);
}
.chip-link:hover { text-decoration: none; border-color: var(--accent); }
.setlist-row-export summary, .setlist-new summary { cursor: pointer; font-size: 0.85rem; color: var(--fg-muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.setlist-row-export[open] { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.85rem; }
.setlist-new { margin-top: 0.6rem; }
.setlist-new .structure-actions { margin-top: 0.5rem; display: flex; gap: 0.5rem; }
.setlist-new .structure-actions input { flex: 1; min-width: 0; }

/* List-page header: title/tabs on the left, the primary "create" action
   top-right — the standard list-page layout, so "+ New band" stops
   competing with real bands for grid space as its own lopsided card. */
.list-page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.create-row {
  display: flex; align-items: flex-end; gap: 0.8rem; flex-wrap: wrap; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-raised); padding: 1rem 1.1rem; margin-bottom: 1.2rem;
}
.create-row[hidden] { display: none; }
.create-row .field { display: flex; flex-direction: column; gap: 0.3rem; }
.create-row .field label { font-size: 0.78rem; font-weight: 600; color: var(--fg-muted); }
.create-row .field input { min-width: 16rem; }
.create-row-cancel { background: none; border: none; color: var(--fg-faint); cursor: pointer; font-size: 0.85rem; }
.create-row #create-band-result { margin: 0; flex-basis: 100%; }

/* Segmented-pill tab bar — shared by the bands-list page (My bands /
   All bands) and every band-detail sub-page (Overview / Repertoire /
   Setlists / Proposals & Listening Party / Members). One rounded track
   holding the tabs, the active one riding a raised pill inside it. */
.band-tabs {
  display: inline-flex; align-items: center; gap: 0.15rem; flex-wrap: wrap;
  background: var(--bg-sunken); border-radius: 10px; padding: 0.2rem;
}
/* Every item in the row — plain nav link, a <button> action (Reorder), or
   a <details><summary> dropdown (PDF) — renders as the same pill: one
   visual language for the whole row instead of tabs mixed with
   differently-styled buttons/links (confirmed live as a real usability
   complaint on mobile, where the odd-one-out controls wrapped to their
   own row). icon + label on every pill, no text-only ones. */
.band-tabs .band-tab,
.band-tabs .band-tab-menu > summary {
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
  padding: 0.45rem 0.9rem; border-radius: 7px; border: none; list-style: none;
  background: transparent; color: var(--fg-muted); font-weight: 500; font-size: 0.82rem; font-family: inherit;
}
.band-tabs .band-tab-menu > summary::-webkit-details-marker { display: none; }
.band-tabs .band-tab .icon,
.band-tabs .band-tab-menu > summary .icon { width: 1.05em; height: 1.05em; }
.band-tabs .band-tab.active,
.band-tabs .band-tab-menu[open] > summary {
  background: var(--bg-raised); color: var(--fg); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.band-tabs .band-tab-menu { position: relative; }
.band-tabs .band-tab-menu .row-menu-panel { right: 0; left: auto; }
.band-tabs-row { margin-bottom: 1.2rem; }

.profile-picture-preview { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }

.admin-stats-row { display: flex; gap: 0.8rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.admin-stat {
  display: flex; flex-direction: column; gap: 0.1rem; align-items: flex-start;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 1rem; min-width: 6rem;
}
.admin-stat strong { font-size: 1.4rem; line-height: 1.1; }
.admin-stat span { font-size: 0.78rem; color: var(--fg-muted); }
.admin-tabs {
  display: inline-flex; gap: 0.15rem; flex-wrap: wrap;
  background: var(--bg-sunken); border-radius: 10px; padding: 0.2rem;
  margin-bottom: 1.2rem;
}
.admin-tabs button {
  padding: 0.45rem 0.9rem; border-radius: 7px; border: none;
  background: transparent; color: var(--fg-muted); font-weight: 500; font-size: 0.82rem;
  cursor: pointer;
}
.admin-tabs button.active {
  background: var(--bg-raised); color: var(--fg); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.coming-up-card {
  display: flex; align-items: center; gap: 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); padding: 0.9rem 1.1rem;
}
.coming-up-date {
  flex: none; width: 3.2rem; height: 3.2rem; border-radius: 10px; background: var(--ok-bg); color: var(--ok);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700;
}
.coming-up-date .month { font-size: 0.68rem; line-height: 1; }
.coming-up-date .day { font-size: 1.15rem; line-height: 1.2; }
.coming-up-card.empty { border-style: dashed; color: var(--fg-faint); }

.browse-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.browse-card { flex: 1 1 220px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); padding: 1rem 1.1rem; }
.browse-card h4 { margin: 0 0 0.25rem; font-size: 1rem; }
.browse-card p { margin: 0; font-size: 0.82rem; color: var(--fg-faint); }

/* ---- Songbooks (Phase 32): a browse/discovery page, not a technical
   listing — a fluid card grid is the default at EVERY width (not just
   mobile; the old desktop <table> is gone), a view toggle switches
   between the flat song browse and "by songbook" (a project's book, or a
   band's repertoire — see icons.html's desktop-sidebar comment and
   catalog.html). ------------------------------------------------------ */
.catalog-intro { max-width: 46rem; color: var(--fg-muted); margin: 0 0 1.1rem; }

.catalog-view-toggle { display: flex; gap: 0.4rem; margin-bottom: 1.1rem; }
.catalog-view-tab {
  padding: 0.5rem 1.1rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--fg-muted); font-weight: 600; font-size: 0.88rem; cursor: pointer;
}
.catalog-view-tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast, #fff); }

/* A filter bar, not a data-entry form — several short fields side by
   side is the accepted exception to "single column," since the whole
   point is scanning/adjusting several small controls at once. Each
   label still sits above its own input rather than inline before it,
   for the same persistent-label reasoning as the rest of the app's
   forms, and a consistent min-width keeps short fields from feeling
   cramped at narrow desktop widths. */
.catalog-filters { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.8rem 1rem; margin-bottom: 1.1rem; }
.catalog-search { display: flex; gap: 0.5rem; }
.catalog-search input { flex: 1; min-width: 0; }
.catalog-filters button[type="submit"] { padding: 0.45rem 1.1rem; flex: none; }
.catalog-more summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--fg-muted); padding: 0.2rem 0; }
.catalog-more-fields { display: flex; gap: 1.1em; align-items: end; flex-wrap: wrap; padding-top: 0.6rem; }
.catalog-more-fields label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; font-weight: 600; color: var(--fg-muted); min-width: 9rem; flex: 1; }

.catalog-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.9rem;
}
.catalog-card {
  display: flex; flex-direction: column; gap: 0.6rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-raised); padding: 1rem 1.1rem;
}
.catalog-card-main { color: inherit; }
.catalog-card-title { font-weight: 600; font-size: 1.05rem; font-family: var(--font-chart, inherit); }
.catalog-card-meta { font-size: 0.82rem; color: var(--fg-faint); margin-top: 0.2rem; }
.catalog-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; font-size: 0.8rem; }
.catalog-card-actions button { font-size: 0.78rem; padding: 0.3rem 0.55rem; }

.catalog-books-heading { font-size: 1.1rem; margin: 1.4rem 0 0.8rem; }
.catalog-books-heading:first-child { margin-top: 0; }
.catalog-book-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.9rem; margin-bottom: 0.4rem; }
.catalog-book-card {
  display: block; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); padding: 1rem 1.1rem; color: inherit;
}
.catalog-book-card-title { font-weight: 600; font-size: 1.05rem; font-family: var(--font-chart, inherit); }
.catalog-book-card-meta { font-size: 0.82rem; color: var(--fg-faint); margin-top: 0.2rem; }

/* ---- Phase 27: bands listing + per-band page redo -------------------- */

/* Sub-nav row within the page body (repertoire/proposals/listening
   party) — distinct from the global header, which this phase doesn't
   touch (a separate desktop nav redesign is being proposed). */
.band-subnav { display: flex; gap: 1.2rem; margin: 0 0 1.2rem; font-size: 0.92rem; }

.band-digest-card { max-width: 640px; margin-bottom: 1.5rem; }
.band-digest-card ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

/* One list for current members AND unclaimed roster slots — "who's in
   this band" as a single coherent picture (the gap this phase fills:
   previously a pending slot was invisible anywhere on the band page). */
.roster-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); overflow: hidden; margin-bottom: 0.4rem; }
.roster-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.45rem 1rem; border-bottom: 1px solid var(--border); min-height: 2.6rem; }
.roster-row:last-child { border-bottom: none; }
.roster-row-pending { background: var(--bg-sunken); }
.roster-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.roster-name { font-weight: 500; }
.roster-instruments { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.roster-instrument-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--fg-muted); background: var(--bg-sunken); border-radius: 999px; padding: 0.15rem 0.55rem; }
.roster-row-pending .roster-instrument-badge { background: var(--bg-raised); }
.roster-pending-badge { font-size: 0.74rem; font-weight: 600; color: var(--fg-faint); background: var(--bg-raised); border: 1px dashed var(--border); border-radius: 999px; padding: 0.15rem 0.55rem; white-space: nowrap; flex: none; }
.roster-row select.status-select { flex: none; }

/* A pending (unclaimed) roster slot is editable inline — unlike a
   current member's row — but stays ONE compact line like every other
   roster row: a one-time column header (.roster-pending-header) above
   the list supplies the Name/Instrument/Role labels instead of
   repeating them per row, which is what made each row tall. The quick-
   add form below reuses the exact same grid columns so it reads as the
   list's own "next row," not a separate boxed-off widget. */
.roster-pending-header, .roster-row-pending, .roster-quick-add {
  display: grid; grid-template-columns: 1.3fr 1fr 6rem auto auto auto;
  align-items: center; gap: 0.6rem;
}
.roster-pending-header { padding: 0.3rem 1rem; border-bottom: 1px solid var(--border); }
.roster-pending-header span { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--fg-muted); }
.roster-row-pending input, .roster-row-pending select,
.roster-quick-add input, .roster-quick-add select { padding: 0.3rem 0.5rem; font-size: 0.88rem; }
.roster-quick-add { grid-template-columns: 1.3fr 1fr 6rem 1fr auto; background: none; }
.roster-quick-add #roster-add-result { font-size: 0.8rem; justify-self: end; }

/* An already-created, still-shareable invite link, with its own copy
   button — shown up front instead of only right after creation (the
   other gap this phase fills). */
.invite-link-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.5rem 0; padding: 0.5rem 0.7rem; background: var(--bg-sunken); border-radius: 8px; }
.group-invite-row { display: flex; flex-direction: column; gap: 0.6rem; }
.group-invite-row + .group-invite-row { margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px dashed var(--border); }
.invite-link-url { font-size: 0.82rem; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; }
/* Inside a data-table cell (admin's Pending accounts list) there's no
   flex context to stretch into, so the table's own layout algorithm
   shrinks that column toward zero width to keep the table at its
   "width:100%" — and overflow-wrap:anywhere then happily breaks the
   token one character per line rather than violate that width, the
   exact vertical wall of characters a mobile screenshot caught. A
   table cell's job here is different from the flex-row case above:
   let the token stay one unbroken run, so the table naturally grows
   past 100% and .table-scroll's own horizontal scroll (not character
   wrapping) is what absorbs the overflow — the same resolution this
   file's own .table-scroll comment already prescribes for wide
   content. */
.table-scroll .invite-link-url { white-space: nowrap; overflow-wrap: normal; display: inline-block; }
.copy-link-btn, .qr-link-btn { flex: none; font-size: 0.8rem; padding: 0.3rem 0.65rem; }

.qr-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 1rem; }
.qr-modal { background: var(--bg); border-radius: 12px; padding: 1.2rem; display: flex; flex-direction: column; align-items: center; gap: 0.7rem; max-width: 90vw; }
/* The QR code itself is black-on-white PNG data regardless of theme (a
   dark-mode-tinted background would reduce the quiet-zone contrast a
   scanner relies on), so this one square deliberately stays a literal
   white, not var(--bg-raised) — everything else in the modal still
   follows tokens. */
.qr-modal-img { width: 260px; height: 260px; background: #fff; border-radius: 8px; }
.qr-modal-url { max-width: 260px; text-align: center; overflow-wrap: anywhere; }

/* Getting-started wizard (phase 36). */
.wizard-card { max-width: 560px; }
.wizard-steps { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 1.1rem; }
.wizard-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.wizard-dot.done { background: var(--ok); }
.wizard-dot.active { background: var(--accent); width: 10px; height: 10px; }
.wizard-steps .hint { margin-left: 0.4rem; }
.wizard-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.wizard-actions a.primary {
  background: var(--accent); color: var(--accent-contrast); border: 1px solid var(--accent);
  font-weight: 700; border-radius: 8px; padding: 0.45rem 0.9rem; display: inline-block;
}
.wizard-actions a.primary:hover { text-decoration: none; filter: brightness(1.05); }
.link-btn, a.link-btn {
  background: none; border: none; color: var(--fg-muted); text-decoration: underline;
  cursor: pointer; padding: 0; font-size: 0.88rem;
}
.wizard-option-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.8rem; }
.wizard-option { flex: 1 1 220px; background: var(--bg-sunken); border-radius: 10px; padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.wizard-option h3 { margin: 0; font-size: 0.95rem; }
.wizard-option input[type=text] { width: 100%; }
.wizard-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.7rem; margin-top: 0.8rem; }
.wizard-pick { background: var(--bg-sunken); border-radius: 10px; padding: 0.7rem 0.8rem; display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; }
.wizard-pick-title { font-weight: 600; font-size: 0.88rem; }
.wizard-pick-artist { font-size: 0.78rem; }
.wizard-pick-add { font-size: 0.8rem; padding: 0.25rem 0.6rem; }
.wizard-pick-added { opacity: 0.6; }
@media (max-width: 760px) { .wizard-option-row { flex-direction: column; } }

/* PDF export mode picker (Phase 38) — a small inline control row paired
   with a "PDF"/"export songbook" link (internal/webassets/static/js/
   pdf-export.js rewrites the link's query string on change). Deliberately
   lightweight: a <select> + a checkbox, not a settings panel. */
.pdf-mode-row { display: inline-flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
/* --line/--card/--ink/--ink-soft/--text-muted were never this app's own
   token names (ported from a different project's vocabulary) — none of
   them exist in :root, so the hardcoded fallbacks above were silently
   winning in every theme and this control stayed light-on-light-gray in
   dark mode while everything around it switched. Reconciled to the real
   tokens: --border/--bg-raised/--fg/--fg-muted. */
.pdf-mode-select { font-size: 0.8rem; padding: 0.2rem 0.4rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-raised); color: var(--fg); }
.pdf-notes-label { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--fg-muted); white-space: nowrap; }
/* Phase 41: the old "wrap to full width at 760px" rule used to be this
   row's only mobile treatment — it still rendered inline in the mobile
   top bar, just as a wrapped second line, which collided with the
   phone's own status bar (a real reported bug, screenshot-confirmed).
   Fixed at the root: .pdf-mode-row now carries .topbar-desktop-only in
   its one remaining top-bar instance (hidden below 901px, see that
   class's rule) and gets a second, mobile-only instance inside the new
   #song-stack sheet instead — this selector needs no width override any
   more, inline-flex + flex-wrap already reads fine at a sheet's width. */
.daw-zoom input[type="range"] { width: 150px; }
.daw-zoom .daw-btn-text { height: 24px; padding: 0 8px; }
.daw-zoom-label { min-width: 5.5em; font-size: 11px; color: var(--daw-muted); font-variant-numeric: tabular-nums; }

/* A pickup / count-in bar (.bar-pickup, song.js's reflow keeps it in the
   first row on top of that row's usual bars): a narrow cell holding a
   whole-bar rest, with the row's regular bars sharing what's left so they
   stay as wide as the rows below. */
/* !important: the per-mode #sheet[data-render-mode=…] .bar rules (an ID
   selector) would otherwise win over these, and they apply in every mode. */
.staff-line > .bar.bar-pickup { flex: 0 0 3.4em !important; min-width: 3.4em; padding: 0 0.3em; }
.staff-line:has(> .bar-pickup) > .bar:not(.bar-pickup) { flex-basis: calc((100% - 3.4em) / var(--cap, 4)) !important; }
.staff-line:has(> .staff-timesig-cell):has(> .bar-pickup) > .bar:not(.bar-pickup) { flex-basis: calc((100% - 5.9em) / var(--cap, 4)) !important; }

/* Song listings: what each song holds, as small icons (song_badges.html). */
.song-badges { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: 0.6rem; vertical-align: middle; flex-wrap: wrap; }
.song-badges:empty { display: none; }
.song-badge {
  display: inline-flex; align-items: center; gap: 0.25rem; height: 1.55rem; padding: 0 0.35rem;
  border-radius: 4px; border: 1px solid var(--border); background: var(--bg-raised);
  color: var(--fg-muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; line-height: 1;
}
.song-badge .icon { width: 1rem; height: 1rem; }
.song-badge small { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; }
.song-badge-gp { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.song-badge-audio { color: #3d6fb8; border-color: color-mix(in srgb, #3d6fb8 35%, var(--border)); }
.song-badge-audio.is-backing { background: color-mix(in srgb, #3d6fb8 10%, var(--bg-raised)); }
.song-badge-audio.is-full { background: color-mix(in srgb, #3d6fb8 18%, var(--bg-raised)); }
.repertoire-row .gig-title .song-badges, .catalog-card .song-badges { margin-left: 0; margin-top: 0.3rem; display: flex; }
.repertoire-row .gig-title .song-badges:empty, .catalog-card .song-badges:empty { display: none; }
.audio-kind-list { display: flex; flex-direction: column; gap: 0.4rem; }
.audio-kind-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.88rem; }
.audio-kind-row > span:first-child { min-width: 11rem; font-weight: 600; }

/* Song history: what each edit changed (internal/songdiff). */
.history-changes ul { margin: 0; padding-left: 1.1rem; }
.history-changes li { margin: 0.1rem 0; }
.history-diff summary { cursor: pointer; font-size: 0.85rem; color: var(--fg-muted); margin-top: 0.3rem; }
.history-diff pre { margin: 0.4rem 0 0; padding: 0.5rem; max-height: 24rem; overflow: auto; font-size: 0.8rem; line-height: 1.4; background: var(--bg-sunken); border-radius: 4px; white-space: pre-wrap; word-break: break-word; }
.history-diff .diff-add { display: block; background: var(--ok-bg); }
.history-diff .diff-del { display: block; background: var(--danger-bg); }
.history-diff .diff-skip { display: block; color: var(--fg-muted); }
.history-diff .diff-ctx { display: block; color: var(--fg-muted); }

/* The chart's "how I read guitar / bass" pickers (notation-prefs.js). */
.notation-pickers { display: flex; justify-content: center; gap: 1rem; margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--fg-muted); }
.notation-pickers label { display: flex; align-items: center; gap: 0.35rem; }
.notation-pickers select { min-height: 0; padding: 0.2rem 0.4rem; font-size: 0.85rem; }

/* ==== Phones (≤ 600px): the mobile review of Nov 2026 ====================
   - the "More" sheet leaves out what the bottom tab bar already shows
     (it keeps everything on the song page, whose own bar replaces it);
   - page headers drop the "Songbooks" home link (the tab bar's Home);
   - a section's tab row scrolls sideways on one line instead of wrapping
     into two rows of pills;
   - song rows keep the whole title, with tempo and badges underneath. */
@media (max-width: 900px) {
  body:not(:has(.song-context-bar)) .site-nav-fullpage-row.is-tab { display: none; }
}
@media (max-width: 600px) {
  .app-header > a.back-link[href="/home"] { display: none; }
  /* One header pattern on phones: back arrow · title on one line · the
     page's one action and the bell. The back link keeps its text for
     screen readers but shows only its arrow. */
  .app-header { flex-wrap: nowrap; gap: 0.5rem; min-height: 3.2rem; }
  .app-header > a.back-link { flex: none; font-size: 0; min-width: 2.2rem; min-height: 2.2rem; justify-content: center; margin-left: -0.4rem; }
  .app-header > a.back-link .icon { width: 1.35rem; height: 1.35rem; }
  .app-header h1, .app-header .band-name-row { flex: 1; min-width: 0; }
  .app-header h1 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-header .song-nav { flex: none; flex-wrap: nowrap; }
  .app-header .notif-bell { flex: none; min-width: 2.2rem; min-height: 2.2rem; justify-content: center; }
  .app-header .song-nav a[href="/songbooks"], .app-header .song-nav a[href="/catalog"] { display: none; }
  .catalog-card-actions { align-items: center; }
  /* Roster: a pending person and the quick-add form stack on a phone
     instead of squeezing six grid columns into one line. */
  .roster-pending-header { display: none; }
  .roster-row-pending, .roster-quick-add { grid-template-columns: 1fr 1fr; row-gap: 0.4rem; padding-top: 0.6rem; padding-bottom: 0.6rem; }
  .roster-row-pending .roster-name, .roster-row-pending .invite-link-row { grid-column: 1 / -1; }
  .roster-row-pending .invite-link-row { margin: 0; }
  .roster-row-pending .invite-link-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .roster-quick-add #roster-add-name { grid-column: 1 / -1; }
  .roster-quick-add #roster-add-result { grid-column: 1 / -1; justify-self: start; }
  .band-tabs-row { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .band-tabs-row::-webkit-scrollbar { display: none; }
  .band-tabs-row .band-tab { flex: none; }
  .song-list li { align-items: flex-start; }
  .song-link { flex-wrap: wrap; row-gap: 0.15rem; }
  .song-link .song-title { white-space: normal; flex-basis: 100%; }
  .song-link .song-meta { margin-left: 0; }
  .song-link .song-badges { margin-left: 0; }
  /* Song badges are a glance at what a song holds, not buttons: drawn
     as bare icons so they don't read as tap targets. */
  .song-badge { border-color: transparent; background: none; padding: 0; min-width: 0; }
  .song-badge-audio.is-backing, .song-badge-audio.is-full { background: none; }
  .catalog-intro { font-size: 0.9rem; margin-bottom: 0.8rem; }
}

/* ==== Brands (internal/brand) =============================================
   A community's or band's look, applied on <body class="branded"> by
   overriding the design tokens inline (--bg, --fg, --accent, --font-ui,
   --font-display, --radius-control, --brand-header...). These rules only
   say where the brand's display font, header color and control shape go;
   colors come through the tokens every rule already uses. */
body.branded { font-family: var(--font-ui); }
body.branded h1, body.branded h2, body.branded .brand-name { font-family: var(--font-display, var(--font-ui)); letter-spacing: -0.01em; }
body.branded .app-header { background: var(--brand-header, var(--bg-raised)); color: var(--brand-header-fg, var(--fg)); border-bottom-color: transparent; }
body.branded .app-header a, body.branded .app-header .back-link { color: inherit; }
body.branded .app-header .back-link { opacity: 0.8; }
body.branded button, body.branded select, body.branded input:not([type=checkbox]):not([type=radio]),
body.branded .band-tabs, body.branded .band-tabs .band-tab, body.branded .chip-link {
  border-radius: var(--radius-control, 8px);
}
/* A card is a box of content, not a control: pill-shaped buttons would
   turn a tall card into an oval, so it only follows the brand's shape up
   to a soft corner. */
body.branded .card, body.branded .next-up-card, body.branded .calendar-agenda-row, body.branded .calendar-grid {
  border-radius: min(var(--radius-control, 8px), 1.25rem);
}
body.branded.branded-square .card, body.branded.branded-square .attention-card { border-radius: 0; }
body.branded.branded-pill .band-tabs { padding: 0.25rem; }
body.branded .band-tabs .band-tab.active { background: var(--accent); color: var(--accent-contrast); box-shadow: none; }
body.branded-dark .card, body.branded-dark .attention-card { box-shadow: none; }
body.branded-dark img.logo-mark, body.branded-dark .logo-mark rect { filter: none; }

/* The band's or community's banner on its home page: its mark or logo,
   its name in its display font, tagline in its second accent, website. */
.brand-banner {
  display: flex; align-items: center; gap: 1rem; margin: 0 0 1.2rem;
  padding: 1.1rem 1.2rem; background: var(--brand-header, var(--bg-raised)); color: var(--brand-header-fg, var(--fg));
  border-radius: min(var(--radius-control, var(--radius)), 1.25rem);
}
.brand-mark {
  flex: none; width: 3rem; height: 3rem; display: grid; place-items: center;
  border: 1.5px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 1.4rem;
}
.brand-logo { flex: none; width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: 50%; }
.brand-banner-text { min-width: 0; }
.brand-name { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.brand-tagline { margin: 0.25rem 0 0; color: var(--accent-2, var(--fg-muted)); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; }
.brand-website { display: inline-block; margin-top: 0.3rem; font-size: 0.85rem; color: inherit; opacity: 0.75; }

/* Look & feel form (brand-editor.js). */
.brand-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.5rem 1rem; }
.brand-color { display: grid; grid-template-columns: 2.4rem 1fr; grid-template-rows: auto auto; gap: 0.2rem 0.4rem; font-size: 0.85rem; color: var(--fg-muted); }
.brand-color span { grid-column: 1 / -1; }
.brand-color input[type=color] { width: 2.4rem; height: 2.2rem; padding: 0.1rem; border: 1px solid var(--border); background: none; }
.brand-color input[type=color].unset { opacity: 0.35; }
.brand-color input[type=text] { font-family: var(--font-mono); }
body.branded .sidebar-crumb, body.branded .sidebar-crumb a { color: var(--sidebar-fg); opacity: 0.75; }

/* ==== Stage mode (stage.js) ===============================================
   The song page for playing: no sidebar, bars, player or pickers; larger
   type; a close button and the previous/next songs' names. */
.stage-exit, .stage-foot { display: none; }
html:has(body.stage) { font-size: 118%; }
body.stage .desktop-sidebar, body.stage .song-context-bar, body.stage .global-tabbar,
body.stage #song-structure-strip, body.stage #audio-player, body.stage .notation-pickers,
body.stage #mode-segmented, body.stage #instrument-picker, body.stage .topbar-utility-mobile,
body.stage .song-topbar .topbar-prev, body.stage .song-topbar .topbar-next,
body.stage .stack-sheet, body.stage .stack-backdrop, body.stage .sidebar-transport { display: none !important; }
body.stage .song-topzone { padding-top: 0.4rem; padding-bottom: 0.2rem; }
body.stage .content-row, body.stage .content-main { padding-bottom: 3rem; }
body.stage .stage-exit {
  display: inline-flex; position: fixed; z-index: 70;
  top: calc(env(safe-area-inset-top, 0px) + 0.4rem); right: 0.5rem;
  background: var(--bg-raised); border: 1px solid var(--border); opacity: 0.85;
}
body.stage .stage-foot {
  display: flex; justify-content: space-between; gap: 1rem; position: fixed; z-index: 69; left: 0; right: 0; bottom: 0;
  padding: 0.5rem 0.9rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 92%, transparent); border-top: 1px solid var(--border); font-size: 0.85rem;
}
.stage-foot a { color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%; }
.stage-foot-next { margin-left: auto; text-align: right; }

/* ==== The editor's header on a phone ======================================
   One row: the song's title, undo/redo, Save and close (Discard only once
   there is something to discard); the five tabs scroll on one line under
   it instead of wrapping into a second block. */
@media (max-width: 600px) {
  .edit-title-row { flex-wrap: nowrap; padding: 0.4rem 0.5rem 0.3rem 0.8rem; gap: 0.3rem; }
  .edit-title-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.3rem; }
  .edit-title-main h2 { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
  .edit-title-prefix { display: none; }
  .edit-dirty-text { display: none; }
  .edit-title-actions { gap: 0.2rem; flex: none; }
  .edit-title-actions .icon-btn { width: 2.4rem; height: 2.4rem; min-width: 2.4rem; min-height: 2.4rem; }
  .edit-title-actions #edit-discard-btn:disabled { display: none; }
  .edit-title-actions .primary { padding: 0.45rem 0.8rem; }
  .edit-topzone .prep-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; margin: 0; padding: 0 0.5rem 0.4rem; }
  .edit-topzone .prep-tabs::-webkit-scrollbar { display: none; }
  .edit-topzone .prep-tab { flex: none; padding: 0.4rem 0.75rem; }
}
/* Hints about hovering mean nothing on a touch screen. */
@media (hover: none) { .hint.hover-only { display: none; } }

/* ==== Forms pass (Nov 2026): page-specific fixes ==================== */

/* ---- auth group (login, invite, join, welcome, profile) ---- */

/* A password input with its Show/Hide button (static/js/password-fields.js) side by side; the input takes the room. */
.pw-field { display: flex; gap: 0.4rem; align-items: stretch; }
.pw-field > input { flex: 1 1 auto; min-width: 0; }
/* The toggle never shrinks or wraps its label. */
.pw-toggle { flex: none; white-space: nowrap; }

/* Instrument icon checkboxes are now .sr-only (were display:none, unreachable by keyboard): anchor them and show focus on the visible label. */
.instrument-icon-btn { position: relative; }
.instrument-icon-btn:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The getting-started "Create a band" card is now a form; its field stack fills the card instead of shrinking to the input. */
.wizard-option > .form-stack { align-self: stretch; }
/* Stacked on a phone, the wizard's option boxes size to their content (flex-basis 220px was meant as a width, became a height). */
@media (max-width: 760px) { .wizard-option { flex-basis: auto; } }

/* Roster quick-add: a field error (forms.js puts it after the input) goes on its own row under the form's grid instead of taking a column. */
.roster-quick-add .field-error { grid-column: 1 / -1; order: 1; }
/* Roster rows: the saved/failed line after a role change, remove or new link stays small. */
.roster-row > .form-status { font-size: 0.8rem; }
/* A not-yet-joined row is a grid: its status line takes a full row of its own. */
.roster-row-pending > .form-status { grid-column: 1 / -1; }
/* Band header (it wraps): the music-type/rename status takes its own line under the title row. */
.app-header #band-header-status { font-size: 0.8rem; flex-basis: 100%; order: 10; }
/* Song picker (proposals, Discover): the result list only shows a box once it has results. */
.song-pick-results:empty { display: none; }
/* Each result is a full-width button styled as a list row, title over artist. */
.song-pick-results button.attention-row { width: 100%; flex-direction: column; align-items: flex-start; gap: 0; text-align: left; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none; font: inherit; color: var(--fg); }
.song-pick-results button.attention-row:last-child { border-bottom: none; }
/* Set lists page: the "New set list" form opens under its summary with a little air. */
.setlist-new > .form-stack { margin-top: 0.6rem; }
/* Look & feel: each color's name is now a real <label> (was a span), spanning the picker + hex field row. */
.brand-color > label { grid-column: 1 / -1; }
/* Look & feel: a bad hex code's error spans the color cell too. */
.brand-color > .field-error { grid-column: 1 / -1; }

/* ---- community group (forms pass) ---- */

/* .create-row (communities.html, now a <form>): the outcome line takes its own row under the field + buttons. */
.create-row .form-status { flex-basis: 100%; }
/* On a phone the create-row's field takes the full row instead of holding a 16rem minimum beside the buttons. */
@media (max-width: 600px) {
  .create-row .field { flex: 1 1 100%; }
  .create-row .field input { min-width: 0; width: 100%; }
}

/* datetime-local (community_admin event form): iOS gives it an intrinsic min width that can push past a 375px card, and centres the value; keep it inside the column and left-aligned like the other fields. */
.form-stack input[type="datetime-local"] { display: block; min-width: 0; }
input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; }

/* A save-on-change status inside a flex row (admin_person membership rows) wraps under the row's controls. */
.import-row .form-status { flex-basis: 100%; }

/* play.html reference link form: .reference-edit-row's display:flex (now also .form-stack) beat the [hidden] UA rule, so the edit field never hid. */
.reference-edit-row[hidden] { display: none; }
/* play.html reference link form: room above the form now it stacks label, hint, field and button. */
.reference-edit-row.form-stack { margin-top: 0.6rem; }
/* song.js header fields: genre is free text, so its chip field is wider than the 4.5rem tempo/time ones. */
.song-meta-chips-row .header-field-genre { width: 8rem; text-align: left; }
/* song.js header fields: the genre "Saved." line sits in the chip row, vertically centred with the fields. */
.song-meta-chips-row .form-status { align-self: center; }
/* project.html new-song wizard: a field with help text (label, hint, control as siblings) stacks like the wrapping-label fields beside it. */
.wizard-fields .field { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; min-width: 10rem; }
.wizard-fields .field > label { font-size: 0.85rem; color: var(--fg-muted); }
.wizard-fields .field > input, .wizard-fields .field > textarea { width: 100%; }

/* ==== Calendar, Next up, band overview (Nov 2026) ===================== */
/* What kind of date it is, the same color everywhere: gigs in the
   accent, rehearsals in the olive "ok" tone, anything else muted. */
.kind-gig { --kind: var(--accent); }
.kind-rehearsal { --kind: var(--ok); }
.kind-event { --kind: var(--fg-muted); }

.next-up-card {
  border: 1px solid var(--border); border-left: 4px solid var(--kind, var(--accent));
  border-radius: var(--radius); background: var(--bg-raised); padding: 0.9rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.next-up-when { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--kind, var(--accent)); }
.next-up-title { font-size: 1.2rem; font-weight: 700; color: var(--fg); }
.next-up-meta { font-size: 0.88rem; color: var(--fg-muted); }
.next-up-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.chip-link.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600; }

.calendar-head { align-items: center; }
.calendar-nav { display: flex; align-items: center; gap: 0.25rem; }
.calendar-nav-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem;
  border-radius: 999px; color: var(--fg); border: 1px solid var(--border); background: var(--bg-raised);
}
.calendar-nav-btn:hover { text-decoration: none; border-color: var(--accent); }
.calendar-nav-today { font-size: 0.85rem; padding: 0 0.5rem; }
.calendar-grid { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.calendar-grid th { padding: 0.4rem 0; font-size: 0.75rem; font-weight: 600; color: var(--fg-faint); }
.calendar-grid abbr { text-decoration: none; }
.calendar-grid td { border-top: 1px solid var(--border); vertical-align: top; padding: 0; height: 3rem; }
.calendar-grid td.is-other { background: var(--bg-sunken); }
.calendar-grid td.is-other .calendar-date { color: var(--fg-faint); }
.calendar-day { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 3px; height: 100%; min-height: 3rem; padding: 0.3rem; color: var(--fg); }
a.calendar-day:hover { text-decoration: none; background: var(--bg-sunken); }
.calendar-date { flex: 0 0 100%; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.calendar-grid td.is-past .calendar-date { color: var(--fg-faint); }
.calendar-date[aria-current="date"] {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem;
  margin-right: calc(100% - 1.7rem); border-radius: 999px; background: var(--fg); color: var(--bg); font-weight: 700;
}
.calendar-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--kind); flex: none; }
.calendar-item { display: inline-flex; align-items: center; }
/* Titles in the cells only where there's room for them. */
.calendar-item-title { display: none; }
.calendar-legend { display: flex; gap: 1rem; list-style: none; margin: 0.5rem 0 0.8rem; padding: 0; font-size: 0.78rem; color: var(--fg-muted); }
.calendar-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.calendar-agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.calendar-agenda-row {
  display: flex; align-items: center; gap: 0.9rem; padding: 0.6rem 0.8rem; border: 1px solid var(--border);
  border-left: 4px solid var(--kind); border-radius: var(--radius); background: var(--bg-raised); scroll-margin-top: 5rem;
}
.calendar-agenda-row:target { box-shadow: 0 0 0 2px var(--accent); }
.calendar-agenda-row.is-past { opacity: 0.6; }
.calendar-agenda-row .coming-up-date { background: var(--bg-sunken); color: var(--kind); }
.calendar-agenda-text { flex: 1; min-width: 0; }
.calendar-agenda-title { font-weight: 600; color: var(--fg); }
.calendar-agenda-meta { font-size: 0.82rem; color: var(--fg-muted); }
.calendar-kind { color: var(--kind); font-weight: 600; }
@media (min-width: 901px) {
  .calendar-grid td { height: 5.5rem; }
  .calendar-day { min-height: 5.5rem; flex-direction: column; flex-wrap: nowrap; gap: 2px; }
  .calendar-item { width: 100%; gap: 0.3rem; font-size: 0.72rem; line-height: 1.2; }
  .calendar-item-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Continue: the songs opened last, as a short scrolling row on a phone
   and a grid on a wide screen. */
.recent-songs { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.6rem; }
.recent-song {
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.7rem 0.9rem; min-height: 2.75rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); color: var(--fg);
}
.recent-song:hover { text-decoration: none; border-color: var(--accent); }
.recent-song-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-song-artist { font-size: 0.82rem; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Fields side by side that belong together (a date and its times). */
.field-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.field-row > .field { flex: 1 1 7rem; }
/* A card whose form is folded away until asked for. */
.fold-card > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.7rem; }
.fold-card > summary::-webkit-details-marker { display: none; }
.fold-card > summary h2 { margin: 0; }
.fold-card > summary h2::before { content: "+ "; color: var(--accent); }
.fold-card[open] > summary h2::before { content: "− "; }
.fold-card[open] > summary { margin-bottom: 1rem; }
.index > .card + .card, .index > .card + .fold-card, .index > section + .card { margin-top: 1.25rem; }
.danger-zone { border-color: var(--danger); }

/* The band's sections on a phone: a list on the overview instead of a
   row of tabs that scrolls out of sight; each section's header leads
   back. Desktop keeps the tabs and doesn't show the list. */
.band-hub { display: none; }
@media (max-width: 600px) {
  .band-section-tabs { display: none; }
  .band-overview-wide { display: none; }
  .band-hub { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1.4rem; }
  .band-hub-group { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); overflow: hidden; }
  .band-hub-group li + li { border-top: 1px solid var(--border); }
  .band-hub-group a { display: flex; align-items: center; gap: 0.75rem; min-height: 3.1rem; padding: 0.5rem 0.9rem; color: var(--fg); }
  .band-hub-group a:hover { text-decoration: none; background: var(--bg-sunken); }
  .band-hub-group a::after { content: "›"; color: var(--fg-faint); font-size: 1.3rem; line-height: 1; }
  .band-hub-group .icon { width: 1.2rem; height: 1.2rem; color: var(--accent); }
  .band-hub-label { flex: 1; font-weight: 500; }
  .band-hub-state { font-size: 0.85rem; color: var(--fg-muted); }
  .band-hub-state.is-due { color: var(--accent); font-weight: 600; }
}

/* Add songs to a set list: one row per song, its Add button at the end. */
.add-songs-results { list-style: none; margin: 0.8rem 0 0; padding: 0; max-height: 22rem; overflow-y: auto; }
.add-songs-results:empty { display: none; }
.add-songs-results li { display: flex; align-items: center; gap: 0.75rem; padding: 0.4rem 0; border-top: 1px solid var(--border); }
.add-songs-results li > div { flex: 1; min-width: 0; }
@media (max-width: 600px) {
  .calendar-grid td, .calendar-day { height: 2.6rem; min-height: 2.6rem; }
}
.event-setlist { margin: 0.9rem 0 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 0.35rem; }
.event-setlist a { font-weight: 500; }

/* Anton and Bebas Neue only come in one weight: stop the browser from faking a bold over them on branded titles. */
body.branded h1, body.branded h2, body.branded .brand-name { font-synthesis-weight: none; }

/* Profile → Passkeys: each row names the passkey automatically (provider or
   browser); renaming is an optional disclosure under the name, not a
   permanent text box. Place next to the existing .passkeys-table rules. */
/* The name reads as the row's title, with its provider/sync line under it. */
.passkey-name { display: block; }
.passkeys-table .field-hint { margin-top: 0.1rem; }
/* "Rename" stays quiet until wanted; padding gives it a finger-sized target. */
.passkey-rename summary { display: inline-block; cursor: pointer; color: var(--fg-muted); font-size: 0.85rem; padding: 0.35rem 0; }
.passkey-rename summary:hover { color: var(--fg); }
/* Input and Save on one line, the input taking whatever width is left (phone too). */
.passkey-rename-form { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.2rem; }
.passkey-rename-form input { flex: 1 1 auto; min-width: 0; max-width: 18rem; }

/* "Already in the library" list on new-song forms (static/js/library-match.js). */
/* Panel: spaced off the fields above, stacked heading/hint/list/"None of these". */
.library-match { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.8rem 0; }
/* Heading sized like a form section label, not a page heading. */
.library-match-title { margin: 0; font-size: 0.95rem; font-weight: 600; }
/* Hint sits tight under the heading. */
.library-match .hint { margin: 0; }
/* Rows tighter than a dashboard attention-row, and on a phone the button wraps under long titles. */
.library-match-row { padding: 0.6rem 0.8rem; gap: 0.6rem; flex-wrap: wrap; }
/* Title/details take the room and may shrink; the action keeps its size. */
.library-match-text { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
/* The row's action never squeezes into two lines. */
.library-match-row > button, .library-match-row > .chip-link { flex: none; white-space: nowrap; }
/* "None of these — create a new song": a plain link-style button, left-aligned, comfortable tap height. */
.library-match-none { align-self: flex-start; min-height: 2.2rem; }

/* ---- Transpose and chord diagrams per key (song page + editor) ---- */
/* The song's own diagram row is hidden while the view is transposed; its display:flex would beat [hidden]. */
.chord-legend[hidden] { display: none; }
/* "No chord diagrams for G yet": sits where the diagram row would. */
.chord-legend-note { margin: 0 0 1.2em; }
/* Song map hides diagram rows; hide the note with them. */
#sheet[data-render-mode="map"] .chord-legend-note { display: none; }
/* Top bar: key, its transposed name and the -/+ buttons on one line. */
.topbar-key { display: inline-flex; align-items: center; gap: 0.4rem; }
/* Bigger -/+ targets for phones than the old 1.6rem panel buttons. */
.topbar-key .transpose-control button { width: 2rem; height: 2rem; }
/* Editor: the transpose panel opens between the Source toolbar and the text. */
.transpose-panel { margin: 0 0 0.6rem; }
/* After a transpose: the summary, then the "Enter chord diagrams for G" button. */
.transpose-done { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
/* Its display:flex would beat [hidden]. */
.transpose-done[hidden] { display: none; }
/* No extra paragraph margin inside the summary. */
.transpose-done p { margin: 0; }
/* Scores tab: chords with no diagram yet, above the builder. */
.cde-todo { margin: 0.4rem 0 0.8rem; }
/* The list's intro line sits close to its chips. */
.cde-todo .hint { margin: 0 0 0.4rem; }
/* Chord chips wrap in a row (.chip-list is a column). */
.cde-todo-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* GP Import: the steps, and step 1's choice of how the file fits. */
.gpimport-stepper { display: flex; gap: 0.3rem; list-style: none; margin: 0 0 0.8rem; padding: 0; counter-reset: gps; font-size: 0.85rem; }
.gpimport-stepper li { counter-increment: gps; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.7rem 0.25rem 0.3rem; border-radius: 999px; color: var(--fg-muted); background: var(--bg-sunken); }
.gpimport-stepper li::before { content: counter(gps); display: inline-flex; align-items: center; justify-content: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--bg-raised); font-weight: 700; font-size: 0.75rem; }
.gpimport-stepper li.current { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
.gpimport-stepper li.current::before { background: var(--accent); color: var(--accent-contrast); }
.gpimport-stepper li.done::before { content: "✓"; }
.gpimport-stepper li.skipped { opacity: 0.45; text-decoration: line-through; }
.gpimport-fit { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.6rem; margin: 0.6rem 0 0.9rem; }
.gpimport-fit-card { position: relative; display: grid; gap: 0.3rem; padding: 0.8rem 0.9rem 0.8rem 2.4rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-raised); cursor: pointer; }
.gpimport-fit-card input { position: absolute; left: 0.85rem; top: 0.95rem; }
.gpimport-fit-card .t { font-weight: 700; }
.gpimport-fit-card .d { font-size: 0.88rem; color: var(--fg-muted); line-height: 1.4; }
.gpimport-fit-card:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent-bg) 55%, var(--bg-raised)); }
.song-gp-only { display: inline-flex; align-items: center; gap: 0.45rem; margin-top: 0.5rem; font-size: 0.92rem; }
.song-gp-only-note { margin: 0.2rem 0 0; }

/* ---- A community's download area (community_downloads.html) ---------- */
.dl-songbook { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); padding: 1rem 1.1rem; margin: 0 0 1.2rem; }
.dl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.9rem; margin-bottom: 0.8rem; }
.dl-head h2 { margin: 0; font-size: 1.15rem; font-family: var(--font-chart, inherit); }
.dl-head h2 a { color: inherit; text-decoration: none; }
.dl-head h2 a:hover { color: var(--accent); text-decoration: underline; }
.dl-back { margin: 0 0 0.8rem; }
.dl-back a { display: inline-flex; align-items: center; gap: 0.3rem; min-height: 2.75rem; }
.dl-back .icon { width: 1em; height: 1em; }
.dl-meta { font-size: 0.82rem; color: var(--fg-faint); }
.dl-access { font-size: 0.78rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--ok-bg); color: var(--ok); }
.dl-access.sold { background: var(--warn-bg); color: var(--warn); }
.dl-book { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.8rem; border-radius: var(--radius); background: var(--bg-sunken); margin-bottom: 0.8rem; }
.dl-book-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-book-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-book-name .dl-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-ext { flex: none; font: 700 0.7rem/1 var(--font-ui); letter-spacing: 0.04em; color: var(--accent-contrast); background: var(--accent); border-radius: 4px; padding: 0.55rem 0.45rem; }
.dl-btn { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.75rem; padding: 0 0.9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-raised); color: var(--fg); white-space: nowrap; text-decoration: none; font-size: 0.9rem; }
.dl-btn.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); font-weight: 700; }
.dl-btn svg { width: 1em; height: 1em; }
.dl-lessons { list-style: none; margin: 0; padding: 0; }
.dl-lesson { padding: 0.75rem 0; border-top: 1px solid var(--border); }
.dl-lesson-title { min-width: 0; display: flex; align-items: baseline; gap: 0.6rem; font-weight: 600; }
.dl-num { flex: none; width: 1.6rem; text-align: right; font: 600 0.78rem var(--font-mono, monospace); color: var(--fg-faint); }
.dl-lesson-title a { color: inherit; text-decoration: none; }
.dl-lesson-title a:hover { color: var(--accent); text-decoration: underline; }
/* A lesson's files: one line each, under its title. A type badge (GP, a
   play button for a backing track, the extension), the name and size,
   a download button; remove only in edit mode. */
.dl-files { display: grid; gap: 0.4rem; margin-top: 0.55rem; padding-left: 2.2rem; }
.dl-file { display: flex; align-items: center; gap: 0.7rem; min-height: 3rem; padding: 0.25rem 0.25rem 0.25rem 0.3rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-raised); }
.dl-badge { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--fg); font: 700 0.7rem/1 var(--font-mono, monospace); letter-spacing: 0.02em; text-transform: uppercase; }
.dl-file.kind-gp .dl-badge { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.dl-file .dl-play { margin: 0; min-height: 0; min-width: 0; background: var(--bg); border: 1.5px solid var(--fg); color: var(--fg); border-radius: 50%; cursor: pointer; }
.dl-file .dl-play .icon { width: 1rem; height: 1rem; }
.dl-file .dl-play .icon + .icon, .dl-file .dl-play.on .icon:first-child { display: none; }
.dl-file .dl-play.on .icon + .icon { display: inline; }
.dl-file .dl-play.on { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.dl-file-name { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.dl-file-name strong { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-file-name small { font-size: 0.75rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.dl-get, .dl-file .dl-del { flex: none; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 8px; background: none; color: var(--fg-muted); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.dl-get .icon, .dl-file .dl-del .icon { width: 1.15rem; height: 1.15rem; }
@media (hover: hover) {
  .dl-file:hover { border-color: var(--border-strong); }
  .dl-get:hover, .dl-file-name:hover strong { color: var(--accent); }
}
.dl-file .dl-del { display: none; color: var(--danger); }
.dl.editing .dl-file .dl-del { display: inline-flex; }
.dl.editing .dl-get { display: none; }
.dl-lessons-head { display: none; }
/* A wide screen: the lessons as a table, a column per kind of file
   (Guitar Pro, backing track, the rest), so they line up. */
@media (min-width: 760px) {
  .dl-lessons-head, .dl-lesson { display: grid; grid-template-columns: minmax(0, 1fr) 13rem 13rem 13rem; column-gap: 0.8rem; row-gap: 0.4rem; align-items: center; }
  .dl-lesson { padding: 0.45rem 0; }
  .dl-lessons-head { padding: 0 0 0.35rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-faint); }
  .dl-lessons-head span:first-child { padding-left: 2.2rem; }
  .dl-files { display: contents; }
  .dl-file { grid-column: 4; min-height: 0; padding: 0.15rem 0.15rem 0.15rem 0.25rem; gap: 0.55rem; }
  .dl-get, .dl-file .dl-del { width: 2.4rem; height: 2.4rem; }
  .dl-file.kind-gp { grid-column: 2; }
  .dl-file.kind-audio { grid-column: 3; }
  .dl-badge { width: 1.9rem; height: 1.9rem; font-size: 0.64rem; }
  .dl-lesson-title { grid-column: 1; grid-row: 1 / span 3; font-weight: 500; }
}
.dl-size { color: var(--fg-faint); font-size: 0.75rem; margin-left: 0.35rem; }
.dl-book .dl-del { min-height: 2.75rem; min-width: 2.75rem; border-radius: 8px; }
.dl-book .dl-del svg { width: 0.9rem; height: 0.9rem; }
.dl-play.on { color: var(--accent); background: var(--accent-bg); }
.dl-del:hover:not(:disabled) { color: var(--danger); }
.dl-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px dashed var(--border); font-size: 0.88rem; }
.dl-upload select { max-width: 16rem; }
.dl-pick { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; border: 1px solid var(--border-strong); border-radius: 8px; min-height: 2.75rem; padding: 0 0.8rem; }
.dl-pick svg { width: 1em; height: 1em; }
.dl-empty { color: var(--fg-muted); padding: 2rem 0; text-align: center; }
.dl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin: 0 0 0.9rem; }
.dl-del-folder svg { width: 1em; height: 1em; }
.dl-crumbs { display: flex; flex-wrap: wrap; gap: 0.2rem 0.45rem; align-items: baseline; margin: 0 0 0.9rem; font-size: 0.92rem; color: var(--fg-faint); }
.dl-crumbs a { color: var(--fg-muted); }
.dl-crumbs a[aria-current] { color: var(--fg); font-weight: 700; text-decoration: none; }
.dl-tree { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
.dl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem; padding: 0.5rem 0.8rem; }
.dl-row + .dl-row { border-top: 1px solid var(--border); }
.dl-row .dl-ext { min-width: 2.6rem; text-align: center; }
.dl-row .dl-ext.dir { background: var(--bg-sunken); color: var(--fg-muted); }
.dl-row.kind-audio .dl-ext, .dl-row.kind-other .dl-ext { background: var(--fg-muted); }
.dl-row-name { flex: 1 1 12rem; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.dl-folder .dl-row-name { flex-direction: row; }
.dl-row-song { display: flex; align-items: center; gap: 0.4rem; }
.dl-row-song select { max-width: 14rem; }
.dl-row-actions { display: flex; gap: 0.35rem; margin-left: auto; }
.dl-row-actions .dl-btn { min-width: 2.75rem; justify-content: center; padding: 0 0.6rem; }
.dl-row-actions svg { width: 1em; height: 1em; }
.dl-row-actions .dl-play.on { color: var(--accent); background: var(--accent-bg); }
.dl-report { flex-basis: 100%; font-size: 0.85rem; }
.dl-report ul { margin: 0.2rem 0 0.6rem; padding-left: 1.2rem; max-height: 12rem; overflow: auto; }
.admin-links { margin: 0 0 1rem; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.6rem; margin: 0 0 0.8rem; }
.stat-tile { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.8rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
.stat-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.8rem; color: var(--fg-muted); }
.stats-table { width: 100%; }
.stats-table th { text-align: left; }
.stats-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table .stats-path { color: var(--fg-faint); }
.stats h3 { margin: 1rem 0 0.4rem; font-size: 0.95rem; }
/* ---- A course: lessons (course.html) ----------------------------------- */
.course .card + .card, .course .card + .course-lessons, .course-lessons + .card { margin-top: 1.2rem; }
.course-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.2rem; margin-bottom: 1.2rem; }
.course-progress-text { flex: 1 1 14rem; display: flex; flex-direction: column; gap: 0.45rem; }
.course-bar { height: 0.5rem; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.course-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.course-progress .dl-btn { white-space: normal; text-align: left; }
.course-lessons { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
.course-lesson { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.9rem; }
.course-lesson + .course-lesson { border-top: 1px solid var(--border); }
.course-num { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font: 700 0.85rem var(--font-ui); background: var(--bg-sunken); color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.course-lesson.started .course-num { background: var(--accent-bg); color: var(--accent); }
.course-lesson.done .course-num { background: var(--accent); color: var(--accent-contrast); }
.course-lesson-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; min-height: 2.75rem; justify-content: center; }
.course-lesson-main:hover strong { color: var(--accent); }
.course-lesson-main .dl-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-state { flex: none; font-size: 0.78rem; color: var(--fg-faint); }
.course-lesson.done .course-state { color: var(--ok); }
.course-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.9rem; }
.course-form .field { flex: 1 1 14rem; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.course-form .field > label { font-size: 0.82rem; font-weight: 600; color: var(--fg-muted); }
.course-form .field input, .course-form .field select, .course-form .field textarea { width: 100%; }
.course-form .field .hint { margin: 0; }
.course-form .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.course-form .course-field-num { flex: 0 0 6rem; }
.course-form .course-field-wide { flex-basis: 100%; }
.course-form .form-status { flex-basis: 100%; margin: 0; }
.course-from-files { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.lesson-done { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 1rem; }
.lesson-video { position: relative; aspect-ratio: 16 / 9; max-width: 56rem; margin: 0 0 1.2rem; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.lesson-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-text { max-width: 42rem; margin: 0 0 1.2rem; line-height: 1.55; }
.lesson-text p { margin: 0 0 0.8rem; white-space: pre-line; }
.lesson-songs .dl-row-name strong { font-weight: 600; }
.lesson-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem; margin: 1.2rem 0; }
.lesson-nav .dl-btn { white-space: normal; max-width: 100%; }
.lesson-nav .lesson-next { margin-left: auto; }
.lesson-nav svg { width: 1em; height: 1em; flex: none; }
@media (max-width: 560px) {
  .dl-book { flex-wrap: wrap; }
  .dl-book-name { flex-basis: calc(100% - 3rem); }
  .dl-book .dl-btn { flex: 1; justify-content: center; }
}

/* ---- A songbook's playlist (playlist.html) ------------------------------
   Phone: the player, then the songs. Tablet and computer: the player and
   the songs in a column beside the song playing (.pl-map, the song page
   at ?embed=playlist), its map following the recording. */
.pl { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 2rem; }
.pl-player { background: var(--bg-raised); border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.6); box-shadow: var(--shadow); padding: 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.pl-art { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: var(--bg-sunken); }
.pl-cover { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 1rem 1.1rem;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 70%, #000 0%) 0%, color-mix(in srgb, var(--accent) 55%, #1a0f0a) 55%, #140c08 100%); color: #fff; }
.pl-cover[hidden] { display: none; }
.pl-cover::after { content: ""; position: absolute; right: -12%; bottom: -38%; width: 70%; aspect-ratio: 1; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(255,255,255,0.10) 0 1px, transparent 1px 7px); }
.pl-cover-owner { font: 700 0.78rem/1 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.85; position: relative; z-index: 1; }
.pl-cover-key { font-size: 0.95rem; opacity: 0.9; position: relative; z-index: 1; }
.pl-video { position: absolute; inset: 0; }
.pl-video[hidden] { display: none; }
.pl-video iframe, .pl-video > div { width: 100%; height: 100%; border: 0; }
.pl-now { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.pl-now-text { min-width: 0; }
.pl-now h2 { margin: 0; font-size: 1.35rem; line-height: 1.2; font-family: var(--font-chart, inherit); }
.pl-now p { margin: 0.15rem 0 0; color: var(--fg-muted); }
.pl-source { flex: none; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.25rem 0.55rem; border-radius: 999px; background: var(--bg-sunken); color: var(--fg-muted); }
.pl-source.kind-band { background: var(--accent-bg); color: var(--accent); }
.pl-sections { display: flex; gap: 2px; min-height: 1.9rem; }
.pl-sections[hidden] { display: none; }
.pl-seg { flex: 1 1 0; min-width: 0; padding: 0.3rem 0.35rem 0; border: 0; border-top: 3px solid var(--border-strong); border-radius: 0; background: none; text-align: left; font: 600 0.66rem/1.1 var(--font-ui); letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-muted); cursor: pointer; }
.pl-seg span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-seg.unmarked { cursor: default; }
.pl-seg.on { border-top-color: var(--accent); color: var(--accent); }
.pl-scrub { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.pl-scrub input { flex: 1; accent-color: var(--accent); min-height: 2.75rem; }
.pl-controls { display: flex; align-items: center; justify-content: center; gap: 1.4rem; }
.pl-btn { width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.pl-btn .icon { width: 1.35rem; height: 1.35rem; }
.pl-btn.pl-play { width: 4.6rem; height: 4.6rem; background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.pl-btn.pl-play .icon { width: 1.8rem; height: 1.8rem; }
.pl-btn.pl-skip { border-color: transparent; background: none; }
.pl-btn .icon-skip { width: 1.9rem; height: 1.9rem; }
@media (max-width: 480px) { .pl-controls { gap: 0.3rem; justify-content: space-between; } .pl-btn { width: 3rem; height: 3rem; } }
.pl-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.pl-prefer { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--bg); }
.pl-prefer a { padding: 0.45rem 0.8rem; border-radius: 999px; font-size: 0.82rem; color: var(--fg-muted); text-decoration: none; min-height: 2.25rem; display: inline-flex; align-items: center; }
.pl-prefer a.active { background: var(--fg); color: var(--bg); font-weight: 600; }
.pl-open { font-size: 0.88rem; }
.pl-queue h2 { margin: 0 0 0.5rem; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-faint); }
.pl-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); overflow: hidden; }
.pl-list li + li { border-top: 1px solid var(--border); }
.pl-row { width: 100%; display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.8rem; min-height: 3.4rem; border: 0; border-radius: 0; background: none; color: inherit; text-align: left; font: inherit; }
.pl-row:hover { background: var(--bg-sunken); }
.pl-row.current { background: var(--accent-bg); }
.pl-row.current strong { color: var(--accent); }
.pl-row-num { flex: none; width: 1.5rem; text-align: right; font-size: 0.8rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.pl-row-eq { display: none; flex: none; width: 1.5rem; height: 1rem; align-items: flex-end; justify-content: flex-end; gap: 2px; }
.pl-row-eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: pl-eq 0.9s ease-in-out infinite; }
.pl-row-eq i:nth-child(2) { animation-delay: -0.3s; } .pl-row-eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes pl-eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .pl-row-eq i { animation: none; height: 70%; } }
.pl-row.playing .pl-row-num { display: none; }
.pl-row.playing .pl-row-eq { display: inline-flex; }
.pl-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-row-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-row-text small { color: var(--fg-faint); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-row-kind { flex: none; color: var(--fg-faint); display: inline-flex; }
.pl-row-kind.kind-band { color: var(--accent); }
.pl-row-kind .icon { width: 1.1rem; height: 1.1rem; }
.pl-silent { margin-top: 0.8rem; font-size: 0.88rem; color: var(--fg-muted); }
.pl-silent summary { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; }
.pl-silent ul { margin: 0.2rem 0 0.4rem; padding-left: 1.2rem; columns: 2 12rem; }
.pl-map { display: none; }
@media (min-width: 760px) {
  .pl { display: grid; grid-template-columns: minmax(18rem, 24rem) 1fr; grid-template-rows: auto 1fr; grid-template-areas: "player map" "queue map";
        gap: 1rem 1.2rem; height: calc(100dvh - 9rem); padding: 0 1rem 1rem; box-sizing: border-box; }
  .pl-player { grid-area: player; }
  .pl-queue { grid-area: queue; min-height: 0; overflow: auto; }
  .pl-map { grid-area: map; display: block; min-height: 0; border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.6); overflow: hidden; background: var(--bg); box-shadow: var(--shadow); }
  .pl-map iframe { width: 100%; height: 100%; border: 0; display: block; }
  .pl-controls { gap: 1rem; }
  .pl-art { aspect-ratio: 16 / 7; }
  .pl-sections { display: none; } /* the song beside it shows them */
}
@media (min-width: 901px) {
  .playlist-page .app-header { display: none; }
  .pl { height: 100dvh; padding: 1rem 1.2rem 1rem 1rem; }
}

/* The song page beside a playlist's player (?embed=playlist): the chart
   alone, the player around it doing the playing. */
body.embed-playlist .desktop-sidebar, body.embed-playlist .global-tabbar, body.embed-playlist .song-context-bar,
body.embed-playlist .topbar-utility-mobile, body.embed-playlist #audio-player, body.embed-playlist #mode-segmented,
body.embed-playlist .topbar-prev, body.embed-playlist .topbar-next { display: none !important; }
body.embed-playlist .app-content { margin: 0 !important; padding-bottom: 1rem !important; }
.pl-h1-sub { font-weight: 400; color: var(--fg-muted); }
/* A course's playlist on a wide screen: the lesson's video in place of the map. */
.pl-stage { display: none; }
@media (min-width: 760px) {
  .pl-map.pl-stage { display: flex; flex-direction: column; justify-content: center; background: #0d0b0a; }
  .pl-stage-video { position: relative; width: 100%; max-height: calc(100% - 3.5rem); aspect-ratio: 16 / 9; margin: auto 0; }
  .pl-stage-video iframe, .pl-stage-video > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
  .pl-stage-caption { margin: 0; padding: 0.7rem 1rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline; justify-content: space-between; background: var(--bg-raised); border-top: 1px solid var(--border); }
}

/* ---- A band's recordings (band_recordings.html) ------------------------ */
.rec-source { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; margin: 0 0 1rem; font-size: 0.88rem; color: var(--fg-muted); }
.rec-fixes-link { font-weight: 600; }
.rec-fixes-link.quiet { font-weight: 400; }
.rec-layout { display: grid; gap: 1rem; }
@media (min-width: 900px) { .rec-layout { grid-template-columns: 1fr 19rem; align-items: start; } }
.rec-session-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.rec-session-head h2 { margin: 0; font-size: 1.2rem; }
.rec-session-head .hint { margin: 0.1rem 0 0; }
.rec-session-nav { display: flex; gap: 0.4rem; }
.rec-session-nav svg { width: 1em; height: 1em; }
.rec-list { list-style: none; margin: 0; padding: 0; }
.rec-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.2rem; min-height: 3.2rem; }
.rec-row + .rec-row { border-top: 1px solid var(--border); }
.rec-row.playing { background: var(--accent-bg); border-radius: 8px; }
.rec-row.playing strong, .rec-row.playing strong a { color: var(--accent); }
.rec-play { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-raised); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.rec-play .icon { width: 1rem; height: 1rem; }
.rec-row.playing .rec-play { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.rec-num { flex: none; width: 1.4rem; text-align: right; color: var(--fg-faint); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.rec-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rec-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-text strong a { color: inherit; text-decoration: none; }
.rec-text strong a:hover { color: var(--accent); text-decoration: underline; }
.rec-text small { color: var(--fg-faint); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-ref { color: var(--accent); font-weight: 600; }
.rec-unknown { font-style: italic; }
.rec-rating { flex: none; margin-right: 0.15rem; display: inline-flex; flex-direction: column; align-items: flex-end; gap: 0.1rem; }
/* Five stars, filled to --stars (0 to 5, by halves): the outline row, and
   the filled row over it clipped to the share of five. */
.rec-stars { position: relative; display: inline-block; font-size: 1.15rem; line-height: 1; letter-spacing: 0.08em; cursor: pointer; color: color-mix(in srgb, var(--fg) 16%, transparent); padding: 0.35rem 0; touch-action: manipulation; }
.rec-stars::before { content: "★★★★★"; }
.rec-stars::after { content: "★★★★★"; position: absolute; left: 0; top: 0.35rem; color: #e0a526; overflow: hidden; white-space: nowrap; width: calc(var(--stars, 0) / 5 * 100%); }
.rec-stars:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.rec-stars-avg { font-size: 0.72rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; min-height: 0.9rem; }
.rec-side { display: flex; flex-direction: column; gap: 1rem; }
.rec-calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.rec-calendar-head h3 { margin: 0; font-size: 1rem; }
.rec-calendar-head svg { width: 1em; height: 1em; }
.rec-cal { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.82rem; text-align: center; }
.rec-cal th { color: var(--fg-faint); font-weight: 600; padding: 0.2rem 0; }
.rec-cal td { padding: 2px; }
.rec-cal td span, .rec-cal td a { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 50%; color: var(--fg-muted); text-decoration: none; min-height: 2rem; }
.rec-cal td.is-other span { opacity: 0.35; }
.rec-cal td.has-session a { background: var(--accent-bg); color: var(--accent); font-weight: 700; }
.rec-cal td.is-selected a { background: var(--accent); color: var(--accent-contrast); }
.rec-sessions h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.rec-sessions ol { list-style: none; margin: 0; padding: 0; max-height: 22rem; overflow: auto; }
.rec-sessions li a { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.45rem 0.4rem; border-radius: 6px; color: inherit; text-decoration: none; font-size: 0.88rem; }
.rec-sessions li a small { color: var(--fg-faint); }
.rec-sessions li.is-selected a { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.rec-stats { margin-top: 1.6rem; }
.rec-stats h2 { font-size: 1.1rem; }
.rec-stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.8rem; }
.rec-stat-cards .card { padding: 0.9rem 1rem; }
.rec-stat-cards h3 { margin: 0 0 0.4rem; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-faint); }
.rec-stat-cards ol, .rec-stat-cards ul { margin: 0; padding-left: 1.2rem; font-size: 0.9rem; }
.rec-stat-cards li { padding: 0.15rem 0; }
.rec-stat-cards li small { color: var(--fg-faint); margin-left: 0.4rem; }
.rec-all { margin-top: 1rem; }
.rec-all summary { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; font-weight: 600; }
/* The recordings' player. A phone: a mini player floating over the tab
   bar (tile, title, play, +15, a thin progress line), opening into a full
   sheet. A wide screen: one bar, everything in it, opening into a panel in
   the middle of the screen, in two columns on a landscape one (the player,
   the recordings). */
.rec-player { position: sticky; bottom: 0; z-index: 30; margin-top: 1rem; }
.rec-player[hidden] { display: none; }
.rp-card { position: relative; background: var(--bg-raised); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(0,0,0,0.08); }
.rp-backdrop, .rp-grab, .rp-close, .rp-queue { display: none; }
.rp-head { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.rp-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.7rem; padding: 0; border: 0; background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.rp-tile { flex: none; width: 3rem; height: 3rem; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); color: var(--accent-contrast); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); }
.rp-tile small { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.rp-tile b { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 0.1rem; }
.rec-player.is-concert .rp-tile { background: linear-gradient(150deg, #6b5bd6, #3f3297); color: #fff; }
.rp-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.rp-meta strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-meta small { color: var(--fg-muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-stars .rec-rating { margin: 0; }
.rp-btn { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0; background: none; color: var(--fg); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
@media (hover: hover) { .rp-btn:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); } }
.rp-btn .icon { width: 1.15rem; height: 1.15rem; }
.rp-btn .icon-skip { width: 1.6rem; height: 1.6rem; }
.rp-play { width: 3.3rem; height: 3.3rem; background: var(--accent); color: var(--accent-contrast); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
@media (hover: hover) { .rp-play:hover { background: var(--accent); filter: brightness(1.06); } }
.rp-play .icon { width: 1.35rem; height: 1.35rem; }
.rec-player:not(.is-open) .rp-close { display: none; }
/* The scrubber: a range input over a track filled to --p (0 to 1), the
   A–B loop shaded under it. */
.rp-scrub { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "pos track left"; align-items: center; gap: 0.6rem; font-size: 0.75rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.rp-scrub #rec-pos { grid-area: pos; } .rp-scrub .rp-left { grid-area: left; text-align: right; min-width: 2.6rem; }
.rp-track { grid-area: track; position: relative; height: 1.6rem; display: flex; align-items: center; --p: 0; }
.rp-track::before { content: ""; position: absolute; left: 0; right: 0; height: 5px; border-radius: 3px; pointer-events: none;
  background: linear-gradient(to right, var(--accent) calc(var(--p) * 100%), color-mix(in srgb, var(--fg) 16%, transparent) 0); }
.rp-loop { position: absolute; height: 13px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 22%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); pointer-events: none; }
.rp-loop[hidden] { display: none; }
.rp-track input { position: relative; width: 100%; margin: 0; height: 1.6rem; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.rp-track input::-webkit-slider-runnable-track { height: 5px; background: none; }
.rp-track input::-moz-range-track { height: 5px; background: none; }
.rp-track input::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border-radius: 50%; background: var(--fg); border: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.rp-track input::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--fg); border: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.rp-transport { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.rp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.rp-chip { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.2rem; padding: 0 0.8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--fg-muted); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-chip .icon { width: 0.95rem; height: 0.95rem; }
.rp-chip[aria-pressed="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.rp-speed { padding: 0; }
.rp-speed select { border: 0; background: none; color: inherit; font: inherit; padding: 0 0.8rem; min-height: 2.2rem; cursor: pointer; -webkit-appearance: none; appearance: none; }
.rp-line, .rp-upnext { display: none; }

/* A wide screen, closed: [tile, title, stars, open] [transport over the
   scrubber] [tools]. */
@media (min-width: 901px) {
  .rec-player:not(.is-open) .rp-card { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(18rem, 1.6fr) minmax(12rem, 1fr); grid-template-areas: "head transport tools" "head scrub tools"; align-items: center; gap: 0.15rem 1.4rem; padding: 0.55rem 1.2rem 0.6rem; }
  .rec-player:not(.is-open) .rp-head { grid-area: head; flex-wrap: wrap; row-gap: 0; }
  .rec-player:not(.is-open) .rp-head .rp-stars { order: 3; flex-basis: 100%; padding-left: 3.7rem; margin-top: -0.2rem; }
  .rec-player:not(.is-open) .rp-stars .rec-rating { flex-direction: row; align-items: center; gap: 0.4rem; }
  .rp-mini { display: none; }
  .rec-player:not(.is-open) .rp-transport { grid-area: transport; }
  .rec-player:not(.is-open) .rp-scrub { grid-area: scrub; }
  .rec-player:not(.is-open) .rp-tools { grid-area: tools; justify-content: flex-end; }
}

/* A phone: the mini player, and the sheet it opens into. The mini player
   is fixed over the tab bar, like the tab bar, not sticky: iOS Safari
   lost a sticky player once its card had been fixed (the open sheet) and
   back, and never drew it again. The page keeps room for it. */
@media (max-width: 900px) {
  .rec-player { position: fixed; left: 0; right: 0; bottom: var(--tabbar-h, 4.2rem); z-index: 55; margin: 0; padding: 0.6rem 0.5rem 0.4rem; background: linear-gradient(to bottom, transparent, var(--bg) 1.2rem); }
  body:has(.rec-player:not([hidden])) main { padding-bottom: 5.6rem; }
  .rp-card { border: 1px solid var(--border); border-radius: 14px; padding: 0.5rem 0.4rem 0.5rem 0.5rem; box-shadow: 0 8px 28px rgba(0,0,0,0.22); overflow: hidden; }
  .rp-tile { width: 2.75rem; height: 2.75rem; border-radius: 8px; }
  .rp-tile b { font-size: 1.1rem; }
  .rec-player :is(.rp-expand, .rp-close) { display: none; }
  .rec-player:not(.is-open) :is(.rp-stars, .rp-scrub, .rp-transport, .rp-tools) { display: none; }
  .rp-line { display: block; position: absolute; left: 0.7rem; right: 0.7rem; bottom: 0; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--fg) 12%, transparent); }
  .rp-line i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; }
  .rp-mini .icon { width: 1.3rem; height: 1.3rem; }
  .rec-player.is-open .rp-card { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92dvh;
    border-radius: 22px 22px 0 0; border-width: 1px 0 0; padding: 0.4rem 1.3rem calc(1.4rem + env(safe-area-inset-bottom)); animation: rp-up 0.22s ease-out; }
  .rec-player.is-open .rp-grab { display: block; align-self: center; width: 3rem; height: 1.6rem; border: 0; padding: 0; background: none; cursor: pointer; position: relative; }
  .rec-player.is-open .rp-grab::before { content: ""; position: absolute; left: 0.6rem; right: 0.6rem; top: 0.6rem; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--fg) 25%, transparent); }
  .rec-player.is-open .rp-tile { width: min(52vw, 13rem); }
}

/* Open, at any size: the tile big, the title under it, the controls
   large, the recordings after them. */
.rec-player.is-open { z-index: 90; }
.rec-player.is-open .rp-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.45); }
.rec-player.is-open .rp-card { overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 1.1rem; }
.rec-player.is-open .rp-head { flex-direction: column; gap: 0.9rem; }
.rec-player.is-open .rp-open { flex-direction: column; text-align: center; gap: 1rem; width: 100%; cursor: default; }
.rec-player.is-open .rp-tile { width: 13rem; height: auto; aspect-ratio: 1; border-radius: 22px; box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 35%, transparent); }
.rec-player.is-concert.is-open .rp-tile { box-shadow: 0 14px 40px rgba(63,50,151,0.4); }
.rec-player.is-open .rp-tile small { font-size: 1.1rem; }
.rec-player.is-open .rp-tile b { font-size: 4.6rem; margin-top: 0.3rem; }
.rec-player.is-open .rp-meta { width: 100%; align-items: center; }
.rec-player.is-open .rp-meta strong { font-size: 1.35rem; white-space: normal; }
.rec-player.is-open .rp-meta small { font-size: 0.9rem; }
.rec-player.is-open .rp-stars .rec-stars { font-size: 1.7rem; letter-spacing: 0.12em; }
.rec-player.is-open .rp-stars .rec-rating { align-items: center; }
.rec-player.is-open :is(.rp-mini, .rp-line, .rp-expand) { display: none; }
.rec-player.is-open .rp-scrub { grid-template-columns: 1fr 1fr; grid-template-areas: "track track" "pos left"; row-gap: 0.1rem; }
.rec-player.is-open .rp-scrub #rec-pos { text-align: left; }
.rec-player.is-open .rp-transport { justify-content: space-between; max-width: 22rem; width: 100%; margin: 0 auto; }
.rec-player.is-open .rp-btn .icon { width: 1.4rem; height: 1.4rem; }
.rec-player.is-open .rp-btn .icon-skip { width: 2rem; height: 2rem; }
.rec-player.is-open .rp-play { width: 4.4rem; height: 4.4rem; }
.rec-player.is-open .rp-play .icon { width: 1.8rem; height: 1.8rem; }
.rec-player.is-open .rp-tools { justify-content: center; }
.rec-player.is-open .rp-upnext { display: block; margin: -0.3rem 0 0; text-align: center; font-size: 0.82rem; color: var(--fg-faint); }
/* The recordings: the one playing lit. */
.rec-player.is-open .rp-queue { display: block; list-style: none; margin: 0; padding: 0.6rem 0 0; border-top: 1px solid var(--border); }
.rp-queue button { width: 100%; display: flex; align-items: center; gap: 0.7rem; min-height: 2.9rem; padding: 0.35rem 0.6rem; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
@media (hover: hover) { .rp-queue button:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); } }
.rp-q-num { flex: none; width: 1.4rem; text-align: right; font-size: 0.8rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.rp-q-text { min-width: 0; display: flex; flex-direction: column; }
.rp-q-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-q-text small { font-size: 0.76rem; color: var(--fg-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-queue .is-current button { background: var(--accent-bg); }
.rp-queue .is-current strong { color: var(--accent); }

/* A wide screen, open: a panel in the middle, closed by its ×, Escape or
   a click beside it. */
@media (min-width: 901px) {
  .rec-player.is-open .rp-card { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(38rem, 92vw); max-height: min(92dvh, 64rem);
    border: 1px solid var(--border); border-radius: 22px; padding: 1.4rem 1.8rem 1.6rem; box-shadow: 0 30px 80px rgba(0,0,0,0.45); animation: rp-in 0.18s ease-out; }
  .rec-player.is-open .rp-close { display: inline-flex; position: absolute; top: 0.8rem; right: 0.8rem; z-index: 1; }
}
/* A landscape screen, open: the player and the recordings side by side. */
@media (min-width: 1100px) and (min-aspect-ratio: 5/4) {
  .rec-player.is-open .rp-card { width: min(64rem, 94vw); height: min(40rem, 88dvh); display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);
    grid-template-rows: auto auto auto auto auto 1fr; grid-template-areas: "head queue" "scrub queue" "transport queue" "tools queue" "upnext queue" ". queue"; column-gap: 2rem; row-gap: 1.1rem; overflow: hidden; }
  .rec-player.is-open .rp-head { grid-area: head; }
  .rec-player.is-open .rp-scrub { grid-area: scrub; }
  .rec-player.is-open .rp-transport { grid-area: transport; }
  .rec-player.is-open .rp-tools { grid-area: tools; }
  .rec-player.is-open .rp-upnext { grid-area: upnext; }
  .rec-player.is-open .rp-queue { grid-area: queue; overflow: auto; border-top: 0; border-left: 1px solid var(--border); padding: 0 0 0 1rem; margin-top: 2rem; }
}
@keyframes rp-up { from { transform: translateY(40%); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes rp-in { from { transform: translate(-50%, -46%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rec-player.is-open .rp-card { animation: none; } }
html.rp-locked { overflow: hidden; }
.rec-reference { border: 0; padding: 0; margin: 0; }
.rec-reference legend { font-weight: 700; margin-bottom: 0.4rem; }
.rec-pick { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; min-height: 2.75rem; }
.rec-pick input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
.rec-none { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; margin-top: 0.4rem; }
.rec-questions { list-style: none; margin: 0; padding: 0; }
.rec-questions li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; padding: 0.6rem 0; }
.rec-questions li + li { border-top: 1px solid var(--border); }
.rec-question-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.rec-fixes .card + .card { margin-top: 1rem; }
.rec-fixes form { margin-top: 1rem; }
.rec-layout { grid-template-columns: minmax(0, 1fr); }
.rec-layout > * { min-width: 0; }
@media (min-width: 900px) { .rec-layout { grid-template-columns: minmax(0, 1fr) 19rem; } }
@media (max-width: 560px) {
  .rec .card { padding: 0.9rem 0.8rem; }
  .rec-row { gap: 0.45rem; padding: 0.4rem 0; }
  .rec-num { display: none; }
  .rec-stars { font-size: 1rem; letter-spacing: 0; }
  .rec-session-head h2 { font-size: 1.05rem; }
}

/* ---- A songbook's look, made from its songs' covers (project.html,
   docs/covers.md). The colors are the look's own (--look-*), whatever the
   page's brand: a banner, like a playlist's header in a music player. */
.sb-look { display: grid; grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); gap: 1.4rem; align-items: end; margin-bottom: 1.2rem; padding: 1.2rem;
  border-radius: calc(var(--radius) * 1.6); color: var(--look-fg); overflow: hidden; position: relative;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--look-accent) 42%, var(--look-header)) 0%, var(--look-header) 55%, var(--look-bg) 100%); }
.sb-look.look-light { background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--look-accent) 22%, var(--look-bg)) 0%, var(--look-bg) 70%); border: 1px solid color-mix(in srgb, var(--look-fg) 10%, transparent); }
.sb-mosaic { display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 1; border-radius: calc(var(--radius) * 0.8); overflow: hidden; box-shadow: 0 18px 40px rgba(0,0,0,0.35); }
.sb-mosaic a, .sb-mosaic img { display: block; width: 100%; height: 100%; }
.sb-mosaic img { object-fit: cover; }
.sb-look-text { min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.sb-look-eyebrow { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--look-accent-2); }
/* The second accent reads on the look's header (dark); on a light banner
   the accent does. */
.sb-look.look-light .sb-look-eyebrow { color: var(--look-accent); }
.sb-look h2 { margin: 0; font-family: var(--look-font, var(--font-display)); font-size: clamp(1.8rem, 5vw, 3.2rem); line-height: 1.02; color: var(--look-fg); }
.sb-look-genres { margin: 0; font-weight: 600; color: var(--look-fg); }
.sb-look-artists { margin: 0; font-size: 0.9rem; color: var(--look-muted); }
.sb-look-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 0.6rem; }
.sb-look-play { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.75rem; padding: 0 1.2rem; border-radius: var(--radius-control, 999px);
  background: var(--look-accent); color: var(--look-on-accent); font-weight: 700; text-decoration: none; }
.sb-look-play .icon { width: 1rem; height: 1rem; }
.sb-look-hues { display: inline-flex; border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.sb-look-hues i { width: 1.3rem; height: 0.7rem; }
.song-cover { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 4px; object-fit: cover; background: var(--bg-sunken); box-shadow: inset 0 0 0 1px var(--border); }
@media (max-width: 560px) {
  .sb-look { grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.9rem; padding: 0.9rem; align-items: center; }
  .sb-look-artists { display: none; }
  .sb-look-foot { grid-column: 1 / -1; margin-top: 0; }
  .sb-look-text { display: contents; }
  .sb-look-text > :not(.sb-look-foot) { grid-column: 2; }
  .sb-mosaic { grid-row: 1 / span 3; }
  .song-cover { width: 2.1rem; height: 2.1rem; }
}
/* The playlist's art: the song's cover, sharp, over a blur of itself. */
.pl-cover-blur { position: absolute; inset: -10%; width: 120%; height: 120%; object-fit: cover; filter: blur(26px) saturate(1.3) brightness(0.55); }
.pl-cover-art { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); height: 84%; aspect-ratio: 1; object-fit: cover; border-radius: calc(var(--radius) * 0.6); box-shadow: 0 12px 30px rgba(0,0,0,0.45); z-index: 1; }
.pl-cover-blur[hidden], .pl-cover-art[hidden] { display: none; }
.pl-cover.has-art::after { display: none; }
.pl-row-cover { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 4px; object-fit: cover; }
.brand-from-songs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }

/* The header's Edit button (edit-toggle): who may edit a course or its
   downloads sees them as a student does until it's on. */
.edit-toggle { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.5rem; padding: 0 0.8rem; margin-left: auto; border: 1px solid currentColor; border-radius: 999px;
  background: transparent; color: inherit; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; opacity: 0.9; white-space: nowrap; }
.edit-toggle .icon { width: 0.95rem; height: 0.95rem; }
.edit-toggle.on { background: #e8a33a; border-color: #e8a33a; color: #1a1205; opacity: 1; }
.app-header .edit-toggle + .notif-bell, .app-header .edit-toggle ~ * { margin-left: 0; }
body:has(.edit-toggle.on) main { box-shadow: inset 0 3px 0 #e8a33a; }

/* ---- The tuner (tuner.html, tuner.js). A meter from −50 to +50 cents:
   the needle at --cents, the ±3 cent zone in the middle, green when the
   note holds there. ---- */
.tuner { max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.1rem; padding: 1.2rem; --tuner-ok: #2f9e5b; --tuner-off: #d9822b; }
.tuner-picks { display: flex; gap: 0.5rem; }
.tuner-pick { flex: 1; min-width: 0; }
.tuner-pick-capo { flex: 0 0 7.5rem; }
.tuner-pick select { width: 100%; min-height: 2.75rem; font-size: 1rem; }
.tuner-dial { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.6rem 0 0.2rem; }
.tuner-readout { display: flex; align-items: baseline; gap: 0.9rem; min-height: 6.2rem; }
.tuner-note { font: 800 5.4rem/1 var(--font-display, var(--font-ui)); letter-spacing: -0.02em; color: var(--fg-faint); transition: color 0.15s; }
.tuner-note sub { font-size: 1.6rem; font-weight: 600; margin-left: 0.15rem; vertical-align: baseline; color: var(--fg-faint); }
.tuner.hearing .tuner-note { color: var(--fg); }
.tuner.in-tune .tuner-note { color: var(--tuner-ok); }
.tuner-cents { font: 600 1.3rem var(--font-mono, monospace); color: var(--fg-muted); min-width: 4.5rem; font-variant-numeric: tabular-nums; }
.tuner.flat .tuner-cents, .tuner.sharp .tuner-cents { color: var(--tuner-off); }
.tuner.in-tune .tuner-cents { color: var(--tuner-ok); }
.tuner-meter { position: relative; width: 100%; height: 5.2rem; --cents: 0; }
.tuner-scale { position: absolute; left: 0; right: 0; top: 0.4rem; height: 2.6rem; }
.tuner-scale i { position: absolute; left: calc(50% + var(--t) * 1%); width: 2px; height: 0.9rem; margin-left: -1px; background: color-mix(in srgb, var(--fg) 25%, transparent); border-radius: 1px; bottom: 0; }
.tuner-scale i.major { height: 1.5rem; background: color-mix(in srgb, var(--fg) 45%, transparent); }
.tuner-scale i.zero { height: 2.6rem; width: 3px; margin-left: -1.5px; background: var(--fg); }
.tuner-zone { position: absolute; top: 0.2rem; height: 3rem; left: 45%; width: 10%; border-radius: 6px; background: color-mix(in srgb, var(--tuner-ok) 16%, transparent); }
.tuner.in-tune .tuner-zone { background: color-mix(in srgb, var(--tuner-ok) 38%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--tuner-ok) 55%, transparent); }
.tuner-needle { position: absolute; top: 0; height: 3.4rem; width: 4px; margin-left: -2px; border-radius: 2px; left: calc(50% + var(--cents) * 1%); background: var(--fg-faint); transition: left 0.08s linear, background 0.15s; }
.tuner.hearing .tuner-needle { background: var(--tuner-off); }
.tuner.in-tune .tuner-needle { background: var(--tuner-ok); }
.tuner-needle::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: inherit; }
.tuner-labels { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font: 600 0.72rem var(--font-mono, monospace); color: var(--fg-faint); }
.tuner-state { margin: 0.2rem 0 0; font-weight: 600; min-height: 1.4em; text-align: center; }
.tuner.in-tune .tuner-state { color: var(--tuner-ok); }
.tuner-hz { margin: 0; font-size: 0.8rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.tuner-strings { display: flex; justify-content: center; gap: 0.45rem; flex-wrap: wrap; }
.tuner-strings[hidden] { display: none; }
.tuner-string { flex: 1 1 0; max-width: 4.2rem; min-width: 2.9rem; min-height: 3.6rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; padding: 0; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--bg); color: var(--fg); cursor: pointer; }
.tuner-string b { font-size: 1.25rem; font-weight: 700; }
.tuner-string small { font-size: 0.68rem; color: var(--fg-faint); }
.tuner-string.current { border-color: var(--tuner-off); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tuner-off) 35%, transparent); }
.tuner-string.tuned { border-color: var(--tuner-ok); background: color-mix(in srgb, var(--tuner-ok) 14%, var(--bg)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tuner-ok) 40%, transparent); }
.tuner-string.locked { border-style: dashed; border-color: var(--fg); }
.tuner-string.ringing { background: var(--accent-bg); border-color: var(--accent); }
.tuner-capo { margin: -0.4rem 0 0; text-align: center; font-size: 0.88rem; color: var(--fg-muted); }
.tuner-start { min-height: 3.2rem; font-size: 1.05rem; }
.tuner.listening .tuner-start { background: var(--bg-raised); color: var(--fg); border: 1px solid var(--border-strong); }
.tuner-foot { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }
.tuner-cal { display: inline-flex; align-items: center; gap: 0.4rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.tuner-foot .hint { margin: 0; font-size: 0.8rem; max-width: 26rem; }
/* The player's round buttons stay round whatever a brand's button shape. */
body.branded :is(.rec-play, .rp-btn) { border-radius: 50%; }
/* A set list's "Our recordings | Reference" (setlist_overview.html), as
   the playlist's choice. */
.setlist-prefer { display: flex; width: fit-content; margin: 0 auto 0.8rem; }
/* The set list's tabs, centred; auto margins rather than justify-content,
   so a row wider than a phone still scrolls from its first tab. */
.setlist-tabs { display: flex; margin-left: auto; margin-right: auto; width: fit-content; max-width: 100%; }
.setlist-tabs > :first-child { margin-left: auto; }
.setlist-tabs > :last-child { margin-right: auto; }
.setlist-prefer button { padding: 0.45rem 0.9rem; border: 0; border-radius: 999px; background: none; font: inherit; font-size: 0.85rem; color: var(--fg-muted); min-height: 2.25rem; cursor: pointer; }
.setlist-prefer button[aria-pressed="true"] { background: var(--fg); color: var(--bg); font-weight: 600; }
/* The Corrections page's names (band_recordings.html). */
.rec-names code, .rec-own-templates code { font-size: 0.85rem; white-space: nowrap; }
.rec-names small { color: var(--fg-muted); word-break: break-word; }
.rec-template-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem; margin-top: 1rem; }
.rec-template-form .field { flex: 1 1 18rem; margin: 0; }
.rec-template-form .field input { font-family: var(--font-mono, monospace); }
.rec-template-form .form-status, .rec-template-try { flex-basis: 100%; }
.rec-template-try { border-top: 1px solid var(--border); padding-top: 0.6rem; font-size: 0.85rem; }
.rec-try-row { padding: 0.35rem 0; border-bottom: 1px dashed var(--border); }
.rec-try-row div { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }
.rec-try-row b { color: var(--fg-faint); font-weight: 600; margin-right: 0.2rem; }
.rec-templates-title { margin: 1.2rem 0 0.2rem; font-size: 1rem; }
.rec-templates { margin: 0.4rem 0 0; padding-left: 1.6rem; display: flex; flex-direction: column; gap: 0.25rem; }
.rec-template { padding: 0.3rem 0; }
.rec-template.own { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; border-bottom: 1px solid var(--border); }
.rec-template.own code { flex: 1 1 14rem; }
.rec-template-count { font-size: 0.8rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.rec-template-actions { display: inline-flex; gap: 0.25rem; }
.rec-template-actions .dl-btn { min-width: 2.5rem; justify-content: center; }
.rec-template-actions .dl-btn:disabled { opacity: 0.35; }
.rec-template-where { flex: 0 0 9rem !important; }
.rec-builtins { margin-top: 1rem; }
.rec-builtins summary { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; font-weight: 600; }
.rec-files select { max-width: 16rem; }
.rec-template-form .field input { width: 100%; }
/* The lesson a song is in, at the top of its page (play.html): one row
   (the course and lesson, then Video, Files, Done), the video or the
   files opening under it. */
.lesson-panel { margin: 0 0 0.9rem; padding: 0.55rem 0.6rem 0.55rem 0.9rem; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--bg-raised); }
.lesson-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; }
.lesson-panel-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 14rem; color: inherit; text-decoration: none; line-height: 1.25; }
.lesson-panel-kicker { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-panel-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-panel-title:hover .lesson-panel-name { color: var(--accent-ink); text-decoration: underline; }
.lesson-panel-actions { display: flex; gap: 0.35rem; flex: none; }
.lesson-panel-btn { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.5rem; padding: 0 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-control, 6px); background: var(--bg); color: var(--fg); font: inherit; font-size: 0.88rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.lesson-panel-btn .icon { margin: 0; width: 1rem; height: 1rem; }
.lesson-panel-btn small { color: var(--fg-muted); font-weight: 500; }
.lesson-panel-btn:hover { border-color: var(--border-strong); }
.lesson-panel-btn[aria-expanded="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-ink); }
.lesson-panel-done[aria-pressed="true"] { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.lesson-panel-video .lesson-video { margin: 0.6rem 0 0.2rem; }
.lesson-panel-files:not([hidden]) { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.lesson-panel-files a { display: flex; align-items: center; gap: 0.6rem; min-height: 2.5rem; color: inherit; text-decoration: none; }
.lesson-panel-files a:hover .lesson-panel-file { text-decoration: underline; }
.lesson-panel-file { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-panel-files small { color: var(--fg-faint); white-space: nowrap; }
.lesson-video-close { display: none; }
.lesson-panel-video.docked { aspect-ratio: 16 / 9; max-width: 56rem; margin: 0.6rem 0 0.2rem; }
.lesson-panel-video.docked .lesson-video { position: fixed; z-index: 60; right: 1rem; bottom: 1rem; width: min(24rem, 42vw); margin: 0; box-shadow: var(--shadow-lg, var(--shadow)); }
.lesson-panel-video.docked .lesson-video-close { display: inline-flex; position: absolute; z-index: 1; top: 0.3rem; right: 0.3rem; width: 2.2rem; height: 2.2rem; min-width: 0; min-height: 0; background: rgb(0 0 0 / 0.6); color: #fff; border: none; }
.lesson-panel-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.8rem; margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px solid var(--border); font-size: 0.85rem; }
.lesson-panel-prev, .lesson-panel-next { display: inline-flex; align-items: center; gap: 0.3rem; min-width: 0; min-height: 2.2rem; color: var(--fg-muted); text-decoration: none; }
.lesson-panel-prev span, .lesson-panel-next span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-panel-next { justify-self: end; max-width: 100%; }
.lesson-panel-prev:hover, .lesson-panel-next:hover { color: var(--fg); }
.lesson-panel-prev .icon, .lesson-panel-next .icon { flex: none; margin: 0; }
/* Done: the next lesson is the way on (Teachable's "complete and continue"). */
.lesson-panel:has(.lesson-panel-done[aria-pressed="true"]) .lesson-panel-next { padding: 0 0.8rem; border-radius: var(--radius-control, 6px); background: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.lesson-panel-progress { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--fg-muted); white-space: nowrap; }
.lesson-panel-meter { width: 5rem; height: 0.35rem; border-radius: 999px; background: linear-gradient(to right, var(--ok) var(--done), var(--bg-sunken) var(--done)); }
@media (max-width: 600px) {
  .lesson-panel-actions { width: 100%; }
  .lesson-panel-btn { flex: 1; justify-content: center; padding: 0 0.5rem; }
  .lesson-panel-name { white-space: normal; }
  .lesson-panel-meter { width: 3rem; }
  .lesson-panel-prev span { display: none; }
  .lesson-panel-nav { grid-template-columns: auto auto minmax(0, 1fr); gap: 0.6rem; }
  .lesson-panel-video.docked .lesson-video { width: 55vw; bottom: calc(4.6rem + env(safe-area-inset-bottom)); }
}
/* A coaching community (coaching.html): students, their voice, lessons. */
:root { --voice-chest: #C8553D; --voice-mixed: #D9A441; --voice-head: #4C8DB5; }
.coach-students { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.8rem; }
.coach-student { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.8rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); color: inherit; text-decoration: none; }
.coach-student:hover { border-color: var(--border-strong); }
.coach-student-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.coach-student-ranges { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.voice-chart { position: relative; padding-top: 1.1rem; }
.voice-chart-keys { position: absolute; inset: 0 0 auto 0; height: 1rem; font-size: 0.68rem; color: var(--fg-faint); }
.voice-chart-keys span { position: absolute; transform: translateX(-50%); }
.voice-chart-keys span:first-child { transform: none; }
.voice-chart-keys span:last-child { transform: translateX(-100%); }
.voice-chart-row { position: relative; height: 0.55rem; margin: 0.18rem 0; border-radius: 999px; background: var(--bg-sunken); }
.voice-chart-bar { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.is-chest.voice-chart-bar, .voice-tag.is-chest { background: var(--voice-chest); }
.is-mixed.voice-chart-bar, .voice-tag.is-mixed { background: var(--voice-mixed); }
.is-head.voice-chart-bar, .voice-tag.is-head { background: var(--voice-head); }
.voice-tag { display: inline-flex; align-items: center; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--bg-sunken); color: var(--fg); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.voice-tag.is-chest, .voice-tag.is-mixed, .voice-tag.is-head { color: #fff; }
.voice-ranges { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.8rem; }
.voice-range { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.voice-range .voice-tag { min-width: 7.5rem; justify-content: center; }
.voice-range label { display: inline-flex; align-items: center; gap: 0.35rem; }
.voice-range select { min-height: 2.5rem; }
.voice-range .voice-note { flex: 1 1 12rem; min-height: 2.5rem; }
.coach-notes { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 1rem; font-weight: 600; }
.coach-notes textarea { width: 100%; font: inherit; font-weight: 400; }
.coach-songs { display: flex; flex-direction: column; }
.coach-song { display: flex; align-items: center; gap: 0.6rem; min-height: 3rem; border-bottom: 1px solid var(--border); }
.coach-song-title { flex: 1; min-width: 0; color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-song-title:hover strong { text-decoration: underline; }
.coach-key { display: inline-flex; align-items: center; gap: 0.2rem; }
.coach-key button { width: 2.4rem; height: 2.4rem; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-control, 6px); background: var(--bg); font: inherit; font-size: 1.1rem; cursor: pointer; }
.coach-key output { min-width: 2.2rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.coach-key-label { color: var(--fg-muted); font-size: 0.88rem; white-space: nowrap; }
.coach-song .icon-btn { width: 2.4rem; height: 2.4rem; min-width: 0; min-height: 0; }
.coach-add-song { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.coach-add-song select { flex: 1; min-width: 0; min-height: 2.5rem; }
.coach-new-lesson summary { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem; cursor: pointer; font-weight: 600; }
.coach-lesson-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.7rem; margin-top: 0.6rem; }
.coach-lesson-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.88rem; font-weight: 600; }
.coach-lesson-form input, .coach-lesson-form select { min-height: 2.5rem; font: inherit; }
.coach-lesson-form fieldset { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.coach-lesson-form fieldset label { flex-direction: row; align-items: center; font-weight: 400; }
.coach-lesson-form button { grid-column: 1 / -1; justify-self: start; }
.coach-lesson { display: flex; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.coach-lesson-time { flex: none; width: 4.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.coach-lesson-time .hint { display: block; font-weight: 400; }
.coach-lesson-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.coach-lesson-who { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.coach-lesson-edit summary { cursor: pointer; color: var(--fg-muted); font-size: 0.88rem; min-height: 2rem; display: flex; align-items: center; }
.coach-lesson-students { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.4rem 0; }
.coach-lesson-actions { display: flex; gap: 0.5rem; }
.lesson-tag { display: inline-flex; align-items: center; padding: 0.05rem 0.5rem; border: 1px solid var(--border); border-radius: 999px; color: var(--fg-muted); font-size: 0.75rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.lesson-tag.is-online { border-color: var(--accent); color: var(--accent-ink); }
.teaching-note-form { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0 0.8rem; }
.teaching-note-form textarea, .teaching-note textarea { width: 100%; font: inherit; }
.teaching-note-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.teaching-note-row select { flex: 1 1 14rem; min-height: 2.5rem; }
.teaching-notes { display: flex; flex-direction: column; }
.teaching-note { padding: 0.6rem 0; border-top: 1px solid var(--border); }
.teaching-note-head { display: flex; align-items: baseline; gap: 0.4rem; }
.teaching-note-head .link-btn { margin-left: auto; }
.teaching-note-body { margin: 0.3rem 0 0; white-space: pre-wrap; }
.coach-group-songs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.coach-group-song-list { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; font-size: 0.9rem; }
.coach-subscribe { margin: 0.4rem 0 0.8rem; font-size: 0.9rem; }
.coach-subscribe a { display: inline-flex; align-items: center; gap: 0.35rem; }
.calendar-subscribe-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }
.calendar-subscribe-btn { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem; padding: 0 1rem; border: 1px solid var(--border); border-radius: var(--radius-control, 6px); color: var(--fg); text-decoration: none; font-weight: 600; }
.calendar-subscribe-btn.is-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.calendar-subscribe-url { display: flex; flex-direction: column; gap: 0.4rem; margin: 1rem 0 0.4rem; }
.calendar-subscribe-copy { display: flex; gap: 0.4rem; }
.calendar-subscribe-copy input { flex: 1; min-width: 0; min-height: 2.5rem; font: inherit; font-size: 0.85rem; }
.topbar-meta-item.key-context { color: var(--accent-ink); font-weight: 600; }
