/* Hallmark · shape: app screens, home is a hymnal page beside the sample chart · genre: editorial · theme: brand (paper and olive kept, olive deepened) · direction: user mockup, with the type and spacing from cfd4373 at the owner's request · redesign: full (home and site chrome), restyle (every other page)
 * paper: oklch(96.5% 0.011 84) · card: oklch(93.4% 0.014 105) tint with oklch(96.3% 0.011 95) cells (cfd4373) · accent: oklch(38.5% 0.068 128) · display: Atkinson Hyperlegible Next · body: Public Sans · chords: Atkinson Hyperlegible Next bold (cfd4373 sizes, weights, line-heights and tracking)
 * nav: open-book mark and wordmark left, Song library as a plain link, language, outlined Sign in, a rule under · signature: the sample chart card, transposed live, printed or expanded · states: hover, active, focus, disabled, selected, pressed, invalid, empty, loading
 * axes: light/grotesk-sans/chromatic-olive · posture: restrained · hero: Stage (/) · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H5 E4 S5 R4 V4 · weakest: E, the editor screens still carry many small controls; their layout is kept as asked and they take the new type and colour only */
/* Hallmark · desktop pass 2026-12-04 · from 1024px: content capped at 1280px with growing gutters, compact hero band beside a shorter sample card, the library table on the first screen, 34px controls (44px on touch from 761px); phones untouched; from 1600px the page grows to 1480px and scales up in steps (zoom 1.1-1.45) · swept in app scope, no waivers needed */
/* Hallmark · dropped "An original practice chart. Press − or + to change the key." · the mockup card carries "Sample chart" and the − + buttons instead; the i18n key is kept */
/* Hallmark · reworded "Chord charts in the key you play." to "For the musicians in your church." · the owner's mockup headline · "Private · {state}" to "Private: {state}", and "Original sample · not a published library chart" to "Original sample, not a published library chart", "Shared snapshot · Not reviewed" to "Shared snapshot, not reviewed" · 63 names dot-joined meta */
/* Hallmark · reworded "0123456789101112" to "None, then 1 to 12" · the capo list shows None for 0 as in the owner's mockup; the option value stays 0 */
/* Hallmark · dismissed 77 · home is an app home: the hero, the sample chart and the reviewed-charts list, as before; no sections were added or cut */
/* Hallmark · answered F4 · one filled button per screen (.primary); the pressed Chords | Numbers side is a filled segment because it is a toggle state, not an action, as the owner asked; Song library is a plain link with an underline for the current page; Sign in is outlined */
/* Hallmark · audit polish 2026-12-05 · redesign: polish · every colour now a :root token (Google button, print, ok/warn, metronome), spacing on the --space scale, splash gets its one line and a filled Browse songs, glued arrows and the middle dot removed */
/* Hallmark · dismissed 3 · the coloured left edge of each chart section is the section colour key (Intro green, Chorus gold) that the song map and badges repeat */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Public Sans";
  src: url("/public-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* cover fonts (public/cover.mjs): only download where a cover with a title shows */
@font-face {
  font-family: "Anton";
  src: url("/anton.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* chart page cover art: light title type and the darkening behind it */
  --color-hero-ink: oklch(98% 0.01 80); --color-hero-shade-mid: oklch(0% 0 0 / 0.35); --color-hero-shade: oklch(12% 0.01 60 / 0.85);
  /* colour: warm paper, dark ink and a terracotta/salmon accent, in OKLCH (2026-12-04 redesign from Ivan's mockup) */
  --color-paper: oklch(96.4% 0.011 62);
  --color-paper-2: oklch(93.4% 0.014 58);
  --color-paper-3: oklch(90.4% 0.016 56);
  --color-tint: oklch(88.5% 0.01 62);       /* sample card: warm stone grey (neutral, sits behind the white bubbles) */
  --color-tint-cell: oklch(95.2% 0.024 84);  /* chord cells: cream, not white */
  --color-field: oklch(99% 0.004 60);
  /* controls inside the beige chart card: tinted, never white */
  --color-tint-control: var(--color-field);
  --color-tint-hover: var(--color-paper-2);
  --color-tint-press: var(--color-paper-3);
  --color-ink: oklch(23% 0.012 50);
  --color-ink-2: oklch(36% 0.014 50);
  --color-muted: oklch(47% 0.016 50);
  --color-rule: oklch(87.5% 0.014 55);
  --color-rule-strong: oklch(80% 0.018 55);
  --color-edge: oklch(58% 0.016 50);
  --color-bar: oklch(23% 0.012 50);
  --color-accent: oklch(50% 0.13 36);
  --color-accent-2: oklch(45% 0.125 35);
  --color-accent-3: oklch(40% 0.115 34);
  --color-accent-ink: oklch(98.5% 0.006 60);
  --color-accent-wash: oklch(92.5% 0.035 45);
  --color-salmon: oklch(73% 0.105 38);         /* logo tile, selected switch, active tab */
  --color-salmon-2: oklch(69% 0.11 37);
  --color-salmon-wash: oklch(91.5% 0.04 48);  /* small pills: beta, Sample chart */
  --color-chord: oklch(21% 0.01 50);
  --color-focus: oklch(50% 0.14 36);
  --color-rust: oklch(52.3% 0.121 38);
  --color-rust-wash: oklch(95% 0.02 45);
  --color-rust-wash-2: oklch(91% 0.035 42);
  --color-rust-ink: oklch(42% 0.12 35);
  --color-accent-wash-2: oklch(88.5% 0.045 44);
  --color-yt: oklch(20% 0.008 50);             /* Watch on YouTube: near-black */
  --color-yt-2: oklch(30% 0.01 50);
  /* section colours: Intro green, Verse purple, Pre-Chorus teal, Chorus gold, Bridge rose, Interlude/Instrumental blue, Outro taupe */
  --sec-intro: oklch(66% 0.085 140);   --sec-intro-wash: oklch(93.5% 0.03 140);
  --sec-verse: oklch(62% 0.085 315);   --sec-verse-wash: oklch(93.5% 0.026 315);
  --sec-pre: oklch(63% 0.075 200);     --sec-pre-wash: oklch(93.5% 0.025 200);
  --sec-chorus: oklch(76% 0.12 78);    --sec-chorus-wash: oklch(94.5% 0.045 85);
  --sec-bridge: oklch(63% 0.11 15);    --sec-bridge-wash: oklch(93.5% 0.03 15);
  --sec-inter: oklch(63% 0.07 250);    --sec-inter-wash: oklch(93.5% 0.022 250);
  --sec-outro: oklch(60% 0.03 60);     --sec-outro-wash: oklch(93% 0.012 60);
  --color-danger: oklch(47% 0.145 29);
  --color-scrim: oklch(25% 0.014 95 / 0.38);
  --color-shadow: oklch(25% 0.014 95 / 0.08);
  /* stage mode: a dark screen for playing live */
  --color-stage-bg: oklch(16% 0.008 100);
  --color-stage-sunk: oklch(20% 0.01 100);
  --color-stage-dim: oklch(64% 0.012 95);
  --color-stage-raise: oklch(27% 0.014 100);
  --color-stage-ink: oklch(94% 0.012 90);
  --color-stage-muted: oklch(74% 0.016 95);
  --color-stage-rule: oklch(37% 0.016 100);
  --color-stage-bar: oklch(63% 0.02 100);
  --color-stage-focus: oklch(82% 0.12 130);
  --color-print-ink: oklch(16% 0.006 100);
  --color-print-paper: oklch(99.4% 0.002 100);
  --color-print-rule: oklch(45% 0.01 100);
  --color-print-hair: oklch(82% 0.006 100);
  --color-print-muted: oklch(58% 0.006 100);
  --color-ok: oklch(42% 0.1 150);           /* Verified, Live, done */
  --color-ok-wash: oklch(94% 0.04 150);
  --color-ok-edge: oklch(84% 0.06 150);
  --color-warn: oklch(42% 0.1 70);
  --color-warn-wash: oklch(94% 0.06 80);
  --color-now: oklch(92% 0.09 85);           /* play along: the bar being played */
  --color-now-edge: oklch(70% 0.15 70);
  --color-beat: oklch(78% 0.13 45 / .6);     /* metronome flash */
  --color-beat-strong: oklch(71% 0.17 40 / .8);
  --color-beat-fill: oklch(80% 0.12 45);
  --color-lift: oklch(20% 0.01 60 / .22);    /* shadow under floating bars */
  --color-google-bg: #fff;                   /* Google's sign-in button colours (their brand rules) */
  --color-google-ink: #1f1f1f;
  --color-google-edge: #747775;
  --color-google-hover: #f2f2f2;

  /* type */
  --font-display: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Public Sans", ui-sans-serif, system-ui, sans-serif;
  --font-chord: var(--font-display);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-xs: 0.8125rem; --text-sm: 0.875rem; --text-md: 1rem; --text-lg: 1.125rem; --text-xl: 1.375rem; --text-2xl: 1.75rem; --text-3xl: 2.25rem;
  --text-display: clamp(2.5rem, 1.4rem + 3vw, 4.25rem);
  --tracking-display: -0.02em;

  /* space: the 4px scale */
  --space-3xs: 2px; --space-2xs: 4px; --space-xs: 8px; --space-sm: 12px; --space-md: 16px; --space-lg: 24px; --space-xl: 40px; --space-2xl: 64px; --space-3xl: 96px; --space-4xl: 144px;

  --container: 1360px; --gutter: 40px; /* content 1280px at most (1480px, scaled up, on big monitors: see wide screens) */
  --radius-control: 6px; --radius-card: 12px; --radius-small: 4px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-micro: 120ms; --dur-short: 220ms;
  --z-raised: 10; --z-dropdown: 100; --z-sticky: 200; --z-modal: 400; --z-toast: 500; --z-skip: 600;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
.status-strip { display: none; }
html, body { overflow-x: clip; }
html { background: var(--color-paper); scrollbar-color: var(--color-edge) var(--color-paper); }
body { margin: 0; background: var(--color-paper); color: var(--color-ink); font-family: var(--font-body); font-size: var(--text-md); line-height: 1.55; font-synthesis: none; caret-color: var(--color-accent); -webkit-font-smoothing: antialiased; }
::selection { background: var(--color-accent-wash); color: var(--color-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: var(--tracking-display); line-height: 1.1; text-wrap: balance; overflow-wrap: break-word; min-width: 0; }
h1 { font-size: var(--text-3xl); margin: 0 0 var(--space-md); max-width: 24ch; }
h2 { font-size: var(--text-xl); margin: var(--space-lg) 0 var(--space-xs); }
h3 { font-size: var(--text-lg); }
p { line-height: 1.6; text-wrap: pretty; }
a { color: var(--color-accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--color-accent-2); }
a:active { color: var(--color-accent-3); }
code { font-family: var(--font-mono); background: var(--color-paper-2); padding: 0 var(--space-2xs); border-radius: var(--radius-small); color: var(--color-ink); }
[hidden] { display: none !important; }
.muted, .subline { color: var(--color-muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* focus: one ring, instant, on every control */
:where(a, button, input, select, textarea, summary, label.dropzone, [tabindex]):focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
:where(input, select, textarea):focus-visible { outline-offset: 0; }
main:focus, main:focus-visible { outline: none; }

/* ---------- controls ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: 40px; padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--color-edge); border-radius: var(--radius-control);
  background: transparent; color: var(--color-ink); line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
button:hover, .button:hover { background: var(--color-paper-2); color: var(--color-ink); }
button:active, .button:active { background: var(--color-paper-3); }
button:disabled, button:disabled:hover { background: var(--color-paper-3); border-color: var(--color-rule); color: var(--color-muted); cursor: not-allowed; }
.primary, .button.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.primary:hover, .button.primary:hover { background: var(--color-accent-2); border-color: var(--color-accent-2); color: var(--color-accent-ink); }
.primary:active, .button.primary:active { background: var(--color-accent-3); border-color: var(--color-accent-3); }
.primary:disabled, .primary:disabled:hover { background: var(--color-paper-3); border-color: var(--color-rule); color: var(--color-muted); }
.quiet, .button.quiet, button.quiet { border-color: transparent; }
.danger { color: var(--color-danger); }
.danger:hover { color: var(--color-danger); }
button.icon { min-width: 40px; padding: var(--space-xs) var(--space-sm); font-family: var(--font-display); font-weight: 700; }
button.with-icon { gap: var(--space-xs); padding-inline: var(--space-sm) var(--space-md); }
.ico { flex: none; }
.text-link, button.text-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0; border: 0; background: transparent; color: var(--color-accent); font-size: var(--text-md); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em; cursor: pointer; }
.text-link:hover, button.text-link:hover { background: transparent; color: var(--color-accent-3); text-decoration-thickness: 2px; }
.text-link:active, button.text-link:active { background: transparent; color: var(--color-accent-3); }
button.text-link:disabled, button.text-link:disabled:hover { background: transparent; color: var(--color-muted); }
/* Chords | Numbers: one outlined pill, the pressed side filled (a state, not an action) */
.segmented { display: inline-flex; border: 1px solid var(--color-edge); border-radius: var(--radius-control); overflow: hidden; }
.segmented button.seg { border: 0; border-radius: 0; min-height: 38px; padding: var(--space-xs) var(--space-md); background: var(--color-field); }
.segmented button.seg + button.seg { border-left: 1px solid var(--color-edge); }
.segmented button.seg:hover { background: var(--color-paper-2); }
.segmented button.seg:active { background: var(--color-paper-3); }
.segmented button.seg[aria-pressed=true] { background: var(--color-accent); color: var(--color-accent-ink); }
.segmented button.seg:focus-visible { outline-offset: -3px; outline-color: var(--color-focus); }
.segmented button.seg[aria-pressed=true]:focus-visible { outline-color: var(--color-accent-ink); }

input, textarea, select {
  min-height: 40px; max-width: 100%; padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-edge); border-radius: var(--radius-control);
  background: var(--color-field); color: var(--color-ink);
}
textarea { line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--color-muted); opacity: 1; }
input:disabled, select:disabled, textarea:disabled { background: var(--color-paper-3); color: var(--color-muted); cursor: not-allowed; }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--color-danger); }
label { display: flex; flex-direction: column; gap: var(--space-xs); font-size: var(--text-sm); font-weight: 600; }
label input, label select, label textarea { font-weight: 400; font-size: var(--text-md); }
.helper { font-size: var(--text-sm); color: var(--color-muted); line-height: 1.55; font-weight: 400; }
.check { flex-direction: row; align-items: start; font-weight: 400; margin: var(--space-md) 0; line-height: 1.5; font-size: var(--text-md); }
.check input { min-height: 0; margin-top: var(--space-2xs); width: 18px; height: 18px; accent-color: var(--color-accent); }

/* ---------- header and footer ---------- */
.skip { position: absolute; left: var(--space-md); top: calc(-1 * var(--space-4xl)); }
.skip:focus { top: var(--space-xs); z-index: var(--z-skip); background: var(--color-field); padding: var(--space-md); }
header {
  display: flex; align-items: center; gap: var(--space-lg); min-height: 72px;
  width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--container) - 2 * var(--gutter)); margin: 0 auto; padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-rule-strong);
}
.brand { display: flex; align-items: center; gap: var(--space-sm); text-decoration: none; color: var(--color-ink); font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; line-height: 1; }
.brand:hover { color: var(--color-ink); }
.brand small { font-family: var(--font-body); font-size: var(--text-xs); font-weight: 500; letter-spacing: 0; color: var(--color-muted); margin-left: var(--space-2xs); }
.mark { flex: none; }
nav { display: flex; gap: var(--space-2xs); }
header nav { margin-left: var(--space-md); }
nav a { color: var(--color-ink-2); text-decoration: none; padding: var(--space-xs) var(--space-sm); font-size: var(--text-md); white-space: nowrap; text-underline-offset: 0.35em; }
nav a:hover { color: var(--color-ink); text-decoration: underline; text-decoration-thickness: 1px; }
nav a:active { color: var(--color-accent-3); }
nav a.active { color: var(--color-ink); text-decoration: underline; text-decoration-color: var(--color-accent); text-decoration-thickness: 2px; }
#language { margin-left: auto; font-size: var(--text-sm); background-color: var(--color-field); }
#account { white-space: nowrap; border-color: var(--color-accent); color: var(--color-accent-3); }
#account:hover { background: var(--color-accent-wash); color: var(--color-accent-3); }
#account:active { background: var(--color-paper-3); }
footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-md);
  width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--container) - 2 * var(--gutter)); margin: 0 auto; padding: var(--space-lg) 0;
  border-top: 1px solid var(--color-rule); color: var(--color-muted); font-size: var(--text-sm);
}
#footer-text { max-width: 70ch; line-height: 1.55; }
#copyright { font-size: var(--text-sm); }

/* ---------- page frame ---------- */
main { max-width: var(--container); margin: 0 auto; padding: var(--space-xl) var(--gutter) var(--space-2xl); min-height: 75vh; }
main.editing { padding-top: var(--space-lg); }
.intro { max-width: 62ch; margin: 0 0 var(--space-lg); font-size: var(--text-lg); }
.actions { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; }
.banner { padding: var(--space-sm) var(--space-md); background: var(--color-paper-2); border-radius: var(--radius-control); font-size: var(--text-sm); line-height: 1.6; margin: var(--space-md) 0; max-width: 80ch; }
.banner p { margin: 0 0 var(--space-xs); }
.import-banner { background: var(--color-rust-wash); }
.back { display: inline-block; color: var(--color-muted); text-decoration: none; font-size: var(--text-sm); margin-bottom: var(--space-xs); }
.back:hover { color: var(--color-ink); text-decoration: underline; }
.empty { padding: var(--space-lg) 0; max-width: 62ch; }
.empty h2 { margin-top: 0; }

/* ---------- home: a hymnal page beside the sample chart ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-2xl); align-items: start; padding: var(--space-lg) 0 var(--space-2xl); }
.hero h1 { font-size: var(--text-display); line-height: 1.02; letter-spacing: -0.03em; max-width: 11ch; margin: 0 0 var(--space-lg); }
.lead { font-size: var(--text-xl); line-height: 1.45; color: var(--color-ink-2); max-width: 30ch; margin: 0 0 var(--space-xl); }
.hero-copy { padding-top: var(--space-xl); }
.owner-links { margin-top: var(--space-md); }
.demo { margin: 0; padding: var(--space-lg) var(--space-lg) var(--space-md); background: var(--color-tint); border: 0; border-radius: var(--radius-card); min-width: 0; }
.demo-head { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: var(--space-xs) var(--space-lg); }
.demo-name { min-width: 0; }
.demo-title { margin: 0; font-size: var(--text-2xl); max-width: none; }
.demo-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-lg); margin: var(--space-2xs) 0 0; }
.demo-meta div { display: flex; align-items: baseline; gap: var(--space-xs); }
.demo-meta dt { font-size: var(--text-sm); color: var(--color-muted); }
.demo-meta dd { margin: 0; font-size: var(--text-sm); color: var(--color-ink); }
.demo-meta .demo-kind dd { color: var(--color-accent); }
.view-buttons { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.demo .chart-tools { margin: var(--space-md) 0 0; }
.demo .sheet-wrap { --chart-scale: 0.86; }
.demo .sheet { margin-top: var(--space-md); }
.demo .bar { background: var(--color-tint-cell); }
.demo .sheet-meta { display: none; }
.demo select, .demo button:not(.primary), .demo .segmented button.seg { background-color: var(--color-tint-control); }
.demo button:not(.primary):hover, .demo .segmented button.seg:hover { background-color: var(--color-tint-hover); }
.demo button:not(.primary):active, .demo .segmented button.seg:active { background-color: var(--color-tint-press); }
.demo .segmented button.seg[aria-pressed=true] { background: var(--color-accent); color: var(--color-accent-ink); }
.focus .hero { grid-template-columns: minmax(0, 1fr); padding-top: 0; }
.focus .demo { max-width: 1100px; margin-inline: auto; }
.focus .demo .sheet { max-width: none; }
.focus .demo .sheet-wrap { --chart-scale: 1.1; }
.library { padding-top: var(--space-xl); border-top: 1px solid var(--color-rule); }
.library-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-sm) var(--space-lg); }
.library-head h2 { font-size: var(--text-3xl); margin: 0; }
.search { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-xs); max-width: 760px; margin: var(--space-lg) 0 var(--space-xl); }
.search input { font-size: var(--text-lg); }
.search select { min-width: 150px; }

/* ---------- lists ---------- */
.rows { border-top: 1px solid var(--color-rule); max-width: 960px; }
.rows + .rows, .actions + .rows { margin-top: var(--space-lg); }
.song-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); width: 100%; padding: var(--space-md) var(--space-xs); border: 0; border-bottom: 1px solid var(--color-rule); border-radius: 0; text-align: left; color: var(--color-ink); text-decoration: none; min-height: 0; }
a.song-row { color: var(--color-ink); }
.song-row:hover { background: var(--color-paper-2); color: var(--color-ink); }
.song-row:active { background: var(--color-paper-3); }
.song-row strong { display: block; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; margin-bottom: var(--space-2xs); }
.row-sub { display: flex; flex-wrap: wrap; gap: 0 var(--space-md); color: var(--color-muted); font-size: var(--text-sm); }
.row-meta { display: flex; align-items: center; gap: var(--space-md); flex-shrink: 0; }
.row-meta .key { order: 2; min-width: 4ch; text-align: right; font-family: var(--font-chord); font-size: var(--text-xl); color: var(--color-chord); font-weight: 700; }
.tag { font-size: var(--text-xs); color: var(--color-accent-3); background: var(--color-accent-wash); padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-small); }
.rows-head, .song-row .row-cell { display: none; }
.member-row { display: flex; flex-wrap: wrap; gap: 0 var(--space-md); align-items: baseline; }

/* ---------- chart view ---------- */
.title-row { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: var(--space-sm) var(--space-lg); max-width: 980px; }
.song-title { margin-bottom: var(--space-2xs); }
.title-row .song-title { margin: 0 0 var(--space-2xs); }
.subline { margin: 0 0 var(--space-2xs); font-size: var(--text-lg); }
.arrangement { display: block; font-size: var(--text-md); }
.status-line { color: var(--color-muted); font-size: var(--text-sm); margin: 0; }
.links { margin: var(--space-xs) 0 0; }
.owner-actions { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--color-rule); }
.share-url { font-family: var(--font-mono); font-size: var(--text-sm); overflow-wrap: anywhere; }
.report-link { font-size: var(--text-sm); margin-top: var(--space-lg); }
.reader-tools { max-width: 980px; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-lg); align-items: center; justify-content: space-between; border-top: 1px solid var(--color-rule); border-bottom: 1px solid var(--color-rule); padding: var(--space-sm) 0; margin: var(--space-md) 0 var(--space-2xs); }
.chart-tools { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); align-items: center; }
.tool-group { display: flex; align-items: center; gap: var(--space-xs); }
.tool-group.inline { flex-direction: row; font-weight: 400; }
.tool-group.end { margin-left: auto; }
.tool-label { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-2); }
.chart-tools select { min-width: 72px; font-family: var(--font-display); font-weight: 700; }
.chart-tools.compact { gap: var(--space-xs); }
.chart-tools.compact .tool-label { display: none; }
.review-box { border-top: 1px solid var(--color-rule); padding-top: var(--space-lg); margin-top: var(--space-xl); max-width: 80ch; }
.review-box textarea { width: 100%; min-height: 96px; }
.focus header, .focus footer, .focus .nonfocus { display: none; }
.focus main { padding-top: var(--space-lg); }
/* Focus view pins the key toolbar, except when Play along is open: then its slim bar is the one pinned at the top. */
.focus main:not(.has-pa) .toolbar { position: sticky; top: 0; background: var(--color-paper); z-index: var(--z-sticky); }

/* the sheet: big chords in bars, four bars a line */
.sheet-wrap { --chart-scale: 1; }
.sheet { max-width: 980px; margin: var(--space-md) 0 0; line-height: 1.2; }
.sheet-meta { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); margin: 0 0 var(--space-xs); }
.sheet-meta div { display: flex; flex-direction: column; }
.sheet-meta dt { font-size: var(--text-xs); color: var(--color-muted); }
.sheet-meta dd { margin: 0; font-size: var(--text-md); font-weight: 600; color: var(--color-ink); }
.music-section { padding: 0 0 var(--space-md); break-inside: avoid; }
.section-heading { font-family: var(--font-body); font-size: var(--text-md); font-weight: 700; letter-spacing: 0; color: var(--color-ink-2); margin: var(--space-md) 0 var(--space-xs); line-height: 1.3; }
.repeat { color: var(--color-accent); font-weight: 700; }
.bars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bar { display: flex; align-items: center; gap: var(--space-xs); min-height: calc(64px * var(--chart-scale)); padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-sm); border-right: 1.5px solid var(--color-bar); border-bottom: 1px solid var(--color-rule); }
.bar:nth-child(4n+1) { border-left: 2px solid var(--color-bar); }
.bar .c { flex: 1 1 0; min-width: 0; font-family: var(--font-chord); font-size: calc(28px * var(--chart-scale)); font-weight: 700; color: var(--color-chord); letter-spacing: -0.01em; overflow-wrap: anywhere; white-space: normal; }
.bar.split .c { font-size: calc(22px * var(--chart-scale)); overflow-wrap: normal; word-break: keep-all; min-width: auto; }
.bar.split .c + .c { border-left: 1px dotted var(--color-edge); padding-left: var(--space-xs); }
.sheet.solfege .bar .c { overflow-wrap: normal; word-break: keep-all; min-width: 0; }
.bar .c small { display: block; font-family: var(--font-body); font-size: var(--text-xs); font-weight: 400; color: var(--color-muted); }
.bar .c.soft { color: var(--color-muted); font-weight: 400; }
.bar.incomplete { background: var(--color-rust-wash); }
.bar.incomplete .c { color: var(--color-rust); }

/* ---------- create and edit ---------- */
.create .editor-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-lg); padding-bottom: var(--space-xs); }
.create .editor-top .song-title-input { flex: 1 1 320px; }
.song-title-input { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; border: 0; border-bottom: 1px solid var(--color-edge); background: transparent; padding: var(--space-xs) 0; border-radius: 0; width: 100%; min-height: 48px; }
.editor-save { display: flex; align-items: center; gap: var(--space-sm); margin-left: auto; }
.editor-save .helper { white-space: nowrap; }
.unsaved { color: var(--color-rust); }
.basics { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr 1fr; gap: var(--space-sm) var(--space-md); padding: var(--space-sm) 0 var(--space-md); border-bottom: 1px solid var(--color-rule); }
.basics input, .basics select { width: 100%; }
.create-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr); gap: var(--space-xl); align-items: start; padding-top: var(--space-lg); }
.mode-switch { display: inline-flex; border: 1px solid var(--color-edge); border-radius: var(--radius-card); padding: var(--space-2xs); margin-bottom: var(--space-md); background: var(--color-field); gap: var(--space-2xs); }
.mode-switch button { border: 0; padding: var(--space-xs) var(--space-md); border-radius: var(--radius-control); min-height: 36px; }
.mode-switch button[aria-selected=true] { background: var(--color-accent-wash); color: var(--color-accent-3); font-weight: 600; box-shadow: inset 0 0 0 1px var(--color-accent); }
.quick-help p { margin: 0 0 var(--space-xs); }
.quick-help details { font-size: var(--text-sm); color: var(--color-muted); margin-bottom: var(--space-sm); }
.quick-help summary { cursor: pointer; color: var(--color-accent); }
.quick-help ul { margin: var(--space-xs) 0; padding-left: var(--space-lg); line-height: 1.9; }
.quick-text { width: 100%; min-height: 300px; font: 600 var(--text-lg)/1.7 var(--font-mono); resize: vertical; padding: var(--space-sm) var(--space-md); }
.problems { font-size: var(--text-sm); color: var(--color-rust); }
.problems p { margin: var(--space-xs) 0 0; }
.problems .helper { color: var(--color-muted); }
.chord-pad { display: flex; flex-direction: column; gap: var(--space-xs); margin-top: var(--space-sm); }
.pad-row { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.pad-row button { padding: var(--space-xs) var(--space-sm); background: var(--color-field); }
.pad-row button:hover { background: var(--color-paper-2); }
.pad-row.chords button { font-family: var(--font-chord); font-weight: 700; color: var(--color-chord); min-width: 44px; }
.pad-row button.mod { color: var(--color-ink-2); font-weight: 400; min-width: 40px; }
.pad-row.sections button { font-size: var(--text-sm); color: var(--color-ink-2); }
.preview { position: sticky; top: var(--space-md); border-left: 1px solid var(--color-rule); padding-left: var(--space-lg); max-height: var(--fit-h, calc(100vh - var(--space-xl))); overflow: auto; overscroll-behavior: contain; }
.preview-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-xs); }
.preview-head h2 { margin: 0; font-size: var(--text-lg); }
.preview .sheet { margin-top: var(--space-xs); }
.preview .bar { min-height: calc(54px * var(--chart-scale)); }
.song-details { margin-top: var(--space-lg); border-bottom: 1px solid var(--color-rule); padding: var(--space-sm) 0 var(--space-md); }
.song-details summary { cursor: pointer; color: var(--color-accent); }
.song-details .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--space-lg) 0; }
.song-details textarea { min-height: 72px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.full { grid-column: 1 / -1; }
.mobile-save { display: none; }

/* block editor */
.block-editor .composer-layout { grid-template-columns: minmax(0, 1fr) 232px; }
.composer-guide { margin: 0 0 var(--space-md); font-size: var(--text-sm); color: var(--color-ink-2); padding: var(--space-sm) var(--space-md); background: var(--color-paper-2); border-radius: var(--radius-control); }
.composer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--space-xl); align-items: start; margin-top: var(--space-md); }
.composer-canvas { min-width: 0; }
.compose-section { margin: 0 0 var(--space-lg); padding: 0 0 var(--space-lg); border-bottom: 1px solid var(--color-rule); }
.section-bar { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.section-bar label { white-space: nowrap; }
.section-bar select { font-weight: 600; width: 160px; }
.section-bar input { width: 88px; }
.section-options { margin-left: auto; position: relative; }
.section-options summary { white-space: nowrap; cursor: pointer; font-size: var(--text-sm); padding: var(--space-xs) var(--space-sm); color: var(--color-ink-2); border-radius: var(--radius-control); }
.section-options summary:hover { background: var(--color-paper-2); }
.section-options-menu { position: absolute; right: 0; top: 100%; min-width: 192px; background: var(--color-paper); border: 1px solid var(--color-rule); box-shadow: 0 1px 2px var(--color-shadow); padding: var(--space-xs); z-index: var(--z-dropdown); display: grid; gap: var(--space-2xs); }
.editable-measures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.edit-measure { background: var(--color-field); border: 1px solid var(--color-edge); border-radius: var(--radius-control); padding: var(--space-xs) var(--space-sm); min-height: 104px; transition: border-color var(--dur-micro) var(--ease-out); }
.edit-measure.selected { border-color: var(--color-accent); outline: 2px solid var(--color-accent-wash); }
.edit-measure.invalid { border-color: var(--color-rust); }
.measure-number { display: block; font-size: var(--text-xs); color: var(--color-muted); }
.chord-inputs { display: flex; gap: var(--space-2xs); padding: var(--space-xs) 0; }
.chord-inputs input { min-width: 0; width: 100%; padding: var(--space-2xs); background: transparent; border: 0; border-radius: var(--radius-small); font-family: var(--font-chord); font-size: var(--text-xl); font-weight: 700; color: var(--color-chord); }
.chord-inputs input::placeholder { font-family: var(--font-body); font-weight: 400; font-size: var(--text-sm); color: var(--color-muted); }
.measure-timing { color: var(--color-muted); font-size: var(--text-xs); }
.add-measure { border-style: dashed; color: var(--color-accent); font-size: var(--text-2xl); min-height: 104px; background: transparent; }
.add-section-bar { display: flex; gap: var(--space-sm); align-items: end; padding: var(--space-2xs) 0 var(--space-lg); }
.measure-inspector { position: sticky; top: var(--space-md); border-left: 1px solid var(--color-rule); padding-left: var(--space-lg); max-height: var(--fit-h, calc(100vh - var(--space-xl))); overflow: auto; overscroll-behavior: contain; }
.measure-inspector h2 { font-size: var(--text-xl); margin: 0 0 var(--space-xs); }
.measure-inspector h3 { font-size: var(--text-md); margin: var(--space-lg) 0 var(--space-xs); }
.beat-total { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; line-height: 1; margin: var(--space-md) 0 0; font-variant-numeric: tabular-nums; }
.timing-presets { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-md); }
.timing-presets button { padding: var(--space-xs); font-size: var(--text-sm); }
.timing-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin: var(--space-sm) 0; }
.timing-row input { width: 88px; }
.quick-chords { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); }
.quick-chords button { padding: var(--space-xs); font-family: var(--font-chord); font-weight: 700; }
.measure-inspector > button { width: 100%; justify-content: flex-start; margin-top: var(--space-xs); font-size: var(--text-sm); }

/* ---------- import ---------- */
.import-box { max-width: 720px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-sm); min-height: 240px; border: 2px dashed var(--color-edge); border-radius: var(--radius-card); background: var(--color-field); cursor: pointer; padding: var(--space-lg); text-align: center; font-weight: 400; font-size: var(--text-md); }
.dropzone:hover, .dropzone.over { border-color: var(--color-accent); background: var(--color-accent-wash); }
.dropzone:active { background: var(--color-paper-3); }
.dropzone:focus-within { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.dropzone img { max-width: 100%; max-height: 420px; border-radius: var(--radius-control); box-shadow: 0 4px 16px var(--color-shadow); }
.drop-text { display: flex; flex-direction: column; gap: var(--space-2xs); }
.dropzone.has-image .drop-text { display: none; }
.import-box .actions { margin: var(--space-md) 0; }
.progress { color: var(--color-accent); font-weight: 600; min-height: 1lh; }

/* ---------- copyright and owner pages ---------- */
.legal-section { max-width: 65ch; }
.legal-section h2 { margin: var(--space-xl) 0 var(--space-xs); }
.legal-section h3 { font-size: var(--text-md); margin: var(--space-md) 0 var(--space-2xs); }
.legal-section p { max-width: 65ch; }
.agent { display: flex; flex-direction: column; gap: var(--space-2xs); font-style: normal; background: var(--color-paper-2); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-control); }
#report { margin-top: var(--space-2xl); }
.report-form { max-width: 65ch; }
.access-result { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--color-paper-2); padding: var(--space-md); font-size: var(--text-sm); }

/* ---------- dialog and notice ---------- */
dialog { border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); color: var(--color-ink); padding: var(--space-xl); width: min(460px, calc(100% - var(--space-xl))); }
dialog::backdrop { background: var(--color-scrim); }
dialog h2 { margin-top: 0; font-size: var(--text-2xl); }
dialog label { margin: var(--space-lg) 0; }
dialog p { color: var(--color-muted); }
#login-error { color: var(--color-danger); min-height: 1lh; }
/* Sign-in window: Google / passkey buttons, email link, access code (folded away) */
.signin .signin-options { display: grid; gap: var(--space-sm); margin-top: var(--space-lg); }
.signin .signin-options > * { width: 100%; justify-content: center; }
.signin-google { display: inline-flex; align-items: center; gap: var(--space-sm); text-decoration: none; background: var(--color-google-bg); color: var(--color-google-ink); border: 1px solid var(--color-google-edge); font-weight: 600; }
.signin-google:hover { background: var(--color-google-hover); }
.signin-or { display: flex; align-items: center; gap: var(--space-sm); margin: var(--space-lg) 0 0; font-size: var(--text-sm); }
.signin-or::before, .signin-or::after { content: ""; flex: 1; border-top: 1px solid var(--color-rule); }
.signin-email label { margin: var(--space-sm) 0; }
.signin-email button { width: 100%; }
.signin-code { margin-top: var(--space-lg); }
.signin-code summary { cursor: pointer; color: var(--color-muted); }
.signin-code label { margin: var(--space-sm) 0; }
.account-box { margin: var(--space-xl) 0; }
.signin-legal { font-size: var(--text-sm); margin-top: var(--space-lg); }
.legal-read { margin: var(--space-lg) 0; padding-left: var(--space-lg); line-height: 1.9; }
.agree-row { display: flex; gap: var(--space-sm); align-items: flex-start; max-width: 60ch; margin: var(--space-lg) 0; cursor: pointer; }
.agree-row input { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; flex: none; }
footer a { margin-left: var(--space-sm); }
.account-box > .button, .account-box > button { margin-bottom: var(--space-lg); }
.member-email { display: inline-flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; }
.member-email input { min-width: 14rem; }
#notice { position: fixed; bottom: var(--space-lg); left: 50%; transform: translateX(-50%); background: var(--color-ink); color: var(--color-paper); padding: var(--space-sm) var(--space-lg); border-radius: var(--radius-control); max-width: calc(100% - var(--space-xl)); z-index: var(--z-toast); }
#notice:empty { display: none; }
@media (min-width: 761px) and (pointer: fine), (min-width: 1401px) { #notice { left: auto; right: var(--space-lg); transform: none; max-width: 420px; } }

/* ---------- song map: the order of sections, one quiet line ---------- */
.song-map { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-xs); margin: var(--space-xs) 0 0; font-size: var(--text-sm); color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.song-map .arrow { color: var(--color-muted); }
.demo .song-map { margin: var(--space-xs) 0 0; }

/* ---------- listen and lyrics: links out to the recording and the lyrics site ---------- */
.listen { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); margin: var(--space-sm) 0 var(--space-xs); max-width: 1120px; }
.listen-h { font-family: var(--font-body); font-size: var(--text-sm); font-weight: 700; color: var(--color-ink-2); margin: 0; }
.listen-links { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-sm); }
.listen .listen-note { flex-basis: 100%; }
.listen-links .button { text-decoration: none; }
.listen-links .listen-yt { background: var(--color-rust-wash); border-color: var(--color-rust); color: var(--color-rust-ink); }
.listen-links .listen-yt:hover { background: var(--color-rust-wash-2); color: var(--color-rust-ink); }
.listen-links .listen-lyrics { background: var(--color-accent-wash); border-color: var(--color-accent); color: var(--color-accent-3); }
.listen-links .listen-lyrics:hover { background: var(--color-accent-wash-2); color: var(--color-accent-3); }
.listen-links .listen-lyrics .listen-host { color: var(--color-accent-2); }
.listen-host { font-size: var(--text-xs); color: var(--color-muted); font-weight: 400; }
.listen-note { margin: 0; font-size: var(--text-xs); color: var(--color-muted); }

/* ---------- set lists ---------- */
.set-fields { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-sm) var(--space-md); margin: var(--space-md) 0 var(--space-lg); max-width: 760px; }
.set-fields label:first-child { flex: 1 1 260px; }
.set-h { font-size: var(--text-xl); margin: var(--space-xl) 0 var(--space-xs); }
.set-items { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--color-rule); max-width: 960px; }
.set-item { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-xs) var(--space-md); padding: var(--space-sm) var(--space-xs); border-bottom: 1px solid var(--color-rule); }
.set-empty { padding: var(--space-md) var(--space-xs); border-bottom: 1px solid var(--color-rule); }
.set-num { font-family: var(--font-display); font-weight: 700; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.set-song { min-width: 0; }
.set-song strong { display: block; font-family: var(--font-display); font-size: var(--text-lg); overflow-wrap: anywhere; }
.set-song .row-sub, .add-row .row-sub { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-sm); align-items: baseline; color: var(--color-ink-2); font-size: var(--text-sm); }
.set-key { flex-direction: row; align-items: center; gap: var(--space-xs); }
.set-move { display: flex; gap: var(--space-2xs); }
.set-actions { margin-top: var(--space-md); }
.save-state { font-size: var(--text-sm); color: var(--color-muted); }
.add-results { max-width: 960px; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) 3rem auto; align-items: center; gap: var(--space-md); padding: var(--space-xs); border-bottom: 1px solid var(--color-rule); }
.add-row strong { display: block; font-family: var(--font-display); overflow-wrap: anywhere; }
.add-key { font-family: var(--font-display); font-weight: 700; color: var(--color-ink-2); margin-left: var(--space-xs); }
.set-delete { margin-top: var(--space-2xl); }
.set-toc { margin: var(--space-md) 0 0; padding-left: var(--space-lg); }
.set-toc li { margin: var(--space-2xs) 0; }
.set-song-page { margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: 1px solid var(--color-rule); }
.set-song-title { display: flex; gap: var(--space-sm); align-items: baseline; margin: 0 0 var(--space-2xs); font-size: var(--text-2xl); }
.set-song-page .subline { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: baseline; }

/* ---------- stage mode: dark, big chords, one song at a time ---------- */
.stage {
  position: fixed; inset: 0; z-index: var(--z-modal); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; padding: var(--space-md) var(--gutter) 0;
  background: var(--color-stage-bg); color: var(--color-stage-ink);
}
body.staging { overflow: hidden; }
.stage-top { display: flex; justify-content: space-between; align-items: start; gap: var(--space-md); }
.stage-title h2 { margin: 0; font-size: var(--text-2xl); color: var(--color-stage-ink); overflow-wrap: anywhere; }
.stage-count { margin: 0; font-size: var(--text-sm); color: var(--color-stage-muted); display: flex; flex-wrap: wrap; gap: var(--space-md); }
.stage .song-map, .stage .song-map .arrow { color: var(--color-stage-muted); }
.stage-sheet { flex: 1 0 auto; --chart-scale: 1.1; }
.stage .sheet { max-width: none; }
.stage .sheet-meta dt, .stage .section-heading, .stage .bar .c small, .stage .bar .c.soft { color: var(--color-stage-muted); }
.stage .sheet-meta dd, .stage .bar .c { color: var(--color-stage-ink); }
.stage .bar { border-color: var(--color-stage-rule); border-right-color: var(--color-stage-bar); }
.stage .bar:nth-child(4n+1) { border-left-color: var(--color-stage-bar); }
.stage .bar.incomplete { background: transparent; }
.stage button { background: transparent; color: var(--color-stage-ink); border-color: var(--color-stage-rule); }
.stage button:hover { background: var(--color-stage-raise); color: var(--color-stage-ink); }
.stage button:active { background: var(--color-stage-rule); }
.stage button:disabled, .stage button:disabled:hover { background: var(--color-stage-sunk); color: var(--color-stage-dim); border-color: var(--color-stage-sunk); cursor: not-allowed; }
.stage :focus-visible { outline: 2px solid var(--color-stage-focus); outline-offset: 2px; }
.stage-nav { position: sticky; bottom: 0; display: flex; gap: var(--space-sm); padding: var(--space-md) 0; background: var(--color-stage-bg); border-top: 1px solid var(--color-stage-rule); margin-top: var(--space-md); }
.stage-nav button { flex: 1 1 0; min-height: 56px; font-size: var(--text-lg); overflow-wrap: anywhere; }
.stage-close { min-height: 44px; }
@media (min-width: 1024px) and (pointer: fine), (min-width: 1401px) { .stage-sheet { --chart-scale: 1.5; } .stage-title h2 { font-size: var(--text-3xl); } }

/* ---------- library table: tablets and computers (phones keep the stacked rows) ---------- */
@media (min-width: 761px) and (pointer: fine), (min-width: 1401px) {
  .library-rows { max-width: none; }
  .lib-row, .rows-head { display: grid; grid-template-columns: 3rem minmax(0, 3fr) minmax(0, 2.4fr) 3.5rem 3.5rem 5.5rem 7.5rem; align-items: center; gap: var(--space-md); padding: var(--space-sm) var(--space-xs); }
  .rows-head { border-bottom: 1px solid var(--color-rule); padding-block: var(--space-xs); font-size: var(--text-sm); color: var(--color-muted); }
  .lib-row .row-main { display: contents; }
  .lib-row strong { margin: 0; font-size: var(--text-lg); min-width: 0; overflow-wrap: anywhere; }
  .lib-row .row-sub { align-items: baseline; gap: 0 var(--space-sm); font-size: var(--text-sm); min-width: 0; }
  .lib-row .row-sub > span:first-child { color: var(--color-ink-2); font-size: var(--text-md); }
  .lib-row .row-meta { display: block; }
  .lib-row, .rows-head { justify-content: stretch; }
  .lib-row .row-meta .key { display: block; text-align: left; font-size: var(--text-lg); }
  .lib-row .row-cell { display: block; font-variant-numeric: tabular-nums; color: var(--color-ink-2); white-space: nowrap; }
  .lib-row .row-updated { color: var(--color-muted); font-size: var(--text-sm); }
}
@media (min-width: 761px) and (max-width: 1023px) and (pointer: fine) {
  .lib-row, .rows-head { grid-template-columns: 3rem minmax(0, 3fr) minmax(0, 2fr) 3.5rem 3.5rem 7.5rem; }
  .lib-row .row-tempo, .rows-head span:nth-child(6) { display: none; }
  main { padding-top: var(--space-lg); }
  .hero { padding: 0 0 var(--space-lg); gap: var(--space-lg); }
  .hero-copy { padding-top: 0; }
  .library { padding-top: var(--space-lg); }
  .search { margin: var(--space-md) 0; }
}

/* ---------- computers: desktop density ---------- */
@media (min-width: 1024px) and (pointer: fine), (min-width: 1401px) {
  header { min-height: 60px; padding: var(--space-xs) 0; }
  main { padding: var(--space-lg) var(--gutter) var(--space-xl); min-height: 70vh; }
  main.editing { padding-top: var(--space-md); }
  h1 { font-size: var(--text-2xl); margin-bottom: var(--space-xs); }
  .intro { font-size: var(--text-md); margin-bottom: var(--space-md); }
  footer { padding: var(--space-sm) 0; font-size: var(--text-xs); }
  #copyright { font-size: var(--text-xs); }

  /* home: a compact hero band, the sample card beside it, the library on the first screen */
  .hero { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: var(--space-xl); align-items: center; padding: 0 0 var(--space-lg); }
  .hero-copy { padding-top: 0; }
  .hero h1 { font-size: clamp(2.5rem, 1.25rem + 1.9vw, 3.125rem); line-height: 1.04; max-width: none; margin-bottom: var(--space-md); }
  .lead { font-size: var(--text-lg); line-height: 1.5; max-width: 34ch; margin-bottom: var(--space-lg); }
  .demo { padding: var(--space-md) var(--space-lg) var(--space-sm); }
  .demo-title { font-size: var(--text-xl); }
  .demo .chart-tools { margin-top: var(--space-sm); }
  .demo .sheet-wrap { --chart-scale: 0.72; }
  .demo .bar.split .c { font-size: 18px; }
  .focus .demo .bar.split .c { font-size: calc(22px * var(--chart-scale)); }
  .demo .sheet { margin-top: var(--space-2xs); }
  .demo .music-section { padding-bottom: var(--space-2xs); }
  .demo .section-heading { margin: var(--space-xs) 0 var(--space-2xs); font-size: var(--text-sm); }
  .focus .demo .sheet-wrap { --chart-scale: 1.1; }
  .focus .demo .section-heading { margin: var(--space-md) 0 var(--space-xs); font-size: var(--text-md); }
  .library { padding-top: var(--space-lg); }
  .library-head h2 { font-size: var(--text-2xl); }
  .search { max-width: 720px; margin: var(--space-sm) 0 var(--space-md); }
  .search input { font-size: var(--text-md); }

  /* lists */
  .song-row { padding: var(--space-sm) var(--space-xs); }
  .song-row strong { font-size: var(--text-lg); margin-bottom: 0; }
  .row-meta .key { font-size: var(--text-lg); }
  .lib-row { padding-block: var(--space-xs); }

  /* chart view: one width for title, tools and sheet; less air around the chords */
  .title-row, .reader-tools, .sheet { max-width: 1120px; }
  .subline { font-size: var(--text-md); }
  .subline .arrangement { display: inline; margin-left: var(--space-sm); color: var(--color-muted); }
  .toolbar { padding: var(--space-xs) 0; margin: var(--space-sm) 0 0; }
  .links { margin-top: var(--space-2xs); }
  .sheet { margin-top: var(--space-sm); }
  .section-heading { margin: var(--space-sm) 0 var(--space-2xs); }
  .music-section { padding-bottom: var(--space-xs); }
  .bar { min-height: calc(56px * var(--chart-scale)); }
  .owner-actions { margin-top: var(--space-md); padding-top: var(--space-sm); }
  .report-link { margin-top: var(--space-md); }

  /* create: editor and live preview side by side, each scrolling on its own */
  .create .editor-top { padding-bottom: 0; }
  .song-title-input { font-size: var(--text-xl); min-height: 40px; padding: var(--space-2xs) 0; }
  .basics { padding: var(--space-xs) 0 var(--space-sm); gap: var(--space-xs) var(--space-md); }
  .basics label { gap: var(--space-2xs); }
  .create-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-xl); padding-top: var(--space-md); }
  .mode-switch { margin-bottom: var(--space-sm); }
  .quick-text { min-height: 260px; font-size: var(--text-md); }
  .preview .bar { min-height: calc(46px * var(--chart-scale)); }
  .preview .bar .c { font-size: calc(22px * var(--chart-scale)); }
  .preview .section-heading { margin: var(--space-sm) 0 var(--space-2xs); }
  .song-details { margin-top: var(--space-md); }
  .composer-layout { margin-top: var(--space-sm); gap: var(--space-lg); }
  .edit-measure, .add-measure { min-height: 88px; }

  /* prose pages keep their measure */
  .legal-section h2 { margin-top: var(--space-lg); }
  #report { margin-top: var(--space-xl); }
  .dropzone { min-height: 200px; }
}
/* computers: compact controls (touch screens get 44px back just below) */
@media (min-width: 1024px) and (pointer: fine), (min-width: 1401px) {
  button, .button, input, select { min-height: 34px; padding: var(--space-2xs) var(--space-sm); }
  .text-link, button.text-link { min-height: 34px; }
  button.icon { min-width: 34px; padding-inline: var(--space-xs); }
  button.with-icon { padding-inline: var(--space-xs) var(--space-sm); }
  .segmented button.seg { min-height: 32px; padding: var(--space-2xs) var(--space-sm); }
  .mode-switch button { min-height: 30px; padding: var(--space-2xs) var(--space-sm); }
  .song-row { min-height: 0; }
  .pad-row button { min-height: 32px; padding: var(--space-2xs) var(--space-xs); }
  .pad-row.chords button { min-width: 40px; }
  .pad-row button.mod { min-width: 34px; }
  .check input { min-height: 0; padding: 0; }
  .song-title-input { min-height: 40px; }
  .search input, .search select, .search button { min-height: 38px; }
}
/* touch screens from tablets up: 44px targets */
@media (min-width: 761px) and (pointer: coarse) {
  button, .button, input, select, .text-link, button.text-link { min-height: 44px; }
  .segmented button.seg { min-height: 42px; }
  button.icon { min-width: 44px; }
}
@media (min-width: 1024px) and (max-height: 820px) and (pointer: fine) {
  .demo .sheet-wrap { --chart-scale: 0.68; }
}

/* ---------- wide screens ---------- */
@media (min-width: 1500px) {
  .editable-measures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* big monitors: the page grows wider and everything scales up in steps, so it fills the screen
   instead of sitting in a narrow column. --zoom is read by fitPanels() in app.mjs. */
html { zoom: var(--zoom, 1); }
@media (min-width: 1600px) { :root { --zoom: 1.1; --container: 1560px; } }
@media (min-width: 1800px) { :root { --zoom: 1.2; } }
@media (min-width: 2100px) { :root { --zoom: 1.3; } }
@media (min-width: 2500px) { :root { --zoom: 1.45; } }

/* ---------- tablets ---------- */
@media (max-width: 1023px), (pointer: coarse) and (max-width: 1400px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); padding-bottom: var(--space-xl); }
  .hero h1 { max-width: 14ch; }
  .create-layout { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; border-left: 0; border-top: 1px solid var(--color-rule); padding: var(--space-md) 0 0; max-height: none; }
  .basics { grid-template-columns: 1fr 1fr 1fr; }
  .basics label:nth-child(1), .basics label:nth-child(2) { grid-column: span 3; }
  .composer-layout, .block-editor .composer-layout { grid-template-columns: minmax(0, 1fr) 220px; gap: var(--space-lg); }
  .measure-inspector { padding-left: var(--space-md); }
}

/* ---------- phones ---------- */
@media (max-width: 760px), (pointer: coarse) and (max-width: 1400px) {
  .sheet.solfege .bar { padding-inline: var(--space-xs); }
  .sheet.solfege .bar .c { font-size: calc(18px * var(--chart-scale)); }
  .sheet.solfege .bar.split .c { font-size: calc(15px * var(--chart-scale)); }
  .listen-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); width: 100%; gap: var(--space-xs); }
  .listen-links .button, .listen-links button { justify-content: center; padding-inline: var(--space-xs); font-size: var(--text-sm); gap: var(--space-2xs); white-space: nowrap; }
  .listen-links .listen-host { display: none; }
  .set-item { grid-template-columns: 1.5rem minmax(0, 1fr); }
  .set-key, .set-move { grid-column: 2; }
  .add-row { grid-template-columns: minmax(0, 1fr) auto; }
  .add-row .add-key { display: none; }
  .stage-sheet { --chart-scale: 0.95; }
  :root { --gutter: 16px; }
  header { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand lang" "nav account"; gap: var(--space-xs) var(--space-sm); padding: var(--space-sm) 0; min-height: 0; }
  .brand { grid-area: brand; font-size: var(--text-xl); gap: var(--space-xs); }
  .mark { width: 34px; }
  #language { grid-area: lang; margin-left: 0; }
  header nav { grid-area: nav; margin-left: 0; overflow-x: auto; min-width: 0; }
  #account { grid-area: account; padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); }
  nav a { padding: var(--space-xs) var(--space-sm); }
  input, select, textarea { font-size: var(--text-md); }
  main, main.editing { padding: var(--space-lg) var(--gutter) var(--space-xl); }
  h1 { font-size: var(--text-2xl); }
  .hero { padding-top: 0; }
  .hero h1 { font-size: 2.5rem; }
  .lead { font-size: var(--text-lg); margin-bottom: var(--space-lg); }
  .demo { padding: var(--space-md) var(--space-sm) var(--space-sm); margin-inline: calc(-1 * var(--space-xs)); }
  .demo .sheet-wrap { --chart-scale: 1; }
  .view-buttons button { padding-inline: var(--space-xs) var(--space-sm); font-size: var(--text-sm); }
  .library-head h2 { font-size: var(--text-2xl); }
  .search { grid-template-columns: minmax(0, 1fr) auto; }
  .search input { grid-column: 1 / -1; }
  .search select { min-width: 0; }
  .song-row { align-items: start; gap: var(--space-sm); }
  .row-meta { gap: var(--space-xs); flex-direction: column; align-items: end; }
  .toolbar { gap: var(--space-sm); margin-top: var(--space-sm); }
  .tool-group.end { margin-left: 0; }
  .bar { padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) var(--space-xs); min-height: calc(52px * var(--chart-scale)); }
  .bar .c { font-size: calc(20px * var(--chart-scale)); }
  .bar.split .c { font-size: calc(16px * var(--chart-scale)); }
  .bar.split .c + .c { padding-left: var(--space-2xs); }
  .create .editor-top .editor-save { display: none; }
  .basics { grid-template-columns: 1fr 1fr 1fr; gap: var(--space-sm); }
  .quick-text { min-height: 200px; font-size: var(--text-lg); padding: var(--space-sm); }
  .song-details .fields, .fields { grid-template-columns: minmax(0, 1fr); }
  .mobile-save { display: flex; margin: var(--space-md) 0 var(--space-2xs); }
  .mobile-save button { flex: 1; min-height: 48px; }
  .composer-layout, .block-editor .composer-layout { grid-template-columns: minmax(0, 1fr); }
  .measure-inspector { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--color-rule); padding: var(--space-md) 0; }
  .editable-measures, .block-editor .editable-measures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-bar { flex-wrap: wrap; }
  .section-options { margin-left: 0; }
  .section-bar select { width: 132px; }
  .section-bar input { width: 72px; }
  .dropzone { min-height: 200px; }
  footer { flex-direction: column; align-items: start; }
  header:has(nav a + a) { grid-template-areas: "brand brand" "lang account" "nav nav"; }
  header:has(nav a + a) #language { justify-self: start; }
  header:has(nav a + a) nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin-inline: calc(-1 * var(--space-sm)); }
  .hero-copy { padding-top: 0; }
}
@media (max-width: 400px) {
  .brand small { display: none; }
  .demo .chart-tools { gap: var(--space-xs) var(--space-sm); }
  .segmented button.seg { padding-inline: var(--space-sm); }
  #language { padding-inline: var(--space-xs); }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- print ---------- */
/* ---------- 2026-12-04 redesign from Ivan's mockup ---------- */
/* header: salmon logo tile, beta pill, divider before the tabs, salmon bar under the active tab */
header { border-bottom-color: var(--color-rule); }
.mark { width: 46px; height: 46px; padding: var(--space-xs); background: var(--color-salmon); color: var(--color-ink); border-radius: 12px; }
.brand:hover .mark { color: var(--color-ink); background: var(--color-salmon-2); }
.brand small { background: var(--color-salmon-wash); color: var(--color-ink-2); padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-control); margin-left: var(--space-xs); }
header nav { border-left: 1px solid var(--color-rule); padding-left: var(--space-md); }
nav a.active { text-decoration: none; box-shadow: inset 0 -3px 0 var(--color-salmon); }
nav a.active:hover { text-decoration: none; }
#account { border-color: var(--color-ink-2); color: var(--color-ink); }
#account:hover { background: var(--color-paper-2); color: var(--color-ink); }
/* small pills */
.pill { display: inline-block; font-family: var(--font-body); font-size: var(--text-sm); font-weight: 600; line-height: 1.3; color: var(--color-ink-2); background: var(--color-salmon-wash); padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-control); }
/* Chords | Do Re Mi | Numbers: the chosen side is salmon */
.segmented button.seg[aria-pressed=true] { background: var(--color-salmon); color: var(--color-ink); font-weight: 600; }
.segmented button.seg[aria-pressed=true]:focus-visible { outline-color: var(--color-ink); }
/* Chords | Do Re Mi | Numbers as three separate buttons, like A− and A+ */
.segmented { gap: var(--space-xs); border: 0; border-radius: 0; overflow: visible; }
.segmented button.seg, .segmented button.seg + button.seg { border: 1px solid var(--color-edge); border-radius: var(--radius-control); }
.segmented button.seg[aria-pressed=true] { border-color: var(--color-salmon-2); }
.segmented button.seg:focus-visible { outline-offset: 2px; }
.segmented button.seg { white-space: nowrap; }

/* chart page header: title and artist on the left; Print, Focus view, YouTube and lyrics on the right */
.title-row { max-width: none; align-items: start; }
.title-block { min-width: 0; flex: 1 1 320px; }
.title-row .song-title { margin: 0 0 var(--space-2xs); }
.title-block .subline { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-sm); margin: 0; }
.title-block .subline .arrangement { margin: 0; }
.title-actions { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-sm); }
/* Watch on YouTube (near-black, red mark) and Read lyrics (outlined); both open another site */
.listen-links { display: flex; flex-wrap: wrap; gap: var(--space-sm); justify-content: flex-end; }
.listen-links .button, .listen-links button { gap: var(--space-xs); padding-inline: var(--space-sm) var(--space-md); }
.listen-links .listen-yt { background: var(--color-yt); border-color: var(--color-yt); color: var(--color-accent-ink); }
.listen-links .listen-yt:hover { background: var(--color-yt-2); border-color: var(--color-yt-2); color: var(--color-accent-ink); }
.listen-links .listen-yt:active { background: var(--color-ink-2); }
.listen-links .listen-lyrics { background: transparent; border-color: var(--color-edge); color: var(--color-ink); }
.listen-links .listen-lyrics:hover { background: var(--color-paper-2); color: var(--color-ink); }
.yt-mark { flex: none; }
/* key, tempo, time under the title */
.meta-row { display: flex; flex-wrap: wrap; align-items: baseline; margin: var(--space-md) 0 0; }
.meta-row div { display: flex; align-items: baseline; gap: var(--space-sm); padding: 0 var(--space-lg); border-left: 1px solid var(--color-rule); }
.meta-row div:first-child { padding-left: 0; border-left: 0; }
.meta-row dt { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-2); }
.meta-row dd { margin: 0; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; color: var(--color-ink); }
/* key/tempo/time on the left, YouTube and lyrics on the right of the same line */
.meta-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm) var(--space-lg); margin: var(--space-md) 0 0; }
.meta-line .meta-row { margin: 0; }
.listen-links .short, .style-pick { display: none; }
/* the controls in one rounded bar, groups split by thin lines */
.toolbar.reader-tools { max-width: none; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-field); padding: var(--space-xs) var(--space-md); margin: var(--space-md) 0 0; }
.reader-tools .chart-tools > * + * { border-left: 1px solid var(--color-rule); padding-left: var(--space-md); }

/* song flow: coloured badges in song order */
.song-flow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); margin: var(--space-md) 0 0; }
.flow-label { font-size: var(--text-sm); font-weight: 700; color: var(--color-ink); padding-right: var(--space-md); border-right: 1px solid var(--color-rule); }
.flow-items { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); list-style: none; margin: 0; padding: 0; }
.flow-item { display: flex; align-items: center; gap: var(--space-xs); }
.flow-chip { display: inline-flex; align-items: center; gap: var(--space-xs); padding: var(--space-3xs) var(--space-sm) var(--space-3xs) var(--space-3xs); border-radius: 999px; background: var(--sec-wash, var(--color-paper-2)); }
.flow-arrow { color: var(--color-ink-2); margin-right: var(--space-xs); }
.flow-name { font-weight: 600; color: var(--color-ink); white-space: nowrap; }
.flow-repeat { font-weight: 400; color: var(--color-ink-2); }
.sec-badge { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 2em; height: 2em; padding: 0 0.3em; border: 2px solid var(--sec, var(--color-edge)); border-radius: 999px; background: var(--color-field); font-family: var(--font-display); font-size: var(--text-sm); font-weight: 700; color: var(--color-ink); letter-spacing: 0; }
.sec-intro { --sec: var(--sec-intro); --sec-wash: var(--sec-intro-wash); }
.sec-verse { --sec: var(--sec-verse); --sec-wash: var(--sec-verse-wash); }
.sec-pre-chorus { --sec: var(--sec-pre); --sec-wash: var(--sec-pre-wash); }
.sec-chorus { --sec: var(--sec-chorus); --sec-wash: var(--sec-chorus-wash); }
.sec-bridge { --sec: var(--sec-bridge); --sec-wash: var(--sec-bridge-wash); }
.sec-interlude, .sec-instrumental { --sec: var(--sec-inter); --sec-wash: var(--sec-inter-wash); }
.sec-outro { --sec: var(--sec-outro); --sec-wash: var(--sec-outro-wash); }

/* the chart: a white card; each section has a coloured stripe and a label pill; each bar starts with a | line */
.sheet { max-width: none; background: transparent; border: 0; padding: 0; }
/* each part of the song is its own bubble: white, rounded, a coloured edge in the part's colour */
.sheet .music-section { background: var(--color-field); border: 1px solid var(--color-rule); border-left: 5px solid var(--sec, var(--color-edge)); border-radius: var(--radius-card); padding: var(--space-xs) var(--space-md) var(--space-sm); margin: 0 0 var(--space-md); }
.sheet .section-heading { display: inline-flex; align-items: center; gap: var(--space-xs); margin: var(--space-xs) 0 var(--space-xs); padding: 0 var(--space-sm) 0 0; border-radius: 999px; background: var(--sec-wash, var(--color-paper-2)); font-size: var(--text-md); color: var(--color-ink); }
.sheet .section-heading .sec-badge { font-size: var(--text-xs); letter-spacing: 0; }
.sheet .repeat { color: var(--color-ink-2); letter-spacing: 0; text-transform: none; }
.sheet .bar { position: relative; border: 0; border-bottom: 1px solid var(--color-rule); padding-left: var(--space-md); }
.sheet .bar:nth-child(4n+1) { border-left: 0; }
.sheet .bar::before { content: ""; position: absolute; left: 0; top: 24%; bottom: 24%; width: 3px; border-radius: 1px; background: var(--color-bar); }
.sheet .bars .bar:nth-last-child(-n+4):nth-child(4n+1), .sheet .bars .bar:nth-last-child(-n+4):nth-child(4n+1) ~ .bar { border-bottom: 0; }
.sheet .bar.split .c + .c { border-left: 0; padding-left: 0; }
.sheet .bar.incomplete { background: var(--color-rust-wash); }
/* the home sample card keeps its beige; the chart inside is the same white card */
.demo .sheet { padding: 0; }
.demo .bar { background: transparent; }
.demo .segmented button.seg[aria-pressed=true] { background: var(--color-salmon); color: var(--color-ink); }

/* stage mode: the chart card and pills go dark */
.stage .sheet { background: transparent; border: 0; padding: 0; }
.stage .sheet .section-heading { background: transparent; color: var(--color-stage-muted); }
.stage .sheet .music-section { background: transparent; border-color: var(--color-stage-rule); border-left-color: var(--sec, var(--color-stage-rule)); }
.stage .sec-badge { background: var(--color-stage-bg); color: var(--color-stage-ink); }
.stage .sheet .bar { border-bottom-color: var(--color-stage-rule); }
.stage .sheet .bar::before { background: var(--color-stage-bar); }
.stage .flow-label { color: var(--color-stage-muted); border-right-color: var(--color-stage-rule); }
.stage .flow-name { color: var(--color-stage-ink); }
.stage .flow-repeat, .stage .flow-arrow { color: var(--color-stage-muted); }

/* phones: their own layout. Buttons in rows under the title, controls without the outer bar, smaller badges */
@media (max-width: 760px), (pointer: coarse) and (max-width: 1400px) {
  .title-actions { align-items: stretch; width: 100%; }
  .title-actions .view-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .listen-links { display: grid; grid-template-columns: 1fr 1fr; justify-content: stretch; }
  .listen-links .button, .listen-links button { justify-content: center; padding-inline: var(--space-xs); font-size: var(--text-sm); white-space: nowrap; }
  .listen-links .ico:last-child { display: none; }
  .meta-row div { padding: 0 var(--space-md); }
  .meta-row dd { font-size: var(--text-lg); }
  .toolbar.reader-tools { border: 0; border-top: 1px solid var(--color-rule); border-bottom: 1px solid var(--color-rule); border-radius: 0; background: transparent; padding: var(--space-sm) 0; }
  .reader-tools .chart-tools > * + * { border-left: 0; padding-left: 0; }
  .toolbar.reader-tools { position: relative; }
  .reader-tools > .tool-group.end { position: absolute; right: 0; bottom: var(--space-sm); }
  header nav { border-left: 0; padding-left: 0; }
  /* phones: less on top so the chords start higher */
  .title-row { flex-wrap: nowrap; gap: var(--space-sm); }
  .title-actions { width: auto; }
  .title-actions .view-buttons { display: flex; }
  .title-actions .view-buttons > button:not(.expand-btn) { display: none; }
  .title-actions .expand-btn { padding: var(--space-xs); min-width: 44px; justify-content: center; }
  .title-actions .expand-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .meta-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-xs) var(--space-sm); }
  .meta-line .listen-links { display: flex; margin-top: 0; gap: var(--space-xs); }
  .listen-links .long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .listen-links .short { display: inline; }
  .meta-line .listen-links .button, .meta-line .listen-links button { min-height: 40px; padding-inline: var(--space-sm); }
  /* phones: Key, Capo and Style as three drop-down buttons in one row; the bigger controls stay on computers */
  .toolbar.reader-tools { border: 0; padding: var(--space-xs) 0 0; }
  .reader-tools .chart-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); width: 100%; max-width: none; }
  .reader-tools .chart-tools > .segmented, .reader-tools .chart-tools > .tool-group:last-child:not(.style-pick), .reader-tools > .tool-group.end, .reader-tools .chart-tools .icon { display: none; }
  .reader-tools .chart-tools > .tool-group { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-3xs); min-width: 0; }
  .reader-tools .chart-tools .tool-label { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--color-ink-2); }
  .reader-tools .chart-tools select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; width: 100%; min-width: 0; min-height: 48px; border: 1px solid var(--color-salmon-2); border-radius: var(--radius-card); background-color: var(--color-salmon-wash); color: var(--color-ink); font-size: var(--text-md); padding-inline: var(--space-sm) var(--space-lg); }
  /* phones: the bubbles already name each part, so the song-flow row is left out */
  main > .song-flow, .set-song-page .song-flow { display: none; }
  .meta-row { row-gap: var(--space-xs); }
  .meta-line { display: block; }
  .meta-line .listen-links { margin-top: var(--space-sm); }
  .meta-row div { padding: 0 var(--space-sm); }
  .flow-label { flex-basis: 100%; border-right: 0; padding-right: 0; font-size: var(--text-xs); }
  .flow-items { gap: var(--space-xs); }
  .sec-badge { font-size: var(--text-xs); }
  .sheet .music-section { padding: var(--space-2xs) var(--space-xs) var(--space-xs); border-left-width: 4px; margin-bottom: var(--space-sm); }
  .sheet .section-heading { font-size: var(--text-sm); }
  .sheet .bar { padding-left: var(--space-sm); }
}

/* very small phones: chords a bit smaller so names like F#m7 stay on one line */
@media (max-width: 380px) {
  .sheet .bar { padding-left: var(--space-xs); }
  .bar .c { font-size: calc(17px * var(--chart-scale)); }
  .sheet.solfege .bar .c { font-size: calc(15px * var(--chart-scale)); }
  .bar.split .c { font-size: calc(14px * var(--chart-scale)); flex: 1 1 auto; overflow: visible; }
  .bar.split .c + .c { flex: 0 1 auto; padding-left: var(--space-2xs); }
  .sheet .bar:not(.split) .c { overflow: hidden; }
  header nav a { font-size: var(--text-sm); }
  .segmented { gap: var(--space-2xs); }
  .reader-tools .chart-tools select { font-size: var(--text-sm); padding-inline: var(--space-xs) var(--space-md); background-position: right var(--space-2xs) center; background-size: 10px 7px; }
  .segmented button.seg { padding-inline: var(--space-xs); }
}
@media print {
  header, footer, .toolbar, .nonfocus, #notice, .view-buttons, .chart-tools, .review-box, .reader-tools, .links, .owner-actions, .report-link, .back, .status-line, .banner,
  .measure-inspector, .composer-guide, .editor-top, .song-details { display: none !important; }
  body { background: var(--color-print-paper); color: var(--color-print-ink); }
  main { padding: 0; max-width: none; margin: 0; }
  h1 { font-size: 24pt; }
  .sheet { max-width: none; }
  .hero { display: block; padding: 0; }
  .demo { border: 0; padding: 0; background: none; }
  .demo .sheet-meta { display: flex; }
  .music-section { break-inside: avoid; page-break-inside: avoid; }
  .section-heading { break-after: avoid; color: var(--color-print-ink); }
  .bar { min-height: 44px; border-color: var(--color-print-rule); }
  .bar:nth-child(4n+1) { border-left-color: var(--color-print-rule); }
  .bar .c { color: var(--color-print-ink); font-size: 18pt; }
  .composer-layout { display: block; }
  .sheet .music-section { background: none; break-inside: avoid; }
  .song-flow, .meta-row { display: flex !important; }
  .stage, .set-toc { display: none !important; }
  .set-song-page { border: 0; margin: 0; padding: 0; }
  .set-song-page + .set-song-page { break-before: page; page-break-before: always; }
}

.promise-dialog { max-width: 36rem; }
.hide-box { margin-top: var(--space-lg); border-top: 1px solid var(--color-rule); padding-top: var(--space-md); }
.hide-box summary { cursor: pointer; font-weight: 600; }
.hide-box textarea { width: 100%; }
.read-mark { color: var(--color-ok); font-weight: 600; }
.agree-row:has(input:disabled) { opacity: .55; cursor: not-allowed; }

/* Play along with the video */
.playalong { margin: var(--space-md) 0; padding: var(--space-md); border: 1px solid var(--color-rule); border-radius: 12px; }
.pa-title { font-size: var(--text-md, 1.1rem); margin: 0 0 var(--space-sm); }
.pa-video iframe { width: 100%; max-width: 640px; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; display: block; }
.pa-controls { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; margin-top: var(--space-sm); }
.pa-speed { display: flex; gap: .4rem; align-items: center; }
.pa-tap { min-width: 6rem; font-size: 1.1rem; }
.pa-status { margin: var(--space-sm) 0 0; font-weight: 600; }
.bar.now { background: var(--color-now); box-shadow: inset 0 0 0 2px var(--color-now-edge); border-radius: 6px; transition: background .08s; }
.section-heading { cursor: pointer; }
@media print { .playalong { display: none; } }

/* Accuracy: confirmations and wrong-chord reports */
.accuracy { margin-top: var(--space-lg); padding: var(--space-md); border: 1px solid var(--color-rule); border-radius: 12px; }
.accuracy h2 { font-size: var(--text-md, 1.1rem); margin: 0 0 var(--space-sm); }
.confirm-count { display: block; margin-bottom: var(--space-sm); }
.wrong-box summary { cursor: pointer; font-weight: 600; margin-top: var(--space-sm); }
.wrong-box textarea { width: 100%; }
.pa-length { margin: var(--space-xs, .25rem) 0 0; }
.review-box.closed { opacity: .6; }
@media print { .accuracy { display: none; } }
.char-count.short { color: var(--color-danger); }

/* Song links row in the editor */
.song-links { display: grid; grid-template-columns: minmax(0, 40rem); gap: var(--space-sm) var(--space-md); padding: var(--space-sm) 0 var(--space-md); border-bottom: 1px solid var(--color-rule); }
.song-links label { display: flex; flex-direction: column; gap: var(--space-2xs, .2rem); }
.link-row { display: flex; gap: var(--space-xs, .4rem); }
.link-row input { flex: 1; min-width: 0; }
.small-link { white-space: nowrap; }
input.invalid { border-color: var(--color-danger); }
.helper.error { color: var(--color-danger); }
@media (max-width: 720px), (pointer: coarse) and (max-width: 1400px) { .song-links { grid-template-columns: 1fr; } }

/* Rows chosen by the writer: one row per sung line, columns stay lined up */
.bars.row + .bars.row { border-top: 1px solid var(--color-rule); }
.sheet .bars.row .bar { border-bottom: 0; }

/* Play along, compact: controls appear only once the video is open */
.playalong:not(.open) .pa-quick { display: none; }
.pa-player { display: grid; gap: var(--space-sm); }
.pa-quick { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }
.pa-extra { margin: 0 0 var(--space-md); }
.pa-extra .pa-status { margin-top: 0; font-weight: 500; font-size: var(--text-sm, .95rem); }
.pa-more summary { cursor: pointer; font-weight: 600; margin-top: var(--space-xs); }
@media (max-width: 700px), (pointer: coarse) and (max-width: 1400px) {
  .playalong { padding: var(--space-sm); }
  .playalong:not(.open) { border: 0; padding: 0; }
  .playalong:not(.open) .pa-title { display: none; }
  .playalong:not(.open) .with-icon { width: 100%; min-height: 48px; }
  .playalong.open .pa-title { display: none; }
  /* YouTube's rules: player at least 200 x 200 px */
  .pa-video iframe { min-height: 200px; }
}
/* Slim pinned control bar: Play/Pause, Tap "1", where we are */
.pa-bar { position: sticky; top: var(--space-xs); z-index: 20; display: flex; align-items: center; gap: var(--space-sm); margin: 0 0 var(--space-sm); padding: var(--space-xs) var(--space-sm); background: var(--color-paper); border: 1px solid var(--color-rule); border-radius: 12px; box-shadow: 0 6px 12px -8px var(--color-lift); }
.pa-bar[hidden] { display: none; }
/* Minimized video: a small player pinned in the bottom corner, still playing (YouTube's minimum is 200 x 200) */
.pa-bar .pa-mini { min-height: 44px; }
.playalong.mini .pa-video { position: fixed; right: var(--space-sm); bottom: calc(var(--space-sm) + env(safe-area-inset-bottom)); z-index: var(--z-sticky); width: 200px; height: 200px; border-radius: var(--radius-card); overflow: hidden; background: var(--color-ink); box-shadow: 0 8px 24px -8px var(--color-lift); }
.playalong.mini .pa-video iframe { width: 100%; height: 100%; min-height: 0; max-width: none; aspect-ratio: auto; border-radius: 0; }
@media (max-width: 700px), (pointer: coarse) and (max-width: 1400px) {
  .pa-bar .pa-mini-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .pa-bar .pa-mini { padding-inline: var(--space-sm); }
}
.pa-bar .pa-play, .pa-bar .pa-tap { min-height: 44px; }
.pa-bar .pa-tap { min-width: 0; padding-inline: var(--space-md); }
.pa-where { flex: 1; min-width: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px), (pointer: coarse) and (max-width: 1400px) {
  .pa-bar { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; border-width: 0 0 1px; padding: var(--space-xs) var(--gutter); }
  .pa-where { font-size: var(--text-sm, .9rem); }
  /* While the song plays, fold the top of the page so the chords start higher */
  body.pa-playing .back, body.pa-playing .subline, body.pa-playing .title-actions, body.pa-playing .meta-line, body.pa-playing .reader-tools, body.pa-playing .song-flow { display: none; }
  body.pa-playing .song-title { font-size: var(--text-xl); }
}

/* Tabs: icons only on phones (desktop shows text links as before) */
nav a svg { display: none; }
@media (max-width: 700px), (pointer: coarse) and (max-width: 1400px) {
  /* Header on one row: logo, language, account */
  header, header:has(nav a + a) { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand lang account"; align-items: center; }
  header:has(nav a + a) #language { justify-self: end; }
  .brand small { display: none; }
  /* Tab bar along the bottom of the screen */
  header nav, header:has(nav a + a) nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky); display: flex; flex-wrap: nowrap; overflow: visible; margin: 0; gap: 0; padding: var(--space-3xs) var(--space-2xs) calc(var(--space-3xs) + env(safe-area-inset-bottom)); background: var(--color-paper); border-top: 1px solid var(--color-rule); border-left: 0; box-shadow: 0 -4px 12px -8px var(--color-lift); }
  header nav a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-3xs); padding: var(--space-xs) var(--space-3xs); font-size: 12px; line-height: 1.2; text-align: center; border-radius: 10px; box-shadow: none; }
  header nav a svg { display: block; width: 24px; height: 24px; }
  header nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  header nav a.active { color: var(--color-ink); background: var(--color-accent-wash); box-shadow: none; text-decoration: none; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  #notice { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .focus body, body.focus { padding-bottom: 0; }
}

/* Home: search first, next set list, recently opened, then the library */
.hero.hero-short { display: block; gap: 0; padding: var(--space-md) 0 0; }
.hero.hero-short h1 { font-size: var(--text-3xl, 2.4rem); max-width: none; margin: 0 0 var(--space-xs); }
.hero-short .lead { max-width: 40ch; margin: 0 0 var(--space-xs); }
.hero-short .hero-actions { margin: 0; }
.home-search + .library, .home-cards + .library { padding-top: var(--space-md); border-top: 0; }
.home-cards + .library .library-head h2, .home-search + .library .library-head h2 { font-size: var(--text-xl); }
.home-search { margin: var(--space-md) 0; }
.home-search .search { margin: 0; }
.home-cards { display: grid; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.home-cards:empty { display: none; }
.home-card { border: 1px solid var(--color-rule); border-radius: 12px; padding: var(--space-sm) var(--space-md); background: var(--color-field); }
.card-kicker { display: block; font-size: var(--text-sm, .9rem); font-weight: 600; color: var(--color-ink-2); margin: 0 0 var(--space-3xs); text-transform: none; }
.next-set { display: flex; align-items: center; gap: var(--space-sm); justify-content: space-between; flex-wrap: wrap; }
.next-set .card-text { display: flex; flex-direction: column; min-width: 0; }
.next-set .card-text strong { font-size: var(--text-lg, 1.2rem); }
.card-actions { display: flex; gap: var(--space-xs); }
.recent-list { display: grid; }
.recent-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t k" "a k"; padding: var(--space-xs) 0; border-top: 1px solid var(--color-rule); color: inherit; text-decoration: none; }
.recent-item:first-child { border-top: 0; }
.recent-item strong { grid-area: t; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .muted { grid-area: a; font-size: var(--text-sm, .9rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .key { grid-area: k; align-self: center; }
@media (min-width: 761px) and (pointer: fine), (min-width: 1401px) { .home-cards { grid-template-columns: 1fr 1fr; align-items: start; } }
@media (max-width: 700px), (pointer: coarse) and (max-width: 1400px) {
  .hero.hero-short { padding-top: 0; }
  .hero.hero-short h1 { font-size: 1.9rem; }
  .hero-short .lead { font-size: var(--text-md); }
  .home-search { margin-top: 0; }
  .next-set .card-actions { width: 100%; }
  .next-set .card-actions > * { flex: 1; }
}
/* Simple home: search + link to the full library */
.home-find { grid-template-columns: minmax(0, 1fr) auto; }
.home-find input { grid-column: auto; }
.browse-all { display: inline-block; margin-top: var(--space-sm); }
.library .library-head h1 { font-size: var(--text-3xl); margin: 0 0 var(--space-sm); }
.library:first-child { border-top: 0; padding-top: var(--space-md); }

/* Home splash: logo, name, Browse songs */
.splash { min-height: calc(100svh - 320px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-sm); padding: var(--space-xl) 0; }
.splash-mark { width: 132px; height: 132px; border-radius: 32px; background: var(--color-salmon); display: grid; place-items: center; color: var(--color-ink); }
.splash-mark .mark { width: 84px; height: auto; }
.splash h1 { font-size: 3.4rem; letter-spacing: -0.02em; margin: var(--space-sm) 0 0; }
.splash-line { margin: 0; max-width: 30ch; font-size: var(--text-lg); color: var(--color-ink-2); }
.splash-go { margin-top: var(--space-sm); min-height: 48px; padding-inline: var(--space-lg); font-size: var(--text-lg); }
.splash-small { display: flex; gap: var(--space-lg); align-items: center; margin-top: var(--space-xs); color: var(--color-ink-2); }
.splash-small .link-button { min-height: 44px; padding-inline: var(--space-xs); }
.link-button { background: none; border: 0; padding: var(--space-2xs) var(--space-xs); min-height: 0; color: var(--color-ink-2); text-decoration: underline; text-underline-offset: .25em; font: inherit; cursor: pointer; box-shadow: none; }
@media (max-width: 700px), (pointer: coarse) and (max-width: 1400px) {
  body.home-page header > :not(nav), body.home-page footer { display: none; }
  body.home-page header { border: 0; padding: 0; min-height: 0; }
  body.home-guest header nav { display: none; }
  body.home-guest { padding-bottom: 0; }
  body.home-page main { padding-top: 0; }
  .splash { min-height: calc(100svh - 120px); }
}
/* My charts: Published and Drafts sections */
.mine-h { display: flex; align-items: center; gap: var(--space-xs); font-size: var(--text-xl); margin: var(--space-lg) 0 0; }
.mine-h .count { font-size: var(--text-sm); font-weight: 600; background: var(--color-paper-2); border-radius: 999px; padding: 0 .55em; }
.tag.ok { background: var(--color-ok-wash); color: var(--color-ok); }
.tag.warn { background: var(--color-warn-wash); color: var(--color-warn); }
/* Phones: Key gets its own row with big − and + (half step down / up); Capo and Style share the row below */
@media (max-width: 760px), (pointer: coarse) and (max-width: 1400px) {
  .reader-tools .chart-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reader-tools .chart-tools > .tool-group:first-child { grid-column: 1 / -1; display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; gap: var(--space-xs); align-items: stretch; }
  .reader-tools .chart-tools > .tool-group:first-child .tool-label { grid-column: 1 / -1; }
  .reader-tools .chart-tools > .tool-group:first-child .icon { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; min-width: 0; font-size: 1.5rem; border: 1px solid var(--color-salmon-2); border-radius: var(--radius-card); background: var(--color-salmon-wash); color: var(--color-ink); touch-action: manipulation; }
  .reader-tools .chart-tools > .tool-group:first-child select { text-align: center; text-align-last: center; }
}

/* Song page tidy-up (phones): one info line, one control row, a short key note, one play button, slim top */
.sub-meta, .pa-open-row .listen-lyrics, .pa-open-row .short { display: none; }
.pa-open-row { display: flex; gap: var(--space-xs); align-items: stretch; }
.key-note:empty { display: none; }
.key-note .link-button { padding: 0 var(--space-3xs); color: var(--color-accent-3, inherit); }
.status-pill.live { background: var(--color-ok-wash); color: var(--color-ok); }
.status-pill.changed { background: var(--color-warn-wash); color: var(--color-warn); }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1400px) {
  /* 6: no site header on a song page; the back link is the way out */
  body.chart-page header, body.artist-page header { display: none; }
  body.chart-page main, body.artist-page main { padding-top: var(--space-sm); }
  .chart-page .back { display: inline-block; font-size: var(--text-sm); margin-bottom: var(--space-3xs); }
  .chart-page .song-title { font-size: 1.75rem; line-height: 1.15; }
  .chart-page .title-row { align-items: flex-start; gap: var(--space-sm); }
  /* 1 + 5: one small info line: artist · tempo · time · status */
  .chart-page .subline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3xs) var(--space-sm); font-size: var(--text-sm); margin-top: var(--space-3xs); }
  .chart-page .sub-meta { display: inline; color: var(--color-ink-2); }
  .chart-page .subline .status-pill { font-size: var(--text-xs); padding: 1px var(--space-xs); }
  .chart-page .meta-row { display: none; }
  .chart-page main.has-pa .meta-line, main.has-pa .meta-line { display: none; }
  /* 2: one row of controls, no labels */
  .reader-tools .chart-tools { grid-template-columns: 40px minmax(0, 0.8fr) 40px minmax(0, 1.35fr) minmax(0, 1.35fr); gap: var(--space-xs); }
  .reader-tools .chart-tools > .tool-group:first-child { display: contents; }
  .reader-tools .chart-tools .tool-label { display: none; }
  .reader-tools .chart-tools > .tool-group:first-child .icon { min-height: 44px; font-size: 1.3rem; padding: 0; }
  .reader-tools .chart-tools select { min-height: 44px; font-size: var(--text-sm); padding-inline: var(--space-xs) 20px; background-position: right 6px center; background-size: 10px 7px; text-overflow: clip; }
  .reader-tools .chart-tools > .tool-group:first-child select { padding-inline: var(--space-xs) var(--space-md); }
  .key-note { margin: var(--space-2xs) 0 0; font-size: var(--text-sm); }
  /* 4: one Play along button with a small lyrics button beside it */
  .pa-open-row .listen-lyrics { display: inline-flex; align-items: center; gap: var(--space-2xs); padding-inline: var(--space-sm); min-height: 48px; }
  .pa-open-row .listen-lyrics .long { display: none; }
  .pa-open-row .listen-lyrics .short { display: inline; }
  .pa-open-row .with-icon { flex: 1; }
  .pa-open-row .long { display: none; }
  .pa-open-row .short { display: inline; }
  .playalong:not(.open) { margin-top: var(--space-sm); }
}
/* Phones: artist, tempo and time easier to see */
@media (max-width: 760px), (pointer: coarse) and (max-width: 1400px) {
  .chart-page .subline { font-size: var(--text-md); gap: var(--space-2xs) var(--space-sm); margin-top: var(--space-2xs); color: var(--color-ink); }
  .chart-page .subline { font-weight: 600; }
  .chart-page .subline .arrangement { font-weight: 400; color: var(--color-ink-2); }
  .chart-page .sub-meta { display: inline-flex; align-items: center; font-weight: 700; font-size: var(--text-sm); color: var(--color-ink); background: var(--color-paper-2); border: 1px solid var(--color-rule); border-radius: 999px; padding: var(--space-3xs) var(--space-xs); font-variant-numeric: tabular-nums; }
}

/* Tap tempo (editor) and metronome (song page) */
.tempo-row { display: flex; gap: var(--space-xs); align-items: stretch; }
.tempo-row input { flex: 1; min-width: 0; }
.tap-tempo { min-width: 64px; font-weight: 700; background: var(--color-salmon-wash); border: 1px solid var(--color-salmon-2); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tap-tempo.hit { animation: tap-hit .15s ease-out; }
@keyframes tap-hit { from { background: var(--color-salmon); transform: scale(.94); } to { background: var(--color-salmon-wash); transform: none; } }
@media (prefers-reduced-motion: reduce) { .tap-tempo.hit { animation: none; } }
.tap-help { display: block; }
.metro-btn[aria-pressed="true"] { background: var(--color-salmon); border-color: var(--color-salmon-2); }
.metro-only { margin: var(--space-sm) 0; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1400px) {
  .pa-open-row .metro-btn { flex: 0 0 auto; padding-inline: var(--space-sm); min-height: 48px; }
  .pa-open-row:not(.metro-only) .metro-btn span { display: none; }
  .basics .tempo-row { grid-column: auto; }
}
.playalong:not(.open) .pa-open-row .with-icon { width: auto; }
/* Song flow row: the section headings already show the song's order, so it's left off the screen (still printed). */
@media screen { main > .song-flow { display: none; } }
/* iPad and other touch tablets use the phone layout, a bit bigger, with the controls kept to a comfortable width */
@media (pointer: coarse) and (min-width: 761px) and (max-width: 1400px) {
  main .toolbar.reader-tools, main .key-note, main .key-refs, main .playalong:not(.open), main .pa-bar { max-width: 680px; }
  main .pa-bar { margin-inline: 0; border-radius: 12px; border-width: 1px; }
  .playalong.open .pa-video iframe { max-width: 680px; }
  .reader-tools .chart-tools select { font-size: var(--text-md); min-height: 50px; }
  .reader-tools .chart-tools > .tool-group:first-child .icon { min-height: 50px; }
  .chart-page .song-title { font-size: 2.2rem; }
  .chart-page .subline { font-size: var(--text-lg); }
  .chart-page .bar .c { font-size: calc(28px * var(--chart-scale)); }
  .chart-page .bar.split .c { font-size: calc(22px * var(--chart-scale)); }
  .chart-page .bar { min-height: calc(64px * var(--chart-scale)); }
  .chart-page .sheet .section-heading { font-size: var(--text-md); }
}
/* Metronome button glows on each beat (stronger on beat 1) */
.metro-btn.beat { animation: metro-beat .22s ease-out; }
.metro-btn.downbeat { animation: metro-down .28s ease-out; }
@keyframes metro-beat { from { box-shadow: 0 0 0 4px var(--color-beat), 0 0 14px var(--color-beat); } to { box-shadow: 0 0 0 0 transparent; } }
@keyframes metro-down { from { box-shadow: 0 0 0 6px var(--color-beat-strong), 0 0 22px var(--color-beat-strong); background: var(--color-beat-fill); } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .metro-btn.beat, .metro-btn.downbeat { animation-duration: .01s; } }
/* Cifrita pick logo: fill more of the tile */
.mark { padding: var(--space-2xs); }
.splash-mark .mark { width: 118px; height: 118px; padding: 0; background: none; border-radius: 0; }

/* Original key and My key, side by side as tappable chips */
.key-refs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); margin: var(--space-xs) 0 0; font-size: var(--text-sm); }
.key-chip { display: inline-flex; align-items: baseline; gap: var(--space-2xs); min-height: 36px; padding: var(--space-2xs) var(--space-sm); border-radius: 999px; border: 1px solid var(--color-rule-strong); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.key-chip .key-chip-label { color: var(--color-ink-2); }
.key-chip strong { font-weight: 700; }
.key-chip.on { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.key-chip.on .key-chip-label { color: inherit; opacity: .8; }
.key-forget { font-size: var(--text-xs); color: var(--color-ink-2); }

/* Lists: your saved key in a small line under the original key */
.row-meta .key .my-key-tag { display: block; margin-top: var(--space-3xs); font-family: var(--font-body, inherit); font-size: var(--text-xs); font-weight: 500; color: var(--color-ink-2); white-space: nowrap; text-align: right; }
.row-meta .key .my-key-tag b { font-family: var(--font-chord); font-size: var(--text-sm); color: var(--color-chord); font-weight: 700; }
.lib-row .row-meta .key .my-key-tag { text-align: inherit; }

/* Home-screen app tip on the splash page */
.install-hint { margin: var(--space-md) auto 0; font-size: var(--text-sm); color: var(--color-ink-2); display: flex; align-items: center; justify-content: center; gap: var(--space-2xs); flex-wrap: wrap; }
.install-hint .share-glyph svg { width: 18px; height: 18px; vertical-align: -3px; display: inline-block; }
.install-hint .install-hide { padding: 0 var(--space-xs); font-size: 1.1rem; text-decoration: none; color: var(--color-ink-2); }
/* Opened from the home screen: no browser bars, so keep clear of the notch */
@media (display-mode: standalone) {
  header { padding-top: max(var(--space-lg), env(safe-area-inset-top)); }
  body.chart-page main, body.home-page main, body.artist-page main { padding-top: max(var(--space-lg), env(safe-area-inset-top)); }
  /* under the clock: a solid, pinned, full-width strip of page colour. The iPhone's home-screen app only drops its
     blurred status bar when it finds an opaque fixed element at the top centre, taller than 10px (WebKit rule), so the
     strip is never shorter than that even when the safe-area inset reads 0. */
  .status-strip { display: block; position: fixed; top: 0; left: 0; right: 0; height: max(14px, env(safe-area-inset-top)); background-color: var(--color-paper); z-index: var(--z-sticky); }
  .status-strip.on-art { background-color: var(--strip, var(--color-paper)); }
  /* chart page: the cover art runs up under the clock; the strip above matches its top colour */
  body.chart-page .chart-hero, body.artist-page .chart-hero { margin-top: calc(-1 * max(var(--space-lg), env(safe-area-inset-top))); padding-top: calc(max(var(--space-lg), env(safe-area-inset-top)) + var(--space-xs)); }
}

/* Print / Save as PDF: one clean page per song where it fits, in the key you're viewing */
@page { margin: 0.5in 0.55in; }
@media print {
  html, body { background: var(--color-print-paper) !important; }
  body { padding: 0 !important; }
  main { padding: 0 !important; }
  .key-refs, .pa-bar, .pa-extra, .pa-open-row, .metro-only, .install-hint, .status-pill, .key-note, .accuracy, .report-link { display: none !important; }
  .title-row { margin: 0; }
  .song-title, main h1 { font-size: 22pt; line-height: 1.1; margin: 0; }
  .subline { font-size: 11pt; margin: 2pt 0 0; }
  .meta-line { margin: 4pt 0 6pt; font-size: 10pt; }
  .meta-line a, .meta-line .yt, .meta-line [href*="youtu"] { display: none !important; }
  .song-flow { margin: 0 0 8pt; font-size: 9pt; gap: 2pt 4pt; }
  .song-flow .sec-badge { transform: scale(.85); }
  .sheet-wrap, .sheet { margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
  .sheet .music-section { padding: 1pt 0 2pt 8pt; margin: 0 0 6pt; border: 0; border-left: 3pt solid var(--sec, var(--color-print-muted)); border-radius: 0; box-shadow: none; background: none !important; }
  .section-heading { margin: 0 0 1pt; font-size: 9.5pt; }
  .section-heading .sec-badge, .section-heading span { background: none !important; }
  .sheet .bar { min-height: 0; padding: 1pt 6pt 1pt 7pt; border-left: 1.5pt solid var(--color-print-ink) !important; }
  .sheet .bar::before { display: none; }
  .sheet .bar .c { font-size: 14pt; line-height: 1.25; }
  .sheet .bars.row + .bars.row { border-top: .5pt solid var(--color-print-hair); }
  main::after { content: "cifrita.com"; display: block; margin-top: 8pt; font-size: 8pt; color: var(--color-print-muted); text-align: right; }
}

/* Phones: Print as a small icon beside the full-view button */
@media (max-width: 760px), (pointer: coarse) and (max-width: 1400px) {
  .title-actions .view-buttons { gap: var(--space-xs); }
  .title-actions .view-buttons > button.print-btn { display: inline-flex; padding: var(--space-xs); min-width: 44px; justify-content: center; }
  .title-actions .print-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Editor chord buttons: key chords, common extras, chords used in this song */
.pad-row { align-items: center; }
.pad-label { flex-basis: 100%; font-size: var(--text-xs); color: var(--color-ink-2); font-weight: 600; margin-top: var(--space-3xs); }
.pad-row.chords.in-key button { background: var(--color-field); border-color: var(--color-chord); }
.pad-row.chords.used button { border-style: dashed; }
.block-pad { margin: var(--space-xs) 0 var(--space-sm); }
.block-pad .pad-row button { min-width: 48px; min-height: 40px; }

/* Phones, Blocks editor: chord buttons pinned above the bottom bar */
.chord-dock { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-width: 1023px) {
  .chord-dock { display: flex; gap: var(--space-xs); overflow-x: auto; position: fixed; left: 0; right: 0; bottom: calc(61px + env(safe-area-inset-bottom)); z-index: var(--z-sticky); padding: var(--space-xs); background: var(--color-paper); border-top: 1px solid var(--color-rule); box-shadow: 0 -4px 12px -8px var(--color-lift); scrollbar-width: none; }
  .chord-dock button { flex: 0 0 auto; min-width: 48px; min-height: 44px; padding: 0 var(--space-sm); font-family: var(--font-chord); font-weight: 700; color: var(--color-chord); background: var(--color-field); }
  main.editing:has(.chord-dock) { padding-bottom: 80px; }
  html:has(.chord-dock) { scroll-padding-bottom: 150px; }
}

/* 1.13.4 Copy a section */
.section-bar .copy-section { align-self: end; display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: 40px; padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); font-weight: 600; }
.section-bar .copy-section svg { width: 18px; height: 18px; }
.chord-pad .pad-row.copies button { display: inline-flex; align-items: center; gap: var(--space-2xs); }
.chord-pad .pad-row.copies svg { width: 16px; height: 16px; flex: none; }

/* 1.13.4 Import: several pages, PDF, rotate */
.import-pages { list-style: none; padding: 0; margin: 0 0 var(--space-sm); display: grid; gap: var(--space-sm); }
.import-page { display: flex; gap: var(--space-md); align-items: center; padding: var(--space-sm); border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-field); }
.import-page .thumb { width: 112px; height: 112px; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--color-paper-2); border-radius: var(--radius-control); }
.import-page .thumb img { max-width: 100%; max-height: 100%; transition: transform .2s; }
.import-page .page-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); }
.import-page .page-tools strong { flex-basis: 100%; }
.import-page .page-tools small { flex-basis: 100%; margin-top: calc(-1 * var(--space-2xs)); }
.import-page .page-tools button { min-height: 40px; }
.import-box .add-more { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; }
.import-box .add-more[hidden], .dropzone[hidden] { display: none; }
.import-tips { margin: var(--space-md) 0; }
.import-tips summary { cursor: pointer; font-weight: 600; }
.import-tips ul { margin: var(--space-xs) 0 0; padding-left: 1.2em; }
@media (prefers-reduced-motion: reduce) { .import-page .thumb img { transition: none; } }

/* 1.13.5 capital-letter hint */
.caps-hint { margin: var(--space-2xs) 0; padding: var(--space-xs) var(--space-sm); border: 1px solid var(--color-accent-wash-2); border-radius: 8px; background: var(--color-accent-wash); font-size: var(--text-sm); }

/* 1.14.0 quality badges and versions */
.q-badge { display: inline-block; vertical-align: middle; font-size: var(--text-xs, 0.75rem); font-weight: 600; line-height: 1.2; padding: var(--space-3xs) var(--space-xs); border-radius: 999px; white-space: nowrap; }
.q-badge.verified { background: var(--color-ok-wash); color: var(--color-ok); border: 1px solid var(--color-ok-edge); }
.q-badge.new { background: var(--color-paper-2); color: var(--color-ink-2); border: 1px solid var(--color-rule); }
.quality-line { margin: var(--space-xs) 0 0; }
.versions-count { color: var(--color-accent); font-weight: 600; }
.versions { margin-top: var(--space-lg); }
.versions h2 { font-size: var(--text-lg, 1.25rem); }
@media print { .q-badge, .quality-line, .versions { display: none !important; } }

/* View counts (owner/reviewers on the chart page, creators in My charts, site owner on Reports) */
.views-line { margin: 0 0 var(--space-sm); font-size: 0.9rem; }
.views-count { font-size: 0.85rem; color: var(--color-muted); white-space: nowrap; }
.popular { margin-bottom: var(--space-lg); }

/* Artist pages: the artist name on a chart links to them */
.artist-link { color: inherit; text-decoration: underline; text-decoration-color: var(--color-rule); text-underline-offset: 0.2em; }
.artist-link:hover { text-decoration-color: currentColor; }
.related-artists { margin-top: var(--space-xl); }
.related-artists ul { display: flex; flex-wrap: wrap; gap: var(--space-sm); list-style: none; padding: 0; margin: var(--space-sm) 0 0; }
.related-artists a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-md); border: 1px solid var(--color-rule); border-radius: 999px; color: inherit; text-decoration: none; }
.related-artists a:hover { border-color: currentColor; }

/* Artist catalog: songs without a chart yet, and the list of all artists */
.missing { margin-top: var(--space-xl); }
.missing-list { list-style: none; padding: 0; margin: var(--space-sm) 0; }
.missing-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); min-height: 48px; padding: var(--space-2xs) 0; border-bottom: 1px solid var(--color-rule); }
.missing-title { min-width: 0; overflow-wrap: anywhere; }
.missing-list .button.small { flex-shrink: 0; min-height: 40px; padding: 0 var(--space-md); font-size: var(--text-sm); }
.source-note { margin-top: var(--space-md); }
.artist-list { list-style: none; padding: 0; margin: var(--space-md) 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 0 var(--space-xl); }
.artist-list a { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); min-height: 52px; padding: var(--space-xs) 0; border-bottom: 1px solid var(--color-rule); color: inherit; text-decoration: none; }
.artist-list a:hover strong { text-decoration: underline; }

/* ---------- song covers (drawn by public/cover.mjs) ---------- */
.cover { display: block; flex: none; overflow: hidden; border-radius: var(--radius-small); line-height: 0; }
.cover svg { display: block; width: 100%; height: 100%; }
.cv-over { mix-blend-mode: multiply; }
.row-cover { width: 3rem; height: 3rem; }
.song-row { justify-content: flex-start; }
.song-row .row-main { flex: 1 1 auto; min-width: 0; }
/* chart page: sharp cover art behind the title block, darkened toward the bottom; the title sits on it in light type */
.chart-hero { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-lg);
  min-height: 19rem; margin-bottom: var(--space-md); padding: var(--space-md) var(--space-lg) var(--space-lg); border-radius: var(--radius-card); overflow: hidden; color: var(--color-hero-ink); }
.cover-band { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.cover-band svg { display: block; width: 100%; height: 100%; }
.cover-band::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 0%, transparent 40%, var(--color-hero-shade-mid) 62%, var(--color-hero-shade) 100%); }
.chart-hero .back { align-self: flex-start; padding: var(--space-3xs) var(--space-sm); border-radius: var(--radius-control); background: var(--color-paper); color: var(--color-ink); }
.chart-hero .song-title, .chart-hero .subline, .chart-hero .artist-link, .chart-hero .arrangement { color: var(--color-hero-ink); }
.chart-hero .artist-link { text-decoration-color: currentColor; }
.chart-hero .title-actions button, .chart-hero .title-actions .button { background: var(--color-paper); color: var(--color-ink); }
.artist-head { display: flex; align-items: end; gap: var(--space-lg); margin-bottom: var(--space-lg); }
.artist-head h1 { margin-top: 0; }
.artist-cover { width: 13rem; height: 13rem; }
/* artist page: the artist's photo (or drawn art) fills the top, like a chart page */
.photo-band { background: var(--color-ink); }
.photo-band img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
/* wide screens: the photo takes the right part at its own shape (faces stay whole); the rest is the photo's edge colour */
@media (min-width: 761px) { .photo-band { background: var(--photo-edge, var(--color-ink)); } .photo-band img { width: min(60%, 34rem); margin-left: auto; object-position: center 12%; } .artist-hero { min-height: 24rem; } }
/* AI art is a landscape: it fills the whole band at every size */
.photo-band.ai-band img { width: 100%; margin: 0; object-position: center; }
.artist-hero { min-height: 20rem; }
.artist-hero .song-title { margin: 0; color: var(--color-hero-ink); }
.artist-hero .artist-count { margin: var(--space-3xs) 0 0; color: var(--color-hero-ink); font-size: var(--text-lg); }
.photo-credit { margin: calc(-1 * var(--space-xs)) 0 var(--space-md); font-size: var(--text-xs); color: var(--color-muted); }
.photo-credit a { color: inherit; }
@media (max-width: 760px) {
  .row-cover { width: 2.75rem; height: 2.75rem; }
  .chart-hero { min-height: 17rem; margin: calc(-1 * var(--space-sm)) calc(-1 * var(--gutter)) var(--space-md); padding: var(--space-sm) var(--gutter) var(--space-md); border-radius: 0; }
  .artist-head { flex-direction: column; align-items: start; gap: var(--space-md); }
  .artist-cover { width: 10rem; height: 10rem; }
  .artist-hero { min-height: 22rem; }
  .photo-credit { margin-top: calc(-1 * var(--space-2xs)); }
}
@media print { .cover, .cover-band { display: none; } .chart-hero { min-height: 0; padding: 0; color: inherit; } .chart-hero .song-title, .chart-hero .subline, .chart-hero .artist-link { color: inherit; } }
