/* Chord — styles
   Layout: ink sidebar + light working surface; charts read like a band roadmap,
   with each section's tag (V1, C, B) in a margin column. */

:root {
  /* Palette: cool paper, ink navy, hymnal green for actions, amber for chords */
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #ebeef3;
  --surface-3: #dfe4ec;
  --text: #131b2c;
  --muted: #5e6a80;
  --border: #dce1ea;
  --border-strong: #c5cdda;
  --accent: #13795b;
  --accent-hover: #0f6149;
  --accent-soft: #dcf1e8;
  --accent-text: #ffffff;
  --chord: #b54708;
  --chord-soft: #fcefe3;
  --danger: #c8341f;
  --good: #15803d;
  --good-soft: #e3f4e8;
  --side-bg: #101828;
  --side-text: #e6eaf2;
  --side-muted: #8a96ad;
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(255, 255, 255, .1);
  --side-accent: #5fd3a8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .05);
  --shadow-lg: 0 18px 48px -12px rgba(16, 24, 40, .28), 0 2px 6px rgba(16, 24, 40, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235e6a80' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

  --c-verse: #2f6fdb;
  --c-chorus: #d4520f;
  --c-prechorus: #0e8a7e;
  --c-bridge: #7a4cd9;
  --c-tag: #c2378a;
  --c-intro: #5b7a1a;
  --c-instrumental: #5b7a1a;
  --c-vamp: #b7791f;
  --c-other: #66758c;

  /* Type: Bricolage Grotesque for display, Atkinson Hyperlegible for reading at a distance */
  --font-display: "Bricolage Grotesque", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-chart: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c111b; --surface: #141a26; --surface-2: #1b2230; --surface-3: #242c3d;
    --text: #e7ebf3; --muted: #95a0b5; --border: #232b3a; --border-strong: #323c50;
    --accent: #4fcb9b; --accent-hover: #74d9b2; --accent-soft: #133a2d; --accent-text: #062317;
    --chord: #ffb25b; --chord-soft: #3a2812; --danger: #f17463; --good: #4ade80; --good-soft: #12291b;
    --side-bg: #080c14; --side-text: #e6eaf2; --side-muted: #7e8aa1; --side-hover: rgba(255, 255, 255, .05); --side-active: rgba(255, 255, 255, .09); --side-accent: #5fd3a8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .25);
    --shadow-lg: 0 18px 50px -10px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2395a0b5' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --c-verse: #74a6ff; --c-chorus: #ff9a5a; --c-prechorus: #3fd3c2; --c-bridge: #b39bff; --c-tag: #f58ac4;
    --c-intro: #b3dc5c; --c-instrumental: #b3dc5c; --c-vamp: #f5c25b; --c-other: #9eabc0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c111b; --surface: #141a26; --surface-2: #1b2230; --surface-3: #242c3d;
  --text: #e7ebf3; --muted: #95a0b5; --border: #232b3a; --border-strong: #323c50;
  --accent: #4fcb9b; --accent-hover: #74d9b2; --accent-soft: #133a2d; --accent-text: #062317;
  --chord: #ffb25b; --chord-soft: #3a2812; --danger: #f17463; --good: #4ade80; --good-soft: #12291b;
  --side-bg: #080c14; --side-text: #e6eaf2; --side-muted: #7e8aa1; --side-hover: rgba(255, 255, 255, .05); --side-active: rgba(255, 255, 255, .09); --side-accent: #5fd3a8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .25);
  --shadow-lg: 0 18px 50px -10px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2395a0b5' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --c-verse: #74a6ff; --c-chorus: #ff9a5a; --c-prechorus: #3fd3c2; --c-bridge: #b39bff; --c-tag: #f58ac4;
  --c-intro: #b3dc5c; --c-instrumental: #b3dc5c; --c-vamp: #f5c25b; --c-other: #9eabc0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font: 700 2rem/1.1 var(--font-display); letter-spacing: -.025em; }
.muted { color: var(--muted); }
.small-text { font-size: .84rem; }
.icon { flex: none; display: block; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }

/* ---------- Motion ---------- */
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes itemIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes chipIn { from { opacity: 0; transform: scale(.8); } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(-6px); } }
@keyframes popOut { to { opacity: 0; transform: scale(.97); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@keyframes sinkOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes chordFlip { from { opacity: 0; transform: translateY(-.5em) rotateX(80deg); } }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--sec-color) 16%, transparent); } 100% { background: transparent; } }
@keyframes pulse { 50% { opacity: .3; } }
@keyframes beat { from { transform: scale(1.4); } to { transform: scale(1); } }
@keyframes slideInR { from { opacity: 0; transform: translateX(48px); } }
@keyframes slideInL { from { opacity: 0; transform: translateX(-48px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.96); } }

.page.enter { animation: pageIn .38s var(--ease) both; }
.page.enter .stagger > *, .page.enter .chart > .sec {
  animation: itemIn .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 38ms + 80ms);
}
.page.enter .arr-chip { animation: chipIn .4s var(--spring) both; animation-delay: calc(var(--i, 0) * 30ms + 120ms); }

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

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; padding: 16px 12px 12px;
}
.main { min-width: 0; }
.page {
  max-width: 1040px; margin: 0 auto;
  padding-block: 32px 96px;
  padding-left: max(36px, env(safe-area-inset-left, 0px));
  padding-right: max(36px, env(safe-area-inset-right, 0px));
}
.topbar { display: none; }
.scrim { display: none; }
.only-mobile { display: none !important; }

.brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 18px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 750 1.3rem/1 var(--font-display); letter-spacing: -.03em; text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--side-accent); color: #062317;
  transition: transform .3s var(--spring);
}
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }
.side-actions { padding: 0 2px 14px; }
.sidebar .btn.primary { background: var(--side-accent); border-color: var(--side-accent); color: #062317; box-shadow: none; }
.sidebar .btn.primary:hover:not(:disabled) { background: #7fe0bd; border-color: #7fe0bd; }
.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item, .folder-toggle {
  position: relative;
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 9px; text-decoration: none;
  color: var(--side-text); background: none; border: 0; cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item .icon, .folder-toggle .icon { color: var(--side-muted); }
.nav-item:hover, .folder-toggle:hover { background: var(--side-hover); }
.nav-item.active { background: var(--side-active); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent); }
.nav-item.active .icon { color: var(--side-accent); }
.nav-item.sub { padding-left: 34px; font-size: .93rem; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-meta { color: var(--side-muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 6px 10px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--side-muted); }
.nav-heading a { text-decoration: none; }
.nav-heading a:hover { color: var(--side-text); }
.nav-heading-actions { display: flex; gap: 2px; }
.sidebar .icon-btn { color: var(--side-muted); }
.sidebar .icon-btn:hover { background: var(--side-hover); color: var(--side-text); }
.folder-row { display: flex; align-items: center; }
.folder-row .icon-btn { opacity: 0; transition: opacity .15s; }
.folder-row:hover .icon-btn, .folder-row .icon-btn:focus-visible { opacity: 1; }
.folder-label { margin: 12px 10px 2px; font-size: .78rem; color: var(--side-muted); }
.nav-empty { padding: 4px 10px 4px 34px; color: var(--side-muted); font-size: .86rem; }
.side-foot { display: flex; gap: 6px; align-items: center; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; margin-top: 12px; }
.sync-status { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: .8rem; color: var(--side-muted); cursor: default; }
.sync-status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--side-muted); transition: background .3s; }
.sync-status.s-synced .sync-dot { background: var(--side-accent); box-shadow: 0 0 0 3px rgba(95, 211, 168, .18); }
.sync-status.s-saving .sync-dot, .sync-status.s-connecting .sync-dot { background: #8fb4ff; animation: pulse 1s ease-in-out infinite; }
.sync-status.s-offline .sync-dot { background: #f17463; }
.sync-status.s-readonly .sync-dot { background: #ffb25b; }
.side-gear { transition: transform .4s var(--spring), background .15s, color .15s; }
.side-gear:hover { transform: rotate(45deg); }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
  font-weight: 700; font-size: .92rem; text-decoration: none; line-height: 1.2;
  transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease), box-shadow .15s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.small { padding: 6px 11px; font-size: .86rem; }
.btn.icon-only { padding: 8px; }
.btn.small.icon-only { padding: 6px; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.btn.toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:focus-visible, .icon-btn:focus-visible, .input:focus-visible, a:focus-visible, .arr-chip:focus-visible, .ch:focus-visible,
.key-chip:focus-visible, .meta-btn:focus-visible, .seg-btn:focus-visible, .key-cell:focus-visible, .capo-cell:focus-visible, .menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.danger-text { color: var(--danger) !important; }
.aa { font: 800 1rem/1 var(--font-display); }
.aa.small-a { font-size: .74rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; background: transparent; border-radius: 9px; color: var(--muted); cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s, transform .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.disabled { opacity: .3; pointer-events: none; }
.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-weight: 700; }
.split-btn { display: inline-flex; }
.split-btn .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-btn .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(255, 255, 255, .25); padding-inline: 9px; }

.input {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .2s;
}
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.input.small { padding: 6px 9px; font-size: .88rem; width: auto; }
select.input {
  width: auto; padding-right: 38px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: var(--chevron); background-repeat: no-repeat;
  background-position: right 12px center; background-size: 14px 14px;
}
select.input.small { padding: 6px 34px 6px 10px; background-position: right 10px center; }
textarea.input { resize: vertical; }
.mono { font-family: var(--font-mono); font-size: .9rem; line-height: 1.5; white-space: pre; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .82rem; font-weight: 700; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: span 2; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }

/* switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 2px; cursor: pointer; }
.switch-text { display: flex; flex-direction: column; min-width: 0; font-weight: 700; font-size: .93rem; }
.switch-hint { font-weight: 400; font-size: .8rem; color: var(--muted); }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 40px; height: 24px; border-radius: 999px; background: var(--surface-3); position: relative;
  transition: background .2s var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--spring);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* segmented */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 11px; }
.seg-btn { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: .86rem; font-weight: 700; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .14); }
/* In stacked option panels the control fills its row, with equal-width choices. */
.field .segmented { display: flex; }
.field .segmented .seg-btn { flex: 1; padding-inline: 6px; }

.tag { display: inline-flex; padding: 1px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; color: var(--muted); border: 1px solid var(--border); }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; background: var(--surface-2); font-size: .8rem; font-weight: 700; }
.pill.good { background: var(--good-soft); color: var(--good); }
.tool-label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* key chip */
.key-chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 5px 10px 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  transition: border-color .15s, background .15s, transform .12s var(--ease);
}
.key-chip:hover { background: var(--surface-2); }
.key-chip:active { transform: scale(.96); }
.key-chip .icon { color: var(--muted); }
.key-chip-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.key-chip-value { font: 800 1.15rem/1 var(--font-display); color: var(--chord); min-width: 1.2em; text-align: center; }
.key-chip-sub { font-size: .78rem; font-weight: 700; color: var(--muted); }
.key-chip.moved { border-color: color-mix(in srgb, var(--chord) 55%, transparent); background: var(--chord-soft); }
.key-chip.small { padding: 4px 8px 4px 11px; gap: 6px; }
.key-chip.small .key-chip-value { font-size: 1rem; }

.meta-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid transparent; background: var(--surface-2); color: var(--muted); font-size: .86rem; font-weight: 700; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.meta-btn:hover { color: var(--text); border-color: var(--border-strong); }
.meta-btn.metro.on { background: var(--chord-soft); color: var(--chord); }
.metro.beat .icon { animation: beat .2s ease-out; }
.metro.accent .icon { color: var(--chord); }

/* ---------- Page chrome ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 700; margin-bottom: 10px; transition: color .15s, gap .2s var(--ease); }
.back:hover { color: var(--text); gap: 7px; }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
.empty.small { padding: 32px 12px; }
.empty p { margin: 0 0 16px; }
.toolbar-row { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }
.search-wrap { position: relative; flex: 1; }
.search-wrap .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-wrap .input { padding-left: 38px; border-radius: 999px; background: var(--surface); }

/* ---------- Library ---------- */
.song-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.song-list:has(> .empty) { background: none; border: 0; }
.song-row { display: flex; align-items: center; gap: 4px; padding-right: 8px; border-top: 1px solid var(--border); transition: background .15s; }
.song-row:first-child { border-top: 0; }
.song-row:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.song-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 12px 8px 12px 14px; text-decoration: none; }
.song-key {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  background: var(--chord-soft); color: var(--chord); font: 800 1.05rem/1 var(--font-display);
  transition: transform .25s var(--spring);
}
.song-row:hover .song-key { transform: rotate(-4deg) scale(1.05); }
.song-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.song-title { font-weight: 700; font-size: 1.05rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-sub { color: var(--muted); font-size: .86rem; line-height: 1.25; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-row-meta { display: flex; gap: 6px; align-items: center; flex: none; }
.song-bpm { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; }
.row-more { opacity: 0; transition: opacity .15s, background .15s; }
.song-row:hover .row-more, .set-item:hover .row-more, .row-more:focus-visible { opacity: 1; }
@media (hover: none) { .row-more { opacity: 1; } }
.sort-btn { flex-direction: row-reverse; }
.mini-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-chip {
  --sec-color: var(--c-other);
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; font-size: .74rem; font-weight: 800;
  color: var(--sec-color); background: color-mix(in srgb, var(--sec-color) 13%, transparent); border: 0; cursor: default;
}
button.mini-chip { cursor: pointer; padding: 5px 10px; font-size: .84rem; }



/* ---------- Import ---------- */
.import-page { max-width: 1280px; }
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.import-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.import-meta { display: flex; flex-direction: column; gap: 2px; }
.title-input {
  font: 700 1.9rem/1.15 var(--font-display); letter-spacing: -.025em;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; padding: 2px 8px; margin-left: -9px; width: 100%;
  transition: border-color .15s, background .15s;
}
.title-input:hover { border-color: var(--border); }
.title-input:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.artist-input { border: 1px solid transparent; background: transparent; padding: 3px 8px; margin-left: -9px; border-radius: 8px; color: var(--muted); font-size: 1rem; }
.artist-input:hover { border-color: var(--border); }
.artist-input:focus { border-color: var(--accent); outline: none; background: var(--surface); color: var(--text); }
.import-details { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.mini-field { display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.mini-field .input { width: 96px; text-transform: none; letter-spacing: 0; font-size: .92rem; }
.mini-field select.input { width: auto; }
.paste { min-height: 440px; font-family: var(--font-mono); font-size: .88rem; line-height: 1.55; white-space: pre; overflow-x: auto; border-radius: var(--radius); }
.fix-row { padding: 2px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.import-right { position: sticky; top: 16px; min-width: 0; }
.parse-status { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-height: 28px; align-items: center; }
.preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; max-height: calc(100vh - 150px); overflow: auto; --chart-size: 15px; font-size: 15px; box-shadow: var(--shadow); }
.preview-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.preview-head strong { font: 700 1.2rem/1.2 var(--font-display); }

/* ---------- Song view ---------- */
.song-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.song-top .back { margin-bottom: 6px; }
.set-nav { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.set-pos { font-size: .84rem; font-weight: 700; color: var(--muted); padding: 0 6px; font-variant-numeric: tabular-nums; }
.song-head { margin-bottom: 16px; }
.song-h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
.song-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: .95rem; }
.song-notes { display: flex; align-items: flex-start; gap: 9px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); }
.song-notes .icon { margin-top: 3px; color: var(--accent); }
.song-toolbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 0; margin: 0 0 8px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-radius: 0 0 var(--radius) var(--radius);
}
.song-toolbar.editing { padding: 10px 12px; margin-bottom: 20px; background: var(--chord-soft); box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--chord) 25%, transparent); border-radius: var(--radius); top: calc(env(safe-area-inset-top, 0px) + 6px); }
.song-toolbar.editing.appear { animation: pageIn .3s var(--ease); }
.editing-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--chord); padding-left: 4px; }
.editing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chord); animation: pulse 1.4s ease-in-out infinite; }
.tool-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tool-group.right { margin-left: auto; }
.edit-hint { margin: 0 0 14px; font-size: .86rem; color: var(--muted); }

.arr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 22px; }

/* Song body: chart on the left, arrangement roadmap in a sticky right rail. */
.song-page { max-width: 1200px; }
.song-body { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 0 32px; align-items: start; }
.song-main { min-width: 0; grid-column: 1; grid-row: 1; }
.arr-rail {
  grid-column: 2; grid-row: 1;
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px);
  max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 10px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.page.enter .arr-rail { animation: pageIn .4s var(--ease) both; }
.arr-rail-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 10px; }
.arr-rail-count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.arr-rail .arr-bar { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 8px; margin: 0; }
.arr-rail .arr-chips { flex-direction: column; flex-wrap: nowrap; gap: 6px; }
.arr-rail .arr-chip { gap: 9px; padding: 6px 6px 6px 7px; border-radius: 10px; background: transparent; color: var(--text); }
.arr-rail .arr-chip:hover { transform: none; box-shadow: none; background: var(--surface-2); }
.arr-rail .arr-chip-label {
  display: inline-grid; place-items: center; min-width: 2.3em; padding: 4px 6px; border-radius: 7px;
  color: var(--sec-color); background: color-mix(in srgb, var(--sec-color) 14%, transparent);
}
.arr-rail .arr-chip-name { flex: 1; min-width: 0; font: 700 .9rem/1.2 var(--font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arr-rail .arr-chips:not(.editable) .arr-chip + .arr-chip::before { left: calc(7px + 1.15em); top: -7px; width: 1.5px; height: 8px; }
.arr-rail .arr-chips.editable .arr-chip { border: 1px dashed color-mix(in srgb, var(--sec-color) 40%, transparent); }
.arr-rail .arr-chip.current { background: color-mix(in srgb, var(--sec-color) 12%, var(--surface)); }
.arr-rail .arr-chip { transition: background .25s ease, scale .2s var(--spring), box-shadow .2s; }
.arr-rail .arr-chip.dragging { background: var(--surface); scale: 1.04; }
.arr-rail .arr-x { color: var(--muted); }
.arr-rail .arr-add { width: 100%; justify-content: center; }
.arr-rail .arr-add.icon-only::after { content: "Add section"; font-size: .84rem; }
.arr-rail .custom-pill { align-self: flex-start; }
.arr-chip-name { display: none; }
.arr-chip-count { font: 800 .76rem/1 var(--font-display); padding: 3px 6px; border-radius: 6px; color: var(--sec-color); background: color-mix(in srgb, var(--sec-color) 16%, transparent); margin-left: 4px; }
.arr-rail .arr-chip-count { margin-left: 0; }
.arr-rail .arr-chip-name { display: block; }
@media (max-width: 1180px) {
  /* Not enough room for a side rail: the roadmap goes back above the chart. */
  .song-body { display: block; }
  .arr-rail { position: static; max-height: none; overflow: visible; padding: 0; background: none; border: 0; animation: none; }
  .arr-rail-head { display: none; }
  .arr-rail .arr-bar { flex-direction: row; flex-wrap: wrap; align-items: center; margin: 4px 0 22px; }
  .arr-rail .arr-chips { flex-direction: row; flex-wrap: wrap; }
  .arr-rail .arr-chip { gap: 2px; padding: 5px 11px; border-radius: 9px; background: color-mix(in srgb, var(--sec-color) 13%, var(--surface)); color: var(--sec-color); }
  .arr-rail .arr-chip:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--sec-color) 13%, var(--surface)); }
  .arr-rail .arr-chip-label { display: inline; min-width: 0; padding: 0; background: none; }
  .arr-rail .arr-chip-name { display: none; }
.arr-chip-count { font: 800 .76rem/1 var(--font-display); padding: 3px 6px; border-radius: 6px; color: var(--sec-color); background: color-mix(in srgb, var(--sec-color) 16%, transparent); margin-left: 4px; }
.arr-rail .arr-chip-count { margin-left: 0; }
  .arr-rail .arr-chips:not(.editable) .arr-chip + .arr-chip::before { left: -6px; top: 50%; width: 6px; height: 1.5px; }
  .arr-rail .arr-chip.current { box-shadow: 0 0 0 2px color-mix(in srgb, var(--sec-color) 50%, transparent); }
  .arr-rail .arr-add { width: auto; }
  .arr-rail .arr-add.icon-only::after { content: none; }
  .arr-rail .arr-x { color: inherit; }
}
.arr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.arr-chip {
  --sec-color: var(--c-other);
  position: relative;
  display: inline-flex; align-items: center; gap: 2px; padding: 5px 11px; border-radius: 9px;
  background: color-mix(in srgb, var(--sec-color) 13%, var(--surface)); color: var(--sec-color);
  font: 800 .88rem/1.1 var(--font-display); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform .15s var(--ease), box-shadow .15s, background .15s, scale .2s var(--spring);
}
.arr-chip:hover { transform: translateY(-2px); box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--sec-color) 60%, transparent); }
.arr-chips:not(.editable) .arr-chip + .arr-chip::before { content: ""; position: absolute; left: -6px; top: 50%; width: 6px; height: 1.5px; background: var(--border-strong); }
.arr-chips.editable .arr-chip { border: 1px dashed color-mix(in srgb, var(--sec-color) 45%, transparent); }
.arr-chip.dragging { scale: 1.12; box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--sec-color) 70%, transparent); transition: scale .2s var(--spring), box-shadow .2s; cursor: grabbing; }
.arr-chip.dragging::before { display: none; }
.arr-x {
  border: 0; background: none; color: inherit; cursor: pointer; font-size: 1.05rem; line-height: 1; opacity: .6;
  max-width: 1.2em; padding: 0 0 0 5px; overflow: hidden; transition: opacity .15s, max-width .2s var(--ease), padding .2s var(--ease), transform .15s;
}
.arr-x:hover { opacity: 1; transform: scale(1.2); }
.arr-chips:not(.editable) .arr-chip:not(:hover):not(:focus-visible) .arr-x { max-width: 0; padding-left: 0; opacity: 0; }
@media (hover: none) { .arr-chips:not(.editable) .arr-x { max-width: 0; padding-left: 0; opacity: 0; } }
.arr-add { border: 1px dashed var(--border-strong) !important; border-radius: 9px !important; }
.custom-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: .8rem; font-weight: 700; white-space: nowrap;
}
.custom-pill.small { padding: 1px 8px; font-size: .72rem; }
.custom-pill-reset {
  display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer; transition: background .15s, transform .25s var(--spring);
}
.custom-pill-reset:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); transform: rotate(-45deg); }
.custom-pill-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* view & key popovers */
.view-pop { display: flex; flex-direction: column; gap: 4px; width: 290px; }
.view-pop > .segmented { align-self: stretch; margin-bottom: 4px; }
.view-pop > .segmented .seg-btn { flex: 1; }
.pop-field { display: flex; flex-direction: column; gap: 6px; padding: 8px 2px 4px; }
.pop-field-label { font-weight: 700; font-size: .93rem; }
.pop-field .segmented { align-self: stretch; }
.pop-field .seg-btn { flex: 1; padding-inline: 6px; }
.size-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px 2px; border-top: 1px solid var(--border); margin-top: 4px; font-weight: 700; font-size: .93rem; }
.view-pop > .size-row:first-child { border-top: 0; margin-top: 0; padding-top: 2px; }
.stage-gear .icon { transition: transform .4s var(--spring); }
.stage-gear:hover .icon { transform: rotate(45deg); }
.size-val { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .86rem; }
.key-pop { display: flex; flex-direction: column; gap: 12px; width: 312px; }
.key-pop-head, .capo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pop-title { font: 700 1rem/1.2 var(--font-display); }
.key-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.key-cell {
  position: relative; padding: 9px 0; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  font: 800 .98rem/1 var(--font-display); cursor: pointer; color: var(--text);
  transition: background .15s, border-color .15s, transform .15s var(--spring), color .15s;
}
.key-cell:hover { border-color: var(--chord); transform: translateY(-2px); }
.key-cell.on { background: var(--chord); border-color: var(--chord); color: #fff; transform: scale(1.05); }
.key-cell.orig::after { content: ""; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.key-cell.on.orig::after { background: #fff; }
.key-pop-wrap.pop-in .key-cell { animation: chipIn .35s var(--spring) both; animation-delay: calc(var(--i, 0) * 14ms); }
.key-step { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.key-step-text { font-size: .84rem; color: var(--muted); text-align: center; }
.capo-block { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.capo-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.capo-cell {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: background .15s, border-color .15s, transform .15s var(--spring);
}
.capo-cell:hover { transform: translateY(-2px); border-color: var(--accent); }
.capo-n { font-weight: 800; font-size: .86rem; }
.capo-cell:first-child .capo-n { font-size: .7rem; }
.capo-shape { font-size: .7rem; color: var(--muted); font-weight: 700; }
.capo-cell.easy { background: var(--accent-soft); border-color: transparent; }
.capo-cell.easy .capo-shape { color: var(--accent); }
.capo-cell.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.capo-cell.on .capo-shape { color: var(--accent-text); }

/* ---------- Chart ---------- */
.chart-wrap { font-size: var(--chart-size, 18px); }
.chart { font-family: var(--font-chart); perspective: 600px; }
.two-col .chart { columns: 2; column-gap: 3em; }
.sec {
  --sec-color: var(--c-other);
  display: grid; grid-template-columns: 2.9em minmax(0, 1fr); gap: 0 .9em;
  margin: 0 0 1.4em; break-inside: avoid; border-radius: 12px;
}
.sec-side { display: flex; flex-direction: column; align-items: flex-start; gap: .4em; padding-top: .1em; }
.sec-tag {
  display: inline-grid; place-items: center; min-width: 2.2em; padding: .28em .45em; border-radius: .5em;
  font: 800 .78em/1 var(--font-display); letter-spacing: -.01em;
  color: var(--sec-color); background: color-mix(in srgb, var(--sec-color) 14%, transparent);
}
.sec-main { min-width: 0; }
.sec-head { display: flex; align-items: center; flex-wrap: wrap; gap: .3em .6em; margin-bottom: .3em; min-height: 1.5em; }
.sec-label { font-size: .68em; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.sec-repeat { cursor: help; font: 800 .74em/1 var(--font-display); color: var(--sec-color); background: color-mix(in srgb, var(--sec-color) 14%, transparent); padding: .2em .45em; border-radius: 5px; }
.sec-note { font-size: .72em; color: var(--muted); font-style: italic; }
.rep-stepper {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; font-size: 14px;
  background: color-mix(in srgb, var(--sec-color) 12%, transparent); color: var(--sec-color);
}
.rep-count { font: 800 .9rem/1 var(--font-display); min-width: 2em; text-align: center; font-variant-numeric: tabular-nums; }
.rep-btn {
  display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--surface); color: inherit; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); transition: transform .15s var(--spring), opacity .15s;
}
.rep-btn:hover:not(:disabled) { transform: scale(1.12); }
.rep-btn:active:not(:disabled) { transform: scale(.9); }
.rep-btn:disabled { opacity: .35; cursor: default; }
.rep-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sec.label-only { margin-bottom: .9em; }
.sec.label-only .sec-head { margin: .15em 0 0; }
.sec.flash { animation: flash 1.2s ease; }
.line { display: flex; flex-wrap: wrap; align-items: flex-end; line-height: 1.32; }
.line + .line { margin-top: .14em; }
.seg { display: inline-flex; flex-direction: column; }
.ch { color: var(--chord); font-weight: 700; white-space: pre; padding-right: .5em; min-height: 1.3em; font-size: .92em; transform-origin: 50% 100%; }
.seg.nochord .ch { padding-right: 0; }
.lyr { white-space: pre; }
.seg.mid .lyr { display: flex; }
.seg.mid .lyr::after { content: ""; flex: 1 1 0; min-width: 0; height: 1.5px; align-self: center; margin-top: .15em; background: currentColor; opacity: .3; }
.line.chords-only .lyr { height: 0; overflow: hidden; }
.line.chords-only + .line { margin-top: .3em; }
.line.spacer { height: .7em; }
.line.lyric-only { display: block; white-space: pre-wrap; }
.chart.lyrics-only .line.lyric-only { white-space: normal; }
/* playing the song */
.line { transition: background .25s ease; border-radius: 6px; }
.line.playing-line { background: color-mix(in srgb, var(--chord-soft) 75%, transparent); }
.ch.chord.playing { color: #fff; background: var(--chord); border-radius: 5px; scale: 1.08; transition: scale .2s var(--spring), background .15s; }
.play-split { display: inline-flex; align-items: center; }
.play-split .play-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.play-split .play-more { border-top-left-radius: 0; border-bottom-left-radius: 0; padding-inline: 3px; }
.play-btn.on, .play-btn.on + .play-more { color: var(--chord); background: var(--chord-soft); }
body.is-playing .chart .line:not(.spacer) { cursor: pointer; }
body.is-playing .chart .line:not(.spacer):not(.playing-line):hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.play-btn.on .icon { animation: pulse 1.2s ease-in-out infinite; }

/* tapped timing */
.chart.editable .ch.chord { position: relative; }
.ch-beats { position: absolute; top: -.3em; right: .05em; font-size: .58em; font-weight: 800; color: var(--muted); pointer-events: none; }
.beats-row { display: flex; align-items: center; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.beats-label { font-weight: 700; font-size: .86rem; margin-right: auto; }
.beats-val { min-width: 72px; text-align: center; font-size: .86rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.rec-bar {
  position: fixed; z-index: 45; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(760px, calc(100vw - 32px)); display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 16px; background: var(--side-bg); color: var(--side-text); box-shadow: var(--shadow-lg);
  animation: toastIn .35s var(--spring);
}
.rec-bar.closing { animation: sinkOut .2s ease forwards; }
.rec-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #f17463; animation: pulse 1s ease-in-out infinite; flex: none; }
.rec-title { font-weight: 800; }
.rec-sub { font-size: .8rem; color: var(--side-muted); }
.rec-chords { display: flex; align-items: center; gap: 8px; font: 800 1.15rem/1 var(--font-display); }
.rec-now { color: #ffb25b; }
.rec-next { color: var(--side-muted); font-size: .9em; }
.rec-actions { display: flex; align-items: center; gap: 6px; }
.rec-actions .btn.ghost, .rec-actions .btn:not(.primary) { color: var(--side-text); background: transparent; border-color: rgba(255, 255, 255, .2); }
.rec-tap { min-width: 96px; padding-block: 10px; font-size: 1rem; }
.rec-tap:active { transform: scale(.94); }

.rec-dot.cue { background: var(--side-accent); }

/* section tags stay in view while you read through a section */
.sec-side { align-self: stretch; }
.sec-tag { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 68px); z-index: 2; }
.stage .sec-tag { top: 14px; }
.paper .sec-tag { position: static; }

/* drag a setlist onto a folder */
.folder.drop-target, .set-group.drop-target { border-radius: 10px; background: var(--side-active); box-shadow: inset 0 0 0 2px var(--side-accent); }
.set-group.drop-target { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); padding: 8px; margin-inline: -8px; }
.folder.unfiled.empty { display: none; }
body.dragging-set .folder.unfiled.empty { display: block; border: 1.5px dashed rgba(255, 255, 255, .2); border-radius: 10px; padding-bottom: 4px; }
.nav-item.sub[draggable="true"]:active { cursor: grabbing; }

/* tap to hear */
@keyframes ring { 0% { scale: 1; } 30% { scale: 1.25; } 100% { scale: 1; } }
@keyframes ripple { from { opacity: .55; scale: .6; } to { opacity: 0; scale: 2.2; } }
.chart.audible .ch.chord { cursor: pointer; position: relative; border-radius: 5px; transition: background .12s; }
.chart.audible .ch.chord:hover { background: var(--chord-soft); }
.ch.chord.ringing { animation: ring .45s var(--spring); }
.ch.chord.ringing::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1.6em; height: 1.6em; margin: -.8em 0 0 -.8em; border-radius: 50%; background: var(--chord); pointer-events: none; animation: ripple .6s ease-out forwards; }
.chart.chords-flip .ch.chord { animation: chordFlip .45s var(--spring) both; animation-delay: calc(var(--ln, 0) * 16ms); }

/* editing */
.chart.editable { user-select: none; -webkit-user-select: none; }
.chart.editable .sec {
  padding: .7em .8em .8em 0; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: box-shadow .2s, border-color .2s;
}
.chart.editable .sec:hover { border-color: var(--border-strong); }
/* Edit mode: a section's header and tag stay pinned under the Editing bar while you're in that section. */
.chart.editable .sec-head {
  position: sticky; top: var(--sec-sticky-top, 76px); z-index: 4;
  margin: -.35em -.45em .3em; padding: .35em .45em; border-radius: 9px;
  background: var(--surface);
}
.chart.editable .sec-side.handle .sec-tag { position: sticky; top: calc(var(--sec-sticky-top, 76px) + .35em); z-index: 4; }
.chart.editable .sec-side.handle { justify-content: flex-start; padding-top: 1.05em; }
.chart.editable .sec.dragging { box-shadow: var(--shadow-lg); border-color: var(--sec-color); scale: 1.02; transition: scale .2s var(--spring), box-shadow .2s; }
/* While dragging a section, every section folds to its header so the whole song fits on screen. */
.chart.sorting .sec-body, .chart.sorting .sec-tools, .chart.sorting .sec-note, .chart.sorting .text-editor { display: none; }
.chart.sorting .sec { margin-bottom: .45em; padding-block: .45em; }
.chart.sorting .sec-side.handle { margin-block: -.45em; padding-block: .45em; }
.chart.sorting .sec-head { margin: 0; }
.sec-side.handle {
  align-self: stretch; align-items: center; margin: -.7em 0 -.8em; padding: .8em 0; cursor: grab; touch-action: none;
  border-right: 1px dashed var(--border); border-radius: 12px 0 0 12px; transition: background .15s;
}
.sec-side.handle:hover { background: color-mix(in srgb, var(--sec-color) 8%, transparent); }
.sec-grip { color: var(--muted); opacity: .6; transition: opacity .15s; }
.sec-side.handle:hover .sec-grip { opacity: 1; }
.chart.editable .ch.chord { cursor: grab; touch-action: none; border-radius: 5px; transition: background .12s; }
.chart.editable .ch.chord:hover { background: var(--chord-soft); }
.chart.editable .ch.chord.dragging { opacity: .3; }
.chart.editable .c { cursor: pointer; border-radius: 2px; transition: background .1s; }
.chart.editable .c:hover { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.chart.editable .c.drop { background: var(--accent); color: var(--accent-text); }
.chart.editable .tail .c, .chart.editable .tail .c:hover { color: transparent; }
.sec-tools { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: 14px; }
.sec-edit-text { padding: 4px 10px; }
.shared-note { font-size: .74rem; color: var(--muted); padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; margin-right: 4px; cursor: help; }
.chord-ghost {
  position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -130%) rotate(-3deg);
  padding: 4px 10px; border-radius: 8px; background: var(--chord); color: #fff; font: 800 16px/1.2 var(--font-display); box-shadow: var(--shadow-lg);
}
.text-editor { display: flex; flex-direction: column; gap: 8px; font-size: 14px; animation: fadeIn .2s; }
.section-editor { min-height: 120px; }
.unused { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 20px 0; padding: 14px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
.unused-sec { display: inline-flex; align-items: center; }

/* ---------- Popover / menu / modal / toast ---------- */
.popover { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 12px; }
.popover.pop-in { animation: popIn .22s var(--spring); }
.popover.pop-out { animation: popOut .14s ease forwards; pointer-events: none; }
.menu-pop { padding: 6px; min-width: 230px; }
.menu { display: flex; flex-direction: column; }
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 9px;
  cursor: pointer; text-align: left; font-size: .93rem; font-weight: 700; color: var(--text); transition: background .1s;
}
.menu-pop.pop-in .menu-item { animation: itemIn .28s var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms); }
.menu-item .icon { color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item:disabled { opacity: .4; cursor: default; }
.menu-hint { margin-left: auto; color: var(--muted); font-size: .78rem; font-weight: 400; padding-left: 14px; }
.menu-check { display: grid; place-items: center; width: 16px; color: var(--accent); }
.menu-check .icon { color: var(--accent); }
.menu-heading { padding: 8px 10px 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.icon-spacer { width: 16px; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.chord-pop { display: flex; flex-direction: column; gap: 10px; width: 270px; padding-bottom: 6px; }
.chord-input { font: 800 1.1rem/1.2 var(--font-display); color: var(--chord); }
.quick-picks { display: flex; flex-wrap: wrap; gap: 5px; }
.pick { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 4px 10px; cursor: pointer; font: 800 .9rem/1.2 var(--font-display); color: var(--chord); transition: border-color .15s, transform .15s var(--spring); }
.pick:hover { border-color: var(--chord); transform: translateY(-2px); }
.pop-foot { border-top: 1px solid var(--border); padding-top: 10px; }
.pop-foot .danger-text { margin-left: auto; }
.pop-err { color: var(--danger); font-size: .82rem; }
.pop-err:empty { display: none; }

.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 20, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fadeIn .2s ease; }
.overlay .modal { animation: riseIn .3s var(--spring); }
.overlay.closing { animation: fadeOut .16s ease forwards; }
.overlay.closing .modal { animation: sinkOut .16s ease forwards; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(660px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 6px 22px; }
.modal-head h2 { font: 700 1.25rem/1.2 var(--font-display); }
.modal-body { padding: 8px 22px 12px; overflow-y: auto; }
.modal-body p { margin: 0 0 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 20px; flex-wrap: wrap; }
.modal-actions .btn:first-child:not(:last-child):not(.primary) { margin-right: auto; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; margin-top: 12px; }
.pick-list.tall { max-height: 56vh; }
.pick-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; transition: background .15s, border-color .15s; }
.pick-row:hover { background: var(--surface-2); }
.pick-row.static { cursor: default; }
.toasts { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 11px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: .92rem; font-weight: 700; box-shadow: var(--shadow-lg); animation: toastIn .35s var(--spring); transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(10px); }
.toast-action { border: 0; background: none; color: var(--side-accent); font-weight: 800; cursor: pointer; padding: 0; }

/* ---------- Setlists ---------- */
.set-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.set-head-main { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 260px; }
.set-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.date-wrap { cursor: pointer; }
.date-input { border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer; }
.date-input:focus { outline: none; }
.notes { margin-bottom: 18px; animation: pageIn .25s var(--ease); }
.set-items { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.set-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 12px 8px 12px 6px; border-top: 1px solid var(--border); background: var(--surface); transition: background .15s; }
.set-item:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.set-item:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.set-item:only-child { border-radius: var(--radius); }
.set-item:hover { background: color-mix(in srgb, var(--surface-2) 50%, var(--surface)); }
.set-item.dragging { box-shadow: var(--shadow-lg); border-radius: var(--radius); scale: 1.015; transition: scale .2s var(--spring), box-shadow .2s; }
.grip { color: var(--muted); cursor: grab; touch-action: none; padding: 8px 2px; opacity: .35; transition: opacity .15s; }
.set-item:hover .grip { opacity: 1; }
@media (hover: none) { .grip { opacity: .8; } }
.set-num { font: 800 1.6rem/1 var(--font-display); color: var(--border-strong); width: 1.4em; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.set-item-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; text-decoration: none; }
.set-item-title { font-weight: 700; font-size: 1.08rem; line-height: 1.2; transition: color .15s; }
.set-item-main:hover .set-item-title { color: var(--accent); }
.set-item-sub { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; color: var(--muted); font-size: .86rem; line-height: 1.3; }
.set-order { font: 700 .78rem/1.3 var(--font-display); letter-spacing: .02em; color: var(--muted); word-spacing: .2em; }
.set-order.custom { color: var(--accent); }
.item-note { font-size: .84rem; color: var(--muted); font-style: italic; }
.set-item-key { display: flex; align-items: center; gap: 8px; }
.key-change { font-size: .76rem; color: var(--muted); }
.add-row { margin-top: 4px; }
.set-group { margin-bottom: 30px; }
.set-group h2 { display: flex; align-items: center; gap: 7px; font: 700 1rem/1.2 var(--font-display); margin-bottom: 12px; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.set-card { display: block; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.set-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.set-card-date { font-size: .76rem; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.set-card-name { font: 700 1.15rem/1.2 var(--font-display); margin: 4px 0 8px; }
.set-card-songs { font-size: .86rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Export / print ---------- */
.export-page { max-width: 1240px; }
.export-page h1 { margin-bottom: 20px; }
.export-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 26px; align-items: start; }
.export-options { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.export-actions { display: flex; flex-direction: column; gap: 8px; }
.export-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-pair .btn { min-width: 0; padding-inline: 10px; }
.export-pair .btn span { overflow: hidden; text-overflow: ellipsis; }
.export-controls { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.export-controls .field { margin: 0; }
.more-options { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.more-options summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; font-weight: 700; list-style: none; }
.more-options summary::-webkit-details-marker { display: none; }
.more-options summary .icon { transition: transform .25s var(--ease); color: var(--muted); }
.more-options[open] summary .icon { transform: rotate(180deg); }
.more-body { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 2px; animation: fadeIn .2s; }
.more-body .field { margin: 8px 0 0; }
.print-hosted { display: flex; flex-direction: column; gap: 6px; }
.print-hosted p { margin: 0; }
.paper-wrap { min-width: 0; }
.paper {
  --paper-size: 16px;
  background: #fff; color: #1a1a1a; border-radius: 6px; box-shadow: var(--shadow-lg);
  padding: 56px 64px; max-width: 820px; margin: 0 auto; font-size: var(--paper-size); font-family: var(--font-ui);
  --chord: #b4410c; --muted: #6b6b78; --surface-2: #f1f1f5; --text: #1a1a1a; --border: #e5e5ea;
  --c-verse: #2f6fdb; --c-chorus: #d4520f; --c-prechorus: #0e8a7e; --c-bridge: #7a4cd9; --c-tag: #c2378a; --c-intro: #5b7a1a; --c-instrumental: #5b7a1a; --c-vamp: #b7791f; --c-other: #66758c;
  animation: riseIn .45s var(--ease);
}
.paper-head { text-align: center; margin-bottom: 2.2em; padding-bottom: 1.4em; border-bottom: 1px solid #e5e5ea; }
.paper-title { font: 700 2em/1.15 var(--font-display); letter-spacing: -.02em; }
.paper-date { color: #6b6b78; margin-top: .2em; }
.paper-order { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: .3em 1.4em; margin: 1em 0 0; padding: 0; list-style-position: inside; color: #444; font-size: .9em; }
.paper-song { margin-bottom: 2.4em; break-inside: auto; }
.paper-song-title { font: 700 1.6em/1.15 var(--font-display); letter-spacing: -.015em; }
.paper-credits { color: #6b6b78; font-size: .78em; margin-top: .2em; }
.lyrics-paper .paper-song-title { margin-bottom: .25em; }
.lyrics-paper .paper-credits { margin-bottom: 1.6em; }
.lyrics-paper .paper-song-title + .paper-block { margin-top: 1.3em; } /* no credits line */
.paper-block { margin-bottom: 1.1em; break-inside: avoid; }
.paper-label { font-size: .68em; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--sec-color, #64748b); margin-bottom: .2em; }
.paper-x { opacity: .8; }
.paper-x-line { font-size: .78em; font-weight: 700; color: #6b6b78; margin-top: .2em; }
.paper-line { line-height: 1.5; }
.paper-gap { height: .6em; }
.paper.two-col .paper-song { columns: 2; column-gap: 2.5em; }
.paper.two-col .paper-song > .paper-song-title, .paper.two-col .paper-song > .paper-credits, .paper.two-col .chart-song-head, .paper.two-col .chart-order { column-span: all; }
.paper-foot { margin-top: 2em; padding-top: 1em; border-top: 1px solid #e5e5ea; font-size: .75em; color: #6b6b78; text-align: center; }
.charts-paper .chart { font-size: 1em; }
.chart-song-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1em; border-bottom: 2px solid #1a1a1a; padding-bottom: .5em; margin-bottom: .8em; }
.chart-song-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3em .9em; font-size: .8em; color: #555; padding-top: .4em; }
.meta-key { font-weight: 800; color: var(--chord); }
.chart-order { font: 700 .78em/1.3 var(--font-display); color: #555; margin-bottom: 1.4em; letter-spacing: .02em; }
.chart-note { font-size: .82em; font-style: italic; margin: -.5em 0 1em; color: #555; }

/* ---------- Stage mode ---------- */
body.stage-active { overflow: hidden; }
body.stage-active .sidebar, body.stage-active .topbar { display: none; }
body.stage-active .app { display: block; }
.stage {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background: #070a10; color: #f4f6fa;
  --chord: #ffb65e; --muted: #8d97ab; --surface: #121722; --surface-2: #1b2230; --surface-3: #2a3346; --border: #232b3a; --border-strong: #34405a; --text: #f4f6fa; --accent: #4fcb9b; --accent-soft: #133a2d; --accent-text: #062317;
  --c-verse: #82b0ff; --c-chorus: #ffa463; --c-prechorus: #4fe0cc; --c-bridge: #b9a2ff; --c-tag: #ff8cc6; --c-intro: #b6f05a; --c-instrumental: #b6f05a; --c-vamp: #ffd166; --c-other: #a7b3c4;
  animation: fadeIn .3s ease;
}
.stage-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  padding-block: calc(8px + env(safe-area-inset-top, 0px)) 8px;
  padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid #161b26; background: #0b0f17;
}
.stage-bar .btn { color: #e8ebf2; }
.stage-bar .btn.ghost:hover:not(:disabled) { background: #1b2230; }
.stage-bar-title { font: 700 .95rem/1.2 var(--font-display); color: #a9b2c4; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-controls { justify-content: flex-end; }
.stage-pos { font-variant-numeric: tabular-nums; color: #a0a8b8; font-size: .9rem; min-width: 34px; text-align: center; }
.stage-scroll { flex: 1; overflow-y: auto; padding-block: 4vh 40vh; padding-left: max(5vw, env(safe-area-inset-left, 0px)); padding-right: max(5vw, env(safe-area-inset-right, 0px)); }
.stage-song { max-width: 1400px; margin: 0 auto; }
.stage-song.slide-next { animation: slideInR .4s var(--ease); }
.stage-song.slide-prev { animation: slideInL .4s var(--ease); }
.stage-title { font: 800 calc(var(--chart-size) * .85)/1.1 var(--font-display); letter-spacing: -.02em; margin-bottom: .9em; display: flex; align-items: baseline; gap: .6em; flex-wrap: wrap; }
.stage-key { font-size: .6em; color: var(--chord); font-weight: 800; }
.stage-note { color: #b5bccb; font-style: italic; margin: -.6em 0 1em; font-size: calc(var(--chart-size) * .5); }
.stage .chart-wrap { font-size: var(--chart-size); }
.stage .sec-label { color: #8d97ab; }
.stage-next { display: flex; align-items: center; gap: .4em; margin: 2em 0 0; padding: .8em 1.1em; border-radius: 14px; border: 1px solid #232b3a; background: #10151f; color: #c9cfdb; cursor: pointer; font-size: calc(var(--chart-size) * .5); transition: border-color .2s, transform .2s var(--ease); }
.stage-next:hover { border-color: var(--accent); transform: translateX(4px); }
.stage-end { margin-top: 2em; color: #6b7385; font-size: calc(var(--chart-size) * .45); }
.stage-pop { width: 280px; }

/* section colours (after every component that sets a default --sec-color) */
.t-verse { --sec-color: var(--c-verse); }
.t-chorus { --sec-color: var(--c-chorus); }
.t-prechorus { --sec-color: var(--c-prechorus); }
.t-bridge { --sec-color: var(--c-bridge); }
.t-tag { --sec-color: var(--c-tag); }
.t-intro, .t-outro { --sec-color: var(--c-intro); }
.t-instrumental { --sec-color: var(--c-instrumental); }
.t-vamp { --sec-color: var(--c-vamp); }
.t-other { --sec-color: var(--c-other); }

/* ---------- Sign-in (self-hosted with Firebase) ---------- */
body.gated { overflow: hidden; }
.auth-gate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--side-bg); animation: fadeIn .3s ease;
}
.auth-card {
  width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: 32px 28px; border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  animation: riseIn .4s var(--spring);
}
.auth-card p { margin: 0; color: var(--muted); }
.auth-card .btn { margin-top: 8px; }
.logo-mark.big { width: 52px; height: 52px; border-radius: 15px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .import-grid { grid-template-columns: minmax(0, 1fr); }
  .import-right { position: static; }
  .paste { min-height: 300px; }
  .export-grid { grid-template-columns: minmax(0, 1fr); }
  .export-options { position: static; }
  .paper { padding: 32px 28px; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    padding-block: 8px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px));
    background: var(--side-bg); color: var(--side-text);
  }
  .topbar .icon-btn { color: var(--side-text); }
  .topbar .icon-btn:hover { background: var(--side-hover); }
  .topbar .logo { font-size: 1.1rem; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); padding-left: max(12px, env(safe-area-inset-left, 0px)); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .4); animation: fadeIn .2s; }
  .only-mobile { display: inline-grid !important; }
  .page { padding-block: 20px 80px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  h1, .title-input { font-size: 1.6rem; }
  .song-toolbar { position: static; margin: 0 0 6px; padding: 6px 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .song-toolbar.editing { position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); padding: 8px 10px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .song-bpm, .song-row-meta .tag { display: none; }
  .set-item { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .set-num, .key-change { display: none; }
  .two-col .chart, .paper.two-col .paper-song { columns: 1; }
  .sec { grid-template-columns: 2.5em minmax(0, 1fr); gap: 0 .6em; }
  .paper { padding: 24px 18px; }
  .stage-bar { grid-template-columns: auto 1fr auto; }
  .stage-bar-title { font-size: .85rem; }
  .stage-scroll { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .stage .two-col .chart { columns: 1; }
  .toolbar-row { flex-wrap: wrap; }
  .key-pop { width: min(312px, calc(100vw - 48px)); }
  .sec-tag { top: calc(env(safe-area-inset-top, 0px) + 64px); }
  /* Icon-only View/Present on phones; the label stays for screen readers. */
  .song-toolbar .btn.ghost:not(.icon-only) { padding: 6px; }
  .song-toolbar .btn.ghost:not(.icon-only) > span,
  .song-toolbar.editing .btn:not(.primary):not(.icon-only) > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .song-toolbar.editing .btn:not(.primary):not(.icon-only) { padding: 6px; }
  .song-toolbar.editing { flex-wrap: nowrap; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 14mm 14mm; }
  body { background: #fff !important; color: #000; }
  .sidebar, .topbar, .no-print, .toasts, .overlay, .popover, .scrim { display: none !important; }
  .app { display: block; }
  .page { padding: 0; max-width: none; animation: none !important; }
  .export-grid { display: block; }
  .paper { box-shadow: none; padding: 0; max-width: none; border-radius: 0; animation: none; }
  .page-break { break-before: page; }
  .paper-block, .sec { break-inside: avoid; }
}
