/* ACM Voice Lines palette. Compatibility names keep existing editor styles. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #182238;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #4269a6;
  --accent-secondary: #557fbd;
  --accent-soft: #eaf0f8;
  --accent-text: #ffffff;
  --header: #182238;
  --logo-dark: #0b0b03;
  --logo-light: #f4f4fc;
  --danger: #c2413a;
  --playhead: var(--danger);
  --danger-soft: #fcedec;
  --warning: #946200;
  --warning-soft: #fff7df;
  --gold: var(--accent);
  --gold-text: var(--accent-text);
  --gold-ink: var(--accent);
  --mine: var(--accent-soft);
  --primary: var(--accent);
  --ink: var(--text);
  --shadow: 0 2px 10px rgb(24 34 56 / 0.06);
  color-scheme: light;
}
/* Scores and editing controls use one explicit light palette on every OS. */

/* Inter, variable weight, Cyrillic included. SIL OFL: fonts/OFL-Inter.txt. */
@font-face {
  font-family: Inter;
  src: url('/fonts/inter-variable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

* { box-sizing: border-box; }
/* Component display rules (e.g. button { display: inline-flex }) would
   otherwise override the hidden attribute. The panel animates its own. */
[hidden]:not(.panel) { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--header);
  color: var(--surface);
}
header h1 { margin: 0; font-size: 1.45rem; font-weight: 650; letter-spacing: -0.01em; }
/* The running version, faint at the right (also in About). */
.header-version { margin-left: auto; font-size: 0.7rem; opacity: 0.45; font-variant-numeric: tabular-nums; }
header h1::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 2px; border-radius: 50%; background: var(--gold); }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h2 { font-size: 1.15rem; font-weight: 650; margin: 24px 0 10px; letter-spacing: -0.005em; }
.muted { color: var(--muted); font-size: 0.92rem; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s ease;
}
button:active:not(:disabled), .button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.danger { color: var(--danger); margin-top: 32px; }
.wide { width: 100%; margin-top: 16px; }
.icon-btn { min-height: 36px; padding: 0 10px; background: transparent; border: none; color: inherit; font-size: 1.3rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.intro { margin: 8px 0 20px; }
.tagline { margin: 0; font-size: 1.6rem; line-height: 1.2; font-weight: 750; letter-spacing: -0.02em; }
.tagline span { color: var(--gold-ink); }
#intro-more { margin: 10px 0 0; font-size: 0.98rem; }

.library { list-style: none; padding: 0; margin: 0; }
.library-search { width: 100%; min-height: 44px; margin: 0 0 12px; padding: 0 14px; font: inherit; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); }
.library li { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.library li > button:first-child { border: 0; box-shadow: var(--shadow); min-height: 64px; flex: 1; min-width: 0; gap: 12px; justify-content: flex-start; padding-left: 8px; text-align: left; }
.library .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/* Full name, wrapping to two lines before it's cut short. */
.library .name { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.25; }
.library small { font-size: 0.8rem; }
.library .thumb { width: 36px; height: 48px; flex: none; border-radius: 5px; box-shadow: 0 0 0 1px var(--border); overflow: hidden; background: var(--border); }
.library .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.library small { color: var(--muted); font-weight: 400; }

.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 0; margin: 16px 0 0; list-style: none; }
.pages li { position: relative; }
.pages img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.pages .remove { position: absolute; top: 4px; right: 4px; min-height: 28px; padding: 0 8px; font-size: 0.85rem; }
.pages .rotate { position: absolute; top: 4px; left: 4px; min-height: 28px; padding: 0 8px; font-size: 1rem; }
.pages .num { position: absolute; bottom: 4px; left: 4px; background: var(--surface); border-radius: 6px; padding: 0 6px; font-size: 0.8rem; }

.name-field { display: grid; gap: 4px; margin-top: 16px; font-size: 0.95rem; }
.name-field input { min-height: 44px; font: inherit; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.status { margin-top: 16px; white-space: pre-line; }
.discard { margin-top: 24px; color: var(--muted); }
.status progress { width: 100%; height: 8px; }

.title-wrap { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.title-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-bottom: 1px dashed var(--muted);
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text);
}
.title-input:focus { border-color: var(--border); background: var(--surface); outline: none; }

.lock-row { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lock-row .muted { font-size: 0.85rem; }
#panel.locked #auto-part, #panel.locked #marked-part, #panel.locked .octave-row { opacity: 0.55; }
.marked-part p { margin: 0 0 10px; }
.danger-text { color: var(--danger); }
#auto-part > .hint { margin: 10px 0 6px; }
#start-markup { width: 100%; }
.markup-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--transport-h);
  padding: 8px 16px max(8px, env(safe-area-inset-bottom));
  background: var(--mine);
  border-top: 2px solid var(--gold);
}
.markup-bar[hidden] { display: none; }
.markup-bar p { flex: 1; margin: 0; font-size: 0.92rem; }
body.marking .transport { display: none; }
select { min-height: 40px; font: inherit; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; font-weight: 400; }
.photo-list .mark { fill: var(--gold); fill-opacity: 0.16; stroke: var(--gold); stroke-opacity: 0.6; stroke-width: 4; }
.photo-list .fix-band { fill: var(--accent); fill-opacity: 0.12; stroke: var(--accent); stroke-opacity: 0.7; stroke-width: 4; }
.photo-list .fix-pending { stroke: var(--accent); stroke-width: 5; stroke-dasharray: 16 10; }
.photo-list .mark-label { fill: var(--warning); font-family: Inter, system-ui, sans-serif; font-weight: 700; }
.lines { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lines li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.lines li.mine { background: var(--mine); border-color: var(--gold); }
.lines .pick { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 32px; }
.lines .range { color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.lines .include { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
input[type="radio"], input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

.controls { display: grid; gap: 14px; margin-top: 20px; }
.controls label { display: grid; gap: 4px; font-size: 0.95rem; }
.controls input[type="range"] { width: 100%; accent-color: var(--accent); }
.bars { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.bars input[type="number"] { width: 72px; min-height: 40px; font: inherit; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.bars .check, .repeats .check { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.repeats { margin-top: 12px; }
.repeats ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.repeats li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.95rem; }
.repeats input[type="number"] { width: 72px; min-height: 40px; font: inherit; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }

/* Practice screen: music fills the page; transport is fixed at the bottom and
   the detailed controls slide up above it. */
:root { --transport-h: calc(72px + env(safe-area-inset-bottom)); }
#practice { padding-bottom: var(--transport-h); }
.transport {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: var(--transport-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 12px env(safe-area-inset-bottom);
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.icon-round { width: 50px; height: 50px; min-height: 0; padding: 0; border-radius: 50%; }
.icon-round svg { width: 26px; height: 26px; fill: currentColor; }
#play { width: 60px; height: 60px; background: var(--gold); border-color: var(--gold); color: var(--gold-text); box-shadow: 0 4px 14px color-mix(in srgb, var(--gold) 45%, transparent); }
#play .i-pause, #play.playing .i-play { display: none; }
#play.playing .i-pause { display: block; }
#settings[aria-expanded="true"] { background: var(--mine); border-color: var(--gold); }
.position { font-variant-numeric: tabular-nums; font-size: 1.05rem; min-width: 64px; text-align: center; }

.panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--transport-h);
  z-index: 2;
  max-height: min(70vh, calc(100vh - var(--transport-h) - 64px));
  overflow-y: auto;
  padding: 4px 16px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgb(0 0 0 / 0.18);
  transform: translateY(0);
  transition: transform 0.25s ease, visibility 0.25s;
}
.panel[hidden] { display: block; visibility: hidden; transform: translateY(110%); pointer-events: none; }
.panel > * { max-width: 608px; margin-left: auto; margin-right: auto; }
.panel { padding-top: 0; }
.panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  margin: 0 -16px;
  max-width: none;
  background: var(--bg);
  touch-action: none;
  cursor: grab;
}
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--border); }
.panel-close { position: absolute; right: 12px; min-height: 34px; padding: 0 14px; font-weight: 600; color: var(--accent); }
.panel-backdrop { position: fixed; inset: 0; z-index: 1; background: rgb(0 0 0 / 0.18); }
.error-toast { position: fixed; top: 64px; left: 12px; right: 12px; z-index: 10; padding: 10px 14px; border-radius: 10px; background: var(--danger); color: var(--surface); font-size: 0.9rem; box-shadow: 0 6px 18px rgb(0 0 0 / 0.25); }
.title-row { display: flex; align-items: center; gap: 4px; }
.title-row .title-wrap { flex: 1; min-width: 0; }
.share-btn { flex: none; width: 44px; height: 44px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--accent); }
.report-link { margin: 32px 0 8px; text-align: center; }
.report-overlay { position: fixed; inset: 0; z-index: 9; display: flex; align-items: flex-start; justify-content: center; padding: 72px 12px 12px; background: rgb(0 0 0 / 0.3); overflow-y: auto; }
.report-card { width: 100%; max-width: 560px; padding: 16px; border-radius: 14px; background: var(--bg); box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); }
.report-card h2 { margin: 0 0 12px; }
.report-card label { display: block; margin-bottom: 6px; }
.report-card textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); resize: vertical; }
.report-card details { margin: 12px 0; }
.report-card pre { max-height: 30vh; overflow: auto; padding: 8px; border-radius: 8px; background: var(--surface); font-size: 0.75rem; white-space: pre-wrap; word-break: break-word; }
/* A scan page full-screen (tap its thumbnail), to check it before reading. */
.page-zoom { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--text); }
.page-zoom[hidden] { display: none; }
.page-zoom img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.page-zoom-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--bg); }
.page-zoom-bar span { flex: 1; color: var(--muted); }
/* Privacy notice and terms (privacy.html, terms.html). */
.legal { line-height: 1.55; }
.legal h2 { font-size: 1.5rem; margin-top: 8px; }
.legal h3 { font-size: 1.08rem; margin: 26px 0 6px; }
.legal h4 { font-size: 0.98rem; margin: 18px 0 4px; }
.legal p, .legal li { font-size: 0.95rem; }
.legal a { color: var(--accent); }
.legal-links { margin-top: 32px; }
.report-link a { color: var(--accent); }
header a.icon-btn { color: inherit; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.about-card h2 small { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.about-card h3 { font-size: 1rem; margin: 18px 0 6px; }
.about-card p, .credits { font-size: 0.92rem; margin: 0 0 8px; }
.credits { padding-left: 18px; }
.credits li { margin-bottom: 6px; }
.about-card a { color: var(--accent); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-close { min-height: 0; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 1.6rem; color: var(--muted); }
.steps { margin: 14px 0 12px; padding-left: 22px; font-size: 0.95rem; }
.steps li { margin-bottom: 4px; }
.report-status { margin: 10px 0 0; font-weight: 600; color: var(--accent); }
.report-status:empty { display: none; }
.report-card .muted { font-size: 0.85rem; margin: 10px 0 0; }
.update-banner { position: fixed; top: 64px; left: 12px; right: 12px; z-index: 8; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 6px 18px rgb(0 0 0 / 0.2); }
.update-banner span { flex: 1; font-size: 0.95rem; }
.install-card { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.install-card p { margin: 0 0 10px; }
.import-offer { margin: 16px 0; padding: 14px 16px; border: 2px solid var(--accent); border-radius: 12px; background: var(--mine); }
.import-offer p { margin: 0 0 10px; }
.library li.just-added > button:first-child { animation: just-added 2.5s ease-out; }
@keyframes just-added { from { background: var(--mine); border-color: var(--accent); } }
.share-spacer { flex: none; width: 44px; }
.library li { gap: 0; }
.library li > button:first-child { margin-right: 4px; min-height: 60px; padding-top: 6px; padding-bottom: 6px; }
.library .share-btn, .library .share-spacer { width: 38px; }
.library .share-btn svg { width: 22px; height: 22px; }
.library .delete-btn { color: var(--danger); }
.library .delete-btn:disabled { color: var(--muted); opacity: 0.4; }
.confirm-delete { flex: 1; padding: 10px 12px; border: 2px solid var(--danger); border-radius: 10px; background: var(--surface); }
.confirm-delete p { margin: 0 0 8px; }
.danger-solid { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.share-btn svg { width: 24px; height: 24px; fill: currentColor; }
.share-status { margin: 0 8px; font-size: 0.85rem; }
.share-status:empty { display: none; }
.panel .danger { margin: 24px auto 8px; display: flex; }
/* Compact panel: explanations behind small "?" buttons. */
.panel h2 { display: flex; align-items: center; gap: 8px; }
.q { flex: none; box-sizing: border-box; width: 28px; height: 28px; min-width: 0; min-height: 0; padding: 0; border-radius: 50%; font-size: 0.85rem; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.panel-head + h2 { margin-top: 0; }
.share-status:empty { display: none; }
.hint { font-size: 0.85rem; margin: 2px 0 8px; color: var(--muted); }
.row2 { display: flex; gap: 10px; margin: 2px 0 4px; }
.row2 button { flex: 1; padding: 10px 8px; }
/* Ready to share at once (no preparing): filled, with a tick. */
.row2 button.ready { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.row2 button.ready::before { content: "✓\00a0"; }
.bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
#score-history { flex-basis: 100%; min-width: 0; }
#score-history[open] { display: grid; gap: 10px; }
#score-history select { width: 100%; min-width: 0; max-width: 100%; }
#score-history button { justify-self: start; }
.lock-box { flex: 1; display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.lock-box .check { flex: 1; }
.panel .bottom .danger { margin: 0; }
#read-again[hidden] { display: none; }

details { margin-top: 24px; }
.view-toggle { flex-direction: column; gap: 0; font-size: 0.62rem; font-weight: 600; line-height: 1.1; }
.view-toggle[hidden] { display: none; }
.view-toggle svg { width: 20px; height: 20px; }
.view-toggle .i-pages, .view-toggle.on-read .i-read { display: none; }
.view-toggle.on-read .i-pages { display: block; }
.follow { margin-top: 12px; }
.read-view { margin-top: 12px; }
.read-view .muted { margin: 0 0 8px; }
.read-page { position: relative; cursor: pointer; }
.read-page.read-failed { cursor: default; padding: 16px 0; }
.read-bar, .read-playhead { position: absolute; pointer-events: none; }
.read-bar[hidden], .read-playhead[hidden] { display: none; }
.read-bar { background: color-mix(in srgb, var(--accent) 10%, transparent); border: 2px solid var(--accent); border-radius: 4px; }
.read-playhead { background: var(--playhead); border-radius: 2px; }
.photo-list { display: grid; gap: 8px; }
.photo-list .page { position: relative; }
.photo-list img { width: 100%; display: block; border-radius: 8px; border: 1px solid var(--border); }
.photo-list svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
/* The music is one big tap target: no tap flash, no long-press selection. */
.photo-list, .read-page { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.photo-list .bar { fill: var(--accent); fill-opacity: 0.12; stroke: var(--accent); stroke-width: 6; }
.photo-list .playhead { stroke: var(--playhead); stroke-width: 8; stroke-linecap: round; }
.photo-list .note { fill: none; stroke: var(--gold); stroke-width: 7; }

summary { cursor: pointer; min-height: 32px; }
#osmd { background: var(--surface); border-radius: 8px; overflow-x: auto; }
#pages img { cursor: zoom-in; }

/* Compact correction panel; the original page and transport remain usable. */
.score-editor { position: fixed; z-index: 35; right: 16px; top: 76px; width: min(360px, calc(100vw - 32px)); max-height: calc(100dvh - 165px); overflow: auto; background: var(--surface, var(--surface)); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: 0 6px 24px color-mix(in srgb, var(--text) 20%, transparent); }
.score-editor label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: .85rem; }
.score-editor input, .score-editor select { width: 100%; min-width: 0; padding: 6px; }
.editor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.score-editor .actions { flex-wrap: wrap; gap: 8px; }
.score-editor .hint { margin: 8px 0; }
.editor-selected { fill: color-mix(in srgb, var(--warning) 27%, transparent); stroke: var(--danger); stroke-width: 4; pointer-events: none; }
@media (min-width: 1000px) { body.editing main { max-width: none; margin-left: max(0px, calc((100vw - 1400px) / 2)); margin-right: 400px; } body.editing #photo-list { margin-right: 0; } }
@media (max-width: 600px) { .score-editor { top: auto; bottom: 80px; max-height: 43dvh; } body.editing #photo-list { padding-bottom: 45dvh; } }

.editor-bars { pointer-events: none; }
.editor-bar { fill: none; stroke: var(--warning); stroke-width: 2; stroke-dasharray: 8 8; }
.editor-bar.active { fill: color-mix(in srgb, var(--warning) 9%, transparent); stroke-width: 5; stroke-dasharray: none; }
.editor-bar-badge { pointer-events: auto; cursor: pointer; }
.editor-bar-badge rect { fill: var(--danger); }
.editor-bar-badge text { fill: white; text-anchor: middle; font-family: sans-serif; font-weight: bold; }
.editor-bar-badge:focus rect { stroke: var(--text); stroke-width: 4; }

body.editing.split-view #score-views { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
body.editing.split-view #score-views > div { overflow: auto; max-height: calc(100dvh - 220px); }
body.editing.split-view .read-page svg { max-width: 100%; height: auto; }
@media (max-width: 800px) { body.editing.split-view #score-views { grid-template-columns: 1fr; } body.editing.split-view #score-views > div { max-height: 35dvh; } }

.read-selection { position: absolute; pointer-events: none; border: 3px solid var(--danger); background: color-mix(in srgb, var(--warning) 9%, transparent); border-radius: 3px; box-sizing: border-box; }
.read-selection[hidden] { display: none; }
.read-selection::before { content: attr(data-label); position: absolute; top: -24px; left: -3px; color: white; background: var(--danger); font: 12px system-ui; padding: 3px 6px; white-space: nowrap; border-radius: 3px; }

.read-note-selection { position: absolute; border: 3px solid var(--danger); border-radius: 50%; background: color-mix(in srgb, var(--warning) 27%, transparent); pointer-events: none; box-sizing: border-box; }
.read-note-selection[hidden] { display: none; }
.score-editor details { margin: 12px 0; }
.score-editor summary { cursor: pointer; font-weight: 600; }

/* The correction workspace owns the editing layout; the form is an inspector. */
body.editing main { max-width: none; margin: 0 440px 0 0; padding-bottom: 100px; }
body.editing .score-editor { position: fixed; right: 12px; top: 76px; bottom: 88px; width: 408px; max-height: none; margin: 0; overflow-y: auto; overscroll-behavior: contain; }
body.editing .score-editor > label { max-width: 240px; }
body.editing #score-views { margin-top: 12px; }
#notation-workspace { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 12px 0; color: var(--text); }
.notation-top, .notation-toolbar, .notation-palette, .notation-tools { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 10px; }
.notation-top { position: sticky; top: 0; background: white; z-index: 4; padding: 6px 0; }
.notation-toolbar label, .notation-tools label { display: flex; gap: 5px; align-items: center; font-size: .85rem; }
.notation-toolbar input { width: 72px; }
.notation-tools input:not([type="checkbox"]) { width: 60px; }
.notation-toolbar select { max-width: 155px; }
:is(#notation-workspace, #notation-controls) button { padding: 7px 10px; font-size: .85rem; }
:is(#notation-workspace, #notation-controls) [aria-pressed="true"] { background: var(--primary, var(--accent)); color: white; border-color: var(--accent); }
#nw-status { background: var(--surface); padding: 8px; border-radius: 6px; margin: 8px 0; }
.notation-duration-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; }
.notation-duration-mode select { max-width: 100%; }
#nw-action-error { position: fixed; right: 16px; bottom: 96px; z-index: 1100; width: min(420px, calc(100vw - 32px)); box-sizing: border-box; padding: 14px; border: 2px solid var(--danger); border-radius: 8px; background: white; color: var(--text); box-shadow: 0 4px 16px #18223824; }
#nw-action-error[hidden] { display: none; }
#nw-error-text { display: block; margin-top: 8px; overflow-wrap: anywhere; }
#nw-action-error strong { color: var(--danger); }
#nw-error-dismiss { float: right; margin: -5px -5px 0 8px; }
#nw-status.editor-operation-error { color: var(--danger); border: 1px solid var(--danger); }
#nw-cut-preview { flex-basis: 100%; margin: 0; }
.notation-focus { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); gap: 12px; }
.notation-focus figure { margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.notation-focus figcaption { color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.notation-focus svg { width: 100%; height: 270px; display: block; }
#nw-score { outline-offset: 4px; cursor: crosshair; }
.nw-selected { stroke: var(--danger); stroke-width: 2.5; fill: color-mix(in srgb, var(--warning) 40%, transparent); }
.rhythm-lane { margin: 12px 0; }
.rhythm-label { text-align: left; font-weight: 600; }
.rhythm-error { color: var(--danger); background: var(--danger-soft); }
.rhythm-grid { position: relative; margin: 6px 4px; border: 1px solid var(--border); background: repeating-linear-gradient(to right, var(--surface) 0, var(--surface) calc(100% / var(--beats) - 1px), var(--border) calc(100% / var(--beats) - 1px), var(--border) calc(100% / var(--beats))); }
.rhythm-tick { position: absolute; top: 0; font-size: 10px; color: var(--muted); padding-left: 2px; }
.rhythm-boundary { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--danger); z-index: 2; pointer-events: none; }
#notation-workspace .rhythm-event { position: absolute; height: 25px; min-height: 0; min-width: 0; padding: 2px; font-size: 12px; overflow: hidden; border: 1px solid var(--accent); border-radius: 3px; background: var(--accent-soft); }
#notation-workspace .rhythm-event.rest { background: var(--border); color: var(--muted); border-style: dashed; }
#notation-workspace .rhythm-event.overflow { background: var(--danger-soft); border-color: var(--danger); }
#notation-workspace .rhythm-event.active { background: var(--warning-soft); color: var(--warning); border: 2px solid var(--danger); }
#nw-selection { margin-left: auto; font-size: .85rem; }
@media (max-width: 800px) { .notation-focus { grid-template-columns: 1fr; } .notation-focus svg { height: 210px; } .notation-top { position: static; } }

.read-page svg { max-width: 100%; height: auto; }

.notation-top label { font-size: .8rem; display: inline-flex; gap: 4px; align-items: center; }
.notation-top input { width: 56px; }

/* Keep all editing controls beside the score, independent of document scroll. */
#notation-controls .notation-top { position: static; }
#notation-controls .notation-top strong, #nw-location { flex-basis: 100%; }
#notation-controls .notation-toolbar { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
#notation-controls .notation-toolbar label { margin: 0; }
#notation-controls .notation-toolbar input, #notation-controls .notation-toolbar select { width: 100%; max-width: none; }
#notation-controls .notation-palette { gap: 5px; }
#notation-controls button { min-height: 32px; padding: 5px 8px; }
#notation-controls #nw-status { font-size: .8rem; }
#notation-controls #nw-selection { display: block; margin: 8px 0; }
#notation-controls details { font-size: .85rem; }
@media (max-width: 800px) {
  body.editing main { margin: 0; padding-bottom: 50dvh; }
  body.editing .score-editor { top: auto; bottom: 80px; right: 8px; width: calc(100vw - 16px); max-height: 43dvh; }
}
#score-editor > .actions strong { font-size: .95rem; }
#score-editor > label { flex-direction: row; align-items: center; max-width: none; }
#score-editor > label select { flex: 1; }
#notation-controls .notation-top strong, #notation-controls [data-do="done"] { display: none; }
#notation-controls #nw-location { order: -1; }
#notation-controls .notation-toolbar label { font-size: .78rem; gap: 2px; }
#notation-controls .notation-toolbar input, #notation-controls .notation-toolbar select { min-height: 32px; height: 32px; padding: 4px 6px; }
/* Issues remain visible across the whole score, independently of selection. */
.read-problem { position: absolute; pointer-events: none; box-sizing: border-box; border: 2px solid var(--danger); background: color-mix(in srgb, var(--danger) 7%, transparent); border-radius: 4px; }
.read-problem > span { position: absolute; right: 0; top: 0; max-width: 100%; background: var(--danger); color: white; font: 10px system-ui; padding: 2px 4px; border-radius: 0 0 0 3px; }
.rhythm-event { touch-action: none; cursor: grab; }
.rhythm-event.dragging { z-index: 8; opacity: .8; cursor: grabbing; box-shadow: 0 2px 6px color-mix(in srgb, var(--text) 33%, transparent); pointer-events: none; }
#nw-score svg, .read-page { touch-action: pan-y; }
.read-page.dragging-note { cursor: grabbing; }
.read-problem.voices-only { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 5%, transparent); }
.read-problem.voices-only > span { background: var(--warning); }

.rhythm-warning {color:var(--warning);background:var(--warning-soft);}
.rhythm-split-cursor {position:absolute;top:0;bottom:0;border-left:2px dashed var(--accent);pointer-events:none;z-index:3;}
#nw-split-preview,#nw-choir-state {font-size:12px;line-height:1.4;max-width:100%;}

#notation-controls input[type="checkbox"] { width: auto; height: auto; min-height: 0; flex: none; }
#nw-routing > label, #nw-routing > p { grid-column: 1 / -1; }
#nw-routing > label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; gap: 8px; }
#notation-controls .notation-palette > label { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; }
.rhythm-event.tied { border-bottom: 3px solid var(--accent); }
#nw-link-state { font-size: .75rem; flex-basis: 100%; }

#notation-controls .notation-palette > label { flex-direction: row; }
#nw-routing { border: 1px solid var(--accent-soft); border-radius: 8px; padding: 8px; background: var(--surface); margin: 8px 0; }
#nw-routing #nw-choir-state { margin: 0; font-size: .75rem; }

#notation-workspace .rhythm-event.rhythm-overlap { border-color: var(--danger); background: var(--danger-soft); }
#notation-workspace .rhythm-event.rhythm-overlap.active { background: var(--warning-soft); border: 2px solid var(--danger); }

body.editing.split-view #score-views > div { scrollbar-gutter: stable; }

.sound-mixer { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.sound-mixer summary { cursor: pointer; font-weight: 600; }
.sound-mixer > label { display: block; margin: 10px 0; }
.sound-mixer select { width: 100%; min-width: 0; }
.voice-mix-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(160px, 2fr) minmax(100px, 2fr) 48px; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.voice-mix-row button { grid-column: 3 / -1; justify-self: end; font-size: 12px; min-height: 25px; }
@media (max-width: 600px) { .voice-mix-row { grid-template-columns: 1fr 48px; } .voice-mix-row strong,.voice-mix-row select { grid-column: 1 / -1; } .voice-mix-row button { grid-column: 1 / -1; } }

.rhythm-drop-preview { position:absolute; top:0; bottom:0; z-index:9; pointer-events:none; border:2px dashed var(--accent); background:color-mix(in srgb, var(--accent) 13%, transparent); color:var(--accent); font-size:11px; font-weight:600; white-space:nowrap; }

/* Fix systems owns the overlay while editing page bands. Playback/part marks
   are retained in the DOM and become visible again after Done or Cancel. */
body.fixing-systems .photo-list :is(.bar, .playhead, .note, .part-marks, .editor-selected, .editor-bars) { display: none !important; }

.score-setup { width:min(920px,94vw); max-height:90vh; border:1px solid var(--border); border-radius:14px; padding:24px; overflow:auto; color:var(--ink); background:var(--surface); }
.score-setup::backdrop { background:color-mix(in srgb, var(--text) 47%, transparent); }
.score-setup fieldset { margin:20px 0; border:1px solid var(--border); border-radius:8px; padding:16px; }
.score-setup label { display:flex; align-items:center; gap:10px; margin:10px 0; }
.score-setup p { line-height:1.5; }
.setup-part-row { display:grid; grid-template-columns:1.1fr 1fr 1fr 1.3fr; gap:10px; align-items:center; margin:12px 0; }
.setup-part-row input { width:100%; min-width:0; min-height:40px; font:inherit; padding:0 10px; border:1px solid var(--border); border-radius:8px; }
.setup-fields { display:flex; flex-wrap:wrap; gap:12px; }
.setup-fields input { width:75px; }
.setup-actions { position:sticky; bottom:-24px; display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; padding:16px 0; background:var(--surface); border-top:1px solid var(--border); }
.setup-warnings { border-left:3px solid var(--warning); padding-left:12px; }
@media(max-width:650px){ .setup-part-row { grid-template-columns:1fr; } .score-setup { padding:16px; } }

.setup-source { position:relative; margin-top:12px; }
.setup-source img { display:block; width:100%; }
.setup-source svg { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }

.rhythm-delete-layer { margin-left: 8px; font-size: 12px; }

/* A consistent score workspace, independent of the operating-system theme. */
:root { --editor-width: 360px; }
body.editing { background: var(--accent-soft); }
body.editing main { margin-right: calc(var(--editor-width) + 28px); padding: 18px 20px 110px; }
body.editing .score-editor { width: var(--editor-width); top: 72px; bottom: 88px; padding: 14px; border-color: var(--accent-soft); box-shadow: 0 6px 24px color-mix(in srgb, var(--header) 7%, transparent); scrollbar-gutter: stable; }
#score-editor > .actions:first-child { position: sticky; top: -14px; z-index: 8; background: var(--surface); margin: -14px -8px 10px; padding: 12px 8px 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--accent-soft); }
#score-editor > .actions:first-child button { min-height: 34px; padding: 4px 14px; background: var(--accent); color: var(--surface); }
#notation-controls .notation-top { position: sticky; top: 42px; z-index: 7; background: var(--surface); border-bottom: 1px solid var(--accent-soft); padding: 8px 0 10px; gap: 6px; }
#notation-controls #nw-location { color: var(--accent); font-weight: 650; font-size: .85rem; }
#notation-controls .notation-top input { width: 48px; min-height: 30px; padding: 3px 5px; }
#notation-controls .notation-toolbar { padding: 10px; border: 1px solid var(--accent-soft); border-radius: 9px; background: var(--surface); gap: 8px; }
#notation-controls .notation-palette { padding: 8px 0; border-bottom: 1px solid var(--accent-soft); }
#notation-controls button { font-size: 12px; border-radius: 7px; }
#notation-controls #nw-setup { margin: 12px 0 0; width: 100%; }
#notation-workspace { box-shadow: 0 2px 10px color-mix(in srgb, var(--header) 2%, transparent); border-color: var(--accent-soft); padding: 14px; }
.notation-focus { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; }
.notation-focus figure { border-color: var(--accent-soft); padding: 10px; background: var(--surface); }
.notation-focus figcaption { color: var(--accent); font-size: 12px; font-weight: 600; }
.notation-focus figure > div { height: clamp(240px, 34dvh, 380px); min-height: 180px; max-height: 70dvh; overflow: auto; resize: vertical; }
.notation-focus svg { height: 100%; min-height: 160px; }
#nw-layer-help { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 12px 0; }
#notation-workspace .rhythm-label { border-radius: 7px; padding: 5px 8px; font-size: 12px; }
#notation-workspace .rhythm-event { color: var(--accent); font-weight: 600; border-radius: 5px; }
.rhythm-delete-layer { min-height: 28px; padding: 4px 8px !important; color: var(--danger); }
.rhythm-grid { margin: 8px 0; border-color: var(--accent-soft); border-radius: 5px; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (min-width: 1700px) { :root { --editor-width: 390px; } }
@media (min-width: 801px) and (max-width: 1100px) { :root { --editor-width: 320px; } body.editing main { padding: 12px; } .notation-focus { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  body.editing main { margin-right: 0; padding: 12px 12px 52dvh; }
  body.editing .score-editor { top: auto; bottom: 80px; right: 8px; width: calc(100vw - 16px); max-height: 43dvh; }
  .notation-focus { grid-template-columns: 1fr; }
  .notation-focus figure > div { height: 230px; }
}

#notation-controls .notation-input-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#notation-controls .notation-input-options label { font-size: 11px; }
#notation-controls .notation-input-options button { font-size: 11px; }

/* Resize the complete score pane, including its frame and layout row. */
.notation-focus { align-items: start; }
.notation-focus figure { display: flex; flex-direction: column; height: clamp(280px, 38dvh, 420px); min-height: 190px; max-height: 70dvh; resize: vertical; overflow: hidden; }
.notation-focus figcaption { flex: none; }
.notation-focus figure > div { height: auto; min-height: 0; max-height: none; flex: 1; resize: none; overflow: hidden; }

.rhythm-ornaments { display:flex; gap:6px; flex-wrap:wrap; margin:8px 0; }
#notation-workspace .rhythm-ornament { color:var(--danger); background:var(--warning-soft); border-color:var(--warning); font-size:12px; }
#notation-workspace .rhythm-ornament.active { outline:2px solid var(--danger); background:var(--warning-soft); }

/* Settings is one centered workspace, with consistent cards and controls. */
#back { gap: 7px; font-size: 18px; }
.header-back-label { font-size: 13px; font-weight: 600; }
body:has(#panel:not([hidden])) > header { z-index: 22; }
#panel-backdrop { z-index: 18; bottom: var(--transport-h); background: color-mix(in srgb, var(--header) 33%, transparent); }
#panel { left: 50%; right: auto; top: 76px; bottom: calc(var(--transport-h) + 14px); width: min(1040px, calc(100vw - 32px)); max-height: none; padding: 0 20px 20px; border: 1px solid var(--accent-soft); border-radius: 16px; background: var(--accent-soft); box-shadow: 0 16px 60px color-mix(in srgb, var(--header) 19%, transparent); z-index: 19; transform: translateX(-50%); transition: transform .16s ease, opacity .16s ease, visibility .16s; scrollbar-gutter: stable; }
#panel[hidden] { transform: translate(-50%, 16px); opacity: 0; }
#panel > * { max-width: none; }
#panel-head { height: 76px; margin: 0 -20px 16px; padding: 12px 20px; justify-content: space-between; border-bottom: 1px solid var(--accent-soft); background: var(--accent-soft); border-radius: 16px 16px 0 0; z-index: 3; }
#panel-head strong { font-size: 18px; letter-spacing: -.3px; }
.settings-subtitle { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
#panel-head .grab { display: none; }
#panel-close { position: static; min-height: 36px; border-radius: 8px; background: var(--accent); color: var(--surface); border-color: var(--accent); }
.settings-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; align-items: start; }
.settings-card { min-width: 0; padding: 18px; border: 1px solid var(--accent-soft); border-radius: 12px; background: var(--surface); box-shadow: 0 2px 5px color-mix(in srgb, var(--header) 2%, transparent); }
#panel .settings-card h2 { margin: 0 0 14px; font-size: 15px; }
#panel .settings-card .hint { font-size: 12px; line-height: 1.5; color: var(--muted); }
#panel .settings-card button { font-size: 13px; border-radius: 8px; min-height: 38px; }
.settings-tools, .settings-sounds, .settings-export, .settings-manage { grid-column: 1 / -1; }
.settings-tool-buttons { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.settings-tool-buttons > button, #fix-link button { width: 100%; padding: 8px 12px; }
#fix-link { min-width: 0; }
#panel .controls { margin-top: 16px; gap: 18px; }
#panel .controls label { font-size: 13px; }
#panel .controls label > span { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
#panel .controls output { font-weight: 650; color: var(--accent); font-variant-numeric: tabular-nums; }
#panel input[type="range"] { accent-color: var(--accent); min-width: 0; }
#panel input[type="range"], #panel select { width: 100%; }
#panel .bars { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; }
#panel .bars input[type="number"] { width: 100%; min-width: 0; }
#panel .lines { gap: 7px; }
#panel .lines li { padding: 8px 10px; border-radius: 8px; font-size: 13px; }
#panel .lines .range, #panel .lines .include { font-size: 11px; }
#panel #start-markup { margin-bottom: 6px; }
#panel .settings-card > summary { font-size: 15px; font-weight: 650; min-height: 24px; cursor: pointer; }
#panel .settings-card[open] > summary { margin-bottom: 14px; }
#panel .voice-mix-row { grid-template-columns: minmax(120px,1fr) minmax(180px,1.5fr) minmax(120px,1.5fr) 48px; gap: 12px; padding: 12px 0; font-size: 13px; }
#panel .voice-mix-row button { min-height: 24px; font-size: 11px; }
#panel .settings-manage .bottom { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-top:14px; }
#panel .settings-manage .danger { margin-top: 0; margin-left: auto; }
#panel .report-link { font-size:12px; margin:20px 0 0; }
@media(max-width:700px) {
  #panel { top: 68px; bottom: calc(var(--transport-h) + 8px); width: calc(100vw - 16px); padding: 0 12px 14px; }
  #panel-head { margin: 0 -12px 12px; padding: 12px; height: 68px; }
  .settings-grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .settings-card { padding: 14px; }
  .settings-tool-buttons { grid-template-columns: 1fr; gap: 7px; }
  #panel .voice-mix-row { grid-template-columns: minmax(0,1fr) 48px; gap:8px; }
  #panel .voice-mix-row strong, #panel .voice-mix-row select { grid-column: 1 / -1; }
  #panel .voice-mix-row button { grid-column: 1 / -1; }
  #panel .bars { grid-template-columns: 1fr 1fr; }
  #panel .bars .check { grid-column: 1 / -1; }
}

#settings-tabs { position: sticky; top: 76px; z-index: 2; display: flex; gap: 6px; padding: 10px 0 14px; margin: -16px 0 0; background: var(--accent-soft); }
#settings-tabs button { flex: 1; min-width: 0; min-height: 38px; padding: 5px 10px; font-size: 13px; border-radius: 8px; background: transparent; }
#settings-tabs [aria-pressed="true"] { background: var(--surface); color: var(--accent); border-color: var(--accent); font-weight: 650; box-shadow: 0 2px 4px color-mix(in srgb, var(--header) 3%, transparent); }
#panel[data-settings-section="practice"] :is(.settings-sounds,.settings-export,.settings-manage),
#panel[data-settings-section="sounds"] :is(.settings-parts,.settings-playback,.settings-export,.settings-manage),
#panel[data-settings-section="files"] :is(.settings-parts,.settings-playback,.settings-sounds) { display: none; }
#settings-open-sounds { width: 100%; margin-top: 18px; color: var(--accent); }
@media(max-width:700px) { #settings-tabs { top: 68px; padding-bottom: 12px; margin-top: -12px; } #settings-tabs button { font-size: 12px; padding: 5px; } .settings-playback { grid-row: 2; } }
#panel .settings-card { margin: 0; }
@media(min-width:701px) {
  #panel .voice-mix-row { grid-template-columns: minmax(100px,1fr) minmax(150px,1.6fr) minmax(100px,1.3fr) 44px 130px; }
  #panel .voice-mix-row button { grid-column: auto; white-space: nowrap; }
}

header h1::after {
  display: none;
}
header h1 {
  font-size: 18px;
  letter-spacing: -0.4px;
}
.acm-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 3px;
}
#admin-link {
  margin-left: auto;
  font-size: 12px;
  color: var(--logo-light);
  text-decoration: none;
}
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 28px 0 12px;
  font-size: 12px;
  color: var(--muted);
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
#install-card,
.try-sample,
.footer-sample,
#intro-more {
  display: none !important;
}
#home .intro {
  display: none;
}
#home > .actions {
  margin-bottom: 16px;
}
#library-heading {
  margin-top: 8px;
  font-size: 24px;
}
#library-search {
  display: block;
  width: 100%;
  margin: 16px 0;
}
.library .name {
  color: var(--text);
}
body:not(.is-admin) [data-admin-only] {
  display: none !important;
}
body:not(.is-admin) #title-icon {
  display: none;
}
@media (max-width: 520px) {
  header h1 {
    font-size: 16px;
  }
  .acm-logo {
    width: 32px;
    height: 32px;
  }
  #admin-link {
    font-size: 11px;
  }
  .header-back-label {
    display: none;
  }
}

.admin-login {
  max-width: 420px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.admin-login label {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}
.admin-login input {
  width: 100%;
}
#admin-toolbar {
  align-items: center;
  flex-wrap: wrap;
}
#admin-version {
  margin-left: auto;
}
#publish-status {
  flex: 1 1 180px;
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Member login and access administration use the shared ACM palette. */
.membership-card { width: min(440px, calc(100% - 32px)); margin: 64px auto; padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.membership-card h2 { margin-top: 0; }
.membership-card button, .membership-login { margin: 8px 8px 8px 0; }
.membership-login { display: inline-block; padding: 12px 18px; border-radius: 8px; text-decoration: none; background: var(--accent); color: var(--surface); }
.membership-login[hidden] { display: none; }
#membership-error { color: var(--danger); }
.member-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--border); }
.member-row span { flex: 1 1 240px; overflow-wrap: anywhere; }
#member-profile { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; }
#member-profile[hidden] { display: none; }
#member-profile button { color: inherit; border-color: currentColor; background: transparent; min-height: 36px; }
@media (max-width: 560px) { #member-name { display: none; } .membership-card { margin: 32px auto; } }

.setup-part-row { border-left:5px solid var(--source-color); padding-left:12px; }
.setup-part-result { grid-column:1/-1; color:var(--muted); }

.page-load-status { position:absolute; top:12px; left:12px; right:12px; z-index:3; padding:12px; border:1px solid var(--border); border-radius:8px; background:var(--surface, #fff); color:var(--text, #182238); }
.page-load-status[hidden] { display:none; }
#nw-routing > label, #nw-routing > p { grid-column: 1 / -1; }

.personal-settings-reset { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 16px; }
.personal-settings-reset button { min-height: 36px; padding: 6px 10px; background: transparent; font-size: 13px; }
.personal-settings-reset .hint { margin: 0; font-size: 12px; }

.setup-source-controls { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:12px 0; }
.setup-source-controls select { width:auto; min-width:0; }
.setup-show-source { justify-self:start; font-size:13px; padding:6px 10px; background:transparent; }

.printed-parts-controls { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:12px 0; }
.printed-parts-controls label { display:flex; align-items:center; gap:6px; }
.printed-parts-controls select { width:auto; }
.printed-parts-grid { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(260px,1fr); align-items:start; gap:16px; }
.printed-part-row { display:grid; gap:6px; margin:0 0 12px; padding:10px; border:1px solid var(--border); border-radius:8px; }
.printed-part-row button { justify-self:start; padding:4px 8px; }
@media(max-width:700px) { .printed-parts-grid { grid-template-columns:1fr; } }

/* Printed staff rows must override the dialog's general flex labels. */
.score-setup .printed-part-row { display:grid; grid-template-columns:minmax(0,1fr) auto; min-width:0; border-left:5px solid var(--staff-color); background:color-mix(in srgb,var(--staff-color) 6%,white); }
.printed-part-row.is-active { outline:2px solid var(--staff-color); outline-offset:1px; }
.printed-part-heading { grid-column:1/-1; display:flex; flex-wrap:wrap; gap:6px 10px; }
.printed-part-heading span { white-space:nowrap; font-size:13px; }
.printed-part-heading span:first-child { background:var(--staff-color); color:white; border-radius:4px; padding:0 6px; font-weight:700; }
.printed-part-row select,.printed-part-row input { min-width:0; width:100%; box-sizing:border-box; }
.printed-part-row input { grid-column:1/-1; }
.printed-part-row button { white-space:nowrap; flex-shrink:0; width:auto; }
.printed-parts-grid > * { min-width:0; }
.printed-parts-grid { grid-template-columns:minmax(0,1.3fr) minmax(300px,1fr); }
#setup-parts-method { min-width:0; max-width:100%; }
@media(max-width:760px) { .printed-parts-grid { grid-template-columns:minmax(0,1fr); } }

.vocal-divisi,.divisi-unavailable { grid-column:1/-1; }
.vocal-divisi { margin:0; padding:8px 12px; border-left:2px solid var(--border); background:var(--surface); min-width:0; }
.vocal-divisi summary { cursor:pointer; color:var(--ink); font-size:13px; }
.divisi-mix-row { display:grid; grid-template-columns:minmax(110px,1fr) minmax(80px,1fr) 42px; align-items:center; gap:10px; padding:8px 0; }
.divisi-mix-row label { display:flex; gap:8px; align-items:center; margin:0; min-width:0; }
.divisi-mix-row input[type=range] { min-width:0; width:100%; }
.divisi-mix-row input[type=checkbox] { flex-shrink:0; }
.divisi-unavailable { font-size:12px; color:var(--muted); }
@media(max-width:440px) { .divisi-mix-row { grid-template-columns:minmax(0,1fr) 42px; } .divisi-mix-row label { grid-column:1/-1; } }

.lines li { flex-wrap:wrap; }
.lines .part-divisi-toggle { flex:none; min-width:34px; min-height:34px; padding:0 8px; background:var(--surface); color:var(--accent); }
.lines .part-divisi-choices { flex:0 0 100%; display:grid; gap:4px; padding-left:24px; box-sizing:border-box; border-left:2px solid var(--border); }
.lines .part-divisi-choices .pick { font-size:13px; font-weight:400; }
.lines .part-divisi-choices .pick:has(input:checked) { font-weight:650; color:var(--accent); }
