:root {
  /* palette from the poster reference — hot red, hot pink, electric blue, amber on warm paper (flat fills).
     Every coloured fill carries black text (AA): R 5.1:1, M 6.5:1, C 4.9:1, Y 10:1. */
  --R: #ff3355;         /* record */
  --M: #ff4fd8;         /* playhead, selection */
  --M-ui: var(--M);
  --C: #4a7bff;         /* slices, IN, armed */
  --Y: #ffb000;         /* trim, capture (amber) */
  --V: #8a6bff;         /* violet */
  --navy: #0b1240;
  --K: #16141f;

  --bg: #e6e2df;
  --panel: #efece9;
  --field: #f8f6f4;
  --hover: #e8e4e0;
  --line: #d6d1cc;
  --line-strong: #b7b1ab;
  --ink: #16141f;
  --on-ink: #f8f6f4;
  --mute: #5b5651;      /* 5.6:1 on bg */
  --M-text: #b3127f;    /* pink as text (4.9:1) */
  --ctl: #87827c;       /* control borders (3:1) */
  --meter-off: #dcd7d2;
  --thumb-dim: #bdb6b0;
  --screen-edge: #0b0d1a;
  --grain-opacity: .06;

  --radius: 10px;
  --ui: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* slate, almost black */
    --K: #e8eaed;
    --bg: #111316;
    --panel: #181a1e;
    --field: #1f2226;
    --hover: #272a30;
    --line: #2a2d33;
    --line-strong: #3b3f47;
    --ink: #e8eaed;
    --on-ink: #111316;
    --mute: #a4a9b1;      /* 7.9:1 */
    --M-text: #ff6fdc;
    --ctl: #6a707a;       /* 3.2:1 on fields */
    --meter-off: #2a2d33;
    --thumb-dim: #464a52;
    --screen-edge: #2a2d33;
    --grain-opacity: .05;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  position: relative;
  color: var(--ink);
  font: 12px/1.35 var(--ui);
  -webkit-font-smoothing: antialiased;
}

#app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  height: 100vh;
  padding: 10px 14px 8px;
}

label, .tab, .btn, .key, .mini, .seg button, .tog, .tbtn b {
  text-transform: uppercase;
  letter-spacing: .08em;
}
label { display: block; font-size: 10.5px; font-weight: 500; color: var(--mute); }
.dim { color: var(--mute); text-transform: none; letter-spacing: 0; font-weight: 400; }
kbd {
  font: 500 10px/1 var(--ui);
  padding: 2px 4px;
  border: 1px solid var(--ctl);
  border-radius: 4px;
  color: var(--mute);
}
code { font-size: 11px; }
.row { display: flex; gap: 6px; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 6px; }

/* ---------- controls (flat) ---------- */
button { font: inherit; color: inherit; cursor: pointer; }
select, input[type=number], input[type=text] {
  font: 500 12px var(--ui);
  color: var(--ink);
  background-color: var(--field);
  border: 1px solid var(--ctl);
  border-radius: 6px;
  padding: 4px 8px;
  height: 28px;
  min-width: 0;
}
select {
  appearance: none; padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(-45deg, transparent 50%, var(--mute) 50%);
  background-position: right 11px top 12px, right 7px top 12px; background-size: 4px 4px; background-repeat: no-repeat;
}
select.small { height: 22px; font-size: 10.5px; padding: 0 20px 0 6px; background-position: right 10px top 9px, right 6px top 9px; }
input[type=number] { width: 74px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--C); outline-offset: 1px; }
input[type=range] { accent-color: var(--ink); width: 120px; }

.key, .btn, .mini {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--field);
  border: 1px solid var(--ctl);
  border-radius: 6px;
  font-size: 11px; font-weight: 500;
  height: 28px; padding: 0 10px;
  white-space: nowrap;
}
.mini { height: 24px; padding: 0 8px; font-size: 10.5px; }
.key:hover, .btn:hover, .mini:hover { background: var(--hover); border-color: var(--ink); }
.key:active, .btn:active, .mini:active { background: var(--line); }
button:disabled { opacity: .4; cursor: default; }
.btn.acc { background: var(--acc, var(--ink)); color: var(--acc-ink, var(--on-ink)); border-color: transparent; }
.btn.acc:hover { filter: brightness(1.06); }

.led { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex: none; }
.on > .led { background: var(--ink); }
.arm.on > .led { background: var(--C); box-shadow: 0 0 6px var(--C); }
.mon.on > .led { background: var(--Y); box-shadow: 0 0 6px var(--Y); }
#loopBtn.on > .led { background: var(--C); box-shadow: 0 0 6px var(--C); }
#playBtn.on > .led { background: var(--M); box-shadow: 0 0 6px var(--M); }
.arm.on { border-color: var(--C); }

.seg { display: inline-flex; border: 1px solid var(--ctl); border-radius: 6px; overflow: hidden; background: var(--field); }
.seg button { border: 0; border-right: 1px solid var(--ctl); background: transparent; font-size: 11px; font-weight: 500; padding: 0 10px; height: 26px; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--hover); }
.seg button.on { background: var(--acc, var(--ink)); color: var(--acc-ink, var(--on-ink)); }
.seg.small button { height: 22px; padding: 0 8px; }
.tog { height: 26px; padding: 0 10px; border: 1px solid var(--ctl); border-radius: 6px; background: var(--field); font-size: 11px; font-weight: 500; }
.tog:hover { background: var(--hover); }
.tog.on { background: var(--acc, var(--ink)); color: var(--acc-ink, var(--on-ink)); border-color: transparent; }

/* ---------- header ---------- */
header.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 4px 2px 2px;
}
.h-left, .h-right { display: flex; gap: 18px; align-items: center; min-width: 0; }
.h-right { justify-content: flex-end; }
.hgroup { display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; flex-direction: column; gap: 6px; }
.logo { font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.logo b { color: var(--M-text); font-weight: 600; }
.cmyk { display: flex; gap: 3px; }
.cmyk i { width: 14px; height: 3px; border-radius: 2px; }
.cmyk .c { background: var(--C); } .cmyk .m { background: var(--M); } .cmyk .y { background: var(--Y); } .cmyk .k { background: var(--R); }
.cmyk { padding: 0; } .cmyk i { height: 4px; filter: blur(.3px); }
#sinkSel { width: 210px; }

/* centred transport */
.h-center {
  display: flex; align-items: stretch; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 6px;
}
.bufbox { display: flex; flex-direction: column; gap: 4px; padding: 2px 6px 0 4px; justify-content: center; }
.bufhead { display: flex; gap: 6px; align-items: center; }
.bufhead label { margin-right: 2px; }
#bufInfo { font-size: 11px; min-width: 32px; }
#bufStrip { width: 190px; height: 30px; border-radius: 5px; background: #0b0c0f; display: block; }
.tbtn {
  display: flex; align-items: center; gap: 12px;
  border: 0; border-radius: 10px;
  padding: 0 16px 0 14px; min-height: 58px; min-width: 196px;
  position: relative; text-align: left;
  transition: filter .1s, transform .05s;
}
.tbtn:hover { filter: brightness(1.05); }
.tbtn:active { transform: scale(.98); }
.tbtn .tl { display: flex; flex-direction: column; gap: 2px; }
.tbtn b { font-size: 13px; font-weight: 600; }
.tbtn small { font-size: 11px; }
.tbtn kbd { position: absolute; top: 6px; right: 7px; border-color: currentColor; color: inherit; }
.tbtn .ico { font-size: 24px; line-height: 1; width: 24px; display: grid; place-items: center; }
.tbtn.cap { background: var(--Y); color: #16141f; }
.tbtn.cap.flash { filter: brightness(1.2); transform: scale(.98); }
.tbtn.rec { background: var(--R); color: #16141f; min-width: 176px; }
.tbtn.rec .dot { width: 18px; height: 18px; border-radius: 50%; background: #16141f; }
.tbtn.rec.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--R), 0 0 28px rgba(255,51,85,.55); }
.tbtn.rec.on .dot { border-radius: 3px; width: 16px; height: 16px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.flash-err { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* ---------- sidebar ---------- */
main { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 10px; min-height: 0; }
.side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.sources { padding-bottom: 8px; flex: none; }
.strip { margin: 0 8px 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); display: flex; flex-direction: column; gap: 7px; }
.strip.live { border-color: var(--line-strong); }
.strip-head { display: flex; gap: 7px; align-items: center; font-size: 10.5px; font-weight: 500; min-width: 0; }
.strip-head .sname { text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.strip-head .slabel { margin-left: auto; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tag { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 1px 5px; border-radius: 3px; }
.t-in { background: var(--C); color: #141414; }
.t-out { background: var(--M-ui); color: #141414; }
.strip .dev { width: 100%; }
.strip .meter { flex: 1; height: 12px; width: 0; display: block; }
.strip .lvl { width: 64px; }
.hint.small { margin: 0 10px; font-size: 11.5px; }

.pool { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#poolList { overflow: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pool-empty { color: var(--mute); text-align: center; padding: 22px 8px; font-size: 11px; letter-spacing: .08em; line-height: 1.7; border: 1px dashed var(--line); border-radius: 8px; text-transform: uppercase; }
.pool-empty span { text-transform: none; letter-spacing: 0; }
.pool-item { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.pool-item:hover { border-color: var(--line-strong); }
.pool-item.on { border-color: var(--ink); }
.pi-top { display: flex; gap: 6px; align-items: center; }
.pi-src { font-size: 9.5px; font-weight: 600; letter-spacing: .08em; padding: 1px 4px; border-radius: 3px; background: var(--ink); color: var(--on-ink); }
.pi-src.rec { background: var(--M-ui); color: #141414; }
.pi-src.buf { background: var(--Y); color: #141414; }
.pi-src.imp { background: var(--C); color: #141414; }
.pi-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; outline: none; }
.pi-name[contenteditable=true] { background: var(--bg); border-radius: 3px; box-shadow: 0 0 0 1px var(--ink); padding: 0 2px; }
.pi-x { border: 0; background: none; color: var(--mute); font-size: 15px; line-height: 1; padding: 0 2px; }
.pi-x:hover { color: var(--M-text); }
.pi-wave { width: 100%; height: 24px; display: block; margin: 5px 0 3px; }
.pi-meta { display: flex; gap: 8px; font-size: 11px; color: var(--mute); }

/* ---------- centre ---------- */
.center { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 10px; min-height: 0; min-width: 0; }
.bezel {
  background: #0b0c0f;
  border: 1px solid var(--screen-edge);
  border-radius: 12px;
  padding: 10px 10px 8px;
  display: flex; flex-direction: column; gap: 8px;
}
#screen { width: 100%; height: clamp(200px, 34vh, 400px); display: block; border-radius: 4px; cursor: crosshair; background: #0b0c0f; }
#overview { width: 100%; height: 28px; display: block; border-radius: 3px; cursor: pointer; }

.infobar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 7px 10px; }
.infobar .grp { display: flex; gap: 6px; align-items: center; }
.infobar .grp.right { margin-left: auto; }
.infobar label { margin-right: 2px; }
#bpmIn { width: 72px; }
#keySel { width: 92px; }
.conf { display: inline-flex; gap: 2px; margin-right: 6px; }
.conf i { width: 4px; height: 12px; border-radius: 1px; background: var(--meter-off); }
.conf.l1 i:nth-child(-n+1), .conf.l2 i:nth-child(-n+2), .conf.l3 i:nth-child(-n+3) { background: var(--ink); }
.conf.manual i { background: var(--M-ui); }

.lower { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; min-height: 0; }
.pads-mod { display: flex; flex-direction: column; }
#bankSel { --acc: var(--C); --acc-ink: #141414; }
#bankSel:empty { display: none; }
#pads { display: grid; grid-template-columns: repeat(4, 52px); grid-auto-rows: 52px; gap: 6px; padding: 2px 10px 10px; }
.pad {
  border: 1px solid var(--line); border-radius: 7px; background: transparent;
  display: flex; flex-direction: column; justify-content: space-between; padding: 5px 6px;
  font-size: 11px; font-weight: 600; color: var(--mute); text-align: left; user-select: none; opacity: .7;
}
.pad small { font-weight: 500; font-size: 10px; text-transform: uppercase; align-self: flex-end; }
.pad.has { background: var(--field); color: var(--ink); opacity: 1; }
.pad.has::after { content: ''; height: 3px; border-radius: 2px; background: var(--C); order: 1; }
.pad.has:hover { border-color: var(--line-strong); }
.pad.sel { border-color: var(--M-ui); box-shadow: inset 0 0 0 2px var(--M-ui); }
.pad.sel .pn::after { content: ' ◆'; font-size: 9px; }
.pad.hit { background: var(--M-ui); color: #141414; }

.pages { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 6px; flex: none; }
.tab { position: relative; border: 0; background: none; padding: 11px 14px 9px; font-size: 11.5px; font-weight: 600; color: var(--mute); }
.tab:hover { color: var(--ink); }
.tab::before { content: ''; position: absolute; left: 14px; right: 14px; top: 0; height: 3px; border-radius: 0 0 2px 2px; background: var(--tc); opacity: .45; }
.tab.on { color: var(--ink); }
.tab.on::before { opacity: 1; height: 4px; }
.tab.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); }
.t-y { --tc: var(--Y); } .t-c { --tc: var(--C); } .t-m { --tc: var(--M); } .t-k { --tc: var(--K); }
.t-cmy { --tc: var(--V); }
.t-cmy::before { background: var(--tc); }
.page { display: none; padding: 12px; overflow: auto; flex-direction: column; gap: 12px; min-height: 0; }
.page.on { display: flex; }
.fields { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.grow { flex: 1; min-width: 180px; }
.field.grow input { width: 100%; }
.field output { font: 500 15px var(--ui); min-width: 92px; height: 28px; display: flex; align-items: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.count { color: var(--mute); font-size: 11px; margin-left: 6px; }
.hint { margin: 0; color: var(--mute); font-size: 12px; max-width: 760px; line-height: 1.55; }
.hint.inline { max-width: 340px; align-self: center; }
.hint b { color: var(--ink); font-weight: 600; }
.hl-y { background: var(--Y); color: #141414 !important; padding: 0 3px; border-radius: 2px; }
.hl-c { background: var(--C); color: #141414 !important; padding: 0 3px; border-radius: 2px; }
.hl-m { background: var(--M-ui); color: #141414 !important; padding: 0 3px; border-radius: 2px; }
.page[data-page=fx].tape .fx-pitch { opacity: .4; pointer-events: none; }
#fxSemisOut, #fxCentsOut { min-width: 32px; font-weight: 600; }

.export-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.preview {
  margin: 0; padding: 7px 10px 7px 34px; max-height: 108px; overflow: auto;
  background: #0b0c0f; color: #e9e9e3; border-radius: 8px; border: 1px solid var(--screen-edge);
  font: 12px/1.6 var(--ui);
}
.preview li::marker { color: #8a8a85; }
.preview li span { color: var(--C); }
.preview .more { list-style: none; margin-left: -24px; color: #a3a39e; }
.export-btns { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }

footer { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--mute); padding: 0 4px; flex-wrap: wrap; }
footer .keys kbd { margin-left: 6px; }
#status.err { color: var(--M-text); font-weight: 600; }
#status.ok { color: var(--ink); }

#busy { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 10; }
#busy[hidden] { display: none; }
.busy-box { background: #0b0c0f; color: #eee; border: 1px solid var(--screen-edge); border-radius: 12px; padding: 18px 22px; width: 300px; font: 11px var(--ui); letter-spacing: .1em; text-transform: uppercase; display: flex; flex-direction: column; gap: 10px; }
.busy-box .bar { height: 4px; background: #222; border-radius: 2px; overflow: hidden; }
.busy-box .bar i { display: block; height: 100%; width: 0; background: var(--M); transition: width .1s; }
.busy-box small { color: #888; text-transform: none; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#drop { position: fixed; inset: 10px; border: 2px dashed var(--C); border-radius: 16px; background: rgba(74,123,255,.1); display: grid; place-items: center; z-index: 9; pointer-events: none; font: 600 16px var(--ui); letter-spacing: .12em; text-transform: uppercase; }
#drop[hidden] { display: none; }

@media (max-width: 1240px) {
  header.top { grid-template-columns: 1fr auto; }
  .h-center { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
}
@media (max-width: 1000px) {
  #app { height: auto; min-height: 100vh; }
  main { grid-template-columns: 1fr; }
  .pool { max-height: 240px; }
  .lower { grid-template-columns: 1fr; }
  .export-foot { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  #app { padding: 10px 16px; }
  header.top { grid-template-columns: 1fr; }
  .h-right { justify-content: flex-start; }
  .h-center { flex-wrap: wrap; justify-self: stretch; }
  .bufbox, .tbtn { flex: 1 1 100%; min-width: 0; }
  #bufStrip { width: 100%; }
  #sinkSel { width: 100%; }
  #pads { grid-template-columns: repeat(4, 1fr); }
  footer .keys { display: none; }
}

/* ---------- feedback guard, confirm & danger states ---------- */
.mon.blocked {
  background: repeating-linear-gradient(-45deg, var(--field) 0 5px, var(--hover) 5px 10px);
  color: var(--mute); border-style: dashed; cursor: not-allowed;
}
.mon.blocked > .led { background: transparent; box-shadow: inset 0 0 0 1px var(--mute); }
.guard { margin: -2px 0 0; font-size: 11px; color: var(--mute); }
.guard::before { content: '⛔ '; }
.mini.danger { color: var(--M-text); border-color: var(--M-text); }
.confirm, .mini.danger.confirm, .pi-x.confirm {
  background: var(--M-ui) !important; color: #141414 !important; border-color: var(--M-ui) !important;
  animation: pulse .6s ease-in-out infinite alternate;
}
.pi-x.confirm { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; border-radius: 4px; padding: 2px 6px; }
@keyframes pulse { to { box-shadow: 0 0 0 3px color-mix(in srgb, var(--M-ui) 35%, transparent); } }

/* pads only in slice mode */
.lower.no-pads { grid-template-columns: minmax(0, 1fr); }
.lower.no-pads .pads-mod { display: none; }

@media (prefers-reduced-motion: reduce) {
  .confirm, .tbtn.rec.on .dot { animation: none !important; }
}

/* short windows: let the page scroll instead of squeezing panels into each other */
.lower > * { min-height: 0; }
.pads-mod { overflow: auto; }
@media (max-height: 860px) {
  #app { height: auto; min-height: 100vh; }
  .lower { min-height: 300px; }
}

/* ---------- picture-in-picture mini player ---------- */
body.pip { margin: 0; height: 100vh; overflow: hidden; }
.pip-wrap { display: flex; flex-direction: column; gap: 8px; padding: 10px; height: 100%; }
.pip-top { display: flex; gap: 6px; align-items: center; font-size: 11px; }
.pip-top .logo { font-size: 15px; margin-right: 4px; }
.pip-top .tag.off { background: transparent; color: var(--mute); box-shadow: inset 0 0 0 1px var(--ctl); text-decoration: line-through; }
.pip-top #pBuf { margin-left: auto; }
#pStrip { width: 100%; flex: 1; min-height: 36px; border-radius: 6px; background: #0b0c0f; display: block; }
.pip-meters { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; }
.pip-meters .mlab { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
.pip-meters canvas { width: 100%; height: 10px; display: block; }
.pip-tr { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px; }
.pip-tr .key { height: auto; }
.pip-tr .tbtn { min-width: 0; min-height: 46px; padding: 0 10px; gap: 8px; }
.pip-tr .tbtn b { font-size: 12px; }
.pip-tr .tbtn small { font-size: 10.5px; }
.pip-tr .tbtn kbd { top: 4px; right: 5px; }
.pip-tr .tbtn.rec .dot { width: 14px; height: 14px; }
#pStatus { font-size: 11px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 14px; }
#pStatus.err { color: var(--M-text); font-weight: 600; }
#pipBtn.on > .led { background: var(--C); box-shadow: 0 0 6px var(--C); }

/* slice tab: pads sit to the right of the slice controls */
.lower:not(.no-pads) { grid-template-columns: minmax(0, 1fr) auto; }
.lower:not(.no-pads) .pads-mod { order: 2; }

/* ---------- palette extras: paper grain ---------- */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  opacity: var(--grain-opacity); mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::before { mix-blend-mode: screen; } }
.cmyk i { border-radius: 4px; }
.t-in { background: var(--C); color: #16141f; }
.t-out { background: var(--R); color: #16141f; }
.pi-src.rec { background: var(--R); color: #16141f; }
.pi-src.imp { background: var(--C); color: #16141f; }
.pi-src.buf { background: var(--Y); color: #16141f; }

/* mini player: arm buttons, buffer length, clear */
.pip-top .parm { height: 24px; padding: 0 8px; font-size: 10.5px; }
.pip-top .parm.on { border-color: var(--C); }
.pip-top .parm.on > .led { background: var(--C); box-shadow: 0 0 6px var(--C); }
.pip-top .pbufgrp { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.pip-top #pBuf { margin-left: 0; min-width: 34px; text-align: right; }
.pip-foot { display: flex; gap: 8px; align-items: center; }
.pip-foot #pStatus { flex: 1; min-width: 0; }

/* mini player: latest sample */
.pip-clip { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); transition: border-color .4s; }
.pip-clip.fresh { animation: fresh 1.2s ease-out; }
@keyframes fresh { 0% { border-color: var(--Y); box-shadow: 0 0 0 2px var(--Y); } 100% { border-color: var(--line); box-shadow: 0 0 0 0 transparent; } }
.pip-clip-head { display: flex; gap: 6px; align-items: center; font-size: 11px; min-width: 0; }
.pip-clip-head #pClipName { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pip-clip-head #pClipMeta { margin-left: auto; white-space: nowrap; }
#pClip { width: 100%; height: 38px; display: block; border-radius: 4px; cursor: pointer; background: #0b0c0f; }
#pClipEmpty { font-size: 11px; padding: 10px 2px; text-align: center; }
#pStrip { min-height: 30px; }
@media (prefers-reduced-motion: reduce) { .pip-clip.fresh { animation: none; } }
.pip-wrap [hidden] { display: none !important; }

/* undo toast after clearing a sample */
.toast {
  position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: 8px;
  background: var(--ink); color: var(--on-ink); font-size: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast[hidden] { display: none; }
.toast .mini { background: var(--Y); color: #16141f; border-color: transparent; font-weight: 600; }
.toast .mini kbd { color: inherit; border-color: currentColor; }
