:root{--accent:#1d4ed8;--danger:#dc2626;--ok:#15803d;--line:#d0d4dc;--bg:#f6f7f9}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{color:#1a1a1a;background:var(--bg);font-family:system-ui,-apple-system,sans-serif;font-size:14px}main{max-width:1100px;padding:24px}table{border-collapse:collapse;font-variant-numeric:tabular-nums}th,td{text-align:left;border:1px solid #ccc;padding:4px 10px}th{background:#eee}.pass{background:#d8f5d8}.fail{background:#f8d0d0}.muted{color:#666}.small{font-size:12px}code{background:#eee;border-radius:3px;padding:1px 4px}button{font:inherit}.editor{grid-template:"palette canvas inspector"1fr"runbar runbar runbar""plot plot plot"/180px 1fr 280px;height:100%;display:grid}.palette{border-right:1px solid var(--line);background:#fff;grid-area:palette;padding:8px;overflow-y:auto}.palette h2,.inspector h2{color:#444;margin:8px 0 6px;font-size:13px}.palette-item{cursor:pointer;text-align:left;color:#222;background:0 0;border:1px solid #0000;border-radius:6px;align-items:center;gap:6px;width:100%;padding:2px 4px;display:flex}.palette-item:hover{background:#eef2ff}.palette-item.active{border-color:var(--accent);background:#e0e7ff}.palette-item span{flex:1;font-size:12px}.palette-item kbd{color:#555;background:#f5f5f5;border:1px solid #bbb;border-radius:3px;padding:0 4px;font-size:10px}.palette-item svg{flex:none}.canvas{touch-action:none;-webkit-user-select:none;user-select:none;background:#fff;outline:none;grid-area:canvas;width:100%;height:100%;display:block}.wire{stroke:#1f2937;stroke-width:1.8px;stroke-linecap:round}.wire.selected{stroke:var(--accent);stroke-width:2.6px}.wire.preview{stroke:var(--accent);stroke-dasharray:4 3}.part{color:#1f2937}.part.selected{color:var(--accent)}.part.highlight{color:var(--danger)}.part.highlight path,.part.highlight circle{filter:drop-shadow(0 0 3px #dc2626cc)}.part.ghost{opacity:.45;color:var(--accent)}.part text.label{fill:#374151;pointer-events:none;font-size:9px;font-weight:600}.part text.value{fill:#4b5563;cursor:text;font-size:9px}.part.selected text{fill:var(--accent)}.pin{fill:#1f2937}.pin.open{fill:var(--danger);stroke:#fff;stroke-width:1px}.junction{fill:#1f2937}.marquee{fill:#1d4ed814;stroke:var(--accent);stroke-dasharray:4 3}.probe-node{fill:currentColor;stroke:#fff;stroke-width:1.2px}.probe-letter{fill:#fff;pointer-events:none;font-size:7px;font-weight:700}.probe-ref{fill:#fff;stroke:currentColor;stroke-dasharray:2 2;cursor:grab}.probe-ref.active{stroke-dasharray:none;fill:currentColor}.probe-ref-line{stroke:currentColor;stroke-dasharray:3 3;stroke-width:1px}.probe-arrow{stroke:currentColor;stroke-width:2.2px;fill:none;cursor:pointer}.probe.selected .probe-node,.probe.selected .probe-arrow{filter:drop-shadow(0 0 3px #1d4ed8b3)}.badge text{pointer-events:none;font-size:9px;font-weight:600}.inline-edit{border:1px solid var(--accent);border-radius:3px;width:78px;padding:1px 3px;font:11px system-ui}.inspector-column{border-left:1px solid var(--line);background:#fff;flex-direction:column;grid-area:inspector;display:flex;overflow-y:auto}.inspector-column .inspector{border-left:none;flex:none;overflow:visible}.inspector{border-left:1px solid var(--line);background:#fff;grid-area:inspector;padding:8px 12px;overflow-y:auto}.inspector h3{color:#444;margin:12px 0 4px;font-size:12px}.field{margin:6px 0 10px;display:block}.field>span{color:#444;margin-bottom:2px;font-size:12px;display:block}.field input,.field select{width:100%;font:inherit;border:1px solid #bbb;border-radius:4px;padding:4px 6px}.field input.bad{border-color:var(--danger)}.field small{color:#666;margin-top:2px;font-size:11px;display:block}.field small.bad{color:var(--danger)}.field.check{align-items:center;gap:6px;display:flex}.field.check input{width:auto}.tips p{margin:6px 0;font-size:12px}.inspector button{margin:4px 0}.runbar{border-top:1px solid var(--line);background:#fff;flex-wrap:wrap;grid-area:runbar;align-items:center;gap:8px;padding:6px 10px;display:flex}.runbar .tabs{border:1px solid #bbb;border-radius:6px;display:flex;overflow:hidden}.runbar .tabs button{cursor:pointer;background:#f3f4f6;border:none;padding:4px 12px}.runbar .tabs button.active{background:var(--accent);color:#fff}.runbar button{cursor:pointer;background:#fff;border:1px solid #bbb;border-radius:6px;padding:4px 10px}.runbar button:disabled{opacity:.4;cursor:default}.runbar button.run{background:var(--ok);color:#fff;border-color:var(--ok);font-weight:600}.runbar button.share{background:var(--accent);color:#fff;border-color:var(--accent)}.runbar button.link{color:var(--accent);background:0 0;border:none;padding:0 4px;text-decoration:underline}.runbar .spacer{flex:1}.runbar select{font:inherit;border:1px solid #bbb;border-radius:6px;max-width:200px;padding:4px}.runfield{align-items:center;gap:4px;font-size:12px;display:inline-flex}.runfield input{font:inherit;border:1px solid #bbb;border-radius:4px;padding:3px 5px}.filebtn{cursor:pointer;background:#fff;border:1px solid #bbb;border-radius:6px;padding:4px 10px}.filebtn input{display:none}.status{max-width:520px;font-size:13px}.status.ok{color:var(--ok)}.status.error{color:var(--danger);font-weight:600}.status.info{color:#374151}.plotpanel{border-top:1px solid var(--line);background:#fff;grid-area:plot;max-height:46vh;overflow:auto}.plotbar{border-bottom:1px solid #eee;align-items:center;gap:8px;padding:4px 10px;display:flex}.plotbar button{cursor:pointer;background:#fff;border:1px solid #bbb;border-radius:6px;padding:2px 8px}.plotbar button:disabled{opacity:.4}.plotbar .spacer{flex:1}.plot{width:100%;padding:4px 8px}.plot svg{cursor:crosshair;display:block}.plot-bg{fill:#fafafa;stroke:#ddd}.tick line{stroke:#e5e7eb}.tick text{fill:#555;font-size:10px}.axis-label{fill:#444;font-size:11px}.trace{fill:none;stroke-width:1.8px}.trace.kept{stroke-dasharray:5 4;opacity:.45}.cursor line{stroke:#444;stroke-dasharray:3 3}.cursor.pinned line{stroke:#111;stroke-dasharray:none}.cursor text{fill:#111;font-size:10px;font-weight:700}.legend text{font-size:11px;font-weight:600}.cursor-table{margin:4px 0 6px 64px;font-size:12px}.cursor-table td,.cursor-table th{border:1px solid #ddd;padding:2px 8px}.initial-table{margin:6px 10px 2px;font-size:12px}.initial-table td,.initial-table th{border:1px solid #ddd;padding:2px 10px}.initial-table th{background:#f3f4f6;font-weight:600}.boundary{color:var(--danger);padding:12px}.tour,.help{z-index:20;border:1px solid var(--accent);background:#fff;border-radius:10px;width:320px;padding:12px 14px;position:fixed;box-shadow:0 6px 24px #0000002e}.tour h3,.help h3{margin:0 0 6px;font-size:14px}.tour p{margin:0 0 10px;font-size:13px}.tour-buttons{align-items:center;gap:8px;display:flex}.tour-buttons .spacer{flex:1}.tour button,.help button{cursor:pointer;background:#fff;border:1px solid #bbb;border-radius:6px;padding:3px 10px}.tour button.primary{background:var(--accent);color:#fff;border-color:var(--accent)}.tour button.link,.help button.link{color:var(--accent);border:none;padding:0;text-decoration:underline}.help{width:420px;max-height:80vh;top:40px;right:300px;overflow:auto}.help table{margin-bottom:8px;font-size:12px}.help td{vertical-align:top;border:none;padding:2px 8px 2px 0}.help kbd{white-space:nowrap;background:#f5f5f5;border:1px solid #bbb;border-radius:3px;padding:0 4px;font-size:11px}@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}.exercise{border-bottom:2px solid var(--accent);background:#f5f7ff;padding:8px 12px}.exercise h2{margin:4px 0 6px;font-size:13px}.exercise h2 .link{float:right;color:var(--accent);cursor:pointer;background:0 0;border:none;text-decoration:underline}.exercise p{margin:4px 0;font-size:12px}.exercise table.grade{width:100%;margin:6px 0;font-size:12px}.exercise table.grade td,.exercise table.grade th{border:1px solid #d8dbe6;padding:2px 6px}.exercise .pass-text{color:var(--ok)}.exercise .fail-text{color:var(--danger)}.exercise-buttons{gap:8px;margin:8px 0 4px;display:flex}.exercise-buttons button{cursor:pointer;background:#fff;border:1px solid #bbb;border-radius:6px;padding:4px 10px}.exercise-buttons button.primary{background:var(--accent);color:#fff;border-color:var(--accent);font-weight:600}.runbar button.help-btn{border-color:var(--accent);color:var(--accent);align-items:center;gap:6px;font-weight:600;display:inline-flex}.runbar button.help-btn .help-icon{background:var(--accent);color:#fff;text-align:center;border-radius:50%;width:16px;height:16px;font-size:11px;line-height:16px;display:inline-block}
