/* multisample builder for op-xy
   monochrome · lowercase · grid · one orange · knobs */

:root {
  --paper: #f2f2f0;
  --panel: #f2f2f0;
  --well: #e9e9e6;
  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #9b9b98;
  --line: #cfcfcb;
  --line-2: #e0e0dc;
  --accent: #ff4d00;
  --accent-ink: #ffffff;
  --danger: #d12d00;
  --radius: 3px;
  --gap: 14px;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Inter, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141414; --panel: #141414; --well: #1d1d1d;
    --ink: #ececea; --ink-2: #a6a6a3; --ink-3: #65655f;
    --line: #333331; --line-2: #262625;
    --accent: #ff5a14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141414; --panel: #141414; --well: #1d1d1d;
  --ink: #ececea; --ink-2: #a6a6a3; --ink-3: #65655f;
  --line: #333331; --line-2: #262625;
  --accent: #ff5a14;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 0 20px 72px;
}
.wrap { max-width: 1120px; margin: 0 auto; }

h1, h2, h3, label, button, .label, .hint, .status, .notice { text-transform: lowercase; }
h1 { font-size: 15px; font-weight: 500; margin: 0; letter-spacing: 0.01em; }
h2 { font-size: 12px; font-weight: 500; color: var(--ink); margin: 0 0 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 26px; }
body { counter-reset: sec; }
section.panel { counter-increment: sec; }
#preset-panel { counter-increment: none; }
h2 i::before { content: counter(sec, decimal-leading-zero); }
h2 i { font-style: normal; font-family: var(--mono); color: var(--ink-3); font-weight: 400; margin-right: 10px; letter-spacing: 0.04em; }
h2 .count { color: var(--ink-2); margin-left: 8px; }
h3 { font-size: 13px; font-weight: 500; margin: 0 0 8px; }
p { margin: 0 0 8px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-weight: 400; }
.mono { font-family: var(--mono); font-size: 12px; }
.danger { color: var(--danger); }
a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
a:hover { border-color: var(--ink); }
kbd { font-family: var(--mono); font-size: 10px; border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; color: var(--ink-2); }
.hidden { display: none !important; }

/* header */
header.top { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); padding: 22px 0 18px; border-bottom: 1px solid var(--ink); }
header.top .brand { display: flex; align-items: center; gap: 10px; }
header.top .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }
header.top .sub { color: var(--ink-2); }
header.top .version { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-left: 4px; }

nav.modes { display: flex; border: 1px solid var(--ink); border-radius: 20px; overflow: hidden; }
nav.modes button { background: transparent; border: 0; color: var(--ink); padding: 6px 14px; cursor: pointer; font: inherit; font-size: 12px; }
nav.modes button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
nav.modes button:disabled { opacity: 0.35; cursor: default; }

button.theme { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ink); background: transparent; cursor: pointer; padding: 0; display: grid; place-items: center; margin-left: 6px; }
button.theme span { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 1px solid var(--ink); box-sizing: border-box; }

/* panels: ruled sections, not cards */
section.panel { padding: 22px 0 26px; border-bottom: 1px solid var(--line); }
section.panel:last-of-type { border-bottom: 0; }
#preset-panel { padding-top: 18px; }
main > section.panel:first-child { border-top: 0; }

.grid { display: grid; gap: var(--gap) 22px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 760px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: span 2; }
}

/* fields */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 11px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; letter-spacing: 0.02em; }
.field > label .val { font-family: var(--mono); color: var(--ink); font-size: 11px; white-space: nowrap; }
input[type="text"], input[type="number"], select {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--well);
  border: 1px solid transparent; border-radius: var(--radius); padding: 7px 10px; width: 100%;
  appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
input:focus, select:focus { outline: none; border-color: var(--ink); }
input.mono { font-family: var(--mono); font-size: 12px; }
.unit { display: flex; align-items: center; gap: 8px; }
.unit input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; }
.unit span { color: var(--ink-3); font-size: 11px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.stats { gap: 36px; }
h2 input[type="text"] { width: 64px; padding: 4px 8px; }

/* toggles (round switches) */
.toggles { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 2px 0 18px; }
.toggles.tight { margin: 0 0 8px; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 12px; cursor: pointer; color: var(--ink); user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .sw { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--ink); position: relative; flex: none; transition: background 0.12s; }
.check .sw::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform 0.12s; }
.check input:checked + .sw::after { transform: scale(1); }
.check input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.check input:disabled + .sw { opacity: 0.35; }

/* knobs */
.knobs { display: flex; flex-wrap: wrap; gap: 18px 22px; align-items: flex-start; }
.knobs .field, .knob-field { align-items: center; width: 96px; gap: 4px; }
.knobs .field > label, .knob-field > label { flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px; text-align: center; }
.knobs .select-field { width: 170px; align-items: stretch; }
.knobs .select-field > label { flex-direction: row; justify-content: flex-start; }
.knobs .field > input[type="text"] { text-align: center; }
.knob-input { display: none; }
svg.knob { width: 56px; height: 56px; cursor: ns-resize; outline: none; touch-action: none; display: block; }
svg.knob:focus-visible .knob-body { stroke: var(--accent); }
.knob-track { fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; }
.knob-fill { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.knob-body { fill: var(--well); stroke: var(--ink); stroke-width: 1; }
.knob-pointer { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
svg.knob.active .knob-pointer, svg.knob.active .knob-fill { stroke: var(--accent); }

/* sliders (loop start / end) */
input[type="range"]:not(.knob-input) { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; margin: 0; }
input[type="range"]:not(.knob-input)::-webkit-slider-runnable-track { height: 1px; background: var(--line); }
input[type="range"]:not(.knob-input)::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink); margin-top: -6px; cursor: ew-resize; }
input[type="range"]:not(.knob-input):focus { outline: none; }
input[type="range"]:not(.knob-input):focus::-webkit-slider-thumb { border-color: var(--accent); }

/* buttons */
button.btn {
  font: inherit; font-size: 12px; cursor: pointer; border-radius: 20px; padding: 7px 14px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink); line-height: 1.2; white-space: nowrap;
}
button.btn:hover { background: var(--ink); color: var(--paper); }
button.btn.small { padding: 4px 11px; font-size: 11px; }
button.btn.quiet { border-color: var(--line); color: var(--ink-2); }
button.btn.quiet:hover { border-color: var(--ink); background: transparent; color: var(--ink); }
button.btn.go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); padding-left: 18px; padding-right: 18px; }
button.btn.go:hover { background: var(--ink); border-color: var(--ink); }
button.btn:disabled, button.btn.go:disabled { opacity: 0.3; cursor: default; background: transparent; color: var(--ink); border-color: var(--ink); }
button.icon { background: none; border: none; cursor: pointer; color: var(--ink-3); font: inherit; font-size: 14px; padding: 2px 6px; line-height: 1; }
button.icon:hover { color: var(--ink); }
.seg { gap: 4px; }

/* dropzone */
.dropzone { display: block; position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 18px 26px; text-align: center; color: var(--ink-2); cursor: pointer; transition: border-color 0.15s; background: var(--well); }
.dropzone:hover, .dropzone.over { border-color: var(--ink); color: var(--ink); }
.dropzone.over .dz-ring { background: var(--accent); }
.dropzone input { display: none; }
.dropzone strong { color: var(--ink); font-weight: 500; }
.dropzone .faint { margin-top: 8px; font-size: 12px; }
.dz-ring { display: block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--ink); margin: 0 auto 14px; }

/* zone map */
.zonemap { display: grid; grid-template-columns: repeat(24, 1fr); gap: 4px; margin: 0 0 14px; }
.zonemap .slot { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; font-family: var(--mono); font-size: 9px; display: grid; place-items: center; color: var(--ink-3); cursor: default; overflow: hidden; }
.zonemap .slot.filled { background: var(--ink); color: var(--paper); border-color: var(--ink); cursor: pointer; }
.zonemap .slot.selected { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--accent); }
.zonemap .slot.playing { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* zone list */
.zones { display: flex; flex-direction: column; }
.zone { display: grid; grid-template-columns: 28px 96px 1fr 128px 24px; gap: 12px; align-items: center; padding: 7px 4px; border-top: 1px solid var(--line-2); cursor: pointer; }
.zone:last-child { border-bottom: 1px solid var(--line-2); }
.zone.selected { background: var(--well); }
.zone.problem .note input { border-color: var(--danger); }
.zone.recording .name { color: var(--accent); }
.zone .idx { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-align: right; }
.zone .note { display: flex; gap: 6px; align-items: center; }
.zone .note input { width: 52px; padding: 3px 6px; font-family: var(--mono); font-size: 12px; background: var(--paper); }
.zone.selected .note input { background: var(--well); border-color: var(--line); }
.zone .note .src { font-size: 9px; color: var(--ink-3); }
.zone .name { font-family: var(--mono); font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.zone .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.zone canvas { width: 100%; height: 26px; display: block; }
.zone .icon { opacity: 0; }
.zone:hover .icon, .zone.selected .icon { opacity: 1; }
@media (max-width: 760px) { .zone { grid-template-columns: 24px 84px 1fr 24px; } .zone .meta { display: none; } }

/* waveforms */
.wave { width: 100%; display: block; background: var(--well); border-radius: var(--radius); }
.wave.tall { height: 160px; }
.wave.short { height: 64px; margin-top: 6px; }
#test-wave { margin-top: 14px; }
.hint { font-size: 11px; color: var(--ink-3); margin: 8px 0 0; line-height: 1.55; }
.detail-grid { margin-top: 16px; }
.plan { margin-top: 18px; }

/* keyboard */
.keyboard { display: flex; gap: 2px; margin-top: 16px; user-select: none; }
.keyboard .key { flex: 1; height: 46px; border: 1px solid var(--line); border-radius: 0 0 3px 3px; background: var(--paper); display: flex; align-items: flex-end; justify-content: center; font-family: var(--mono); font-size: 9px; color: var(--ink-3); padding-bottom: 3px; cursor: pointer; }
.keyboard .key.zone-b { background: var(--well); }
.keyboard .key.black { background: var(--ink); color: var(--paper); border-color: var(--ink); height: 30px; }
.keyboard .key.black.zone-b { background: var(--ink-2); border-color: var(--ink-2); }
.keyboard .key.root { box-shadow: inset 0 -3px 0 var(--accent); }
.keyboard .key.down, .keyboard .key.black.down { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* meter */
.meter { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.meter > div { height: 5px; background: var(--well); border-radius: 3px; position: relative; overflow: hidden; }
.meter > div::after { content: ''; position: absolute; inset: 0; width: var(--level, 0%); background: var(--ink); transition: width 0.05s; }
.meter > div.hot::after { background: var(--danger); }

/* status, stats, notices */
.status { font-family: var(--mono); font-size: 11px; color: var(--ink-2); margin-top: 12px; min-height: 1em; text-transform: none; }
.status:empty { display: none; }
.notice { border-left: 2px solid var(--accent); padding: 6px 12px; margin: 10px 0; font-size: 12px; background: var(--well); border-radius: 0 var(--radius) var(--radius) 0; text-transform: none; }
.notice.error { border-color: var(--danger); }
.notice .btn { margin: 0 4px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .big { font-family: var(--mono); font-size: 20px; line-height: 1.1; }
.stat .big.small { font-size: 12px; line-height: 1.5; max-width: 480px; }
.stat .big.over { color: var(--danger); }
.stat .label { font-size: 10px; color: var(--ink-3); letter-spacing: 0.03em; }
.progress { height: 2px; background: var(--line-2); border-radius: 1px; overflow: hidden; margin-top: 14px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width 0.1s; }

footer { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--ink); color: var(--ink-3); font-size: 11px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

dialog { background: var(--paper); color: var(--ink); border: 1px solid var(--ink); border-radius: var(--radius); padding: 20px; max-width: 480px; width: calc(100% - 40px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog input { width: 120px; }
