/* App shell — Alpha UI v1.0. All colors from ui/tokens.css. */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg0); color: var(--tx);
  font-family: var(--font-ui); font-size: 12px; line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }

/* Thin scrollbars, only when an area overflows */
* { scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--tx3); }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
*::-webkit-scrollbar-corner { background: transparent; }

.spacer { flex: 1; }
.dim { opacity: .5; display: flex; }
.eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--tx3); }
.eyebrow-count { font-size: 10px; color: var(--tx3); }
.soon-chip { font-size: 10px; color: var(--tx2); border: 1px dashed var(--muted); border-radius: var(--r-ctl); padding: 3px 7px; white-space: nowrap; align-self: flex-start; }

/* ---------- Layout: fixed height, only the song area scrolls ---------- */
.app { height: 100vh; min-height: 560px; min-width: 660px; display: flex; flex-direction: column; overflow: hidden; background: var(--bg0); }
.workspace { display: flex; flex: 1; min-height: 0; align-items: stretch; }
.col-left, .col-right { display: flex; min-height: 0; }
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg2); }
/* The song area doesn't scroll itself: a fixed head (song header) sits above a scrolling body (report 01b, UI-2),
   so the scrollbar is drawn only beside the song. */
.song-area { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.song-scroll { flex: 1; min-height: 0; overflow-y: auto; }

/* ---------- Controls ---------- */
.ctl {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-h); padding: 0 10px; border-radius: var(--r-ctl);
  background: var(--bg3); border: 1px solid var(--edge); color: var(--tx); white-space: nowrap;
}
.ctl:hover:not(:disabled) { border-color: var(--tx3); }
.ctl.active { border-color: var(--acc); color: var(--acct); }
.ctl:disabled { opacity: .45; }
.ctl-play { width: 32px; padding: 0; background: var(--acc); border-color: var(--acc); color: var(--onacc); }
.ctl-field { min-width: 40px; padding: 0 7px; gap: 3px; background: var(--field); font-family: var(--font-mono); font-size: 11px; }
.ctl-sq { width: 24px; padding: 0; }
.icon-btn {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: var(--bg3); border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--tx);
}
.icon-btn.sm { width: 22px; height: 22px; }
.icon-btn.active, .icon-btn[aria-pressed="true"] { border-color: var(--acc); color: var(--acct); }
.icon-btn:hover { border-color: var(--tx3); }
.link-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; color: var(--acct); font-size: 11px; }
.link-btn:disabled { opacity: .45; }

/* ---------- Transport: always one line, compacts in steps as it narrows ---------- */
.transport {
  container: transport / inline-size;
  height: var(--transport-h); flex-shrink: 0; background: var(--bg1); border-bottom: 1px solid var(--line);
  position: relative; z-index: 5;
}
.transport-row {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 16px;
  height: 100%; padding: 0 14px; white-space: nowrap;
}
/* Title (UI-3): mark centered in the bar; "Acord" and "v1.0" share one baseline. */
.app-title { display: flex; align-items: center; gap: 5px; white-space: nowrap; margin-right: 4px; flex-shrink: 0; }
.logo-mark { display: block; flex-shrink: 0; }
.app-words { display: flex; align-items: baseline; gap: 4px; }
.app-name { font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--tx); }
.app-ver { font-size: 11px; font-weight: 400; color: var(--tx2); }
.views { display: flex; gap: 1px; background: var(--edge); border: 1px solid var(--edge); border-radius: var(--r-ctl); overflow: hidden; flex-shrink: 0; }
.view { height: 24px; padding: 0 12px; border: 0; font-size: 11px; background: var(--bg3); color: var(--tx2); }
.view.on { background: var(--acc); color: var(--onacc); font-weight: 600; }
.view:disabled { cursor: default; }
.view:disabled:not(.on) { opacity: .6; }
.sep { width: 1px; height: 20px; background: var(--line); flex-shrink: 0; }
.group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.group > .ctl + .ctl { margin-left: -2px; }
.lbl { color: var(--tx2); font-size: 11px; white-space: nowrap; }
.key-chip { font-family: var(--font-mono); font-size: 12px; padding: 2px 6px; border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--tx2); }
.ctl-labeled, .settings-anchor { flex-shrink: 0; }

/* Step 1: tighter gaps */
@container transport (max-width: 1100px) {
  .transport-row { gap: 8px; padding: 0 10px; }
  .app-title { margin-right: 0; }
}
/* Step 2: Import and Theory become icon-only (name stays in the tooltip and aria-label) */
@container transport (max-width: 1020px) {
  .ctl-labeled { width: 28px; padding: 0; }
  .ctl-labeled .btn-label { display: none; }
}
/* Step 3: group labels hide; each control keeps its name in its tooltip */
@container transport (max-width: 880px) {
  .group .lbl { display: none; }
  .view { padding: 0 9px; }
  .key-shape { display: none; }
}
/* Step 4: smallest windows — shorter title spacing and view tabs */
@container transport (max-width: 760px) {
  .transport-row { gap: 6px; padding: 0 8px; }
  .view { padding: 0 6px; }
  .sep { display: none; }
}
.settings-anchor { position: relative; }

/* ---------- Popover / settings ---------- */
.popover {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: 280px;
  background: var(--bg1); border: 1px solid var(--edge); border-radius: var(--r-dlg); color: var(--tx);
  padding: 4px 0 12px;
}
.pop-head { padding: 8px 14px 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; }
.set-col { flex-direction: column; align-items: stretch; gap: 6px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; }
.set-label { font-size: 12px; color: var(--tx); }
.set-hint { font-size: 11px; color: var(--tx3); margin-top: -2px; }
.seg { display: flex; border: 1px solid var(--edge); border-radius: var(--r-ctl); overflow: hidden; }
.seg button { height: 24px; padding: 0 10px; border: 0; background: var(--bg3); color: var(--tx2); font-size: 11px; }
.seg button + button { border-left: 1px solid var(--edge); }
.seg button.on { background: var(--acc); color: var(--onacc); font-weight: 600; }
.swatches { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.swatch {
  width: 24px; height: 24px; padding: 0; border-radius: var(--r-ctl); border: 1px solid var(--edge);
  background: var(--sw); color: #141414; display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.swatch.on { outline: 2px solid var(--tx); outline-offset: 1px; }
.swatch.custom { cursor: pointer; color: var(--tx2); background: var(--sw); border-style: dashed; }
.swatch.custom.on { border-style: solid; color: var(--onacc); }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.swatch.custom:focus-within { outline: 2px solid var(--acc); outline-offset: 1px; }
.swatch-name { font-size: 11px; color: var(--tx2); font-family: var(--font-mono); }
.accent-preview { margin-top: 6px; padding: 8px 10px; background: var(--bg2); border: 1px solid var(--edge); border-radius: var(--r-ctl); }
.pv-chords { display: flex; gap: 22px; font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--acct); }
.pv-lyric { font-family: var(--font-mono); font-size: 13px; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-controls { display: flex; gap: 6px; margin-top: 8px; }
.pv-on { background: var(--acc); color: var(--onacc); font-weight: 600; font-size: 11px; padding: 3px 10px; border-radius: var(--r-ctl); }
.pv-sel { background: var(--sel); color: var(--seltx); border: 1px solid var(--acc); font-size: 11px; padding: 2px 10px; border-radius: var(--r-ctl); }

/* ---------- Library sidebar ---------- */
.library { width: var(--lib-w); height: 100%; background: var(--bg1); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.lib-head { height: var(--lib-head-h); flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px var(--lib-edge); }
/* The line under the search box meets the song header's bottom line (UI-1); spare space goes under the box. */
.lib-search { height: calc(var(--panel-head-h) - var(--lib-head-h) - 1px); flex-shrink: 0; padding: 2px var(--lib-edge) 0; position: relative; }
.lib-search input {
  width: 100%; height: 28px; padding: 0 10px 0 30px; background: var(--field); border: 1px solid var(--edge);
  border-radius: var(--r-ctl); color: var(--tx); font-size: 12px;
}
.lib-search input:disabled { opacity: .6; }
.search-ico { position: absolute; left: 21px; top: 9px; color: var(--tx3); display: flex; pointer-events: none; }
.lib-folders { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 0 8px; flex-shrink: 0; }
.lib-folders-head { display: flex; align-items: center; gap: 6px; padding: 6px var(--lib-edge) 6px 8px; }
.chev { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; color: var(--tx3); transition: transform .12s; }
.chev.closed { transform: rotate(-90deg); }
.folder-row {
  display: flex; align-items: center; gap: 8px; width: 100%; height: var(--row-folder); border: 0; text-align: left;
  font-size: 12px; padding: 0 var(--lib-edge); background: none; color: var(--tx);
}
.folder-row:disabled { cursor: default; }
.folder-row:hover:not(:disabled) { background: var(--hl); }
.folder-row.on { background: var(--sel); color: var(--seltx); }
.folder-ico { width: 14px; display: flex; align-items: center; justify-content: center; }
.folder-ico.star { color: var(--acc); }
.folder-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-count { font-size: 10px; opacity: .7; font-family: var(--font-mono); }
.song-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 0; }
.empty-note { margin: 12px var(--lib-edge); color: var(--tx3); font-size: 12px; }

/* Library rail (collapsed) */
.rail {
  width: var(--rail-w); height: 100%; background: var(--bg1); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 8px;
}
.rail .icon-btn { width: 28px; height: 28px; }
.rail-sep { height: 1px; width: 22px; background: var(--line); margin: 2px 0; }

/* Tuner device (placeholder) */
.device { margin: 4px var(--lib-edge) var(--lib-edge); border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--dev-bg); color: var(--dev-tx); flex-shrink: 0; }
.device-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--dev-off); border-bottom: 1px solid var(--line); }
.device-name { font-weight: 600; font-size: 11px; }
.device-status { font-family: var(--font-mono); font-size: 10px; color: var(--dev-tx3); }
.power { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 50%; background: var(--dev-btn); border: 1px solid var(--edge); color: var(--dev-btntx); }
.power:disabled { opacity: .6; }
.device-body { padding: 10px; display: flex; }

/* ---------- Song area ---------- */
.song-area > .empty-state { overflow-y: auto; }
.empty-state { max-width: 420px; margin: 18vh auto 0; padding: 0 24px; text-align: center; color: var(--tx2); }
.empty-state h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--tx); }
.empty-state p { margin: 0; font-size: 13px; line-height: 1.5; }

/* ---------- Floating zoom (over the song area, above the dock tabs) ---------- */
.main { position: relative; }
.zoom-float {
  position: absolute; z-index: 4; left: 5px; bottom: calc(var(--dock-h) + 8px);
  display: flex; flex-direction: column; gap: 4px;
  opacity: .45; transition: opacity .15s;
}
.zoom-float.zf-low { bottom: calc(var(--dock-closed-h) + 8px); }
.zoom-float:hover, .zoom-float:focus-within { opacity: 1; }
.zoom-btn {
  width: 26px; height: 24px; display: flex; align-items: center; justify-content: center; padding: 0;
  background: var(--bg3); border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--tx);
}
.zoom-btn:hover:not(:disabled) { border-color: var(--tx3); }

/* ---------- Dock ---------- */
.dock { flex-shrink: 0; display: flex; height: var(--dock-h); background: var(--bgp); border-top: 1px solid var(--line); }
.dock-tabs { flex: 0 0 var(--dock-tabs-w); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 0; background: var(--bg1); border-right: 1px solid var(--line); }
.dock-collapse { width: 24px; height: 14px; display: flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; color: var(--tx2); }
.dock-tab { width: 26px; height: 22px; display: flex; align-items: center; justify-content: center; padding: 0; border-radius: var(--r-ctl); background: var(--bg3); border: 1px solid var(--edge); color: var(--tx2); }
.dock-tab.on { background: var(--acc); border-color: var(--acc); color: var(--onacc); }
.dock-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 20px; }
.dock-title { font-size: 12px; color: var(--tx2); }
.dock-closed { flex-shrink: 0; display: flex; align-items: center; gap: 10px; height: var(--dock-closed-h); padding: 0 6px; background: var(--bg1); border-top: 1px solid var(--line); }
.dock-closed .icon-btn { width: 24px; height: 20px; }

/* ---------- Theory panel ---------- */
.theory { width: var(--theory-w); height: 100%; overflow: hidden; background: var(--bg1); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.theory-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.theory-head { height: var(--panel-head-h); flex-shrink: 0; display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.theory-empty { margin: 0 14px; color: var(--tx2); font-size: 12px; line-height: 1.5; }
.theory .soon-chip { margin: 0 14px; }
.theory-rail { width: var(--theory-rail-w); height: 100%; background: var(--bg1); border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding-top: 8px; }
.theory-rail-btn { writing-mode: vertical-rl; background: var(--bg3); border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--tx2); font-size: 11px; padding: 10px 3px; }

/* ---------- Status bar ---------- */
.status { display: flex; gap: 12px; align-items: center; height: var(--status-h); padding: 0 14px; background: var(--bg1); border-top: 1px solid var(--line); color: var(--tx3); font-size: 11px; flex-shrink: 0; }

/* ---------- Library (stage 3) ---------- */
.lib-content { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.folder-list { display: flex; flex-direction: column; max-height: 40vh; overflow-y: auto; }
.folder-row-wrap { position: relative; display: flex; }
.folder-row-wrap .folder-row { flex: 1; min-width: 0; padding-right: 30px; }
.folder-row.editing { gap: 8px; }
.folder-row.drop, .folder-row-wrap .folder-row.drop { background: var(--sel); color: var(--seltx); outline: 1px dashed var(--acc); outline-offset: -2px; }
.folder-input {
  flex: 1; min-width: 0; height: 20px; padding: 0 6px; background: var(--field); border: 1px solid var(--acc);
  border-radius: var(--r-ctl); color: var(--tx); font-size: 12px;
}
.folder-input:focus-visible { outline: none; }
.row-more {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; padding: 0;
  background: var(--bg3); border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--tx2);
  font-size: 12px; line-height: 1; opacity: 0;
}
.folder-row-wrap:hover .row-more, .folder-row-wrap:focus-within .row-more,
.song-row:hover .row-more, .song-row:focus-within .row-more { opacity: 1; }

.song-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 28px 26px; column-gap: 8px; align-items: center;
  height: 28px; padding: 0 var(--lib-edge); flex-shrink: 0; font-size: 10px; color: var(--tx3);
  text-transform: uppercase; letter-spacing: .06em;
}
.song-head-name { display: flex; gap: 6px; align-items: baseline; min-width: 0; text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--tx2); }
.song-head-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-head-count { font-family: var(--font-mono); font-size: 10px; color: var(--tx3); }
.song-head-col { text-align: center; }
.sort select {
  height: 20px; padding: 0 4px; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r-ctl);
  color: var(--tx2); font-size: 10px; text-transform: none; letter-spacing: 0;
}

.song-row {
  position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr) 28px 26px; column-gap: 8px; align-items: center;
  height: var(--row-song); padding: 0 var(--lib-edge); color: var(--tx);
}
.song-row:hover { background: var(--hl); }
.song-row.on { background: var(--sel); color: var(--seltx); }
.song-row .row-more { right: 4px; }
.fav { display: flex; justify-content: center; align-items: center; padding: 0; width: 14px; height: 14px; background: none; border: 0; color: var(--edge); }
.fav.on { color: var(--acc); }
.fav:hover { color: var(--acct); }
.song-main {
  min-width: 0; height: 100%; display: flex; align-items: center; padding: 0; background: none; border: 0; text-align: left;
  overflow: hidden; white-space: nowrap; color: inherit; font-size: 12px;
}
.song-title { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.song-row.on .song-title { font-weight: 600; }
.song-artist { opacity: .7; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; white-space: pre; }
.song-key { font-family: var(--font-mono); font-size: 11px; opacity: .85; text-align: center; }
.site-badge { font-family: var(--font-mono); font-size: 9px; border: 1px solid var(--edge); border-radius: var(--r-ctl); text-align: center; padding: 1px 0; opacity: .8; }
.dev-seed { margin: 8px var(--lib-edge); }
.dev-seed-status { margin-left: 12px; }

/* ---------- Menu ---------- */
.menu {
  position: fixed; z-index: 50; min-width: 180px; max-width: 280px; max-height: 70vh; overflow-y: auto; padding: 4px 0;
  background: var(--bg1); border: 1px solid var(--edge); border-radius: var(--r-dlg); color: var(--tx); font-size: 12px;
}
.menu-item { display: flex; align-items: center; gap: 6px; width: 100%; height: 26px; padding: 0 12px 0 6px; background: none; border: 0; text-align: left; white-space: pre; }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--sel); color: var(--seltx); outline: none; }
.menu-item:disabled { color: var(--tx3); }
.menu-item.danger { color: #C4372B; }
:root[data-theme="dark"] .menu-item.danger { color: #FF7A6E; }
.menu-check { width: 12px; display: flex; justify-content: center; color: var(--acct); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(400px, 90vw); padding: 18px 20px 16px; background: var(--bg1); color: var(--tx);
  border: 1px solid var(--edge); border-radius: var(--r-dlg);
}
.dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-title { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.dialog-body { margin: 0 0 16px; color: var(--tx2); font-size: 12px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ctl-primary { background: var(--acc); border-color: var(--acc); color: var(--onacc); font-weight: 600; }
.ctl-danger { background: #B3261E; border-color: #B3261E; color: #FFFFFF; font-weight: 600; }

/* ---------- Song area placeholder (until the Viewer, stage 4) ---------- */
.song-placeholder { padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--bgh); }
.song-placeholder h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.song-placeholder p { margin: 4px 0 10px; color: var(--tx2); }

/* ---------- Viewer (stage 4) ---------- */
.viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.song-header {
  flex-shrink: 0; height: var(--panel-head-h); overflow: hidden; position: relative; z-index: 3; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--bgh);
  /* Two rows in a fixed height (UI-1, report 08 §3 A): title row on top, structure + rhythm strip row at the bottom. */
  display: flex; flex-direction: column; justify-content: space-between;
}
.song-header-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.song-header h1 { margin: 0; min-width: 6ch; flex-shrink: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.song-artist-h { color: var(--tx2); min-width: 0; flex-shrink: 2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chips { display: flex; gap: 6px; flex-wrap: nowrap; align-self: center; flex-shrink: 0; }
/* The header narrows in steps (container query on the song area, not the window): chips drop their labels, then the
   rhythm chip keeps only its icon and the artist hides; the title takes "…" last. */
.song-header { container: songhead / inline-size; }
.chip-s { display: none; }
@container songhead (max-width: 700px) {
  .song-header .chip-l, .song-header .chip-x { display: none; }
  .song-header .chip-s { display: inline; }
}
@container songhead (max-width: 520px) {
  .song-header .rc-name, .song-header .rc-sug { display: none; }
  .song-header .song-artist-h { display: none; }
}
.chip { font-size: 11px; color: var(--tx2); border: 1px solid var(--edge); border-radius: var(--r-ctl); padding: 2px 6px; white-space: nowrap; }
.fav-big { flex-shrink: 0; align-self: center; width: 26px; height: 24px; display: flex; align-items: center; justify-content: center; padding: 0; background: var(--bg3); border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--muted); }
.fav-big.on { color: var(--acc); border-color: var(--acc); }
.song-header-row2 { display: flex; align-items: center; gap: 12px; height: 30px; min-width: 0; }
.structure { display: flex; gap: 2px; flex: 1 1 auto; min-width: 160px; }
.strip {
  flex: 1 1 0; min-width: 0; height: 20px; padding: 3px 6px; border: 0; border-radius: var(--r-ctl); text-align: left;
  font-size: 10px; font-weight: 600; color: #141414; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: var(--s-other);
}
.strip:hover { filter: brightness(1.08); }

.k-intro { --sec: var(--s-intro); } .k-verse { --sec: var(--s-verse); } .k-chorus { --sec: var(--s-chorus); }
.k-bridge { --sec: var(--s-bridge); } .k-tab { --sec: var(--s-tab); } .k-other { --sec: var(--s-other); }
.strip { background: var(--sec); }

.song-body { padding: 16px 28px 32px 0; font-family: var(--font-mono); font-size: calc(15px * var(--z, 1)); color: var(--tx); }
/* Zoom below the readability floor: columns. A part stays in one column when it fits. */
.song-body.cols { column-count: var(--cols); column-gap: 32px; column-rule: 1px solid var(--line); }
.song-body.cols .sec { break-inside: avoid; }
/* No code ligatures in songs: JetBrains Mono would turn tab strings like "|-" into box characters. */
.song-body, .song-body *, .key-chip, .ctl-field, .song-key, .site-badge, .pv-chords, .pv-lyric { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.sec { display: flex; margin-bottom: 1.1em; scroll-margin-top: 8px; }
/* Section marker lane: 12 px | marker | 28 px (spec §8) */
.sec-lane { flex: 0 0 auto; width: 16px; padding: 0 28px 0 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; box-sizing: content-box; }
.sec-label {
  writing-mode: vertical-rl; transform: rotate(180deg); background: var(--sec); color: #141414;
  font-family: var(--font-ui); font-weight: 600; font-size: 10px; letter-spacing: .02em; padding: 6px 2px; border-radius: var(--r-ctl);
  white-space: nowrap; max-height: 14em; overflow: hidden; text-overflow: ellipsis;
}
.sec-bar { flex: 1; width: 3px; min-height: 6px; background: var(--sec); border-radius: 2px; }
.sec-content { flex: 1; min-width: 0; }

.ln { line-height: 1.4; white-space: normal; }
.ln .w { white-space: pre; }
.ln.blank { height: 1.4em; }
.ln.comment { font-family: var(--font-ui); font-size: calc(13px * var(--z, 1)); font-style: italic; color: var(--tx2); margin: .2em 0; }
.ln.has-chords, .ln.chords-only { display: flex; flex-wrap: wrap; align-items: flex-end; margin-bottom: .15em; }
.u { display: inline-flex; flex-direction: column; }
.u .c { font-size: calc(1em * var(--cz, 1) / var(--z, 1)); min-height: 1.25em; line-height: 1.25; white-space: pre; color: var(--acct); font-weight: 600; }
.u.with-chord .c { padding-right: 1ch; }
.u .l { line-height: 1.35; white-space: pre; }
.ln.chords-only .u .c { padding-right: 1ch; }
.tab-block { margin: .3em 0 .6em; background: var(--tabbg); border: 1px solid var(--edge); border-radius: var(--r-ctl); overflow-x: auto; }
.tab-block pre { margin: 0; padding: .45em .7em; font-family: var(--font-mono); font-size: .9em; line-height: 1.35; color: var(--tabtx); }

/* ---------- Paste import (stage 5) ---------- */
.muted { color: var(--tx3); font-size: 11px; margin: 0; }
.mono, .mono input { font-family: var(--font-mono); }
.import-dialog { width: min(980px, 94vw); padding: 16px 18px 14px; }
.import-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.import-head .dialog-title { margin: 0; }
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.import-text {
  width: 100%; height: min(60vh, 520px); resize: vertical; padding: 10px 12px;
  background: var(--field); color: var(--tx); border: 1px solid var(--edge); border-radius: var(--r-ctl);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.4; white-space: pre; overflow: auto; tab-size: 4;
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}
.import-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-height: min(60vh, 520px); overflow-y: auto; }
.import-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--tx2); }
.import-field input, .import-field select {
  height: 26px; padding: 0 8px; background: var(--field); color: var(--tx); border: 1px solid var(--edge); border-radius: var(--r-ctl); font-size: 12px;
}
.import-field input[aria-invalid="true"] { border-color: #C4372B; }
.import-row3 { display: grid; grid-template-columns: 1fr 72px; gap: 8px; }
.field-error { margin: -4px 0 0; min-height: 0; font-size: 11px; color: #C4372B; }
:root[data-theme="dark"] .field-error { color: #FF7A6E; }
.field-error:empty { display: none; }
.pv-title { margin-top: 6px; }
.import-preview { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--bg2); border: 1px solid var(--edge); border-radius: var(--r-ctl); font-size: 12px; }
.pv-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pv-stat { display: flex; flex-direction: column; align-items: center; }
.pv-stat strong { font-size: 16px; font-family: var(--font-mono); color: var(--acct); }
.pv-stat span { font-size: 10px; color: var(--tx3); }
.pv-sections { display: flex; flex-wrap: wrap; gap: 3px; }
.pv-sec { background: var(--sec); color: #141414; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: var(--r-ctl); }
.pv-chordlist { margin: 0; color: var(--acct); font-weight: 600; font-size: 12px; word-spacing: 2px; }
.pv-warn { margin: 0; color: #9A5B00; font-size: 11px; line-height: 1.4; }
:root[data-theme="dark"] .pv-warn { color: #F0B35A; }
.kbd-hint { margin-right: auto; align-self: center; }
.import-dialog .dialog-actions { margin-top: 14px; }
.est-badge { margin-left: 6px; padding: 0 5px; border: 1px dashed var(--acc); border-radius: var(--r-ctl); color: var(--acct); font-size: 10px; }
.est-badge[hidden] { display: none; }
.pv-found { margin: 0; font-size: 11px; color: var(--tx); }
.key-chip.est { border-style: dashed; border-color: var(--acc); }

/* ---------- Banner (storage notices) ---------- */
.banner {
  position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 60; max-width: min(720px, 92vw);
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-dlg);
  background: var(--bg1); color: var(--tx); border: 1px solid var(--acc); font-size: 12px; line-height: 1.4;
}
.banner.error { border-color: #C4372B; }
.banner.info { border-color: var(--acc); }

/* ---------- Number fields (transpose, capo) ---------- */
.numfield { cursor: ns-resize; user-select: none; touch-action: none; min-width: 34px; position: relative; }
.numfield:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.numfield.changed .nf-val { color: var(--acct); }
.numfield.dragging { border-color: var(--acc); }
.nf-input { width: 3.2ch; border: 0; padding: 0; background: transparent; color: var(--tx); font: inherit; text-align: center; outline: none; }
.key-shape { color: var(--tx3); }
.reset-pitch[hidden] { display: none; }

/* ---------- Key picker (the key chip is a button) ---------- */
.key-anchor { position: relative; display: inline-flex; }
.key-btn { background: var(--field); cursor: pointer; }
.key-btn:hover:not(:disabled), .key-btn.open { border-color: var(--acc); color: var(--tx); }
.key-btn:disabled { cursor: default; }
.key-pop {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 30;
  display: grid; grid-template-columns: repeat(6, 34px); gap: 3px; padding: 6px;
  background: var(--bg1); border: 1px solid var(--edge); border-radius: var(--r-dlg);
}
.key-opt {
  position: relative; height: 26px; padding: 0; border: 1px solid var(--edge); border-radius: var(--r-ctl);
  background: var(--bg3); color: var(--tx); font-family: var(--font-mono); font-size: 11px;
}
.key-opt:hover { border-color: var(--tx3); }
.key-opt.on { background: var(--acc); border-color: var(--acc); color: var(--onacc); }
.key-opt.orig::after { content: ""; position: absolute; top: 3px; right: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--acct); }
.key-opt.on.orig::after { background: var(--onacc); }

/* ---------- Autoscroll ---------- */
.ctl-play:disabled { opacity: .45; }
.ctl-play.playing { background: var(--bg3); color: var(--acct); }
.ctl-sq:not(:disabled) { color: var(--tx); }

/* ---------- Editor (M3 stage 5) ---------- */
.editor { flex: 1; min-height: 0; display: flex; flex-direction: column; container: editor / inline-size; }
.editor-head { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 10px; }
.ed-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ed-row .spacer { flex: 1; }
.ed-input {
  height: 24px; padding: 0 6px; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r-ctl);
  color: var(--tx); font-size: 12px; min-width: 0;
}
.ed-input:focus { outline: none; border-color: var(--acc); }
.ed-input.wide { flex: 1 1 160px; max-width: 260px; }
.ed-input.wide[aria-label] { font-weight: 500; }
.ed-field { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ed-lbl { font-size: 11px; color: var(--tx2); }
.ed-field .ed-input { font-family: var(--font-mono); font-size: 11px; }
.ed-warn { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--acct); cursor: help; white-space: nowrap; }
.ed-toggle { display: none; }
.editor-head .ctl { flex-shrink: 0; height: 24px; font-size: 11px; }

.editor-split { flex: 1; min-height: 0; display: flex; }
.editor-src { flex: 1 1 50%; min-width: 0; position: relative; overflow: hidden; background: var(--field); }
.src-wrap { position: absolute; inset: 0; overflow: hidden; }
.src-hl, .src-text {
  margin: 0; padding: 14px 16px 40px; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; tab-size: 2;
  white-space: pre; letter-spacing: 0; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}
.src-hl { position: absolute; top: 0; left: 0; min-width: 100%; color: var(--tx); pointer-events: none; will-change: transform; }
.src-text {
  position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0; outline: none; overflow: auto;
  background: transparent; color: transparent; caret-color: var(--tx);
}
.src-text::selection { background: color-mix(in srgb, var(--acc) 35%, transparent); color: transparent; }
.hl-chord { color: var(--acct); font-weight: 600; }
.hl-dir { color: var(--tx3); }
.hl-sec { color: var(--tx2); font-weight: 600; background: var(--hl); }
.editor-preview { flex: 1 1 50%; min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg2); }
.editor-preview .viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor-preview .song-header { display: none; }
button.sec-label { border: 0; cursor: pointer; }
button.sec-label:hover, button.sec-label:focus-visible { outline: 2px solid var(--tx); outline-offset: 1px; }

/* Narrow: one pane at a time, with a toggle */
@container editor (max-width: 820px) {
  .ed-toggle { display: flex; }
  .editor-preview { display: none; border-left: 0; }
  .show-preview .editor-src { display: none; }
  .show-preview .editor-preview { display: flex; }
}
.dialog-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--tx2); margin-bottom: 10px; }
.dialog-input { height: 28px; padding: 0 8px; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--tx); font-size: 12px; }
.dialog-scope { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
@container editor (max-width: 820px) {
  .ed-lbl { display: none; }
  .ed-toggle { order: -1; flex-shrink: 0; }
  .ed-row .spacer { display: none; }
  .ed-input.wide { flex-basis: 90px; }
  .ed-field .ed-input::placeholder { color: var(--tx3); }
}
@container editor (max-width: 620px) {
  .ed-field:nth-of-type(n+5) { display: none; } /* tempo, feel: wider windows only */
}
.ed-key-anchor, .ed-pair { position: relative; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ed-small { height: 24px; padding: 0 8px; font-size: 11px; }
.ed-key-pop { left: 0; transform: none; top: calc(100% + 4px); }
.ed-key-pop[hidden] { display: none; }
.ed-note { font-size: 11px; color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.editor-head { overflow: visible; z-index: 6; }

/* ---------- Chord popover (M4a) ---------- */
.song-body .c[data-chord] { cursor: pointer; border-radius: 2px; }
.song-body .c[data-chord]:hover, .song-body .c.pop-on { background: var(--hl); outline: 1px solid var(--edge); }
.chord-pop {
  position: fixed; z-index: 40; min-width: 112px; padding: 8px 10px 8px; display: flex; flex-direction: column; gap: 6px;
  background: var(--bg1); border: 1px solid var(--edge); border-radius: var(--r-dlg); color: var(--tx); font-size: 11px;
}
.chord-pop[hidden] { display: none; }
.chord-pop.pinned { border-color: var(--acc); }
.pop-head { display: flex; align-items: center; gap: 8px; }
.pop-name { font: 600 14px var(--font-mono); font-variant-ligatures: none; }
.pop-mode button { height: 20px; padding: 0 6px; font-size: 10px; }
.pop-diagram { display: flex; justify-content: center; min-height: 40px; }
.pop-steps { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pop-counter { font-family: var(--font-mono); font-size: 10px; color: var(--tx2); }
.pop-gen { color: var(--acct); }
.pop-notes { font-family: var(--font-mono); font-size: 11px; color: var(--tx); text-align: center; }
.pop-muted { color: var(--tx3); font-size: 10px; text-align: center; }
.pop-theory { align-self: flex-start; font-size: 11px; }

/* ---------- Theory panel content (M4a) ---------- */
.theory-body { padding: 12px 14px 24px; gap: 18px; }
.th-block { display: flex; flex-direction: column; gap: 8px; }
.th-title { margin: 0; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--tx3); }
.th-sub { margin: 6px 0 0; font-size: 11px; font-weight: 600; color: var(--tx2); }
.th-hint { margin: 0; }
.th-chord-name { font: 600 18px var(--font-mono); font-variant-ligatures: none; }
.th-facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; }
.th-facts dt { color: var(--tx3); }
.th-facts dd { margin: 0; }
.mono { font-family: var(--font-mono); font-variant-ligatures: none; }
.th-intervals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.th-iv { display: inline-block; min-width: 3ch; color: var(--acct); font-weight: 600; }
.th-keys { display: flex; justify-content: center; }
.th-shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.th-shape { margin: 0; text-align: center; }
.th-shape figcaption { font-size: 9px; color: var(--tx3); }
.th-key { font-size: 13px; }
.th-key strong { font: 600 15px var(--font-mono); }
.th-key-sub { font-size: 11px; color: var(--tx2); margin-top: 2px; }
.th-est { font-size: 11px; color: var(--tx3); }
.th-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.th-seg button { height: 20px; padding: 0 7px; font-size: 10px; }
.th-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.th-pill {
  display: inline-flex; align-items: baseline; gap: 4px; height: 24px; padding: 0 7px; border: 1px solid var(--edge); border-radius: var(--r-ctl);
  background: var(--bg3); color: var(--tx); font: 12px var(--font-mono); font-variant-ligatures: none; align-items: center;
}
.th-pill:hover { border-color: var(--tx3); }
.th-pill.on { border-color: var(--acc); background: var(--acc); color: var(--onacc); }
.th-pill.out { border-style: dashed; }
.th-deg { font: 10px var(--font-ui); color: var(--tx3); }
.th-pill.on .th-deg { color: var(--onacc); }
.th-left { text-align: left; }
.th-block .theory-empty { margin: 0; }

/* ---------- Graphic tabs (M4b) ---------- */
.tab-block { position: relative; }
.tab-block.graphic { overflow: visible; background: transparent; border-color: var(--line); }
.tab-graphic { font-family: var(--font-mono); font-size: .9em; padding: .35em .4em .3em; overflow-x: auto; }
.tab-row { line-height: 0; overflow-x: auto; }
.tab-row + .tab-row { margin-top: .25em; }
.tab-graphic-row { display: block; height: auto; max-width: none; }
.tab-graphic-row text { font-family: var(--font-mono); font-variant-ligatures: none; }
.tg-label { font-size: 10px; fill: var(--tx3); }
.tg-string { stroke: var(--tx3); stroke-width: .8; }
.tg-bar { stroke: var(--tx2); stroke-width: 1; }
.tg-chip { fill: var(--bg2); }
.tg-fret { font-size: 11.5px; font-weight: 600; fill: var(--tx); }
.tg-tech { font-size: 9px; font-style: italic; fill: var(--acct); }
.tab-annot { font-family: var(--font-mono); font-size: .85em; color: var(--tx2); padding: 0 .4em .3em; text-align: right; }
.tab-mode {
  position: absolute; top: 3px; right: 3px; z-index: 2; height: 18px; min-width: 22px; padding: 0 4px; border: 1px solid var(--edge); border-radius: var(--r-ctl);
  background: var(--bg3); color: var(--tx2); font: 10px var(--font-mono); opacity: .55;
}
.tab-block:hover .tab-mode, .tab-mode:focus-visible { opacity: 1; }
.tab-mark { display: flex; align-items: center; gap: 8px; padding: .3em .6em 0; font: 10px var(--font-ui); color: var(--tx3); }
.tab-block.transposed .tab-mark-label { color: var(--acct); font-weight: 600; }
.tab-mark-btn { font-size: 10px; }
.tab-block:not(.graphic) .tab-mark { padding-bottom: .2em; }

/* ---------- Partitura (M4b) ---------- */
.pt-toolbar {
  flex-shrink: 0; display: flex; align-items: center; gap: 14px; padding: 6px 16px; min-height: 36px;
  border-bottom: 1px solid var(--line); background: var(--bg2); font-size: 11px; overflow: hidden;
}
.pt-title { font-weight: 600; color: var(--tx2); white-space: nowrap; }
.pt-time { color: var(--acct); font-family: var(--font-mono); }
.pt-group { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pt-group-label { color: var(--tx3); }
.pt-group .seg button { height: 20px; padding: 0 7px; font-size: 10px; }
@container (max-width: 760px) { .pt-group-label { display: none; } }
.pt-flow { display: flex; flex-wrap: wrap; align-items: stretch; margin: 0 0 .9em; border-left: 1px solid var(--tx3); }
.pt-bar {
  display: flex; flex-direction: column; align-items: stretch; gap: .15em; min-width: 4.5ch; padding: .25em .7em .35em .45em;
  border-right: 1px solid var(--tx3); border-bottom: 1px solid var(--line); position: relative;
}
.pt-bar.pickup { border-left: 1px dashed var(--edge); opacity: .85; }
.pt-num { position: absolute; top: .1em; right: .3em; font-size: .55em; color: var(--tx3); font-family: var(--font-mono); }
.pt-chord { min-height: 1.25em; font-weight: 700; color: var(--acct); white-space: nowrap; }
.pt-chord .c { font-size: calc(1em * var(--cz, 1) / var(--z, 1)); }
.pt-bar.cont .pt-chord .c { color: var(--tx3); font-weight: 400; }
.pt-words { white-space: nowrap; color: var(--tx); }
.pt-lyrics-fold .pt-words { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; color: var(--tx2); font-size: .85em; }
.pt-chords-fold .pt-chord { font-weight: 500; color: var(--tx3); font-size: .78em; min-height: 1.1em; }
.pt-tab-fold {
  display: block; margin: .2em 0 .8em; padding: .25em .7em; border: 1px dashed var(--edge); border-radius: var(--r-ctl);
  background: transparent; color: var(--tx2); font: .78em var(--font-ui); text-align: left;
}
.pt-tab-fold:hover { border-color: var(--tx3); color: var(--tx); }
.pt-chord { display: flex; justify-content: flex-start; padding-right: 1.1em; }
.pt-chord .c { text-align: left; }
.pt-bar.ln.has-chords { align-items: stretch; flex-wrap: nowrap; margin-bottom: 0; }

/* ---------- Drag-to-place chords (M4b) ---------- */
.editor-right { flex: 1 1 50%; min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.editor-right .editor-preview { flex: 1; min-height: 0; border-left: 0; }
.ed-palette {
  flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line);
  background: var(--bg2); max-height: 64px; overflow-y: auto;
}
.pal-label { font-size: 10px; color: var(--tx3); margin-right: 4px; }
.pal-sep { font: 10px var(--font-mono); color: var(--tx3); margin: 0 2px 0 8px; }
.pal-chip {
  height: 22px; padding: 0 7px; display: inline-flex; align-items: center; border: 1px solid var(--edge); border-radius: var(--r-ctl);
  font: 600 12px var(--font-mono); font-variant-ligatures: none; color: var(--acct); background: var(--bg3); cursor: grab; user-select: none; touch-action: none;
}
.pal-chip.dia { color: var(--tx2); font-weight: 500; border-style: dashed; }
.editor-preview .c[data-ci] { cursor: grab; touch-action: none; }
.chord-dragging, .chord-dragging * { cursor: grabbing !important; user-select: none; }
.chord-dragging .chord-pop { display: none; }
.drag-ghost {
  position: fixed; z-index: 60; pointer-events: none; padding: 2px 7px; border-radius: var(--r-ctl); background: var(--acc); color: var(--onacc);
  font: 600 13px var(--font-mono); font-variant-ligatures: none;
}
.drag-ghost.delete { background: var(--tx3); color: var(--bg1); text-decoration: line-through; }
.drag-caret { position: fixed; z-index: 59; pointer-events: none; width: 2px; background: var(--acc); border-radius: 1px; }
.drag-caret[hidden] { display: none; }
.drag-source { opacity: .35; }
.c.drop-on { outline: 2px solid var(--acc); outline-offset: 1px; }
@container editor (max-width: 820px) {
  .editor-right { display: none; border-left: 0; }
  .show-preview .editor-right { display: flex; }
}

/* ── Tabs visibility (D45) ─────────────────────────────────────────────────── */
.tabs-toggle { flex-shrink: 0; align-self: center; height: 24px; min-width: 34px; padding: 0 6px; border: 1px solid var(--edge); border-radius: var(--r-ctl);
  background: var(--bg3); color: var(--tx3); font: 700 10px/1 var(--font-mono); letter-spacing: .06em; cursor: pointer; margin-left: 8px;
  text-decoration: line-through; text-decoration-thickness: 1.5px; }
.tabs-toggle.on { color: var(--tx); border-color: var(--tx3); text-decoration: none; }
.tabs-toggle:hover { color: var(--tx); }
.song-body.tabs-off .tab-block, .song-body .sec.tabs-hidden { display: none; }
.structure .strip.dim { opacity: .35; }
.structure .strip.dim:hover { opacity: .7; }
/* Tabs off: chords of the hidden tabs in one row, by bar (at most two lines; fitTabChords shrinks it if needed). */
.ln.tab-chords { display: flex; flex-wrap: wrap; align-items: baseline; row-gap: .1em; margin-bottom: .15em; line-height: 1.3;
  font-size: calc(var(--tcf, 1) * 1em * var(--cz, 1) / var(--z, 1)); }
.tab-chords .tc-bar { display: inline-flex; gap: .8ch; padding: 0 1.1ch; border-left: 1px solid var(--edge); }
.tab-chords .tc-bar:first-child { padding-left: 0; border-left: 0; }
.tab-chords .tc-bar.tc-system { border-left-color: var(--tx3); }
.tab-chords .c { color: var(--acct); font-weight: 600; white-space: pre; }
.tab-chords .tc-empty { color: var(--tx3); }

/* ---------- Link import (M5) ---------- */
.import-linkrow { display: flex; gap: 8px; margin-bottom: 8px; }
.import-link {
  flex: 1; min-width: 0; height: 30px; padding: 0 10px; background: var(--field); color: var(--tx);
  border: 1px solid var(--edge); border-radius: var(--r-ctl); font-size: 12px;
}
.import-link:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.import-link:disabled { opacity: .6; }
.link-status:empty { display: none; }
.link-status { margin-bottom: 10px; }
.link-msg { font-size: 12px; line-height: 1.5; color: var(--tx2); }
.link-msg.ok { color: var(--tx); }
.link-msg.error { color: #C4372B; }
:root[data-theme="dark"] .link-msg.error { color: #FF7A6E; }
.link-msg.loading::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid var(--acc); border-right-color: transparent; border-radius: 50%; animation: link-spin .8s linear infinite; }
@keyframes link-spin { to { transform: rotate(360deg); } }
.link-msg .link-btn { margin-left: 4px; }
.clean-note:empty { display: none; }
.clean-note { margin: -4px 0 10px; font-size: 12px; line-height: 1.5; color: var(--tx2); }
.clean-note .link-btn[hidden] { display: none; }
.bm-install { margin: 0 0 10px; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--edge); border-radius: var(--r-ctl); font-size: 12px; line-height: 1.5; color: var(--tx2); }
.bm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bm-button {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-ctl);
  background: var(--acc); color: #141414; font-weight: 600; text-decoration: none; cursor: grab;
}
.bm-hint { margin-top: 6px; }
.bm-steps { margin: 8px 0 6px; padding-left: 18px; }
.send-install { max-width: 520px; }
.import-tools { display: flex; gap: 14px; margin: -2px 0 8px; }
.set-links { display: flex; gap: 12px; }
.ext-status { margin: 0 0 10px; font-size: 12px; }
.ext-status.ok { color: var(--tx); }
.ext-status.ok::before { content: "● "; color: #3FA34D; }
.ext-status.warn { color: #C4372B; }
.import-queue { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--acc-tx, var(--tx)); }
.import-queue:empty { display: none; }

/* ---------- Backup (M6) ---------- */
.backup-dialog { max-width: 540px; }
.bk-line { margin: 0 0 6px; font-size: 13px; }
.bk-actions { display: flex; gap: 8px; margin: 12px 0 4px; }
.bk-msg { font-size: 12px; color: var(--tx2); margin: 8px 0 0; }
.bk-msg:empty { display: none; }
.bk-table { border-collapse: collapse; font-size: 12px; margin: 8px 0; }
.bk-table th, .bk-table td { padding: 4px 12px 4px 0; text-align: left; }
.bk-table td { font-family: var(--mono, monospace); }
.bk-note { font-size: 12px; margin: 4px 0 8px; }
.bk-check { display: flex; align-items: center; gap: 6px; font-size: 12px; }
