:root { color-scheme: dark; scrollbar-color: var(--line2) var(--panel); scrollbar-width: thin;
  --bg: #0e0f10; --panel: #151617; --panel2: #1b1c1e; --line: #2a2b2e; --line2: #3a3c40;
  --text: #c9c9c4; --mute: #7d7e7a; --acc: #d29a3a; --acc-bg: #2a2114; --blue: #6f9fc8; --bad: #c8553d;
  --sans: "DejaVu Sans", "Bitstream Vera Sans", Verdana, Geneva, sans-serif;
  --mono: "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 12px/1.45 var(--sans); }
.app { display: flex; height: 100%; }
.sidebar { width: 420px; min-width: 340px; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 0 0 40px; }
.brand { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.brand h1 { margin: 0; font-size: 14px; font-weight: bold; letter-spacing: 0; color: var(--text); }
.brand p { margin: 2px 0 0; color: var(--mute); font-size: 11px; }
.view { flex: 1; position: relative; min-width: 0; }
.hud { position: absolute; z-index: 2; top: 0; left: 0; right: 0; display: flex; gap: 0; flex-wrap: wrap; pointer-events: none; font-family: var(--mono); font-size: 11px; }
.chip { background: var(--panel); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 10px; }
.chip b { color: var(--acc); font-weight: normal; }
.chip.warn { color: var(--bad); }
.turntable { position: absolute; z-index: 2; left: 0; bottom: 0; display: flex; align-items: stretch; background: var(--panel); border-top: 1px solid var(--line); border-right: 1px solid var(--line); font-size: 11px; }
.turntable span { padding: 4px 10px; color: var(--mute); align-self: center; }
.turntable button { border: 0; border-left: 1px solid var(--line); padding: 4px 10px; background: transparent; }
.turntable button.on { background: var(--acc-bg); color: var(--acc); }
.section { border-bottom: 1px solid var(--line); }
.section summary { cursor: pointer; padding: 8px 14px; font-weight: bold; user-select: none; list-style: none; }
.section summary::-webkit-details-marker { display: none; }
.section summary::before { content: "+"; display: inline-block; width: 14px; color: var(--mute); font-family: var(--mono); }
.section[open] summary::before { content: "\2212"; }
.section summary:hover { background: var(--panel2); }
.section .body { padding: 4px 14px 12px; display: flex; flex-direction: column; gap: 7px; }
h3 { margin: 6px 0 0; font-size: 11px; font-weight: bold; color: var(--mute); }
.field { display: flex; flex-direction: column; gap: 2px; }
.field > span { color: var(--mute); font-size: 11px; }
input, select, button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line2); border-radius: 0; padding: 4px 6px; }
input[type=number], .res, .bom td:nth-child(3), .bom td:nth-child(4) { font-family: var(--mono); }
input:focus, select:focus, button:focus-visible { outline: 1px solid var(--acc); outline-offset: -1px; }
input.bad { border-color: var(--bad); }
input[type=range] { padding: 0; accent-color: var(--acc); }
input[type=checkbox] { accent-color: var(--acc); margin: 0; }
button { cursor: pointer; }
button:hover { background: #222326; }
button.primary, button.on { background: var(--acc-bg); border-color: var(--acc); color: var(--acc); }
button.x { padding: 1px 7px; color: var(--mute); border-color: var(--line); }
.seg { display: flex; gap: 0; flex-wrap: wrap; }
.seg button { flex: 1; margin-left: -1px; }
.seg button:first-child { margin-left: 0; }
.check { display: flex; gap: 6px; align-items: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row .field { flex: 1; }
.row.small { font-size: 11px; justify-content: space-between; }
.card { border: 1px solid var(--line); padding: 7px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.row.card { flex-direction: row; }
.card p { margin: 0; }
input.label { flex: 1; }
.err { color: var(--bad); font-style: normal; font-size: 11px; margin: 0; }
.hint { color: var(--mute); font-size: 11px; margin: 0; }
table { border-collapse: collapse; width: 100%; font-size: 11px; }
th, td { border-bottom: 1px solid var(--line); padding: 3px 4px; text-align: left; vertical-align: top; }
th { color: var(--mute); font-weight: normal; font-family: var(--sans); }
.res b { color: var(--acc); font-weight: normal; }
.res td:nth-child(n+2), .res th:nth-child(n+2) { text-align: right; }
.bom td:nth-child(4) { text-align: right; }
.chart { width: 100%; height: auto; background: var(--bg); border: 1px solid var(--line); }
.chart .grid { stroke: #1f2022; stroke-width: 1; }
.chart .tick { fill: var(--mute); font-size: 9px; font-family: var(--mono); }
.chart .axis { fill: var(--mute); font-size: 10px; font-family: var(--sans); }
.chart .ln { fill: none; stroke-width: 1.4; }
.chart .ln.base { stroke: var(--blue); }
.chart .ln.loaded { stroke: var(--acc); }
.modes { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.cbar { width: 100%; height: auto; }
.cbar .tick { fill: var(--mute); font-size: 8px; font-family: var(--mono); }
.legend { font-size: 11px; color: var(--mute); margin: 0; }
.sw { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin: 0 4px 0 2px; }
.sw.base { background: var(--blue); }
.sw.loaded { background: var(--acc); }
@media (max-width: 800px) { .app { flex-direction: column-reverse; } .sidebar { width: 100%; height: 55%; } .view { height: 45%; } }
.brand button.link { border: 0; background: none; padding: 0 0 0 8px; color: var(--acc); font-size: 11px; cursor: pointer; text-decoration: underline; }
.tutorial { position: absolute; z-index: 3; right: 16px; top: 40px; width: 340px; max-width: calc(100% - 32px); background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; color: var(--text); font-size: 12px; }
.tutorial h2 { margin: 0 0 6px; font-size: 14px; }
.tutorial p { margin: 0 0 10px; line-height: 1.45; }
.tutorial .step { color: var(--mute); font-size: 11px; margin-bottom: 4px; }
.tutorial .presets { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tutorial .presets button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 8px 10px; }
.tutorial .presets span { color: var(--mute); font-size: 11px; }
.tutorial .row { justify-content: flex-end; }
.notfound { padding: 40px 16px; }
.notfound a { color: var(--acc); }
.toolbar { display: flex; flex-wrap: wrap; gap: 0; margin-top: 8px; }
.toolbar button { margin-left: -1px; padding: 3px 8px; font-size: 11px; }
.toolbar button:first-child { margin-left: 0; }
.toolbar button:disabled { opacity: 0.4; }
.card.selcard { border-color: var(--acc); }
.flash { outline: 1px solid var(--acc); outline-offset: 2px; }
table.bom tr.pick, table.res tr { cursor: pointer; }
table.bom tr.sel td, table.res tr.sel td { background: var(--acc-bg); color: var(--acc); }
.history { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; font-family: var(--mono); font-size: 11px; }
.history li button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 3px 6px; color: var(--text); }
.history li.now button { background: var(--acc-bg); color: var(--acc); }
.history li.future button { color: var(--mute); }
.tutorial { top: auto; bottom: 40px; right: 16px; }
.rightbar { width: 400px; min-width: 320px; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 0 0 40px; }
@media (max-width: 1100px) { .rightbar { width: 320px; } .sidebar { width: 340px; } }
.turntable { right: 0; flex-wrap: wrap; }
.turntable button, .turntable span { white-space: nowrap; }
