/* Demo components for lesson pages. Generated from deck.css (scoped to .lab); edit the deck rules, then regenerate. */
.lab .svgfig{background:var(--panel);border:2px solid var(--frame);box-shadow:var(--shadow);border-radius:4px;padding:.6em}
.lab .svgfig svg{display:block;width:100%;height:auto;max-height:50vh}
.lab .svgfig.wide svg{max-height:44vh}
.lab .btn-svg .body{fill:#2b2b2b}
.lab .btn-svg .cap{fill:#3d3d3d;stroke:#555;stroke-width:3}
.lab .btn-svg .legs path{stroke:#9aa3a6;stroke-width:9;stroke-linecap:round;fill:none}
.lab .btn-svg .wire{stroke:var(--sky);stroke-width:6;fill:none;stroke-linecap:round}
.lab .btn-svg .sw{stroke:#fff;stroke-width:6;stroke-linecap:round}
.lab .btn-svg .dot{fill:#fff}
.lab .btn-svg .diag{stroke:var(--orange);stroke-width:4;stroke-dasharray:10 8;fill:none}
.lab .btn-svg text{font:700 22px ui-monospace,Menlo,Consolas,monospace;fill:var(--ink)}
.lab .bounce-svg .axis{stroke:var(--frame);stroke-width:2;fill:none}
.lab .bounce-svg .sig{stroke:var(--blue);stroke-width:4;fill:none;stroke-linejoin:round}
.lab .bounce-svg .zone{fill:var(--orange);opacity:.16}
.lab .bounce-svg text{font:15px 'Miriam Libre',sans-serif;fill:var(--muted)}
.lab .bounce-svg text.z{fill:var(--orange);font-weight:700;font-family:ui-monospace,Menlo,Consolas,monospace}
.lab .mon .serial-out{height:auto;max-height:52vh;font-size:clamp(13px,1.3vw,22px);padding:.6em 1em}
.lab .mon .serial-bar{font-size:clamp(12px,1vw,16px)}
.lab .mon .serial-bar small{margin-left:auto;direction:rtl}
.lab .flip{display:flex;align-items:center;justify-content:center;gap:.5em;flex-wrap:wrap}
.lab .flip div{background:var(--panel);border:2px solid var(--frame);box-shadow:var(--shadow);border-radius:4px;padding:.4em .8em;text-align:center}
.lab .flip span{display:block;font-size:.6em;color:var(--muted)}
.lab .flip b{font-family:ui-monospace,Menlo,Consolas,monospace;color:var(--blue-dark)}
.lab tr.hit td{background:var(--blush)}
/* ── interactive demos (assets/btnsim.js, assets/sim.js) ── */
.lab .sim{border:2px solid var(--frame);box-shadow:var(--shadow);border-radius:4px;overflow:hidden;background:#1f272a;margin:0}
.lab .sim pre.rows{font-size:clamp(12px,1.02vw,18px);line-height:1.38;padding:.5em 0;margin:0}
.lab .sim .row{min-height:1.38em;padding:0 .7em}
.lab .sim .ln{margin-right:.8em;width:1.6em}
.lab .sim .serial-out{height:clamp(86px,15vh,150px);font-size:clamp(12px,.95vw,16px)}
.lab .sim .ev{font-size:clamp(10px,.75vw,13px);margin-left:.8em}
.lab .sim .sim-thermo{padding:.7em .5em;gap:.3em}
.lab .sim .thermo{width:clamp(96px,8vw,140px)}
.lab .sim .sim-readout{font-size:clamp(18px,1.4vw,26px)}
.lab .sim .sim-label{font-size:.7em}
.lab .sim .row.wait{background:rgba(243,156,18,.2);border-left-color:#f39c12}
.lab .sim figure,.lab figure.sim{background:#1f272a}
/* virtual push button */
.lab .vbtn{--s:clamp(64px,5.6vw,96px);width:var(--s);height:var(--s);border-radius:10px;border:0;background:#2b2b2b;box-shadow:0 5px 0 #111,0 7px 12px rgba(0,0,0,.25);cursor:pointer;display:grid;place-items:center;touch-action:none;user-select:none;-webkit-user-select:none;transition:transform .05s,box-shadow .05s;padding:0}
.lab .vbtn i{width:58%;height:58%;border-radius:50%;background:radial-gradient(circle at 40% 35%,#666,#2f2f2f 70%);box-shadow:inset 0 -3px 0 rgba(0,0,0,.4)}
.lab .vbtn.down{transform:translateY(4px);box-shadow:0 1px 0 #111,0 2px 4px rgba(0,0,0,.2)}
.lab .vbtn.down i{background:radial-gradient(circle at 40% 35%,#555,#262626 70%)}
.lab .vbtn:focus-visible,.lab .rocker:focus-visible,.lab [role=button]:focus-visible{outline:3px solid var(--sky);outline-offset:3px}
.lab .vbtn.sm{--s:clamp(48px,4vw,68px)}
.lab .bs-press{display:flex;flex-direction:column;align-items:center;gap:.45em}
.lab .bs-press small,.lab .sw-row small{font-size:.55em;color:var(--muted);text-align:center;line-height:1.2}
.lab .vled{display:inline-block;width:clamp(26px,2.2vw,38px);height:clamp(26px,2.2vw,38px);border-radius:50%;background:radial-gradient(circle at 35% 30%,#d9a7a1,#8a3a33);border:2px solid var(--frame);transition:background .05s,box-shadow .05s}
.lab .vled.on{background:radial-gradient(circle at 35% 30%,#fff3f0,#ff3b2f 55%);box-shadow:0 0 16px 4px rgba(255,59,47,.6)}
/* panel beside the code */
.lab .bsim{grid-template-columns:clamp(150px,11.5vw,200px) minmax(0,1fr)}
.lab .bs-panel{display:flex;flex-direction:column;align-items:center;gap:.55em;padding:.8em .5em;background:var(--blush);border-left:2px solid var(--frame);font-size:.8em}
.lab .bs-led{display:flex;align-items:center;gap:.5em}
.lab .bs-led small{font-size:.65em;color:var(--muted)}
.lab .bs-pin{text-align:center;line-height:1.2}
.lab .bs-pin small{display:block;font-size:.62em;color:var(--muted)}
.lab .bs-pin b{font:700 1em ui-monospace,Menlo,Consolas,monospace;color:var(--blue-dark)}
.lab .vars{direction:ltr;width:100%;font:clamp(11px,.85vw,15px)/1.5 ui-monospace,Menlo,Consolas,monospace;background:var(--panel);border:1.5px solid var(--frame);border-radius:4px;padding:.25em .5em}
.lab .vars div{display:flex;justify-content:space-between;gap:.5em}
.lab .vars span{color:var(--muted)}
.lab .vars b{color:var(--blue-dark)}
.lab .bs-stat{font-size:.7em;text-align:center;line-height:1.2}
.lab .bs-stat b{display:block;font:700 1.9em/1.1 ui-monospace,Menlo,Consolas,monospace;color:var(--orange)}
.lab .speed{display:flex;flex-direction:column;gap:.3em;width:100%}
.lab .speed button,.lab .chip,.lab .pinsel-btns button,.lab .fl-reset,.lab .fl-run,.lab .verify-btn{font:inherit;font-size:.62em;font-weight:700;background:var(--panel);color:var(--ink);border:2px solid var(--frame);border-radius:6px;padding:.25em .6em;cursor:pointer;box-shadow:2px 2px 0 var(--frame)}
.lab .speed button[aria-pressed=true],.lab .pinsel-btns button[aria-pressed=true],.lab .chip[aria-pressed=true]{background:var(--blue);color:#fff}
.lab .waitnote{font-size:.6em;background:#fff4dd;border:1.5px solid #f39c12;border-radius:4px;padding:.25em .45em;text-align:center;line-height:1.3}
/* verify */
.lab .verify .ide-bar{padding:.45em .7em}
.lab .verify .verify-btn{margin-left:auto;font-size:.95em;background:#0ca1a6;color:#fff;border-color:#0b1012;box-shadow:none;padding:.3em .8em}
.lab .verify .row.err{background:rgba(229,57,53,.22);border-left-color:#e53935}
.lab .ide-out{background:#0b1012;color:#dae3e3;font:clamp(12px,.95vw,16px)/1.5 ui-monospace,Menlo,Consolas,monospace;padding:.6em 1em;min-height:4.6em;direction:ltr;text-align:left}
.lab .ide-out .err-line{color:#ff7b72}
.lab .ide-out .ok-line{color:#3fb950}
.lab .ide-out .he-line{direction:rtl;text-align:right;font-family:'Miriam Libre',sans-serif;color:#f6e1de;margin-top:.3em}
.lab .ide-out .muted-line{color:#7f8c8d}
.lab .verify .sim-io{display:flex;flex-direction:column}
.lab figure.verify{display:block}
/* anatomy */
.lab .anatomy .leg{fill:#c9d0d2;stroke:var(--frame);stroke-width:2;cursor:pointer}
.lab .anatomy .leg.sel{fill:var(--orange)}
.lab .anatomy .leg:hover{fill:#f2c09c}
.lab .anatomy .capbtn{cursor:pointer;touch-action:none}
.lab .anatomy .capbtn.down .cap{fill:#555}
.lab .anatomy .probe{stroke:var(--orange);stroke-width:4;stroke-dasharray:10 8;fill:none;pointer-events:none}
.lab .anatomy .probe.closed{stroke-dasharray:none;stroke:#2e9b5f;stroke-width:5}
.lab .anatomy svg.pressed .wire{stroke:#2e9b5f}
.lab .anatomy .lbl text{font:700 22px ui-monospace,Menlo,Consolas,monospace;fill:var(--ink)}
.lab .anatomy .probe-msg{font-size:.65em;min-height:2.6em;padding-top:.3em}
.lab .ok{color:#1d7a46;font-weight:700}
.lab .no{color:var(--muted);font-weight:700}
/* doorbell / light switch */
.lab .switches{margin:0;background:none!important}
.lab .sw-row{display:flex;align-items:center;gap:1em;margin-top:.5em}
.lab .lamp{width:clamp(34px,3vw,52px);height:clamp(34px,3vw,52px);border-radius:50%;background:#e8e2d8;border:2px solid var(--frame);transition:all .08s}
.lab .lamp.on{background:radial-gradient(circle at 40% 35%,#fffbe6,#ffd23f 60%);box-shadow:0 0 22px 6px rgba(255,210,63,.65)}
.lab .rocker{width:clamp(38px,3.2vw,54px);height:clamp(60px,5vw,86px);border-radius:8px;background:#f4f1ea;border:2px solid var(--frame);padding:5px;cursor:pointer;display:flex;align-items:flex-end}
.lab .rocker i{display:block;width:100%;height:50%;border-radius:4px;background:#d8d2c6;box-shadow:inset 0 -3px 0 rgba(0,0,0,.15);transition:all .1s}
.lab .rocker[aria-pressed=true]{align-items:flex-start}
.lab .rocker[aria-pressed=true] i{background:#c8c1b3}
/* pin selector */
.lab .pinsel{margin:.7em 0 0;background:var(--panel)!important;border:2px solid var(--frame);box-shadow:var(--shadow);border-radius:4px;padding:.6em .8em}
.lab .pinsel-btns{display:flex;gap:.5em;align-items:center;flex-wrap:wrap}
.lab .pinsel-btns span{font-size:.75em;font-weight:700}
.lab .pinsel-btns button{font-size:.7em}
.lab .pinsel-read{margin-top:.5em;font-size:.85em}
.lab .pinsel-out{font:700 1.1em ui-monospace,Menlo,Consolas,monospace;color:var(--blue-dark);display:inline-block;min-width:6em}
.lab .pinsel-out.noise{color:var(--orange)}
.lab tr.hit td{background:var(--blush);transition:background .15s}
.lab table[data-edge] tr.hit td{background:#ffe2c4}
/* floating pin */
.lab .floatsim{margin:0;background:none!important}
.lab .fs-ctrl{display:flex;align-items:center;gap:1.2em;margin-bottom:.7em}
.lab .fs-ctrl .chip{font-size:.72em}
.lab .floatsim .ide{margin:0}
.lab .floatsim .serial-out{height:clamp(150px,30vh,300px);font-size:clamp(12px,1.05vw,18px)}
/* flipper */
.lab .flipper{display:flex;flex-direction:column;gap:.6em;align-items:flex-start}
.lab .fl-top{display:flex;align-items:center;gap:.7em;font-size:1.1em}
.lab .fl-val{color:var(--blue-dark)}
.lab .fl-run{font-size:.8em}
.lab .fl-hist{display:flex;gap:.4em;flex-wrap:wrap;min-height:1.6em}
.lab .fl-hist span{font:.62em ui-monospace,Menlo,Consolas,monospace;background:var(--tag);border-radius:50px;padding:.15em .6em}
.lab .fl-reset{font-size:.55em;box-shadow:none}
/* loop counter */
.lab .loopcount{display:flex;flex-direction:column;gap:.6em}
.lab .lc-top{display:flex;align-items:center;justify-content:space-around}
.lab .lc-top .vled{width:clamp(36px,3vw,52px);height:clamp(36px,3vw,52px)}
.lab .lc-out{display:grid;grid-template-columns:1fr auto;gap:.2em .8em;margin:0;font-size:.75em}
.lab .lc-out dt{color:var(--muted)}
.lab .lc-out dd{margin:0;font:700 1em ui-monospace,Menlo,Consolas,monospace;color:var(--blue-dark);text-align:left}
.lab .lc-out dd[data-res]{font-family:inherit;font-size:.9em;color:var(--orange);grid-column:1/-1;text-align:right}
/* bounce scope */
.lab .scope{display:grid;grid-template-columns:minmax(0,1fr) clamp(180px,16vw,260px);gap:1em;align-items:center}
.lab .plots{display:grid;grid-template-columns:1fr 1fr;gap:.6em}
.lab .plot b{font-size:.7em;color:var(--blue-dark)}
.lab .plot svg{width:100%;height:auto;max-height:36vh;display:block;background:#1f272a;border-radius:4px}
.lab .plot .grid{stroke:#434f54;stroke-width:1;stroke-dasharray:4 4;fill:none}
.lab .plot .ticks line{stroke:#7f8c8d}
.lab .plot text{font:13px ui-monospace,Menlo,Consolas,monospace;fill:#9fb0b3}
.lab .plot .sig{stroke:#0ca1a6;stroke-width:3;fill:none;stroke-linejoin:round}
.lab .scope-ctrl{display:flex;flex-direction:column;align-items:center;gap:.5em}
.lab .scope-ctrl dl{display:grid;grid-template-columns:1fr auto;gap:.15em .7em;margin:0;font-size:.7em;width:100%}
.lab .scope-ctrl dd{margin:0;font:700 1.3em ui-monospace,Menlo,Consolas,monospace;color:var(--blue-dark)}
.lab .scope.mismatch [data-seen]{color:var(--orange)}
.lab .scope-ctrl p{font-size:.55em;margin:0}
@media(max-width:900px){.lab .bsim{grid-template-columns:1fr}
.lab .bs-panel{flex-direction:row;flex-wrap:wrap;justify-content:center;border-left:0;border-bottom:2px solid var(--frame)}
.lab .speed{flex-direction:row;width:auto}
.lab .scope,.lab .plots{grid-template-columns:1fr}}
@media print{.lab .bs-panel,.lab .speed,.lab .scope-ctrl .vbtn{display:none}
.lab .bsim{grid-template-columns:1fr}}
.lab .bsim pre.rows,.lab .verify pre.rows{font-size:clamp(13px,1.2vw,21px)}
.lab .bsim .sim-io .serial{flex:1 1 0;min-height:clamp(86px,15vh,150px)}
.lab .bsim .sim-io .serial-out{flex:1 1 0;height:auto;min-height:0}
.lab .lc-out dd[data-dur],.lab .lc-out dd[data-rounds]{direction:ltr;unicode-bidi:isolate}
.lab .sim-thermo .thermo{max-height:34vh}
.lab .sim pre.rows{line-height:1.3}
.lab .sim .row{min-height:1.3em}
.lab .sim .serial-out{height:clamp(70px,12vh,130px)}
.lab .bsim .sim-io .serial{min-height:clamp(70px,12vh,130px)}
.lab .bs-panel{gap:.45em;padding:.6em .5em}
.lab table.tight td,.lab table.tight th{padding:.3em .6em}
.lab .bsim.long pre.rows{font-size:clamp(11px,.95vw,16px);line-height:1.28}
.lab .bsim.long .bs-panel{gap:.3em;padding:.45em .5em}
@media(max-height:760px) and (min-width:901px){.lab .bsim.long pre.rows{line-height:1.18}
.lab .bsim.long .row{min-height:1.18em}}
/* micro switch (slide 23) */
.lab .microsw svg{max-height:46vh}
.lab .micro-svg .mbody{fill:#2f3a40}
.lab .micro-svg .mwin{fill:#1f272a;stroke:#4a5a61;stroke-width:2;stroke-dasharray:6 5}
.lab .micro-svg .plunger{fill:#c9d0d2;stroke:#0b1012;stroke-width:2;transition:y .06s}
.lab .micro-svg .legs rect{fill:#c9a24a;stroke:#7a5f22;stroke-width:1.5}
.lab .micro-svg .w{stroke:#7f8c8d;stroke-width:4;fill:none;stroke-linejoin:round}
.lab .micro-svg .ct{fill:#c9a24a}
.lab .micro-svg .blade{stroke:#e8e2d8;stroke-width:6;stroke-linecap:round}
.lab .micro-svg .pivot{fill:#e8e2d8}
.lab .micro-svg .arm{stroke:#c9d0d2;stroke-width:7;stroke-linecap:round}
.lab .micro-svg .roller{fill:#e8e2d8;stroke:#0b1012;stroke-width:2}
.lab .micro-svg .hit{stroke:transparent;stroke-width:44;stroke-linecap:round}
.lab .micro-svg .hinge{fill:#0b1012;stroke:#c9d0d2;stroke-width:2}
.lab .micro-svg .lever{cursor:pointer;touch-action:none;outline:none}
.lab .micro-svg .lever:focus-visible .arm{stroke:var(--sky)}
.lab .micro-svg .lbl text{font:700 20px ui-monospace,Menlo,Consolas,monospace;fill:var(--ink)}
.lab .micro-svg:not(.pressed) .w-com,.lab .micro-svg:not(.pressed) .w-nc,.lab .micro-svg:not(.pressed) .ct-nc,.lab .micro-svg.pressed .w-com,.lab .micro-svg.pressed .w-no,.lab .micro-svg.pressed .ct-no{stroke:#2e9b5f;fill:none}
.lab .micro-svg:not(.pressed) .ct-nc,.lab .micro-svg.pressed .ct-no{fill:#2e9b5f;stroke:none}
.lab .micro-svg:not(.pressed) .blade,.lab .micro-svg.pressed .blade{stroke:#3fb950}
.lab .micro-msg{font-size:.65em;padding-top:.3em;min-height:1.6em}
.lab .micro-note{font-size:.5em;color:var(--muted);margin:.2em 0 0}
.lab .micro-note b{color:var(--orange)}
.lab .micro-svg .lever[role=button]:focus-visible,.lab .anatomy .capbtn[role=button]:focus-visible{outline:none}
.lab .micro-svg .lever:focus-visible .arm{stroke:#c9d0d2}
.lab .micro-svg .lever:focus-visible .roller,.lab .anatomy .capbtn:focus-visible .cap{stroke:var(--sky);stroke-width:4}
/* homework examples (slide 22) */
/* DIY switch principles (slide 23) */
.lab .sw-parts{padding-right:1.1em;margin:.3em 0 .6em}
.lab .sw-parts li{margin-bottom:.35em}
.lab .swlab{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.7em}
.lab figure.sw-demo{margin:0;padding:0;display:flex;flex-direction:column;background:var(--panel);border:2px solid var(--frame);box-shadow:var(--shadow);border-radius:4px;overflow:hidden}
.lab .sw-stage{position:relative;background:#f7f3ec;border-bottom:2px solid var(--frame)}
.lab .sw-svg{display:block;width:100%;height:clamp(64px,13vh,130px);touch-action:none}
.lab .sw-lamp{position:absolute;top:6px;left:6px;width:14px;height:14px;border-radius:50%;background:#e8e2d8;border:2px solid var(--frame)}
.lab .sw-demo.closed .sw-lamp{background:#ffd23f;box-shadow:0 0 10px 3px rgba(255,210,63,.7)}
.lab .sw-ctrl{padding:.25em .6em 0;min-height:1.6em;font-size:.55em;display:flex;align-items:center}
.lab .sw-ctrl label{display:flex;align-items:center;gap:.5em;width:100%;font-weight:700}
.lab .sw-ctrl input[type=range]{flex:1;accent-color:var(--blue);direction:ltr}
.lab .sw-ctrl .chip{font-size:1em}
.lab .sw-demo figcaption{padding:.2em .6em .45em;font-size:.55em;line-height:1.35;text-align:right;display:flex;flex-direction:column;gap:.1em}
.lab .sw-demo figcaption b{font-size:1.15em;color:var(--blue-dark)}
.lab .sw-svg .cond{fill:#c97b3a}
.lab .sw-svg .cond-line{stroke:#c97b3a;stroke-width:6;fill:none;stroke-linecap:round}
.lab .sw-demo.closed .cond{fill:#2e9b5f}
.lab .sw-demo.closed .cond-line{stroke:#2e9b5f}
.lab .sw-svg .spacer{fill:#e8d9b5;stroke:#b9a77c}
.lab .sw-svg .hint{font:12px 'Miriam Libre',sans-serif;fill:var(--muted)}
.lab .sw-svg[role=button]{cursor:pointer;outline:none}
.lab .sw-svg[role=button]:focus-visible{outline:3px solid var(--sky);outline-offset:-3px}
.lab .sw-svg .glass{fill:rgba(81,158,198,.12);stroke:#9fb0b3;stroke-width:2}
.lab .sw-svg .mtext{font:700 12px ui-monospace,monospace;fill:#fff}
.lab .sw-svg .fulcrum{fill:#4a4848}
.lab .sw-svg .tube{fill:rgba(81,158,198,.12);stroke:#4a4848;stroke-width:2}
.lab .sw-svg .ball circle{fill:#8a949a;stroke:#4a4848;stroke-width:1.5}
.lab .sw-svg .ball{transition:transform .35s ease-in}
.lab .sw-svg .bracket{fill:#4a4848}
.lab .sw-svg .head,.lab .sw-svg .shaft{fill:#9aa3a6;stroke:#4a4848;stroke-width:1.5}
.lab .sw-svg .thread{stroke:#4a4848;stroke-width:1.5}
.lab .sw-demo.closed .sw-svg .shaft,.lab .sw-demo.closed .sw-svg .head{fill:#7cc59a}
.lab .sw-svg .cond-ring{fill:none;stroke:#c97b3a;stroke-width:5}
.lab .sw-demo.closed .cond-ring{stroke:#2e9b5f}
.lab .sw-svg .weight{fill:#9aa3a6;stroke:#4a4848;stroke-width:1.5}
.lab .sw-demo.closed .sw-svg .weight{fill:#7cc59a}
.lab .sw-svg .pivot{fill:#4a4848}
.lab .sw-svg .slot{fill:#e8e2d8;stroke:#4a4848;stroke-width:2}
.lab .sw-svg .coin{transition:transform .3s ease-in}
.lab .sw-svg .coin circle{fill:#d9b24a;stroke:#8a6d1f;stroke-width:2}
.lab .sw-svg .coin text{font:700 18px sans-serif;fill:#8a6d1f}
@media(max-width:900px){.lab .swlab{grid-template-columns:repeat(2,minmax(0,1fr))}}
.lab .swlab:has(.sw-micro:not([hidden])){grid-template-columns:repeat(3,minmax(0,1fr)) minmax(0,1.15fr)}
.lab figure.sw-micro[hidden]{display:none}
.lab figure.sw-micro{grid-column:4;grid-row:1/span 2}
.lab .sw-micro .sw-stage{flex:1;display:flex;align-items:center}
.lab .sw-micro .micro-svg{display:block;width:100%;height:auto;max-height:34vh;touch-action:none}
@media(max-width:900px){.lab figure.sw-micro{grid-column:auto;grid-row:auto}}
/* page-level container */
.lab{font-size:clamp(17px,1.5vw,22px);line-height:1.5;margin:18px 0}
.lab .panel{background:var(--panel);border:2px solid var(--frame);box-shadow:var(--shadow);border-radius:4px;padding:.9em 1.1em}
.lab figure{margin:0}
.lab .muted{color:var(--muted)}
.lab .cols{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1em}
@media(max-width:700px){.lab .cols{grid-template-columns:1fr}}

