/* PigCat playable synth workbench — Stitch / Figma tokens */
:root {
  --sx-bg: #0e0e0e;
  --sx-bg-2: #131313;
  --sx-panel: #1c1b1b;
  --sx-panel-2: #201f1f;
  --sx-panel-3: #2a2a2a;
  --sx-line: #201f1f;
  --sx-line-2: #353534;
  --sx-text: #e5e2e1;
  --sx-text-2: #bec8d2;
  --sx-mute: #88929b;
  --sx-cyan: #0ea5e9;
  --sx-cyan-2: #89ceff;
  --sx-amber: #de8712;
  --sx-amber-2: #ffb86e;
  --sx-red: #ffb4ab;
  --sx-red-2: #93000a;
  --sx-font: Geist, Inter, "Segoe UI", sans-serif;
  --sx-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body.sx-body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--sx-bg); color: var(--sx-text);
  font-family: var(--sx-font); font-size: 12px;
  user-select: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
.sx-mono { font-family: var(--sx-mono); font-variant-numeric: tabular-nums; }

.sx-app {
  width: min(1440px, 100vw);
  height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--sx-bg);
}

.sx-top {
  flex: 0 0 auto;
  background: rgba(14,14,14,.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--sx-line);
}
.sx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  height: 44px;
}
.sx-row-1 { height: 48px; }
.sx-row-2 { height: 44px; background: #1c1b1b; }
.sx-row-3 { height: 44px; background: #0e0e0e; }
.sx-row + .sx-row { border-top: 1px solid var(--sx-line); }
.sx-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--sx-text); }
.sx-brand b { font-size: 14px; letter-spacing: .05em; font-weight: 500; }
.sx-logo {
  width: 24px; height: 24px; border-radius: 4px; background: #201f1f;
  display: inline-flex; align-items: center; justify-content: center;
}
.sx-user, .sx-patch-bar, .sx-save-bar, .sx-transport, .sx-meters {
  display: flex; align-items: center; gap: 8px;
}
.sx-patch-bar { gap: 6px; }
.sx-save-bar { gap: 6px; }
.sx-transport { gap: 16px; }
.sx-eng, .sx-trans-btns, .sx-tempo, .sx-perf, .sx-cpu, .sx-peak-wrap {
  display: flex; align-items: center; gap: 6px;
}
.sx-trans-btns { gap: 4px; }
.sx-tempo { gap: 8px; }
.sx-perf { gap: 4px; }
.sx-cpu { gap: 8px; }
.sx-peak-wrap { gap: 4px; }
.sx-eng { gap: 6px; font-size: 9px; letter-spacing: .072em; }
.sx-eng #sxEngine { color: var(--sx-text); }
.sx-eng #sxEngineSpec { font-family: var(--sx-mono); font-size: 9px; }
.sx-user { gap: 16px; }
.sx-meters { gap: 12px; }
.sx-vr { width: 1px; height: 16px; background: #353534; }
.sx-morph-a { color: var(--sx-cyan); font-family: var(--sx-mono); font-size: 8px; font-weight: 700; }
.sx-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #89ceff;
  display: inline-flex; align-items: center; justify-content: center;
}
.sx-avatar img { width: 12px; height: 12px; }
.sx-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 4px; background: #1c1b1b;
}
.sx-btn.tiny { height: 20px; padding: 0 6px; font-size: 9px; }
.sx-sel.tiny { height: 20px; font-size: 8px; }
.sx-icon img { display: block; }
.sx-icon.rec img { filter: none; }
.sx-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px; border-radius: 4px; font-size: 8px; letter-spacing: .08em;
  color: var(--sx-cyan); background: rgba(14,165,233,.1);
}
.sx-chip.dim { color: var(--sx-mute); background: #201f1f; }
.sx-switch {
  display: flex; padding: 2px; border-radius: 4px; background: #1c1b1b;
}
.sx-switch a, .sx-switch button {
  padding: 4px 12px; border-radius: 4px; color: var(--sx-text-2); text-decoration: none;
  font-size: 11px; letter-spacing: .011em;
}
.sx-switch .on, .sx-switch a.on { background: #2a2a2a; color: #fff; font-weight: 600; }
.sx-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sx-cyan); display: inline-block; }
.sx-dot.off { background: #444748; }
.sx-dot.warn { background: var(--sx-amber); }
.sx-dot.err { background: var(--sx-red); }
.sx-pro {
  color: var(--sx-amber-2); background: rgba(255,184,110,.1);
  padding: 2px 4px; border-radius: 4px;
  font-family: var(--sx-mono); font-size: 8px; letter-spacing: .08em; font-weight: 500;
}

.sx-btn {
  height: 28px; padding: 0 10px; border-radius: 4px;
  background: #201f1f; color: var(--sx-text-2); border: 1px solid var(--sx-line);
}
.sx-btn:hover { color: #fff; background: #2a2a2a; }
.sx-btn.pri { background: var(--sx-cyan); color: #003751; border-color: transparent; font-weight: 600; }
.sx-btn.danger { color: var(--sx-red); }
.sx-btn.on { background: rgba(14,165,233,.2); color: var(--sx-cyan); border-color: rgba(14,165,233,.4); }
.sx-icon {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: #201f1f; border-radius: 4px; color: var(--sx-text);
}

.sx-name {
  width: 144px; height: 22px; padding: 0 8px; border: 0; border-radius: 4px;
  background: #0e0e0e; color: #fff; font-family: var(--sx-mono); font-size: 10px; letter-spacing: .06em;
}
.sx-sel {
  height: 20px; background: #0e0e0e; border: 0; border-radius: 4px;
  padding: 2px 10px 2px 10px; font-family: var(--sx-mono); font-size: 9px;
  letter-spacing: .072em; color: var(--sx-text);
}
.sx-morph { width: 64px; accent-color: var(--sx-cyan); height: 4px; }

.sx-body-row {
  flex: 1; min-height: 0; display: flex;
}
.sx-side {
  width: 240px; flex: 0 0 240px;
  border-right: 1px solid var(--sx-line);
  display: flex; flex-direction: column;
  background: var(--sx-bg);
}
.sx-side.right { width: 280px; flex: 0 0 280px; border-right: 0; border-left: 1px solid var(--sx-line); }
.sx-side.collapsed { display: none; }
.sx-side h3 {
  margin: 0; padding: 8px 12px; font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sx-mute); border-bottom: 1px solid var(--sx-line);
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.sx-side#sxLeft h3 {
  font-size: 12px; letter-spacing: .06em; text-transform: none; color: var(--sx-text);
  padding: 12px 12px 8px; border-bottom: 0; justify-content: flex-start;
}
.sx-side#sxLeft h3 .sx-side-ico { margin-left: auto; color: var(--sx-mute); font-size: 10px; }
.sx-search {
  margin: 0 12px 8px; height: 23px; width: calc(100% - 24px); padding: 0 8px;
  background: #1c1b1b; border: 0; border-radius: 4px; color: #fff;
  font-size: 9px; letter-spacing: .072em;
}
.sx-tabs {
  display: flex; gap: 2px; margin: 0 12px 8px; padding: 2px;
  flex-wrap: wrap; background: #1c1b1b; border-radius: 4px;
}
.sx-tab {
  flex: 1; padding: 4px 6px; border-radius: 4px; font-size: 8px; letter-spacing: .08em;
  background: transparent; color: var(--sx-mute); text-align: center;
}
.sx-tab.on { background: #353534; color: var(--sx-text); }
.sx-list { flex: 1; overflow: auto; padding: 0 12px 8px; }
.sx-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; border-radius: 4px; color: var(--sx-text-2); margin-bottom: 2px;
  font-family: var(--sx-mono); font-size: 9px; letter-spacing: .072em;
}
.sx-item:hover { background: #1c1b1b; color: #fff; }
.sx-item.on { background: #2a2a2a; color: #fff; box-shadow: inset 4px 0 0 var(--sx-cyan); }
#sxLibEmpty { padding: 12px; text-align: center; }
.sx-foot {
  padding: 9px 12px 8px; border-top: 1px solid #2a2a2a;
  color: var(--sx-mute); font-size: 8px; letter-spacing: .08em;
  display: flex; justify-content: space-between;
}
.sx-foot button { color: var(--sx-mute); font-size: 8px; letter-spacing: .08em; }

.sx-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; background: #1c1b1b;
}
.sx-center-nav {
  display: flex; gap: 0; border-bottom: 1px solid #201f1f; background: #0e0e0e;
  overflow-x: auto;
}
.sx-center-nav button {
  padding: 6px 12px 8px; color: #88929b; font-size: 9px; letter-spacing: .08em; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.sx-center-nav button.on {
  color: #e5e2e1; font-weight: 500; font-size: 11px; letter-spacing: .01em;
  border-bottom: 2px solid #0ea5e9; background: #201f1f;
}
.sx-center { flex: 1; min-height: 0; overflow: auto; padding: 8px; background: #131313; }

.sx-card {
  background: #0e0e0e; border: 1px solid var(--sx-line); border-radius: 2px; padding: 12px;
}
.sx-card.on { border-color: var(--sx-cyan); }
.sx-grid { display: grid; gap: 8px; }
.sx-g12 { grid-template-columns: repeat(12, 1fr); }
.sx-span2 { grid-column: span 2; }
.sx-span4 { grid-column: span 4; }
.sx-span3 { grid-column: span 3; }
.sx-span6 { grid-column: span 6; }
.sx-span8 { grid-column: span 8; }
.sx-span12 { grid-column: span 12; }
.sx-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--sx-line); }
.sx-voice-h { align-items: center; padding-bottom: 9px; }
.sx-voice-h-l, .sx-voice-h-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sx-voice-h-l b { font-size: 12px; letter-spacing: .05em; font-weight: 600; text-transform: uppercase; }
.sx-vr-tall { height: 12px; align-self: center; }
.sx-voice-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 8px; letter-spacing: .08em; }
.sx-meta { display: flex; flex-direction: column; gap: 0; min-width: 56px; line-height: 10px; }
.sx-meta em { font-style: normal; color: #88929b; }
.sx-meta .sx-mono { color: #e5e2e1; }
.sx-meta .sx-mono.c, .sx-mono.c { color: #0ea5e9; }
.sx-headroom {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px; border: 1px solid #201f1f; border-radius: 4px; background: #0e0e0e;
}
.sx-headroom em { font-style: normal; color: #88929b; font-size: 8px; letter-spacing: .08em; }
.sx-k { font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: var(--sx-mute); }
.sx-waves { display: flex; flex-direction: column; gap: 4px; background: transparent; border: 0; }
.sx-waves button { padding: 6px 2px; color: var(--sx-mute); font-size: 8px; letter-spacing: .06em; }
.sx-waves button.on { background: #2a2a2a; color: var(--sx-cyan); }
.sx-knobs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sx-knob { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: ns-resize; }
.sx-dial {
  width: 36px; height: 36px; border-radius: 50%;
  background: conic-gradient(from 210deg, var(--sx-cyan) calc(var(--p, .4) * 270deg), #1a1a1a 0);
  position: relative;
}
.sx-dial::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #201f1f;
  box-shadow: inset 0 0 0 1px #353534;
}
.sx-dial i {
  position: absolute; left: 50%; top: 6px; width: 2px; height: 10px; background: #fff;
  transform-origin: 50% 12px; transform: translateX(-50%) rotate(calc(-135deg + var(--p, .4) * 270deg));
  z-index: 1;
}
.sx-mod { width: 6px; height: 6px; border-radius: 50%; background: var(--sx-cyan); display: inline-block; margin-left: 3px; }
.sx-graph {
  height: 88px; background: #000; border: 1px solid var(--sx-line); position: relative; overflow: hidden;
}
.sx-graph canvas { width: 100%; height: 100%; display: block; }

.sx-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; margin-bottom: 8px; border: 1px solid rgba(14,165,233,.35);
  background: rgba(14,165,233,.08); color: var(--sx-text);
}
.sx-banner.warn { border-color: rgba(222,135,18,.5); background: rgba(222,135,18,.1); }
.sx-banner.err { border-color: rgba(147,0,10,.6); background: rgba(147,0,10,.18); }

.sx-play {
  flex: 0 0 112px; display: flex; align-items: center; gap: 12px;
  padding: 0 12px; border-top: 1px solid var(--sx-line); background: #0e0e0e;
}
.sx-play-cfg {
  width: 192px; flex: 0 0 192px; display: flex; flex-direction: column; justify-content: center; gap: 4px;
  border-right: 1px solid var(--sx-line); padding-right: 9px;
}
.sx-play-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sx-play .sx-k { font-size: 8px; letter-spacing: .08em; }
.sx-play .sx-btn.tiny {
  height: 16px; padding: 2px 4px; font-size: 8px; letter-spacing: .08em;
  border: 0; border-radius: 4px;
}
.sx-play .sx-sel.tiny {
  height: 16px; padding: 2px 20px 2px 8px; font-size: 8px; background: #201f1f;
}
.sx-play .sx-knob { gap: 2px; }
.sx-play .sx-knob .sx-k { font-family: var(--sx-mono); }
.sx-play .sx-knob .sx-mono { font-size: 8px; letter-spacing: .08em; color: var(--sx-text); }
.sx-seg { display: flex; padding: 2px; border-radius: 4px; background: #1c1b1b; }
.sx-seg button { padding: 2px 6px; border-radius: 4px; font-size: 8px; letter-spacing: .08em; color: var(--sx-mute); }
.sx-seg button.on { background: #2a2a2a; color: var(--sx-text); }
.sx-oct { display: flex; align-items: center; gap: 4px; }
.sx-oct-lab { color: var(--sx-cyan); font-size: 8px; }
.sx-xy {
  width: 96px; height: 96px; background: #1c1b1b; border: 1px solid var(--sx-line);
  position: relative; cursor: crosshair; flex: 0 0 96px; border-radius: 4px; align-self: center;
}
.sx-xy::before, .sx-xy::after {
  content: ""; position: absolute; background: rgba(136,146,155,.2);
}
.sx-xy::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.sx-xy::after { top: 50%; left: 0; right: 0; height: 1px; }
.sx-xy i {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  background: var(--sx-cyan); transform: translate(-50%, -50%);
  box-shadow: 0 0 8px var(--sx-cyan);
}
.sx-xy span {
  position: absolute; left: 8px; bottom: 4px; font-size: 8px; letter-spacing: .08em;
  color: var(--sx-mute); transform: scale(.75); transform-origin: left bottom;
}
.sx-keys { flex: 1; min-width: 0; position: relative; padding: 8px 0; }
.sx-keys canvas { width: 100%; height: 96px; display: block; border: 1px solid var(--sx-line); background: #0e0e0e; }
.sx-macro4 { display: flex; gap: 8px; align-items: center; padding-right: 9px; border-right: 1px solid var(--sx-line); }

.sx-meter { width: 48px; height: 6px; background: #201f1f; border-radius: 99px; overflow: hidden; }
.sx-meter > i { display: block; height: 100%; background: var(--sx-cyan); }
.sx-peak { display: flex; gap: 2px; align-items: flex-end; height: 16px; }
.sx-peak i { width: 6px; background: var(--sx-cyan); }

.sx-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.62); display: flex;
  align-items: center; justify-content: center; z-index: 80;
}
.sx-dialog {
  width: min(520px, 92vw); background: #131313; border: 1px solid var(--sx-line); padding: 20px;
}
.sx-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 92vw);
  background: #131313; border-left: 1px solid var(--sx-line); z-index: 70; padding: 16px; overflow: auto;
}
#sxMidi.sx-drawer {
  top: 136px; bottom: 112px; width: 420px; max-width: 92vw;
  background: #0e0e0e; padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: -12px 0 50px -12px rgba(0,0,0,.25);
}

.sx-gate {
  min-height: 100vh; display: flex; flex-direction: column; background: #000; color: #fff;
}
.sx-gate main { max-width: 560px; margin: 80px auto; padding: 0 20px; text-align: center; }
.sx-gate-card {
  text-align: left; border: 1px solid #262626; border-radius: 10px; padding: 16px; margin-top: 14px; background: #0a0a0a;
}

.sx-matrix-row { display: grid; grid-template-columns: 28px 1fr 90px 70px 52px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #1a1a1a; }
.sx-src { display: flex; justify-content: space-between; padding: 8px; background: #1c1b1b; margin-bottom: 4px; border-radius: 3px; }
.sx-step { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.sx-cell {
  min-height: 54px; background: #111; border: 1px solid #262626; border-radius: 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--sx-mono); font-size: 10px;
}
.sx-cell.on { border-color: var(--sx-cyan); color: var(--sx-cyan); }
.sx-cell.play { box-shadow: inset 0 0 0 1px var(--sx-cyan); }

.sx-hidden { display: none !important; }
.sx-scroll::-webkit-scrollbar { width: 0; height: 0; }

@media (max-width: 900px) {
  .sx-app { display: none; }
  .sx-gate { display: flex; }
}
@media (min-width: 901px) {
  .sx-gate { display: none; }
}
.sx-app.sx-force {
  display: flex !important;
  height: auto;
  min-height: 100vh;
  overflow: auto;
}

/* euro-rack voice / mod / fx */
.sx-rack {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: start;
}
.sx-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sx-modcard {
  background: #0e0e0e;
  border: 1px solid #201f1f;
  border-radius: 4px;
  padding: 13px;
}
.sx-modhead {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
  min-height: 20px; padding-bottom: 7px; border-bottom: 1px solid #201f1f;
}
.sx-modhead .sx-modtitle { flex: 1; font-size: 8px; color: #e5e2e1; letter-spacing: .04em; }
.sx-badge {
  display: inline-flex; align-items: center;
  font-size: 8px; letter-spacing: .08em; padding: 2px 4px; border-radius: 4px;
  background: rgba(14,165,233,.2); color: #0ea5e9; font-weight: 600;
}
.sx-badge.solid { background: #0ea5e9; color: #003751; }
.sx-badge.flat { background: #2a2a2a; color: #e5e2e1; }
.sx-active { font-family: var(--sx-mono); font-size: 8px; letter-spacing: .08em; color: #0ea5e9; }
.sx-sync, .sx-tocut {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px; border-radius: 4px; border: 1px solid #353534;
  background: #1c1b1b; color: #88929b; font-size: 8px; letter-spacing: .04em;
}
.sx-sync.on, .sx-tocut.on {
  border-color: #0ea5e9; background: rgba(14,165,233,.2); color: #0ea5e9;
}
.sx-premaster { margin-left: auto; color: #3e4850; }
.sx-fxhead { font-size: 8px; color: #e5e2e1; letter-spacing: .04em; font-weight: 600; }
.sx-led {
  width: 6px; height: 6px; border-radius: 50%; background: #353534; display: inline-block;
}
.sx-led.on { background: #0ea5e9; box-shadow: 0 0 6px #0ea5e9; }
.sx-wave-lab {
  font-size: 8px; color: #88929b; letter-spacing: .04em; margin: 0;
  text-transform: uppercase;
}
.sx-wave-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
  background: #1c1b1b; border: 1px solid #201f1f; border-radius: 4px; padding: 3px;
}
.sx-wave-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 2px 6px; border-radius: 4px; border: 1px solid transparent;
  color: #88929b; background: transparent; font-size: 8px; letter-spacing: .08em;
}
.sx-wave-btn.on {
  background: #2a2a2a; border-color: rgba(14,165,233,.5); color: #0ea5e9; font-weight: 600;
}
.sx-wave-ico { display: block; }
.sx-hslider {
  position: relative; height: 16px; background: #1c1b1b; border: 1px solid #353534;
  border-radius: 4px; cursor: ew-resize; overflow: hidden;
}
.sx-hslider-fill { height: 100%; width: 0; background: rgba(14,165,233,.45); }
.sx-hslider.dim { opacity: .38; pointer-events: none; }
.sx-hslider-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: #88929b; letter-spacing: .08em;
}
.sx-slider-row { margin-top: 10px; }
.sx-slider-row .sx-k { display: block; margin-bottom: 4px; font-size: 8px; }
.sx-hint { margin-top: 6px; font-size: 8px; letter-spacing: .06em; color: #0ea5e9; }
.sx-knob.lg .sx-dial { width: 64px; height: 64px; }
.sx-knob.lg .sx-dial::after { inset: 8px; }
.sx-knob.lg .sx-dial i {
  top: 10px; height: 16px; transform-origin: 50% 22px;
}
.sx-knob.sm .sx-dial { width: 28px; height: 28px; }
.sx-knob.sm .sx-dial::after { inset: 4px; }
.sx-knob.sm .sx-dial i { top: 4px; height: 8px; transform-origin: 50% 10px; }
.sx-knob.sideknob { gap: 2px; }
.sx-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sx-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.sx-sidecard {
  background: #1c1b1b; border: 1px solid #201f1f; border-radius: 4px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.sx-sidecard .sx-k { font-size: 8px; }
.sx-graph.tall { height: 128px; }
.sx-graph.env { height: 56px; }
.sx-filt-read {
  position: absolute; left: 8px; top: 6px; display: flex; gap: 10px;
  font-family: var(--sx-mono); font-size: 8px; color: #e5e2e1; letter-spacing: .04em;
  pointer-events: none;
}
.sx-filt-read span { color: #88929b; }
.sx-filt-knobs { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.sx-octseg, .sx-colseg { display: flex; gap: 4px; margin: 6px 0 8px; }
.sx-octseg button, .sx-colseg button {
  flex: 1; height: 22px; border-radius: 4px; border: 1px solid #201f1f;
  background: #1c1b1b; color: #88929b; font-size: 8px; letter-spacing: .08em;
}
.sx-octseg button.on, .sx-colseg button.on {
  background: #2a2a2a; border-color: rgba(14,165,233,.5); color: #0ea5e9;
}
.sx-fxminis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sx-fxmini {
  background: #1c1b1b; border: 1px solid #201f1f; border-radius: 4px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.sx-fxmini-h {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  font-size: 8px; letter-spacing: .08em; color: #e5e2e1;
}
.sx-wet { font-family: var(--sx-mono); font-size: 8px; color: #0ea5e9; }
.sx-pw {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding: 7px; background: #1c1b1b; border: 1px solid #201f1f; border-radius: 4px;
}
.sx-pw.dim { opacity: .4; }
.sx-pw-l, .sx-pw-r { display: flex; align-items: center; gap: 6px; }
.sx-pw-l .sx-k { line-height: 10px; }
.sx-pw .sx-hint { margin-top: 0; }
.sx-pw-chip {
  background: #0e0e0e; color: #3e4850; font-size: 8px; letter-spacing: .08em;
  padding: 0 4px; border-radius: 4px;
}
.sx-pw-bar {
  width: 80px; height: 6px; background: #353534; border-radius: 99px; overflow: hidden; cursor: ew-resize;
}
.sx-pw.dim .sx-pw-bar { width: 64px; height: 4px; background: #201f1f; cursor: default; }
.sx-pw-bar .sx-hslider-fill { height: 100%; background: #0ea5e9; }
.sx-pw.dim .sx-pw-bar .sx-hslider-fill { background: #3e4850; }
.sx-route {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 8px; padding: 5px 9px; background: #0e0e0e; border: 1px solid #201f1f; border-radius: 4px;
  font-size: 8px; letter-spacing: .08em; color: #e5e2e1;
}
.sx-route-k { color: #0ea5e9; font-family: var(--sx-mono); line-height: 10px; }
.sx-route-p, .sx-route-arr { color: #88929b; }
.sx-route b { font-weight: 600; color: #e5e2e1; }
.sx-route-tail { display: flex; gap: 8px; margin-left: auto; }
.sx-route-r { display: flex; flex-direction: column; line-height: 10px; }
.sx-route-r em { font-style: normal; color: #88929b; }
.sx-route-r .c { color: #0ea5e9; }
.sx-collapsible { cursor: pointer; }
.sx-fxrack {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: stretch;
}
.sx-fxmod {
  background: #0e0e0e; border: 1px solid #201f1f; border-radius: 4px;
  padding: 10px; min-height: 260px;
  display: flex; flex-direction: column; gap: 8px;
}
.sx-fxmod.off { opacity: .42; }
.sx-fxmod-h { display: flex; align-items: center; gap: 6px; }
.sx-fxmod-h b { flex: 1; font-size: 10px; letter-spacing: .08em; }
.sx-fxmod-knobs { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sx-fxby {
  height: 20px; padding: 0 6px; border-radius: 4px; border: 1px solid #353534;
  background: #1c1b1b; color: #88929b; font-size: 8px; letter-spacing: .08em;
  display: inline-flex; align-items: center; gap: 4px;
}
.sx-fxby.on { color: #0ea5e9; border-color: rgba(14,165,233,.45); }
.sx-modgroup { margin-bottom: 14px; }
.sx-modgroup > .sx-k { display: block; margin-bottom: 6px; font-size: 8px; }
.sx-modslot {
  display: grid;
  grid-template-columns: 28px minmax(72px,1fr) 14px minmax(72px,1fr) 110px 44px 32px 26px 26px;
  gap: 6px; align-items: center;
  padding: 8px; border: 1px solid #201f1f; border-radius: 4px; margin-bottom: 4px;
  background: #0e0e0e;
}
.sx-modslot.on { border-color: rgba(14,165,233,.5); background: #1c1b1b; }
.sx-modslot.off { opacity: .4; }
.sx-modslot select {
  width: 100%; height: 24px; background: #0e0e0e; border: 1px solid #353534;
  border-radius: 4px; font-size: 9px; padding: 0 4px;
}
.sx-mod-arrow { color: #88929b; text-align: center; font-size: 10px; }
.sx-bipolar {
  position: relative; height: 12px; background: #1c1b1b; border: 1px solid #353534;
  border-radius: 99px; cursor: ew-resize; overflow: hidden;
}
.sx-bipolar-fill { position: absolute; top: 0; bottom: 0; background: #0ea5e9; }
.sx-bipolar-handle {
  position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%;
  background: #e5e2e1; transform: translate(-50%, -50%); pointer-events: none;
}
.sx-bipolar-read { font-size: 8px; color: #0ea5e9; }
.sx-pwr {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid #353534;
  background: #1c1b1b; position: relative;
}
.sx-pwr i {
  position: absolute; left: 50%; top: 5px; width: 2px; height: 6px; background: #88929b;
  transform: translateX(-50%);
}
.sx-pwr::after {
  content: ""; position: absolute; left: 5px; right: 5px; top: 7px; bottom: 5px;
  border: 1.5px solid #88929b; border-radius: 50%; border-top-color: transparent;
}
.sx-pwr.on { border-color: rgba(14,165,233,.5); }
.sx-pwr.on i, .sx-pwr.on::after { background: #0ea5e9; border-color: #0ea5e9; border-top-color: transparent; }
.sx-algo-desc { margin-top: 8px; font-size: 9px; color: #88929b; letter-spacing: .04em; }

/* header / footer / sides / MIDI chrome — Figma 2:656 / 2:780 / 2:4393 / 2:5679 */
.sx-top .sx-btn {
  height: 22px; padding: 4px 8px; font-size: 11px; letter-spacing: .011em; border: 0;
}
.sx-top .sx-btn.tiny {
  height: 16px; padding: 2px 6px; font-size: 9px; letter-spacing: .072em;
}
.sx-top .sx-meters .sx-btn {
  height: 18px; padding: 2px 8px; font-size: 9px; letter-spacing: .072em;
}
.sx-top .sx-meters .sx-btn.danger {
  height: 16px; padding: 2px 6px; font-size: 8px; letter-spacing: .08em;
}
.sx-top .sx-user .sx-btn { height: 22px; }
.sx-top .sx-user .sx-k { font-size: 9px; letter-spacing: .072em; text-transform: none; color: var(--sx-text-2); }
.sx-bpm-wrap {
  position: relative; display: inline-flex; align-items: center;
}
.sx-pill {
  cursor: pointer;
}
.sx-pill #sxBpm, .sx-beat {
  font-family: var(--sx-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .06em; color: var(--sx-text); line-height: 12px;
}
.sx-beat {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 0; padding: 0 10px 0 0;
  cursor: pointer; background-image: none;
}
#sxBpmIn {
  width: 48px; height: 16px; margin: 0; padding: 0 2px;
  background: #0e0e0e; border: 0; border-radius: 2px;
  color: var(--sx-text); font-family: var(--sx-mono); font-size: 10px; font-weight: 600;
}
.sx-add-mod {
  width: 20px; height: 20px; padding: 0; border-radius: 4px;
  background: #201f1f; color: var(--sx-text-2); font-size: 14px; line-height: 18px;
}
.sx-add-mod:hover { color: #fff; background: #2a2a2a; }

.sx-midi-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; padding: 12px 12px 0; background: #1c1b1b;
}
.sx-midi-title { display: flex; align-items: center; gap: 8px; }
.sx-midi-title b {
  display: block; font-size: 12px; font-weight: 500; letter-spacing: .03em;
  color: var(--sx-text); text-transform: uppercase;
}
.sx-midi-ico {
  width: 16px; height: 16px; flex: 0 0 16px;
  background:
    linear-gradient(#88929b, #88929b) 1px 10px / 2px 6px no-repeat,
    linear-gradient(#88929b, #88929b) 5px 6px / 2px 10px no-repeat,
    linear-gradient(#88929b, #88929b) 9px 2px / 2px 14px no-repeat,
    linear-gradient(#88929b, #88929b) 13px 8px / 2px 8px no-repeat;
}
.sx-midi-esc { display: flex; align-items: center; gap: 6px; }
.sx-midi-x {
  width: 24px; height: 24px; border-radius: 4px; background: #201f1f;
  color: var(--sx-mute); font-size: 14px; line-height: 22px;
}
.sx-midi-x:hover { color: var(--sx-text); }
.sx-midi-tabs {
  display: flex; gap: 0; margin: 8px 12px 0; padding: 2px;
  background: #0e0e0e; border-radius: 4px;
}
.sx-midi-tabs button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 4px 0; border-radius: 4px; font-size: 9px; letter-spacing: .072em;
  color: var(--sx-mute);
}
.sx-midi-tabs button.on {
  background: #2a2a2a; color: var(--sx-cyan); font-family: var(--sx-mono); font-weight: 600;
}
.sx-midi-body {
  flex: 1; min-height: 0; overflow: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.sx-midi-sec {
  background: #1c1b1b; border-radius: 4px; padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.sx-midi-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sx-midi-online { display: inline-flex; align-items: center; gap: 4px; color: var(--sx-cyan); font-size: 8px; letter-spacing: .08em; }
.sx-midi-dev, .sx-midi-sel {
  width: 100%; height: 26px; padding: 4px 12px;
  background: #0e0e0e; border: 0; border-radius: 4px;
  font-family: var(--sx-mono); font-size: 9px; letter-spacing: .072em; color: var(--sx-text);
}
.sx-midi-note {
  margin: 0; padding: 6px; border-radius: 4px; background: #201f1f;
  color: var(--sx-text-2); font-size: 11px; letter-spacing: .011em; line-height: 1.25;
}
.sx-midi-prefs { display: flex; gap: 6px; }
.sx-midi-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sx-midi-step {
  display: flex; align-items: center; justify-content: space-between;
  height: 24px; padding: 2px 4px; background: #0e0e0e; border-radius: 4px;
}
.sx-midi-step .sx-mono { font-size: 9px; font-weight: 600; letter-spacing: .072em; }
.sx-midi-step-btn {
  width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--sx-mute); font-family: var(--sx-mono); font-size: 10px;
}
.sx-midi-clear {
  margin-left: auto; cursor: pointer; background: none; border: 0; padding: 0;
  font: inherit; color: inherit;
}
.sx-midi-clear:hover { color: var(--sx-text); }
.sx-midi-clock-input {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.sx-midi-clock-row { position: relative; cursor: pointer; }
.sx-midi-clock-row:has(#sxMidiClock:checked) {
  opacity: 1;
}
.sx-midi-clock-row:has(#sxMidiClock:checked) .sx-radio {
  border-color: var(--sx-cyan);
  box-shadow: inset 0 0 0 2.6px #fff;
  background: var(--sx-cyan);
}
.sx-midi-clock-row.on { opacity: 1; }
.sx-midi-clock-row.on.dim { opacity: 1; }
.sx-midi-clock-row.on .sx-radio {
  border-color: var(--sx-cyan);
  box-shadow: inset 0 0 0 2.6px #fff;
  background: var(--sx-cyan);
}
.sx-midi-clock-row.on .sx-mono { font-weight: 600; color: var(--sx-text); }
.sx-midi-maps { display: flex; flex-direction: column; gap: 4px; min-height: 28px; }
.sx-midi-maps > * {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px; border-radius: 4px; background: #0e0e0e;
  font-family: var(--sx-mono); font-size: 8px; letter-spacing: .08em; color: var(--sx-text);
}
.sx-midi-learn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px; border-radius: 4px; background: #201f1f;
}
.sx-midi-clock-row {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 6px; border-radius: 4px; background: #0e0e0e;
  text-align: left; color: var(--sx-text);
}
.sx-midi-clock-row .sx-mono { font-size: 9px; letter-spacing: .072em; font-weight: 600; }
.sx-midi-clock-row.dim { opacity: .5; }
.sx-midi-clock-row.dim .sx-mono { font-weight: 500; color: var(--sx-mute); }
.sx-midi-active { margin-left: auto; color: var(--sx-cyan); font-size: 8px; letter-spacing: .08em; }
.sx-radio {
  width: 13px; height: 13px; border-radius: 50px; flex: 0 0 13px;
  border: 1px solid #767676; background: #fff; box-sizing: border-box;
}
.sx-radio.on { border-color: var(--sx-cyan); box-shadow: inset 0 0 0 2.6px #fff; background: var(--sx-cyan); }
.sx-midi-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 12px 12px; background: #1c1b1b; border-top: 1px solid var(--sx-line);
}
.sx-midi-foot .sx-k { display: inline-flex; align-items: center; gap: 6px; text-transform: none; }
.sx-midi-foot .sx-btn.pri { height: 19px; padding: 4px 12px; font-size: 9px; letter-spacing: .072em; border: 0; }

#sxMidiGrant {
  width: 100%;
  height: auto;
  min-height: 28px;
  padding: 6px 10px;
  white-space: normal;
  line-height: 1.35;
  text-align: center;
}
#sxMidiGrant:disabled {
  opacity: .75;
  cursor: not-allowed;
  background: #201f1f;
  color: var(--sx-text-2);
  border: 1px solid var(--sx-line);
}
.sx-midi-export-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.sx-item .sx-cloud-del {
  width: 18px; height: 18px; padding: 0; margin-left: 8px;
  font-size: 12px; line-height: 16px; color: var(--sx-mute);
  background: transparent; border: 0;
}
.sx-item .sx-cloud-del:hover { color: var(--sx-red); }
.sx-midi-clock-row:has(#sxMidiClockOut:checked) { opacity: 1; }
.sx-midi-clock-row:has(#sxMidiClockOut:checked) .sx-radio {
  border-color: var(--sx-cyan);
  box-shadow: inset 0 0 0 2.6px #fff;
  background: var(--sx-cyan);
}
