@font-face{font-family:Barlow;src:url('assets/BarlowCondensed-Medium.ttf')} 
:root{--paper:#eef1f4;--surface:#f8fafc;--ink:#293238;--muted:#56636e;--line:#d7dfe5;--bench:#232a29;--bench-ink:#e9eee8;--bench-muted:#bac8c4;--copper:#dfa55f;--alert:#ff684a;--radius:5px;--fast:240ms;--ease:cubic-bezier(.2,.75,.2,1)}
*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:14px/1.5 -apple-system,BlinkMacSystemFont,'PingFang SC','Microsoft YaHei',sans-serif}button{font:inherit;cursor:pointer;color:inherit;border:0;background:none}button:disabled{cursor:default;opacity:.42}button:focus-visible{outline:2px solid #80a7ba;outline-offset:3px}button:active:not(:disabled){transform:scale(.98)}svg{fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.icon-button{display:grid;place-items:center;width:36px;height:36px;border-radius:var(--radius)}.icon-button svg{width:19px;height:19px}.icon-button:hover{background:#ffffff12}
h1,h2,p{margin:0}.topbar{height:58px;display:flex;align-items:center;justify-content:space-between;padding:0 23px 0 20px;border-bottom:1px solid var(--line);background:var(--surface)}.course{display:flex;gap:18px;align-items:center}.course>span{font-weight:650;font-size:17px}.course i{width:1px;height:20px;background:var(--line)}h1{font-size:18px;font-weight:500}.header-actions{display:flex;gap:17px;align-items:center;color:var(--muted)}.header-actions button{font-size:13px;padding:5px 0}.header-actions button:hover{color:var(--ink)}#record-count{font-family:Barlow;margin-left:3px}.workspace{display:grid;grid-template-columns:148px minmax(0,1fr) 0;height:calc(100dvh - 58px);min-height:640px;overflow:clip;transition:grid-template-columns 300ms var(--ease)}.workspace.observation-open{grid-template-columns:148px minmax(0,1fr) 184px}
.toolbox{background:var(--surface);border-right:1px solid var(--line);padding:18px 14px;overflow:auto}.toolbox h2{font-size:15px;font-weight:600}.toolbox-hint{font-size:12px;color:var(--muted);margin-top:3px}#tool-list{display:flex;flex-direction:column;margin-top:7px}.tool-item{display:flex;align-items:center;flex-direction:column;width:100%;min-height:117px;padding:8px 0 9px;border-bottom:0;touch-action:none}.tool-preview{position:relative;display:block;width:114px;height:70px}.tool-preview>img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 3px 2px #1d293018);transition:transform 220ms var(--ease)}.tool-item:hover .tool-preview>img{transform:translateY(-3px)}.tool-item b{display:inline;font-size:14px;font-weight:500}.tool-item small{font-size:13px;color:var(--muted);margin-left:7px}.tool-item.ammeter small{display:block;margin-left:0}.wire-info{display:flex;align-items:center;gap:12px;padding-top:17px}.wire-info small{display:block;font-size:12px;color:var(--muted)}.wire-sample{width:24px;height:23px;border-left:2px solid #77848c;border-bottom:2px solid #77848c;border-bottom-left-radius:7px}
.bench{min-width:0;display:flex;flex-direction:column;background:var(--bench);color:var(--bench-ink);overflow:clip;position:relative}.bench-toolbar{position:absolute;inset:0 0 auto;height:64px;z-index:10;display:flex;justify-content:flex-end;align-items:center;padding:0 20px;pointer-events:none}.bench-actions{pointer-events:auto}.bench-actions{display:flex;gap:11px;align-items:center;color:var(--bench-muted)}.bench-actions>button{font-size:13px}.bench-actions>button:hover{color:#fff}.bench-actions .icon-button{width:30px;height:30px}.bench-actions svg{width:17px}#toggle-observation span{margin-left:4px}
.stage-wrap{position:relative;flex:1;min-height:0;overflow:clip;touch-action:none;background:radial-gradient(ellipse at 45% 45%,#343c38 0,#232a29 65%)}.stage{position:absolute;width:1000px;height:600px;left:50%;top:50%;transform-origin:center center;touch-action:none}.stage>canvas,.stage>svg,#components{position:absolute;inset:0;width:100%;height:100%}#components{z-index:2;pointer-events:none}#circuit-canvas{z-index:3;pointer-events:none}#fallback-wires{z-index:3;display:none;pointer-events:none}#fallback-wires path{stroke:#d99d57;stroke-width:5}#preview-wire{z-index:6;pointer-events:none}#preview-wire path{stroke:var(--copper);stroke-width:3;stroke-dasharray:6 5}.component{position:absolute;pointer-events:auto;touch-action:none;user-select:none}.component>img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 7px 4px #080f0d70);pointer-events:none}.component.selected:not(.switch)::after{content:'';position:absolute;inset:-8px;border:1px dashed #a7beb4;border-radius:9px;pointer-events:none}.component-label{position:absolute;left:50%;top:calc(100% + 8px);transform:translateX(-50%);white-space:nowrap;display:flex;align-items:baseline;gap:7px;font-size:15px;color:#dce6df;pointer-events:none}.component-label b{font:500 21px Barlow;color:#eff7f0}.component-label small{display:none}.terminal{position:absolute;width:40px;height:40px;transform:translate(-50%,-50%);z-index:8;border-radius:50%;padding:0;background:transparent;box-shadow:none}.terminal:active:not(:disabled){transform:translate(-50%,-50%) scale(.96)}.terminal:hover{box-shadow:0 0 0 2px #e3bd8790;background:#e2b97812}.terminal.pending{box-shadow:0 0 0 3px #f5c07e}.component.switch{cursor:pointer}.switch-blade{position:absolute;z-index:4;height:8px;background:linear-gradient(#f8d093,#ab6b31 48%,#e6b66c 55%,#865f32);box-shadow:0 2px 2px #101713;transform-origin:6px center;transform:rotate(-33deg);border-radius:3px;pointer-events:none;transition:none}.switch-blade::before{content:'';position:absolute;right:-9px;top:-4px;width:23px;height:15px;background:linear-gradient(#3c4843,#141b19);border-radius:4px}.closed .switch-blade{transform:rotate(0deg)}.switch-flash{position:absolute;width:35px;height:35px;border-radius:50%;background:radial-gradient(#fff9d8,#ffc57460 25%,transparent 70%);opacity:0;z-index:7;pointer-events:none}.component.switch.switching .switch-flash{animation:contact-flash 330ms ease-out}.lamp-filament{position:absolute;width:22%;height:18%;left:39%;top:21%;border-radius:50%;background:radial-gradient(ellipse,#fff9de 0,#ffc457 22%,#eb7224 42%,transparent 72%);box-shadow:none;mix-blend-mode:screen;pointer-events:none;z-index:5;transition:opacity 280ms ease-out,filter 280ms ease-out}.lamp-warmth{position:absolute;inset:48% 20% 14%;border-radius:50%;background:radial-gradient(ellipse at 50% 45%,#f9d88530 0,#b8732f14 28%,transparent 64%);mix-blend-mode:screen;pointer-events:none;z-index:4;transition:opacity 280ms ease-out}.meter-face{position:absolute;z-index:4;overflow:visible;pointer-events:none}.meter-face svg{width:100%;height:100%;background:#e8e6d5;border-radius:3px;stroke:#434941;stroke-width:1}.meter-face text{font-family:Barlow;fill:#343d36;stroke:none;font-size:14px}.meter-needle{stroke:#ac592e;stroke-width:1.7;transform-origin:90px 96px;transition:transform 300ms cubic-bezier(.2,.8,.3,1.17)}.meter-needle.overload{animation:needle-shake 110ms linear 300ms infinite}.polarity-mark{position:absolute;color:#dce5de;font:500 20px Barlow;pointer-events:none}.polarity-mark.minus{left:12%;top:91%}.polarity-mark.plus{right:9%;top:91%}
#empty-state{position:absolute;z-index:5;left:50%;top:50%;transform:translate(-50%,-50%);text-align:center;width:540px}#empty-state>svg{width:130px;height:88px;color:#9db2a2;opacity:.65;margin-bottom:19px}#empty-state h2{font-size:24px;font-weight:500;color:#e4eee6}#empty-state p{font-size:15px;color:#bac8c4;margin-top:9px}#empty-state button{height:46px;padding:0 22px;margin-top:24px;border:1px solid #b78b51;border-radius:5px;color:#edbc7c;background:#bf945514;font-size:15px}#empty-state button span{margin-left:22px}.fault-callout{display:none;position:absolute;z-index:7;left:62px;top:292px;width:235px;color:#ffd6c1;font-size:15px;border-radius:5px;padding:11px 14px;background:#543126;border:1px solid #98603e;pointer-events:none;animation:fault-notice 850ms ease-out}.fault-callout strong{display:block;font-weight:550}.fault-callout>span:not(.fault-leader){display:block;font-size:14px;margin-top:3px}.fault-leader{position:absolute;left:100%;top:50%;width:220px;border-top:1px solid #e57c55;transform:rotate(-17deg);transform-origin:left}.readouts{height:96px;flex:none;background:#1d2521;border-top:1px solid #ffffff0c;display:flex;align-items:center;padding:10px 25px;gap:30px}.readout{width:190px;border-right:1px solid #ffffff0c;flex:none}.readout>span{font-size:13px;color:var(--bench-muted)}.readout small{font:14px Barlow;margin-left:8px}.readout p{display:flex;align-items:baseline;gap:9px;line-height:1.1}.readout b{font:500 43px/1.1 Barlow;letter-spacing:.3px;color:#f1f7ec}.readout p>span{font:20px Barlow;color:#c1cec3}.circuit-status{margin-left:auto;display:flex;gap:24px;align-items:center;min-width:0}.circuit-status>span{font-size:14px;max-width:370px;color:#c9d6cf}.switch-button{display:flex;align-items:center;gap:9px;padding:11px 18px;border:1px solid #c8965a;border-radius:var(--radius);background:#d9a965;color:#17251e;font-weight:600;white-space:nowrap}.switch-button svg{width:20px;height:20px}.switch-button.on{color:#e2eee3;border-color:#637a68;background:#3e5543}.switch-button:disabled{background:transparent;border-color:#6d7e7370;color:#aab9af;opacity:.6}.readouts.fault .readout b{color:#ffb98b}
.observation{width:184px;min-width:0;overflow:auto;background:var(--surface);padding:22px 17px;border-left:1px solid var(--line);visibility:hidden;opacity:0;transition:opacity 200ms var(--ease)}.observation-open .observation{visibility:visible;opacity:1}.observation-head{display:flex;align-items:center;justify-content:space-between}.observation h2{font-size:15px;font-weight:600}.observation-head button{font-size:23px;color:var(--muted)}.result-title{font-size:19px;font-weight:600;margin-top:30px;line-height:1.45}.result-description{font-size:14px;line-height:1.8;color:var(--muted);margin-top:12px}.observation-facts{margin-top:30px}.fact{padding:13px 0;border-top:1px solid var(--line)}.fact>span{font-size:13px;color:var(--muted);display:block}.fact b{display:block;font:22px Barlow;margin-top:4px}.record-button,.remove-bulb{width:100%;border:1px solid #b3bfc8;border-radius:var(--radius);padding:9px 7px;text-align:left;margin-top:24px;font-size:13px}.record-button span,.remove-bulb span{float:right}.remove-bulb{margin-top:10px;border-color:transparent;padding-left:0}.observation.fault .result-title{color:#7c3c2f}
#toast{position:fixed;left:50%;top:69px;transform:translate(-50%,-10px);background:#f7fafc;color:#293238;border:1px solid #c9d4dc;padding:9px 18px;border-radius:5px;box-shadow:0 7px 20px #0b172426;z-index:30;font-size:14px;pointer-events:none;opacity:0;transition:opacity 200ms,transform 200ms}#toast.show{opacity:1;transform:translate(-50%,0)}dialog{width:min(580px,90vw);border:1px solid #d0dae2;padding:25px;border-radius:8px;background:var(--surface);color:var(--ink);box-shadow:0 30px 100px #17232844}dialog::backdrop{background:#101b2566;backdrop-filter:blur(3px)}.dialog-header{display:flex;align-items:center;justify-content:space-between}.dialog-header h2{font-size:21px}.dialog-content{margin-top:23px;font-size:14px;line-height:1.9}.dialog-content h3{font-size:16px;margin:22px 0 5px}.dialog-content p{color:var(--muted)}table{border-collapse:collapse;width:100%;margin-top:18px;font-size:14px}td,th{text-align:left;padding:10px 5px;border-bottom:1px solid var(--line)}th{font-weight:500}.delete-record{color:#783f3b}.drag-ghost{position:fixed;width:180px;height:170px;z-index:40;pointer-events:none;opacity:.88;filter:drop-shadow(0 9px 9px #17201b55);object-fit:contain;transform:translate(-50%,-50%)}
body.entrance .component{animation:apparatus-weight 520ms var(--ease) both}body.entrance .component:nth-child(2){animation-delay:35ms}body.entrance .component:nth-child(n+3){animation-delay:70ms}body.entrance #empty-state{animation:empty-arrive 480ms var(--ease) both}@keyframes table-arrive{from{filter:brightness(.72)}to{filter:brightness(1)}}@keyframes apparatus-weight{0%{transform:translateY(-10px);opacity:1}72%{transform:translateY(1.5px);opacity:1}100%{transform:translateY(0);opacity:1}}@keyframes empty-arrive{from{opacity:0;translate:0 5px}to{opacity:1;translate:0 0}}@keyframes bench-arrive{from{opacity:.4}to{opacity:1}}@keyframes tool-arrive{from{opacity:0;transform:translateX(-7px)}to{opacity:1;transform:none}}@keyframes apparatus-arrive{from{opacity:0;transform:translateY(-12px) scale(.97)}to{opacity:1;transform:none}}@keyframes contact-flash{0%{opacity:.85}100%{opacity:0}}@keyframes needle-shake{0%,100%{transform:rotate(110deg)}50%{transform:rotate(107deg)}}@keyframes fault-notice{0%,75%{opacity:0;transform:translateY(-5px)}100%{opacity:1;transform:none}}
@media(max-width:1000px){.topbar{padding:0 15px}.header-actions{gap:12px}.course{gap:12px}.course>span{font-size:15px}h1{font-size:15px}.workspace{grid-template-columns:124px minmax(0,1fr) 0}.workspace.observation-open{grid-template-columns:124px minmax(0,1fr) 176px}.toolbox{padding:15px 10px}.tool-preview{width:100px}.bench-toolbar{padding:0 10px}.bench-actions{gap:8px}.readouts{gap:18px;padding:10px 18px}.readout{width:130px}.circuit-status>span{display:none}.circuit-status{margin-left:auto}.switch-button{padding:10px 13px}.observation{width:176px}}
@media(max-width:620px){.topbar{height:64px;gap:8px;align-items:center}.course{display:block}.course>span{font-size:14px}.course i{display:none}h1{font-size:13px;margin-top:2px}.header-actions{gap:10px}.header-actions [data-panel=principle],.header-actions #fullscreen{display:none}.header-actions button{font-size:12px}.workspace,.workspace.observation-open{display:flex;flex-direction:column;height:auto;min-height:calc(100dvh - 64px)}.toolbox{padding:11px 12px;overflow:hidden;border-bottom:1px solid var(--line);border-right:0}.toolbox h2,.toolbox-hint,.wire-info{display:none}#tool-list{margin:0;flex-direction:row;justify-content:space-between}.tool-item{min-height:102px;width:20%;padding:0 1px;border:0}.tool-preview{width:65px;height:63px}.tool-item b{font-size:12px}.tool-item small{display:block;margin:0;font-size:11px}.tool-item.ammeter small{font-size:10px}.bench{height:652px;flex:none}.bench-toolbar{height:54px}.bench-actions{gap:5px}.bench-actions .icon-button{width:25px}.bench-actions>button{font-size:11px}#toggle-observation{padding:0}.stage-wrap{min-height:500px}.stage{transform-origin:center center}#empty-state{width:840px}#empty-state h2{font-size:40px}#empty-state p{font-size:24px}#empty-state>svg{width:190px;height:120px}#empty-state button{font-size:26px;height:76px;padding:0 34px}.readouts{height:108px;padding:10px 14px;gap:14px;flex-wrap:wrap;align-content:center}.readout{width:104px}.readout>span{font-size:12px}.readout b{font-size:37px}.circuit-status{gap:0}.switch-button{padding:10px 8px;font-size:12px}.switch-button svg{width:16px}.observation{display:none;width:auto;padding:20px 24px;max-height:none}.observation-open .observation{display:block}.result-title{margin-top:14px}.observation-facts{display:flex;gap:25px;margin-top:14px}.fact{flex:1}.record-button,.remove-bulb{width:auto;margin-top:15px;margin-right:15px}.fault-callout{font-size:20px}.fault-callout>span:not(.fault-leader){font-size:18px}#toast{top:74px;max-width:92vw;width:max-content}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.component-label{top:-29px}.lamp-filament{top:15%}.readout b.over-range{font:500 27px/1.7 -apple-system,BlinkMacSystemFont,'PingFang SC',sans-serif}

.switch-gap{position:absolute;left:24%;top:19%;width:51%;height:20%;background:#2b2e2d;z-index:3;pointer-events:none}.fault-callout{top:250px}

.tool-item.ammeter .tool-preview{width:82px;height:72px}.tool-preview .polarity-mark{font-size:11px}.tool-preview .polarity-mark.minus{top:87%;left:13%}.tool-preview .polarity-mark.plus{top:87%;right:9%}

/* The measurement strip contains only two readings; switch access belongs to the bench toolbar. */
.readouts{height:82px;gap:38px}.readout{width:230px}.readout:last-child{border-right:0}
@media(max-width:1000px){.readout{width:170px}.bench-actions{gap:6px}.bench-actions .switch-button{padding:5px 7px}}
@media(max-width:620px){.bench-toolbar{height:48px;padding:0 10px}.bench-actions .switch-button{font-size:12px}.readouts{height:82px;gap:20px;flex-wrap:nowrap}.readout{width:calc(50% - 10px)}.stage-wrap{min-height:490px}.bench{height:650px}}

body.loading .stage{visibility:hidden;opacity:0}.stage{transform:translate(-50%,-50%) scale(var(--stage-scale,1))}

/* Light stays inside real material; an open circuit has no residual energized frame. */
.bulb:not(.energized) .lamp-filament,.bulb:not(.energized) .lamp-warmth,.ammeter.zero .meter-needle{transition:none}
.component>img{filter:drop-shadow(3px 6px 3px #080f0d80)}
.socket-image{position:absolute;inset:0;visibility:hidden}.bulb-removed .socket-image{visibility:visible}.bulb-assembly{position:relative;transform-origin:50% 42%}.bulb-removed .bulb-assembly{visibility:hidden}.bulb-handling .socket-image{visibility:visible}.bulb-handling .bulb-assembly{clip-path:polygon(0 0,100% 0,100% 39%,62% 39%,62% 47%,40% 47%,40% 39%,0 39%)}.bulb-handling .bulb-grip{pointer-events:none}.bulb-grip{position:absolute;left:31%;top:3%;width:38%;height:43%;border-radius:50%;z-index:6;touch-action:none}.bulb-grip:hover{background:#ffffff08}.bulb-removed .bulb-grip{top:39%;height:26%}
.terminal.heated{background:radial-gradient(#ffd389a0 0,#ff6e3628 25%,transparent 64%);box-shadow:none}

.lamp-filament{background:none;border-radius:0;left:40%;width:20%;height:12%;top:13%;mix-blend-mode:screen}.lamp-filament svg{width:100%;height:100%;stroke:#ffe2a0;stroke-width:1.1;filter:drop-shadow(0 0 2px #ffb55e) drop-shadow(0 0 5px #ff963c80)}
.fault-callout{background:none;border:0;animation:none;color:#e7d7c9}.fault-callout strong{color:#f2c29e}

/* OIL-3: generated incandescent material states and independent movable lamp. */
.component>.socket-image{visibility:visible;position:absolute;inset:0;z-index:1}
.lamp-head{position:absolute;left:32.3%;top:1.4%;width:35.4%;height:57.3%;z-index:2;transform-origin:50% 80%;clip-path:polygon(50% 0,65% 2%,80% 6%,92% 15%,99% 24%,100% 34%,96% 43%,86% 53%,74% 62%,70% 68%,70% 89%,64% 95%,52% 99%,40% 99%,31% 93%,28% 88%,28% 70%,24% 63%,12% 54%,4% 43%,0 34%,2% 22%,12% 12%,30% 3%)}
.lamp-head>img{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none}.lamp-head .lamp-off{filter:brightness(.58) saturate(.75)}
.lamp-head .lamp-filament{background:none;left:0;top:0;width:100%;height:100%;border-radius:0;mix-blend-mode:screen;z-index:2;transition:opacity 180ms ease,filter 180ms ease}
.component>.socket-front{position:absolute;inset:0;clip-path:inset(43% 0 0);z-index:3}.component>.socket-lit{position:absolute;inset:0;z-index:4;clip-path:inset(39% 29% 23%);mask-image:radial-gradient(ellipse at 50% 50%,black 0,black 45%,transparent 72%);filter:none;transition:opacity 180ms ease;pointer-events:none}
.bulb-handling .bulb-assembly{clip-path:polygon(50% 0,65% 2%,80% 6%,92% 15%,99% 24%,100% 34%,96% 43%,86% 53%,74% 62%,70% 68%,70% 89%,64% 95%,52% 99%,40% 99%,31% 93%,28% 88%,28% 70%,24% 63%,12% 54%,4% 43%,0 34%,2% 22%,12% 12%,30% 3%)}
.bulb:not(.energized) .lamp-filament,.bulb:not(.energized) .socket-lit{transition:none}.bulb-removed .lamp-head{visibility:hidden}
.terminal.heated::before{content:'';position:absolute;width:14px;height:25px;left:15px;top:15px;border-radius:5px;background:linear-gradient(#ffcc7399,#ec502a88 62%,#fcab5366);mix-blend-mode:color;pointer-events:none;animation:brass-heat 850ms ease-in both}@keyframes brass-heat{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.lamp-filament,.socket-lit{transition:none}.terminal.heated::before{animation:none}}

/* One action, attached to the knife switch it operates. */
#switch-control[hidden]{display:none}
.component.switch .component-label{left:0;top:-42px;transform:none;align-items:center;height:34px}
.component.switch #switch-control{position:absolute;right:0;top:-42px;height:34px;min-width:128px;padding:0 12px;z-index:9;border:1px solid #bfa37965;background:#343e38;color:#eee9dc;font-size:13px;font-weight:500;box-shadow:0 1px 1px #080f0d50,0 4px 8px #080f0d20;transition:background 180ms,border-color 180ms,transform 180ms}
.component.switch #switch-control:hover:not(:disabled){background:#4a554b;border-color:#cfad7e}
.component.switch #switch-control.on{background:#29382f;border-color:#859c8270;color:#d8e7d9}
.component.switch #switch-control:disabled{opacity:.55}
.component.switch #switch-control svg{width:16px;height:16px}
.component.switch:focus-visible{outline:1px solid #cfad7e;outline-offset:6px;border-radius:5px}
.toolbox .tool-item:hover{background:#e9eef2;border-radius:5px}
.bench-actions .icon-button{width:38px;height:38px}
.readout{border:0}.readout b{font-variant-numeric:tabular-nums}
.terminal.heated{background:radial-gradient(#ffd389a0 0,#ff6e3628 25%,transparent 64%)}
.component.dragging{cursor:grabbing;z-index:5}.component.dragging>img{filter:drop-shadow(4px 10px 5px #080f0d90)}

body.entrance #circuit-canvas,body.entrance #fallback-wires{animation:wire-arrive 400ms ease-out 100ms both}@keyframes wire-arrive{from{opacity:0}to{opacity:1}}
