:root {
  color-scheme: light;
  --bg: #f6f6f4; --panel: #ffffff; --text: #1d1d1b; --muted: #6b6a65; --line: #e2e1dc;
  --accent: #2862c9; --accent-soft: #e3ecfc; --sel: #dce8fd; --focus: #2862c9; --star: #e0a100; --star-avg: #7d9cc9;
  --danger: #c2372f; --drop: #d8f1dc; --input: #fff; --playing: #fff1c9; --playing-strong: #c27c00;
  /* Defaults that the looks in skins.css override */
  --font-ui: system-ui, "Segoe UI", sans-serif; --font-mono: ui-monospace, Consolas, monospace;
  --font-title: var(--font-ui); --font-size: 13px; --radius: 5px;
  --input-text: var(--text); --btn: var(--panel); --on-accent: #fff; --ok: #2e9a48;
  --header: var(--panel); --header-text: var(--text); --title: var(--text); --led: var(--muted);
  /* The six operators (voice editor: columns, envelopes, algorithm diagram) */
  --op1: #d62728; --op2: #b45700; --op3: #7d6f00; --op4: #26843a; --op5: #1f6fd1; --op6: #9b3fd0;
  --well: #f1f0ec; --key-w: #fff; --key-b: #2b2b29; --chip-text: #fff;
}
html[data-skin]:not([data-skin="modern"]) { --well: var(--bg); }   /* the looks don't set it */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #171716; --panel: #212120; --text: #ecebe6; --muted: #9a9993; --line: #34332f;
    --accent: #7aa7ff; --accent-soft: #24324d; --sel: #2a3a58; --focus: #7aa7ff; --star: #f2c14b; --star-avg: #6f8fbf;
    --danger: #ef7a72; --drop: #23422a; --input: #1a1a19; --playing: #4a3d16; --playing-strong: #f2c14b; --on-accent: #171716;
    --op1: #ff6b6b; --op2: #ffa64d; --op3: #e6d84a; --op4: #5fd77a; --op5: #6fb0ff; --op6: #d18cff;
    --well: #1a1a19; --key-w: #d9d8d2; --key-b: #121211; --chip-text: #111;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: var(--font-size)/1.35 var(--font-ui); display: flex; flex-direction: column; }
button, select, input, textarea { font: inherit; color: inherit; }
button { background: var(--btn); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 9px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.danger { color: var(--danger); }
#pickBtn { font-size: 1.35em; line-height: 1; }                 /* bigger dice, same height as the buttons beside it */
a.btn-link { background: var(--btn); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 9px; color: inherit; text-decoration: none; }
a.btn-link:hover { border-color: var(--accent); }
select, input[type=search], input[type=password], input:not([type]), textarea { background: var(--input); color: var(--input-text); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px 6px; }
/* The open list takes its colours from the options, not from a transparent or tinted select */
option, optgroup { background: var(--input); color: var(--input-text); font-style: normal; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
code { font-size: 11px; }

header { display: flex; align-items: center; gap: 16px; padding: 8px 14px; background: var(--header); color: var(--header-text); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
h1 { font: 600 16px var(--font-title); color: var(--title); margin: 0; display: flex; align-items: baseline; white-space: nowrap; }
h1 .tagline { order: 2; font: 400 12px var(--font-ui); letter-spacing: 0; color: var(--header-text); opacity: .8; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.midi { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex: 1; }
.midi label, .look { display: flex; gap: 4px; align-items: center; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px 1fr 340px; }
aside, #cart { background: var(--panel); padding: 12px; overflow: auto; }
aside { border-right: 1px solid var(--line); }
#cart { border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }

#catList, #listenList { list-style: none; margin: 0 0 10px; padding: 0; }
#catList li, #listenList li { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 5px; cursor: pointer; border: 1px dashed transparent; }
#catList li:hover, #listenList li[data-filter]:hover { background: var(--bg); }
#catList li.active, #listenList li.active { background: var(--accent-soft); font-weight: 600; }
#catList li.drop { background: var(--drop); border-color: var(--accent); }
#catList .n, #listenList .n { margin-left: auto; color: var(--led); font-variant-numeric: tabular-nums; }
#catList .del, #catList .ren { visibility: hidden; border: 0; background: none; padding: 0 2px; color: var(--muted); }
#catList li:hover .del, #catList li:hover .ren { visibility: visible; }
#catList .ren:hover { color: var(--accent); }
#catList li.sep { border-top: 1px solid var(--line); border-radius: 0; margin-top: 4px; padding-top: 6px; }
#catList .caret, #catList .caret-pad { flex: none; width: 18px; }
#catList .caret { height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--accent); border-radius: 4px; background: var(--bg); color: var(--accent);
  font-size: 12px; font-weight: 700; line-height: 1; }
#catList .caret:hover, #catList .caret.open { background: var(--accent-soft); }
#catList li.sub { margin-left: 14px; padding-left: 12px; font-size: .95em; box-shadow: inset 2px 0 0 var(--accent-soft); border-radius: 0 5px 5px 0; }
#catList li.sub .caret-pad { display: none; }
#catList li.only .cl { font-style: italic; }
#catList li.virtual .cl { color: var(--muted); }
#addCatForm { display: flex; gap: 4px; }
#addCatForm input { flex: 1; min-width: 0; }

main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar, .selbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; flex-wrap: wrap; }
.toolbar { border-bottom: 1px solid var(--line); }
.toolbar label { display: flex; gap: 4px; align-items: center; }
#search { width: 220px; }
#count { margin-left: auto; }
.selbar { background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.tablewrap { flex: 1; overflow: auto; outline: none; scroll-padding-top: 36px; }
.keys { padding: 4px 12px; border-top: 1px solid var(--line); font-size: 11px; }

table { border-collapse: collapse; width: 100%; }
thead th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line); z-index: 1; white-space: nowrap; }
td { padding: 2px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.also { color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
td.src { max-width: 230px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
td.name { font-family: var(--font-mono); white-space: pre; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.selected td { background: var(--sel); }
tr.playing td { background: var(--playing); }
tr.playing .play { color: var(--playing-strong); }
tr.playing.selected td { background: color-mix(in srgb, var(--sel) 50%, var(--playing)); }
#slots li.playing { background: var(--playing); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--accent); }
th.sorted { color: var(--accent); }
th[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
th[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
.sugg { cursor: pointer; border-bottom: 1px dashed var(--muted); }
.sugg:hover { color: var(--accent); border-color: var(--accent); }
.sugg b { font-weight: 500; color: var(--muted); font-size: 11px; }
.sugg.agree { color: var(--muted); border: 0; cursor: default; font-size: 11px; }
h2.gap { margin-top: 18px; }
tr.focus td:first-child { box-shadow: inset 3px 0 0 var(--focus); }
tbody tr { cursor: default; }
td input.nn { width: 160px; border: 1px solid transparent; background: transparent; padding: 1px 4px; border-radius: 4px; }
td input.nn:hover, td input.nn:focus { border-color: var(--line); background: var(--input); }
td select.cat { border-color: transparent; background: transparent; padding: 1px 2px; max-width: 170px; }
td select.cat:hover { border-color: var(--line); }
td select.cat.unchecked { font-style: italic; color: var(--muted); }
.play { border: 0; background: none; padding: 0 4px; color: var(--accent); font-size: 12px; }
.din, .spk, .vri, .edi { width: 15px; height: 15px; display: block; pointer-events: none; }   /* clicks belong to the button */
.pv { border: 0; background: none; padding: 0 3px; color: var(--accent); }
.c-play { white-space: nowrap; }
.c-play button { display: inline-block; vertical-align: middle; }
#slots li .spv { color: var(--accent); }
#slots li .sp { color: var(--accent); }
#slots li.playing .sp { color: var(--playing-strong); }
.c-chk, .c-play { width: 22px; }
.warn { color: var(--danger); }
.c-play .warn { display: inline-block; width: 1.2em; text-align: center; cursor: default; }
a.copies { color: var(--accent); cursor: pointer; text-decoration: none; }
.col-btn { border: 0; background: none; padding: 0 2px; color: var(--muted); vertical-align: middle; }
.col-btn:hover { color: var(--accent); }
/* The columns menu (right-click the list's header) */
.ctx-menu { position: fixed; z-index: 30; min-width: 200px; padding: 4px; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 4px 16px rgb(0 0 0 / .25); }
.ctx-menu button { display: flex; width: 100%; border: 0; background: none; text-align: left; padding: 3px 8px; }
.ctx-menu button:is(:hover, :focus-visible):not(:disabled) { background: var(--sel); outline: none; }
.ctx-menu .tick { width: 1.4em; flex: none; color: var(--accent); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.stars { white-space: nowrap; cursor: pointer; user-select: none; letter-spacing: 1px; }
.stars span { color: var(--line); font-size: 14px; }
.stars span.on { color: var(--star); }
.stars:hover span { color: var(--line); }
.stars span:hover, .stars span:has(~ span:hover) { color: var(--star) !important; }
.stars.bulk { background: var(--panel); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); }
.verified { cursor: pointer; color: var(--muted); user-select: none; }
.verified.on { color: var(--ok); font-weight: 700; }

.cart-head { display: flex; gap: 6px; }
.cart-head select { flex: 1; min-width: 0; }
#cartName { width: 100%; font-weight: 600; }
#slots { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 120px; border: 1px solid var(--line); border-radius: 6px; }
#slots li { display: grid; grid-template-columns: 22px 92px 1fr auto auto auto auto; gap: 4px; align-items: center; padding: 2px 6px; border-bottom: 1px solid var(--line); }
#slots li:last-child { border-bottom: 0; }
#slots li.empty .lbl { color: var(--muted); font-style: italic; }
#slots li.drop { background: var(--drop); }
#slots li .no { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
#slots li input { width: 100%; font-family: var(--font-mono); padding: 1px 4px; }
#slots li .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
#slots li button { border: 0; background: none; padding: 0 3px; color: var(--muted); }
#slots li[draggable=true] { cursor: grab; }
.cart-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dirty::after { content: " •"; color: var(--danger); }

dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); max-width: 720px; width: 90vw; max-height: 80vh; }
dialog table td { white-space: normal; }
dialog > form[method=dialog] { margin-top: 14px; }
#settings { max-width: 760px; }
dialog h2:first-child, dialog .dlg-x + h2 { margin-top: 0; }
/* The close ✕ in every window's corner; headings keep clear of it */
.dlg-x { position: absolute; top: 6px; right: 6px; border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; padding: 4px 6px; flex: none; }
.dlg-x:hover:not(:disabled) { color: var(--text); background: var(--accent-soft); }
dialog > h2:first-of-type, #detailBody > h3:first-child { padding-right: 28px; }
dialog > .dupes-head { padding-right: 48px; }
#settings .midi-config + p { margin: 10px 0 18px; }
body:not(.is-admin) .admin-only, body.is-admin .user-only { display: none !important; }
body.is-guest .member-only, body.is-guest .c-hide { display: none !important; }

/* ratings: bright = yours, faded + number = everyone's average */
.stars.avg span.on { color: var(--star-avg); }
.avgn { font-size: 10px; color: var(--muted); margin-left: 2px; font-variant-numeric: tabular-nums; }
/* a user's own name or category, different from the default */
td.mine input.nn, td.mine select.cat { box-shadow: inset 2px 0 0 var(--accent); }
.mine textarea { box-shadow: inset 2px 0 0 var(--accent); }
.mine-swatch { display: inline-block; width: 3px; height: 11px; background: var(--accent); vertical-align: -1px; }
.rv { border: 0; background: none; padding: 0 3px; color: var(--accent); }
tr.hid td { opacity: .45; }
tr.hid td.c-chk, tr.hid td.c-play { opacity: 1; }
.hide { border: 0; background: none; padding: 0 2px; color: var(--muted); visibility: hidden; }
tr:hover .hide, tr.hid .hide { visibility: visible; }
.c-hide { text-align: center; }
.keys { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.legend .stars { cursor: default; }

/* near-duplicates review */
#dupesDlg { max-width: 1200px; width: 96vw; height: 90vh; max-height: 90vh; padding: 0; }
#dupesDlg[open] { display: flex; flex-direction: column; }
.dupes-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px 6px; }
.dupes-head h2 { margin: 0; }
.dupes-head label { display: flex; gap: 6px; align-items: center; }
.dupes-head .spacer { flex: 1; }
.dupes-help { padding: 0 16px; margin: 0 0 8px; }
.dupes-body { flex: 1; overflow: auto; padding: 0 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dupes-foot { display: flex; gap: 8px; align-items: center; padding: 10px 16px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.dgroup { border: 1px solid var(--line); border-radius: 6px; margin: 12px 0; background: var(--bg); }
.dgroup header { display: flex; gap: 10px; align-items: center; padding: 6px 10px 6px 8px; background: transparent; border-bottom: 1px solid var(--line); }
.dgroup header .dall { margin: 0 6px 0 0; }
.dgroup header .spacer { flex: 1; }
.dgroup table { table-layout: fixed; }
.dgroup table td { white-space: nowrap; padding: 3px 8px; overflow: hidden; text-overflow: ellipsis; }
.dgroup table td:nth-child(-n+2) { padding: 3px 4px; text-overflow: clip; }
.dgroup td.diff { color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.dgroup tr.drop td:not(:first-child):not(:nth-child(2)):not(:nth-child(4)):not(.diff) { opacity: .5; text-decoration: line-through; text-decoration-color: var(--muted); }
.dgroup .kp { color: var(--ok); font-size: 11px; font-weight: 600; }
.dgroup td.nm { font-family: var(--font-mono); white-space: pre; }
.dgroup select.dcat { width: 100%; border-color: transparent; background: transparent; padding: 1px 2px; }
.dgroup select.dcat:hover { border-color: var(--line); }
.dgroup select.dcat.unchecked { font-style: italic; color: var(--muted); }
.dgroup tr.drop select.dcat { text-decoration: line-through; }
table.supp td { padding: 3px 8px; white-space: nowrap; }

/* random sounds */
/* Fits the window: everything keeps its size and only the history list gives way and scrolls */
#randomDlg { max-width: 760px; max-height: calc(100vh - 32px); }
#randomDlg[open] { display: flex; flex-direction: column; }
#randomDlg > * { flex: none; }
#randomDlg > .rnd-history { flex: 1 1 180px; min-height: 72px; }
.rnd-opts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.rnd-opts label { display: flex; gap: 6px; align-items: center; }
.rnd-drum { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rnd-drum[hidden] { display: none; }
.rnd-result { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--bg); }
.rnd-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rnd-line input { font-family: var(--font-mono); width: 12ch; }
.rnd-field { display: flex; gap: 6px; align-items: center; }
.rnd-full { flex: 1; min-width: 200px; }
.rnd-full input { font-family: var(--font-ui); width: auto; flex: 1; min-width: 0; }
#rndInfo { flex-basis: 100%; }
td.name input.on { width: 11.5ch; font-family: var(--font-mono); border: 1px solid transparent; background: transparent; padding: 1px 4px; border-radius: 4px; white-space: pre; }
td.name input.on:hover, td.name input.on:focus { border-color: var(--line); background: var(--input); }
td.mine input.on { box-shadow: inset 2px 0 0 var(--accent); }
.rnd-result p { margin: 6px 0 10px; min-height: 2.7em; }
#rndInfo { min-height: 1.35em; }
.rnd-help { min-height: 4.2em; }          /* room for the longer help text, so switching modes doesn't resize */
#randomDlg .rnd-help p { margin: 4px 0 0; }
#randomDlg .rnd-opts { margin: 6px 0 8px; }
#randomDlg .rnd-result p { margin: 4px 0 6px; }
.rnd-history { margin: 0; padding: 4px 8px 4px 30px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.rnd-history li.none { list-style: none; margin-left: -22px; color: var(--muted); }
.rnd-history li { cursor: pointer; padding: 1px 0; }
.rnd-history li:hover { color: var(--accent); }
.rnd-history li.cur { font-weight: 600; }
.rnd-history .saved { color: var(--ok); }

/* variations */
#varDlg { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
#varDlg[open] { display: flex; flex-direction: column; }
#varDlg > * { flex: none; }
#varDlg > .var-cards { flex: 1 1 auto; min-height: 120px; overflow: auto; }
.var-orig { display: flex; gap: 6px; align-items: center; }
kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; color: var(--muted); }
.var-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-content: start; }
.var-card { border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--bg); display: flex; flex-direction: column; gap: 5px; cursor: pointer; }
.var-card.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.var-card.added { background: var(--accent-soft); }
.var-top { display: flex; gap: 4px; align-items: center; }
.var-card input { min-width: 0; }
.var-card input.vname { font-family: var(--font-mono); width: 12ch; }
.var-card .info { font-size: 12px; min-height: 2.7em; }
.var-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.var-ok { color: var(--ok); }
.var-none { color: var(--muted); grid-column: 1 / -1; }
@media (max-width: 640px) { .var-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#slots li.flash { animation: slotflash 1.2s ease-out; }
@keyframes slotflash { from { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); } }

/* family tree */
#morphDlg { width: min(760px, calc(100vw - 32px)); }
.morph-ends { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.morph-ends label { display: flex; gap: 6px; align-items: center; font-weight: bold; }
.morph-ends select { max-width: 260px; font-weight: normal; }
.morph-ends label + button { margin-left: 2px; }
.morph-ends button.pv + label { margin-left: 14px; }
.morph-slide { display: flex; gap: 8px; align-items: center; margin: 14px 0 6px; }
.morph-slide input { flex: 1; }
.morph-slide output { font-family: var(--font-mono); width: 4.5ch; text-align: right; }
#morphInfo { min-height: 1.4em; margin-bottom: 8px; }
.morph-keep { cursor: default; }
.morph-keep .vfull { flex: 1; }
#famMakeDlg { width: min(620px, calc(100vw - 32px)); }
.fam-parents { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.fam-parents .fp { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--bg); }
.fam-parents { align-items: center; }
.fam-row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.fam-row input[type=range] { flex: 1; min-width: 0; }
.fam-row > .muted:first-child { min-width: 5.5em; text-align: right; }
.fam-row > .muted:last-child { min-width: 3.5em; }
#famDlg { width: 96vw; max-width: 1600px; height: 90vh; max-height: 90vh; }
#famDlg[open] { display: flex; flex-direction: column; }
#famDlg > * { flex: none; }
.fam-tree { flex: 1 1 auto !important; min-height: 200px; overflow: auto; position: relative; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.fam-canvas { position: relative; margin: 12px; }
.fam-canvas > svg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.fam-canvas > svg path { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.fam-canvas > svg path.wed { stroke-width: 1.2; }
.fam-canvas.hl > svg path { opacity: .25; }
.fam-canvas.hl > svg path.on { opacity: 1; stroke: var(--accent); stroke-width: 2; }
.fam-gen { position: absolute; left: 0; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; writing-mode: vertical-rl; transform: rotate(180deg); }
.fam-box { position: absolute; width: 136px; box-sizing: border-box; border: 1px solid var(--line); border-left: 5px solid var(--cat); border-radius: 6px;
  background: var(--panel, var(--bg)); padding: 4px 6px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; font-size: 12px; }
.fam-box.mate { border-style: dashed; border-left-style: solid; }
.fam-box.founder { box-shadow: 0 0 0 1px var(--line); font-weight: 500; }
.fam-box:hover, .fam-box.cur { border-color: var(--accent); border-left-color: var(--cat); }
.fam-box.gone { opacity: .55; }
.fam-canvas.hl .fam-box:not(.rel) { opacity: .35; }
.fam-box .fb-top { display: flex; gap: 5px; align-items: baseline; min-width: 0; }
.fam-box .fb-slot { font-size: 10px; color: var(--muted); min-width: 1.6em; }
.fam-box .fb-name { font-family: var(--font-mono); white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.fam-box .fb-cat { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fam-box .fb-act { display: flex; gap: 3px; align-items: center; }
.fam-box .fb-act button { padding: 0 5px; min-height: 20px; font-size: 11px; }
.fam-box .fb-act .fb-ok { color: var(--ok); font-size: 11px; }
.fam-gb { display: inline-flex; height: 7px; width: 100%; border-radius: 3px; overflow: hidden; background: var(--line); vertical-align: middle; }
.fam-legend .fam-gb { width: 18px; }
.fam-legend .fam-gb i { width: 100%; }
.fam-gb i { display: block; height: 100%; }
.fam-gb .ga { background: var(--accent); }
.fam-gb .gb { background: #d9822b; }
.fam-gb .gs { background: var(--muted); opacity: .6; }
.fam-gb .gn { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 4px); }
.fam-legend { font-size: 12px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.fam-dash { display: inline-block; width: 18px; height: 10px; border: 1px dashed var(--muted); border-radius: 3px; }
.fam-fail { color: var(--muted); font-style: italic; }
#slots li.draft .lbl { font-style: italic; }
#slots li.draft .lbl::before { content: "draft · "; color: var(--accent); font-style: normal; }

/* account, users, sign-in */
.form-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.form-actions .danger { margin-left: auto; }
#accountDlg { max-width: 440px; }
table.users td { padding: 4px 6px; }
table.users input { width: 100%; min-width: 0; }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 140px; }
body.login { align-items: center; justify-content: center; padding: 16px; }
.login-box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 6px; }
.login-box h1 { margin-bottom: 4px; }
.login-row { display: flex; flex-direction: column; gap: 6px; }
.login-row[hidden] { display: none; }
.login-box button { margin-top: 10px; }
.login-err { color: var(--danger); margin: 4px 0 0; }
.midi-config { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; }
.midi-config select { min-width: 0; }
.midi-config > label:has(input) { display: flex; gap: 4px; align-items: center; }
@media (max-width: 560px) { .midi-config { grid-template-columns: 1fr; } }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.toast { background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 6px; max-width: 420px; box-shadow: 0 4px 16px rgba(0,0,0,.2); display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--danger); color: #fff; }
.toast button { background: transparent; color: inherit; border-color: currentColor; }
.dragcount { position: absolute; top: -100px; background: var(--accent); color: var(--on-accent); padding: 4px 10px; border-radius: 12px; font-weight: 600; }

/* sounds like this */
.like, .vary, .edit { border: 0; background: none; padding: 0 3px; color: var(--muted); font-size: 13px; }
.vary, .edit { padding: 0 2px; }
.like:hover, .vary:hover, .edit:hover { color: var(--accent); }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--accent); }
.chip button { border: 0; background: none; padding: 0 4px; color: var(--accent); }
.liketag { font: 11px var(--font-ui); white-space: nowrap; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.liketag.self { color: var(--accent); border-color: var(--accent); }
.liketag.near { color: var(--ok); border-color: var(--ok); }
#detail .form-actions { margin: 10px 0 4px; }

/* files dragged onto the page */
body.filedrop::after { content: "Drop .syx files to import them"; position: fixed; inset: 12px; display: flex; align-items: center; justify-content: center;
  border: 3px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--bg) 85%, transparent); font-size: 20px; z-index: 20; pointer-events: none; }

/* on-screen keyboard */
.kbd { border-top: 1px solid var(--line); padding: 6px 12px 8px; background: var(--panel); }
.kbd-ctl { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; font-size: 12px; }
.kbd-ctl label { display: flex; gap: 4px; align-items: center; }
.kbd-oct { display: inline-flex; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.kbd-oct span { min-width: 6.5ch; text-align: center; }
.kbd-keys { display: flex; height: 64px; user-select: none; touch-action: none; }
.kbd-keys .k { position: relative; cursor: pointer; }
.kbd-keys .w { flex: 1; background: #fbfbf8; border: 1px solid #9a9993; border-left-width: 0; border-radius: 0 0 4px 4px; }
.kbd-keys .w:first-child { border-left-width: 1px; }
.kbd-keys .b { width: 0; z-index: 1; }
.kbd-keys .b::before { content: ""; position: absolute; left: -9px; width: 18px; height: 60%; background: #26251f; border-radius: 0 0 3px 3px; }
.kbd-keys .w.down { background: var(--accent-soft); box-shadow: inset 0 -4px 0 var(--accent); }
.kbd-keys .b.down::before { background: var(--accent); }
.kbd-keys .w span { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: 10px; color: #75746f; pointer-events: none; }
.pv-note { display: flex; gap: 6px; }

/* envelope graph */
.env-ed { margin: 10px 0 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.env-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.env-title { font-weight: 600; }
.env-ops { display: inline-flex; gap: 4px; }
.env-op { padding: 1px 8px; font-family: var(--font-mono); }
.env-op.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.env-hint { font-size: 11px; }
.env-graph { width: 100%; height: auto; display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; touch-action: none; }
.env-graph .g { stroke: var(--line); stroke-width: 1; }
.env-graph .ax { fill: var(--muted); font-size: 9px; font-family: var(--font-ui); }
.env-graph .c { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.env-graph .c.prim { stroke: var(--accent); stroke-width: 2.5; }
.env-graph .c.sel { stroke: var(--accent); opacity: .6; }
.env-graph .c.other { stroke: var(--muted); opacity: .45; stroke-dasharray: 3 3; }
.env-graph .keyoff { stroke: var(--muted); stroke-dasharray: 2 3; }
.env-graph .h { fill: var(--panel); stroke: var(--accent); stroke-width: 2; cursor: grab; vector-effect: non-scaling-stroke; }
.env-graph .h:hover { fill: var(--accent); }
.env-graph .c { pointer-events: none; }
.env-graph .hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.env-graph .hh { fill: transparent; cursor: grab; }
.env-graph .hg:hover .h { fill: var(--c, var(--accent)); }
.env-graph .hl { fill: var(--text); font-size: 9.5px; font-weight: 600; pointer-events: none; }
.env-graph .hv { fill: var(--muted); font-size: 8px; pointer-events: none; }
.env-lab { display: flex; gap: 4px; align-items: center; font-size: 12px; }
.rnd-cat { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rnd-cat[hidden] { display: none; }
.rnd-mix { flex-basis: 100%; }
.rnd-mix input { flex: 1; min-width: 120px; max-width: 260px; }
#rndMixA, #rndMixB { white-space: nowrap; font-size: 12px; }
.env-graph .sus { fill: var(--accent); opacity: .08; }
.env-graph .sus-t { fill: var(--accent); font-size: 10px; font-family: var(--font-ui); opacity: 1; }
.env-graph :is(.sus-t, .ku, .hl, .hv, .mk-t) { paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }

/* view switch and sound map */
.viewsw { display: inline-flex; }
.viewsw button { border-radius: 0; }
.viewsw button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.viewsw button:last-child { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }
.viewsw button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.mapwrap { flex: 1; position: relative; min-height: 0; overflow: hidden; background: var(--bg); }
#mapCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#mapCanvas.panning { cursor: grabbing; }
.map-ctl { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.map-tip { position: absolute; pointer-events: none; z-index: 2; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 2px 7px; font-size: 12px; white-space: nowrap; }
.map-card { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px 6px 10px; box-shadow: 0 2px 10px rgb(0 0 0 / .25); }
.map-acts { display: inline-flex; gap: 4px; align-items: center; }
.map-acts button { display: inline-block; vertical-align: middle; }
.map-x { border: 0; background: none; color: var(--muted); padding: 0 2px; }
.map-sw { width: 10px; height: 10px; border-radius: 50%; background: var(--cat); flex: none; }
.map-status { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); margin: 0; text-align: center; max-width: 80%; }
body.mapview #catList li:not([data-filter="__all__"]) .cl { position: relative; padding-left: 15px; }
body.mapview #catList li:not([data-filter="__all__"]) .cl::before { content: ""; position: absolute; left: 0; top: .35em; width: 9px; height: 9px;
  border-radius: 50%; background: var(--cat); }
body.mapview .list-keys, body:not(.mapview) .map-keys { display: none; }

/* voice editor */
#editDlg { width: min(1280px, calc(100vw - 16px)); max-width: none; max-height: calc(100vh - 16px); padding: 10px 14px 8px; outline: none; }
.ed-top { display: flex; gap: 10px; align-items: center; padding-right: 30px; }
#editDlg .ed-top h2 { margin: 0; white-space: nowrap; }
.ed-vname { font-family: var(--font-mono); font-size: 15px; font-weight: 600; width: calc(11ch + 10px); padding: 2px 6px; }   /* 10 wide characters show in full */
.ed-src { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.ed-sp { flex: 1; }
.ed-seg { display: inline-flex; }
.ed-seg button { border-radius: 0; margin-left: -1px; }
.ed-seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.ed-seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.ed-seg button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); position: relative; }
.ed-tabs { display: flex; gap: 2px; margin: 8px 0 10px; border-bottom: 1px solid var(--line); align-items: flex-end; }
.ed-tabs > button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 5px 16px 4px; font-weight: 600; color: var(--muted); }
.ed-tabs > button.on { color: var(--text); border-bottom-color: var(--accent); }
#edStatus { margin: 0 0 0 auto; flex: 1; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; align-self: center; }
#editDlg h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 4px; font-weight: 600; display: flex; gap: 6px; align-items: baseline; }
.ed-body { display: grid; grid-template-columns: 440px minmax(0, 1fr); gap: 10px; height: 800px; }
.ed-voice { background: var(--well, var(--bg)); border: 1px solid var(--line); border-radius: 9px; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ed-vb { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; min-width: 0; min-height: 0; }
.ed-nav { height: 400px; flex: none; display: flex; flex-direction: column; padding: 6px 5px; }
.ed-nav h3 { padding: 0 4px; }
.ed-vgrp { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; --c: var(--accent); }
.ed-lfogrid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px; align-items: center; margin-top: 2px; }
.ed-sl { display: grid; grid-template-columns: 44px 1fr 48px; gap: 4px; align-items: center; font-size: 12px; margin: 0 0 4px; }
.ed-sl input { width: 100%; margin: 0; accent-color: var(--accent); }
.ed-sl output { font: 600 11.5px var(--font-mono); text-align: right; }
.ed-waves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 4px 0 3px; }
.ed-waves button { padding: 2px 4px; display: flex; justify-content: center; }
.ed-waves svg { width: 26px; height: 14px; }
.ed-waves path { fill: none; stroke: currentColor; stroke-width: 1.6; }
.ed-waves button.on, .ed-tog.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ed-tog { width: 100%; padding: 1px 6px; font-size: 12px; }
#edVoice svg { display: block; user-select: none; touch-action: none; }
#edVoice .ax { font-size: 9.5px; }
#edLfo .lfowave { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
#edLfo .ramp { fill: none; stroke: color-mix(in srgb, var(--star) 65%, var(--text)); stroke-width: 1.4; stroke-dasharray: 4 3; }
.ed-vrow { flex: 1; min-height: 0; display: flex; gap: 8px; }
.ed-trk { width: 104px; flex: none; display: flex; flex-direction: column; align-items: center; }
.ed-trk h3 { align-self: flex-start; }
.ed-trk svg { cursor: ns-resize; margin-top: auto; }
.ed-trv { font: 700 18px var(--font-mono); color: var(--accent); margin-top: 4px; }
#edTrOff { font-size: 12px; margin-bottom: auto; }
.ed-trk .ed-tog { margin-top: 6px; }
.ed-pegbox { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ed-pegbox svg { flex: 1 1 0; min-height: 70px; width: 100%; }        /* the graph gives way to the values under it */
.ed-pegvals { flex: none; display: grid; grid-template-columns: auto repeat(4, 1fr); gap: 2px 6px; align-items: center; font-size: 11px; margin-top: 2px; }
.ed-pegvals b { text-align: center; font-weight: 600; }
.ed-pegvals > span { color: var(--muted); }
.ed-pegvals label { display: flex; flex-direction: column; align-items: center; min-width: 0; line-height: 1.15; }
.ed-pegvals input { width: 3.4em; min-width: 0; }
.ed-pegvals small { color: var(--muted); white-space: nowrap; font-size: 10px; }
#edPeg .pegl { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.ed-algbtn { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; padding: 0 8px; color: var(--text); }
.ed-legend { margin-left: auto; display: flex; gap: 10px; font-size: 11px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.ed-legend i { display: inline-block; width: 16px; height: 11px; vertical-align: -1px; margin-right: 4px; border-radius: 3px; border: 2px solid var(--muted); }
.ed-legend i.m { border-style: dashed; border-width: 1.5px; border-radius: 1px; }
.ed-navwrap { position: relative; width: 412px; height: 348px; margin: auto; }
.ed-corner { position: absolute; right: 0; bottom: 0; width: 140px; height: 52px; display: flex; flex-direction: column; gap: 4px; }
.ed-corner span { display: flex; gap: 2px; align-items: center; }
.ed-corner input, .ed-corner select, .ed-corner button { height: 22px; padding: 1px 4px; font-size: 12px; }
#edFull { width: 100%; }
#edCat { flex: 1; min-width: 0; }
.ed-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
#editDlg svg.alg { display: block; user-select: none; -webkit-user-select: none; }
#editDlg .alg text { font-family: var(--font-ui); }
#editDlg .alg .msb { cursor: pointer; }
#editDlg .alg .msb rect { fill: var(--panel); stroke: var(--muted); stroke-width: 1; }
#editDlg .alg .msb text { fill: var(--muted); font: 700 10.5px var(--font-ui); text-anchor: middle; pointer-events: none; }
#editDlg .alg .msb:hover rect { stroke: var(--text); }
#editDlg .alg .msb.on.m rect { fill: var(--danger); stroke: var(--danger); }
#editDlg .alg .msb.on.s rect { fill: var(--star); stroke: var(--star); }
#editDlg .alg .msb.on text { fill: var(--chip-text, #fff); }
#editDlg .alg .msb.on.s text { fill: #111; }
#editDlg .alg g.muted > :not(.msb) { opacity: .3; filter: grayscale(1); }
#editDlg .alg g.dim > :not(.msb) { opacity: .35; }
#editDlg .alg .wire { stroke: var(--muted); stroke-width: 1.6; fill: none; }
#editDlg .alg .arrow { fill: var(--muted); }
#editDlg .alg .bus { stroke: var(--text); stroke-width: 2; fill: none; opacity: .55; }
#editDlg .alg .outl { fill: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; }
#editDlg .alg .fb { fill: none; stroke: var(--c); stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
#editDlg .alg .fbk { cursor: ns-resize; }
#editDlg .alg .fbk .kn { fill: var(--panel); stroke: var(--c); stroke-width: 2; }
#editDlg .alg .fbk .ka { fill: none; stroke: var(--c); stroke-width: 3.5; stroke-linecap: round; }
#editDlg .alg .fbk .kt { fill: none; stroke: var(--line); stroke-width: 3.5; stroke-linecap: round; }
#editDlg .alg .fbk .kp { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
#editDlg .alg .fbk .kv { fill: var(--c); font: 700 12px var(--font-mono); text-anchor: middle; }
#editDlg .alg g.op { cursor: ns-resize; }
#editDlg .alg .bg { fill: var(--panel); }
#editDlg .alg .lvl { fill: var(--c); opacity: .2; }
#editDlg .alg g.car .lvl { opacity: .32; }
#editDlg .alg g.on .lvl { opacity: .42; }
#editDlg .alg .lvline { stroke: var(--c); stroke-width: 2; }
#editDlg .alg .ol { fill: none; stroke: var(--c); stroke-width: 2.6; }
#editDlg .alg g.mod .ol { stroke-width: 1.6; stroke-dasharray: 5 3; }
#editDlg .alg g.on .ol { stroke-width: 3.4; stroke-dasharray: none; }
#editDlg .alg .glow { fill: none; stroke: var(--c); stroke-width: 7; opacity: .25; }
#editDlg .alg g.op:hover .ol { stroke-width: 3.4; }
#editDlg .alg .opn { fill: var(--text); font-size: 11px; font-weight: 700; }
#editDlg .alg .rat { fill: var(--text); font: 600 10px var(--font-mono); }
#editDlg .alg .lab { fill: var(--text); font: 700 11px var(--font-mono); }
#editDlg .alg .spark { fill: none; stroke: var(--c); stroke-width: 1.6; stroke-linejoin: round; }
#editDlg .alg g.on .spark { stroke: color-mix(in srgb, var(--c) 60%, var(--text)); }   /* stands out on the stronger tint */
#editDlg .alg.mini .opn { font-size: 30px; text-anchor: middle; dominant-baseline: central; }
#editDlg .alg.mini .ol { stroke-width: 4; stroke-dasharray: none; }
#editDlg .alg.mini g.mod .ol { stroke-dasharray: 8 5; stroke-width: 3; }
#editDlg .alg.mini .wire { stroke-width: 3.5; }
#editDlg .alg.mini .bus { stroke-width: 4; }
.ed-picker { position: absolute; inset: 0; background: rgb(0 0 0 / .35); border-radius: 8px; display: flex; align-items: center; justify-content: center; z-index: 5; }
.ed-pbox { width: min(1020px, 100%); max-height: 100%; overflow: auto; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 10px 40px rgb(0 0 0 / .3); }
#edPickX { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); }
.ed-pgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin-top: 8px; }
.ed-pgrid button { padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; height: 128px; }
.ed-pgrid button span { font-weight: 700; }
.ed-pgrid button svg { width: 100%; height: 100px; }
.ed-pgrid button.on { background: var(--accent-soft); border-color: var(--accent); border-width: 2px; }
.ed-cards { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ed-card { border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 7px; padding: 5px 7px 6px; display: flex; flex-direction: column; gap: 4px;
  justify-content: space-between; min-width: 0; overflow: hidden; background: var(--panel); }
.ed-card.on { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); background: color-mix(in srgb, var(--c) 7%, var(--panel)); }
.ed-card.prim { box-shadow: inset 0 0 0 2px var(--c), 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.ed-card.lnk { border-style: dashed; border-top-style: solid; }
.ed-card.mute > :not(.ed-mrow), .ed-card.mute .ed-mrow > :not(.ed-msc) { opacity: .5; }   /* fade, but keep M/S readable */
.ed-chead { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ed-chip { background: var(--c); color: var(--chip-text); font: 700 12px var(--font-mono); padding: 1px 6px; border-radius: 4px; }
.ed-chead .role { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ed-chead .rat { margin-left: auto; font: 700 14px var(--font-mono); color: var(--c); white-space: nowrap; }
.ed-chead .rat small { font-size: 11px; color: var(--muted); }
.ed-cp { display: inline-flex; gap: 2px; }
.ed-cp button { padding: 0 4px; font-size: 11px; line-height: 1.4; }
.ed-cp button.on { background: color-mix(in srgb, var(--c) var(--hl-mix, 30%), var(--btn)); border-color: var(--c); }
#edCards .ml { font-size: 11px; color: var(--muted); white-space: nowrap; }
#edCards .ml b, .ed-mlv b { font: 700 11px var(--font-mono); color: var(--text); }
.ed-mfreq, .ed-mlv, .ed-mrow { display: flex; align-items: center; gap: 6px; }
.ed-mfreq svg, .ed-mlv svg { flex: 1; min-width: 0; cursor: ew-resize; }
.ed-mlv .ml { width: 62px; }
.ed-mlv b { font-size: 12px; width: 20px; text-align: right; }
#edCards .ed-seg button { padding: 0 5px; font-size: 11px; min-width: 18px; line-height: 1.5; }
.ed-mrow .ed-seg { margin-left: auto; }
#edCards .ed-mrow .ed-seg button { padding: 0 2px; min-width: 13px; font-size: 10.5px; }
.ed-msc { display: inline-flex; gap: 2px; margin-left: 4px; }
.ed-msc button { padding: 0 5px; font: 700 11px var(--font-ui); line-height: 1.5; }
.ed-msc button[data-msc=m].on { background: var(--danger); border-color: var(--danger); color: var(--chip-text); }
.ed-msc button[data-msc=s].on { background: var(--star); border-color: var(--star); color: #111; }
.ed-mtrio { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.ed-mtrio > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#edCards svg { display: block; user-select: none; -webkit-user-select: none; touch-action: none; }
#edCards [data-w=vel], #edCards [data-w=kls] { width: 100%; }
#edCards [data-w=vel], #edCards [data-w=dial] { cursor: ns-resize; }
:is(#edCards, #edVoice) .ax { fill: var(--muted); }
:is(#edCards, #edVoice) .g { stroke: var(--line); stroke-width: 1; }
#edCards .tick { stroke: var(--muted); }
#edCards .tick.oct { stroke: var(--text); }
:is(#edCards, #edVoice) .handle { fill: var(--panel); stroke: var(--c); stroke-width: 2.4; cursor: grab; }
:is(#edCards, #edVoice) .handle:hover { fill: var(--c); }
#edCards .cfill { fill: var(--c); opacity: .14; }
#edCards .cline { fill: none; stroke: var(--c); stroke-linejoin: round; }
#edCards .kw { fill: var(--key-w); stroke: var(--muted); stroke-width: .5; }
#edCards .kb { fill: var(--key-b); }
#edCards .keys { pointer-events: none; }
#edCards .side-hit { fill: transparent; cursor: pointer; }
#edCards .side-hit:hover { fill: var(--c); opacity: .05; }
#edCards .base { stroke: var(--muted); stroke-dasharray: 3 3; }
#edCards .bp { stroke: var(--c); }
#edCards .bpgrip { fill: var(--c); cursor: ew-resize; }
#edCards .ktrack { fill: none; stroke: var(--line); stroke-width: 5; stroke-linecap: round; }
#edCards .kval { fill: none; stroke: var(--c); stroke-width: 5; stroke-linecap: round; }
#edCards .kcap { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
#edCards .kptr { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
#edEnv { flex: none; }
:is(#edEnv, #edEnvQ) { margin: 0; border-top: 0; padding-top: 0; }
:is(#edEnv, #edEnvQ) .h { stroke: var(--c); }
:is(#edEnv, #edEnvQ) .env-op { border-left: 4px solid var(--c); }   /* each operator's colour, as in the column heads */
:is(#edEnv, #edEnvQ) .env-op.on { background: color-mix(in srgb, var(--c) var(--hl-mix, 30%), var(--btn)); border-color: var(--c); color: inherit; }
:is(#edEnv, #edEnvQ) .env-graph .c { stroke-width: 1.5; opacity: .55; stroke-dasharray: none; }
:is(#edEnv, #edEnvQ) .env-graph .c.sel { stroke-width: 2; opacity: .9; }
:is(#edEnv, #edEnvQ) .env-graph .c.prim { stroke-width: 3; opacity: 1; }
:is(#edEnv, #edEnvQ) .c.op1 { stroke: var(--op1); } :is(#edEnv, #edEnvQ) .c.op2 { stroke: var(--op2); } :is(#edEnv, #edEnvQ) .c.op3 { stroke: var(--op3); }
:is(#edEnv, #edEnvQ) .c.op4 { stroke: var(--op4); } :is(#edEnv, #edEnvQ) .c.op5 { stroke: var(--op5); } :is(#edEnv, #edEnvQ) .c.op6 { stroke: var(--op6); }
.ed-quick { display: grid; grid-template-columns: 118px minmax(0, 1fr); grid-template-rows: 452px minmax(0, 1fr); gap: 10px; height: 800px; }
.ed-qnav { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; }
.ed-qrow { flex: 1; min-height: 0; display: flex; gap: 12px; align-items: center; }
.ed-qsound { flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; gap: 8px; }
.ed-sv { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--well, var(--bg)); border-radius: 6px; padding: 5px 8px 6px; }
.ed-sv svg { flex: 1; min-height: 0; width: 100%; }
:is(#edScope, #edHarm) .g { stroke: var(--line); stroke-width: 1; }
:is(#edScope, #edHarm) .ax { fill: var(--muted); font-size: 9px; font-family: var(--font-ui); }
:is(#edScope, #edHarm) > text.ax:only-child { font-size: 14px; fill: var(--text); }
.scope-l { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.harm-b { fill: var(--accent); opacity: .85; }
.env-graph .mk-l { stroke: var(--accent); stroke-dasharray: 3 3; opacity: .7; pointer-events: none; }
.env-graph :is(.mk, .mk-t) { fill: var(--accent); pointer-events: none; }
.env-graph .mkh { fill: transparent; cursor: ew-resize; }
.env-graph .mk-t { font-size: 9px; font-family: var(--font-ui); }
.ed-qenv { grid-column: 2; grid-row: 2; }
.ed-knobs { grid-column: 1; display: grid; gap: 8px; min-height: 0; }
#edKnobsTop { grid-row: 1; grid-template-rows: repeat(4, minmax(0, 1fr)); }
#edKnobsSide { grid-row: 2; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.ed-knob { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--well, var(--bg)); }
.ed-knob h4 { margin: 0; font-size: 12.5px; white-space: nowrap; }
.ed-knob svg { width: 70px; height: 70px; cursor: ns-resize; touch-action: none; user-select: none; }
.ed-knob .ends { display: flex; justify-content: space-between; width: 104px; font-size: 10px; color: var(--muted); margin-top: -5px; }
:is(.ed-knob, .ed-trk) .ktrack { fill: none; stroke: var(--line); stroke-width: 10; stroke-linecap: round; }
:is(.ed-knob, .ed-trk) .kval { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; }
:is(.ed-knob, .ed-trk) .kcap { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
:is(.ed-knob, .ed-trk) .kptr { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.ed-knob .knum { fill: var(--text); font: 700 22px var(--font-mono); text-anchor: middle; dominant-baseline: central; }
.ed-chg { margin: 0 0 4px 10px; padding: 1px 10px; font-size: 12px; }
.ed-chgpop { position: absolute; right: 14px; top: 92px; z-index: 6; width: 420px; max-height: 360px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 8px 28px rgb(0 0 0 / .2); padding: 10px 12px; }
.ed-qdiff { margin: 0; padding-left: 18px; font-size: 12px; font-family: var(--font-mono); columns: 2; column-gap: 18px; }
.ed-qdiff li { break-inside: avoid; }
#edConfirm h2 { padding-right: 28px; }
.ed-diff { max-height: 220px; overflow: auto; font-family: var(--font-mono); font-size: 12px; margin: 6px 0 10px; padding-left: 20px; }
/* MIDI Learn */
.ed-tabs > .ed-learn { margin: 0 0 4px 8px; padding: 1px 12px; font-size: 12px; font-weight: 400; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--btn); }
.ed-tabs > .ed-learn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ed-ccmsg { font-size: 12px; align-self: center; margin-left: 8px; white-space: nowrap; }
.ed-knob { position: relative; }
.ed-lt { outline: 2px dashed var(--accent); outline-offset: 2px; cursor: pointer; }
.ed-armed { outline: 3px solid var(--accent); animation: ed-blink .5s infinite alternate; }
@keyframes ed-blink { from { outline-color: var(--accent); } to { outline-color: transparent; } }
.ed-cctag { position: absolute; top: -8px; right: 6px; background: var(--accent); color: var(--on-accent); font: 700 10px var(--font-mono); padding: 0 5px; border-radius: 4px; }
.ed-cctag.arm { background: var(--star); color: #111; font-family: var(--font-ui); font-weight: 600; }
.ed-algwrap { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; text-transform: none; letter-spacing: 0; }
.ed-algwrap .ed-cctag { position: static; }
#editDlg .alg .ed-lrn { fill: transparent; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 3; cursor: pointer; }
#editDlg .alg .ed-lrn.armed { stroke-width: 3.5; stroke-dasharray: none; animation: ed-sblink .5s infinite alternate; }
@keyframes ed-sblink { from { stroke-opacity: 1; } to { stroke-opacity: .1; } }
#editDlg .alg .ed-svtag rect { fill: var(--accent); }
#editDlg .alg .ed-svtag text { fill: var(--on-accent); font: 700 10px var(--font-mono); text-anchor: middle; pointer-events: none; }
#editDlg .alg .ed-svtag.arm rect { fill: var(--star); }
#editDlg .alg .ed-svtag.arm text { fill: #111; font-family: var(--font-ui); }
#editDlg #edNavQ { overflow: visible; }   /* a CC tag above a top-row box or the feedback knob shows */
