:root {
  --bg: #0e1216; --panel: #161c22; --panel-2: #1d252d; --line: #2a343e; --text: #e9edf1; --muted: #9aa7b3;
  --accent: #6cb6ff; --good: #6fd08c; --warn: #ffb454; --bad: #ff7b72; --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.45rem; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 1.02rem; margin: 0 0 10px; }
p { margin: 0 0 10px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 14px 40px; }
.site-header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn, .seg { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; cursor: pointer; min-height: 40px; }
.btn:hover, .seg:hover { border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.warn { border-color: var(--warn); }
.btn.primary { background: var(--accent); color: #06121f; border-color: var(--accent); font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font: inherit; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 6px; cursor: pointer; min-height: 40px; }
.switch-track { width: 38px; height: 22px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); position: relative; flex: none; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.switch[aria-checked="true"] .switch-track { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(16px); background: #06121f; }
.notice { background: #3a2a10; border: 1px solid var(--warn); border-radius: var(--radius); padding: 10px 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.lead { color: var(--muted); margin-bottom: 12px; }
.banner { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: .9rem; color: var(--text); font-family: inherit; cursor: pointer; min-height: 34px; }
.chip.static { cursor: default; }
.chip.hl { border-color: var(--accent); }
.layout { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .layout { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; } }
.stage { position: relative; background: #05080b; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stage canvas { display: block; width: 100%; aspect-ratio: 16 / 10; touch-action: manipulation; }
.stage-note { position: absolute; left: 10px; bottom: 8px; font-size: .78rem; color: var(--muted); background: rgba(5,8,11,.7); padding: 2px 8px; border-radius: 999px; pointer-events: none; }
.equation { font-size: 1.05rem; margin: 10px 0 0; }
.equation .words { color: var(--muted); display: block; font-size: .95rem; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; padding: 0; list-style: none; font-size: .92rem; }
.legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; margin-bottom: 12px; }
.control label, .control-label { font-weight: 600; }
.control input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); min-height: 30px; }
.control .value { color: var(--muted); font-variant-numeric: tabular-nums; grid-row: 1; grid-column: 2; }
.control.check { grid-template-columns: auto 1fr; justify-content: start; }
.control.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.seg-control { grid-template-columns: minmax(0, 1fr); }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.seg[aria-pressed="true"] { background: var(--accent); color: #06121f; border-color: var(--accent); font-weight: 600; }
.chart { margin-bottom: 14px; }
.chart h3 { font-size: .95rem; margin: 0 0 6px; }
.chart canvas { display: block; width: 100%; height: 190px; background: var(--panel-2); border-radius: 9px; }
.chart .caption { color: var(--muted); font-size: .86rem; margin: 6px 0 0; }
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.readout { background: var(--panel-2); border-radius: 9px; padding: 8px 10px; }
.readout .num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; display: block; }
.readout .lab { color: var(--muted); font-size: .84rem; }
.swatch { height: 54px; border-radius: 9px; border: 1px solid var(--line); background: #1d252d; position: relative; overflow: hidden; }
.swatch .fill { position: absolute; inset: 0; background: #8d3fd1; }
.options { display: grid; gap: 8px; margin: 10px 0; }
.option { text-align: left; }
.option[aria-pressed="true"] { border-color: var(--accent); background: #17304a; }
.verdict { font-weight: 700; }
.verdict.good { color: var(--good); } .verdict.bad { color: var(--warn); }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 4px 0 4px 26px; position: relative; }
.checks li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--muted); }
.checks li.done::before { background: var(--good); border-color: var(--good); }
.limits { margin: 0; padding-left: 20px; color: var(--muted); }
.term-pop { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-top: 10px; }
.term-pop .other { font-weight: 700; }
.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); max-width: 440px; width: calc(100% - 32px); }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dialog-msg.good { color: var(--good); } .dialog-msg.bad { color: var(--bad); }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { display: block; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card:hover { border-color: var(--accent); }
.card .meta { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }
.rag { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; font-weight: 700; color: #0b0f13; margin-right: 8px; flex: none; }
.rag.R { background: var(--bad); } .rag.A { background: var(--warn); } .rag.G { background: var(--good); }
table.plain { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.plain td, table.plain th { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.raglist { list-style: none; margin: 0; padding: 0; }
.raglist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.raglist .grow { flex: 1 1 180px; min-width: 0; }
select, input[type=text] { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; min-height: 38px; }
.nogpu { border-color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .switch-thumb { transition: none; } }
