/* =========================================================================
   Jazzify MVP — design tokens and interface
   Tablet-first, stylus-first. Dark chrome, warm paper, brass accent.
   ========================================================================= */

@font-face {
  font-family: "Bravura";
  src: url("assets/Bravura.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}

:root {
  --font-ui: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-score: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-music: "Bravura", "Segoe UI Symbol", serif;

  --bg: #0b0d10;
  --bg-deep: #07090c;
  --chrome: #111419;
  --chrome-2: #171b22;
  --surface: #151920;
  --surface-2: #1a1f28;
  --surface-3: #222832;
  --surface-4: #2a313d;
  --line: #2a313a;
  --line-soft: rgba(239, 234, 223, 0.10);
  --line-strong: rgba(239, 234, 223, 0.22);

  --text: #f2efe8;
  --text-soft: #d8d3c8;
  --muted: #b5bac2;
  --muted-2: #9299a3;
  --dim: #7e8792;

  --brass: #e5b466;
  --brass-bright: #f2c97e;
  --brass-deep: #b9873f;
  --brass-ink: #1b1409;
  --blue: #7aa7ff;
  --blue-soft: rgba(122, 167, 255, 0.2);
  --amber: #efb35e;
  --amber-soft: rgba(239, 179, 94, 0.2);
  --green: #83c79c;
  --green-soft: rgba(131, 199, 156, 0.16);
  --red: #e58178;
  --red-soft: rgba(229, 129, 120, 0.15);
  --violet: #b69cff;

  --paper: #1b1d20;
  --paper-deep: #15171a;
  --paper-ink: #f2ede3;
  --paper-soft: #c9c2b6;
  --paper-muted: #a69d8f;
  --paper-line: #474e57;
  --paper-line-soft: rgba(242, 237, 227, 0.12);
  --paper-hover: rgba(255, 255, 255, 0.045);

  --stage-bg: #060708;
  --stage-chrome: #0d0f12;
  --stage-surface: #12151a;
  --stage-line: #2c3138;
  --stage-paper: #111418;
  --stage-paper-2: #0e1114;
  --stage-ink: #f5eedf;
  --stage-soft: #d8d2c6;
  --stage-muted: #a7a39b;
  --stage-line-strong: #4a525b;

  --shadow-1: 0 1px 2px rgba(0,0,0,.25);
  --shadow-2: 0 18px 45px rgba(0,0,0,.42), 0 2px 8px rgba(0,0,0,.35);
  --shadow-3: 0 30px 80px rgba(0,0,0,.6), 0 5px 18px rgba(0,0,0,.35);
  --shadow-paper: 0 1px 0 rgba(255,255,255,.05) inset, 0 28px 60px rgba(0,0,0,.48), 0 5px 16px rgba(0,0,0,.4);

  --r-xs: 4px;
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;

  --focus: #8db6ff;
  --ease: cubic-bezier(.2, .7, .25, 1);
  --dur-1: 150ms;
  --dur-2: 250ms;

  --appbar-h: 68px;
  --page-pad: clamp(16px, 2.2vw, 32px);
  --score-paper-w: 900px;
}

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

html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
body.is-locked { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
img, svg { max-width: 100%; }
::selection { background: rgba(229,180,102,.3); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.paper :focus-visible { outline-color: #a9782c; outline-offset: 1px; }
button:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 10000;
  padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--brass); color: var(--brass-ink);
  font-weight: 700; transform: translateY(-150%);
  transition: transform var(--dur-1) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; display: block; flex: 0 0 auto; fill: none; }
.brand-svg { width: 32px; height: 32px; display: block; fill: none; }
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.eyebrow--brass { color: var(--brass); }

/* -------------------------------------------------------------------------
   Buttons, chips, fields
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary {
  background: var(--brass);
  color: var(--brass-ink);
  border-color: var(--brass);
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset;
}
.btn-primary:hover { background: var(--brass-bright); border-color: var(--brass-bright); }
.btn-soft {
  background: var(--surface-2);
  color: var(--text-soft);
  border-color: var(--line);
}
.btn-soft:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--text); }
.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.btn-danger {
  background: var(--red-soft);
  color: #ffb0a8;
  border-color: rgba(229,129,120,.3);
}
.btn-danger:hover { background: rgba(229,129,120,.23); }
.btn-quiet {
  background: transparent;
  color: var(--muted);
  min-height: 34px;
  padding: 6px 10px;
}
.btn-quiet:hover { color: var(--text); background: var(--surface-2); }
.btn.is-disabled, .btn:disabled, .icon-btn:disabled {
  opacity: .38;
  cursor: not-allowed;
  transform: none;
}
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--text-soft);
  border: 1px solid transparent;
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--line-soft); }
.icon-btn.is-active { color: var(--brass-bright); background: rgba(229,180,102,.11); border-color: rgba(229,180,102,.24); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.is-disabled, .icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn--lg { width: 44px; height: 44px; }

.segmented {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.segmented button {
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--muted);
  transition: background var(--dur-1), color var(--dur-1);
}
.segmented button:hover { color: var(--text); background: var(--surface-3); }
.segmented button.is-active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }
.segmented--brass button.is-active { background: rgba(229,180,102,.16); color: var(--brass-bright); }

.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  transition: border-color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: rgba(141,182,255,.65);
  box-shadow: 0 0 0 3px rgba(141,182,255,.12);
  background: var(--surface-2);
}
.textarea { min-height: 96px; resize: vertical; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 12px; font-weight: 650; color: var(--muted); }
.field-hint { font-size: 11px; color: var(--muted-2); line-height: 1.45; }
.field-error { font-size: 12px; color: var(--red); line-height: 1.4; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.switch-row:last-child { border-bottom: 0; }
.switch-copy { display: grid; gap: 3px; }
.switch-copy strong { font-size: 14px; font-weight: 650; color: var(--text); }
.switch-copy span { font-size: 13px; color: var(--muted); line-height: 1.5; max-width: 46ch; }
.switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  transition: background var(--dur-2), border-color var(--dur-2);
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform var(--dur-2) var(--ease), background var(--dur-2);
}
.switch[aria-checked="true"] { background: rgba(229,180,102,.24); border-color: rgba(229,180,102,.55); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--brass-bright); }
.switch:hover { border-color: var(--brass-deep); }

/* -------------------------------------------------------------------------
   Boot / app shell / appbar
   ------------------------------------------------------------------------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--bg-deep);
  transition: opacity 350ms var(--ease), visibility 350ms;
}
.boot.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-mark {
  width: 62px; height: 62px;
  display: grid; place-items: center;
  color: var(--brass);
  border: 1px solid rgba(229,180,102,.24);
  border-radius: 18px;
  background: rgba(229,180,102,.05);
  margin-bottom: 6px;
}
.boot-mark .brand-svg { width: 42px; height: 42px; }
.boot-word { font-family: var(--font-display); font-size: 30px; letter-spacing: -.02em; color: var(--text); }
.boot-wordmark { display: block; height: 62px; width: auto; max-width: min(300px, 80vw); object-fit: contain; }
.boot-track { margin-top: 14px; width: 150px; height: 2px; background: var(--surface-3); overflow: hidden; border-radius: 99px; }
.boot-track span { display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--brass); animation: bootSlide 1s var(--ease) infinite; }
@keyframes bootSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(250%); } }

.app { min-height: 100dvh; display: flex; flex-direction: column; }
.appbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 30px);
  min-height: var(--appbar-h);
  padding: 10px var(--page-pad);
  background: rgba(11,13,16,.88);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(18px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-align: left;
  border-radius: var(--r-sm);
}
.brand-mark { color: var(--brass); display: grid; place-items: center; }
.brand-wrap { display: grid; gap: 1px; min-width: 0; }
.brand-word { font-family: var(--font-display); font-size: 22px; line-height: 1.05; letter-spacing: -.025em; }
.brand-wordmark { display: block; height: 38px; width: auto; max-width: 170px; object-fit: contain; }
.brand-tag { font-size: 9px; letter-spacing: .14em; color: var(--muted-2); text-transform: uppercase; white-space: nowrap; }
.brand:hover .brand-word { color: var(--brass-bright); }
.brand:hover .brand-wordmark { filter: brightness(1.1); }
html[data-theme="light"] .brand-wordmark { filter: brightness(.5) saturate(.9); }
.apptabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(21,25,32,.65);
}
.apptab {
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: color var(--dur-1), background var(--dur-1);
}
.apptab:hover { color: var(--text); }
.apptab.is-active {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}
.appbar-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.local-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(131,199,156,.16);
  background: rgba(131,199,156,.06);
  color: #a4ceb2;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .06em;
  white-space: nowrap;
}
.local-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(131,199,156,.09); }
.import-btn { min-height: 36px; }
#main { flex: 1 0 auto; min-height: 0; width: 100%; }
.view { width: 100%; min-height: calc(100dvh - var(--appbar-h)); }
.view[hidden] { display: none !important; }
.view.is-entering { animation: viewIn var(--dur-2) var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* -------------------------------------------------------------------------
   Library: master-detail
   ------------------------------------------------------------------------- */
.library-layout {
  display: grid;
  grid-template-columns: minmax(320px, 356px) minmax(0, 1fr);
  gap: clamp(14px, 1.6vw, 24px);
  width: 100%;
  max-width: 1660px;
  margin: 0 auto;
  padding: clamp(12px, 1.6vw, 22px) var(--page-pad) clamp(18px, 2vw, 28px);
  min-height: calc(100dvh - var(--appbar-h));
  align-items: stretch;
}
.library-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line-soft);
  padding-right: clamp(8px, 1.2vw, 18px);
}
.pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 2px 16px;
}
.pane-head h1 {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.025em;
}
.pane-head .icon-btn { margin-top: 3px; border: 1px solid var(--line); background: var(--surface); }
.pane-head .icon-btn:hover { border-color: var(--brass-deep); color: var(--brass-bright); }
.library-tools { display: grid; gap: 10px; padding-bottom: 12px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box .icon {
  position: absolute;
  left: 12px;
  color: var(--muted-2);
  pointer-events: none;
  width: 18px; height: 18px;
}
.search-box .input { min-height: 42px; padding-left: 38px; padding-right: 46px; background: #0f1216; }
.search-kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  display: inline-grid; place-items: center;
  width: 23px; height: 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted-2);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  pointer-events: none;
}
.library-subtools { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.filter-chips { display: flex; align-items: center; gap: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 29px; padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .01em;
  border: 1px solid transparent;
  transition: color var(--dur-1), background var(--dur-1), border-color var(--dur-1);
}
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.is-active { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.chip .count { color: var(--muted-2); font-variant-numeric: tabular-nums; font-size: 10px; }
.sort-select {
  width: auto;
  min-height: 29px;
  padding: 0 25px 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background-color: transparent;
  border-color: transparent;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 12px, calc(100% - 8px) 12px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.sort-select:hover { color: var(--text); border-color: var(--line); }
.song-list-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 6px; margin-right: -6px; padding-right: 6px; }
.song-list { display: grid; gap: 1px; }
.song-item { display: flex; align-items: stretch; min-width: 0; border-radius: var(--r-sm); position: relative; }
.song-item + .song-item { border-top: 1px solid rgba(255,255,255,.035); }
.song-item.is-selected { background: var(--surface); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.song-item.is-selected::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px;
  background: var(--brass); border-radius: 99px;
}
.song-row-btn {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  text-align: left;
  padding: 11px 8px 11px 12px;
  border-radius: var(--r-sm);
}
.song-row-btn:hover { background: rgba(255,255,255,.027); }
.song-item.is-selected .song-row-btn:hover { background: transparent; }
.key-badge {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1;
  letter-spacing: -.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.song-item.is-selected .key-badge { color: var(--brass-bright); border-color: rgba(229,180,102,.35); background: rgba(229,180,102,.075); }
.song-main { min-width: 0; display: grid; gap: 2px; }
.song-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -.005em;
}
.song-item.is-selected .song-title { color: var(--text); }
.song-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted-2);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}
.song-sub .sep { opacity: .5; }
.song-sub .truncate { overflow: hidden; text-overflow: ellipsis; }
.song-bpm {
  color: var(--muted-2);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  letter-spacing: .01em;
}
.song-bpm strong { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.song-fav {
  flex: 0 0 auto;
  align-self: center;
  width: 32px; height: 34px;
  display: grid; place-items: center;
  color: var(--dim);
  border-radius: var(--r-sm);
}
.song-fav .icon { width: 16px; height: 16px; }
.song-fav:hover { color: var(--brass); background: rgba(229,180,102,.06); }
.song-fav.is-fav { color: var(--brass); }
.song-fav.is-fav .icon { fill: currentColor; }
.song-more { display: none; flex: 0 0 auto; align-self: center; width: 36px; height: 34px; place-items: center; color: var(--dim); border-radius: var(--r-sm); }
.song-more .icon { width: 16px; height: 16px; }
.song-more:hover { color: var(--brass); background: rgba(229,180,102,.06); }
.empty-list {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 30px 12px;
  color: var(--muted);
}
.empty-list .empty-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 13px; color: var(--muted-2); margin-bottom: 2px; }
.empty-list strong { color: var(--text-soft); font-size: 14px; }
.empty-list p { font-size: 12px; max-width: 30ch; line-height: 1.5; color: var(--muted-2); }
.library-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 2px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--dim);
  font-size: 10px;
  letter-spacing: .04em;
}
.library-foot .meta-dot { color: var(--muted-2); }

/* preview */
.preview-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.preview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 14px;
}
.preview-heading { min-width: 0; padding-top: 2px; }
.preview-heading .kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.preview-heading h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 2.1vw, 32px);
  line-height: 1.08;
  letter-spacing: -.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-heading p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.preview-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; padding-top: 3px; }
.preview-stage {
  flex: 1 1 auto; min-height: 0;
  overflow: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background:
    radial-gradient(100% 80% at 50% 0%, rgba(229,180,102,.035), transparent 60%),
    #0d1014;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 2vw, 28px);
  position: relative;
}
.preview-stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.3), transparent 65%);
  pointer-events: none;
  opacity: .4;
}
.preview-paper-wrap {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  margin: auto;
  transform-origin: top center;
}
.page-shadow { position: relative; }

.paper-scale-box { position: relative; flex: 0 0 auto; }
.paper-scale-box > .paper { position: absolute; top: 0; left: 0; }
.system-body { min-width: 0; }
.nowrap { white-space: nowrap; }
.score-empty { padding: 50px 0; color: var(--paper-muted); font-size: 14px; text-align: center; }
.form-stack { display: grid; gap: 13px; }
.sheet-action-row {
  width: 100%;
  min-height: 44px;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--text-soft);
  font-size: 13px;
  text-align: left;
}
.sheet-action-row .icon { width: 18px; height: 18px; color: var(--muted); }
.sheet-action-row:hover { background: var(--surface-2); color: var(--text); }
.sheet-action-row:hover .icon { color: var(--brass); }
.sheet-action-row--danger { color: var(--red); }
.sheet-action-row--danger .icon { color: var(--red); }
.sheet-action-row--danger:hover { background: var(--red-soft); color: #ffc0b9; }
.library-empty-hero {
  position: relative; z-index: 1;
  display: grid; justify-items: center; gap: 8px;
  padding: 36px; max-width: 440px; margin: auto;
  text-align: center;
}
.library-empty-hero .empty-note {
  width: 62px; height: 62px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 18px;
  color: var(--brass); background: rgba(229,180,102,.05); margin-bottom: 8px;
}
.library-empty-hero .empty-note .icon { width: 27px; height: 27px; }
.library-empty-hero h3 { font-family: var(--font-display); font-size: 27px; font-weight: 400; letter-spacing: -.03em; color: var(--text-soft); }
.library-empty-hero p { max-width: 36ch; color: var(--muted); font-size: 12px; line-height: 1.55; }
.library-empty-hero .btn { margin-top: 7px; }
.note-rest {
  position: absolute; width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--paper-ink); transform: translate(-11px, -11px);
  z-index: 3;
}
.note-rest .icon { width: 15px; height: 15px; }
.fatal-error { position: fixed; inset: 0; z-index: 10002; display: grid; place-content: center; gap: 8px; padding: 30px; background: var(--bg); color: var(--text); }
.fatal-error h2 { font-family: var(--font-display); font-size: 30px; font-weight: 400; }
.fatal-error p { max-width: 60ch; color: var(--muted); font-size: 13px; }
@media (min-width: 681px) {
  .appbar { display: grid; grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr); }
  .appbar-tools { justify-self: end; }
  .apptabs { justify-self: center; }
}

.preview-help {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 0 2px;
  color: var(--dim);
  font-size: 10px;
}
.preview-help .kbd {
  display: inline-flex; align-items: center; gap: 3px; justify-content: center;
  padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px; color: var(--muted-2);
}

/* -------------------------------------------------------------------------
   Paper / score
   ------------------------------------------------------------------------- */
.paper {
  --paper-width: 900px;
  --paper-head-ink: var(--paper-ink);
  --score-line: var(--paper-line);
  position: relative;
  width: var(--paper-width);
  min-height: 1120px;
  padding: 50px 54px 28px;
  color: var(--paper-ink);
  background: var(--paper);
  border-radius: 3px;
  box-shadow: var(--shadow-paper);
  transform-origin: top left;
  isolation: isolate;
}
.paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  box-shadow: inset 0 0 0 1px rgba(32,31,27,.07), inset 0 1px 0 rgba(255,255,255,.6);
  border-radius: inherit;
}
.paper--preview { width: 760px; min-height: 0; padding: 38px 42px 24px; }
.paper--preview .score-title { font-size: 33px; }
.paper--preview .system { padding: 14px 0 12px; }
.paper--preview .bar { min-height: 76px; }
.paper--preview .chord-btn { font-size: 15px; }
.paper--editor { min-height: 1160px; }
.stage-page-wrap { position: relative; flex: 0 0 auto; }
.stage-page-wrap > .paper { position: absolute; top: 0; left: 0; transform-origin: top left; }
.paper--stage { min-height: 0; }
.paper--stage .chord-btn { font-size: 20px; }
.paper--stage.stage-font-small .chord-btn { font-size: 16px; }
.paper--stage.stage-font-large .chord-btn { font-size: 23px; }
.paper--stage.stage-font-large .score-title { font-size: 42px; }
.paper--stage.stage-font-small .score-title { font-size: 32px; }
.paper--stage .bar { min-height: 92px; }
.stage-wake[hidden] { display: none; }
.mobile-back { display: none; }
.setlist-tag--none { background: transparent; border: 1px solid var(--line-strong); }
.setlist-tag--none::after { display: none; }
.setlist-add-row {
  width: 100%;
  min-height: 46px;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
}
.setlist-add-row:hover { color: var(--brass-bright); border-color: rgba(229,180,102,.35); background: rgba(229,180,102,.04); }
.setlist-add-row .icon { width: 16px; height: 16px; }
.transpose-offset { color: var(--brass); }
.picker-row .picker-text { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.picker-row .picker-text strong { font-size: 12px; font-weight: 650; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-row .picker-text > span { font-size: 10px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-drop-inner { display: grid; justify-items: center; gap: 7px; }
.import-drop-inner .icon { width: 29px; height: 29px; color: var(--brass); }
.import-drop.is-dragover { border-color: var(--brass); background: rgba(229,180,102,.08); }
.import-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.sample-icon { display: grid; place-items: center; color: var(--brass); }
.sample-icon .icon { width: 17px; height: 17px; }
.scene-song-sub .setlist-tag { width: 7px; height: 7px; border: 0; margin-right: 2px; }
.scene-song-sub .setlist-tag::after { inset: 0; }

.ink-selection-toolbar.is-floating { position: fixed; z-index: 12000; }
.input-hint { color: var(--dim); font-size: 9px; white-space: nowrap; }
.editor-page-label { color: var(--muted-2); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.page-nav { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.page-nav .status-page { width: 29px; height: 29px; justify-content: center; border-radius: 5px; color: var(--text-soft); }
.page-nav .status-page .icon { width: 16px; height: 16px; }
.page-nav .editor-page-label { min-width: 66px; text-align: center; font-size: 11px; font-weight: 650; color: var(--text-soft); letter-spacing: 0; }
.status-page .icon { width: 13px; height: 13px; }
.score-stage.is-note-mode .staff-notes { cursor: text; }
.score-stage.is-note-mode .paper { cursor: text; }
.editor-save { color: var(--muted-2); }
@media (max-width: 980px) { .transpose-label { display: none; } }
@media (max-width: 860px) { .input-hint { display: none; } }
@media (max-width: 680px) {
  .editor-page-label { font-size: 8px; }
  .editor-statusbar .right .sep { display: none; }
  .editor-statusbar .right { gap: 4px; }
  .editor-statusbar .editor-save span:last-child { display: none; }
}

.paper--preview .score-head { padding-bottom: 18px; margin-bottom: 6px; }
.paper--preview .score-systems { gap: 0; }
.paper--stage {
  --paper-ink: var(--stage-ink);
  --paper-soft: var(--stage-soft);
  --paper-muted: var(--stage-muted);
  --score-line: var(--stage-line-strong);
  --paper-line: var(--stage-line);
  --paper-hover: rgba(255,255,255,.035);
  background: var(--stage-paper);
  box-shadow: 0 35px 80px rgba(0,0,0,.65);
  width: 900px;
  min-height: 1160px;
}
.paper--stage::after { box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.paper--stage .chord-btn { color: var(--stage-ink); }
.paper--stage .score-key { color: var(--brass-bright); border-color: rgba(229,180,102,.35); background: rgba(229,180,102,.08); }
.paper--stage .bar:hover { background: transparent; }
.paper--stage .bar-menu-btn { display: none; }
.paper--stage .bar-no { color: var(--stage-muted); }
.paper--stage .score-foot { color: var(--stage-muted); border-color: rgba(255,255,255,.09); }
.paper--stage .staff-line { background: rgba(255,255,255,.24); }
.paper--stage .rehearsal { color: var(--brass-bright); border-color: rgba(229,180,102,.4); }

.score-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(32,31,27,.16);
  margin-bottom: 4px;
}
.score-heading { min-width: 0; padding-top: 2px; }
.score-kicker {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 7px;
  color: var(--paper-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.score-kicker .rule { width: 18px; height: 1px; background: var(--gold, #a9772f); display: inline-block; opacity: .7; }
.score-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 2.8vw, 40px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.03em;
  color: var(--paper-ink);
  overflow-wrap: anywhere;
}
.score-composer { margin-top: 6px; font-size: 12px; color: var(--paper-muted); letter-spacing: .015em; }
.score-meta {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 0 0 auto;
  padding-top: 5px;
}
.score-key {
  display: grid;
  place-items: center;
  min-width: 52px;
  min-height: 48px;
  padding: 4px 8px;
  border: 1px solid rgba(32,31,27,.25);
  border-radius: 5px;
  color: var(--paper-ink);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  letter-spacing: -.03em;
}
.score-tempo { display: grid; gap: 3px; padding-top: 2px; font-size: 10px; color: var(--paper-muted); line-height: 1.25; }
.score-tempo strong { display: block; color: var(--paper-ink); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.score-tempo .bar-count { margin-top: 2px; color: var(--paper-muted); font-size: 9px; letter-spacing: .03em; }
.score-systems { display: grid; gap: 0; padding-top: 4px; }
.system {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 4px;
  padding: 18px 0 14px;
  border-bottom: 1px solid rgba(32,31,27,.065);
  page-break-inside: avoid;
}
.system:last-child { border-bottom: 0; }
.system-gutter { position: relative; }
.staff-wrap { position: relative; height: 88px; min-width: 0; }
.staff-lines { position: absolute; left: 0; right: 0; top: 15px; height: 44px; pointer-events: none; }
.staff-barlines { position: absolute; left: 0; right: 0; top: 15px; height: 44px; z-index: 1; pointer-events: none; }
.staff-barlines span { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--score-line); opacity: .58; }
.paper--stage .staff-barlines span { background: rgba(255,255,255,.3); }

.staff-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--score-line); opacity: .72; }
.staff-line:nth-child(1) { top: 0; }
.staff-line:nth-child(2) { top: 11px; }
.staff-line:nth-child(3) { top: 22px; }
.staff-line:nth-child(4) { top: 33px; }
.staff-line:nth-child(5) { top: 44px; }
.staff-clef {
  position: absolute;
  left: -1px;
  top: -4px;
  width: 28px;
  height: 64px;
  font-family: var(--font-music);
  font-size: 66px;
  line-height: 1;
  color: var(--paper-ink);
  opacity: .92;
  z-index: 2;
  pointer-events: none;
}
.staff-timesig {
  position: absolute;
  left: 0;
  top: 23px;
  display: grid;
  gap: 1px;
  color: var(--paper-ink);
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1;
  text-align: center;
  width: 17px;
}
.staff-placeholder {
  position: absolute;
  left: 44%;
  top: 31px;
  color: var(--paper-muted);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .7;
  pointer-events: none;
  white-space: nowrap;
}
.bar-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--score-line);
  border-bottom: 1px solid rgba(32,31,27,.1);
}
.bar {
  position: relative;
  min-height: 88px;
  padding: 0;
  border-right: 1px solid var(--score-line);
  transition: background var(--dur-1);
}
.bar:first-child { border-left: 1px solid var(--score-line); }
.bar:hover { background: var(--paper-hover); }
.bar.is-selected { background: rgba(229,180,102,.1); }
.bar-add {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  z-index: 0;
}
.bar-add-hint {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--paper-muted);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity var(--dur-1);
  pointer-events: none;
  white-space: nowrap;
}
.bar:hover .bar-add-hint { opacity: .7; }
.bar.is-empty .bar-add-hint { opacity: .5; }
.chord-slots {
  position: absolute;
  left: 12px;
  right: 10px;
  top: 17px;
  bottom: 25px;
  display: grid;
  grid-template-columns: repeat(var(--beats, 4), minmax(0, 1fr));
  align-items: start;
  align-content: start;
  column-gap: 2px;
  row-gap: 0;
  z-index: 2;
  pointer-events: none;
}
.bar.has-cue-above .chord-slots { top: 31px; }
.chord-btn {
  position: relative;
  justify-self: start;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  max-width: 100%;
  padding: 2px 4px 3px;
  margin: 0;
  border-radius: 4px;
  color: var(--paper-ink);
  font-family: var(--font-score);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -.035em;
  white-space: nowrap;
  text-align: left;
  pointer-events: auto;
  transition: background var(--dur-1), color var(--dur-1), box-shadow var(--dur-1);
}
.chord-btn:hover { background: rgba(64, 52, 30, .09); box-shadow: 0 0 0 1px rgba(64,52,30,.09); }
.chord-btn:active { transform: translateY(.5px); }
.chord-btn .chord-alt { color: var(--paper-muted); font-size: .62em; font-weight: 500; letter-spacing: 0; }
.chord-btn .chord-paren { color: var(--paper-muted); }
.chord-btn--dim { color: var(--paper-soft); }
.chord-btn--free { position: absolute !important; top: 0 !important; z-index: 2; }
.chord-bass-select { width: 100%; min-width: 0; }
@media (max-width: 680px) { .field-grid { grid-template-columns: 1fr; } }
.bar[data-chords="3"] .chord-btn, .bar[data-chords="4"] .chord-btn { font-size: 15px; }
.bar[data-chords="4"] .chord-slots { row-gap: 0; }
.bar-cue {
  position: absolute;
  left: 12px;
  right: 10px;
  z-index: 3;
  color: var(--paper-soft);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.bar-cue--above { top: 7px; }
.bar-cue--below { bottom: 6px; }
.bar-cue--s { font-size: 9.5px; }
.bar-cue--m { font-size: 11px; }
.bar-cue--l { font-size: 13px; }
.bar-cue--c-red { color: #a6483d; }
.bar-cue--c-blue { color: #315f9f; }
.bar-cue--c-green { color: #39754f; }
.bar-cue--c-amber { color: #93671f; }
.bar--percent .percent-mark {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--paper-soft);
  font-family: var(--font-display);
  font-size: 28px;
  opacity: .8;
  z-index: 2;
}
.bar--rest .rest-mark {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%,-50%);
  width: 19px; height: 5px; border-radius: 1px; background: var(--paper-soft); opacity: .65; z-index: 2;
}
.bar--rest .bar-add-hint { display: none; }
.bar-no {
  position: absolute;
  right: 6px;
  top: 4px;
  z-index: 4;
  color: var(--paper-muted);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  opacity: .65;
  pointer-events: none;
}
.rehearsal {
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: grid;
  place-items: center;
  width: 20px;
  height: 19px;
  border: 1px solid rgba(32,31,27,.35);
  border-radius: 3px;
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 11px;
  line-height: 1;
  color: var(--paper-ink);
  pointer-events: none;
}
.volta {
  position: absolute;
  top: -1px;
  left: -1px;
  right: 2px;
  height: 12px;
  border-top: 1px solid var(--paper-soft);
  border-left: 1px solid var(--paper-soft);
  pointer-events: none;
  z-index: 4;
}
.volta span {
  position: absolute;
  top: 1px;
  left: 5px;
  background: var(--paper);
  padding: 0 3px;
  color: var(--paper-soft);
  font-family: var(--font-display);
  font-size: 9px;
  line-height: 1;
}
.bar-repeat-start, .bar-repeat-end {
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: 8px;
  z-index: 4;
  pointer-events: none;
}
.bar-repeat-start { left: 1px; border-left: 2px solid var(--paper-soft); }
.bar-repeat-start::before { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 1px; background: var(--paper-soft); }
.bar-repeat-start::after { content: ""; position: absolute; left: 6px; top: 35%; width: 2px; height: 2px; border-radius: 50%; background: var(--paper-soft); box-shadow: 0 6px 0 var(--paper-soft); }
.bar-repeat-end { right: 1px; border-right: 2px solid var(--paper-soft); }
.bar-repeat-end::before { content: ""; position: absolute; right: 3px; top: 0; bottom: 0; width: 1px; background: var(--paper-soft); }
.bar-repeat-end::after { content: ""; position: absolute; right: 6px; top: 35%; width: 2px; height: 2px; border-radius: 50%; background: var(--paper-soft); box-shadow: 0 6px 0 var(--paper-soft); }
.bar-menu-btn {
  position: absolute;
  right: 1px;
  bottom: 2px;
  z-index: 6;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--paper-muted);
  opacity: .4;
  transition: opacity var(--dur-1), background var(--dur-1), color var(--dur-1);
}
.bar-menu-btn .icon { width: 22px; height: 22px; }
.bar:hover .bar-menu-btn, .bar:focus-within .bar-menu-btn { opacity: .82; }
.bar-menu-btn:hover { opacity: 1; color: var(--paper-ink); background: rgba(32,31,27,.1); }

/* melody */
.staff-notes { position: absolute; inset: 0; z-index: 3; }
.staff-notes.is-empty .staff-placeholder { display: block; }
.staff-placeholder { display: none; }
.note-btn {
  position: absolute;
  display: block;
  width: 26px;
  height: 30px;
  border-radius: 6px;
  color: var(--paper-ink);
  transform: translate(-13px, -14px);
  z-index: 3;
  touch-action: manipulation;
}
.note-btn:hover { background: rgba(64,52,30,.08); }
.note-btn.is-selected { background: rgba(239,179,94,.24); box-shadow: 0 0 0 1.5px rgba(183,122,34,.65); color: #713f05; }
.note-svg { width: 26px; height: 30px; overflow: visible; display: block; }
.note-head { fill: currentColor; }
.note-head--open { fill: var(--paper); stroke: currentColor; stroke-width: 1.4; }
.note-stem { stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; }
.note-flag { fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; }
.note-dot { fill: currentColor; }
.note-accidental { position: absolute; left: -5px; top: 8px; font-family: var(--font-music); font-size: 16px; line-height: 1; color: var(--paper-ink); pointer-events: none; }
.note-tie { position: absolute; height: 8px; z-index: 2; color: var(--paper-soft); pointer-events: none; }
.beam { position: absolute; height: 2.2px; background: var(--paper-ink); border-radius: 1px; z-index: 2; pointer-events: none; transform-origin: left center; }
.note-cursor {
  position: absolute;
  width: 2px;
  top: 20px;
  height: 53px;
  background: var(--blue);
  border-radius: 99px;
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(122,167,255,.1);
  animation: caretBlink 1.15s steps(2, jump-none) infinite;
}
@keyframes caretBlink { 0%, 45% { opacity: 1; } 55%, 100% { opacity: .25; } }
.staff-voice-label {
  position: absolute; left: 0; top: 70px;
  font-size: 8px; color: var(--paper-muted); letter-spacing: .08em; text-transform: uppercase;
  pointer-events: none;
}
.ink-canvas { position: absolute; inset: 0; z-index: 20; width: 100%; height: 100%; pointer-events: none; }
.paper-tools-corner { position: absolute; right: 16px; bottom: 13px; display: flex; gap: 4px; z-index: 25; }
.paper-tools-corner button { color: var(--paper-muted); }
.score-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 9px;
  border-top: 1px solid rgba(32,31,27,.1);
  color: var(--paper-muted);
  font-size: 9px;
  letter-spacing: .03em;
}
.score-foot .page-mark { font-variant-numeric: tabular-nums; }
.score-foot .jz { letter-spacing: .12em; font-weight: 650; color: var(--paper-soft); }
.score-foot .page-mark { color: var(--paper-muted); }
.score-error {
  padding: 24px;
  border: 1px solid #c9bcaa;
  background: #f2e9da;
  color: #3a3329;
  font-size: 13px;
  line-height: 1.5;
}

/* ink / lasso UI overlays */
.lasso-rect {
  position: absolute;
  border: 1.2px dashed #2b65c2;
  background: rgba(43,101,194,.07);
  z-index: 22;
  pointer-events: none;
}
.ink-selection-toolbar {
  position: absolute;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 9px;
  background: #1b2028;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2);
}
.ink-selection-toolbar button {
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px;
}
.ink-selection-toolbar button:hover { background: var(--surface-3); color: var(--text); }
.ink-selection-toolbar button.is-danger:hover { background: var(--red-soft); color: #ffb0a8; }
.ink-selection-toolbar .icon { width: 15px; height: 15px; }
.ink-eraser-cursor {
  position: fixed;
  z-index: 1000;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(32,31,27,.55);
  background: rgba(255,255,255,.15);
  pointer-events: none;
  transform: translate(-50%,-50%);
  mix-blend-mode: multiply;
}

/* -------------------------------------------------------------------------
   Editor
   ------------------------------------------------------------------------- */
.app.is-editor .appbar { display: none; }
.app.is-editor .editor-view { min-height: 100dvh; }
.editor-view { padding: 0; }
.editor-shell {
  height: 100dvh;
  min-height: 580px;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  overflow: hidden;
}
.editor-top {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 8px clamp(14px, 1.8vw, 24px);
  background: var(--chrome);
  border-bottom: 1px solid var(--line-soft);
  z-index: 20;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  flex: 0 0 auto;
}
.back-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--line-soft); }
.back-btn .icon { width: 18px; height: 18px; }
.editor-identity {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 11px;
  flex: 1 1 auto;
}
.editor-identity .eyebrow { white-space: nowrap; flex: 0 0 auto; }
.editor-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: clamp(18px, 1.55vw, 23px);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -.02em;
  color: var(--text);
}
.editor-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.undo-group { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.undo-group .icon-btn { width: 35px; height: 34px; border: 0; border-radius: 0; }
.undo-group .icon-btn + .icon-btn { border-left: 1px solid var(--line-soft); }
.undo-group .icon-btn:hover { background: var(--surface-2); }
.transpose-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}
.transpose-btn .score-key-mini {
  display: inline-grid; place-items: center;
  min-width: 25px; height: 24px;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid rgba(229,180,102,.24);
  background: rgba(229,180,102,.075);
  color: var(--brass-bright);
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1;
}
.transpose-btn .icon { width: 15px; height: 15px; color: var(--muted); }
.transpose-btn:hover { border-color: var(--brass-deep); color: var(--text); }
.editor-save { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted-2); white-space: nowrap; padding: 0 2px; }
.editor-save .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.editor-save.is-saving .dot { background: var(--brass); animation: pulseDot 1s infinite; }
@keyframes pulseDot { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

.editor-ribbon {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px clamp(12px, 1.6vw, 22px);
  background: #0e1115;
  border-bottom: 1px solid var(--line-soft);
  min-height: 51px;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 19;
  flex: 0 0 auto;
}
.editor-ribbon::-webkit-scrollbar { display: none; }
.ribbon-group { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.ribbon-label { font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-right: 3px; white-space: nowrap; }
.ribbon-divider { width: 1px; align-self: stretch; margin: 5px 4px; background: var(--line-soft); flex: 0 0 auto; }
.ribbon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 33px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}
.ribbon-btn .icon { width: 17px; height: 17px; }
.ribbon-btn:hover { color: var(--text); background: var(--surface-2); }
.ribbon-btn.is-active { color: var(--brass-bright); background: rgba(229,180,102,.09); border-color: rgba(229,180,102,.2); }
.ribbon-btn.is-ink-tool.is-active { color: #f6d79d; }
.ribbon-icon-btn { width: 33px; height: 33px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--muted); }
.ribbon-icon-btn .icon { width: 17px; height: 17px; }
.ribbon-icon-btn:hover { color: var(--text); background: var(--surface-2); }
.ribbon-icon-btn.is-active { color: var(--brass-bright); background: rgba(229,180,102,.1); }
.color-well { display: flex; align-items: center; gap: 4px; padding: 0 3px; }
.color-dot {
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  background-clip: padding-box;
  position: relative;
  transition: transform var(--dur-1), border-color var(--dur-1);
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.is-active { border-color: var(--text); box-shadow: 0 0 0 2px rgba(255,255,255,.1); }
.size-well { display: flex; align-items: center; gap: 4px; padding: 0 3px; }
.size-dot {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--muted-2);
  border: 1px solid transparent;
}
.size-dot span { display: block; border-radius: 50%; background: currentColor; }
.size-dot:nth-child(1) span { width: 3px; height: 3px; }
.size-dot:nth-child(2) span { width: 6px; height: 6px; }
.size-dot:nth-child(3) span { width: 9px; height: 9px; }
.size-dot:hover { color: var(--text); background: var(--surface-2); }
.size-dot.is-active { color: var(--brass-bright); border-color: rgba(229,180,102,.25); background: rgba(229,180,102,.08); }
.finger-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 4px 8px;
  border-radius: 6px; color: var(--muted); font-size: 10px; white-space: nowrap;
  border: 1px solid transparent;
}
.finger-toggle .icon { width: 16px; height: 16px; }
.finger-toggle:hover { background: var(--surface-2); color: var(--text); }
.finger-toggle[aria-pressed="true"] { color: var(--brass-bright); background: rgba(229,180,102,.08); border-color: rgba(229,180,102,.18); }
.finger-toggle .switch-mini { width: 24px; height: 14px; border-radius: 99px; background: var(--surface-4); position: relative; border: 1px solid var(--line-strong); }
.finger-toggle .switch-mini::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); top: 2px; left: 2px; transition: transform var(--dur-2), background var(--dur-2); }
.finger-toggle[aria-pressed="true"] .switch-mini { background: rgba(229,180,102,.24); border-color: rgba(229,180,102,.45); }
.finger-toggle[aria-pressed="true"] .switch-mini::after { transform: translateX(10px); background: var(--brass-bright); }

.editor-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  background: var(--bg-deep);
  position: relative;
}
.notation-rail {
  flex: 0 0 70px;
  width: 70px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 10px 6px;
  background: #0f1216;
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
  scrollbar-width: none;
  z-index: 10;
}
.notation-rail::-webkit-scrollbar { display: none; }
.rail-label { font-size: 8px; line-height: 1.2; letter-spacing: .11em; color: var(--dim); text-transform: uppercase; text-align: center; margin: 4px 0 5px; }
.rail-sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.duration-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  height: 43px;
  border-radius: 6px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: color var(--dur-1), background var(--dur-1), border-color var(--dur-1);
}
.duration-btn svg { width: 23px; height: 21px; display: block; }
.duration-btn span { font-size: 8px; line-height: 1; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.duration-btn:hover { color: var(--text); background: var(--surface-2); }
.duration-btn.is-active { color: var(--brass-bright); background: rgba(229,180,102,.09); border-color: rgba(229,180,102,.22); }
.duration-btn.is-active span { color: var(--brass); }
.rail-mini-btn {
  height: 31px; display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  border-radius: 5px; color: var(--muted); border: 1px solid transparent;
  font-size: 9px; font-weight: 600;
}
.rail-mini-btn .icon { width: 14px; height: 14px; }
.rail-mini-btn:hover { background: var(--surface-2); color: var(--text); }
.rail-mini-btn.is-active { color: var(--brass-bright); background: rgba(229,180,102,.09); border-color: rgba(229,180,102,.18); }
.rail-note-toggle {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 46px; padding: 5px 2px;
  border-radius: 7px; border: 1px solid var(--line);
  color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .03em; text-align: center;
}
.rail-note-toggle .icon { width: 17px; height: 17px; }
.rail-note-toggle:hover { border-color: var(--line-strong); color: var(--text); }
.rail-note-toggle[aria-pressed="true"] { color: var(--blue); border-color: rgba(122,167,255,.4); background: rgba(122,167,255,.1); }
.rail-mode-group { display: grid; gap: 3px; }
.rail-mode-btn { min-height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 7px; border: 1px solid var(--line-soft); color: var(--muted); font-size: 8px; font-weight: 700; }
.rail-mode-btn .icon { width: 16px; height: 16px; }
.rail-mode-btn:hover { color: var(--text); border-color: var(--line-strong); }
.rail-mode-btn.is-active { color: var(--blue); border-color: rgba(122,167,255,.4); background: rgba(122,167,255,.1); }
.rail-grid-group { display: grid; gap: 3px; margin-top: 3px; }
.rail-grid-toggle { display: grid; grid-template-columns: 1fr; gap: 2px; }
.rail-grid-toggle button { font-size: 8px; padding: 5px 2px; border-radius: 5px; color: var(--muted-2); border: 1px solid transparent; }
.rail-grid-toggle button:hover { color: var(--text); }
.rail-grid-toggle button.is-active { color: var(--brass-bright); border-color: rgba(229,180,102,.22); background: rgba(229,180,102,.08); }

.score-stage {
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: auto;
  padding: 30px clamp(18px, 3vw, 55px) 45px;
  scrollbar-color: var(--surface-3) transparent;
  overscroll-behavior: contain;
}
.score-stage::before {
  content: "";
  position: fixed;
  inset: var(--appbar-h) 0 0 0;
  pointer-events: none;
  background: radial-gradient(60% 55% at 55% 0%, rgba(229,180,102,.045), transparent 70%);
}
.score-scale-box {
  position: relative;
  margin: 0 auto;
  transform-origin: top center;
  will-change: width, height;
}
.score-scale-box .paper { position: absolute; top: 0; left: 0; }
.page-nav-float {
  position: sticky;
  bottom: 14px;
  display: flex;
  justify-content: center;
  z-index: 25;
  pointer-events: none;
}
.page-nav-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(17,20,25,.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-2);
  pointer-events: auto;
}
.page-nav-pill button { width: 30px; height: 30px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; }
.page-nav-pill button:hover { color: var(--text); background: var(--surface-3); }
.page-nav-pill .page-count { font-size: 10px; color: var(--muted); padding: 0 3px; font-variant-numeric: tabular-nums; }
.zoom-float {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 30;
  display: flex; align-items: center; gap: 2px;
  padding: 4px;
  border-radius: 9px;
  background: rgba(17,20,25,.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(10px);
}
.zoom-float button { width: 29px; height: 29px; border-radius: 5px; color: var(--muted); display: grid; place-items: center; }
.zoom-float button:hover { color: var(--text); background: var(--surface-2); }
.zoom-float .zoom-val { min-width: 38px; text-align: center; color: var(--muted-2); font-size: 9px; font-variant-numeric: tabular-nums; }
.input-legend {
  position: absolute;
  left: 18px;
  bottom: 17px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 240px);
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--line-soft);
  background: rgba(14,17,21,.9);
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.3;
  pointer-events: none;
  backdrop-filter: blur(10px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.input-legend .legend-swatch { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.input-legend .style-chip { padding: 1px 4px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 8px; letter-spacing: .04em; }
.input-legend .sep { opacity: .3; }
.editor-statusbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  min-height: 34px;
  padding: 4px clamp(14px, 1.8vw, 24px);
  background: #0b0e12;
  border-top: 1px solid var(--line-soft);
  color: var(--dim);
  font-size: 9px;
  letter-spacing: .03em;
}
.editor-statusbar .left, .editor-statusbar .right { display: flex; align-items: center; gap: 9px; min-width: 0; }
.editor-statusbar .sep { opacity: .35; }
.status-page {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; color: var(--muted-2); font-size: 9px; padding: 2px 3px; border-radius: 3px;
}
.status-page:hover { color: var(--text); background: var(--surface-2); }
.status-page:disabled { opacity: .3; pointer-events: none; }
.editor-statusbar .mode-label { color: var(--muted-2); }
.editor-statusbar .mode-label strong { color: var(--muted); font-weight: 650; }
.sheet-dialog-hint { color: var(--muted-2); font-size: 11px; }

/* -------------------------------------------------------------------------
   Setlists
   ------------------------------------------------------------------------- */
.setlists-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: clamp(14px, 1.7vw, 26px);
  max-width: 1560px;
  margin: 0 auto;
  padding: clamp(16px, 2vw, 28px) var(--page-pad);
  min-height: calc(100dvh - var(--appbar-h));
}
.setlist-pane { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); padding-right: clamp(8px, 1.3vw, 18px); }
.setlist-list { display: grid; gap: 4px; overflow-y: auto; min-height: 0; }
.setlist-list-item { display: flex; align-items: stretch; border: 1px solid transparent; border-radius: var(--r-sm); }
.setlist-list-item.is-selected { background: var(--surface); border-color: var(--line-soft); }
.setlist-open { flex: 1 1 auto; display: grid; grid-template-columns: 35px minmax(0,1fr) auto; align-items: center; gap: 10px; text-align: left; padding: 11px 8px 11px 9px; border-radius: var(--r-sm); min-width: 0; }
.setlist-open:hover { background: rgba(255,255,255,.025); }
.setlist-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); }
.setlist-icon .icon { width: 17px; height: 17px; }
.setlist-list-item.is-selected .setlist-icon { color: var(--brass-bright); border-color: rgba(229,180,102,.3); background: rgba(229,180,102,.07); }
.setlist-list-name { min-width: 0; display: grid; gap: 2px; }
.setlist-list-name strong { font-size: 13px; font-weight: 650; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setlist-list-item.is-selected .setlist-list-name strong { color: var(--text); }
.setlist-list-name span { font-size: 10px; color: var(--muted-2); }
.setlist-count { font-size: 10px; color: var(--muted-2); font-variant-numeric: tabular-nums; padding-right: 4px; }
.setlist-dupe { width: 30px; align-self: center; color: var(--dim); border-radius: 5px; height: 30px; display: grid; place-items: center; }
.setlist-dupe:hover { color: var(--brass); background: rgba(229,180,102,.07); }
.setlist-detail { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.setlist-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 2px 0 16px; }
.setlist-title-wrap { min-width: 0; }
.setlist-title { font-family: var(--font-display); font-size: clamp(27px, 2.35vw, 36px); font-weight: 400; line-height: 1.05; letter-spacing: -.028em; margin-top: 4px; overflow-wrap: anywhere; }
.setlist-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 11px; }
.setlist-meta .dotsep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.setlist-detail-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; padding-top: 4px; }
.setlist-board {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255,255,255,.018), transparent 120px), var(--chrome);
  padding: 5px 10px 10px;
  scrollbar-color: var(--surface-3) transparent;
}
.setlist-row {
  display: grid;
  grid-template-columns: 27px 30px minmax(0, 1fr) auto 44px;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 5px 4px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  border-radius: 6px;
}
.setlist-row:last-child { border-bottom: 0; }
.setlist-row:hover { background: rgba(255,255,255,.025); }
.setlist-row.is-dragging { opacity: .4; }
.setlist-row.is-drag-over { box-shadow: inset 0 2px 0 var(--brass); }
.setlist-row .drag-handle { width: 26px; height: 42px; display: grid; place-items: center; border-radius: 4px; color: var(--dim); cursor: grab; }
.setlist-row .drag-handle:active { cursor: grabbing; }
.setlist-row .drag-handle:hover { color: var(--muted); background: var(--surface-2); }
.setlist-row .drag-handle .icon { width: 15px; height: 15px; }
.setlist-row--missing { grid-template-columns: 30px minmax(0, 1fr) 44px; }
.setlist-pos { font-size: 11px; color: var(--muted-2); text-align: center; font-variant-numeric: tabular-nums; }
.setlist-row-key { justify-self: start; width: 31px; min-width: 31px; height: 31px; font-size: 12px; }
.setlist-key-label { color: var(--brass); font-weight: 650; font-variant-numeric: tabular-nums; }
.setlist-tag-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; align-self: center; margin-left: 2px; }
.setlist-song-main { min-width: 0; display: grid; gap: 2px; }
.setlist-song-title { color: var(--text-soft); font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setlist-song-sub { color: var(--muted-2); font-size: 10px; display: flex; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setlist-song-sub .tag-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; align-self: center; }
.setlist-bpm { color: var(--muted-2); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.setlist-bpm strong { display: block; font-size: 10px; color: var(--muted); font-weight: 600; }
.setlist-tag {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid transparent;
  position: relative;
  flex: 0 0 auto;
}
.setlist-tag::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: inherit; filter: saturate(1.1); }
.setlist-tag:hover { border-color: var(--text-soft); }
.setlist-tag--amber { background: #d6a250; }
.setlist-tag--blue { background: #6592d7; }
.setlist-tag--green { background: #6faf89; }
.setlist-tag--red { background: #c86f67; }
.setlist-tag--violet { background: #9a83d8; }
.setlist-row-menu { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; color: var(--dim); }
.setlist-row-menu:hover { color: var(--text); background: var(--surface-2); }
.setlist-row-menu .icon { width: 18px; height: 18px; }
.setlist-empty {
  display: grid; justify-items: start; gap: 9px;
  padding: 44px 18px;
  color: var(--muted);
}
.setlist-empty .empty-icon { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted-2); }
.setlist-empty h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; color: var(--text-soft); }
.setlist-empty p { max-width: 42ch; font-size: 12px; line-height: 1.5; color: var(--muted-2); }
.setlist-detail-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 2px 0; color: var(--dim); font-size: 10px; }
.duration-total { color: var(--muted-2); font-variant-numeric: tabular-nums; }
.setlist-tag-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-choice { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.tag-choice:hover { border-color: var(--line-strong); color: var(--text); }
.tag-choice .setlist-tag { width: 14px; height: 14px; }
.tag-choice .setlist-tag::after { inset: 2px; }
.setlist-picker-list { display: grid; gap: 3px; max-height: 360px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 5px; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; }
.picker-row:hover { background: var(--surface-2); }
.picker-row input { width: 18px; height: 18px; accent-color: var(--brass); flex: 0 0 auto; }
.picker-row label { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; cursor: pointer; }
.picker-row strong { font-size: 12px; font-weight: 650; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-row span { font-size: 10px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-search { margin-bottom: 10px; }
.setlist-picker-empty { padding: 24px; color: var(--muted-2); font-size: 12px; text-align: center; }

/* -------------------------------------------------------------------------
   Stage
   ------------------------------------------------------------------------- */
.stage-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--stage-bg);
  color: var(--stage-ink);
  overflow: hidden;
}
.stage-dialog::backdrop { background: #000; }
.stage-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(80% 60% at 50% -10%, rgba(229,180,102,.08), transparent 65%),
    var(--stage-bg);
  color: var(--stage-ink);
}
.stage-notice { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 74px); left: 50%; z-index: 20; transform: translateX(-50%) translateY(-8px); max-width: calc(100vw - 32px); padding: 10px 15px; border: 1px solid rgba(229,180,102,.35); border-radius: 12px; background: rgba(12,14,18,.95); color: var(--stage-ink); font-size: 12px; line-height: 1.4; text-align: center; opacity: 0; pointer-events: none; transition: opacity 180ms var(--ease), transform 180ms var(--ease); }
.stage-notice.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.stage-top {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: max(12px, env(safe-area-inset-top)) clamp(16px, 2.2vw, 30px) 9px;
  min-height: 62px;
}
.stage-top-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.stage-mark { color: var(--brass); width: 27px; height: 27px; flex: 0 0 auto; }
.stage-title-wrap { min-width: 0; display: grid; gap: 1px; }
.stage-kicker { font-size: 8px; letter-spacing: .17em; text-transform: uppercase; color: var(--stage-muted); }
.stage-set-title { font-family: var(--font-display); font-size: clamp(16px, 1.6vw, 21px); font-weight: 400; letter-spacing: -.02em; color: var(--stage-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-top-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.stage-page-ind { font-size: 10px; color: var(--stage-muted); letter-spacing: .08em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage-exit { color: var(--stage-muted); border-color: rgba(255,255,255,.1); background: rgba(255,255,255,.03); }
.stage-exit:hover { background: rgba(255,255,255,.06); color: var(--text); border-color: rgba(255,255,255,.18); }
.stage-wake { display: inline-flex; align-items: center; gap: 5px; color: var(--stage-muted); font-size: 9px; padding: 3px 7px; border-radius: 999px; border: 1px solid rgba(255,255,255,.08); }
.stage-wake .icon { width: 12px; height: 12px; }
.stage-main { flex: 1 1 auto; min-height: 0; position: relative; display: flex; }
.stage-viewport {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(48px, 5.5vw, 84px) 8px;
  overflow: hidden;
}
.stage-page-wrap { transform-origin: center center; will-change: transform; filter: drop-shadow(0 30px 48px rgba(0,0,0,.35)); }
.stage-page-wrap .paper { transform-origin: top left; }
.stage-side-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 42px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  color: rgba(245,238,223,.36);
  background: rgba(255,255,255,.025);
  transition: color var(--dur-1), background var(--dur-1), border-color var(--dur-1);
}
.stage-side-btn:hover { color: var(--stage-ink); background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.17); }
.stage-side-btn:disabled { opacity: .18; pointer-events: none; }
.stage-side-btn.prev { left: clamp(8px, 1.6vw, 22px); }
.stage-side-btn.next { right: clamp(8px, 1.6vw, 22px); }
.stage-side-btn .icon { width: 24px; height: 24px; }
.stage-tapzone { position: absolute; top: 0; bottom: 0; width: 18%; z-index: 2; cursor: pointer; background: transparent; }
.stage-tapzone--left { left: 0; }
.stage-tapzone--right { right: 0; }
.stage-tapzone:focus-visible { outline-offset: -4px; }
.stage-empty { display: grid; place-items: center; height: 100%; color: var(--stage-muted); font-size: 13px; }
.stage-bar {
  flex: 0 0 auto;
  margin: 0 clamp(10px, 1.8vw, 24px) max(10px, env(safe-area-inset-bottom));
  padding: 7px 9px;
  border-radius: 13px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(15,18,22,.94);
  box-shadow: 0 16px 42px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.05) inset;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 55px;
  z-index: 8;
}
.scene-pos { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; border-right: 1px solid rgba(255,255,255,.1); padding-right: 8px; }
.scene-pos button { width: 31px; height: 34px; border-radius: 6px; display: grid; place-items: center; color: var(--stage-muted); }
.scene-pos button:hover { color: var(--stage-ink); background: rgba(255,255,255,.06); }
.scene-pos button:disabled { opacity: .22; pointer-events: none; }
.scene-pos .pos-val { min-width: 44px; text-align: center; font-size: 11px; color: var(--stage-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.scene-pos .pos-val strong { color: var(--stage-ink); font-weight: 700; }
.scene-song { min-width: 0; flex: 1 1 auto; padding: 0 8px; display: grid; gap: 1px; }
.scene-song-title { font-family: var(--font-display); font-size: clamp(16px, 1.55vw, 21px); line-height: 1.15; color: var(--stage-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-song-sub { font-size: 9px; color: var(--stage-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.scene-bpm { color: var(--stage-muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scene-key-btn {
  min-width: 42px; height: 38px; padding: 2px 8px;
  border-radius: 7px;
  border: 1px solid rgba(229,180,102,.3);
  background: rgba(229,180,102,.07);
  color: var(--brass-bright);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  white-space: nowrap;
}
.scene-key-btn:hover { background: rgba(229,180,102,.14); border-color: rgba(229,180,102,.5); }
.scene-key-btn .icon { width: 12px; height: 12px; opacity: .7; }
.scene-divider { width: 1px; height: 27px; background: rgba(255,255,255,.1); flex: 0 0 auto; margin: 0 2px; }
.scene-mode { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 7px; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.025); }
.scene-mode button { min-height: 29px; padding: 4px 8px; border-radius: 5px; font-size: 9px; font-weight: 700; letter-spacing: .08em; color: var(--stage-muted); }
.scene-mode button:hover { color: var(--stage-ink); }
.scene-mode button.is-active { background: rgba(255,255,255,.1); color: var(--stage-ink); }
.scene-font { display: inline-flex; align-items: center; gap: 0; padding: 2px; border-radius: 7px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.02); }
.scene-font button { width: 26px; height: 29px; display: grid; place-items: center; color: var(--stage-muted); font-size: 10px; font-weight: 700; border-radius: 4px; }
.scene-font button.is-active { color: var(--stage-ink); background: rgba(255,255,255,.08); }
.scene-exit { margin-left: 1px; }
.stage-page-number {
  position: absolute; right: clamp(16px, 2vw, 26px); bottom: 10px; font-size: 9px; letter-spacing: .08em; color: var(--stage-muted); z-index: 3;
}

/* -------------------------------------------------------------------------
   Modals / sheet / toast
   ------------------------------------------------------------------------- */
.sheet {
  width: min(620px, calc(100vw - 28px));
  max-height: min(84dvh, 780px);
  margin: auto auto 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(3, 5, 8, .62); backdrop-filter: blur(6px); }
.sheet[open] .sheet-panel { animation: sheetIn var(--dur-2) var(--ease) both; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(14px) scale(.992); } to { opacity: 1; transform: translateY(0) scale(1); } }
.sheet--wide { width: min(760px, calc(100vw - 28px)); }
.sheet--compact { width: min(480px, calc(100vw - 28px)); }
.sheet-panel { display: flex; flex-direction: column; max-height: min(84dvh, 780px); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 20px 12px; flex: 0 0 auto; }
.sheet-heading { min-width: 0; display: grid; gap: 4px; }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-size: 25px; font-weight: 400; line-height: 1.1; letter-spacing: -.025em; color: var(--text); overflow-wrap: anywhere; }
.sheet-close { margin: -4px -4px 0 0; color: var(--muted); }
.sheet-body { padding: 0 20px 28px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; scroll-padding-bottom: 16px; }
.sheet-foot { padding: 13px 20px 18px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; background: rgba(13,16,20,.3); }
.sheet-foot--split { justify-content: space-between; }
.sheet-foot .left { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.sheet-note { font-size: 11px; color: var(--muted-2); line-height: 1.5; }
.sheet-hint { display: flex; align-items: flex-start; gap: 7px; padding: 9px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; line-height: 1.5; }
.sheet-hint .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--brass); flex: 0 0 auto; }
.sheet-section { display: grid; gap: 10px; margin-top: 15px; }
.sheet-section:first-child { margin-top: 0; }
.sheet-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--muted-2); }
.sheet-section-title .muted { letter-spacing: 0; text-transform: none; font-size: 10px; font-weight: 500; color: var(--dim); }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.choice-chip {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
.choice-chip:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--text); }
.choice-chip.is-active { background: rgba(229,180,102,.13); border-color: rgba(229,180,102,.4); color: var(--brass-bright); }
.choice-chip .degree { color: var(--muted-2); font-size: 9px; font-weight: 500; margin-right: 4px; }
.choice-chip.is-active .degree { color: var(--brass); }
.choice-chip--danger { color: #ffb0a8; border-color: rgba(229,129,120,.2); background: rgba(229,129,120,.06); }
.choice-chip--danger:hover { background: rgba(229,129,120,.14); border-color: rgba(229,129,120,.4); color: #ffc3bc; }
.root-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.root-choice {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 14px;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
.root-choice:hover { background: var(--surface-3); color: var(--text); }
.root-choice.is-active { background: rgba(229,180,102,.13); border-color: rgba(229,180,102,.4); color: var(--brass-bright); }
.quality-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.full-keyboard { display: grid; gap: 12px; padding-top: 2px; }
.full-keyboard .keyboard-row { display: grid; gap: 7px; }
.keyboard-label { font-size: 10px; color: var(--muted-2); }
.chord-preview {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 67px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.chord-preview-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.chord-preview-label { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.chord-preview-value { font-family: var(--font-display); font-size: 34px; line-height: 1; letter-spacing: -.03em; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chord-preview-meta { color: var(--muted); font-size: 10px; text-align: right; line-height: 1.4; }
.flat-select { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.flat-select .select { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 12px; }
.beat-row { display: flex; gap: 4px; flex-wrap: wrap; }
.beat-choice { width: 33px; height: 33px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.beat-choice:hover { color: var(--text); border-color: var(--line-strong); }
.beat-choice.is-active { color: var(--brass-bright); background: rgba(229,180,102,.11); border-color: rgba(229,180,102,.4); }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-soft); }
.check-row input { width: 16px; height: 16px; accent-color: var(--brass); }
.key-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 6px; }
.key-tile {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), transform var(--dur-1);
}
.key-tile small { font-family: var(--font-ui); font-size: 8px; letter-spacing: .06em; color: var(--dim); text-transform: uppercase; }
.key-tile:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--text); transform: translateY(-1px); }
.key-tile.is-current { background: rgba(229,180,102,.13); border-color: rgba(229,180,102,.5); color: var(--brass-bright); }
.key-tile.is-current small { color: var(--brass); }
.transpose-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 11px; line-height: 1.5; padding-top: 5px; }
.transpose-note .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--brass); flex: 0 0 auto; }
.import-drop {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 24px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-1), background var(--dur-1);
}
.import-drop:hover { border-color: rgba(229,180,102,.5); background: rgba(229,180,102,.04); }
.import-drop .icon { width: 28px; height: 28px; color: var(--brass); }
.import-drop strong { font-size: 13px; color: var(--text-soft); }
.import-drop span { font-size: 11px; color: var(--muted-2); max-width: 38ch; line-height: 1.5; }
.import-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.import-samples { display: grid; gap: 5px; }
.import-sample {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 7px; background: var(--surface-2);
}
.import-sample:hover { background: var(--surface-3); border-color: var(--line-strong); }
.import-sample .icon { width: 17px; height: 17px; color: var(--brass); flex: 0 0 auto; }
.import-sample-text { min-width: 0; display: grid; gap: 1px; }
.import-sample-text strong { font-size: 12px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-sample-text span { font-size: 10px; color: var(--muted-2); }
.import-sample .arrow { margin-left: auto; color: var(--dim); }
.import-file-name { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }
.import-file-name .icon { color: var(--green); width: 15px; height: 15px; }
.import-error { padding: 10px 11px; border-radius: 7px; border: 1px solid rgba(229,129,120,.25); background: var(--red-soft); color: #ffb7b0; font-size: 12px; line-height: 1.5; }
.import-report { display: grid; gap: 9px; }
.import-report-head { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 8px; }
.import-report-head .icon { color: var(--green); width: 20px; height: 20px; margin-top: 1px; }
.import-report-head strong { display: block; font-size: 13px; color: var(--text); }
.import-report-head span { font-size: 11px; color: var(--muted); }
.report-list { display: grid; gap: 2px; max-height: 295px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 8px; }
.report-row { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 7px 9px; border-bottom: 1px solid var(--line-soft); }
.report-row:last-child { border-bottom: 0; }
.report-row .status { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: var(--green); background: var(--green-soft); font-size: 9px; }
.report-row.has-warning .status { color: var(--brass); background: rgba(229,180,102,.12); }
.report-row .report-title { min-width: 0; display: grid; gap: 1px; }
.report-row strong { font-size: 11px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-row span { font-size: 9px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-row .report-meta { color: var(--muted-2); font-size: 9px; text-align: right; white-space: nowrap; }
.warn-dot { color: var(--brass); }
.source-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 99px; border: 1px solid var(--line); font-size: 8px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.source-pill--ireal { color: var(--brass); border-color: rgba(229,180,102,.25); background: rgba(229,180,102,.07); }
.add-song-list { display: grid; gap: 2px; max-height: 350px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 5px; }
.add-song-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 6px; }
.add-song-row:hover { background: var(--surface-2); }
.add-song-row .song-title { font-size: 12px; }
.add-song-row .song-sub { font-size: 10px; }
.add-song-row .key-badge { width: 31px; height: 31px; font-size: 12px; }
.add-song-row .add-btn { margin-left: auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 5px; color: var(--brass); background: rgba(229,180,102,.07); }
.add-song-row .add-btn:hover { background: rgba(229,180,102,.16); }
.add-song-row.is-added { opacity: .55; }
.settings-section { display: grid; gap: 8px; }
.settings-section + .settings-section { margin-top: 15px; }
.settings-title { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.about-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.about-line:last-child { border-bottom: 0; }
.about-line strong { color: var(--text-soft); font-weight: 600; }
.telemetry-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.telemetry-row:last-child { border-bottom: 0; }
.telemetry-row button { color: var(--muted); font-size: 11px; }
.telemetry-row button:hover { color: var(--text); }
.confirm-copy { font-size: 13px; line-height: 1.55; color: var(--muted); }
.confirm-copy strong { color: var(--text-soft); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 10000;
  max-width: min(560px, calc(100vw - 28px));
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: #1d232c;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2), transform var(--dur-2) var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast .toast-action { color: var(--brass-bright); font-weight: 650; margin-left: 7px; padding: 0; }
.toast .toast-action:hover { text-decoration: underline; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); color: var(--text); font-size: 16px; z-index: 10001; }

/* -------------------------------------------------------------------------
   Print
   ------------------------------------------------------------------------- */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { background: #fff !important; color: #000 !important; }
  .appbar, .editor-top, .editor-ribbon, .notation-rail, .editor-statusbar, .playback-bar, .score-stage > .zoom-float, .score-stage > .input-legend, .page-nav-float, .paper-tools-corner, .bar-menu-btn, .stage-top, .stage-bar, .stage-side-btn, .stage-tapzone, .boot, .toast, .skip-link { display: none !important; }
  .app, .view, .editor-view, .editor-shell, .editor-workspace, .score-stage { display: block !important; height: auto !important; min-height: 0 !important; overflow: visible !important; padding: 0 !important; background: #fff !important; }
  .score-scale-box { transform: none !important; width: auto !important; height: auto !important; }
  .score-scale-box .paper { position: static !important; transform: none !important; width: 100% !important; min-height: 0 !important; box-shadow: none !important; border: 0 !important; }
  .paper { background: #fff !important; color: #000 !important; }
  .ink-canvas { display: none !important; }
  .chord-btn { color: #000 !important; }
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 1220px) {
  .local-label { display: none; }
  .local-chip { padding: 0 7px; }
  .library-layout { grid-template-columns: minmax(300px, 330px) minmax(0,1fr); }
}

@media (max-width: 980px) {
  :root { --page-pad: 18px; }
  .library-layout { grid-template-columns: 300px minmax(0,1fr); gap: 14px; }
  .preview-heading h2 { font-size: 24px; }
  .bar-row { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .paper--preview { width: 680px; padding: 30px 34px 22px; }
  .paper--preview .score-title { font-size: 29px; }
  .editor-title { font-size: 18px; }
  .ribbon-label { display: none; }
  .setlists-layout { grid-template-columns: 290px minmax(0,1fr); gap: 14px; }
  .setlist-row { grid-template-columns: 25px 24px minmax(0,1fr) auto 44px; }
  .setlist-row .setlist-tag { display: none; }
}

@media (max-width: 860px) {
  .appbar { gap: 10px; }
  .brand-tag { display: none; }
  .setlists-layout { grid-template-columns: 1fr; }
  .setlist-pane { border-right: 0; padding-right: 0; max-width: 640px; width: 100%; margin: 0 auto; }
  .setlist-detail { display: none; }
  .setlists-layout.mobile-open .setlist-pane { display: none; }
  .setlists-layout.mobile-open .setlist-detail { display: flex; max-width: 720px; width: 100%; margin: 0 auto; }
  .mobile-back { display: inline-flex !important; }
  .setlist-detail-head .mobile-back { margin-bottom: 8px; }
  .editor-identity .eyebrow { display: none; }
  .editor-top { min-height: 56px; gap: 8px; }
  .editor-actions .editor-save { display: none; }
  .editor-actions .btn span { display: none; }
  .editor-actions .btn { padding: 7px 9px; }
  .notation-rail { width: 62px; flex-basis: 62px; }
  .paper--preview { width: 620px; }
  .input-legend { display: none; }
  .stage-bar { flex-wrap: wrap; row-gap: 6px; }
  .scene-song { flex-basis: calc(100% - 190px); }
  .scene-meta { margin-left: auto; }
  .stage-side-btn { width: 34px; height: 54px; }
  .stage-viewport { padding-left: 38px; padding-right: 38px; }
}

@media (max-width: 720px) {
  .library-layout { grid-template-columns: 1fr; min-height: calc(100dvh - var(--appbar-h)); }
  .library-pane { border-right: 0; padding-right: 0; max-width: 620px; width: 100%; margin: 0 auto; }
  .preview-pane { display: none; }
}

@media (max-width: 680px) {
  :root { --page-pad: 14px; --appbar-h: 58px; }
  body { font-size: 14px; }
  .appbar {
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 8px 10px;
    min-height: var(--appbar-h);
  }
  .brand-mark .brand-svg { width: 27px; height: 27px; }
  .brand-word { font-size: 20px; }
  .brand-wordmark { height: 33px; }
  .apptabs { order: 3; width: 100%; padding: 3px; }
  .apptab { flex: 1 1 0; min-height: 31px; }
  .appbar-tools .local-chip { display: none; }
  .appbar-tools { gap: 4px; }
  .import-btn { min-height: 34px; padding: 6px 9px; }
  .import-btn span { display: inline; }
  .song-more { display: grid; width: 44px; height: 44px; }
  .library-layout { padding-top: 12px; }
  .pane-head { padding-top: 2px; }
  .pane-head h1 { font-size: 29px; }
  .library-tools { padding-bottom: 9px; }
  .song-row-btn { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; padding-left: 7px; }
  .key-badge { width: 31px; height: 31px; font-size: 13px; }
  .song-title { font-size: 13px; }
  .song-sub { font-size: 10px; }
  .song-bpm { display: none; }
  .library-foot { padding-top: 9px; }
  .paper--preview { width: 520px; padding: 25px 26px 18px; }
  .paper--preview .score-title { font-size: 24px; }
  .editor-top { flex-wrap: wrap; padding: 7px 10px; }
  .editor-identity { order: 3; width: 100%; padding: 0 2px 2px; }
  .editor-title { font-size: 16px; }
  .editor-actions { margin-left: auto; }
  .editor-ribbon { padding: 5px 8px; gap: 2px; min-height: 47px; }
  .ribbon-btn { padding: 5px 6px; }
  .ribbon-btn .ribbon-text { display: none; }
  .ribbon-btn .icon { width: 18px; height: 18px; }
  .ribbon-divider { margin-left: 2px; margin-right: 2px; }
  .color-well .color-dot { width: 15px; height: 15px; }
  .size-well { display: none; }
  .finger-toggle .finger-text { display: none; }
  .finger-toggle { padding: 5px; min-height: 33px; }
  .editor-workspace { flex-direction: column; }
  .notation-rail {
    order: 2;
    width: 100%;
    flex: 0 0 auto;
    height: 66px;
    flex-direction: row;
    align-items: center;
    gap: 1px;
    padding: 5px 6px;
    border-right: 0;
    border-top: 1px solid var(--line-soft);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .rail-label, .rail-sep { display: none; }
  .duration-btn { flex: 0 0 43px; height: 48px; }
  .rail-mini-btn { flex: 0 0 auto; min-width: 34px; height: 38px; }
  .rail-note-toggle { flex: 0 0 auto; min-width: 58px; height: 48px; }
  .rail-mode-group { display: flex; gap: 2px; }
  .rail-mode-btn { flex: 0 0 58px; height: 48px; min-height: 0; }
  .rail-grid-group { display: flex; align-items: center; gap: 2px; }
  .rail-grid-group .rail-label { display: none; }
  .rail-grid-toggle { display: flex; gap: 2px; }
  .rail-grid-toggle button { min-width: 48px; height: 38px; }
  .score-stage { order: 1; padding: 16px 11px 28px; }
  .zoom-float { right: 9px; bottom: 9px; }
  .editor-statusbar { min-height: 38px; padding: 3px 9px; font-size: 8px; }
  .page-nav .status-page { width: 31px; height: 31px; }
  .page-nav .editor-page-label { min-width: 64px; font-size: 10.5px; }
  .editor-statusbar .left .mode-label { display: none; }
  .editor-statusbar .left { display: none; }
  .editor-statusbar .right { margin-left: auto; }
  .page-nav-float { bottom: 8px; }
  .setlists-layout { padding-top: 12px; }
  .setlist-title { font-size: 26px; }
  .setlist-detail-head { flex-wrap: wrap; padding-bottom: 9px; }
  .setlist-detail-actions { width: 100%; justify-content: flex-end; }
  .setlist-row { grid-template-columns: 24px minmax(0,1fr) 44px; gap: 6px; }
  .setlist-row .drag-handle { display: none; }
  .setlist-row .setlist-bpm { display: none; }
  .setlist-row--missing { grid-template-columns: 24px minmax(0,1fr) 44px; }
  .setlist-row-menu { display: grid; }
  .setlist-board { padding: 3px 4px 6px; border-radius: 10px; }
  .setlist-song-title { font-size: 12px; }
  .sheet { width: calc(100vw - 16px); margin-bottom: 8px; border-radius: var(--r-lg); }
  .sheet-head { padding: 16px 15px 10px; }
  .sheet-body { padding: 0 15px 24px; }
  .sheet-foot { padding: 10px 15px 13px; }
  .sheet-head h2 { font-size: 22px; }
  .root-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .key-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .key-tile { min-height: 52px; font-size: 16px; }
  .chord-preview { min-height: 58px; }
  .chord-preview-value { font-size: 29px; }
  .stage-top { padding-left: 12px; padding-right: 12px; }
  .stage-exit span { display: none; }
  .stage-wake { display: none; }
  .stage-viewport { padding: 0 8px 0; }
  .stage-side-btn { display: none; }
  .stage-tapzone { width: 24%; }
  .stage-bar { margin: 0 7px max(7px, env(safe-area-inset-bottom)); padding: 6px; gap: 4px; border-radius: 10px; }
  .scene-pos { padding-right: 3px; }
  .scene-pos button { width: 27px; height: 31px; }
  .scene-pos .pos-val { min-width: 38px; font-size: 10px; }
  .scene-song { padding: 0 3px; }
  .scene-song-title { font-size: 15px; }
  .scene-song-sub { display: none; }
  .scene-meta { gap: 4px; flex-wrap: wrap; }
  .scene-bpm { display: none; }
  .scene-divider { display: none; }
  .scene-key-btn { height: 35px; min-width: 37px; font-size: 14px; }
  .scene-mode button { padding: 4px 6px; font-size: 8px; }
  .scene-font { display: none; }
  .stage-page-number { right: 10px; }
  .toast { bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (max-width: 680px) {
  .input, .select, .textarea { font-size: 16px; }
}
@media (pointer: coarse), (any-pointer: coarse) {
  .bar-menu-btn { opacity: 0; }
  .bar-add-hint { opacity: 0; }
  .note-btn { transform: translate(-13px, -14px) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .note-cursor { animation: none; opacity: 1; }
  .boot-track span { animation: none; width: 70%; }
}

.setlist-detail > .mobile-back { display: none; }
.paper.paper--stage { min-height: 0; }
.paper.paper--stage .bar { min-height: 92px; }
.paper.paper--stage .score-title { font-size: 37px; }
@media (min-width: 681px) {
  .stage-bar { min-height: 58px; }
}



/* -------------------------------------------------------------------------
   Light theme
   ------------------------------------------------------------------------- */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f0ebe2;
  --bg-deep: #e7dfd2;
  --chrome: #fbf8f2;
  --chrome-2: #f4eee4;
  --surface: #fffdf8;
  --surface-2: #f5efe5;
  --surface-3: #ebe2d3;
  --surface-4: #dfd3c1;
  --line: #d6cbba;
  --line-soft: rgba(46,37,25,.09);
  --line-strong: rgba(46,37,25,.17);
  --text: #211e19;
  --text-soft: #3d372d;
  --muted: #6d6458;
  --muted-2: #8b8173;
  --dim: #a79b8b;
  --brass: #b88437;
  --brass-bright: #99671f;
  --brass-deep: #7f5317;
  --brass-ink: #fffaf1;
  --blue: #3f6fae;
  --blue-soft: rgba(63,111,174,.13);
  --amber: #b1761d;
  --amber-soft: rgba(177,118,29,.14);
  --green: #3f7d58;
  --green-soft: rgba(63,125,88,.12);
  --red: #a44b42;
  --red-soft: rgba(164,75,66,.11);
  --violet: #7354ad;
  --paper: #fffdf8;
  --paper-deep: #f7f1e6;
  --paper-ink: #201f1b;
  --paper-soft: #4e4b43;
  --paper-muted: #7b7469;
  --paper-line: #bcb3a5;
  --paper-line-soft: rgba(32,31,27,.09);
  --paper-hover: rgba(69,57,35,.055);
  --focus: #9a6b2b;
  --shadow-1: 0 1px 2px rgba(58,44,26,.10);
  --shadow-2: 0 18px 45px rgba(58,44,26,.16), 0 2px 8px rgba(58,44,26,.10);
  --shadow-3: 0 30px 80px rgba(58,44,26,.22), 0 5px 18px rgba(58,44,26,.12);
  --shadow-paper: 0 1px 0 rgba(255,255,255,.8) inset, 0 28px 60px rgba(80,60,30,.18), 0 5px 16px rgba(80,60,30,.12);
}
html[data-theme="light"] .appbar { background: rgba(251,248,242,.92); }
html[data-theme="light"] .apptabs { background: rgba(240,234,224,.85); }
html[data-theme="light"] .search-box .input { background: var(--surface); }
html[data-theme="light"] .editor-ribbon { background: var(--chrome-2); }
html[data-theme="light"] .notation-rail { background: var(--surface-2); }
html[data-theme="light"] .editor-statusbar { background: var(--surface-2); }
html[data-theme="light"] .score-stage { background-image: radial-gradient(60% 55% at 55% 0%, rgba(184,132,55,.06), transparent 70%); }
html[data-theme="light"] .preview-stage {
  background:
    radial-gradient(100% 80% at 50% 0%, rgba(184,132,55,.06), transparent 60%),
    #e9e1d5;
}
html[data-theme="light"] .preview-stage::before {
  background-image: linear-gradient(rgba(45,36,25,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(45,36,25,.03) 1px, transparent 1px);
}
html[data-theme="light"] .sheet-foot { background: rgba(255,253,248,.55); }
html[data-theme="light"] .toast { background: #fffdf8; color: var(--text); }
html[data-theme="light"] .zoom-float,
html[data-theme="light"] .page-nav-pill,
html[data-theme="light"] .input-legend { background: rgba(251,248,242,.94); }
html[data-theme="light"] .local-chip { color: #3f7a55; background: rgba(63,127,89,.08); border-color: rgba(63,127,89,.18); }
html[data-theme="light"] .song-item + .song-item { border-top-color: rgba(32,31,27,.075); }
html[data-theme="light"] .song-item.is-selected { background: var(--surface-2); box-shadow: inset 0 1px 0 rgba(255,255,255,.7); }
html[data-theme="light"] .setlist-row:hover,
html[data-theme="light"] .setlist-open:hover { background: rgba(32,31,27,.035); }
html[data-theme="light"] .stage-shell,
html[data-theme="light"] .stage-dialog {
  --brass: #e5b466;
  --brass-bright: #f2c97e;
  --brass-deep: #b9873f;
  --brass-ink: #1b1409;
  --text: #f2efe8;
}
html[data-theme="light"] .stage-exit:hover { color: var(--stage-ink); }
html[data-theme="light"] .stage-tapzone:focus-visible { outline-color: var(--brass-bright); }

.theme-toggle { position: relative; }
.theme-icon { display: inline-flex; align-items: center; justify-content: center; }
.theme-icon--sun { display: none; }
html[data-theme="light"] .theme-icon--moon { display: none; }
html[data-theme="light"] .theme-icon--sun { display: inline-flex; }

/* -------------------------------------------------------------------------
   Playback
   ------------------------------------------------------------------------- */
.playback-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 5px clamp(14px, 1.8vw, 24px);
  background: var(--chrome);
  border-bottom: 1px solid var(--line-soft);
  z-index: 18;
}
.playback-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 3px 11px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.playback-main:hover { border-color: var(--brass-deep); color: var(--text); }
.playback-glyph {
  width: 26px; height: 26px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  color: var(--brass-bright);
  background: rgba(229,180,102,.12);
}
.playback-glyph .icon { width: 13px; height: 13px; }
.playback-glyph--stop { display: none; }
.playback-main.is-playing .playback-glyph--play { display: none; }
.playback-main.is-playing .playback-glyph--stop { display: inline-grid; }
.playback-main.is-playing { border-color: rgba(229,180,102,.38); background: rgba(229,180,102,.07); color: var(--brass-bright); }
.playback-meter {
  flex: 1 1 auto;
  min-width: 70px;
  height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.playback-meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brass-deep), var(--brass)); transition: width 100ms linear; }
.playback-position { min-width: 73px; color: var(--muted); font-size: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.playback-tempo { color: var(--dim); font-size: 9px; letter-spacing: .04em; white-space: nowrap; }
.playback-toggle .playback-mini { display: grid; place-items: center; }
.playback-toggle .playback-mini--stop { display: none; }
.playback-toggle.is-playing .playback-mini--play { display: none; }
.playback-toggle.is-playing .playback-mini--stop { display: grid; }
.playback-toggle.is-playing { color: var(--brass-bright); background: rgba(229,180,102,.09); border-color: rgba(229,180,102,.28); }
.preview-play-progress { flex: 0 0 auto; height: 3px; margin: 6px 2px 0; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.preview-play-progress[hidden] { display: none; }
.preview-play-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--brass); transition: width 100ms linear; }
.preview-playback-status { color: var(--brass-bright); font-size: 10px; white-space: nowrap; }
.bar.is-playing { background: rgba(229,180,102,.14); box-shadow: inset 0 0 0 1px rgba(229,180,102,.38); }
.paper--stage .bar.is-playing { background: rgba(229,180,102,.1); }
@media (max-width: 680px) {
  .playback-bar { gap: 7px; min-height: 39px; padding: 4px 9px; }
  .playback-main { min-height: 31px; padding: 2px 7px 2px 3px; gap: 4px; }
  .playback-glyph { width: 24px; height: 24px; }
  .playback-label { font-size: 9px; }
  .playback-position { min-width: 60px; font-size: 9px; }
  .playback-tempo { display: none; }
  .playback-meter { min-width: 36px; }
}

html[data-theme="light"] .ribbon-btn.is-ink-tool.is-active { color: var(--brass-deep); }
html[data-theme="light"] .playback-glyph { color: var(--brass-deep); background: rgba(184,132,55,.16); }
html[data-theme="light"] .playback-meter,
html[data-theme="light"] .preview-play-progress { background: rgba(46,37,25,.14); }
@media (max-width: 680px) {
  .editor-statusbar .right { margin-left: 0; width: 100%; justify-content: space-between; gap: 6px; }
}

.paper--stage .chord-btn,
.paper--preview .chord-btn { pointer-events: none; }
.paper--stage .chord-btn:hover,
.paper--preview .chord-btn:hover { background: none; box-shadow: none; transform: none; }

.preview-actions .playback-toggle { color: var(--brass-bright); border-color: rgba(229,180,102,.3); background: rgba(229,180,102,.08); }
.preview-actions .playback-toggle:hover { color: var(--brass-bright); background: rgba(229,180,102,.14); border-color: rgba(229,180,102,.45); }
.preview-actions .playback-toggle.is-playing { color: var(--brass-ink); background: var(--brass); border-color: var(--brass); }
@media (max-width: 680px) {
  .editor-statusbar .right > .status-page { width: 29px; height: 29px; font-size: 9px; }
  .editor-statusbar #editorZoomLabel { font-size: 10px; min-width: 30px; text-align: center; }
}

/* Score structure: chords above the staff, beat grid inside each bar */
.system { row-gap: 0; align-items: start; padding-top: 10px; padding-bottom: 10px; }
.system-chord-gutter { min-height: 1px; }
.system-chords { min-width: 0; }
.system-gutter { min-height: 88px; }
.system-body { min-width: 0; }
.bar { min-height: 68px; }
.chord-slots {
  left: 10px;
  right: 24px;
  top: 27px;
  bottom: 19px;
  display: grid;
  grid-template-columns: repeat(var(--beats, 4), minmax(0, 1fr));
  align-content: start;
  align-items: start;
  column-gap: 3px;
  row-gap: 0;
}
.chord-btn { justify-self: start; max-width: 100%; font-size: 15.5px; }
.paper--preview .bar .chord-btn { font-size: 14px; }
.paper--stage .bar .chord-btn { font-size: 19px; }
.bar[data-chords="3"] .chord-btn, .bar[data-chords="4"] .chord-btn { font-size: 13.5px; }
.bar-beats {
  position: absolute;
  left: 10px;
  right: 30px;
  bottom: 4px;
  display: grid;
  grid-template-columns: repeat(var(--beats, 4), minmax(0, 1fr));
  color: var(--paper-muted);
  font-family: var(--font-ui);
  font-size: 7.5px;
  line-height: 1;
  letter-spacing: .02em;
  opacity: .62;
  z-index: 4;
  pointer-events: none;
}
.bar-beats span { text-align: left; }
.rehearsal {
  left: 6px;
  top: 5px;
  transform: none;
  width: 18px;
  height: 17px;
  font-size: 10px;
}
.bar-cue--above { top: 4px; }
.has-cue-above .chord-slots { top: 30px; }

.staff-beams {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
}
.staff-beam-line {
  stroke: var(--paper-ink);
  stroke-width: 2.2;
  stroke-linecap: butt;
  vector-effect: non-scaling-stroke;
}

html:not([data-theme="light"]) .paper::after { box-shadow: inset 0 0 0 1px rgba(242,237,227,.10), inset 0 1px 0 rgba(255,255,255,.08); }
html:not([data-theme="light"]) .score-key { border-color: rgba(242,237,227,.24); }
html:not([data-theme="light"]) .chord-btn:hover { background: rgba(255,255,255,.065); box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
html:not([data-theme="light"]) .note-btn:hover { background: rgba(255,255,255,.065); }
html:not([data-theme="light"]) .rehearsal { border-color: rgba(242,237,227,.35); background: var(--paper); }
html:not([data-theme="light"]) .system { border-bottom-color: rgba(242,237,227,.08); }
html:not([data-theme="light"]) .bar-row { border-bottom-color: rgba(242,237,227,.1); }
html:not([data-theme="light"]) .bar-menu-btn:hover { color: var(--paper-ink); background: rgba(255,255,255,.08); }
html:not([data-theme="light"]) .bar-cue--c-red { color: #ff9a90; }
html:not([data-theme="light"]) .bar-cue--c-blue { color: #8dbbff; }
html:not([data-theme="light"]) .bar-cue--c-green { color: #97d5a9; }
html:not([data-theme="light"]) .bar-cue--c-amber { color: #f4c879; }
html:not([data-theme="light"]) .paper :focus-visible { outline-color: var(--brass-bright); }

.paper--stage { --paper: var(--stage-paper); --paper-deep: var(--stage-paper-2); --paper-line-soft: rgba(255,255,255,.08); }

.bar-beats { color: var(--paper-soft); font-size: 8.5px; opacity: .8; }
.note-btn.is-selected { background: transparent !important; box-shadow: none !important; outline: none; }
@media print {
  .paper .note-btn, .paper .chord-btn, .paper .rehearsal, .paper .bar-beats { color: #000 !important; }
  .paper .note-head { fill: #000 !important; }
  .paper .note-head--open { fill: #fff !important; stroke: #000 !important; }
  .paper .note-stem, .paper .note-flag, .paper .staff-beam-line { stroke: #000 !important; }
  .paper .staff-line, .paper .staff-barlines span { background: #000 !important; }
  .paper .rehearsal { background: #fff !important; border-color: #000 !important; }
}
.rehearsal { left: 10px; }

.stage-dialog[data-stage-sheet="light"] .paper--stage {
  --paper: #fbf7ed;
  --paper-deep: #f1e9da;
  --paper-ink: #1b1a16;
  --paper-soft: #47433b;
  --paper-muted: #6f6a60;
  --score-line: #9f9788;
  --paper-line: #b3aa9b;
  --paper-line-soft: rgba(32,31,27,.12);
  --paper-hover: rgba(69,57,35,.06);
  background: #fbf7ed;
  box-shadow: 0 35px 80px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.7) inset;
}
.stage-dialog[data-stage-sheet="light"] .paper--stage::after { box-shadow: inset 0 0 0 1px rgba(32,31,27,.1), inset 0 1px 0 rgba(255,255,255,.75); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .chord-btn { color: var(--paper-ink); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .bar-no { color: var(--paper-muted); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .score-foot { color: var(--paper-muted); border-color: rgba(32,31,27,.15); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .staff-line { background: rgba(32,31,27,.3); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .staff-barlines span { background: rgba(32,31,27,.28); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .rehearsal { color: var(--paper-ink); border-color: rgba(32,31,27,.4); background: var(--paper); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .score-key { color: var(--paper-ink); border-color: rgba(32,31,27,.3); background: rgba(184,132,55,.08); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .system { border-bottom-color: rgba(32,31,27,.075); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .bar-row { border-bottom-color: rgba(32,31,27,.12); }
.stage-dialog[data-stage-sheet="light"] .paper--stage .bar-cue--c-red { color: #a6483d; }
.stage-dialog[data-stage-sheet="light"] .paper--stage .bar-cue--c-blue { color: #315f9f; }
.stage-dialog[data-stage-sheet="light"] .paper--stage .bar-cue--c-green { color: #39754f; }
.stage-dialog[data-stage-sheet="light"] .paper--stage .bar-cue--c-amber { color: #93671f; }
.staff-tie-line { fill: none; stroke: var(--paper-ink); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-linecap: round; }
@media print { .paper .staff-tie-line { stroke: #000 !important; } }

/* Conventional lead-sheet chrome: clef/time in the prelude, staff carries barlines */
.system { grid-template-columns: 84px minmax(0, 1fr); column-gap: 0; }
.system-gutter { min-height: 88px; position: relative; }
.gutter-staff-lines { position: absolute; left: 0; right: 0; top: 15px; height: 44px; pointer-events: none; }
.gutter-staff-lines span { position: absolute; left: 0; right: 0; height: 1px; background: var(--score-line); opacity: .72; }
.gutter-staff-lines span:nth-child(1) { top: 0; }
.gutter-staff-lines span:nth-child(2) { top: 11px; }
.gutter-staff-lines span:nth-child(3) { top: 22px; }
.gutter-staff-lines span:nth-child(4) { top: 33px; }
.gutter-staff-lines span:nth-child(5) { top: 44px; }
.staff-clef { left: 2px; top: -5px; width: 32px; height: 64px; font-size: 62px; }
.staff-timesig { left: 50px; top: 21px; width: 24px; display: grid; gap: 1px; color: var(--paper-ink); font-family: var(--font-display); font-size: 12px; line-height: 1; text-align: center; }
.staff-timesig span { display: block; }
.system-chords .bar-row { border-top: 0; border-bottom: 0; }
.system-chords .bar { min-height: 56px; border-left: 0; border-right: 0; background: transparent; }
.system-chords .bar:first-child { border-left: 0; }
.system-chords .bar:hover { background: transparent; }
.system-chords .chord-slots { top: 27px; bottom: 2px; }
.system-chords .bar-no { top: 3px; right: 30px; }
.system-chords .bar-menu-btn { top: 1px; right: 2px; bottom: auto; }
.system-chord-gutter { position: relative; }
.system-meter-mini {
  display: inline-grid; place-items: center;
  margin: 7px 0 0 4px;
  width: 36px; height: 32px;
  border: 1px solid var(--score-line);
  color: var(--paper-ink);
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1;
}
.staff-repeat { position: absolute; top: 15px; height: 44px; width: 16px; z-index: 4; pointer-events: none; color: var(--paper-soft); }
.staff-repeat::before, .staff-repeat::after { content: ""; position: absolute; top: 0; bottom: 0; background: currentColor; }
.staff-repeat--start::before { left: 0; width: 3px; }
.staff-repeat--start::after { left: 5px; width: 1px; }
.staff-repeat--end { transform: translateX(-16px); }
.staff-repeat--end::before { left: 12px; width: 1px; }
.staff-repeat--end::after { left: 15px; width: 3px; }
.staff-repeat-dot { position: absolute; top: 20px; width: 2.4px; height: 2.4px; border-radius: 50%; background: currentColor; box-shadow: 0 11px 0 currentColor; }
.staff-repeat--start .staff-repeat-dot { left: 9px; }
.staff-repeat--end .staff-repeat-dot { left: 4px; }
.staff-beam-stem { stroke: var(--paper-ink); stroke-width: 1.35; stroke-linecap: round; vector-effect: non-scaling-stroke; }
@media print { .paper .staff-beam-stem { stroke: #000 !important; } }
.staff-beams { overflow: visible; }
.note-svg { overflow: visible; }

.system { grid-template-columns: 112px minmax(0, 1fr); }
.staff-timesig { left: 82px; }
.key-signature { position: absolute; left: 38px; top: 0; width: 38px; height: 88px; pointer-events: none; color: var(--paper-ink); }
.key-acc { position: absolute; transform: translateY(-50%); font-family: "Bravura", var(--font-display); font-size: 18px; line-height: 1; }
@media print { .paper .key-acc { color: #000 !important; } }

.staff-repeat-dot { top: 31.5px; }
.paper--stage .bar-no, .paper--preview .bar-no { display: none; }
@media print {
  .paper .key-acc, .paper .staff-timesig, .paper .staff-repeat { color: #000 !important; }
  .paper .gutter-staff-lines span { background: #000 !important; }
  .paper .bar-no, .paper .bar-menu-btn, .paper .bar-add { display: none !important; }
}

/* VexFlow systems: chord strip aligned to a fixed prelude; notation is SVG */
.system { display: block; grid-template-columns: none; column-gap: 0; }
.system-chord-row { display: grid; grid-template-columns: var(--score-prelude, 176px) minmax(0, 1fr); column-gap: 0; }
.system-chord-gutter { min-width: 0; }
.system-chords { width: 100%; }
.vex-host { position: relative; width: 100%; height: 150px; margin: 0; }
.vex-host svg { display: block; width: 100%; height: 150px; overflow: visible; }
.vex-note-hits { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.vex-note-hit {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translate(-11px, -11px);
  background: transparent;
  opacity: 1;
  pointer-events: auto;
  z-index: 6;
}
.vex-note-hit:hover { background: rgba(239,179,94,.16); }
.vex-note-hit.is-selected { background: rgba(239,179,94,.16); box-shadow: 0 0 0 1.5px rgba(183,122,34,.7); }
.vex-staff-hit { position: absolute; left: 0; right: 0; z-index: 4; pointer-events: none; }
.stage-dialog .vex-staff-hit, .paper--preview .vex-staff-hit { display: none; }
.is-note-mode .vex-staff-hit { pointer-events: auto; cursor: text; }
.vex-host .staff-notes { inset: auto 0 auto 0; }

@media print {
  .vex-host { break-inside: avoid; }
  .vex-host svg path, .vex-host svg rect { fill: #000 !important; stroke: #000 !important; }
  .vex-host svg text { fill: #000 !important; stroke: none !important; }
}

.vex-note-hit.is-selected { background: transparent !important; box-shadow: 0 0 0 2px var(--brass-bright), 0 0 0 5px rgba(229,180,102,.18) !important; border-radius: 50%; outline: none; }
.vex-host svg .vf-stavenote.is-selected .vf-notehead text { fill: var(--brass-bright, #e5b466) !important; }
.vex-host svg .vf-stavenote.is-selected .vf-stem path { stroke: var(--brass-bright, #e5b466) !important; }
.vex-host svg .vf-stavenote.is-selected .vf-flag path { stroke: var(--brass-bright, #e5b466) !important; }
.vex-host svg .vf-stavenote.is-selected .vf-notehead { filter: drop-shadow(0 0 2.5px rgba(229,180,102,.7)); }

.vex-clef-hit {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  z-index: 7;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}
.vex-clef-hit:hover { background: rgba(229,180,102,.08); }
.paper--preview .vex-clef-hit, .paper--stage .vex-clef-hit { display: none; }

.vex-note-selection {
  fill: rgba(229,180,102,.16) !important;
  stroke: var(--brass-bright, #e5b466) !important;
  stroke-width: 1.4;
  pointer-events: none;
}

.vex-key-hit {
  position: absolute;
  top: 0;
  height: 100%;
  z-index: 7;
  border: 0;
  border-radius: 0 7px 7px 0;
  background: transparent;
  cursor: pointer;
}
.vex-key-hit:hover { background: rgba(229,180,102,.06); }
.paper--preview .vex-key-hit, .paper--stage .vex-key-hit { display: none; }

.clef-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.clef-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 124px; padding: 6px 6px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); cursor: pointer; touch-action: manipulation; overflow: hidden; }
.clef-tile:hover { border-color: var(--brass); }
.clef-tile.is-active { border-color: var(--brass); background: rgba(229,180,102,.12); }
.clef-symbol { display: flex; align-items: center; justify-content: center; width: 100%; height: 60px; font-family: "Bravura", serif; font-size: 29px; line-height: 1; color: var(--brass-bright); }
.clef-tile strong { font: 600 13px/1.2 var(--font-ui); color: var(--text); }
.clef-tile small { color: var(--muted); font-size: 10px; letter-spacing: .04em; }
@media (max-width: 620px) { .clef-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.sheet-autosave-note { align-self: center; margin-left: auto; margin-right: 8px; color: var(--muted); font-size: 11px; letter-spacing: .02em; }
@media (pointer: coarse) {
  .sheet .choice-chip, .sheet .root-choice, .sheet .beat-choice, .sheet .key-tile, .sheet .clef-tile { min-height: 44px; }
  .sheet .chip-row { row-gap: 6px; }
}

#clefSheetRoot .sheet-note { margin: 0 0 14px; line-height: 1.55; }
#clefSheetRoot .clef-grid { margin-top: 4px; }

.export-link { text-decoration: none; }
@media print {
  #libraryView[hidden], #setlistsView[hidden], #editorView[hidden] { display: none !important; }
  body * { visibility: hidden !important; }
  #editorView, #editorView * { visibility: visible !important; }
  #editorView { display: block !important; }
  .appbar, .editor-top, .editor-ribbon, .notation-rail, .editor-statusbar, .playback-bar,
  .page-nav-float, .score-stage > .zoom-float, .score-stage > .input-legend,
  .sheet, .stage-dialog, .toast, .vex-note-hits, .vex-staff-hit, .vex-clef-hit,
  .vex-key-hit, .bar-menu-btn, .bar-add, .bar-no, .vex-note-selection { display: none !important; }
  .paper-scale-box, .score-stage, .editor-workspace, .editor-body, .editor-shell { transform: none !important; overflow: visible !important; height: auto !important; }
  #editorView .paper { position: static !important; transform: none !important; width: 900px !important; min-height: 0 !important; margin: 0 auto !important; zoom: .78; box-shadow: none !important; border: 0 !important; background: #fff !important; color: #000 !important; }
  #editorView .paper * { color: #000 !important; }
  #editorView .vex-host svg path, #editorView .vex-host svg rect { fill: #000 !important; stroke: #000 !important; }
  #editorView .vex-host svg text { fill: #000 !important; stroke: none !important; }
  #editorView .ink-canvas { display: block !important; visibility: visible !important; }
  .system, .vex-host { break-inside: avoid; }
}

.settings-general-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.settings-general-row:last-child { border-bottom: 0; }
.settings-general-row > span { color: var(--text-soft); font-size: 13px; font-weight: 600; }
.settings-general-row .segmented { flex-wrap: wrap; }
.settings-language { min-width: 180px; }
.settings-beta-note { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 8px 0 0; }

.settings-slider-wrap { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; }
.settings-slider { flex: 1; min-width: 140px; accent-color: var(--brass); cursor: pointer; }
.settings-scale-value { min-width: 42px; text-align: right; font-weight: 700; color: var(--brass-bright); font-variant-numeric: tabular-nums; }

@media (pointer: coarse) { .search-kbd { display: none; } .bar-menu-btn { opacity: .6; } }

.is-chord-mode .bar-add { pointer-events: none; }

/* Tablet touch targets: footer zoom/page controls */
@media (pointer: coarse) and (min-width: 681px) {
  .editor-statusbar { min-height: 54px; padding-top: 5px; padding-bottom: 5px; }
  .editor-statusbar .status-page { min-width: 44px; min-height: 44px; justify-content: center; border-radius: 7px; }
  .editor-statusbar .page-nav .status-page { width: 44px; height: 44px; }
  .editor-statusbar .status-page .icon { width: 18px; height: 18px; }
  .editor-statusbar #editorZoomLabel { min-width: 42px; font-size: 10px; }
}

/* Hide add-chord copy on touch; the empty bar remains tappable */
@media (pointer: coarse), (any-pointer: coarse) {
  .bar-add-hint, .bar.is-empty .bar-add-hint { opacity: 0 !important; }
}

/* Print all pages: hidden on screen, one print job with page breaks */
#printScores { display: none; }
@media print {
  html.is-print-all #editorView, html.is-print-all #editorView * { display: none !important; visibility: hidden !important; }
  html.is-print-all #printScores, html.is-print-all #printScores * { visibility: visible !important; }
  html.is-print-all #printScores { display: block !important; }
  #printScores .print-score-page { break-after: page; page-break-after: always; }
  #printScores .print-score-page:last-child { break-after: auto; page-break-after: auto; }
  #printScores .paper { position: static !important; width: 900px !important; min-height: 0 !important; margin: 0 auto !important; padding: 26px 28px 20px !important; zoom: .78; box-shadow: none !important; border: 0 !important; background: #fff !important; color: #000 !important; }
  #printScores .paper * { color: #000 !important; }
  #printScores .ink-canvas { display: none !important; }
  #printScores .vex-host svg path, #printScores .vex-host svg rect { fill: #000 !important; stroke: #000 !important; }
  #printScores .vex-host svg text { fill: #000 !important; stroke: none !important; }
  #printScores .system, #printScores .vex-host { break-inside: avoid; }
}

.bpm-stepper { display: flex; align-items: center; gap: 4px; }
.bpm-stepper .bpm-step { min-width: 40px; min-height: 40px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text-soft); background: var(--surface-2); font-size: 12px; font-weight: 650; }
.bpm-stepper .bpm-step:hover { color: var(--text); border-color: var(--brass); }
.bpm-stepper .bpm-input { flex: 1 1 64px; min-width: 54px; text-align: center; font-variant-numeric: tabular-nums; }
.bpm-presets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.bpm-presets .choice-chip { min-height: 32px; padding: 3px 8px; }
.tempo-preview { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 4px 0 14px; }
.tempo-preview strong { font-family: var(--font-display); font-size: 48px; font-weight: 400; line-height: 1; color: var(--paper-ink, var(--text)); }
.tempo-preview span { color: var(--muted-2); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.score-tempo-edit { display: inline; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.score-tempo-edit:hover, .score-tempo-edit:focus-visible { color: var(--brass-bright); text-decoration: underline; text-underline-offset: 2px; }

/* Score layout controls: independent notation and chord sizes */
.paper { --chord-base: 17px; --note-scale: 1; --chord-scale: 1; }
.paper--preview { --chord-base: 15px; }
.paper--stage { --chord-base: 20px; }
.paper--stage.stage-font-small { --chord-base: 16px; }
.paper--stage.stage-font-large { --chord-base: 23px; }
.paper .chord-btn { font-size: calc(var(--chord-base) * var(--chord-scale, 1)); }
.paper .bar[data-chords="3"] .chord-btn, .paper .bar[data-chords="4"] .chord-btn { font-size: calc(13.5px * var(--chord-scale, 1)); }
.vex-host { zoom: var(--note-scale, 1); }
.vex-note-hit.is-selected { background: transparent !important; box-shadow: none !important; }
.vex-host svg .vf-stavenote.is-selected .vf-notehead { filter: drop-shadow(0 0 4px rgba(229,180,102,.9)); }
.vex-host svg .vf-stavenote.is-selected .vf-notehead text { fill: var(--brass-bright, #e5b466) !important; }
.vex-host svg .vf-stavenote.is-selected .vf-stem path, .vex-host svg .vf-stavenote.is-selected .vf-flag path { stroke: var(--brass-bright, #e5b466) !important; }


.scale-control { display: flex; align-items: center; gap: 6px; }
.scale-control input[type="range"] { flex: 1; min-height: 34px; accent-color: var(--brass); }
.scale-step { min-width: 44px; min-height: 44px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-2); color: var(--text-soft); font-size: 11px; font-weight: 650; }
.scale-step:active { color: var(--brass-bright); border-color: var(--brass); }


/* Settings: per-song sheet view (moved from the old "Вид листа" sheet) */
.settings-section--card {
  padding: 13px 14px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.settings-layout { gap: 10px; }
.settings-layout-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.settings-layout-head > div { min-width: 0; display: grid; gap: 3px; }
.settings-layout-context { margin: 0; font-size: 11px; line-height: 1.45; color: var(--muted); }
.settings-layout-context strong { color: var(--text-soft); font-weight: 650; }
.settings-badge {
  flex: 0 0 auto; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted-2); font-size: 9px; font-weight: 650; letter-spacing: .04em; white-space: nowrap;
}
.settings-reset {
  flex: 0 0 auto; min-height: 44px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--muted);
  font-size: 11px; font-weight: 650;
}
.settings-reset:hover { color: var(--text); border-color: var(--line-strong); }
.settings-layout-field { display: grid; gap: 7px; }
.settings-layout-label {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap;
  gap: 4px 10px; color: var(--text-soft); font-size: 12px; font-weight: 650;
}
.settings-layout-label label, .settings-layout-label > span { min-width: 0; }
.settings-layout-label small {
  flex-basis: 100%; order: 2; font-size: 10px; font-weight: 400; line-height: 1.4; color: var(--muted-2);
}
.settings-layout-label output {
  margin-left: auto; color: var(--brass-bright); font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.settings-layout-chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.settings-layout .choice-chip { min-height: 44px; padding: 0 4px; font-size: 11px; }
.settings-layout .scale-control input[type="range"] {
  min-height: 44px; height: 44px; padding: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.settings-layout .scale-control input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px; border: 1px solid var(--line-soft);
  background: linear-gradient(to right, var(--brass) 0 var(--range-pct, 50%), var(--surface-4) var(--range-pct, 50%) 100%);
}
.settings-layout .scale-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--brass); border: 2px solid var(--surface); box-shadow: var(--shadow-1);
}
.settings-layout .scale-control input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 999px; border: 1px solid var(--line-soft); background: var(--surface-4);
}
.settings-layout .scale-control input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brass); }
.settings-layout .scale-control input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brass); border: 2px solid var(--surface); box-shadow: var(--shadow-1);
}
.settings-layout .scale-step { min-width: 44px; min-height: 44px; }
.settings-layout-note { margin: 0; font-size: 10px; line-height: 1.45; color: var(--muted-2); }
.settings-helper { margin: 0; font-size: 11px; line-height: 1.5; color: var(--muted); }
.settings-layout-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 7px; background: var(--surface);
}
.settings-layout-cta-copy { display: grid; gap: 2px; min-width: 0; }
.settings-layout-cta-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-soft); }
.settings-layout-cta-copy span { font-size: 10px; color: var(--muted-2); }
.settings-open-song { flex: 0 0 auto; min-height: 44px; padding: 0 11px; font-size: 11px; }
@media (max-width: 480px) {
  .settings-layout-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .settings-layout .choice-chip { font-size: 10px; }
  .settings-layout-label { font-size: 11px; }
}


.paper, .vex-note-hit, .chord-btn, .bar-menu-btn { -webkit-tap-highlight-color: transparent; }
.vex-note-hit:focus, .vex-note-hit:focus-visible { outline: none !important; box-shadow: none !important; }

.system-chord-gutter { position: relative; }
.system-section-label { position: absolute; left: 8px; top: 2px; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; padding: 2px 6px; border: 1px solid rgba(229,180,102,.38); border-radius: 4px; background: rgba(229,180,102,.06); color: var(--brass-bright); font-family: var(--font-display); font-size: 14px; line-height: 1; }

/* Per-song read-only view */
.editor-shell.view-mode .editor-workspace { grid-template-columns: minmax(0, 1fr); }
.editor-shell.view-mode .editor-ribbon,
.editor-shell.view-mode .notation-rail,
.editor-shell.view-mode .bar-menu-btn,
.editor-shell.view-mode .bar-add,
.editor-shell.view-mode .bar-add-hint,
.editor-shell.view-mode .vex-note-hits,
.editor-shell.view-mode .vex-staff-hit,
.editor-shell.view-mode .vex-clef-hit,
.editor-shell.view-mode .vex-key-hit { display: none !important; }
.editor-shell.view-mode .chord-btn { pointer-events: none; }
.editor-shell.view-mode .editor-statusbar .left,
.editor-shell.view-mode .editor-statusbar .input-hint { display: none !important; }
.editor-shell.view-mode .score-stage { padding-top: 18px; }

.paper { -webkit-user-select: none; user-select: none; }

.ribbon-undo-group { margin-left: auto; }

/* Exclusive editor modes: one mode provider, one contextual rail */
.editor-mode-rail { flex: 0 0 max(104px, calc(92px * var(--ui-scale))); width: max(104px, calc(92px * var(--ui-scale))); gap: 4px; padding: 9px 6px; }
.editor-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.editor-mode-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 42px; padding: 5px 2px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); font-size: 7px; font-weight: 650; letter-spacing: .02em; }
.editor-mode-tab .icon { width: 16px; height: 16px; }
.editor-mode-tab:hover { background: var(--surface-2); color: var(--text); }
.editor-mode-tab.is-active { color: var(--brass-bright); background: rgba(229,180,102,.09); border-color: rgba(229,180,102,.24); }
.editor-mode-panel { display: flex; flex-direction: column; gap: 3px; min-height: 0; }
.rail-color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; justify-items: center; padding: 2px 0; }
.rail-color-grid .color-dot { width: 20px; height: 20px; }
.rail-size-grid { display: flex; justify-content: center; gap: 4px; padding: 2px 0; }
.rail-duration-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.rail-duration-grid .duration-btn { height: 44px; }
.rail-hint { margin: 4px 2px 6px; color: var(--muted); font-size: 9px; line-height: 1.35; text-align: center; }
.rail-bottom { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.rail-bottom .undo-group { justify-content: center; }
.rail-bottom .rail-finger { flex: 1 1 auto; min-width: 0; min-height: 32px; padding: 4px; justify-content: center; gap: 2px; }
.rail-bottom .rail-finger .switch-mini { display: none; }
.rail-bottom .undo-group { flex: 0 0 auto; }
.rail-bottom .undo-group .icon-btn { width: 27px; height: 30px; }
@media (max-width: 720px) {
  .editor-mode-rail { flex: 1 1 auto; width: 100%; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; height: auto; }
  .editor-mode-tabs { display: flex; flex: 0 0 auto; }
  .editor-mode-tab { min-width: 46px; min-height: 46px; }
  .editor-mode-panel { flex: 0 0 auto; flex-direction: row; align-items: center; }
  .rail-color-grid { grid-template-columns: repeat(6, 1fr); }
  .rail-duration-grid { grid-template-columns: repeat(5, 1fr); }
  .rail-bottom { margin-left: auto; margin-top: 0; padding-top: 0; padding-left: 6px; border-top: 0; border-left: 1px solid var(--line-soft); flex: 0 0 auto; }
}

/* Global interface scale + larger page controls */
:root { --ui-scale: 1; }
.appbar { min-height: calc(58px * var(--ui-scale)); }
.editor-top { min-height: calc(60px * var(--ui-scale)); }
.btn { min-height: calc(38px * var(--ui-scale)); font-size: calc(13px * var(--ui-scale)); }
.icon-btn { width: calc(36px * var(--ui-scale)); height: calc(34px * var(--ui-scale)); }
.editor-mode-rail { flex-basis: calc(92px * var(--ui-scale)); width: calc(92px * var(--ui-scale)); }
.editor-mode-tab { min-height: calc(42px * var(--ui-scale)); font-size: calc(7px * var(--ui-scale)); }
.editor-mode-tab .icon { width: calc(16px * var(--ui-scale)); height: calc(16px * var(--ui-scale)); }
.status-page { width: calc(30px * var(--ui-scale)); height: calc(30px * var(--ui-scale)); }
.playback-bar { min-height: calc(38px * var(--ui-scale)); }
.editor-statusbar { min-height: calc(44px * var(--ui-scale)); font-size: calc(11px * var(--ui-scale)); }
/* Page navigation must be easy to hit, independent of the 100% UI scale. */
.page-nav .status-page { width: 44px; height: 42px; border-radius: 8px; }
.page-nav .status-page .icon { width: 21px; height: 21px; }
.page-nav .editor-page-label { min-width: 78px; font-size: 13px; }
@media (max-width: 720px) {
  .page-nav .status-page { width: 46px; height: 44px; }
  .page-nav .editor-page-label { min-width: 70px; }
}

/* =========================================================================
   Design review P1/P2: readability, targets, selected states, stage, settings
   ========================================================================= */
:root { --tap: 44px; }

/* --- contrast + type scale ------------------------------------------------ */
.eyebrow { font-size: 11px; letter-spacing: .13em; }
.brand-tag { font-size: 10px; }
.field-label { font-size: 13px; }
.field-hint, .sheet-note, .sheet-hint, .preview-help, .sheet-dialog-hint { font-size: 12px; line-height: 1.55; }
.sheet-section-title, .settings-title, .sheet-section-title .muted { font-size: 11px; letter-spacing: .10em; }
.choice-chip { font-size: 13px; }
.keyboard-label { font-size: 11px; }
.chord-preview-label { font-size: 10px; }
.chord-preview-meta { font-size: 11px; }
.beat-choice { font-size: 12px; }

.song-title { font-size: 15px; }
.song-sub { font-size: 12px; }
.song-bpm, .song-bpm strong { font-size: 12px; }
.library-foot, .preview-help { font-size: 12px; }
.chip { font-size: 12px; }
.sort-select { font-size: 12px; min-height: 40px; }
.empty-list p, .library-empty-hero p { font-size: 13px; line-height: 1.55; }
.preview-heading p { font-size: 13px; }

.setlist-list-name strong { font-size: 14px; }
.setlist-list-name span, .setlist-count { font-size: 12px; }
.setlist-meta { font-size: 12px; }
.setlist-song-title { font-size: 14px; }
.setlist-song-sub, .setlist-bpm, .setlist-bpm strong, .setlist-pos { font-size: 12px; }
.setlist-detail-foot, .setlist-empty p, .setlist-picker-empty { font-size: 12px; line-height: 1.55; }
.setlist-add-row { font-size: 13px; }
.tag-choice, .picker-row span { font-size: 12px; }

.editor-statusbar { font-size: max(12px, calc(11px * var(--ui-scale))); min-height: max(48px, calc(44px * var(--ui-scale))); }
.editor-page-label { font-size: 12px; }
.editor-save { font-size: 12px; }
.input-hint { font-size: 11px; }
.status-page { font-size: 12px; }
.rail-label { font-size: 11px; letter-spacing: .07em; }
.duration-btn span { font-size: 10px; }
.rail-mini-btn, .rail-grid-toggle button { font-size: 11px; }
.editor-mode-tab { font-size: 10px; }
.rail-hint { font-size: 11px; }

.stage-kicker { font-size: 10px; }
.stage-set-title { font-size: clamp(18px, 1.7vw, 23px); }
.stage-page-ind { font-size: 13px; }
.stage-wake { font-size: 11px; }
.stage-page-number { font-size: 12px; }
.scene-song-title { font-size: clamp(17px, 1.6vw, 22px); }
.scene-song-sub { font-size: 12px; }
.scene-bpm { font-size: 13px; }
.scene-pos .pos-val { font-size: 12px; }
.scene-mode button { font-size: 12px; }
.scene-font button { font-size: 12px; }

/* --- touch targets ------------------------------------------------------- */
.icon-btn { width: max(var(--tap), calc(36px * var(--ui-scale))); height: max(var(--tap), calc(36px * var(--ui-scale))); }
.icon-btn--sm { width: var(--tap); height: var(--tap); }
.btn-sm { min-height: var(--tap); }
.song-fav, .song-more { width: var(--tap); height: var(--tap); }
.song-fav .icon, .song-more .icon { width: 19px; height: 19px; }
.song-more { display: grid; opacity: .62; }
.song-more:hover, .song-more:focus-visible { opacity: 1; }
.song-row-btn { min-height: 58px; }
.setlist-open { min-height: 60px; }
.setlist-dupe { width: var(--tap); height: var(--tap); }
.setlist-row { min-height: 56px; }
.setlist-row .drag-handle { width: var(--tap); height: var(--tap); }
.setlist-row .drag-handle .icon { width: 18px; height: 18px; }
.setlist-row-menu { width: var(--tap); height: var(--tap); }
.setlist-detail-actions .icon-btn { width: var(--tap); height: var(--tap); }
.status-page { min-width: var(--tap); min-height: var(--tap); display: inline-grid; place-items: center; }
.page-nav .status-page { width: var(--tap); height: var(--tap); }
.page-nav .editor-page-label { min-width: 88px; font-size: 13px; }
.zoom-float button, .page-nav-pill button { width: var(--tap); height: var(--tap); }
.editor-mode-tab { min-height: 48px; }
.duration-btn { height: 46px; }
.rail-mini-btn { min-height: 40px; }
.rail-bottom .rail-finger { min-height: 42px; }
.rail-bottom .undo-group { gap: 2px; }
.rail-bottom .undo-group .icon-btn { width: var(--tap); height: var(--tap); }
.color-dot { width: 22px; height: 22px; border: 1.5px solid rgba(255,255,255,.3); box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.rail-color-grid .color-dot { width: 28px; height: 28px; }
.size-dot { width: 30px; height: 30px; }
.rail-size-grid { gap: 6px; }
.scene-pos button { width: var(--tap); height: var(--tap); }
.scene-mode button { min-height: var(--tap); padding: 0 12px; }
.scene-font button { width: 58px; height: var(--tap); font-size: 12px; padding: 0 6px; }
.scene-key-btn { min-width: 50px; height: var(--tap); font-size: 17px; }
.stage-exit { min-height: var(--tap); }
.stage-side-btn { width: 48px; height: 72px; }
.stage-tapzone { width: 20%; }

/* selected states: shape + text, not colour alone */
.editor-mode-tab { position: relative; border: 1px solid transparent; }
.editor-mode-tab.is-active { border-color: rgba(229,180,102,.55); box-shadow: inset 0 0 0 1px rgba(229,180,102,.16); }
.editor-mode-tab.is-active::after {
  content: ""; position: absolute; left: 25%; right: 25%; bottom: 3px; height: 2px;
  border-radius: 99px; background: var(--brass-bright);
}
.color-dot.is-active { border-color: #fff; box-shadow: 0 0 0 2px var(--brass); }
.setlist-list-item.is-selected .setlist-list-name span { color: var(--brass-bright); }
.setlist-list-item.is-selected .setlist-open { box-shadow: inset 2px 0 0 var(--brass); }
.setlist-tag-dot { border: 1px solid rgba(255,255,255,.5); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }

/* --- stage: use more of the viewport ------------------------------------ */
.paper--stage .score-head, .paper--stage .score-foot { display: none; }
.paper--stage { padding-top: 16px; padding-bottom: 12px; }
.paper--stage .score-systems { padding-top: 0; }
.paper--stage .system { padding-top: 8px; }
.stage-top {
  min-height: 56px;
  padding: max(8px, env(safe-area-inset-top)) clamp(14px, 2vw, 24px) 6px;
  background: linear-gradient(180deg, rgba(6,7,8,.96) 0%, rgba(6,7,8,.68) 72%, rgba(6,7,8,0) 100%);
}
.stage-viewport { padding: 0 clamp(46px, 4.5vw, 74px) 4px; }
.stage-bar {
  min-height: 64px; padding: 7px 10px;
  margin-bottom: max(8px, env(safe-area-inset-bottom));
}
.scene-pos { gap: 2px; padding-right: 10px; }
.scene-pos .pos-val { min-width: 64px; display: flex; align-items: baseline; justify-content: center; gap: 3px; }
.pos-kicker { color: var(--stage-muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.scene-song { padding: 0 6px; }
.scene-meta { gap: 6px; }
.scene-divider { height: 30px; }
.stage-page-number { right: clamp(14px, 2vw, 22px); bottom: 6px; }
.stage-page-ind { padding: 4px 8px; border: 1px solid rgba(255,255,255,.08); border-radius: 999px; color: var(--stage-soft); }

/* --- settings: global vs song ------------------------------------------- */
.settings-song-card { gap: 9px; }
.settings-song-card .settings-title { color: var(--muted-2); }
.settings-song-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.settings-song-values { min-width: 0; display: grid; gap: 2px; }
.settings-song-values strong { color: var(--text-soft); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-song-values span { color: var(--muted-2); font-size: 12px; }
.settings-song-card .settings-layout-note { font-size: 11px; }
.settings-song-card .settings-open-song { min-height: var(--tap); }
.song-layout-sheet { padding: 2px 2px 0; }
.song-layout-sheet .settings-layout-head { margin-bottom: 10px; }
.song-layout-sheet .settings-layout-context { font-size: 12px; }
.song-layout-sheet .settings-layout-chips .choice-chip { min-height: var(--tap); }
.song-layout-sheet .settings-layout-label { font-size: 13px; }
.song-layout-sheet .settings-layout-note { font-size: 11px; }
.song-layout-sheet .scale-step { min-width: var(--tap); min-height: var(--tap); }
.song-layout-sheet .settings-layout-field + .settings-layout-field { margin-top: 12px; }

/* --- import sheet readability ------------------------------------------- */
.import-migrate-hero > span:not(.import-migrate-icon),
.import-scan-empty > span, .import-platform-hint, .import-scan-status { font-size: 12px; line-height: 1.55; }
.import-migrate-hero strong { font-size: 22px; }
.import-scan-head strong { font-size: 14px; }
.import-candidate-name, .import-candidate-count { font-size: 12px; }
.import-scan-actions .btn { min-height: var(--tap); }

@media (max-width: 900px) {
  .scene-font button { width: 54px; font-size: 10px; }
  .scene-mode button { padding: 0 9px; }
  .scene-song-sub { max-width: 34vw; }
  .stage-bar { gap: 5px; }
  .page-nav .editor-page-label { min-width: 74px; }
}
@media (max-width: 720px) {
  .editor-mode-rail { flex-basis: 100%; width: 100%; }
  .rail-bottom { flex-direction: row; align-items: center; }
  .rail-bottom .undo-group .icon-btn { width: var(--tap); height: var(--tap); }
  .stage-top { min-height: 52px; }
  .stage-bar { min-height: 60px; }
  .scene-font button { width: 48px; }
}
.settings-section-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.settings-song-card .settings-section-title-row .settings-layout-context { margin-top: 2px; font-size: 12px; }
.settings-song-values strong { font-size: 15px; }
.scene-key-btn {
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto;
  align-items: center; column-gap: 4px; row-gap: 0; padding: 3px 10px;
  min-width: 88px;
}
.scene-key-label {
  grid-column: 1 / -1; color: var(--stage-muted); font-family: var(--font-ui);
  font-size: 9px; font-weight: 650; letter-spacing: .06em; line-height: 1.1; text-transform: uppercase;
}
.scene-key-btn strong { grid-column: 1; font-family: var(--font-display); font-size: 17px; font-weight: 500; line-height: 1; }
.scene-key-btn .icon { grid-column: 2; align-self: center; }
.pos-kicker { font-size: 9px; }
.editor-mode-rail { flex-basis: max(104px, calc(92px * var(--ui-scale))); width: max(104px, calc(92px * var(--ui-scale))); }
.stage-page-ind { font-size: 13px; }

/* =========================================================================
   Stage UX: one large page pill, sheet theme toggle, idle chrome
   ========================================================================= */
.stage-page-ind {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .01em;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(9, 11, 14, .8);
  color: var(--stage-ink);
  box-shadow: 0 8px 22px rgba(0,0,0,.3);
  backdrop-filter: blur(6px);
}
.scene-sheet button { min-width: 66px; padding: 0 10px; letter-spacing: .01em; }
.scene-sheet button.is-active { color: var(--brass-ink); background: var(--brass); }
.scene-sheet button.is-active:hover { color: var(--brass-ink); background: var(--brass-bright); }

.stage-top-left, .stage-wake, .stage-exit {
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.stage-bar {
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}
.stage-side-btn {
  transition: opacity 240ms var(--ease), color var(--dur-1), background var(--dur-1), border-color var(--dur-1);
}
.stage-dialog.is-chrome-hidden .stage-top { background: none; }
.stage-dialog.is-chrome-hidden .stage-top-left,
.stage-dialog.is-chrome-hidden .stage-wake,
.stage-dialog.is-chrome-hidden .stage-exit {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}
.stage-dialog.is-chrome-hidden .stage-bar {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
}
.stage-dialog.is-chrome-hidden .stage-side-btn {
  opacity: 0;
  pointer-events: none;
}
.stage-dialog.is-chrome-hidden .stage-tapzone { cursor: default; }

@media (max-width: 900px) {
  .scene-sheet button { min-width: 58px; padding: 0 8px; }
}
@media (max-width: 680px) {
  .scene-sheet button { min-width: 54px; padding: 0 7px; font-size: 11px; }
}

/* Tablet library keeps the preview alongside the list; row actions move to the preview toolbar so titles are not squeezed. */
@media (min-width: 721px) and (max-width: 1100px) {
  .song-item .song-fav, .song-item .song-more { display: none; }
  .song-row-btn { padding-right: 12px; }
}

/* Tablet library: the preview header carries BPM, so prioritise the song title and composer. */
@media (min-width: 721px) and (max-width: 1100px) {
  .song-item .song-bpm { display: none; }
}

/* General settings: discrete interface-scale slider */
.settings-ui-scale {
  flex: 1 1 230px; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}
.settings-ui-scale input[type="range"] {
  flex: 1 1 180px; min-width: 130px; max-width: 260px; min-height: 34px;
  accent-color: var(--brass);
}
.settings-ui-scale output {
  flex: 0 0 46px; text-align: right; color: var(--brass-bright); font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.settings-ui-scale datalist { display: none; }
.settings-song-scales { display: grid; gap: 9px; margin-top: 10px; }

/* Give the chord at the start of a bar a little breathing room from the barline. */
.chord-slots > .chord-btn:first-child { margin-left: 8px; }

/* iOS standalone: keep app chrome below the status bar and notch. */
.appbar {
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  padding-left: max(var(--page-pad), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-pad), env(safe-area-inset-right, 0px));
}
.editor-top {
  padding-top: max(8px, env(safe-area-inset-top, 0px));
  padding-left: max(clamp(14px, 1.8vw, 24px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(14px, 1.8vw, 24px), env(safe-area-inset-right, 0px));
}
