:root{--bg:#f6f6f3;--surface:#fff;--surface-2:#efefea;--fg:#1d1d1b;--muted:#64645e;--border:#d9d9d2;--accent:#2357c6;--accent-fg:#fff;--active:#e7efff;--warn:#c2410c;--warn-bg:#fff1e6;--ok:#1f7a3a;--ok-bg:#e8f6ec;--ng:#b42318;--ng-bg:#fdecea;--pot-l:#d23c3c;--pot-n:#2f63d6;--pot-0:#9a9a92;--lamp-red:#ef4444;--lamp-green:#22c55e;--lamp-yellow:#facc15;--lamp-white:#f5f5f4;--lamp-off:#d6d3d1;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;font-family:system-ui,-apple-system,Apple SD Gothic Neo,Malgun Gothic,sans-serif;line-height:1.5}@media (prefers-color-scheme:dark){:root{--bg:#141413;--surface:#1e1e1c;--surface-2:#2a2a27;--fg:#ececea;--muted:#a5a59f;--border:#3a3a36;--accent:#6f9bff;--accent-fg:#0d1526;--active:#1f2b45;--warn:#fb923c;--warn-bg:#3a2414;--ok:#4ade80;--ok-bg:#12301c;--ng:#f87171;--ng-bg:#3b1716;--pot-l:#f26b6b;--pot-n:#6f9bff;--pot-0:#6b6b65;--lamp-off:#44403c;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}*{box-sizing:border-box}body{background:var(--bg);color:var(--fg);margin:0}button,select{font:inherit;color:inherit}button{cursor:pointer}button:disabled{opacity:.45;cursor:default}:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.sr-only{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.muted{color:var(--muted);font-size:.875rem}code{background:var(--surface-2);word-break:break-all;border-radius:4px;padding:1px 4px;font-size:.85em}.app{max-width:1400px;margin:0 auto;padding:12px 16px 32px}.top{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;display:flex}.top h1{margin:4px 0;font-size:1.15rem}.problem-select select{border:1px solid var(--border);background:var(--surface);border-radius:8px;max-width:100%;padding:8px 10px}.tabs{border-bottom:1px solid var(--border);gap:4px;margin:12px 0 8px;display:flex;overflow-x:auto}.tabs button{color:var(--muted);background:0 0;border:none;border-bottom:3px solid #0000;flex:1 0 auto;min-height:44px;padding:10px 14px;font-weight:600}.tabs button.active{color:var(--fg);border-bottom-color:var(--accent)}.description{margin:4px 0 12px;font-size:.9rem}.description summary{cursor:pointer;color:var(--muted)}.description p{margin:6px 0 0}.foot{color:var(--muted);margin-top:32px;font-size:.8rem}.workspace{flex-direction:column-reverse;gap:12px;display:flex}.workspace.wiring{flex-direction:column}.canvas{min-width:0}.side{flex-direction:column;gap:12px;display:flex}@media (width>=860px){.workspace{grid-template-columns:minmax(0,1fr) 340px;align-items:start;display:grid}.side{max-height:calc(100vh - 24px);position:sticky;top:12px;overflow-y:auto}}.legend{color:var(--muted);flex-wrap:wrap;align-items:center;gap:4px 6px;margin:0 0 6px;font-size:.8rem;display:flex}.legend span[class$=swatch]{border-radius:2px;width:18px;height:4px;margin-left:6px;display:inline-block}.pot-l-swatch{background:var(--pot-l)}.pot-n-swatch{background:var(--pot-n)}.pot-0-swatch{background:var(--pot-0)}.schematic{-webkit-user-select:none;user-select:none;touch-action:manipulation;width:100%;height:auto;display:block}.box-bg{fill:var(--surface);stroke:var(--border);stroke-width:1.2px}.box.active .box-bg{fill:var(--active);stroke:var(--accent)}.box.warn .box-bg{stroke:var(--warn);fill:var(--warn-bg)}.box-title{fill:var(--fg);font-size:14px;font-weight:700}.box-sub{fill:var(--muted);font-size:11px}.box-status{fill:var(--accent);font-size:12px;font-weight:700}.box.warn .box-status{fill:var(--warn)}.lamp{stroke:var(--border);stroke-width:1.5px}.group-bg{fill:var(--surface-2)}.group-label{fill:var(--muted);font-size:10.5px}.pin-label{fill:var(--fg);pointer-events:none;font-size:10px}.wire{fill:none;stroke-width:2.4px;stroke-linecap:round;opacity:.85;pointer-events:none}.wire.pot-l{stroke:var(--pot-l)}.wire.pot-n{stroke:var(--pot-n)}.wire.pot-0{stroke:var(--pot-0)}.wire.locked{stroke-dasharray:6 4}.wire.selected{stroke:var(--warn);stroke-width:4.5px;opacity:1}.wire-hit{fill:none;stroke:#0000;stroke-width:14px;cursor:pointer}.wire-hit:focus-visible{stroke:color-mix(in srgb, var(--accent) 35%, transparent);outline:none}.terminal-dot{fill:var(--surface);stroke:var(--pot-0);stroke-width:2px}.terminal.wired .terminal-dot{fill:var(--pot-0)}.terminal.pot-l .terminal-dot{stroke:var(--pot-l)}.terminal.pot-l.wired .terminal-dot{fill:var(--pot-l)}.terminal.pot-n .terminal-dot{stroke:var(--pot-n)}.terminal.pot-n.wired .terminal-dot{fill:var(--pot-n)}.terminal.crowded .terminal-dot{stroke-dasharray:3 2}.terminal.marked .terminal-dot{stroke:var(--warn);stroke-width:4px}.terminal.selected .terminal-dot{stroke:var(--accent);stroke-width:5px;fill:var(--surface)}.terminal-hit{fill:#0000}.schematic.interactive .terminal{cursor:pointer}.schematic.interactive .terminal:hover .terminal-dot{stroke:var(--accent)}.terminal:focus-visible{outline:none}.terminal:focus-visible .terminal-hit{fill:color-mix(in srgb, var(--accent) 25%, transparent)}.panel,.guide,.grade,.quiz-card,.notice{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px}.panel{flex-direction:column;gap:12px;display:flex}.panel h3,.grade h3{color:var(--muted);margin:0 0 6px;font-size:.8rem;font-weight:600}.panel-row{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.panel-row .clock{font-variant-numeric:tabular-nums;color:var(--muted);min-width:4.5em}.power,.toggle,.ghost,.toolbar button,.seg button,.primary,.pin{border:1px solid var(--border);background:var(--surface-2);border-radius:8px;min-height:40px;padding:6px 12px}.power{background:var(--accent);color:var(--accent-fg);border-color:var(--accent);font-weight:700}.power.on{background:var(--surface-2);color:var(--fg);border-color:var(--border)}.primary,.toolbar .primary{background:var(--accent);color:var(--accent-fg);border-color:var(--accent);font-weight:700}.ghost{background:0 0}.link{color:var(--accent);background:0 0;border:none;min-height:32px;padding:4px}.seg{align-items:center;gap:0;display:inline-flex}.seg button{border-radius:0;margin-left:-1px}.seg button:first-of-type{border-radius:8px 0 0 8px}.seg button:last-of-type{border-radius:0 8px 8px 0}.seg button[aria-pressed=true]{background:var(--accent);color:var(--accent-fg);border-color:var(--accent);position:relative}.seg.labeled{gap:0}.seg.labeled .toggle-id{margin-right:8px}.pb-row{flex-wrap:wrap;gap:10px;display:flex}.pb{border:3px solid var(--border);touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;background:var(--surface-2);border-radius:50%;flex-direction:column;justify-content:center;align-items:center;gap:2px;width:76px;height:76px;transition:transform 60ms;display:flex}.pb-a{border-color:var(--lamp-green)}.pb-b{border-color:var(--lamp-red)}.pb.pressed{background:var(--active);transform:scale(.93);box-shadow:inset 0 2px 6px #00000040}.pb-id{font-weight:700}.pb-label{color:var(--muted);font-size:.72rem}.switch-grid{flex-direction:column;align-items:flex-start;gap:8px;display:flex}.toggle{align-items:center;gap:8px;display:inline-flex}.toggle.on{background:var(--active);border-color:var(--accent)}.toggle.warn{background:var(--warn-bg);border-color:var(--warn);color:var(--warn)}.toggle-id{font-size:.85rem;font-weight:700}.indicators{grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:6px;margin:0;padding:0;list-style:none;display:grid}.indicators li{align-items:center;gap:6px;font-size:.85rem;display:flex}.indicators .dot{background:var(--lamp-off);border:1px solid var(--border);border-radius:50%;flex:none;width:16px;height:16px}.indicators .ind-name{color:var(--muted);font-size:.78rem}.lamp-red.on .dot{background:var(--lamp-red);box-shadow:0 0 10px var(--lamp-red)}.lamp-green.on .dot{background:var(--lamp-green);box-shadow:0 0 10px var(--lamp-green)}.lamp-yellow.on .dot,.lamp-orange.on .dot{background:var(--lamp-yellow);box-shadow:0 0 10px var(--lamp-yellow)}.lamp-white.on .dot{background:var(--lamp-white);box-shadow:0 0 10px #fff}.bz-ind.on .dot{background:var(--warn);animation:.25s infinite alternate buzz}.coil-ind.on .dot{background:var(--accent)}@keyframes buzz{to{transform:scale(1.2)}}@media (prefers-reduced-motion:reduce){.bz-ind.on .dot{animation:none}}.alert{background:var(--ng-bg);color:var(--ng);border-radius:8px;padding:8px 10px;font-size:.875rem}.alert p{margin:0 0 4px}.guide summary{cursor:pointer;font-weight:600}.guide ol{margin:8px 0 0;padding-left:20px;font-size:.875rem}.guide ul{color:var(--muted);margin:2px 0 8px;padding-left:16px}.guide li.expect{color:var(--fg)}.toolbar{flex-wrap:wrap;gap:6px;margin-bottom:6px;display:flex}.status{color:var(--muted);min-height:2.6em;margin:0 0 6px;font-size:.85rem}.grade.pass{border-color:var(--ok)}.grade.fail{border-color:var(--ng)}.grade header{justify-content:space-between;align-items:flex-start;gap:8px;display:flex}.grade h2{margin:0 0 8px;font-size:1rem}.grade.pass h2{color:var(--ok)}.grade.fail h2{color:var(--ng)}.scenario-results{margin:0 0 10px;padding:0;font-size:.9rem;list-style:none}.scenario-results ul{color:var(--ng);padding-left:24px;font-size:.85rem}.diag{margin:0 0 10px;padding-left:18px;font-size:.85rem}.diag.error li{color:var(--ng);margin-bottom:4px}.diag.warning li{color:var(--warn);margin-bottom:4px}.quiz{flex-direction:column;gap:12px;max-width:640px;display:flex}.notice{font-size:.875rem}.notice.warn{border-color:var(--warn);background:var(--warn-bg)}.notice p{margin:0}.quiz-card h2{margin:4px 0;font-size:1.25rem}.pin-grid{grid-template-columns:repeat(auto-fill,minmax(64px,1fr));gap:8px;margin:12px 0;display:grid}.pin{min-height:48px;font-weight:700;position:relative}.pin.picked{background:var(--active);border-color:var(--accent)}.pin.answer{outline:3px solid var(--ok)}.pin small{color:var(--accent);font-size:.7rem;position:absolute;top:2px;right:6px}.quiz-result{border-radius:8px;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:8px 10px;display:flex}.quiz-result p{margin:0}.quiz-result.ok{background:var(--ok-bg);color:var(--ok)}.quiz-result.ng{background:var(--ng-bg);color:var(--ng)}
