/* Bouncebox. Faceplate grey, ink, one signal red, and a tape colour per mix version. */
@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans.woff2") format("woff2-variations");
  font-weight: 400 700; font-stretch: 75% 100%; font-display: swap;
}
:root {
  --bg: #e6e8e8; --panel: #f3f4f3; --raised: #ffffff; --sunk: #dcdfdf;
  --ink: #171c20; --ink2: #56616a; --ink3: #87919a; --line: #c6cbcc; --line2: #d9dddd;
  --signal: #d23b26; --ok: #1d7f52; --wave: #b3babd;
  --v1: #1f5fd1; --v2: #d2601a; --v3: #178253; --v4: #8a3fc4; --v5: #c22e6b; --v6: #0b8593;
  --vc: var(--v1);
  --r: 5px; --font: "Instrument Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --panel: #1b1f23; --raised: #242a2f; --sunk: #0f1214;
    --ink: #eceeee; --ink2: #a3adb5; --ink3: #76818a; --line: #343b41; --line2: #2a3035;
    --signal: #f0604a; --ok: #46b986; --wave: #4a545c;
    --v1: #6f9ef5; --v2: #f08f4a; --v3: #4cc08c; --v4: #b98af0; --v5: #f076a8; --v6: #45c2cf;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--font); font-stretch: 100%;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .cond { font-stretch: 80%; font-weight: 600; letter-spacing: 0.005em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--raised); font-weight: 500; white-space: nowrap; text-decoration: none;
  box-shadow: 0 1px 0 var(--line2); }
.btn:hover { border-color: var(--ink3); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); box-shadow: none; }
.btn.primary:hover { opacity: .88; }
.btn.danger { background: var(--signal); border-color: var(--signal); color: #fff; box-shadow: none; }
.btn.quiet { background: none; border-color: transparent; box-shadow: none; color: var(--ink2); padding: 0 9px; }
.btn.quiet:hover { color: var(--ink); background: var(--sunk); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn svg { width: 16px; height: 16px; flex: none; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.field small { display: block; color: var(--ink2); font-size: 12.5px; margin-top: 5px; line-height: 1.4; }
.input, textarea.input, select.input { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--raised); }
.input:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
textarea.input { resize: vertical; min-height: 76px; line-height: 1.45; }
.check { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 32px; height: 18px; border-radius: 9px; background: var(--line); position: relative; flex: none; transition: background .12s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--raised); transition: transform .12s; }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch input:disabled + i { opacity: .4; }
.err { color: var(--signal); font-size: 13.5px; margin: 0 0 12px; font-weight: 500; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.top .brand { font-stretch: 78%; font-weight: 700; font-size: 17px; text-decoration: none; display: flex; align-items: center; gap: 9px; flex: none; }
.top .brand::before { content: ""; width: 9px; height: 18px; background: var(--signal); border-radius: 1.5px; }
.top .crumb { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.top .crumb b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .crumb span { color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.top nav { display: flex; align-items: center; gap: 4px; flex: none; }

/* ---------- plain pages (login, dashboard, clients) ---------- */
.page { max-width: 880px; margin: 0 auto; padding: 34px 20px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 30px; line-height: 1.1; }
.gate { max-width: 400px; margin: 9vh auto 0; padding: 0 20px 60px; }
.gate h1 { font-size: 30px; line-height: 1.12; margin-bottom: 8px; }
.gate > p { color: var(--ink2); margin-bottom: 24px; }
.gate .btn { width: 100%; min-height: 42px; }
.rows { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); overflow: hidden; }
.row { display: flex; align-items: center; gap: 16px; padding: 13px 16px; border-top: 1px solid var(--line2); text-decoration: none; }
.row:first-child { border-top: 0; }
a.row:hover { background: var(--raised); }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; font-size: 17px; font-stretch: 82%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main span { color: var(--ink2); font-size: 13.5px; }
.row .meta { color: var(--ink2); font-size: 13.5px; white-space: nowrap; text-align: right; }
.open-notes { display: inline-flex; align-items: center; gap: 6px; color: var(--signal); font-weight: 600; font-size: 13px; white-space: nowrap; }
.open-notes::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }
.empty { padding: 44px 24px; text-align: center; color: var(--ink2); border: 1px dashed var(--line); border-radius: var(--r); }
.empty h2 { color: var(--ink); font-size: 20px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 11.5px; font-weight: 600; background: var(--sunk); color: var(--ink2); vertical-align: 1px; }

/* ---------- project: track sheet + deck ---------- */
.proj { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: calc(100vh - 55px); min-height: calc(100dvh - 55px); }
.sheet { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-width: 0; }
.sheet ol { list-style: none; margin: 0; padding: 8px; flex: 1; }
.trk { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; width: 100%; padding: 10px 10px;
  border: 1px solid transparent; border-radius: var(--r); background: none; text-align: start; }
.trk:hover { background: var(--sunk); }
.trk[aria-current="true"] { background: var(--raised); border-color: var(--line); box-shadow: 0 1px 0 var(--line2); }
.trk .n { color: var(--ink3); font-size: 13px; }
.trk .t { font-stretch: 82%; font-weight: 600; font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk .s { grid-column: 2 / 4; display: flex; gap: 10px; align-items: center; color: var(--ink2); font-size: 12.5px; }
.trk .dur { color: var(--ink2); font-size: 13px; }
.sheet .drop { margin: 0 12px 14px; padding: 16px 14px; border: 1px dashed var(--ink3); border-radius: var(--r); text-align: center; color: var(--ink2); font-size: 13.5px; }
.sheet .drop b { color: var(--ink); display: block; font-weight: 600; margin-bottom: 2px; }
.sheet .drop .btn { margin-top: 10px; }
.dragging .sheet .drop, .deck.dragover { outline: 2px solid var(--ink); outline-offset: -4px; }
.deck { padding: 26px 34px 90px; min-width: 0; max-width: 1080px; }
.deck-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.deck-head h1 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.05; flex: 1; min-width: 0; overflow-wrap: anywhere; font-stretch: 76%; font-weight: 700; }
.back { display: none; }

/* version switches: one physical-looking button per mix, lamp in the version's tape colour */
.versions { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin-bottom: 16px; }
.ver { position: relative; min-width: 84px; max-width: 240px; padding: 13px 12px 9px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); text-align: start; display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 0 var(--line); }
.ver::before { content: ""; position: absolute; left: 8px; right: 8px; top: 5px; height: 3px; border-radius: 2px; background: var(--vc); opacity: .28; }
.ver b { font-stretch: 80%; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver kbd { font: inherit; font-size: 11px; color: var(--ink3); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; line-height: 16px; margin-left: auto; }
.ver:hover { border-color: var(--ink3); }
.ver[aria-pressed="true"] { background: var(--raised); border-color: var(--vc); box-shadow: 0 0 0 1px var(--vc); transform: translateY(2px); }
.ver[aria-pressed="true"]::before { opacity: 1; }
.ver.busy b { color: var(--ink2); font-weight: 500; }
.ver.bad::before { background: var(--signal); opacity: 1; }
.versions .btn { align-self: center; }

.wavewrap { position: relative; padding-top: 18px; touch-action: pan-y; }
.wavewrap canvas { display: block; width: 100%; height: 132px; cursor: text; border-radius: 3px; }
.marks { position: absolute; left: 0; right: 0; top: 0; height: 18px; }
.mark { position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px; padding: 0; border: 2px solid var(--signal); background: var(--signal); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.mark.done { background: var(--bg); border-color: var(--ink3); }
.mark:hover, .mark.hot { transform: rotate(-45deg) scale(1.35); z-index: 2; }
.hovert { position: absolute; top: 18px; padding: 1px 6px; font-size: 12px; background: var(--ink); color: var(--bg); border-radius: 3px; transform: translateX(-50%); pointer-events: none; }
.wave-msg { position: absolute; inset: 18px 0 0 0; display: flex; align-items: center; justify-content: center; color: var(--ink2); font-size: 14px; pointer-events: none; }

.transport { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.playbtn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }
.playbtn:hover { opacity: .88; }
.playbtn svg { width: 22px; height: 22px; }
.clock { font-size: 24px; font-stretch: 80%; font-weight: 600; min-width: 5.6em; }
.clock span { color: var(--ink3); font-weight: 400; }
.transport .gap { flex: 1; }
.vol { width: 86px; accent-color: var(--ink); }
.spec { display: flex; flex-wrap: wrap; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r); font-size: 13.5px; background: var(--panel); overflow: hidden; }
.spec > span { padding: 7px 12px; border-right: 1px solid var(--line2); white-space: nowrap; }
.spec > span:last-child { border-right: 0; }
.spec .swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--vc); margin-right: 7px; }
.vnotes { margin-top: 12px; padding: 10px 14px; border-left: 3px solid var(--vc); background: var(--panel); border-radius: 0 var(--r) var(--r) 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.vnotes .who { display: block; font-size: 12.5px; color: var(--ink2); font-weight: 500; margin-bottom: 2px; }
.state { padding: 40px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r); color: var(--ink2); }
.state b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.state .btn { margin: 14px 4px 0; }

/* ---------- notes ---------- */
.notes { margin-top: 30px; max-width: 760px; }
.notes-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.notes-head h2 { font-size: 21px; margin-right: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: none; padding: 5px 11px; font-size: 13px; font-weight: 500; color: var(--ink2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.composer { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--raised); }
.composer:focus-within { border-color: var(--ink); }
.composer textarea { flex: 1; min-width: 0; border: 0; background: none; resize: none; outline: none; padding: 6px 2px; min-height: 34px; max-height: 200px; line-height: 1.45; }
.stamp { flex: none; min-height: 34px; padding: 0 9px; border-radius: 4px; border: 1px solid var(--vc); background: var(--vc); color: #fff; font-weight: 600; font-size: 13.5px; }
@media (prefers-color-scheme: dark) { .stamp, .note .at { color: #10151a !important; } }
.stamp[aria-pressed="false"] { background: none; color: var(--ink2) !important; border-color: var(--line); font-weight: 500; }
.composer.reply { margin-top: 8px; }
.namefield { margin-bottom: 8px; max-width: 280px; }
.notelist { list-style: none; margin: 14px 0 0; padding: 0; }
.note { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 2px 12px; padding: 13px 8px 13px 0; border-top: 1px solid var(--line2); }
.note:first-child { border-top: 0; }
.note.flash { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--signal) 22%, transparent); } to { background: transparent; } }
.note .at { align-self: start; min-height: 24px; padding: 0 6px; border-radius: 4px; border: 0; background: var(--vc); color: #fff; font-weight: 600; font-size: 13px; }
.note .at.none { background: none; color: var(--ink3) !important; font-weight: 400; cursor: default; padding: 0; text-align: start; }
.note .by { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.note .by b { font-weight: 600; font-size: 14.5px; }
.note .by time { color: var(--ink3); font-size: 12.5px; }
.note .text { grid-column: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
.note .acts { grid-column: 2; display: flex; gap: 2px; margin: 4px 0 0 -9px; }
.note.done > .text, .note.done > .by b { color: var(--ink3); }
.note.done > .text { text-decoration: line-through; text-decoration-color: var(--line); }
.replies { grid-column: 2; list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line2); }
.replies li { padding: 5px 0; }
.replies .by { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; }
.vtag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink2); }
.vtag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--vc); }

/* ---------- dialogs, menus, toasts, uploads ---------- */
dialog { border: 1px solid var(--line); border-radius: 8px; padding: 0; background: var(--panel); color: var(--ink); width: min(480px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); box-shadow: 0 18px 60px rgba(8, 14, 20, .32); }
dialog.wide { width: min(680px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(12, 16, 20, .5); }
dialog form, dialog .dlg { padding: 22px; }
dialog h2 { font-size: 22px; margin-bottom: 6px; }
dialog .lead { color: var(--ink2); margin-bottom: 16px; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
dialog h3 { font-size: 16px; margin: 22px 0 8px; }
.menu { position: absolute; z-index: 50; min-width: 190px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--raised); box-shadow: 0 10px 34px rgba(8, 14, 20, .22); }
.menu button { display: block; width: 100%; text-align: start; padding: 8px 10px; border: 0; background: none; border-radius: 4px; }
.menu button:hover { background: var(--sunk); }
.menu button.danger { color: var(--signal); }
.menu hr { border: 0; border-top: 1px solid var(--line2); margin: 4px 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; padding: 10px 16px; border-radius: 6px; background: var(--ink); color: var(--bg); font-weight: 500; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(8, 14, 20, .3); }
.tray { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: min(340px, calc(100vw - 36px)); border: 1px solid var(--line); border-radius: 8px; background: var(--raised); box-shadow: 0 12px 40px rgba(8, 14, 20, .25); overflow: hidden; }
.tray h3 { font-size: 14px; padding: 10px 12px; border-bottom: 1px solid var(--line2); display: flex; justify-content: space-between; align-items: center; }
.tray ul { list-style: none; margin: 0; padding: 4px 12px 10px; max-height: 240px; overflow: auto; }
.tray li { padding: 7px 0 3px; font-size: 13px; }
.tray li div { display: flex; justify-content: space-between; gap: 10px; }
.tray li div span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray progress { width: 100%; height: 4px; margin-top: 5px; appearance: none; -webkit-appearance: none; border: 0; background: var(--sunk); border-radius: 2px; overflow: hidden; display: block; }
.tray progress::-webkit-progress-bar { background: var(--sunk); }
.tray progress::-webkit-progress-value { background: var(--ink); }
.tray progress::-moz-progress-bar { background: var(--ink); }
.tray .failed { color: var(--signal); }
.linkrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 0; border-top: 1px solid var(--line2); }
.linkrow:first-of-type { border-top: 0; }
.linkrow .opts { grid-column: 1 / 3; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.linkrow code { font: inherit; font-size: 12.5px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.warn { padding: 10px 12px; border: 1px solid var(--signal); border-radius: var(--r); font-size: 13.5px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ---------- small screens: sheet and deck become two steps ---------- */
@media (max-width: 820px) {
  .proj { grid-template-columns: minmax(0, 1fr); }
  .proj.has-track .sheet { display: none; }
  .proj:not(.has-track) .deck { display: none; }
  .sheet { border-right: 0; }
  .deck { padding: 16px 16px 90px; }
  .back { display: inline-flex; margin: -4px 0 10px -9px; }
  .proj.single .back { display: none; }
  .wavewrap canvas { height: 104px; }
  .top { padding: 8px 14px; gap: 10px; }
  .top .crumb span, .top nav .wide { display: none; }
  .transport { gap: 12px; }
  .transport .gap { flex-basis: 100%; height: 0; }
  .vol { display: none; }
  .ver kbd { display: none; }
  .note { grid-template-columns: 52px minmax(0, 1fr); }
  .page-head h1 { font-size: 26px; }
  .row .meta.wide { display: none; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
