:root {
  --bg: #000000; --panel: #131313; --panel-2: #1a1a1a; --line: #2a2a2a;
  --grey: #4a4a4a; --orange: #ff6b35; --cyan: #00c2c7; --green: #8bc34a; --pink: #f4436e; --gold: #e8b64c;
  --text: #f5f5f5; --dim: #8a8a8a;
  --display: 'Space Grotesk', sans-serif; --body: 'Inter', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); -webkit-tap-highlight-color: transparent; }
.board { max-width: 460px; margin: 0 auto; padding: 16px 16px 60px; }
[hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.topbar { display:flex; justify-content:space-between; align-items:center; margin-bottom: 16px; }
.topbar__name { font-family: var(--display); font-weight:700; font-size: 20px; letter-spacing: -0.01em; }
.topbar__name span { color: var(--orange); }
.topbar__meta { font-size: 10px; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--display); font-weight: 700; letter-spacing: 0.04em;
  border: none; background: var(--panel-2); color: var(--text); cursor: pointer;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary { width: 100%; padding: 13px; background: var(--orange); color: #000; font-size: 13px; }
.btn--primary:not(:disabled):hover { background: #ff8256; }
.btn--small { padding: 8px 12px; font-size: 11px; background: var(--orange); color: #000; }

.text-btn {
  background: none; border: none; color: var(--dim); font-family: var(--display); font-weight: 700;
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; padding: 6px 8px;
  text-decoration: none; display: inline-block;
}
.text-btn:hover { color: var(--text); }
.text-btn--danger:hover { color: var(--pink); }

.back-btn {
  background: none; border: 1px solid var(--line); color: var(--dim); font-family: var(--display);
  font-weight: 700; font-size: 11px; letter-spacing: 0.08em; padding: 9px 13px; cursor: pointer; margin-bottom: 12px;
}
.back-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ---------- Panels / collapsible ---------- */
.panel-title { font-family: var(--display); font-weight:700; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin: 0; }
.panel-title--iconed { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.panel-icon { width: 22px; height: 11px; color: var(--orange); flex: none; }
.panel-icon--cyan { color: var(--cyan); }

.log-panel--primary { border-left: 3px solid var(--orange); }
.library--featured { background: rgba(0,194,199,0.06); border-top: 2px solid var(--cyan); }
.library--stage { background: rgba(232,182,76,0.07); border-top: 2px solid var(--gold); }

/* ---------- Stage Prep ---------- */
.stage-prep__transport { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.stage-prep__transport .play-flat { color: var(--gold); }
.stage-prep__transport .play-flat.is-playing { background: var(--gold); color: #000; }

.stage-prep__channels { display: flex; flex-direction: column; gap: 3px; }
.stage-channel { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 9px 12px; border-left: 3px solid var(--ch-color, var(--grey)); flex-wrap: wrap; }
.stage-channel__label { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.05em; color: var(--ch-color, var(--grey)); flex: 1; min-width: 120px; }
.stage-channel__btns { display: flex; gap: 5px; flex: none; }
.stage-btn {
  width: 30px; height: 26px; background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  font-family: var(--display); font-weight: 700; font-size: 10px; cursor: pointer;
}
.stage-btn--mute.is-active { background: var(--pink); color: #000; border-color: var(--pink); }
.stage-btn--solo.is-active { background: var(--gold); color: #000; border-color: var(--gold); }
.stage-channel__route { display: flex; flex: none; }
.route-btn {
  width: 44px; height: 26px; background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  font-family: var(--display); font-weight: 700; font-size: 10px; cursor: pointer; margin-left: -1px;
}
.route-btn:first-child { margin-left: 0; }
.route-btn.is-active { background: var(--gold); color: #000; border-color: var(--gold); }
.log-panel, .library { background: var(--panel); padding: 16px; margin-bottom: 12px; }

.panel-toggle { width:100%; display:flex; justify-content:space-between; align-items:center; background:none; border:none; padding:0; cursor:pointer; }
.panel-toggle__chevron { color: var(--dim); font-size: 15px; transition: transform 0.15s; }
.panel-toggle[aria-expanded="true"] .panel-toggle__chevron { transform: rotate(180deg); color: var(--orange); }
.panel-body { margin-top: 14px; }

.field { display:block; margin-bottom: 12px; }
.field__label { display:block; font-size: 10px; letter-spacing: 0.1em; color: var(--dim); margin-bottom: 5px; text-transform: uppercase; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 11px; font-family: var(--body); font-size: 13.5px; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--orange); }
.error-line { color: var(--pink); font-size: 12px; margin: 8px 0 0; min-height: 1em; }
.success-line { color: var(--green); font-size: 12px; margin: 8px 0 0; min-height: 1em; font-weight: 600; }

/* ---------- Record mode toggle ---------- */
.mode-toggle { display:flex; gap: 3px; margin-bottom: 14px; }
.mode-btn {
  flex:1; padding: 9px; background: var(--panel-2); border: none; color: var(--dim);
  font-family: var(--display); font-weight:700; font-size: 10.5px; letter-spacing: 0.06em; cursor: pointer;
}
.mode-btn.is-active { background: var(--orange); color: #000; }

/* ---------- Recorder ---------- */
.recorder { margin-bottom: 14px; background: var(--panel-2); padding: 18px; text-align: center; }
.recorder__hint { font-size: 11px; color: var(--dim); margin: 10px 0 0; }
.recorder__countdown { text-align: center; padding: 10px 0; }
.recorder__countdown-label { font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: 0.1em; color: var(--dim); margin: 0; }
.recorder__countdown-number {
  font-family: var(--display); font-weight: 800; font-size: 64px; color: var(--pink);
  margin: 6px 0; line-height: 1;
}

.recorder__utils { display: flex; justify-content: center; gap: 4px; margin-bottom: 4px; }

/* ---------- Metronome ---------- */
.metronome { background: var(--panel); padding: 14px 16px; margin: 10px 0; }
.metronome__row { display: flex; align-items: center; gap: 12px; justify-content: center; }
.metronome__bpm-group {
  display: flex; align-items: stretch; background: var(--panel-2);
  border: 1px solid var(--line); overflow: hidden;
}
.metronome__bpm-input {
  width: 56px; text-align: center; padding: 8px 4px; background: none; border: none; color: var(--text);
  font-family: var(--display); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
}
.metronome__bpm-input:focus { outline: none; }
.metronome__bpm-tag {
  display: flex; align-items: center; font-family: var(--display); font-weight: 700; font-size: 9px;
  letter-spacing: 0.08em; color: var(--dim); background: var(--panel); padding: 0 10px; border-left: 1px solid var(--line);
}
.metronome__beat { width: 14px; height: 14px; border-radius: 50%; background: var(--panel-2); flex: none; transition: background 0.05s, transform 0.05s; }
.metronome__beat.is-hit { background: var(--orange); transform: scale(1.3); }
.metronome__beat.is-hit.is-downbeat { background: var(--pink); }

.metronome__row--mini { justify-content: center; gap: 8px; margin-top: 12px; }
.metronome__row--mini .recorder__hint { margin: 0; }
.recorder__device-row { text-align: left; margin-bottom: 16px; }
.recorder__device-row .field__label { display:block; margin-bottom: 5px; }

.record-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--pink); background: none;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.record-btn__dot { width: 26px; height: 26px; border-radius: 50%; background: var(--pink); }
.record-btn--stop { border-color: var(--pink); background: var(--pink); }
.record-btn__square { width: 20px; height: 20px; background: #000; }

.record-meter { display:flex; align-items:flex-end; justify-content:center; gap: 4px; height: 48px; margin-bottom: 10px; }
.record-meter div { width: 6px; height: 100%; background: var(--pink); transform-origin: bottom; transform: scaleY(0.1); transition: transform 0.08s linear; }

.recorder__timer { font-family: var(--display); font-weight:700; font-size: 22px; margin-bottom: 14px; font-variant-numeric: tabular-nums; }

.recorder__review-actions { display:flex; justify-content:center; gap: 14px; margin-top: 10px; }

/* ---------- Dropzone / upload progress ---------- */
.dropzone {
  border: 1px dashed var(--line); padding: 20px 14px; text-align: center; cursor: pointer;
  margin-bottom: 14px; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--orange); background: rgba(255,107,53,0.05); }
.dropzone p { margin: 0; font-size: 12px; color: var(--dim); }
.dropzone-file { color: var(--orange) !important; margin-top: 6px !important; word-break: break-all; }
.daw-file-current {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel-2); padding: 8px 12px; margin-bottom: 10px; font-size: 12px; color: var(--text);
}
.progress { height: 4px; background: var(--line); margin-top: 10px; overflow: hidden; }
.progress__bar { height: 100%; width: 0%; background: var(--orange); transition: width 0.15s; }
.empty-state { color: var(--dim); font-size: 13px; text-align: center; padding: 20px 0; margin: 0; }
.setup-note { font-size: 12px; color: var(--dim); margin: 0 0 12px; }

/* ---------- Loading ---------- */
.loading-row { display:flex; align-items:center; justify-content:center; gap: 5px; padding: 26px 0; }
.loading-row div { width: 7px; height: 7px; background: var(--orange); animation: loadbounce 0.9s ease-in-out infinite; }
.loading-row div:nth-child(2) { animation-delay: -0.6s; }
.loading-row div:nth-child(3) { animation-delay: -0.3s; }
@keyframes loadbounce { 0%, 100% { transform: scaleY(0.4); opacity: 0.5; } 50% { transform: scaleY(1); opacity:1; } }

/* ---------- Tabs ---------- */
.tabs { display:flex; gap: 3px; margin-bottom: 12px; }
.tab {
  flex:1; text-align:center; padding: 12px; background: var(--panel); color: var(--dim);
  font-family: var(--display); font-weight:700; font-size: 11.5px; letter-spacing: 0.08em; cursor: pointer; border: none;
}
.tab.is-active-archive { background: var(--orange); color: #000; }
.tab.is-active-prep { background: var(--cyan); color: #000; }
.tab.is-active-stage { background: var(--gold); color: #000; }

/* ---------- Projects list ---------- */
.library__list { display:flex; flex-direction:column; gap: 3px; }
.project-card { background: var(--panel); padding: 14px; cursor: pointer; }
.project-card:hover { background: var(--panel-2); }
.project-card__top { display:flex; justify-content:space-between; align-items:baseline; gap: 8px; }
.project-card__name { font-family: var(--display); font-weight:700; font-size: 17px; }
.project-card__count { font-size: 10px; color: var(--dim); white-space:nowrap; letter-spacing: 0.05em; }
.project-card__desc { font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.project-card__songinfo { font-size: 10.5px; color: var(--orange); margin-top: 6px; font-family: var(--display); font-weight: 700; letter-spacing: 0.04em; }
.project-card__statuses { display:flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Song info (BPM / key / time signature) ---------- */
.song-info-row { display:flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.song-info-select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.04em;
  padding: 7px 10px; cursor: pointer;
}
.song-info-select:focus { outline: none; border-color: var(--orange); }
.status-chip { display:inline-flex; align-items:center; gap: 5px; font-size: 9.5px; letter-spacing: 0.05em; color: var(--dim); text-transform: uppercase; }
.status-chip__dot { width: 7px; height: 7px; background: var(--chip-color, var(--grey)); }

/* ---------- Project heading ---------- */
.project-heading { background: var(--panel); padding: 14px 16px; margin-bottom: 12px; }
.project-heading__name { font-family: var(--display); font-size: 22px; font-weight: 700; margin: 0; text-transform: uppercase; }
.project-heading__desc { font-size: 12px; color: var(--dim); margin: 4px 0 8px; }

/* ---------- Rehearsal master notes ---------- */
.master-notes-trail { display:flex; flex-direction:column; gap: 6px; margin-top: 10px; }
.master-note { background: var(--panel-2); padding: 8px 10px; border-left: 3px solid var(--orange); }
.master-note__time { font-size: 9.5px; color: var(--dim); letter-spacing: 0.05em; display:block; margin-bottom:3px; }
.master-note__text { font-size: 12.5px; margin: 0; white-space: pre-wrap; word-break: break-word; }

/* ---------- Hero (flat clip block) ---------- */
.hero { background: var(--orange); color: #000; padding: 18px; margin-bottom: 3px; position: relative; }
.hero.prep-mode { background: var(--cyan); }
.hero__idle { background: var(--panel); color: var(--dim); text-align:center; padding: 34px 14px; }
.hero__idle-title { font-family: var(--display); font-weight:700; font-size: 13px; letter-spacing: 0.16em; margin: 0 0 4px; }
.hero__idle-sub { font-size: 11px; margin:0; }

.hero__eyebrow { font-size: 10px; letter-spacing: 0.14em; font-weight:700; opacity: 0.75; text-transform: uppercase; display:flex; align-items:center; gap:6px; }
.live-dot { width:6px; height:6px; background:#000; border-radius:50%; }
.live-dot.is-on { animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.hero__name { font-family: var(--display); font-weight:700; font-size: 24px; margin: 4px 0 5px; line-height: 1.08; word-break: break-word; }
.hero__desc { font-size: 11.5px; opacity: 0.82; margin: 0 0 14px; }
.hero__link-badge {
  display:inline-block; font-family: var(--display); font-weight:700; font-size: 9.5px; letter-spacing: 0.06em;
  background:#000; color: inherit; padding: 4px 9px; margin-bottom: 12px;
}
.hero__link-badge.archive-badge { color: var(--cyan); }
.hero__link-badge.prep-badge { color: var(--orange); }

/* Flat waveform */
.flat-wave { position: relative; height: 56px; margin-bottom: 6px; cursor: pointer; }
.flat-wave__bars { display:flex; align-items:center; gap: 2px; height: 100%; }
.flat-wave__bar { flex:1; background: rgba(0,0,0,0.32); }
.flat-wave__bar.played { background: #000; }
.flat-wave__playhead { position:absolute; top:0; bottom:0; width: 2px; background: #fff; pointer-events:none; }
.flat-wave__handle { position:absolute; top: -4px; width: 10px; height: 10px; background: #fff; transform: translateX(-4px); pointer-events:none; }
.flat-wave__time-row { display:flex; justify-content: space-between; font-family: var(--display); font-weight:700; font-size: 10.5px; opacity: 0.7; margin-bottom: 14px; }

/* SoundCloud fallback embed (legacy rows) */
.sc-embed { margin-bottom: 10px; }
.sc-embed iframe { display:block; width:100%; border:none; }

.hero__row { display:flex; align-items:center; gap: 12px; flex-wrap: wrap; }
.play-flat { width:38px; height:38px; background:#000; color: inherit; display:flex; align-items:center; justify-content:center; flex:none; cursor:pointer; border:none; }
.hero.prep-mode .play-flat { color: var(--cyan); }
.hero:not(.prep-mode) .play-flat { color: var(--orange); }
.play-flat svg { width:14px; height:14px; fill:currentColor; }
.hero:not(.prep-mode) .play-flat.is-playing { background: var(--orange); color: #000; }
.hero.prep-mode .play-flat.is-playing { background: var(--cyan); color: #000; }

/* ---------- Guide track summary (compact, not a hero) ---------- */
.guide-summary-panel { border-left: 3px solid var(--cyan); }
.guide-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.guide-summary__info { display: flex; flex-direction: column; gap: 2px; }
.guide-summary__label { font-family: var(--display); font-weight: 700; font-size: 10px; letter-spacing: 0.12em; color: var(--cyan); }
.guide-summary__name { font-size: 14px; font-weight: 600; }
.guide-summary__desc { font-size: 11.5px; color: var(--dim); }
.guide-summary__actions { display: flex; gap: 4px; flex: none; }

/* ---------- Stem Machine waveform ---------- */
.sm-waveform { width: 100%; height: 96px; display: block; background: var(--panel-2); margin-bottom: 12px; cursor: pointer; }

.sm-channel { flex-wrap: wrap; }
.sm-channel__fader { flex: 1; min-width: 90px; display: flex; align-items: center; gap: 6px; position: relative; }
.sm-channel__fader input[type="range"] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 3px; background: var(--line); outline: none;
}
.sm-channel__fader input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--ch-color, var(--text)); cursor: pointer;
}
.sm-channel__fader input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: var(--ch-color, var(--text)); border: none; cursor: pointer;
}
.sm-channel__fader-bubble {
  position: absolute; top: -20px; left: 0%; transform: translateX(-50%);
  background: #000; color: var(--ch-color, var(--text)); font-family: var(--display); font-weight: 700;
  font-size: 10px; letter-spacing: 0.03em; padding: 2px 6px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s; font-variant-numeric: tabular-nums;
}
.sm-channel__fader-bubble.is-visible { opacity: 1; }

/* ---------- Stem Machine ---------- */
.stem-machine__idle, .stem-machine__loading { text-align: center; padding: 20px 10px; }
.stem-machine__loading .loading-row { margin-bottom: 8px; }

.stem-machine__transport { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.stem-machine .play-flat { color: var(--cyan); }
.stem-machine .play-flat.is-playing { background: var(--cyan); color: #000; }

.sm-scrub { position: relative; flex: 1; height: 8px; background: var(--panel-2); cursor: pointer; }
.sm-scrub__fill { position: absolute; top:0; left:0; bottom:0; width: 0%; background: var(--cyan); }
.sm-scrub__handle { position: absolute; top: 50%; left: 0%; width: 12px; height: 12px; background: var(--text); transform: translate(-50%, -50%); pointer-events: none; }

.stem-machine__channels { display: flex; flex-direction: column; gap: 3px; }
.sm-channel { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 9px 12px; border-left: 3px solid var(--ch-color, var(--grey)); }
.sm-channel__label { font-family: var(--display); font-weight:700; font-size: 11px; letter-spacing: 0.05em; color: var(--ch-color, var(--grey)); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-channel__btns { display: flex; gap: 5px; flex: none; }
.sm-btn {
  width: 30px; height: 26px; background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  font-family: var(--display); font-weight: 700; font-size: 10px; cursor: pointer;
}
.sm-btn--mute.is-active { background: var(--pink); color: #000; border-color: var(--pink); }
.sm-btn--solo.is-active { background: var(--cyan); color: #000; border-color: var(--cyan); }
.hero__time {
  font-family: var(--display); font-weight:700; font-size: 13px;
  font-variant-numeric: tabular-nums; min-width: 96px; display: inline-block;
}

.mini-meter { display:flex; align-items:flex-end; gap: 2px; height: 16px; }
.mini-meter div { width: 3px; background: #000; transform-origin: bottom; transform: scaleY(0.35); }
.mini-meter.is-playing div { animation: bounce 0.9s ease-in-out infinite; }
.mini-meter div:nth-child(1) { height: 40%; animation-delay: -0.6s; }
.mini-meter div:nth-child(2) { height: 90%; animation-delay: -0.2s; }
.mini-meter div:nth-child(3) { height: 60%; animation-delay: -0.9s; }
.mini-meter div:nth-child(4) { height: 100%; animation-delay: -0.35s; }
.mini-meter div:nth-child(5) { height: 55%; animation-delay: -0.75s; }
@keyframes bounce { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

.hero__status { margin-left:auto; font-family: var(--display); font-weight:700; font-size: 10px; letter-spacing:0.06em; background:#000; padding: 5px 9px; border: none; }
.hero.prep-mode .hero__status { color: var(--cyan); }
.hero:not(.prep-mode) .hero__status { color: var(--orange); }
.hero__extra-row { display:flex; gap: 4px; margin-top: 12px; flex-wrap: wrap; }
.hero__extra-row .text-btn { color: #000; opacity: 0.7; }
.hero__extra-row .text-btn:hover { opacity: 1; }

/* ---------- Version / stem rows (flat clip-cell style) ---------- */
.track, .stem-row-outer { background: var(--panel); margin-bottom: 3px; }
.track__head { display:flex; align-items:center; gap: 10px; padding: 12px; }
.track__playbtn {
  width: 34px; height:34px; background: var(--panel-2); color: var(--text); border:none;
  display:flex; align-items:center; justify-content:center; flex:none; cursor:pointer;
}
.track__playbtn svg { width:14px; height:14px; fill:currentColor; }
.track.is-active .track__playbtn { background: var(--orange); color:#000; }

.track__titles { flex:1; min-width:0; }
.track__toprow { display:flex; align-items:center; gap: 8px; flex-wrap: wrap; }
.track__index { font-family: var(--display); font-weight:700; color: var(--dim); font-size: 13px; }
.track.is-active .track__index { color: var(--orange); }
.track__name { font-size: 13px; font-weight: 600; word-break: break-word; }
.track__quickmeta { display:flex; align-items:center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.track__quickmeta .text-btn { padding:0; font-size: 10px; }

.status-tag { width: 10px; height: 10px; flex: none; background: var(--tag-color, var(--grey)); }
.status-select-wrap { display:flex; align-items:center; gap: 6px; }
.status-select-wrap select {
  appearance:none; -webkit-appearance:none; background: var(--panel-2); border:1px solid var(--line); color: var(--text);
  font-family: var(--display); font-weight:700; font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 20px 4px 8px; cursor:pointer;
}

.link-badge {
  font-family: var(--display); font-weight:700; font-size: 8.5px; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--panel-2); color: var(--cyan); padding: 3px 7px; display:inline-block;
}
.new-badge {
  font-family: var(--display); font-weight:700; font-size: 8.5px; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--green); color: #000; padding: 3px 7px; display:inline-block;
}
.track.is-newest { background: rgba(255,107,53,0.09); }

.track__expand {
  width: 28px; height:28px; background:none; border: 1px solid var(--line); color: var(--dim);
  cursor:pointer; flex:none; font-size:12px; transition: transform 0.15s, color 0.15s, border-color 0.15s;
}
.track__expand:hover { color: var(--orange); border-color: var(--orange); }
.track__expand.is-open { transform: rotate(180deg); color: var(--orange); border-color: var(--orange); }
.track__expandpanel { padding: 0 12px 12px; border-top: 1px solid var(--line); margin-top: -1px; padding-top: 12px; }
.track__desc { font-size: 12px; color: var(--dim); margin-top: 3px; word-break: break-word; }
.track__meta { font-size: 10px; color: var(--dim); letter-spacing: 0.03em; display:flex; gap: 8px; flex-wrap:wrap; margin-top: 6px; }
.track__controls { display:flex; align-items:center; gap: 4px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.track__spacer { flex:1; }

/* ---------- Notes (per-take) ---------- */
.track__notes { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.notes-form { display:flex; gap: 8px; margin-bottom: 10px; align-items:flex-start; }
.notes-form textarea { flex:1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 8px 9px; font-size: 12.5px; resize: vertical; min-height: 36px; }
.notes-form textarea:focus { outline:none; border-color: var(--orange); }
.notes-trail { display:flex; flex-direction:column; gap: 8px; }
.note { background: var(--panel-2); padding: 8px 10px; }
.note__time { font-size: 10px; color: var(--dim); letter-spacing: 0.05em; display:block; margin-bottom:3px; }
.note__text { font-size: 12.5px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.notes-empty { font-size: 11.5px; color: var(--dim); text-align:center; padding: 6px 0; }

/* ---------- Session Prep: guide track + stems ---------- */
.stems-header { display:flex; justify-content:space-between; align-items:center; margin: 4px 0 8px; }
.stems-header__title { font-family: var(--display); font-weight:700; font-size: 11px; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; }
.stems-header__count { font-size: 10px; color: var(--cyan); }

.stem-row-outer { display:flex; align-items:center; gap: 10px; padding: 10px 12px; border-left: 3px solid var(--stem-color, var(--grey)); }
.stem-tag { font-family: var(--display); font-size: 9.5px; font-weight:700; letter-spacing: 0.06em; color: var(--stem-color, var(--grey)); min-width: 58px; flex:none; }
.stem-name { font-size: 12px; flex:1; min-width:0; }
.stem-sub { font-size: 9.5px; color: var(--dim); margin-top: 2px; }
.stem-icon-btn {
  width: 28px; height:28px; background: var(--panel-2); border:none; color: var(--dim);
  display:flex; align-items:center; justify-content:center; flex:none; cursor:pointer;
}
.stem-icon-btn svg { width:12px; height:12px; fill:currentColor; }
.stem-icon-btn:hover { color: var(--cyan); }
.stem-icon-btn.is-playing { background: var(--cyan); color: #000; }

/* ---------- Fatal error recovery banner ---------- */
.fatal-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 999;
  background: var(--pink); color: #000; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
}
.fatal-banner button {
  font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: 0.06em;
  background: #000; color: var(--pink); border: none; padding: 7px 14px; cursor: pointer;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .topbar__name { font-size: 18px; }
  .board { padding: 12px 10px 50px; }
  .hero__name { font-size: 20px; }
  .track__controls { justify-content: space-between; }
  .notes-form { flex-direction: column; }
  .btn--small { width: 100%; }
}

/* ---------- Desktop ----------
   Below 900px everything stays the single mobile-width column as before.
   Above it, the project view becomes a sidebar (heading, rehearsal notes,
   tab switcher) + a wide content column (hero, versions, stem machine) —
   real use of the space instead of a narrow column floating in the middle
   of a wide window. */
@media (min-width: 900px) {
  .board { max-width: 1040px; padding: 24px 24px 60px; }

  #view-projects .log-panel { max-width: 480px; }
  #projects-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }

  #view-project {
    display: grid;
    grid-template-columns: 340px 1fr;
    grid-template-areas:
      "back    back"
      "heading content"
      "notes   content"
      "tabs    content";
    column-gap: 20px;
    align-items: start;
  }
  #view-project > .back-btn { grid-area: back; }
  #view-project > .project-heading { grid-area: heading; margin-bottom: 0; }
  #view-project > .log-panel { grid-area: notes; margin-bottom: 0; }
  #view-project > .tabs { grid-area: tabs; flex-direction: column; position: sticky; top: 24px; }
  #view-project > #panel-archive, #view-project > #panel-prep, #view-project > #panel-stage { grid-area: content; min-width: 0; }
  .stage-prep__channels { max-width: 640px; }

  .stem-machine__channels {
    max-width: none; display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px;
  }
  .sm-channel {
    flex-direction: column; align-items: center; justify-content: flex-start;
    width: 122px; padding: 14px 10px 12px; text-align: center; gap: 10px;
    border-left: none; border-top: 3px solid var(--ch-color, var(--grey));
  }
  .sm-channel__label {
    white-space: normal; overflow: visible; text-overflow: clip;
    font-size: 11.5px; line-height: 1.35; min-height: 30px; display: flex; align-items: center;
  }
  .sm-channel__fader { flex: none; min-width: 0; height: 132px; display: flex; align-items: center; justify-content: center; }
  .sm-channel__fader input[type="range"] {
    writing-mode: vertical-lr; direction: rtl; width: 6px; height: 122px; flex: none;
  }
  .sm-channel__fader-bubble { top: -20px; bottom: auto; }
  .sm-channel__btns { flex-direction: row; }

  .library__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 6px; align-content: start; }
  #stems-list { grid-template-columns: 1fr; }
}
