/* Tab to Sheet ------------------------------------------------------------
   One neutral palette, one accent, system UI type, a serif for titles to
   echo engraved music. The score itself always sits on white paper. */

:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --stage: #e9e8e4;
  --ink: #18181b;
  --ink-2: #4b4b52;
  --ink-3: #85858c;
  --line: #e3e2de;
  --line-strong: #cfcec9;
  --hover: #f0efec;
  --accent: #9b2c2c;
  --accent-soft: #f6e9e8;
  --on-accent: #ffffff;
  --primary: #18181b;
  --on-primary: #ffffff;
  --danger: #a32020;
  --warn: #fbf3e2;
  --shadow-paper: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-pop: 0 4px 24px rgba(0, 0, 0, 0.14);
  --radius: 6px;
  --topbar-h: 56px;
  --transport-h: 60px;
  --sidebar-w: 300px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-title: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --panel: #1a1a1d;
    --stage: #0e0e10;
    --ink: #ededee;
    --ink-2: #b4b4ba;
    --ink-3: #7d7d85;
    --line: #2a2a2e;
    --line-strong: #3a3a40;
    --hover: #232327;
    --accent: #e0868c;
    --accent-soft: #3a2224;
    --on-accent: #1a0d0e;
    --primary: #ededee;
    --on-primary: #18181b;
    --danger: #f08a8a;
    --warn: #2d2716;
    --shadow-paper: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-pop: 0 6px 30px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--hover); padding: 1px 4px; border-radius: 3px; }
kbd { font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--panel); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon .fill, .icon use { fill: inherit; }
.icon.inline { width: 14px; height: 14px; vertical-align: -2px; }
#i-play .fill, #i-pause .fill, #i-stop .fill { fill: currentColor; stroke: none; }

/* Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--panel); color: var(--ink);
  font-size: 14px; font-weight: 550; white-space: nowrap; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { opacity: 0.88; background: var(--primary); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.block { width: 100%; justify-content: flex-start; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn .ext { margin-left: auto; color: var(--ink-3); font-weight: 400; font-size: 13px; }
.file-input { display: none; }

.linklike {
  background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
  display: inline-flex; align-items: center; gap: 4px;
}
.linklike:hover { text-decoration-color: currentColor; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius);
  display: inline-grid; place-items: center; padding: 0;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn.primary { background: var(--primary); color: var(--on-primary); width: 40px; height: 40px; border-radius: 50%; }
.icon-btn.primary:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); opacity: 0.88; }
.icon-btn.primary .icon { width: 20px; height: 20px; }
.icon-btn.toggle[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.icon-btn .i-pause { display: none; }
.icon-btn.playing .i-play { display: none; }
.icon-btn.playing .i-pause { display: block; }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn.small .icon { width: 16px; height: 16px; }

/* Top bar ------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.wordmark svg { width: 26px; height: 26px; }
.wordmark .staff path { stroke: var(--ink-3); stroke-width: 1.2; }
.wordmark circle { fill: var(--ink); }
.wordmark .stem { stroke: var(--ink); stroke-width: 1.8; }
.topbar-actions { margin-left: auto; display: flex; gap: 4px; }
.options-toggle { display: none; }
body[data-view="score"] .options-toggle { display: inline-flex; }
body.panel-hidden .viewer { grid-template-columns: 0 1fr; }
body.panel-hidden .paper-frame, body.panel-hidden .tip, body.panel-hidden .edited-banner, body.panel-hidden .warnings { max-width: 1240px; }
body.panel-hidden .sidebar { visibility: hidden; padding: 0; border: 0; }
.tip { max-width: 1000px; margin: 0 auto 14px; padding: 6px 6px 6px 12px; border-radius: var(--radius); display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.tip span { flex: 1; }
.dialog { border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px; background: var(--panel); color: var(--ink); box-shadow: var(--shadow-pop); width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.dialog h2 { margin: 0 0 14px; font: 500 22px/1.2 var(--font-title); }
.shortcut-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 32px; }
.dialog dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; align-items: baseline; }
.dialog dt { white-space: nowrap; }
.dialog dd { margin: 0; color: var(--ink-2); }
.dialog .dl-head { grid-column: 1 / -1; font-weight: 600; color: var(--ink-3); font-size: 13px; }
.dialog form { margin-top: 18px; text-align: right; }
.results button:focus-visible { outline-offset: -2px; }
body[data-view="home"] #top-search { visibility: hidden; }

/* Search fields ------------------------------------------------------------ */
.search { position: relative; display: flex; align-items: center; }
.search > .icon { position: absolute; left: 12px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 38px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus-visible { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.search.compact { flex: 1; max-width: 520px; }
.search.large input { height: 52px; font-size: 16px; padding-right: 76px; background: var(--panel); border-radius: 8px; }
.search.large > .icon { left: 16px; width: 20px; height: 20px; }
.search.large input { padding-left: 46px; }
.search.large .btn { position: absolute; right: 6px; height: 40px; }

/* Home --------------------------------------------------------------------- */
.home { min-height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; }
.home-inner { width: 100%; max-width: 680px; margin: 0 auto; padding: 72px 20px 40px; flex: 1; }
.home h1 { font: 500 38px/1.15 var(--font-title); letter-spacing: -0.01em; margin: 0 0 10px; }
.lede { margin: 0 0 28px; color: var(--ink-2); font-size: 17px; }
.alt { color: var(--ink-2); margin: 18px 0 0; }
.back-to-score { margin: 14px 0 0; }

.status { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.status.error { border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.status .spinner { width: 14px; height: 14px; margin-top: 3px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.status .status-actions { margin-left: auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.results { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
.results li + li { border-top: 1px solid var(--line); }
.results button { width: 100%; text-align: left; background: none; border: 0; padding: 10px 14px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.results button:hover, .results button:focus-visible { background: var(--hover); }
.results .r-title { font-weight: 600; }
.results .r-artist { color: var(--ink-2); grid-column: 1; }
.results .r-meta { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--ink-3); font-size: 13px; }
.results .empty { padding: 12px 14px; color: var(--ink-2); }

.recent { margin-top: 44px; }
.recent h2, .more-ways h3 { font-size: 13px; font-weight: 600; color: var(--ink-3); margin: 0 0 8px; }
.recent ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.recent li { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.recent .open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 10px 2px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.recent .open:hover .t { text-decoration: underline; text-underline-offset: 3px; }
.recent .t { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .a { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edited-tag { font-size: 11px; font-weight: 600; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.recent .d { margin-left: auto; color: var(--ink-3); font-size: 13px; white-space: nowrap; padding-left: 8px; }
.recent li .icon-btn { opacity: 0; }
.recent li:hover .icon-btn, .recent li .icon-btn:focus-visible { opacity: 1; }

.more-ways { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 14px; color: var(--ink-2); }
.more-ways summary { cursor: pointer; font-weight: 550; color: var(--ink); }
.more-body { padding: 4px 0 4px; font-size: 14px; }
.more-body h3 { margin: 18px 0 6px; }
.more-body ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.bookmarklet { display: inline-block; padding: 1px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); color: var(--ink); font-weight: 600; text-decoration: none; cursor: grab; }
.relay-form { display: flex; gap: 8px; }
.relay-form input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); }

.site-footer { max-width: 680px; margin: 0 auto; padding: 24px 20px 32px; color: var(--ink-3); font-size: 13px; }

/* Viewer ------------------------------------------------------------------- */
.viewer {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--transport-h);
  grid-template-areas: "side stage" "transport transport";
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h)); /* phones: the visible height, without the browser's toolbars */
}
.sidebar { grid-area: side; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 20px 18px 28px; }
/* isolation keeps alphaTab's high z-index cursor inside the stage */
.stage { grid-area: stage; overflow: auto; background: var(--stage); position: relative; isolation: isolate; padding: 28px 28px 48px; }
.transport { grid-area: transport; }

.song-head h1 { font: 500 22px/1.2 var(--font-title); margin: 0; overflow-wrap: anywhere; }
.song-head p { margin: 2px 0 0; color: var(--ink-2); }
.song-head .song-meta { color: var(--ink-3); font-size: 13px; margin-top: 8px; }

.panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.panel h2 { font-size: 13px; font-weight: 600; color: var(--ink-3); margin: 0 0 10px; }
details.panel > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2 { margin: 0; }
details.panel > summary::after {
  content: ""; width: 7px; height: 7px; margin-right: 4px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(45deg); transition: transform 0.15s;
}
details.panel:not([open]) > summary { margin-bottom: 0; }
details.panel:not([open]) > summary::after { transform: rotate(-45deg); }
details.panel > summary:hover h2 { color: var(--ink); }
.panel-note { margin: 8px 0 0; color: var(--ink-3); font-size: 12.5px; }

.track-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.track-list li { display: flex; align-items: center; gap: 6px; border-radius: var(--radius); padding: 2px 2px 2px 6px; }
.track-list li:hover { background: var(--hover); }
.track-list label { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 4px 0; }
.track-list input { accent-color: var(--ink); margin: 0; }
.track-list .name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.track-list .sub { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.track-list .names { min-width: 0; }
.track-list .icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

.segmented { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 2px; background: var(--bg); }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 5px 6px; border-radius: 4px; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.segmented input:checked + span { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(0, 0, 0, 0.06); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

.switches { display: grid; gap: 8px; margin-top: 12px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 14px; }
.switch input { appearance: none; width: 30px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; flex: none; order: 2; margin: 0; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(12px); }
.switch input:disabled { opacity: 0.4; cursor: default; }
.switch:has(input:disabled) { color: var(--ink-3); cursor: default; }

.field { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: 14px; }
.field label { display: flex; justify-content: space-between; color: var(--ink-2); }
.field output { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.field select { width: 100%; min-width: 0; text-overflow: ellipsis; }
select { height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); }
input[type="range"] { accent-color: var(--ink); width: 100%; margin: 0; }

.panel .btn.primary { margin-top: 14px; }
.export-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 2px; }
.export-list .btn { height: 34px; font-weight: 500; color: var(--ink-2); padding: 0 8px; }
.export-list .btn:hover { color: var(--ink); }

.shortcuts { margin: 24px 0 0; color: var(--ink-3); font-size: 12px; line-height: 2; }

/* Editing */
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.edit-toggle { margin-top: 14px; width: 100%; }
.edit-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.edit-panel { border-top-color: var(--accent); }
.edit-where { margin: 0 0 4px; font-weight: 600; font-size: 14px; }
.edit-group { margin-top: 16px; }
.edit-group h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin: 0 0 8px; }
.edit-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip-row:first-of-type { margin-top: 0; }
.chip {
  height: 28px; padding: 0 9px; border-radius: 5px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink-2);
}
.chip:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.chip:disabled { opacity: 0.4; cursor: default; }
.chip.danger { color: var(--danger); }
.string-picker { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.string-picker span { min-width: 112px; text-align: center; font-variant-numeric: tabular-nums; }
.mini-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.mini-field.wide { display: flex; margin-top: 6px; }
.mini-field input, .mini-field select, .range-row input {
  height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--panel); font-size: 14px;
}
.mini-field input[type="number"], #edit-fret { width: 56px; }
.mini-field.wide input { flex: 1; min-width: 0; }
.mini-field select { height: 30px; padding: 0 4px; }
.edit-keys { margin: 16px 0 10px; color: var(--ink-3); font-size: 12px; line-height: 2; }
.field-label { color: var(--ink-2); }
.range-row { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
.range-row input { width: 64px; }

.edit-banner {
  position: sticky; top: -28px; z-index: 5; max-width: 1000px; margin: -28px auto 14px;
  display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 14px;
  background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); font-size: 14px; color: var(--ink-2);
}
.edit-banner span { margin-right: auto; }
.edit-banner strong { color: var(--ink); }
.edit-cursor, .edit-note-box { position: absolute; z-index: 3; pointer-events: none; border-radius: 4px; }
.edit-cursor { background: rgba(37, 99, 235, 0.07); outline: 1.5px solid rgba(37, 99, 235, 0.55); }
.edit-note-box { outline: 2px solid #2563eb; background: rgba(37, 99, 235, 0.12); }
body.editing .at-cursor-beat { opacity: 0.35; }

/* Score */
.paper-frame { position: relative; max-width: 1000px; margin: 0 auto; }
.paper { background: #fff; color: #000; box-shadow: var(--shadow-paper); min-height: 60vh; padding: 12px 0 24px; overflow-x: auto; border-radius: 2px; }
body.horizontal .paper-frame { max-width: none; }
.render-progress { position: absolute; inset: 0 0 auto; height: 2px; overflow: hidden; z-index: 2; }
.render-progress span { display: block; height: 100%; width: 30%; background: var(--accent); animation: slide 1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.warnings { max-width: 1000px; margin: 0 auto 14px; padding: 8px 12px; border-radius: var(--radius); background: var(--warn); font-size: 13.5px; }
.warnings summary { cursor: pointer; }
.warnings ul { margin: 6px 0 2px; padding-left: 18px; }
.status.floating { max-width: 1000px; margin: 0 auto 14px; }
.edited-banner {
  max-width: 1000px; margin: 0 auto 14px; padding: 8px 12px; border-radius: var(--radius);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--accent-soft); color: var(--ink); font-size: 14px;
}
.edited-banner span { margin-right: auto; }

/* alphaTab playback highlighting */
.at-cursor-bar { background: rgba(155, 44, 44, 0.045); }
.at-cursor-beat { background: rgba(155, 44, 44, 0.8); width: 2px; }
body.cursor-idle:not(.editing) .at-cursor-bar, body.cursor-idle:not(.editing) .at-cursor-beat { visibility: hidden; }
.at-highlight * { fill: #9b2c2c; stroke: #9b2c2c; }
.at-selection div { background: rgba(155, 44, 44, 0.12); }

/* Transport */
.transport {
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px; background: var(--panel); border-top: 1px solid var(--line);
}
.transport-buttons, .transport-options { display: flex; align-items: center; gap: 4px; }
.timeline { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; min-width: 38px; flex: none; }
#seek { flex: 1; min-width: 0; width: 0; }
.time:last-child { text-align: right; }
.speed { display: flex; align-items: center; gap: 6px; margin-left: 6px; font-size: 13px; color: var(--ink-2); }
.speed select { height: 30px; font-variant-numeric: tabular-nums; }
.icon-btn.labeled { width: auto; padding: 0 9px; gap: 6px; display: inline-flex; align-items: center; }
.btn-label { font-size: 13px; font-weight: 550; }
@media (max-width: 1250px) { .btn-label, .speed-label { display: none; } .icon-btn.labeled { width: 36px; padding: 0; justify-content: center; } }
.trainer { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.trainer .panel-note { margin-top: 4px; }
.trainer-fields { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
#trainer-status:empty { display: none; }
.volume { display: flex; align-items: center; gap: 6px; margin-left: 6px; color: var(--ink-2); }
.volume input { width: 70px; }
.icon-btn.primary.busy { background: color-mix(in srgb, var(--primary) 60%, transparent); }
.icon-btn.primary.busy .icon { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.player-status { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.player-status:empty { display: none; }

/* Toast + drop overlay */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: var(--radius); font-size: 14px; box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); }
.toast button { background: none; border: 0; padding: 0; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; white-space: nowrap; }
.tool-btn { margin-top: 10px; justify-content: center; }
.track-action { font-size: 12px; color: var(--accent); margin-top: 2px; text-decoration-color: currentColor; }
.drop-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(2px); }
.drop-overlay p { margin: 0; padding: 36px 56px; border: 2px dashed var(--line-strong); border-radius: 12px; background: var(--panel); font-size: 18px; font-weight: 600; }

/* Narrow screens ----------------------------------------------------------- */
@media (max-width: 900px) {
  .viewer, body.panel-hidden .viewer { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "transport"; }
  body.panel-hidden .sidebar { visibility: visible; padding: 20px 18px 28px; }
  .sidebar {
    position: fixed; z-index: 40; top: var(--topbar-h); bottom: var(--transport-h); left: 0;
    width: min(340px, 88vw); transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: none; }
  .stage { padding: 12px 8px 32px; }
}
@media (max-width: 900px) {
  .wide-only { display: none; }
  .edit-banner { margin-top: -12px; top: -12px; }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .wordmark span { display: none; }
  .topbar-actions .label { display: none; }
  .topbar-actions .btn { padding: 0 10px; }
  .home-inner { padding-top: 40px; }
  .home h1 { font-size: 30px; }
  .transport { gap: 8px; padding: 0 8px; }
  #countin-btn, .volume { display: none; }
  .time { min-width: 0; }
  .timeline { gap: 6px; }
  .speed { margin-left: 0; }
  .speed-label { display: none; }
  .speed select { padding: 0 2px; }
}
@media (max-width: 420px) {
  #time-total { display: none; }
  .recent li .icon-btn { opacity: 1; }
}

/* Printing straight from the page (fallback when the print window is blocked) */
@media print {
  body { background: #fff; }
  .topbar, .sidebar, .transport, .warnings, .status, .home, .toast, .tip, .edited-banner { display: none !important; }
  .viewer { display: block; height: auto; }
  .stage { padding: 0; overflow: visible; background: #fff; }
  .paper { box-shadow: none; padding: 0; overflow: visible; }
  .at-cursor-bar, .at-cursor-beat, .at-selection, .edit-cursor, .edit-note-box, .edit-banner { display: none !important; }
}
