:root {
  --bg: #141414;
  --panel: #1e1e1e;
  --panel2: #262626;
  --line: #333;
  --text: #e8e8e8;
  --muted: #8a8a8a;
  --accent: #f5a623;
  --accent-dim: #8a5d12;
  --blue: #2ea8ff;
  --red: #e5484d;
  --green: #3fb950;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); height: 100vh; display: flex; flex-direction: column; }
code { color: var(--accent); font-size: 12px; }
.muted { color: var(--muted); }
button, select, input { font: inherit; color: var(--text); }
button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; 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: #111; font-weight: 600; }
button.danger { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
select, input[type=search] { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; }

.topbar {
  display: flex; align-items: center; gap: 32px; padding: 10px 18px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 300; letter-spacing: 4px; color: var(--accent); font-size: 18px; white-space: nowrap; }
.brand small { color: var(--muted); letter-spacing: 1px; font-size: 11px; }
.tabs { display: flex; gap: 6px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; font-size: 17px; padding: 6px 10px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.conn { margin-left: auto; display: flex; gap: 8px; align-items: center; position: relative; }
.conn #portToggle.on { border-color: var(--accent); color: var(--accent); }
/* gear menu under the ⚙ button: wide enough for full MIDI port names */
.gear-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(440px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #2b2b2b; border: 1px solid #444;
  border-radius: 6px; box-shadow: 0 6px 24px rgba(0, 0, 0, .55); }
.gear-panel[hidden] { display: none; }
.gear-panel label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.gear-panel select { width: 100%; padding: 7px 8px; font-size: 14px; }
.gear-panel p { margin: 0; }
.gear-panel hr { width: 100%; border: 0; border-top: 1px solid #444; margin: 2px 0; }
.gear-panel .gear-tool { text-align: left; }
.conn #portToggle { align-self: stretch; min-width: 34px; padding: 0 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; }
.status { font-size: 12px; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.status.off { background: #3a1d1d; color: #f08080; }
.status.busy { background: #3a311b; color: var(--accent); }
.status.on { background: #1b3a22; color: #7ee787; }

.layout { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 270px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px; gap: 8px; }
.side-head { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.small { font-size: 11px; }
.small-btn { padding: 2px 7px; font-size: 12px; font-weight: 400; }
.current-box { background: var(--panel2); border-radius: 4px; padding: 8px 10px; }
.current-box .cur-lbl { color: var(--accent); font-variant-numeric: tabular-nums; }
.current-box #curName { font-size: 15px; }
td.warn { color: var(--accent); }
.side-head .muted { font-weight: 400; font-size: 12px; }
.preset-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.preset-list li { display: flex; gap: 8px; padding: 5px 6px; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.preset-list li:hover { background: var(--panel2); }
.preset-list li.current { color: var(--accent); }
.preset-list li .lbl { color: var(--muted); width: 44px; flex: none; font-variant-numeric: tabular-nums; }
.preset-list li.current .lbl { color: var(--accent); }
.preset-list li .nm { overflow: hidden; text-overflow: ellipsis; }
.hint { font-size: 11px; margin: 0; }

.content { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; }
/* cards in a scrolling page never shrink: a shrunk card cut off the 2-column module legend (its min height is underestimated) */
.content > .card { flex-shrink: 0; }
.row h2 { margin: 0 !important; }
.card h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; }
.card p { margin: 0 0 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.spacer { flex: 1; }
.progress { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin: 6px 0; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .1s; }
.file { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; cursor: pointer; }
.file:hover { border-color: var(--accent); }
.file input { display: none; }
.notice { border-left: 3px solid var(--accent); background: #2a2416; padding: 8px 12px; margin-bottom: 10px; }

.table-wrap { max-height: 420px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 400; position: sticky; top: 0; background: var(--panel); }
th, td { padding: 4px 8px; border-bottom: 1px solid var(--line); }
td.ok { color: var(--green); }
td.err { color: var(--red); }
tr.diff td:nth-child(4) { color: var(--accent); }

/* log panel at the bottom of every page */
.log-panel { background: var(--panel); border-top: 1px solid var(--line); padding: 4px 12px; }
.log-head { display: flex; gap: 10px; align-items: center; }
.log-head #logLast { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70vw; }
#log { margin: 4px 0; height: 180px; overflow-y: auto; font-size: 12px; color: #bbb; white-space: pre-wrap; }
.log-panel.collapsed #log { display: none; }

.group-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-left: 6px; }
.segmented { display: inline-flex; }
.segmented button { border-radius: 0; }
.segmented button:first-child { border-radius: 4px 0 0 4px; }
.segmented button:last-child { border-radius: 0 4px 4px 0; border-left: none; }
.segmented button.on { background: var(--accent-dim); border-color: var(--accent); color: #fff; }

.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; z-index: 10; }
.dialog { background: var(--panel); border: 1px solid var(--accent-dim); border-radius: 8px; padding: 18px 20px; width: min(640px, 92vw); max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.dialog h3 { margin: 0 0 6px; color: var(--accent); font-size: 16px; }
.dialog p { margin: 0 0 12px; color: var(--muted); }
.dlg-table { overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; }
.dlg-table th { background: var(--panel2); }
.dlg-table td.old { color: var(--muted); }
.dlg-table td.arrow { color: var(--accent); width: 20px; text-align: center; }
.dlg-table td.new { color: var(--text); font-weight: 600; }
.dlg-table tr.same td.new { font-weight: 400; }
.dlg-buttons { margin: 14px 0 0; }
.warn-banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin: 0; border-radius: 0; }

.model { color: var(--text); font-weight: 600; white-space: nowrap; }
.layout.no-sidebar .sidebar { display: none; }

/* preset list: All / Style */
.list-tabs { display: flex; border-bottom: 1px solid var(--line); }
.list-tabs button { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 6px; color: var(--muted); font-size: 15px; }
.list-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.side-head input[type=search] { flex: 1; min-width: 0; }
.preset-list li .menu-btn { margin-left: auto; color: var(--muted); padding: 0 4px; visibility: hidden; cursor: pointer; }
.preset-list li:hover .menu-btn, .preset-list li.menu-open .menu-btn { visibility: visible; }
.preset-list li.menu-open { background: var(--panel2); }
.preset-list li.style-group { padding: 9px 6px; border-bottom: 1px solid var(--line); border-radius: 0; cursor: pointer; font-size: 15px; }
.preset-list li.style-group .count { color: var(--muted); width: 22px; flex: none; text-align: center; }
.preset-list li.style-group .chev { margin-left: auto; color: var(--muted); }
.preset-list li.style-group.unknown { color: var(--muted); font-style: italic; }
.preset-list li.in-group { padding-left: 18px; background: #222; }
.style-info { background: var(--panel2); border-radius: 4px; padding: 6px 8px; line-height: 1.5; }
.style-info button { margin-top: 4px; }

/* context menu */
.ctx-menu { position: fixed; z-index: 20; list-style: none; margin: 0; padding: 4px 0; min-width: 170px; background: #2b2b2b; border: 1px solid #444; border-radius: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, .55); }
.ctx-menu li { position: relative; padding: 7px 28px 7px 16px; cursor: pointer; white-space: nowrap; }
.ctx-menu li:hover:not(.disabled):not(.sep) { background: #3a3a3a; }
.ctx-menu li.disabled { color: #666; cursor: default; }
.ctx-menu li.danger:not(.disabled) { color: var(--red); }
.ctx-menu li.danger:hover:not(.disabled) { background: var(--red); color: #fff; }
.ctx-menu li.sep { padding: 0; margin: 4px 0; border-top: 1px solid #444; cursor: default; }
.ctx-menu li.sub::after { content: '▸'; position: absolute; right: 10px; color: var(--muted); }
.ctx-menu li.checked::before { content: '✓'; position: absolute; left: 4px; color: var(--accent); }
.ctx-menu li > .ctx-menu { display: none; position: absolute; left: 100%; top: -5px; }
.ctx-menu li > .ctx-menu.left { left: auto; right: 100%; }
.ctx-menu li.sub:hover > .ctx-menu { display: block; }

/* dialogs */
.small-dialog { width: min(420px, 92vw); }
.dialog input[type=text] { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; font-size: 15px; }
.prompt-error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 4px; }

/* mockups */
.mockup-note { border: 1px dashed var(--accent-dim); color: var(--accent); background: #221c10; border-radius: 6px; padding: 8px 12px; font-size: 13px; }
.editor-head { display: flex; align-items: center; gap: 20px; }
.preset-title { display: flex; align-items: baseline; gap: 10px; font-size: 18px; }
.preset-title .cur-lbl { color: var(--accent); font-size: 15px; }
.style-tag { font-size: 11px; border: 1px solid var(--accent-dim); color: var(--accent); border-radius: 10px; padding: 1px 8px; }
.mock-meters { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.scene-vals { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.scene-vals label { display: flex; align-items: center; gap: 6px; }
.scene-vals input[type=number] { width: 64px; }
.scene-vals .vol-val { min-width: 28px; color: #ddd; font-variant-numeric: tabular-nums; }
.files-wrap td .small-btn + .small-btn { margin-left: 4px; }
.meter { width: 110px; height: 10px; border: 1px solid var(--accent); border-radius: 2px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }
.editor-chain { display: flex; gap: 18px; }
.scenes { display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); padding-right: 16px; }
.scene { background: none; text-align: left; min-width: 110px; }
.scene.on { color: var(--accent); border-color: var(--accent-dim); }
.chain-wrap { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.chain-mode { min-height: 15px; }
.chain { display: grid; grid-template-columns: 48px 1fr 48px; grid-template-rows: auto auto; row-gap: 26px; align-items: center; padding: 8px 0; }
.chain #chainLeft { grid-column: 1; grid-row: 1 / 3; }
.chain #chainRowA { grid-column: 2; grid-row: 1; }
.chain #chainRowB { grid-column: 2; grid-row: 2; }
.chain #chainRight { grid-column: 3; grid-row: 1 / 3; }
.chain-side { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-around; align-items: center; }
.chain-row { display: flex; align-items: center; min-height: 66px; }
.chain-link { flex: 1; height: 2px; background: #6b5a35; min-width: 8px; }
.io { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; z-index: 1; color: #e8e8e8; }
.io.out { color: #e8e8e8; } /* like the Hotone editor: all nodes white, the selected one orange */
.io.sel { color: var(--accent); }
.io svg { width: 40px; height: 40px; overflow: visible; }
.io svg polygon { fill: #000; stroke: currentColor; stroke-width: 2; }
.io svg path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.io svg text { fill: currentColor; font-weight: 700; font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.io-gap { height: 38px; }
.io.shared { position: absolute; top: 50%; transform: translateY(-50%); }
/* shared split / mix node: a bracket joining both rows */
.bracket { position: absolute; top: 33px; bottom: 33px; width: 24px; border: 2px solid #6b5a35; }
.bracket.split { right: 0; border-right: none; border-radius: 10px 0 0 10px; }
.bracket.mix { left: 0; border-left: none; border-radius: 0 10px 10px 0; }
.node { width: 12px; height: 12px; flex: none; border: 2px solid var(--accent); border-radius: 50%; }
.turn { width: 18px; flex: none; color: #6b5a35; font-size: 18px; }
.fx { position: relative; width: 62px; height: 62px; flex: none; border: 2px solid #555; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #ddd; background: #161616; }
.fx .fx-label { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--panel); padding: 0 4px; font-size: 12px; font-weight: 700; color: #eee; white-space: nowrap; }
.fx .fx-icon { font-size: 13px; font-weight: 600; opacity: .8; }
.fx .fx-name { position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); }
.fx.off .fx-name { color: #666; }
.fx.empty { border-color: #444; color: #777; font-size: 26px; font-weight: 300; background: none; }
.fx.off { border-color: #555 !important; color: #666; }
.fx.off .fx-label { color: #777; }
.fx.m-DYN { border-color: #2ea8ff; }
.fx.m-EQ { border-color: #3fd6e8; }
.fx.m-FREQ { border-color: #6495ed; }
.fx.m-WAH { border-color: #a07cff; }
.fx.m-DRV { border-color: #ff4d6d; }
.fx.m-AMP { border-color: #4d8dff; }
.fx.m-PRE-AMP { border-color: #8ad94a; }
.fx.m-CAB { border-color: #f5a623; }
.fx.m-IR { border-color: #e8e8e8; }
.fx.m-NAM, .fx.m-CLONE { border-color: #b0b0b0; }
.fx.m-MOD { border-color: #3fb950; }
.fx.m-DLY { border-color: #ff4fa0; }
.fx.m-RVB { border-color: #f5d423; }
.fx.m-VOL { border-color: #c86bff; }
.fx.m-FX-LOOP, .fx.m-FX-SND, .fx.m-FX-RTN { border-color: #ff8c2a; }
.fx.m-Split-Mixer { border-color: #9aa0a6; }
.editor-params { display: flex; gap: 24px; min-height: 220px; }
.mock-modules ul { list-style: none; margin: 6px 0 0; padding: 0; columns: 2; color: #999; }
.ed-left { width: 250px; flex: none; display: flex; flex-direction: column; gap: 12px; }
.ed-left .modules { padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: #181818; }
.fs-box + .fs-box { border-top: 1px solid #262626; padding-top: 8px; }
.modules .hint { font-size: 11px; }
.modules li { cursor: pointer; border-radius: 3px; padding-left: 3px; }
.modules li:hover { color: #fff; background: #2a2a2a; }
.modules li.active { color: var(--accent); background: #2a2416; }
.params-body { display: flex; gap: 22px; align-items: flex-start; }
.params-body .param-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 10px 14px 14px; border: 1px solid var(--line); border-radius: 4px; background: #181818; }
.browser { display: flex; gap: 10px; align-items: flex-start; flex: none; }
/* the lists end where the module legend on the left ends (--legend-h, measured in app.js) */
.b-list { list-style: none; margin: 0; padding: 4px; min-width: 120px; max-height: var(--legend-h, 300px); overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; background: #181818; }
.b-list li { padding: 4px 9px; cursor: pointer; border-radius: 3px; white-space: nowrap; }
.b-list li:hover { background: #2a2a2a; }
.b-list li.on { background: var(--accent-dim); color: #fff; }
.b-list.algs { min-width: 190px; max-width: 260px; }
.b-list li { overflow: hidden; text-overflow: ellipsis; }
.b-list .sub { color: var(--muted); font-size: 11px; margin-left: 6px; }
.mock-modules li { padding: 3px 0; }
.mock-knobs { flex: 1; display: flex; gap: 30px; align-items: center; justify-content: center; }
/* parameter editor */
.params { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.params-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.params-head .p-title { font-size: 16px; color: #eee; }
.params-head .p-save { margin-left: auto; }
.params-empty { margin: auto; color: var(--muted); }
.params-grid { display: flex; flex-wrap: wrap; gap: 18px 22px; }
.pk { width: 84px; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--blue); text-align: center; }
.pk .dial { position: relative; width: 52px; height: 52px; border-radius: 50%; border: 3px solid #333; background: radial-gradient(circle at 40% 35%, #444, #1a1a1a); cursor: ns-resize; touch-action: none; outline: none; }
.pk .dial:focus-visible { border-color: var(--accent); }
.pk .dial::after { content: ''; position: absolute; left: 50%; top: 3px; width: 3px; height: 15px; margin-left: -1.5px; border-radius: 2px; background: var(--accent); transform-origin: 50% 20px; transform: rotate(var(--a, -135deg)); }
.pk .val { color: #ddd; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pk select { max-width: 84px; }
.pk .sw { min-width: 52px; }
.pk .sw.on { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.pk.disabled { opacity: .5; pointer-events: none; }
.fx.sel { box-shadow: 0 0 0 2px var(--accent); }
.fx.drop { box-shadow: 0 0 0 2px #fff; }
.fx.empty { cursor: pointer; }
.fx .fx-state { cursor: pointer; }
.block-ctl { display: inline-flex; gap: 6px; align-items: center; margin-left: 12px; }
.block-ctl select { max-width: 220px; }
.block-ctl .small-btn[hidden] { display: none; }
.block-ctl .sw.on { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.fx:not(.empty) { cursor: pointer; }
.dirty-tag { color: var(--accent); font-size: 12px; }
.scene.xs { border-style: dashed; }
.xs-note { color: var(--accent); font-size: 12px; }
#edSave { padding: 3px 14px; font-size: 13px; }
/* themed range sliders */
input[type=range] { -webkit-appearance: none; appearance: none; height: 18px; background: transparent; accent-color: var(--accent); cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent)) 0 / var(--fill, 50%) 100% no-repeat, #3a3a3a; }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: #3a3a3a; }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4px; border-radius: 50%; background: #111; border: 2px solid var(--accent); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #111; border: 2px solid var(--accent); }
input[type=range]:disabled { opacity: .45; cursor: default; }
/* block extras: position, footswitches */
.fx .fx-pos { position: absolute; top: 2px; left: 3px; font-size: 9px; color: #888; font-weight: 600; }
.fx .fx-fs { position: absolute; bottom: 2px; left: 3px; display: flex; gap: 2px; }
.fx .fx-fs span { font-size: 8px; font-weight: 700; line-height: 1; padding: 1px 2px; border-radius: 2px; background: var(--accent-dim); color: #fff; }
.fx .fx-fs span.cur { background: #fff; color: #000; font-size: 9px; padding: 1px 3px; }
.style-sel { font-size: 12px; }
/* footswitches of the preset */
.editor-fs { display: flex; flex-direction: row; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.editor-fs .fs-left { width: 240px; flex: none; }
/* every section of the card: same heading, separated by a line */
.editor-fs > * + * { border-left: 1px solid var(--line); padding-left: 16px; }
.sec-h { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; line-height: 22px; }
.exp-head .sec-h { margin: 0 6px 0 0; }
.editor-fs .midi-box.patch > summary { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; line-height: 22px; margin: 0 0 6px; }
.fs-sum { display: flex; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; }
.fs-sum-it { display: inline-flex; align-items: center; gap: 3px; }
.mi.fs-ic { display: inline-flex; width: 15px; height: 15px; flex: none; }
.mi.fs-ic svg { width: 100%; height: 100%; }
.fs-grid .fs-empty { color: var(--muted); }
.qk-cell.off .qk-icon { color: #3d6f99; }
.qk-icon.qk-jump { cursor: pointer; border-radius: 4px; }
.qk-icon.qk-jump:hover { background: #12263a; }
.pk.qk-focus { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; transition: outline-color .4s; }
.editor-fs .fs-box { flex: 1 1 360px; max-width: 560px; }
.editor-fs .qk-box { flex: 1 1 300px; max-width: 460px; display: flex; flex-direction: column; gap: 6px; }
.editor-fs .exp-box { flex: 1 1 340px; max-width: 520px; display: flex; flex-direction: column; gap: 8px; }
.exp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.exp-head .small-btn.on { border-color: var(--accent); color: var(--accent); }
.exp-row { display: flex; flex-direction: column; gap: 4px; }
.exp-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-left: 56px; }
.exp-range input[type=number] { width: 64px; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 4px; }
/* quick knobs like on the pedal: display strip (value, bar, blue label), three small black knobs below */
.qk-pedal { display: flex; flex-direction: column; }
.qk-screen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 10px 12px 8px;
  background: #05080c; border-radius: 8px; border: 1px solid var(--line); }
.qk-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 2px 0;
  background: none; border: 1px solid transparent; border-radius: 4px; }
.qk-cell.disabled { cursor: default; }
.qk-cell:hover:not(.disabled) { border-color: #24425f; }
.qk-cell .qk-icon { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; }
.qk-cell .qk-icon svg { width: 100%; height: 100%; }
.qk-cell .qk-icon:not([class*=" m-"]) { color: #4db3ff; }
.qk-cell .qk-name { color: #d8dde3; font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qk-cell .qk-label { color: #4db3ff; font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qk-cell .qk-val { color: #e3e6b4; font-size: 12px; font-variant-numeric: tabular-nums; }
.qk-cell.off .qk-name { color: #3d6f99; }
.qk-plate { display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center; padding: 10px 12px 2px; }
.qk-knob { display: block; width: 38px; height: 38px; border-radius: 50%; cursor: ns-resize; touch-action: none; outline: none; }
.qk-knob.off, .qk-knob.disabled { cursor: default; opacity: .5; }
.qk-knob:focus-visible .qk-cap { box-shadow: 0 0 0 2px var(--accent); }
.qk-knob .qk-cap { display: block; width: 100%; height: 100%; border-radius: 50%; border: 1px solid #3a3a3a;
  background: radial-gradient(circle at 42% 38%, #3a3a3a 0, #141414 55%, transparent 56%),
    repeating-conic-gradient(#0c0c0c 0 6deg, #2c2c2c 6deg 12deg);
  box-shadow: 0 3px 5px rgba(0, 0, 0, .45), inset 0 0 0 1px #000; }
.qk-knob:hover:not(.off):not(.disabled) .qk-cap { box-shadow: 0 0 0 2px var(--accent), 0 3px 5px rgba(0, 0, 0, .45); }
.qk-badge { margin-left: 5px; padding: 0 4px; border-radius: 3px; background: var(--accent-dim); color: #fff; font-size: 10px; font-weight: 600; vertical-align: 1px; }
.qk-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qk-row .qk-n { width: 48px; flex: none; color: var(--muted); font-size: 12px; }
.qk-row select { flex: 1 1 0; min-width: 0; }
.editor-fs .midi-box.patch { flex: 1 1 300px; max-width: 420px; border-top: 0; padding-top: 0; }
.editor-fs[hidden] { display: none; }
.editor-fs .fs-title { width: 100%; color: var(--muted); font-size: 12px; }
.fs-box { display: flex; flex-direction: column; gap: 5px; }
.fs-box select { flex: 1; min-width: 0; }
.fs-box .fs-head { display: flex; align-items: center; gap: 8px; }
.fs-box .fs-head b { width: 34px; }
.fs-box .fs-hold { color: var(--muted); font-size: 12px; }
.fs-picks { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.fs-pick { display: flex; gap: 8px; align-items: center; min-width: 0; width: 100%; }
.fs-pick .fs-sum { color: var(--muted); font-size: 12px; }
.fs-pick.on .fs-sum { color: inherit; }
.fs-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 4px 0 8px; }
.fs-grid button { display: flex; flex-direction: column; align-items: center; padding: 2px 0; min-width: 0; font-size: 10px; line-height: 1.2; }
.fs-grid button .fs-pos { color: var(--muted); font-size: 9px; }
.fs-grid button.empty { color: #666; }
.fs-grid button.on { border-color: var(--accent); color: var(--accent); background: rgba(245, 166, 35, .12); }
.fx.fs-mark { background: #34302a; }
.fx.empty.fs-mark { border-style: dashed; border-color: var(--accent); }
.chain.fs-picking .fx { cursor: copy; }
.chain.fs-picking .fx:hover { box-shadow: 0 0 0 2px #fff; }
.fs-pick-hint { color: #fff; margin-left: 10px; }
.fs-box > .small-btn { align-self: flex-start; }
.fs-box > .small-btn.on { color: var(--accent); border-color: var(--accent); }
.io.sel svg polygon { stroke-width: 2.6; }
.io:hover { color: #fff; }
.io.sel:hover { color: var(--accent); }
.io { cursor: pointer; }
.fs-follow { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.midi-box summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 4px; }
.midi-box.patch { border-top: 1px solid #262626; padding-top: 8px; }
.midi-row { display: grid; grid-template-columns: 12px 64px 1fr 52px; gap: 4px; align-items: center; margin-top: 4px; }
.midi-row select, .midi-row input { min-width: 0; font-size: 12px; padding: 2px 3px; }
.midi-row .midi-n { color: var(--muted); font-size: 11px; }
.fs-slots { display: flex; flex-wrap: wrap; gap: 4px; max-width: 420px; }
.fs-slots button { font-size: 11px; padding: 2px 6px; }
.fs-slots button.on { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.edit-hint { margin-right: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.about-link { margin-right: 12px; white-space: nowrap; text-decoration: none; }
.about-link:hover { color: var(--accent); }
.about-dialog { width: min(680px, 92vw); }
.about-text { overflow-y: auto; }
.about-text p { margin: 0 0 10px; color: #ccc; line-height: 1.45; }
/* global settings */
.gs-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; min-width: 0; }
.gs-row > span:first-child { width: 128px; flex: none; }
.gs-row select { flex: 1; min-width: 0; max-width: 200px; }
.gs-row input[type=range] { flex: 1; min-width: 60px; }
.gs-eq { grid-column: 1 / -1; }
.gs-row .gs-val { min-width: 54px; color: #ddd; font-variant-numeric: tabular-nums; }
/* one row, always: the swatches shrink with the space next to the label (same width as the selects) */
.gs-colors { display: flex; flex-wrap: nowrap; gap: 4px; flex: 1; min-width: 0; max-width: 200px; }
.gs-colors button { flex: 1 1 0; min-width: 0; max-width: 22px; aspect-ratio: 1; height: auto; padding: 0; border-radius: 3px; border: 2px solid transparent; }
.gs-colors button.on { border-color: #fff; }
.eq-table td, .eq-table th { padding: 3px 6px; }
.eq-graph { width: 100%; max-width: 1100px; height: auto; background: #101010; border: 1px solid var(--line); border-radius: 4px; touch-action: none; }
.eq-graph .g { stroke: #262626; stroke-width: 1; }
.eq-graph .g0 { stroke: #444; stroke-width: 1; }
.eq-graph .gl { fill: #777; font-size: 11px; }
.eq-graph .eq-curve { fill: none; stroke: var(--accent); stroke-width: 2; }
.eq-graph .eq-pt { fill: #111; stroke-width: 2.5; cursor: grab; }
.eq-graph .eq-pt.off { opacity: .45; }
.eq-table input[type=number] { width: 78px; }
.gs-guess { color: var(--accent); cursor: help; }
/* IR & NAM page */
.files-wrap { max-height: 360px; }
.files-wrap td.st.ok { color: #7ee787; }
.files-wrap td.st.err { color: #f08080; }
.files-wrap td.st.busy { color: var(--accent); }
.files-wrap td.nm.empty { color: var(--muted); }
.knob { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--blue); font-size: 13px; }
.knob .dial { width: 62px; height: 62px; border-radius: 50%; border: 3px solid #333; border-top-color: var(--blue); background: radial-gradient(circle at 40% 35%, #444, #1a1a1a); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.setting { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #2a2a2a; color: #bbb; }
.setting input[type=number] { width: 70px; background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 4px; }

/* sniffer */
.tab-tool { font-size: 14px; color: var(--muted); margin-left: 12px; }
.sniffer { gap: 10px; }
.sn-toolbar .row { margin-bottom: 6px; }
.sn-toolbar #snFilter { min-width: 300px; }
.sn-list { padding: 0; flex: 1 1 40%; min-height: 160px; display: flex; }
.sn-list-wrap { overflow: auto; flex: 1; }
.sn-table { font: 12px Consolas, monospace; }
.sn-table th { background: var(--panel2); z-index: 1; }
.sn-table td { padding: 2px 8px; white-space: nowrap; border-bottom: 1px solid #262626; cursor: pointer; }
.sn-table td:last-child { white-space: normal; color: #bbb; }
.sn-table tr.in td:nth-child(3) { color: #7ee787; }
.sn-table tr.out td:nth-child(3) { color: var(--blue); }
.sn-table tr.unknown td { color: var(--accent); }
.sn-table tr.bad td { color: var(--red); }
.sn-table tr:hover td { background: #262626; }
.sn-table tr.sel td { background: #3a3220; }
.sn-detail { flex: 1 1 45%; min-height: 220px; display: flex; flex-direction: column; }
.sn-panes { flex: 1; display: flex; gap: 12px; min-height: 0; }
.sn-fields { flex: 1; overflow: auto; margin: 0; padding: 0 0 0 4px; list-style: none; font: 12px Consolas, monospace; }
.sn-fields ul { list-style: none; padding-left: 16px; margin: 0; }
.sn-fields .fld { display: flex; gap: 8px; align-items: center; padding: 1px 4px; cursor: pointer; border-radius: 3px; }
.sn-fields .fld:hover { background: #262626; }
.sn-fields .fld.on { background: #4a3c18; }
.sn-fields .fld.collapsed .fn::after { content: ' ▸ (double-click)'; color: var(--muted); }
.sn-fields .sw { width: 10px; height: 10px; flex: none; border-radius: 2px; }
.sn-fields .fn { color: #ddd; }
.sn-fields .fv { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-fields .fo { margin-left: auto; color: #666; flex: none; }
.sn-hex { flex: 1.2; overflow: auto; font: 12px Consolas, monospace; }
.sn-hex .hl { white-space: pre; }
.sn-hex .ho { color: #666; margin-right: 10px; }
.sn-hex .hb { display: inline-block; width: 2.6ch; text-align: center; cursor: pointer; border-radius: 2px; }
.sn-hex .hb.on { outline: 2px solid var(--accent); outline-offset: -1px; color: #fff; }
.sn-hex .ha { margin-left: 12px; color: #999; }
.sn-hex .legend { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sn-hex .legend span { padding: 1px 6px; border-radius: 3px; }
.sn-hex .frame-bytes { display: flex; flex-wrap: wrap; gap: 1px; margin: 2px 0 8px; }
.sn-hex .frame-bytes span { padding: 0 2px; border-radius: 2px; }
.content.sniffer { overflow: hidden; }
.sniffer.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
.chain { position: relative; }
.chain-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.chain-svg path { fill: none; stroke: #6b5a35; stroke-width: 2; }
.chain.unknown .chain-row { opacity: .35; }
.chain-mode .small-btn { margin-left: 6px; }
/* chain: sides as two cells aligned with the rows */
.chain-side { display: grid; grid-template-rows: 66px 66px; row-gap: 26px; align-items: center; justify-items: center; height: auto; }
.chain-row { height: 66px; }
.node.split, .node.merge { margin: 0 2px; }

/* module icons */
.fx .fx-icon { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; opacity: 1; }
.fx .fx-icon svg { width: 100%; height: 100%; }
.fx .fx-state { position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.fx.off .fx-state { background: none; border: 1.5px solid #666; width: 7px; height: 7px; }
.fx.off .fx-icon { color: #666; }
.fx.m-DYN, .mi.m-DYN { color: #2ea8ff; }
.fx.m-EQ, .mi.m-EQ { color: #3fd6e8; }
.fx.m-FREQ, .mi.m-FREQ { color: #6495ed; }
.fx.m-WAH, .mi.m-WAH { color: #a07cff; }
.fx.m-DRV, .mi.m-DRV { color: #ff4d6d; }
.fx.m-AMP, .mi.m-AMP { color: #4d8dff; }
.fx.m-PRE-AMP, .mi.m-PRE-AMP { color: #8ad94a; }
.fx.m-CAB, .mi.m-CAB { color: #f5a623; }
.fx.m-IR, .mi.m-IR { color: #e8e8e8; }
.fx.m-NAM, .mi.m-NAM, .fx.m-CLONE, .mi.m-CLONE { color: #b0b0b0; }
.fx.m-MOD, .mi.m-MOD { color: #3fb950; }
.fx.m-DLY, .mi.m-DLY { color: #ff4fa0; }
.fx.m-RVB, .mi.m-RVB { color: #f5d423; }
.fx.m-VOL, .mi.m-VOL { color: #c86bff; }
.fx.m-FX-LOOP, .mi.m-FX-LOOP, .fx.m-FX-SND, .fx.m-FX-RTN { color: #ff8c2a; }
.mock-modules li { display: flex; align-items: center; gap: 8px; }
.mock-modules .mi { width: 20px; height: 20px; display: inline-flex; }
.mock-modules .mi svg { width: 100%; height: 100%; }
.sn-probe summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.sn-probe .row { margin: 6px 0; }
.pr-wrap { max-height: 260px; overflow: auto; margin-top: 6px; }
.sn-table tr.changed td { color: var(--accent); }
.sn-table td .chg { background: #7a4b16; color: #fff; border-radius: 2px; }
.sn-table tr.noanswer td { color: #666; }

/* Ko-fi "Tip Me" button: bottom left, over the free space at the bottom of the preset sidebar, just above the log
   panel (--kofi-bottom is set from the panel's height in index.html). !important because the widget injects its
   own stylesheet after ours. */
.floatingchat-container-wrap, .floatingchat-container-wrap-mobi {
  left: 12px !important; right: auto !important; bottom: var(--kofi-bottom, 56px) !important;
}
.floating-chat-kofi-popup-iframe, .floating-chat-kofi-popup-iframe-mobi {
  left: 16px !important; right: auto !important; bottom: calc(var(--kofi-bottom, 56px) + 60px) !important;
}
/* room for the button below the preset list (list + hint end above it) */
.sidebar { padding-bottom: 72px; }

/* ------------------------------------------------------------------ start screen (no pedal) / connecting */
.offline-screen { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.offline-screen[hidden] { display: none; }
.off-box { max-width: 460px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.off-box h2 { margin: 4px 0 0; font-size: 20px; font-weight: 500; }
.off-box p { margin: 0; line-height: 1.45; }
.off-brand { font-weight: 300; letter-spacing: 6px; color: var(--accent); font-size: 26px; }
.off-brand small { color: var(--muted); letter-spacing: 1px; font-size: 13px; }
/* without a pedal: no sidebar, pages, tabs (the sniffer stays reachable from the gear menu) */
body.offline .layout > .sidebar, body.offline .layout > .page:not(#page-sniffer) { display: none !important; }
body.offline .tabs { visibility: hidden; }
body.offline #editHint { display: none; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid #333; border-top-color: var(--accent);
  animation: spin .8s linear infinite; }
.spinner[hidden] { display: none; }
.status.connecting::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: -1px;
  border-radius: 50%; border: 2px solid #5a4a20; border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner, .status.connecting::before { animation-duration: 2.4s; } }
.version { margin-right: 12px; white-space: nowrap; text-decoration: none; font-variant-numeric: tabular-nums; }
a.version[href]:hover { color: var(--accent); }

/* about dialog */
.info-table { border-collapse: collapse; margin: 4px 0 12px; }
.info-table th { text-align: left; font-weight: 400; color: var(--muted); padding: 4px 14px 4px 0; vertical-align: top; white-space: nowrap; }
.info-table td { padding: 4px 0; color: #ccc; }
.about-text h4 { margin: 6px 0 6px; font-size: 14px; }
.info-list { margin: 0 0 10px; padding-left: 18px; color: #ccc; line-height: 1.45; }
.info-list li { margin-bottom: 4px; }
.about-text a { color: var(--accent); }

/* split / mixer node: draggable along row 1 */
.node.movable { cursor: grab; touch-action: none; background: var(--bg); }
.node.movable:hover { box-shadow: 0 0 0 3px rgba(245, 166, 35, .35); }
.node.dragging { opacity: .35; }
.node-ghost { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid var(--accent); background: rgba(245, 166, 35, .35); pointer-events: none; z-index: 5; }
.node-ghost.bad { border-color: var(--red); background: rgba(229, 72, 77, .35); }

/* drum machine on the edit page */
/* fixed width: the text (rhythm · BPM) changes and must not push the BPM / volume sliders around */
.drum-toggle { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; width: 210px; flex: none; }
.drum-toggle #drumSum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; font-variant-numeric: tabular-nums; }
.drum-toggle.playing .drum-ic { animation: drum-beat .5s ease-in-out infinite alternate; }
@keyframes drum-beat { to { transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .drum-toggle.playing .drum-ic { animation: none; } }
.drum-toggle.on { border-color: var(--accent); }
.drum-toggle.playing { color: var(--accent); }
.drum-toggle .drum-ic { font-size: 16px; line-height: 1; }
.drum-toggle .drum-caret { color: var(--muted); font-size: 10px; }
.drum-toggle.on .drum-caret { transform: rotate(180deg); }
.drum-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; padding: 10px 16px; }
.drum-card[hidden] { display: none; }
.drum-play { width: 44px; height: 44px; border-radius: 50%; padding: 0; border: 2px solid var(--accent); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.drum-play svg { width: 22px; height: 22px; display: block; }
.drum-play.on { background: var(--accent); color: #111; }
.drum-style { min-width: 190px; }
.drum-slider { display: flex; align-items: center; gap: 8px; }
.drum-slider input[type=range] { width: 170px; }
.drum-val { min-width: 32px; font-variant-numeric: tabular-nums; color: #ddd; }
.drum-sync { display: flex; align-items: center; gap: 8px; }
.drum-close { margin-left: auto; }

/* current preset name: double-click renames */
.renamable { cursor: text; border-radius: 3px; }
.renamable:hover { background: #2a2a2a; box-shadow: 0 0 0 3px #2a2a2a; }


/* preset list: drag handle to move a preset to another slot */
.preset-list li .grip { flex: none; width: 12px; color: #555; cursor: grab; visibility: hidden; user-select: none; }
.preset-list li:hover .grip { visibility: visible; }
.preset-list li .grip:hover { color: var(--accent); }
.preset-list li.dragging { opacity: .45; }
.preset-list li.drop-target { box-shadow: inset 0 2px 0 var(--accent); background: #2a2416; }
.preset-list li.drop-target::after { content: attr(data-drop); margin-left: auto; color: var(--accent); font-size: 12px; }
.preset-list li.drop-target .menu-btn { display: none; }

/* About: a button right of the gear, opens the about overlay */
.conn .about-btn { align-self: stretch; }

/* online / offline pill in the status bar */
.log-head #status { margin-right: 12px; font-size: 11px; padding: 2px 8px; }

/* demo mode (simulated pedal) */
.demo-btn { background: none; border-color: var(--line); color: var(--muted); }
.demo-btn:hover { color: var(--text); }
.demo-banner { display: flex; align-items: center; gap: 12px; padding: 6px 18px; font-size: 13px;
  background: repeating-linear-gradient(-45deg, #2a2140, #2a2140 12px, #251d39 12px, #251d39 24px); color: #d9ccff;
  border-bottom: 1px solid #4a3a73; }
.demo-banner[hidden] { display: none; }
.demo-banner b { letter-spacing: .12em; color: #b9a2ff; }
.demo-banner .small-btn { margin-left: auto; }

/* value next to a slider that can be typed in (double-click) */
.tap-edit { cursor: text; border-radius: 3px; padding: 0 2px; }
.tap-edit:hover { background: #2a2a2a; }
.tap-input { width: 58px; padding: 1px 4px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 3px; font-variant-numeric: tabular-nums; }
.scene-vals #edTempo { width: 130px; }
