/* ════════════════════════════════════════════
   TOKENS
════════════════════════════════════════════ */
:root {
  /* Paper surfaces */
  --paper:      #faf7f2;
  --paper-1:    #f4f0e8;
  --paper-2:    #ece7dc;
  --paper-3:    #e0d9cc;

  /* Ink */
  --ink:        #1a160f;
  --ink-2:      #5a5244;
  --ink-3:      #9a9082;
  --ink-4:      #c8bfb0;

  /* Borders */
  --rule:       rgba(26,22,15,0.12);
  --rule-hi:    rgba(26,22,15,0.22);

  /* Accent — indigo */
  --indigo:       #2b4acb;
  --indigo-light: rgba(43,74,203,0.1);
  --indigo-mid:   rgba(43,74,203,0.22);
  --indigo-border:rgba(43,74,203,0.38);

  /* Accent — teal */
  --teal:         #0d8f6f;
  --teal-light:   rgba(13,143,111,0.1);
  --teal-mid:     rgba(13,143,111,0.2);
  --teal-border:  rgba(13,143,111,0.36);

  /* Accent — amber */
  --amber:        #b85c00;
  --amber-light:  rgba(184,92,0,0.1);
  --amber-mid:    rgba(184,92,0,0.18);
  --amber-border: rgba(184,92,0,0.38);

  /* Danger */
  --red:          #b82020;
  --red-light:    rgba(184,32,32,0.08);
  --red-border:   rgba(184,32,32,0.32);

  /* Canvas bg — exposed to JS via body background */
  --canvas-bg:  #faf7f2;

  /* Typography */
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans:  'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, Menlo, monospace;

  /* Layout */
  --topbar-h:    46px;
  --transport-h: 42px;
  --sticky-transport-h: var(--transport-h);
  --sidebar-w:   300px;
  --r:           6px;
  --r-lg:        10px;
}

/* ════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}

button, input, select, textarea { font: inherit; }

:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

/* ════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 12px;
  min-height: 30px;
  border-radius: var(--r);
  border: 1px solid var(--rule-hi);
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, box-shadow 0.1s, transform 0.07s;
  box-shadow: 0 1px 2px rgba(26,22,15,0.06);
}
.btn:hover  { background: var(--paper-1); border-color: var(--rule-hi); box-shadow: 0 1px 3px rgba(26,22,15,0.1); }
.btn:active { transform: translateY(1px); box-shadow: none; }

.btn-sm  { padding: 4px 9px;  min-height: 26px; font-size: 11.5px; }
.btn-xs  { padding: 3px 7px;  min-height: 22px; font-size: 11px; }

.btn-ghost {
  background: transparent;
  border-color: var(--rule);
  box-shadow: none;
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--paper-1); border-color: var(--rule-hi); color: var(--ink); }

.btn-ink {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  box-shadow: 0 1px 3px rgba(26,22,15,0.18);
}
.btn-ink:hover { background: #2e2820; border-color: #2e2820; }

.btn-play {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
  font-weight: 600;
  min-width: 64px;
  box-shadow: 0 1px 4px rgba(43,74,203,0.3);
}
.btn-play:hover { background: #2340b0; border-color: #2340b0; }

.btn-teal {
  background: var(--teal-light);
  border-color: var(--teal-border);
  color: var(--teal);
}
.btn-teal:hover { background: var(--teal-mid); }

.btn-amber {
  background: var(--amber-light);
  border-color: var(--amber-border);
  color: var(--amber);
}
.btn-amber:hover { background: var(--amber-mid); }

.btn-red-hover:hover {
  background: var(--red-light);
  border-color: var(--red-border);
  color: var(--red);
}

/* File picker button */
.file-btn {
  position: relative;
  overflow: hidden;
}
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ════════════════════════════════════════════
   FORM CONTROLS
════════════════════════════════════════════ */
input[type="text"],
input[type="number"],
select,
textarea {
  border-radius: var(--r);
  border: 1px solid var(--rule-hi);
  background: #fff;
  color: var(--ink);
  padding: 5px 8px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(43,74,203,0.12);
  outline: none;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  background: #fff;
}

select { width: 100%; cursor: pointer; }

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--ink-3);
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s;
}
input[type="checkbox"]:checked {
  background: var(--indigo);
  border-color: var(--indigo);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 6px;
  height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg);
}

/* Range */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--paper-3);
  border-radius: 99px;
  border: none;
  outline: none;
  cursor: pointer;
  flex: 1;
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--indigo);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(43,74,203,0.3);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--indigo);
  border: 2px solid #fff;
  cursor: pointer;
}

/* ════════════════════════════════════════════
   INLINE HELPERS
════════════════════════════════════════════ */
.mono-btn { font-family: var(--mono); }

.check-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.check-pair:hover { color: var(--ink); }
.check-pair--hd { margin-left: auto; margin-right: 6px; }

/* ════════════════════════════════════════════
   TAGS / CHIPS
════════════════════════════════════════════ */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule-hi);
  background: #fff;
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(26,22,15,0.05);
}
.tag--mono { font-family: var(--mono); }
.tag--file { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.tag--mode {
  background: var(--teal-light);
  border-color: var(--teal-border);
  color: var(--teal);
  font-weight: 500;
}
.tag--sync {
  background: var(--indigo-light);
  border-color: var(--indigo-border);
  color: var(--indigo);
  font-weight: 500;
  font-family: var(--mono);
}

/* Legend pills */
.legend {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
}
.selected-legend { background: var(--amber-light); border-color: var(--amber-border); color: var(--amber); }
.sounding-legend  { background: var(--indigo-light); border-color: var(--indigo-border); color: var(--indigo); }
.done-legend      { background: var(--teal-light); border-color: var(--teal-border); color: var(--teal); }

/* ════════════════════════════════════════════
   TOPBAR
════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-shrink: 0;
}
.brand-serif {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand-mono {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink);
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.08em;
}

.topbar-mid {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.project-field { display: flex; align-items: center; }
.project-field input {
  width: 160px;
  height: 28px;
  font-size: 12px;
  font-family: var(--serif);
  font-style: italic;
  padding: 4px 9px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.save-status {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink-3);
  white-space: nowrap;
}

/* ════════════════════════════════════════════
   TRANSPORT
════════════════════════════════════════════ */
.transport {
  height: var(--transport-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: var(--paper-1);
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 50;
}
.transport::-webkit-scrollbar { height: 3px; }
.transport::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 2px; }

.t-group { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.t-div   { width: 1px; height: 18px; background: var(--rule); margin: 0 3px; flex-shrink: 0; }

.t-scrub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 160px;
}

.time-chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 3px 8px;
  white-space: nowrap;
  min-width: 58px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(26,22,15,0.05);
}
.time-chip--dim { color: var(--ink-3); }

.scrubber { flex: 1; }

/* ════════════════════════════════════════════
   WORKSPACE
════════════════════════════════════════════ */
.workspace {
  display: flex;
  height: calc(100vh - var(--topbar-h) - var(--transport-h));
  overflow: hidden;
}

/* ════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════ */
.sidebar {
  position: relative;
  width: min-content;
  min-width: 220px;
  max-width: 520px;
  background: var(--paper-1);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 2px; }

/* Drag-to-resize handle on right edge */
.sidebar-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}
.sidebar-resize:hover,
.sidebar-resize:active {
  background: var(--indigo-border);
}

/* Selected badge strip */
.sel-badge {
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule);
  background: #fff;
  flex-shrink: 0;
}
.sel-badge__text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Collapsible panels */
.panel {
  border-bottom: 1px solid var(--rule);
}

.panel > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  user-select: none;
  background: var(--paper-1);
  transition: background 0.1s;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary:hover { background: var(--paper-2); }

.panel__title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  flex: 1;
}

.panel__hd-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.panel__arrow {
  font-size: 10px;
  color: var(--ink-3);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.panel:not([open]) .panel__arrow { transform: rotate(-90deg); }

.panel__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: #fff;
}

/* Sidebar field patterns */
.field-stacked {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field-stacked input,
.field-stacked select {
  height: 30px;
  font-size: 12px;
  width: 100%;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.slider-row__lbl {
  font-size: 11px;
  color: var(--ink-2);
  min-width: 54px;
  white-space: nowrap;
}
.slider-row__val {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink);
  min-width: 42px;
  text-align: right;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 5px; }

.nudge-strip {
  display: flex;
  align-items: center;
  gap: 5px;
}
.nudge-strip__lbl {
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
  margin-right: 2px;
}

.sel-detail {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0;
}

/* 3-col timing grid */
.timing-trio {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
}
.timing-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.timing-cell__lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 3px;
}
.timing-cell input {
  width: 100%;
  height: 30px;
  font-size: 12px;
  font-family: var(--mono);
  padding: 4px 7px;
}
.pitch-note {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--amber);
  text-transform: none;
  letter-spacing: 0;
}

.hint {
  font-size: 10.5px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 0;
}

/* ════════════════════════════════════════════
   MAIN PANE
════════════════════════════════════════════ */
.mainpane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  flex: 1;
  background: var(--paper);
}

/* Collapsible main sections */
.main-section {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

/* Flex sections grow to fill remaining height when open */
.main-section--flex.is-open {
  flex: 1;
  min-height: 0;
}

.section-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Hide body when not open */
.main-section:not(.is-open) .section-body {
  display: none;
}

/* Summary row acts as section-bar when clickable */
.section-bar--clickable {
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.section-bar--clickable::-webkit-details-marker { display: none; }
.section-bar--clickable:hover { background: var(--paper-2); }

.section-bar__arrow {
  font-size: 10px;
  color: var(--ink-3);
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 4px;
}
.main-section:not(.is-open) .section-bar__arrow { transform: rotate(-90deg); }

.section-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px;
  background: var(--paper-1);
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.section-bar__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-shrink: 0;
}
.section-bar__right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  flex: 1;
}
.view-range {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink-3);
  margin-left: auto;
}

.field-inline-sm {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-2);
}
.field-inline-sm input {
  width: 52px;
  height: 24px;
  font-size: 11px;
  padding: 2px 6px;
}

/* Canvas wrappers */
.canvas-body {
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.timeline-wrap { height: clamp(130px, 25vh, 270px); }
.overview-wrap { height: 48px; border-top: 1px solid var(--rule); background: var(--paper-1); }
.pitch-wrap    { flex: 1; min-height: 100px; height: 100%; }

/* Make canvas-body fill the flex element when open */
.main-section--flex.is-open .canvas-body {
  flex: 1;
  min-height: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  cursor: crosshair;
  background: var(--canvas-bg);
}

/* ════════════════════════════════════════════
   LYRICS STAGE
════════════════════════════════════════════ */
.lyrics-stage {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  min-height: 0;
  background: #fff;
}
.lyrics-stage::-webkit-scrollbar { width: 4px; }
.lyrics-stage::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 2px; }

.lyric-line {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: flex-start;
  padding: 2px 0;
  border-radius: var(--r);
  transition: background 0.1s;
}
.lyric-line.active { background: var(--indigo-light); }
.lyric-line.selected-line {
  outline: 1px solid var(--indigo-border);
  outline-offset: 1px;
}

/* JS creates .line-jump.compact — keep .compact harmless */
.line-jump, .line-jump.compact {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--ink-3);
  text-align: right;
  padding: 3px 2px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  min-height: auto;
  min-width: auto;
  box-shadow: none;
  transition: color 0.1s, background 0.1s;
}
.line-jump:hover { color: var(--ink); background: var(--paper-2); }

.line-content {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  padding-top: 2px;
}

.lyric-word {
  display: inline-flex;
  align-items: center;
  padding: 1px 3px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.lyric-word:hover { border-color: var(--rule-hi); background: var(--paper-1); }
.lyric-word.selected-word {
  border-color: var(--indigo-border);
  background: var(--indigo-light);
}
.lyric-word.unsynced { opacity: 0.45; }

/* Syllables */
.syllable {
  --fill: 0%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 1px 2px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13.5px;
  font-family: var(--serif);
  isolation: isolate;
}
.syllable::before {
  content: '';
  position: absolute;
  inset: 2px 0;
  width: var(--fill);
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(13,143,111,0.45), rgba(43,74,203,0.35));
  z-index: -1;
}
.syllable::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.syllable.is-sounding::after {
  border-color: var(--indigo);
  box-shadow: 0 0 0 2px var(--indigo-light);
}
.syllable.is-complete { color: var(--teal); }
.syllable.is-unsynced { color: var(--ink-3); }
.syllable.is-unsynced::after {
  border-color: var(--rule);
  border-style: dashed;
}

/* placement matters here to override alpha border color for .is-unsynced */
.syllable.is-selected::after {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px var(--amber-light);
}

.syllable-joiner {
  color: var(--ink-4);
  font-size: 11px;
  user-select: none;
}

/* ════════════════════════════════════════════
   EMPTY STATE
════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  text-align: center;
  color: var(--ink-3);
  padding: 20px;
  gap: 4px;
}
.empty-icon  { font-size: 32px; opacity: 0.35; margin: 0; line-height: 1; }
.empty-title { font-family: var(--serif); font-size: 15px; color: var(--ink-2); margin: 0; }
.empty-body  { font-size: 12px; margin: 0; }

/* ════════════════════════════════════════════
   SCROLLBARS
════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--paper-2); }

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 1060px) { .sidebar { min-width: 200px; } }

@media (max-width: 800px) {
  .workspace {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  body { overflow: auto; }
  .sidebar {
    width: 100% !important;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    overflow: visible;
  }
  .sidebar-resize { display: none; }
  .mainpane { height: 80vh; overflow: visible; }
  .timeline-wrap { height: 180px; }
  .timing-trio { grid-template-columns: 1fr 1fr; }
  .topbar { height: auto; padding: 8px 14px; }
  .transport { position: sticky; top: 0; height: auto; flex-wrap: wrap; padding: 8px 14px; gap: 6px; }
  .t-scrub { min-width: 100%; }

  .panel[open] > summary,
  .main-section.is-open > .section-bar {
    position: sticky;
    top: var(--sticky-transport-h);
    z-index: 35;
    box-shadow: 0 1px 0 var(--rule);
  }
}

@media (max-width: 760px) {
  .keybind-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .topbar-mid { flex-wrap: wrap; }
  .brand-serif { font-size: 15px; }
}
/* ════════════════════════════════════════════
   ADDITIONS & OVERRIDES
════════════════════════════════════════════ */

/* Check pair row — side-by-side checkboxes */
.check-pair-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

/* Extras group in transport — can wrap */
.t-group--extras {
  flex-wrap: wrap;
}

/* ── Responsive topbar ── */
@media (max-width: 900px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 6px 12px;
    gap: 6px;
  }
  .topbar-mid {
    flex-wrap: wrap;
    gap: 6px;
  }
  .topbar-actions {
    flex-wrap: wrap;
    gap: 4px;
  }
  .topbar-status {
    flex-wrap: wrap;
    gap: 5px;
  }
  .save-status {
    font-size: 10px;
  }
  .project-field input {
    width: 120px;
  }
}

@media (max-width: 680px) {
  .brand-serif { font-size: 14px; }
  .tag--file { max-width: 110px; }
}

/* ── Responsive transport ── */
@media (max-width: 900px) {
  .transport {
    height: auto;
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 4px 6px;
  }
  .t-div { display: none; }
  .t-group { flex-wrap: wrap; }
  .t-scrub { min-width: 100%; order: 99; }
}

/* ── Selected syllable: override faded unsynced when selected ── */
.lyric-word.unsynced .syllable.is-selected,
.lyric-word.unsynced:has(.syllable.is-selected) {
  opacity: 1;
}
/* Make word container not fade when it contains the selected syllable */
.lyric-word.unsynced:has(.syllable.is-selected) {
  opacity: 1;
}

/* is-selected always wins over is-sounding visually */
.syllable.is-selected.is-sounding::after {
  border-color: var(--amber) !important;
  box-shadow: 0 0 0 2px var(--amber-light) !important;
}

/* Snap indicator on timeline blocks */
.snap-active canvas {
  cursor: ew-resize;
}

/* Word that contains the currently selected syllable — override unsynced fade */
.lyric-word.unsynced.has-selected-syllable {
  opacity: 1;
}

/* ════════════════════════════════════════════
   IMPORT SPLIT BUTTON
════════════════════════════════════════════ */
.split-btn {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
}

.split-btn > .btn {
  position: relative;
  border-radius: 0;
  box-shadow: none;
}

.split-btn__main {
  border-top-left-radius: var(--r) !important;
  border-bottom-left-radius: var(--r) !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  padding-right: 11px;
}

.split-btn__toggle {
  min-width: 28px;
  padding: 5px 8px;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-top-right-radius: var(--r) !important;
  border-bottom-right-radius: var(--r) !important;
  margin-left: -1px;
}

.split-btn__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: max(100%, 132px);
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(26,22,15,0.12);
  z-index: 120;
}

.split-btn__menu-item {
  display: block;
  width: 100%;
  justify-content: flex-start;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: calc(var(--r) - 1px);
  text-align: left;
}

.keybind-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.keybind-field input {
  font-family: var(--mono);
}

.field-label--with-warning {
  display: flex;
  align-items: center;
  gap: 5px;
}

.keybind-warning-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  color: var(--amber);
  cursor: help;
}
