/* ── CHORDPRO CHORD OVERLAY ── */

/* chord line container */
.b-chord-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  line-height: 1;
  margin-bottom: 4px;
}

/* each segment = chord above + lyric below */
.b-seg {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  margin-right: 1px;
  max-width: 100%;   /* a long lyric segment wraps inside the screen instead of being cut off */
}

/* chord with whitespace-only lyric ("rest") — one space = natural gap, no need to spam spaces */
.b-seg-rest {
  min-width: calc(1.6em * var(--fsx));
}

/* chord label */
.b-chord-over {
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-size: calc(16px * var(--fsx));   /* chords are the musician's main info — readable from a music stand */
  font-weight: 700;
  color: var(--chord);
  line-height: 1.3;
  white-space: nowrap;
  min-height: calc(18px * var(--fsx));
  display: block;
  transition: color .18s ease;         /* no font-size transition: scroll measures the final layout */
}
.b-chord-empty {
  visibility: hidden;
}

/* lyric segment */
.b-lyric-seg {
  font-size: calc(17px * var(--fsx));
  color: var(--lyric);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
  transition: color .18s ease;
}

/* lyric only (no chord) */
.b-lyric-only {
  font-size: calc(17px * var(--fsx));
  color: var(--lyric);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
}

/* current block overrides */
.block.is-cur .b-chord-over  { font-size: calc(19px * var(--fsx)); color: var(--accent); }
.block.is-cur .b-lyric-seg   { font-size: calc(22px * var(--fsx)); font-weight: 700; color: white; }
.block.is-cur .b-lyric-only  { font-size: calc(22px * var(--fsx)); font-weight: 700; color: white; }

/* past/fade overrides */
.block.is-past .b-chord-over,
.block.is-prev1 .b-chord-over { color: var(--chord-dim); }
.block.is-past .b-lyric-seg,
.block.is-past .b-lyric-only  { color: var(--lyric-dim); }

/* ── CHORD-ONLY LINE (intro, instrumental) ── */
/* no lyric — chords render at lyric size as flat text */
.b-chord-only {
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-size: calc(17px * var(--fsx));
  font-weight: 700;
  color: var(--chord);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  letter-spacing: 0.05em;
  transition: color .18s ease;
}
.block.is-cur .b-chord-only { font-size: calc(22px * var(--fsx)); color: var(--accent); }

/* section-type color overrides — block opacity handles past/prev dimming */
.b-chord-solo                { color: #7eb8d9; }
.b-chord-freepress           { color: #d9a07e; }
.block.is-cur .b-chord-solo      { color: #a8d4e8; }
.block.is-cur .b-chord-freepress { color: #e8c09a; }

/* ── EDITOR PANEL ── */
.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.editor-split {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  gap: 0;
}

.editor-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.editor-right {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  min-width: 0;
}

/* chord toolbar — tabbed layout */
.chord-toolbar {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  max-height: 30vh;
  overflow-y: auto;
  transition: max-height .2s ease;
}
.chord-toolbar.collapsed {
  max-height: none;
  overflow: hidden;
}
.chord-toolbar.collapsed .ctb-panel,
.chord-toolbar.collapsed .ctb-recent-row { display: none !important; }

/* ── CTB: tab bar ── */
.ctb-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ctb-tab {
  flex: 1;
  padding: 6px 4px;
  font-size: 10px;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.ctb-tab.ctb-active { color: var(--accent); border-bottom-color: var(--accent); }
.ctb-tab-util {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-left: 1px solid var(--border);
  color: var(--section-color);
  flex-shrink: 0;
}

/* ── CTB: panels ── */
.ctb-panel { padding: 5px 10px 6px; }

/* ── CTB: rows (horizontal scroll) ── */
.ctb-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 4px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ctb-row::-webkit-scrollbar { display: none; }
.ctb-row + .ctb-row { margin-top: 2px; }

/* ── CTB: recent row ── */
.ctb-recent-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 4px;
  padding: 3px 0 5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ctb-recent-row::-webkit-scrollbar { display: none; }
.ctb-label {
  font-size: 9px;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  color: var(--muted);
  white-space: nowrap;
  align-self: center;
  padding-right: 2px;
  flex-shrink: 0;
}

/* ── CTB: chord buttons ── */
.chord-btn {
  padding: 6px 10px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--chord);
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .1s;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
}
.chord-btn:hover  { background: var(--border); color: white; }
.chord-btn:active { transform: scale(.94); }

/* root selected state */
.ctb-root-active {
  background: var(--accent) !important;
  color: #000 !important;
  border-color: var(--accent) !important;
}

/* ── CTB: slash input ── */
.ctb-slash-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 2px;
}
.ctb-slash-input {
  width: 64px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: white;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-size: 13px;
}

/* ── CTB: color hint ── */
.ctb-hint {
  font-size: 9px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  white-space: nowrap;
  align-self: center;
  padding-left: 4px;
}

/* migrate button (tab-bar variant) */
.migrate-btn {
  padding: 5px 10px;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--section-color);
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: all .1s;
  flex-shrink: 0;
}
.migrate-btn:hover { background: rgba(91,141,238,.1); }

/* toolbar collapse toggle */
.ctb-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.ctb-collapse-btn:hover { color: var(--accent); }

/* preview area (legacy admin panel) */
.preview-label {
  font-size: 9px;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 8px 14px 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#songPreview {
  padding: 8px 0;
}
#songPreview .block {
  opacity: 1 !important;
  border-left: none !important;
  background: none !important;
  padding: 8px 14px;
}

/* ── SONG EDITOR HEADER ── */
.se-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.se-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all .15s;
}
.se-back-btn:hover { border-color: var(--accent); color: var(--accent); }

.se-title-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: white;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Sarabun', sans-serif;
  padding: 4px 2px;
  outline: none;
  transition: border-color .15s;
}
.se-title-input:focus { border-bottom-color: var(--accent); }
.se-title-input::placeholder { color: var(--muted); font-weight: 400; font-size: 14px; }

.se-key-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 1px;
}
.se-key-label {
  font-size: 8px;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  color: var(--accent);
  letter-spacing: .12em;
  opacity: .7;
  line-height: 1;
}
.se-key-input {
  width: 96px;
  background: rgba(240,192,64,.06);
  border: 1px solid rgba(240,192,64,.3);
  border-radius: 5px;
  color: var(--accent);
  font-size: 13px;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-weight: 700;
  padding: 3px 4px;
  outline: none;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.se-key-input:focus { border-color: var(--accent); background: rgba(240,192,64,.12); }
.se-key-input::placeholder { color: var(--muted); font-weight: 400; }

.se-toggle-btn {
  padding: 5px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.se-save-btn {
  padding: 6px 14px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #000;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.se-save-btn:active { opacity: .8; }

/* ── HEADER ACTIONS GROUP (Key + Save) ── */
.se-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: 10px;
}

/* ── SONG EDITOR META ROW (author / tags / youtube) ── */
.se-meta-row {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.se-meta-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  min-width: 0;
  overflow: hidden;
}
.se-meta-field + .se-meta-field {
  border-left: 1px solid var(--border);
}
/* author gets slightly more space, youtube slightly less */
.se-meta-author { flex: 1.2; }
.se-meta-tags   { flex: 1.3; }
.se-meta-yt     { flex: 1; }
.se-meta-bpm    { flex: .6; }
.se-meta-ts     { flex: .6; }

.se-meta-icon {
  flex-shrink: 0;
  color: var(--muted);
  opacity: .5;
}
.se-author-input, .se-tags-input, .se-yt-input, .se-bpm-input, .se-ts-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  padding: 2px 0;
  outline: none;
}
.se-author-input { font-family: 'Sarabun', sans-serif; font-size: 12px; }
.se-author-input:focus, .se-tags-input:focus, .se-yt-input:focus, .se-bpm-input:focus, .se-ts-input:focus { color: white; }
.se-author-input::placeholder, .se-tags-input::placeholder, .se-yt-input::placeholder, .se-bpm-input::placeholder { color: var(--muted); opacity: .6; }
/* number spinner off; select matches dark theme */
.se-bpm-input::-webkit-outer-spin-button, .se-bpm-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.se-bpm-input { -moz-appearance: textfield; }
.se-ts-input { cursor: pointer; }
.se-ts-input option { background: var(--surface); color: var(--text); }

/* ── SONG EDITOR CONTENT TEXTAREA ── */
.se-content {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: var(--bg);
  border: none;
  color: white;
  resize: none;
  outline: none;
  line-height: 1.7;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  font-size: 13px;
  padding: 14px 12px;
}
.se-content::placeholder { color: var(--muted); opacity: .45; }

/* ── PREVIEW LABEL ── */
.se-preview-label {
  font-size: 9px;
  font-family: 'IBM Plex Mono', 'Sarabun', monospace;
  color: var(--muted);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  opacity: .6;
}

/* ── SONG EDITOR OVERLAY ── */
.song-editor-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 70;
  display: none;
  flex-direction: column;
}
.song-editor-overlay.show { display: flex; }

/* split: editor left | preview right */
.se-split {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.se-editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.se-preview-pane {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
  min-width: 0;
}

#sePreview {
  padding: 8px 0;
}
#sePreview .block {
  opacity: 1 !important;
  border-left: none !important;
  background: none !important;
  padding: 8px 14px;
}

/* Mobile/Tablet (<1024px): hide preview pane, show toggle button */
@media (max-width: 1023px) {
  .se-preview-pane { display: none; }
  .se-toggle-btn { display: inline-flex !important; }
}

/* ── SPLIT RESIZER ── */
.se-resizer {
  display: none;
  width: 6px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  position: relative;
  z-index: 1;
}
.se-resizer:hover { background: rgba(240,192,64,.3); }
.se-resizer.dragging { background: var(--accent); }
.se-resizer-handle {
  width: 2px;
  height: 32px;
  background: var(--muted);
  border-radius: 2px;
  opacity: .5;
  pointer-events: none;
}
.se-resizer.dragging .se-resizer-handle { opacity: 1; background: var(--accent); }

/* Desktop (>=1024px): both panes side-by-side, hide toggle + larger UI */
@media (min-width: 1024px) {
  .se-resizer { display: flex; }
  .se-toggle-btn { display: none !important; }

  /* Content textarea */
  .se-content { font-size: 14px; padding: 16px; line-height: 1.75; }

  /* Preview pane */
  #sePreview .block { padding: 10px 20px; }

  /* Chord buttons */
  .chord-btn { min-height: 30px; padding: 5px 9px; }
}

/* ── CHORD DRAG-AND-DROP (editor preview only) ── */
#sePreview .b-chord-over[draggable] {
  cursor: grab;
  user-select: none;
  border-radius: 3px;
  transition: background .1s, color .1s;
}
#sePreview .b-chord-over[draggable]:hover {
  background: rgba(96,165,250,.15);
  color: var(--accent, #60a5fa);
}
#sePreview .b-chord-over[draggable]:active {
  cursor: grabbing;
}

/* ── TAP-TO-PLACE: chords look like tappable chips on mobile ── */
@media (max-width: 768px) {
  #sePreview .b-chord-over[data-chord-idx] {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 5px;
    padding: 1px 6px;
    cursor: pointer;
  }
}
/* selected chord — prominent (tap a lyric position to move it here) */
#sePreview .b-chord-over.chord-selected {
  background: var(--accent) !important;
  color: #0d0f14 !important;
  border-color: var(--accent) !important;
  border-radius: 5px;
}

/* a chord wider than its syllable must not touch the next chord ("Dm7 F", not "Dm7F") */
.b-chord-over { padding-right: .4em; }

/* ── IMPORT QUEUE BAR ── */
.se-queue-bar { display: flex; align-items: center; gap: 10px; padding: 6px 14px; background: rgba(91,141,238,.1); border-bottom: 1px solid var(--border); font-size: 13px; min-width: 0; }
.seq-pos { font-family: 'IBM Plex Mono', 'Sarabun', monospace; font-weight: 700; color: var(--section-color); flex-shrink: 0; }
.seq-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.seq-dup { flex-shrink: 0; color: #ff8a8a; font-weight: 600; }
.seq-skip { margin-left: auto; flex-shrink: 0; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 13px; cursor: pointer; }

/* ── PREVIEW: undo + selected-chord nudge bar ── */
.se-preview-label { display: flex; align-items: center; gap: 8px; }
.se-preview-hint { font-family: 'Sarabun', sans-serif; letter-spacing: 0; text-transform: none; color: var(--muted); font-size: 12px; }
.se-undo-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-family: 'Sarabun', sans-serif; font-size: 12px; letter-spacing: 0; text-transform: none; cursor: pointer; }
.se-undo-btn:disabled { opacity: .35; cursor: default; }
.se-chord-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--accent); }
.scb-name { min-width: 44px; padding: 4px 8px; border-radius: 5px; background: var(--accent); color: #0d0f14; font-family: 'IBM Plex Mono', 'Sarabun', monospace; font-weight: 700; text-align: center; }
.scb-btn { height: 40px; min-width: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.scb-del { color: #ff8a8a; }
.scb-done { color: var(--accent); }
.scb-hint { color: var(--muted); font-size: 12px; }

/* ═══ DESIGN SYSTEM (Sprint 5) — song editor speaks the app's language ═══
   Sarabun for every label/input; mono stays on chords (.chord-btn, .scb-name) and the ChordPro textarea */
.ctb-tab, .migrate-btn, .se-toggle-btn, .se-save-btn, .se-key-input, .se-key-label, .se-preview-label,
.se-author-input, .se-tags-input, .se-yt-input, .se-bpm-input, .se-ts-input, .seq-pos {
  font-family: var(--font-ui); letter-spacing: normal; text-transform: none;
}
.ctb-tab { font-size: 14px; font-weight: 600; padding: 8px 4px; }
.migrate-btn { font-size: 13px; }
.se-key-label { font-size: 11px; letter-spacing: normal; opacity: 1; }
.se-preview-label { font-size: 13px; font-weight: 700; opacity: 1; }
.se-author-input, .se-tags-input, .se-yt-input, .se-bpm-input, .se-ts-input { font-size: 13px; color: var(--text); }
.se-author-input::placeholder, .se-tags-input::placeholder, .se-yt-input::placeholder, .se-bpm-input::placeholder { opacity: 1; }
.se-save-btn { font-size: 15px; border-radius: var(--r-md); color: #0d0f14; }
.se-toggle-btn { font-size: 14px; color: var(--text); border-color: #343a4a; border-radius: var(--r-md); }
.se-back-btn { border-radius: var(--r-md); }
.se-back-btn:focus-visible, .se-save-btn:focus-visible, .se-toggle-btn:focus-visible, .ctb-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.migrate-btn { display: inline-flex; align-items: center; white-space: nowrap; }
.se-ts-input:has(option[value=""]:checked) { color: var(--muted); }

/* I-7 · compact song metadata; each workspace scrolls independently.
   ID scope wins over legacy shared controls without layout !important. */
#songEditorOverlay { --se-edge: 16px; overflow: hidden; height: 100dvh; }
#songEditorOverlay .se-header { gap: 12px; padding: 8px var(--se-edge); flex-wrap: nowrap; }
#songEditorOverlay .se-heading { margin: 0; flex: 1; font: 700 21px/1.5 var(--font-ui); }
#songEditorOverlay .se-header-actions { border: 0; padding: 0; flex: none; }
#songEditorOverlay button, #songEditorOverlay .chord-btn { min-height: 44px; min-width: 44px; }
#songEditorOverlay .se-back-btn { width: 44px; height: 44px; border-radius: 12px; }
#songEditorOverlay .se-save-btn { height: 44px; padding: 0 20px; }
#songEditorOverlay .se-primary-row { display: grid; grid-template-columns: 64px minmax(80px,96px) minmax(80px,96px); gap: 8px; padding: 8px var(--se-edge) 0; flex-shrink: 0; align-items: end; }
#songEditorOverlay .se-title-field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; min-width: 0; font: 13px/1.5 var(--font-ui); color: var(--muted); }
#songEditorOverlay input, #songEditorOverlay select { font: 400 16px/1.5 var(--font-ui); min-width: 0; height: 44px; box-sizing: border-box; }
#songEditorOverlay .se-title-input { width: 100%; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
#songEditorOverlay .se-title-input::placeholder { font-size: 16px; }
#songEditorOverlay .se-key-wrap { position: relative; gap: 0; flex-direction: row; }
#songEditorOverlay .se-key-label { position: absolute; left: 0; top: -24px; visibility: hidden; }
#songEditorOverlay .se-key-input { width: 64px; height: 44px; padding: 4px; color: var(--accent); border-color: var(--accent); border-radius: 12px; opacity: 1; }
#songEditorOverlay .se-meta-field { padding: 0 10px; min-height: 44px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; gap: 6px; }
#songEditorOverlay .se-meta-icon { opacity: 1; }
#songEditorOverlay .se-primary-row .se-meta-field { width: 96px; max-width: 100%; box-sizing: border-box; }
#songEditorOverlay .se-meta-field input, #songEditorOverlay .se-meta-field select { width: 100%; color: var(--text); }
#songEditorOverlay .se-meta-toggle { display: flex; align-items: center; gap: 8px; padding: 0 var(--se-edge); border: 0; background: transparent; color: var(--muted); font: 14px/1.5 var(--font-ui); text-align: left; flex-shrink: 0; cursor: pointer; }
#songEditorOverlay .se-meta-toggle > span:first-of-type { flex-shrink: 0; white-space: nowrap; }
#songEditorOverlay .se-meta-sum { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#songEditorOverlay.meta-open .se-meta-toggle svg { transform: rotate(180deg); }
#songEditorOverlay .se-meta-row { display: none; grid-template-columns: minmax(0,1fr); gap: 8px; padding: 0 var(--se-edge) 8px; background: transparent; border: 0; max-height: 26dvh; overflow: auto; }
#songEditorOverlay.meta-open .se-meta-row { display: grid; }
#songEditorOverlay .se-meta-tags, #songEditorOverlay .se-meta-yt { grid-column: auto; grid-row: auto; }
#songEditorOverlay .se-view-actions { display: flex; padding: 0 var(--se-edge) 8px; flex-shrink: 0; }
#songEditorOverlay .se-view-chip { display: inline-flex; align-items: center; justify-content: center; line-height: 1.5; border-radius: 0; margin-left: -1px; }
#songEditorOverlay .se-view-chip:first-child { border-radius: 12px 0 0 12px; margin-left: 0; }
#songEditorOverlay .se-view-chip:last-child { border-radius: 0 12px 12px 0; }
#songEditorOverlay .se-view-chip.active { position: relative; z-index: 1; background: var(--accent); border-color: var(--accent); color: #0d0f14; }
#songEditorOverlay .se-toggle-btn { padding: 0 16px; height: 44px; }
#songEditorOverlay .se-split { padding: 0 var(--se-edge) max(12px,env(safe-area-inset-bottom)); gap: 0; }
#songEditorOverlay .se-editor-pane { min-height: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
#songEditorOverlay .chord-toolbar { max-height: 36dvh; overflow: auto; }
#songEditorOverlay .chord-toolbar.collapsed { max-height: none; overflow: hidden; }
#songEditorOverlay .ctb-tabs { min-height: 64px; align-items: center; padding: 8px; gap: 4px; overflow-x: auto; }
#songEditorOverlay .ctb-tab { flex: 0 0 auto; padding: 8px 12px; font: 600 14px/1.5 var(--font-ui); white-space: nowrap; border-radius: 8px; }
#songEditorOverlay .ctb-tab.ctb-active { background: var(--surface-2); }
#songEditorOverlay .ctb-collapse-btn { width: 44px; height: 44px; margin-left: auto; }
#songEditorOverlay .migrate-btn { font: 13px/1.5 var(--font-ui); padding: 4px 8px; }
#songEditorOverlay .chord-btn { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; flex-shrink: 0; line-height: 1.5; }
#songEditorOverlay .ctb-hint { font: 12px/1.5 var(--font-ui); }
#songEditorOverlay .se-content { font-size: 16px; padding: 16px; overflow: auto; overscroll-behavior: contain; }
#songEditorOverlay .se-preview-pane { position: relative; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 12px; overscroll-behavior: contain; }
#songEditorOverlay .se-preview-label { position: sticky; top: 0; z-index: 2; min-height: 64px; box-sizing: border-box; padding: 8px 12px; background: var(--surface); color: var(--text); font: 600 16px/1.5 var(--font-ui); opacity: 1; }
#songEditorOverlay .se-preview-hint { font-size: 12px; line-height: 1.5; }
#songEditorOverlay .se-undo-btn { height: 44px; flex-shrink: 0; }
#songEditorOverlay .se-chord-bar { min-height: 44px; }
#songEditorOverlay .scb-btn { height: 44px; }
#songEditorOverlay .se-queue-bar { flex-wrap: wrap; padding: 4px var(--se-edge); gap: 8px; font: 13px/1.5 var(--font-ui); }
#songEditorOverlay .seq-pos { font-family: var(--font-ui); }
#songEditorOverlay .seq-name { flex: 1; min-width: 80px; line-height: 1.5; }
#songEditorOverlay .seq-dup { white-space: normal; }
#songEditorOverlay .seq-skip { height: 44px; }
#songEditorOverlay button:focus-visible, #songEditorOverlay input:focus-visible, #songEditorOverlay select:focus-visible, #songEditorOverlay textarea:focus-visible, #songEditorOverlay .chord-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (min-width: 600px) {
  #songEditorOverlay .se-primary-row { grid-template-columns: minmax(0,1fr) 64px 96px 96px; gap: 12px; }
  #songEditorOverlay .se-title-field { grid-column: auto; }
  #songEditorOverlay .se-meta-row { grid-template-columns: minmax(0,240px) minmax(0,200px) minmax(0,320px); }
}
@media (min-width: 1024px) {
  #songEditorOverlay { --se-edge: max(24px,var(--edge)); }
  #songEditorOverlay .se-view-actions { display: none; }
  #songEditorOverlay .se-split { gap: 0; }
  #songEditorOverlay .se-resizer { width: 24px; background: transparent; }
  /* Inline visibility from the phone toggle must not hide either PC column. */
  #songEditorOverlay #seEditorPane { display: flex !important; }
  #songEditorOverlay #sePreviewPane { display: block !important; }
}
@media (max-height: 500px) {
  #songEditorOverlay .se-header { padding-block: 2px; }
  #songEditorOverlay .se-primary-row { padding-top: 4px; grid-template-columns: minmax(80px,1fr) 64px 80px 80px; gap: 4px; }
  #songEditorOverlay .se-title-field { grid-column: auto; }
  #songEditorOverlay .se-title-field > span { display: none; }
  #songEditorOverlay .se-meta-toggle { min-height: 44px; }
  #songEditorOverlay .se-view-actions { padding-bottom: 4px; }
  #songEditorOverlay .ctb-tabs { min-height: 44px; padding-block: 0; }
  #songEditorOverlay .chord-toolbar { max-height: 28dvh; }
}

