/* Cut-Up — newsprint on a dark table, with scissors. */

:root {
  --bg: #14140f;
  --bg-panel: #1c1c16;
  --bg-sunk: #100f0b;
  --ink: #eae6d9;
  --ink-dim: #a39d8c;
  --ink-faint: #6d685c;
  --paper: #e8e2d0;
  --paper-ink: #1a1813;
  --accent: #e2543c;
  --accent-soft: #f0a58e;
  --line: #33322a;
  --ok: #7fbf6a;
  --bass: #5b8dd6;
  --radius: 6px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Our own `display` rules would otherwise out-specify the browser's default
   [hidden] rule, so say it once, loudly. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding-bottom: 6rem;
  background:
    radial-gradient(circle at 20% -10%, #26251c 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: var(--accent-soft); }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1.4rem clamp(1rem, 4vw, 2.5rem) 0;
}

.brand { display: flex; gap: 0.85rem; align-items: center; }
.brand h1 { font-size: 1.6rem; }
.scissors { font-size: 1.9rem; color: var(--accent); transform: rotate(-18deg); }
.tagline { margin: 0.15rem 0 0; color: var(--ink-dim); font-size: 0.86rem; max-width: 46ch; }

.tabs { display: flex; gap: 0.25rem; }

.tab {
  appearance: none;
  border: 1px solid var(--line);
  border-bottom: none;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
}
.tab:hover { color: var(--ink); background: #201f18; }
.tab.is-active { background: var(--bg-panel); color: var(--ink); border-color: var(--line); }

/* ---------- layout ---------- */

main { padding: 0 clamp(1rem, 4vw, 2.5rem); }

.panel { border-top: 1px solid var(--line); padding-top: 1.4rem; }
.panel[hidden] { display: none; }

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

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

/* ---------- controls ---------- */

.controls { display: flex; flex-direction: column; gap: 1rem; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  padding: 0.9rem 1rem 1rem;
  margin: 0;
}

legend {
  padding: 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; }
.field:last-child { margin-bottom: 0; }
.field > span { font-size: 0.8rem; color: var(--ink-dim); display: flex; justify-content: space-between; gap: 0.5rem; }
.field.inline { flex-direction: row; align-items: center; gap: 0.5rem; margin: 0; }
.field.inline > span { white-space: nowrap; }

.row { display: flex; gap: 0.6rem; align-items: flex-end; margin-bottom: 0.75rem; }
.row:last-child { margin-bottom: 0; }
.row.wrap { flex-wrap: wrap; }
.row .field { margin-bottom: 0; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font: inherit;
  padding: 0.45rem 0.55rem;
}
textarea { resize: vertical; font-size: 0.9rem; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

input[type="range"] { width: 100%; accent-color: var(--accent); }
output { color: var(--ink-faint); font-family: var(--mono); font-size: 0.75rem; }

.check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--ink-dim); cursor: pointer; }
.check input { accent-color: var(--accent); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.4rem; }

.hint { color: var(--ink-faint); font-size: 0.76rem; line-height: 1.35; }
small { font-size: 0.76rem; color: var(--ink-faint); }

details summary { cursor: pointer; font-size: 0.8rem; color: var(--ink-dim); }
details[open] summary { margin-bottom: 0.5rem; }

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #26251d;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #302f24; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0f0c; font-weight: 600; }
.btn.primary:hover { background: #ef6449; }
.btn.ghost { background: transparent; color: var(--ink-dim); }
.btn.ghost:hover { color: var(--ink); background: #26251d; }
.btn.is-on { background: var(--accent); border-color: var(--accent); color: #1a0f0c; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.segmented { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
.segmented .btn { flex: 1 1 auto; }

/* ---------- output ---------- */

.output { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.output-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.section-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }

.lines {
  list-style: none;
  margin: 0;
  padding: 1.4rem clamp(1rem, 3vw, 2rem);
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  min-height: 8rem;
  /* Faint newsprint ruling. */
  background-image: repeating-linear-gradient(transparent 0 2.05rem, rgba(0, 0, 0, 0.06) 2.05rem 2.1rem);
}

.lines:empty::after {
  content: "Press “Cut it up”.";
  color: #8a8371;
  font-style: italic;
}

.line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  line-height: 2.1rem;
  font-size: 1.05rem;
}
.line .text { flex: 1; min-width: 0; }
.line.is-locked .text { text-decoration: underline wavy rgba(226, 84, 60, 0.5); }

.line-btn {
  appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.2rem;
  color: #a49b83;
  border-radius: 3px;
}
/* A closed and an open padlock emoji are hard to tell apart at this size, so
   lean on opacity to carry the state as well. */
.line-btn { opacity: 0.4; transition: opacity 0.12s ease; }
.line-btn:hover { color: var(--accent); background: rgba(0, 0, 0, 0.06); opacity: 1; }
.line-btn.is-on { color: var(--accent); opacity: 1; }

.titles ul { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.4rem 0 0; }
.titles li {
  font-family: var(--mono);
  font-size: 0.82rem;
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  color: var(--accent-soft);
}

.keepers { border-top: 1px solid var(--line); padding-top: 1rem; }
.keeper-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.keeper-list li {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.92rem;
  padding: 0.3rem 0.5rem;
  background: var(--bg-panel);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
}
.keeper-list li span { flex: 1; }
.keeper-list:empty::after { content: "Nothing kept yet."; color: var(--ink-faint); font-size: 0.82rem; }

/* ---------- chords ---------- */

.chord-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chord-card {
  position: relative;
  min-width: 7.5rem;
  flex: 1 1 7.5rem;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem 0.8rem;
  cursor: pointer;
  border: none;
  font: inherit;
  text-align: left;
  /* Torn-paper edge. */
  clip-path: polygon(0 0, 100% 0, 100% 94%, 92% 100%, 0 100%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
.chord-card:hover { background: #f3eddc; }
.chord-card.is-playing { outline: 2px solid var(--accent); }
.chord-card.is-locked { background: #f0e2c8; }
.chord-card .roman { font-family: var(--mono); font-size: 0.72rem; color: #8a7f66; letter-spacing: 0.06em; }
.chord-card .symbol { font-size: 1.3rem; font-weight: 650; line-height: 1.2; }
.chord-card .notes { font-family: var(--mono); font-size: 0.7rem; color: #6f6754; }
.chord-card .lock {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  font-size: 0.75rem;
  opacity: 0.35;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0.15rem;
}
.chord-card .lock.is-on, .chord-card .lock:hover { opacity: 1; color: var(--accent); }

.piano-roll {
  width: 100%;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: block;
  /* The roll is a drag surface, so a touch drag must not scroll the page. */
  touch-action: none;
}

/* Little colour key in the roll's caption. */
.swatch {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: 2px;
  vertical-align: -0.05em;
  background: var(--accent);
}
.swatch.edited { background: var(--ok); }
.swatch.bass { background: var(--bass); }

/* ---------- sections & song ---------- */

.section-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.6rem;
}

.section-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-faint);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.section-card.is-current { background: #221f19; box-shadow: inset 0 0 0 1px var(--accent); }
.section-card.is-current .section-name::after {
  content: "· open";
  margin-left: 0.35rem;
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
}
.section-card.kind-intro, .library-card.kind-intro { border-left-color: #6f9fc0; }
.section-card.kind-main, .library-card.kind-main { border-left-color: var(--accent); }
.section-card.kind-bridge, .library-card.kind-bridge { border-left-color: #c9a227; }
.section-card.kind-outro, .library-card.kind-outro { border-left-color: #8a7fc0; }

.section-head { display: flex; align-items: baseline; gap: 0.5rem; }
.section-name { font-size: 1.15rem; font-weight: 650; }
.section-kind {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
}
.section-meta { font-size: 0.74rem; color: var(--ink-dim); }
.section-chords {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-soft);
  overflow-wrap: anywhere;
}
/* What a composed section says about itself: the key it went to, the kit it
   swapped in, how hard it is played. */
.section-traits {
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-style: italic;
  overflow-wrap: anywhere;
}
.section-actions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.2rem; }
.section-actions .btn { padding: 0.25rem 0.5rem; font-size: 0.78rem; }

/* A button with two halves: the whole job on the left, the choice of job on
   the right. They read as one control, so they are drawn as one. */
.split-btn { display: inline-flex; }
.split-btn .btn { border-radius: 0; }
.split-btn .split-main { border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.split-btn .split-more {
  border-top-right-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  border-left-width: 0;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
.split-btn .split-more::before {
  content: "";
  display: block;
  position: absolute;
  inset: 0.25rem auto 0.25rem 0;
  border-left: 1px solid var(--line);
}
.split-btn .split-more { position: relative; }

/* One row per aspect in the regenerate dialog: the tick, and what it costs. */
.regen-aspects { display: grid; gap: 0.4rem; margin-bottom: 0.9rem; }
.regen-aspect { display: grid; gap: 0.1rem; }
.regen-aspect .hint { margin: 0 0 0 1.5rem; }

/* The key shortcuts, and the same list of moves the composer works from. */
.key-moves { gap: 0.3rem; margin: 0.5rem 0 0.2rem; }
.btn.small { padding: 0.2rem 0.5rem; font-size: 0.75rem; }

.regen-variations { display: grid; gap: 0.9rem; margin-bottom: 0.9rem; }
.regen-group { display: grid; gap: 0.4rem; }
.regen-group-label {
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
}
.regen-variation { display: grid; gap: 0.1rem; }
.regen-variation .hint { margin: 0 0 0 1.5rem; }
.regen-variation.is-dial .hint { margin-left: 0; }
.regen-variation.is-dial input[type="range"] { width: 100%; }
.regen-variation-label { font-size: 0.85rem; color: var(--ink-dim); }
.regen-variation-label output { color: var(--accent); }
.regen-variation.is-unavailable { opacity: 0.4; }
.regen-variation.is-unavailable .check { cursor: not-allowed; }
.btn.danger:hover { color: #ff8b73; }

/* The thumbs — see ui/marks.js. Lit means you have already said so. */
.mark-buttons { display: inline-flex; gap: 0.15rem; }
.mark-btn { padding: 0.25rem 0.4rem; line-height: 1; filter: grayscale(1); opacity: 0.6; }
.mark-btn:hover { filter: none; opacity: 1; }
.mark-btn.is-on { filter: none; opacity: 1; background: #37271f; border-color: var(--accent); }
.song-mark { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.6rem; }

fieldset.composer { border-color: var(--accent-soft); }
fieldset.composer > .hint { margin-bottom: 0.2rem; }
fieldset.composer #compose-minutes,
fieldset.composer #compose-letters { min-width: 6rem; }
fieldset.composer details { margin-top: 0.5rem; }
fieldset.composer details > summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--ink-dim);
  margin-bottom: 0.4rem;
}
fieldset.composer details > *:not(summary) { margin-bottom: 0.5rem; }
#compose-summary { display: block; margin-top: 0.4rem; }

.arrangement { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; }

.song-chip {
  position: relative;
  min-width: 6.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink-faint);
  border-radius: var(--radius);
  padding: 0.45rem 0.5rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: center;
}
.song-chip.kind-intro { border-top-color: #6f9fc0; }
.song-chip.kind-main { border-top-color: var(--accent); }
.song-chip.kind-bridge { border-top-color: #c9a227; }
.song-chip.kind-outro { border-top-color: #8a7fc0; }
.song-chip.is-playing { outline: 2px solid var(--ok); }

.chip-head { display: flex; align-items: center; gap: 0.15rem; }
.chip-name { font-weight: 650; font-size: 0.95rem; padding: 0 0.2rem; }
.chip-repeats { display: flex; align-items: center; gap: 0.25rem; font-family: var(--mono); font-size: 0.75rem; }
.chip-bars { font-size: 0.68rem; color: var(--ink-faint); }

.chip-btn {
  appearance: none;
  border: none;
  background: none;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  cursor: pointer;
}
.chip-btn:hover { color: var(--ink); background: #302f24; }

.chip-remove {
  position: absolute;
  top: 0.1rem;
  right: 0.15rem;
  appearance: none;
  border: none;
  background: none;
  color: var(--ink-faint);
  font-size: 0.7rem;
  line-height: 1;
  padding: 0.15rem;
  cursor: pointer;
}
.chip-remove:hover { color: var(--accent); }

/* ---------- rhythm grid ---------- */

.grid-wrap { overflow-x: auto; padding-bottom: 0.4rem; }
/* Steps stretch to fill the width, then scroll once they hit their floor. */
.step-grid { display: flex; flex-direction: column; gap: 0.3rem; min-width: min-content; }

.grid-row { display: flex; align-items: center; gap: 0.3rem; }
.grid-row .label {
  width: 5.5rem;
  flex: none;
  font-size: 0.78rem;
  color: var(--ink-dim);
  text-align: right;
  padding: 0 0.4rem 0 0;
  /* It is a button — clicking it auditions the piece — but it should read as
     a row heading until you go near it. */
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.grid-row .label:hover { color: var(--accent); }

.step {
  flex: 1 1 1.6rem;
  min-width: 0.95rem;
  max-width: 2rem;
  height: 1.6rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  cursor: pointer;
  padding: 0;
}
.step.beat { border-color: #4a483c; }
.step.bar-start { border-left: 2px solid #5d5a49; }
.step.is-on { background: var(--accent); border-color: var(--accent); }
.step.is-on.beat { background: #f0714f; }
.step.is-now { box-shadow: inset 0 0 0 2px var(--ok); }
.step:hover { border-color: var(--accent-soft); }

/* ---------- transport ---------- */

.transport {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(20, 20, 15, 0.94);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.transport[hidden] { display: none; }
.transport .field.inline input[type="number"] { width: 4.5rem; }
.transport .field.inline input[type="range"] { width: 6rem; }
.parts { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* The time signature, written the way it is written on paper. */
.meter input[type="number"] { width: 3.2rem; text-align: center; }
.meter select { width: auto; padding-right: 0.3rem; }
.meter .over { color: var(--ink-faint); }
.meter .hint { white-space: nowrap; }

/* ---------- the lichtkrant ---------- */

/* A strip of the lyric across the top of the transport: the line being sung,
   and the one coming. It takes a whole row of the bar to itself, so the
   controls under it stay where they were. */
.lyric-ribbon {
  flex: 1 0 100%;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  min-width: 0;
  padding: 0.35rem 0.7rem;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.lyric-mic { font-size: 1rem; opacity: 0.55; }
.lyric-lines { flex: 1; min-width: 0; }

/* Each line is a button: clicking one plays from there, which turns the words
   into a way about the song as well as something to read. */
.lyric-line {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.05rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  cursor: pointer;
}
.lyric-line::-webkit-scrollbar { display: none; }
.lyric-line:disabled { cursor: default; }
.lyric-line:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lyric-now {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--ink-faint);
}
.lyric-next {
  font-size: 0.85rem;
  color: var(--ink-faint);
  opacity: 0.75;
}
/* Nothing has started yet — the top line is the one that is coming, not one
   being sung, so it is written the way the one underneath it is. */
.lyric-ribbon.is-pending .lyric-now { color: var(--ink-dim); font-weight: 500; }

.lyric-word {
  display: inline-block;
  transition: color 120ms linear, text-shadow 120ms linear;
}
/* Sung already: lit but cooling. Being sung: the bulb that is on. */
.lyric-word.is-sung { color: var(--ink); }
.lyric-word.is-singing {
  color: var(--accent-soft);
  text-shadow: 0 0 14px rgba(226, 84, 60, 0.55);
}

/* The toggle in the transport, lit while the ribbon is on. */
#lyric-toggle.is-on { background: #302f24; color: var(--ink); }

/* ---------- transport drawers ---------- */

/* Feel and tuning belong to the whole song rather than to any one tab, so they
   live in the transport — in a drawer that opens upwards over the page.

   The drawers themselves are deliberately *not* positioned: the transport is,
   so an absolutely positioned body inside one is laid out against the whole
   transport bar. It therefore opens against the right-hand edge of the window
   and the top of the bar, wherever the summary that opened it happens to have
   wrapped to. */
.drawers { display: flex; gap: 0.4rem; }
.drawer > summary { list-style: none; display: inline-block; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer[open] > summary { background: #302f24; color: var(--ink); }
.drawer[open] > summary::after { content: " ▾"; }

.drawer-body {
  position: absolute;
  bottom: calc(100% + 0.6rem);
  right: 0;
  z-index: 20;
  width: min(30rem, calc(100vw - 2rem));
  max-height: min(70vh, 34rem);
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}
.drawer-body .section-label { margin-bottom: 0.5rem; }
.drawer-body .section-label:not(:first-child) { margin-top: 1.1rem; }
.drawer-body .hint { display: block; margin-bottom: 0.75rem; }

/* One row per player: how far off the grid, and which side of it. */
.feel-parts {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.35rem 0.7rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.feel-parts .part-name { font-size: 0.8rem; color: var(--ink-dim); }
.feel-parts .head { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.feel-parts .cell { display: flex; flex-direction: column; gap: 0.1rem; }
.feel-parts input[type="range"] { width: 100%; }
.feel-parts output { font-size: 0.68rem; }

/* The mixing desk. Wider than the other drawers, because five strips side by
   side is the only layout in which a desk reads as a desk. */
.drawer-body.wide { width: min(46rem, calc(100vw - 2rem)); }

.mix-strips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.mix-strips.is-off { opacity: 0.45; }
.mix-strip {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.mix-strip.is-silent { opacity: 0.42; }
.mix-head { display: flex; align-items: center; justify-content: space-between; gap: 0.3rem; }
.mix-name { font-size: 0.78rem; color: var(--ink-dim); }
.mix-buttons { display: flex; gap: 0.2rem; }
.mix-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-faint);
  border-radius: 4px;
  font: inherit;
  font-size: 0.65rem;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  cursor: pointer;
}
.mix-toggle:hover { color: var(--ink); }
.mix-mute.is-on { background: var(--accent); border-color: var(--accent); color: var(--paper-ink); }
.mix-solo.is-on { background: var(--ok); border-color: var(--ok); color: var(--paper-ink); }
.mix-knob { display: flex; flex-direction: column; }
.mix-knob-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.3rem; }
.mix-knob-name { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }
.mix-knob input[type="range"] { width: 100%; margin: 0; }
.mix-knob output { font-size: 0.66rem; color: var(--ink-dim); }
.mix-master {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem 0.9rem;
  margin-bottom: 0.6rem;
}

@media (max-width: 640px) {
  .mix-strips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mix-master { grid-template-columns: 1fr; }
}

/* The library shelves. Cards rather than rows, because what you are looking
   for is "the one with those chords" rather than a file name. */
.library-shelf { display: grid; gap: 0.5rem; margin-bottom: 1.2rem; }
.library-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  display: grid;
  gap: 0.25rem;
}
.library-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.library-name { font-weight: 600; }
.library-when { font-size: 0.72rem; color: var(--ink-faint); }
.library-meta { font-size: 0.78rem; color: var(--ink-dim); }
.section-label .count { color: var(--ink-faint); font-weight: 400; }
#panel-library.is-dropping { outline: 2px dashed var(--accent-soft); outline-offset: -0.5rem; }

.colophon {
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 1rem;
  color: var(--ink-faint);
  font-size: 0.78rem;
  max-width: 70ch;
}

.toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--paper-ink);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 20;
  animation: rise 0.2s ease-out;
}
@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* The ribbon is another row of the fixed transport, so the page has to keep
   clear of it as well. */
body.with-ribbon { padding-bottom: 10rem; }

/* The transport wraps onto three rows on a phone, so keep clear of it. */
@media (max-width: 640px) {
  body { padding-bottom: 13rem; }
  body.with-ribbon { padding-bottom: 17rem; }
  .transport { gap: 0.5rem 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- the Train tab ---------- */

.train-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.train-hand {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 0.75rem;
}

.train-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.train-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.train-card-name { font-size: 1.3rem; font-weight: 650; }
.train-card-meta { font-size: 0.74rem; color: var(--ink-dim); }
.train-card-chords {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent-soft);
  overflow-wrap: anywhere;
}
.train-card-traits { font-size: 0.72rem; color: var(--ink-faint); font-style: italic; }

.train-join {
  margin-top: 0.75rem;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
}
.train-join-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.train-join-title { font-weight: 650; }

/* A button that is currently sounding, so it is obvious what you are hearing. */
.train-play.is-playing {
  border-color: var(--accent);
  color: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.rate-block { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.4rem; }

.rate-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
}
/* The cursor. One row at a time is what the number keys are pointed at, and
   there is no guessing which. */
.rate-row.is-cursor {
  background: #221f19;
  border-left-color: var(--accent);
}
.rate-label {
  font-size: 0.76rem;
  color: var(--ink-dim);
  min-width: 8.5rem;
  flex: 1 1 8.5rem;
}
.rate-row.is-cursor .rate-label { color: var(--ink); }
.rate-buttons { display: flex; gap: 0.2rem; }

.rate-btn {
  font: inherit;
  font-size: 0.72rem;
  padding: 0.18rem 0.5rem;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.rate-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.rate-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #16130f;
  font-weight: 650;
}

kbd {
  font-family: var(--mono);
  font-size: 0.78em;
  padding: 0.05em 0.35em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--bg-sunk);
  color: var(--ink);
}

/* ---------- the export dialog ---------- */

.sheet {
  width: min(28rem, calc(100vw - 2rem));
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.sheet::backdrop { background: rgba(8, 8, 6, 0.6); }
.sheet.narrow { width: min(22rem, calc(100vw - 2rem)); }
/* The one button in the app that destroys something: it says so in colour. */
.btn.danger-solid { background: #7a2718; border-color: #a3341f; color: #ffe9e3; font-weight: 600; }
.btn.danger-solid:hover { background: #93301d; }
.sheet h2 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.sheet > .hint { display: block; margin-bottom: 0.9rem; }
.sheet > small.hint { margin: -0.4rem 0 0.9rem; }
.sheet .row.end { justify-content: flex-end; margin-top: 1rem; }
.sheet #regen-summary { margin-top: 0.6rem; }
.sheet { max-height: calc(100vh - 3rem); overflow-y: auto; }
.sheet #export-audio-passes { width: 5rem; }

.export-progress {
  margin-top: 0.9rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-sunk);
}
.export-progress progress {
  width: 100%;
  height: 0.5rem;
  accent-color: var(--accent);
}
.export-progress .hint { display: block; margin-top: 0.4rem; }
