/*
 * Anagram Control: styles.
 * Near-black surfaces, teal accent, one colour per block category. Dark by default.
 */

/* ======================= tokens ======================= */
:root {
  --bg: #0b0b0c;
  --bg-raised: #111113;
  --surface: #161618;
  --surface-2: #1c1c1f;
  --surface-3: #232327;
  --line: #26262a;
  --line-strong: #35353a;
  --line-inset: rgba(255, 255, 255, 0.04);

  --text: #f2f1ed;
  --text-2: #b4b3ad;
  --text-3: #8a8984;
  --muted: var(--text-3);

  --accent: #3fd6b4;
  --accent-strong: #62e3c6;
  --accent-ink: #04221b;
  --accent-soft: rgba(63, 214, 180, 0.12);
  --accent-line: rgba(63, 214, 180, 0.35);

  --ok: #4ade80;
  --warn: #f5b544;
  --danger: #f87171;

  --cat-amp: #f59e4b;
  --cat-drive: #f0605f;
  --cat-mod: #a78bfa;
  --cat-time: #5eb8f5;
  --cat-dyn: #3fd6b4;
  --cat-util: #9ca3af;

  --img-bg: #1a1a1d;
  --grid-dot: rgba(255, 255, 255, 0.045);

  --font-display: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 0 var(--line-inset) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --gutter: 20px;
  color-scheme: dark;
}

/* ======================= base ======================= */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 70% -200px, rgba(63, 214, 180, 0.06), transparent 70%),
    radial-gradient(var(--grid-dot) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-2); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -0.01em; }
code { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

/* category colour, from block-images.js catClass() */
.cat-amp { --cc: var(--cat-amp); }
.cat-drive { --cc: var(--cat-drive); }
.cat-dyn { --cc: var(--cat-dyn); }
.cat-mod { --cc: var(--cat-mod); }
.cat-time { --cc: var(--cat-time); }
.cat-util { --cc: var(--cat-util); }

/* ======================= header ======================= */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px var(--gutter);
  background: rgba(11, 11, 12, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 32px; height: 32px; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); flex: none; }
.brandText { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.wordmark { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.wmMuted { color: var(--text-3); }
.wmBright { color: var(--text); }
.product { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.beta {
  font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); border: 1px solid var(--accent-line); border-radius: 4px; padding: 1px 4px;
}
.conn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3);
}
#connState::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, var(--surface-2)); }
#connState.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }

/* ======================= controls ======================= */
.btn {
  font: inherit; font-weight: 500; font-size: 13px; line-height: 1.2;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 7px 12px; min-height: 34px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: #4a4a50; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { color: var(--danger); background: transparent; border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: var(--danger); }
.btn.on { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.btn.small { padding: 3px 9px; min-height: 28px; }
.btnRow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btnRow.end { justify-content: flex-end; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

input[type=search], input[type=number], input:not([type]), select, .nameInput {
  font: inherit; color: var(--text); background: var(--bg-raised);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; min-height: 34px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--text-3); }

.banner { margin: 14px var(--gutter) 0; padding: 10px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--text-2); }
.banner.info { background: var(--surface); border-color: var(--accent-line); color: var(--text); }

/* ======================= layout ======================= */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; padding: 18px var(--gutter); max-width: 1680px; margin: 0 auto; }
.card, .side, .chain, .params, details {
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 70%, var(--bg)));
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}

/* presets sidebar */
.side { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 92px); position: sticky; top: 74px; align-self: start; }
.sideHead { display: flex; justify-content: space-between; align-items: center; }
.sideHead h3 { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono); }
.slotList { overflow: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.slot { display: flex; gap: 10px; align-items: center; text-align: left; font: inherit; color: var(--text); background: none; border: 0; border-radius: 7px; padding: 6px 8px; cursor: pointer; position: relative; }
.slot:hover:not(:disabled) { background: var(--surface-2); }
.slot.active { background: var(--accent-soft); color: var(--text); }
.slot.active::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--accent); }
.slot.active .slotNum { color: var(--accent); }
.slot.empty { color: var(--text-3); cursor: default; opacity: 0.45; }
.slotNum { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); width: 34px; flex: none; }
.slotName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* editor column */
.editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.presetBar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; }
.presetTitle { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; min-width: 0; }
.presetTitle .eyebrow { color: var(--accent); }
input.nameInput {
  font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
  background: transparent; border-color: transparent; padding: 2px 6px; margin-left: -7px; min-height: 0;
  width: min(480px, 86vw);
}
input.nameInput:hover { border-color: var(--line); }
input.nameInput:focus { background: var(--bg-raised); }
.live {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; min-height: 34px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); font-weight: 500; font-size: 13px; cursor: pointer;
}
.live input { accent-color: var(--accent); margin: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px color-mix(in srgb, var(--ok) 70%, transparent); }
.dot.busy { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: pulse 0.8s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: 0.35; } }

/* scenes */
.sceneBar { display: flex; gap: 10px 24px; flex-wrap: wrap; align-items: center; }
.sceneGroup { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.sceneTab, .segBtn {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text-3); background: none; border: 0;
  border-radius: 7px; padding: 6px 13px; min-height: 30px; cursor: pointer; transition: color 0.15s, background 0.15s;
}
.sceneTab b { font-family: var(--font-mono); font-weight: 500; }
.sceneTab:hover, .segBtn:hover { color: var(--text); }
.sceneTab.active, .segBtn.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 2px rgba(0,0,0,.4); }
.sceneTab.active b { color: var(--accent); }

/* ======================= signal chain ======================= */
.chain { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; overflow-x: auto; scrollbar-width: thin; }
.lane { display: flex; align-items: stretch; gap: 12px; position: relative; }
.laneLabel {
  width: 62px; flex: none; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  font-size: 12px; color: var(--text-2);
}
.laneLabel b { font-weight: 600; }
.laneLabel span { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.cells { display: grid; grid-template-columns: repeat(12, minmax(64px, 1fr)); gap: 7px; flex: 1 0 0; min-width: calc(12 * 64px + 11 * 7px); position: relative; }
/* the signal wire running behind the slots */
.cells::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: linear-gradient(90deg, var(--line-strong), var(--line) 80%, transparent); z-index: 0; }

.cell {
  position: relative; z-index: 1; height: 112px; min-width: 0; padding: 6px 6px 7px;
  border-radius: 11px; font: inherit; cursor: pointer; text-align: center;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
}
.emptyCell { border: 1px dashed var(--line-strong); background: var(--bg); color: var(--text-3); justify-content: center; }
.emptyCell .plus {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; line-height: 1;
  border: 1px solid var(--line-strong); background: var(--surface); transition: inherit;
}
.emptyCell:hover { color: var(--accent); border-color: var(--accent-line); }
.emptyCell:hover .plus { border-color: var(--accent-line); background: var(--accent-soft); }

.block {
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc, var(--cat-util)) 10%, var(--surface-2)), var(--surface-2) 70%);
  border-color: color-mix(in srgb, var(--cc, var(--cat-util)) 28%, var(--line));
}
.block::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--cc, var(--cat-util)); opacity: 0.8; }
.block:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--cc) 55%, var(--line)); box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--cc) 60%, transparent); }
.block .art { width: 100%; flex: 1; min-height: 0; }
.block .bname { font-size: 11px; font-weight: 500; line-height: 1.15; color: var(--text-2); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block .led { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 7px var(--ok); z-index: 2; }
.block.off { filter: saturate(0.15); opacity: 0.55; }
.block.off .led { background: #3a3a3f; box-shadow: none; }
.cell.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 22px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.cell.sel .bname { color: var(--text); }
.sceneBadge {
  position: absolute; top: 5px; left: 6px; z-index: 2;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600; line-height: 1;
  color: var(--accent-ink); background: var(--accent); border-radius: 4px; padding: 2px 4px;
}

/* ======================= block artwork (block-images.js) ======================= */
.art {
  position: relative; display: grid; place-items: center; overflow: hidden;
  border-radius: 8px; color: var(--cc, var(--cat-util));
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--cc, var(--cat-util)) 18%, var(--img-bg)), var(--img-bg) 75%);
}
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5)); }
.art.hasImg { background: radial-gradient(circle at 50% 40%, #26262b, var(--img-bg) 70%); }
.art:not(.hasImg) { display: flex; flex-direction: column; justify-content: center; gap: 4px; border: 1px solid color-mix(in srgb, var(--cc, var(--cat-util)) 25%, transparent); }
.art .catIcon { width: 40%; max-width: 30px; height: auto; opacity: 0.9; }
.artAbbr { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.04em; color: var(--text); line-height: 1; max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art.md { width: 52px; height: 52px; flex: none; }
.art.md .artAbbr { font-size: 9.5px; }
.art.lg { width: 84px; height: 84px; flex: none; border-radius: 12px; }
.art.lg .catIcon { max-width: 34px; }
.art.lg .artAbbr { font-size: 13px; }

/* ======================= block parameters ======================= */
.params { padding: 18px; min-height: 180px; }
.params > p.muted { margin: 30px 0; text-align: center; }
.paramHead {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line);
}
.paramId { display: flex; align-items: center; gap: 14px; min-width: 0; }
.paramHead.off .art { filter: saturate(0.15); opacity: 0.6; }
.paramTitle { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.paramTitle h2 { font-size: 24px; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.catChip {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; color: var(--cc); padding: 2px 8px 2px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--cc) 12%, transparent); border: 1px solid color-mix(in srgb, var(--cc) 30%, transparent);
}
.catChip .catIcon { width: 13px; height: 13px; }

.paramGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.param {
  display: flex; flex-direction: column; gap: 8px; padding: 11px 12px 10px;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color 0.15s;
}
.param:hover { border-color: var(--line-strong); }
.param.scened { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.paramTop { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 500; }
.paramTop output { color: var(--accent); font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.param select { width: 100%; }
.btn.toggle { align-self: flex-start; min-width: 64px; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer; accent-color: var(--accent); }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent-line), var(--surface-3)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-3); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--text); border: 3px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.6); transition: transform 0.1s; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 3px solid var(--accent); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.2); }
input[type=range]:focus { box-shadow: none; }

.param.scened .paramTop span:first-child::after { content: ' ·S'; color: var(--accent); font-weight: 700; }
.sceneVals { display: flex; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); flex-wrap: wrap; }
.sceneVals:empty { display: none; }
.sceneVals .cur { color: var(--accent); }
.btn.scened { box-shadow: inset 0 -2px 0 var(--accent); }

.props { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.prop { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px; }
.quickpot { display: flex; gap: 10px; align-items: center; margin-top: 16px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }

/* ======================= panels ======================= */
details { padding: 12px 16px; }
summary { cursor: pointer; color: var(--text-2); font-weight: 500; list-style: none; display: flex; align-items: center; gap: 8px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: '›'; font-size: 16px; line-height: 1; color: var(--text-3); transition: transform 0.15s; }
details[open] summary::before { transform: rotate(90deg); }
details[open] summary { margin-bottom: 12px; }
summary:hover { color: var(--text); }
#midiSlot { width: 76px; }
.log { font-family: var(--font-mono); font-size: 11px; max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.log:empty { display: none; }
.logLine { word-break: break-all; }
.logLine.out b { color: var(--accent); }
.logLine.in b { color: var(--ok); }
.probe input { min-width: 200px; }
#logActions { margin: 8px 0; }

/* ======================= dialogs ======================= */
dialog {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 16px;
  padding: 0; width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
dialog[open] { animation: dlgIn 0.18s var(--ease); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
dialog::backdrop { background: rgba(5, 5, 6, 0.72); backdrop-filter: blur(3px); }
.dlgHead { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dlgHead input { flex: 1; min-width: 0; }
.pickerBody { padding: 4px 16px 20px; max-height: min(70vh, 720px); overflow: auto; }
.pickerBody h3 {
  display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--cc); margin: 18px 0 10px;
}
.pickerBody h3 .catIcon { width: 15px; height: 15px; }
.pickerBody h3 .count { color: var(--text-3); margin-left: 2px; }
.pickGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.pick {
  font: inherit; text-align: left; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 11px; padding: 7px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; min-width: 0;
  transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease);
}
.pick:hover { border-color: color-mix(in srgb, var(--cc) 55%, var(--line)); background: var(--surface-3); transform: translateY(-1px); }
.pickText { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pickText strong { font-weight: 500; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.pickText .small { font-family: var(--font-mono); font-size: 10.5px; }
.saveForm { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.saveForm h3 { font-size: 18px; }
.saveForm p { margin: 0; }
.saveForm select { width: 100%; font-family: var(--font-mono); font-size: 12.5px; }
#saveDialog { width: min(480px, calc(100vw - 24px)); }

/* ======================= toasts, footer ======================= */
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: calc(100vw - 32px); }
.toast {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-left: 3px solid var(--text-3);
  border-radius: 10px; padding: 10px 14px; max-width: 380px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.7);
  animation: dlgIn 0.2s var(--ease);
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--accent); }
.foot { padding: 4px var(--gutter) 28px; max-width: 1680px; margin: 0 auto; }

/* ======================= responsive ======================= */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: 280px; }
}
@media (max-width: 640px) {
  :root { --gutter: 12px; }
  body { font-size: 14px; }
  .top { position: static; padding-top: 8px; padding-bottom: 8px; }
  .conn { width: 100%; }
  .conn .btn { flex: 1; }
  #fw { display: none; }
  .layout { padding-top: 12px; gap: 12px; }
  input.nameInput { font-size: 24px; width: 100%; }
  .presetTitle { width: 100%; }
  .presetBar .btnRow { width: 100%; }
  .presetBar .btnRow .btn { flex: 1 1 auto; }
  .live { flex: 1 1 100%; justify-content: flex-start; }
  .sceneBar { flex-direction: column; align-items: stretch; gap: 8px; }
  .sceneGroup { justify-content: space-between; }
  .chain { padding: 12px; margin: 0 calc(-1 * var(--gutter)); border-radius: 0; border-left: 0; border-right: 0; }
  .laneLabel { width: 44px; }
  .cells { grid-template-columns: repeat(12, 72px); gap: 6px; min-width: calc(12 * 72px + 11 * 6px); }
  .cell { height: 100px; }
  .params { padding: 14px; }
  .paramHead { flex-direction: column; align-items: stretch; }
  .paramHead .btnRow .btn { flex: 1 1 auto; }
  .art.lg { width: 64px; height: 64px; }
  .paramTitle h2 { font-size: 20px; }
  .paramGrid { grid-template-columns: 1fr; }
  .pickGrid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .pick { flex-direction: column; align-items: stretch; text-align: center; }
  .pick .art.md { width: 100%; height: 72px; }
  .pickText { align-items: center; }
  .pickText strong { white-space: normal; }
  .probe input { min-width: 0; flex: 1 1 100%; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ======================= about / SEO copy ======================= */
.about { max-width: 1680px; margin: 8px auto 0; padding: 24px var(--gutter) 8px; border-top: 1px solid var(--line); color: var(--muted); }
.about h1 { font-family: "Inter Tight", Inter, sans-serif; font-size: 22px; line-height: 1.25; color: var(--text); margin: 0 0 10px; }
.about h2 { font-size: 15px; color: var(--text); margin: 18px 0 8px; }
.about h3 { font-size: 13px; color: var(--text); margin: 14px 0 4px; }
.about p, .about li { font-size: 14px; line-height: 1.6; max-width: 70ch; }
.about ul, .about ol { padding-left: 20px; margin: 0; }
.aboutGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 40px; }
