/* Circuit Lab — experimental, tablet-first circuit workbench. */
#view-circuit-lab:checked ~ .app #circuit-lab{display:block}
#view-circuit-lab:checked ~ .app #circuitLabNav{background:#30291e;color:#f5db9e;box-shadow:inset 3px 0 var(--gold)}
#circuit-lab{min-width:0}
#circuit-lab .section-head{margin-bottom:15px}
#circuit-lab .section-head p{max-width:900px;line-height:1.6}
#circuit-lab .cl-disclaimer{
 border-left:3px solid #be9549;background:var(--panel2);
 border-radius:8px;padding:13px 15px;color:var(--muted);
 line-height:1.65;font-size:12px;margin:0 0 18px
}
#circuit-lab .cl-layout{
 display:grid;grid-template-columns:minmax(0,1fr) minmax(245px,285px);
 gap:14px;align-items:start;max-width:1500px
}
#circuit-lab .cl-work-area,#circuit-lab .cl-tools{min-width:0}
#circuit-lab .cl-work-area{display:grid;gap:15px}
#circuit-lab .cl-tools{display:grid;gap:14px;align-self:start}
#circuit-lab .cl-card{
 background:var(--panel);border:1px solid var(--line);
 border-radius:14px;padding:clamp(12px,2vw,20px);min-width:0;
 display:grid;gap:13px
}
#circuit-lab .cl-card h2{margin:0;font-size:clamp(15px,2vw,19px)}
#circuit-lab .cl-card .cl-small{margin:0;line-height:1.65}
#circuit-lab .cl-small{font-size:12px;color:var(--muted)}
#circuit-lab .cl-row{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
#circuit-lab .cl-header-row{justify-content:space-between;align-items:start}
#circuit-lab .cl-header-row>div{flex:1 1 240px;display:grid;gap:8px}
#circuit-lab .cl-header-row button{min-height:43px}
#circuit-lab .cl-add-row{display:flex;flex-wrap:wrap;gap:8px}
#circuit-lab .cl-add-row button{min-height:44px;white-space:nowrap;font-size:12px}
#circuit-lab .cl-tool-row{padding:7px;border:1px solid var(--line);border-radius:11px;background:var(--panel2)}
#circuit-lab .cl-tool{
 flex:1 1 120px;min-height:47px;border:1px solid transparent;border-radius:9px;
 padding:10px;color:var(--text);font-size:12px;font-weight:730;
 background:transparent;cursor:pointer;line-height:1.35
}
#circuit-lab .cl-tool.cl-tool-active{background:#49391d;color:#ffe0a0;border-color:#b18b49}
#circuit-lab .cl-scroll{
 max-width:100%;min-width:0;overflow:auto;max-height:min(620px,68dvh);border:1px solid #474f58;
 border-radius:13px;background:#171e25;touch-action:pan-x pan-y;
 -webkit-overflow-scrolling:touch;scrollbar-gutter:stable
}
#circuit-lab #clDiagram{
 display:block;width:1000px;height:570px;max-width:none;min-width:1000px;
 background:#171e25;color:#7a8b93;user-select:none;-webkit-user-select:none;touch-action:none
}
#circuit-lab .cl-grid-bg{pointer-events:none}
#circuit-lab .cl-wire-path{fill:none;stroke:#caa35b;stroke-width:5;pointer-events:none;stroke-linecap:round;stroke-linejoin:round}
#circuit-lab .cl-wire-touch{fill:none;stroke:transparent;stroke-width:23;cursor:pointer;pointer-events:stroke;stroke-linecap:round}
#circuit-lab .cl-wire-group.cl-selected .cl-wire-path{stroke:#87d6eb;stroke-width:7}
#circuit-lab .cl-component-body{
 fill:#29333d;stroke:#84909c;stroke-width:2;cursor:grab
}
#circuit-lab .cl-component.cl-active .cl-component-body{stroke:#8ec8a1;fill:#253d35}
#circuit-lab .cl-component.cl-open .cl-component-body{stroke:#e2ac78}
#circuit-lab .cl-component.cl-selected .cl-component-body{stroke:#e7c077;stroke-width:3.5}
#circuit-lab .cl-component-symbol{
 fill:#e9c075;font-size:28px;font-weight:800;dominant-baseline:middle
}
#circuit-lab .cl-device-name{
 fill:#e0e8eb;font-size:13px;font-weight:750;letter-spacing:.015em;
 paint-order:stroke;stroke:#171e25;stroke-width:4px;stroke-linejoin:round
}
#circuit-lab .cl-device-value-bg{
 fill:#252f39;stroke:#6c7985;stroke-width:1.2
}
#circuit-lab .cl-component-value{fill:#e4edf0;font-size:13px;font-weight:800}
#circuit-lab .cl-terminal-hit{
 fill:transparent;stroke:none;cursor:crosshair;pointer-events:all
}
#circuit-lab .cl-terminal{
 fill:#d7dfe2;stroke:#1c2732;stroke-width:3;
 outline:none;pointer-events:none
}
#circuit-lab .cl-terminal-hit:focus{fill:rgba(224,184,101,.2);stroke:#e0b865;stroke-width:2}
#circuit-lab .cl-terminal.cl-terminal-pending{fill:#ffd57a;stroke:#875f19;stroke-width:4}
#circuit-lab .cl-terminal.cl-terminal-probe{fill:#88d7f7;stroke:#2671a2}
#circuit-lab .cl-terminal-label-bg{
 fill:#1b2630;stroke:#a0b0c0;stroke-width:1.2;
 pointer-events:none
}
#circuit-lab .cl-terminal-label{
 fill:#f1f6fa;font-size:13px;font-weight:850;pointer-events:none
}
#circuit-lab .cl-bottom-row label{font-size:12px;color:var(--muted);font-weight:750}
#circuit-lab .cl-bottom-row select{min-height:44px;flex:1 1 200px;min-width:0;font-size:14px}
#circuit-lab .cl-bottom-row button{min-height:44px}
#circuit-lab #clFeedback{padding:11px 13px;background:var(--panel2);border:1px solid var(--line);border-radius:8px}
#circuit-lab .cl-status-box{display:grid;gap:10px;border:1px solid var(--line);border-radius:11px;padding:13px;background:var(--panel2)}
#circuit-lab .cl-status-box>strong{font-size:15px}
#circuit-lab .cl-status-box>p{margin:0;font-size:12px;line-height:1.65;color:var(--muted)}
#circuit-lab .cl-status-powered{border-color:#3c7559;background:#1e332b}
#circuit-lab .cl-status-powered>strong{color:#a5e2b9}
#circuit-lab .cl-status-open{border-color:#88723e}
#circuit-lab .cl-status-open>strong{color:#f2d08a}
#circuit-lab .cl-status-short,#circuit-lab .cl-status-high-current,
#circuit-lab .cl-status-invalid{border-color:#b06261;background:#382829}
#circuit-lab .cl-status-short>strong,#circuit-lab .cl-status-high-current>strong,
#circuit-lab .cl-status-invalid>strong{color:#ffb6b5}
#circuit-lab .cl-metrics{display:grid;gap:6px}
#circuit-lab .cl-metric{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:1px solid var(--line)}
#circuit-lab .cl-metric:last-child{border-bottom:0}
#circuit-lab .cl-metric small{font-size:11px;color:var(--muted)}
#circuit-lab .cl-metric b{font-size:12px;text-align:right;font-variant-numeric:tabular-nums}
#circuit-lab #clMeter{display:grid;gap:10px}
#circuit-lab #clMeter strong{font-size:13px}
#circuit-lab .cl-reading{font:800 clamp(23px,3vw,31px)/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--gold);margin:0;overflow-wrap:anywhere}
#circuit-lab .cl-detail-body{display:grid;gap:12px;min-height:70px}
#circuit-lab .cl-detail-body strong{font-size:14px}
#circuit-lab .cl-detail-body .cl-detail-field{display:grid;gap:7px;color:var(--muted);font-size:12px}
#circuit-lab .cl-detail-body input{min-height:46px;font-size:16px;width:100%}
#circuit-lab .cl-detail-body button{min-height:44px;justify-self:start}
#circuit-lab .cl-help ol{margin:0;padding-left:22px;color:var(--muted);font-size:12px;line-height:1.7;display:grid;gap:10px}
#circuit-lab button:focus-visible,#circuit-lab select:focus-visible,
#circuit-lab input:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
@media(max-width:1140px){
 #circuit-lab .cl-layout{grid-template-columns:minmax(0,1fr)}
 #circuit-lab .cl-tools{position:static;grid-template-columns:repeat(2,minmax(0,1fr))}
 #circuit-lab .cl-tools>.cl-card:first-child{grid-column:1/-1}
 #circuit-lab .cl-card{padding:14px}
}
@media(max-width:620px){
 #circuit-lab .cl-tools{grid-template-columns:1fr}
 #circuit-lab .cl-add-row button{flex:1 1 135px}
 #circuit-lab .cl-tool{flex-basis:90px}
 #circuit-lab .cl-bottom-row label{flex:1 1 100%}
 #circuit-lab .cl-bottom-row button{flex:1 1 130px}
}
:root[data-theme="light"] #circuit-lab .cl-status-powered{background:#eaf8ed}
:root[data-theme="light"] #circuit-lab .cl-status-open{background:#fff8e7}
:root[data-theme="light"] #circuit-lab .cl-status-short,
:root[data-theme="light"] #circuit-lab .cl-status-high-current{background:#fff0ee}
:root[data-theme="light"] #circuit-lab .cl-status-powered>strong{color:#276a40}
:root[data-theme="light"] #circuit-lab .cl-status-short>strong{color:#952f32}

/* 3-way training: visible lamp illumination follows the solver, not switch position alone. */
#circuit-lab .cl-three-way .cl-component-body{stroke:#a78ad0}
#circuit-lab .cl-three-way .cl-component-symbol{fill:#d0b8f2}
#circuit-lab .cl-lamp-on .cl-component-body{
 fill:#635024;stroke:#ffe18f;stroke-width:3.5;
 filter:drop-shadow(0 0 13px rgba(255,215,113,.75))
}
#circuit-lab .cl-lamp-on .cl-component-symbol{
 fill:#fff3bd;filter:drop-shadow(0 0 9px rgba(255,226,122,.95))
}
#circuit-lab .cl-lamp-on .cl-component-value{fill:#fff2b0;font-weight:850}
#circuit-lab .cl-lamp-on .cl-device-value-bg{fill:#5d4925;stroke:#f4cc69}
#circuit-lab .cl-lamp-off .cl-device-value-bg{fill:#252c34;stroke:#72808c}
#circuit-lab .cl-lamp-glow{
 fill:rgba(255,205,84,.26);stroke:rgba(255,223,123,.7);stroke-width:2;
 filter:drop-shadow(0 0 18px rgba(255,216,109,.65))
}
#circuit-lab .cl-lamp-off .cl-component-body{fill:#252b30;stroke:#66727e}
#circuit-lab .cl-lamp-off .cl-component-symbol{fill:#8d9aa5}
#circuit-lab .cl-lamp-off .cl-component-value{fill:#b5bec7}
#circuit-lab .cl-light-indicator{
 border:1px solid #77777f;background:#272c32;border-radius:9px;
 padding:12px 14px;font-size:13px;font-weight:850;letter-spacing:.03em;
 color:#b6c2cb;line-height:1.4
}
#circuit-lab .cl-light-indicator-on{
 color:#ffe2a4;background:#504023;border-color:#e5b762;
 box-shadow:0 0 16px rgba(255,207,114,.18)
}
:root[data-theme="light"] #circuit-lab .cl-light-indicator:not(.cl-light-indicator-on){
 color:#454e58;background:#e8e9ea
}
:root[data-theme="light"] #circuit-lab .cl-light-indicator-on{
 background:#fff1c5;color:#7c5007;border-color:#d4a44f
}

/* Source voltage selector: keep native hidden custom entry truly hidden. */
#circuit-lab .cl-detail-body select{min-height:46px;width:100%;font-size:16px}
#circuit-lab .cl-detail-field[hidden]{display:none!important}

/* Full-viewport Circuit Lab workspace; CSS fallback for iOS browsers which
   do not allow element.requestFullscreen(). */
#circuit-lab .cl-header-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
#circuit-lab .cl-header-actions button{min-height:44px}
#circuit-lab .cl-full-add{display:none;align-items:center;gap:8px;font-size:12px;font-weight:700;color:var(--text)}
#circuit-lab .cl-full-add select{min-height:44px;max-width:230px;min-width:165px;font-size:14px}
body.cl-circuit-fullscreen{overflow:hidden!important}
#circuit-lab.cl-fullscreen,
#circuit-lab:fullscreen{
 position:fixed!important;inset:0!important;z-index:2147483000!important;
 width:100%!important;max-width:none!important;max-height:none!important;
 height:100dvh!important;margin:0!important;
 padding:clamp(10px,1.5vw,18px)!important;box-sizing:border-box!important;
 display:block!important;overflow:auto!important;
 background:var(--bg,#151a20);color:var(--text);overscroll-behavior:contain;
}
#circuit-lab.cl-fullscreen .section-head,
#circuit-lab.cl-fullscreen .cl-disclaimer,
#circuit-lab.cl-fullscreen .cl-help{display:none}
#circuit-lab.cl-fullscreen .cl-add-row{display:none}
#circuit-lab.cl-fullscreen .cl-full-add{display:flex}
#circuit-lab.cl-fullscreen .cl-header-row>div>p{display:none}
#circuit-lab.cl-fullscreen .cl-layout{
 grid-template-columns:minmax(0,1fr) minmax(260px,315px);
 max-width:none;min-height:calc(100dvh - 36px);align-items:stretch
}
#circuit-lab.cl-fullscreen .cl-work-area{grid-template-columns:minmax(0,1fr)}
#circuit-lab.cl-fullscreen .cl-work-area>.cl-card{display:flex;flex-direction:column;height:100%;min-height:0}
#circuit-lab.cl-fullscreen .cl-scroll{min-height:270px;max-height:min(680px,69dvh);overflow:auto}
#circuit-lab.cl-fullscreen #clDiagram{margin:0}
#circuit-lab.cl-fullscreen .cl-tools{position:static;display:flex;flex-direction:column;min-width:0}
#circuit-lab.cl-fullscreen .cl-tools>.cl-card:first-child{grid-column:auto}
#circuit-lab.cl-fullscreen .cl-tools>.cl-card{flex-shrink:0}
#circuit-lab .cl-control .cl-component-body{stroke:#8ca6bb;fill:#25343f}
#circuit-lab .cl-control .cl-component-symbol{font-size:29px;color:#e2cd97}
#circuit-lab .cl-control.cl-coil-on .cl-component-body{stroke:#82d7a7;fill:#254438;stroke-width:3}
#circuit-lab .cl-control.cl-coil-on .cl-component-value{fill:#aef2cb}
#circuit-lab .cl-control .cl-device-value-bg{fill:#24303b}
@media(max-width:820px){
 #circuit-lab.cl-fullscreen .cl-layout{grid-template-columns:minmax(0,1fr);min-height:0}
 #circuit-lab.cl-fullscreen .cl-work-area>.cl-card{min-height:0;height:auto}
 #circuit-lab.cl-fullscreen .cl-scroll{min-height:385px;max-height:calc(100dvh - 285px)}
 #circuit-lab.cl-fullscreen .cl-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 #circuit-lab.cl-fullscreen .cl-tools>.cl-card:first-child{grid-column:1/-1}
}
@media(max-width:560px){
 #circuit-lab.cl-fullscreen .cl-header-row{align-items:center}
 #circuit-lab.cl-fullscreen .cl-header-actions{width:100%;justify-content:space-between}
 #circuit-lab.cl-fullscreen .cl-header-actions>button{flex:1}
 #circuit-lab.cl-fullscreen .cl-full-add{flex:1 1 100%;justify-content:space-between}
 #circuit-lab.cl-fullscreen .cl-full-add select{flex:1;min-width:0}
 #circuit-lab.cl-fullscreen .cl-scroll{max-height:calc(100dvh - 340px);min-height:280px}
 #circuit-lab.cl-fullscreen .cl-tools{grid-template-columns:1fr}
}

/* Live training-only diagnostics for coil ratings and measured supply voltage. */
#circuit-lab .cl-coil-overview{
 display:grid;gap:9px;padding:12px;border:1px solid #966c44;
 border-radius:10px;background:var(--panel2);min-width:0
}
#circuit-lab .cl-coil-overview>strong{font-size:13px;color:#efbd80}
#circuit-lab .cl-coil-overview>p{font-size:12px;color:var(--muted);margin:0;line-height:1.55}
#circuit-lab .cl-coil-alert{
 display:grid;gap:7px;padding:11px;border:1px solid #aa6750;
 background:rgba(176,91,63,.10);border-radius:9px;min-width:0
}
#circuit-lab .cl-coil-alert>strong{color:#f0ab89;font-size:12px}
#circuit-lab .cl-coil-alert>p{
 color:var(--text);font-size:12px;margin:0;line-height:1.55;
 overflow-wrap:anywhere
}
#circuit-lab .cl-coil-alert>button{justify-self:start;min-height:40px}
#circuit-lab .cl-coil-check{
 display:grid;gap:7px;padding:12px;border:1px solid var(--line);
 background:var(--panel2);border-radius:10px;min-width:0
}
#circuit-lab .cl-coil-check>strong{font-size:12px}
#circuit-lab .cl-coil-check>p{
 font-size:12px;color:var(--text);margin:0;line-height:1.5;
 overflow-wrap:anywhere
}
#circuit-lab .cl-coil-check-warning{border-color:#ad7650}
#circuit-lab .cl-coil-check-warning>strong{color:#edb788}
#circuit-lab .cl-coil-check-ok{border-color:#537962}
#circuit-lab .cl-coil-check-ok>strong{color:#99d4a8}
#circuit-lab .cl-control.cl-coil-issue .cl-component-body{
 stroke:#e89a64;stroke-width:3.5;
 filter:drop-shadow(0 0 6px rgba(220,111,67,.3))
}
#circuit-lab .cl-control.cl-coil-issue .cl-component-value{fill:#ffc99e}
:root[data-theme="light"] #circuit-lab .cl-coil-overview>strong,
:root[data-theme="light"] #circuit-lab .cl-coil-check-warning>strong{color:#87411f}
:root[data-theme="light"] #circuit-lab .cl-coil-alert>strong{color:#873f2e}
:root[data-theme="light"] #circuit-lab .cl-coil-check-ok>strong{color:#245e38}

/* Fault-finding mode: separate from the user-edited/saved free-build board. */
#circuit-lab .cl-view-tabs{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin:0 0 14px}
#circuit-lab .cl-view-tabs button{min-height:46px;flex:1 1 170px}
#circuit-lab .cl-view-tabs [aria-pressed="true"]{border-color:var(--gold);box-shadow:inset 0 -2px var(--gold)}
#circuit-lab .cl-view-tabs .btn[aria-pressed="false"]{box-shadow:none}
#circuit-lab .cl-practice-panel{
 border:1px solid #987b4d;border-radius:12px;padding:clamp(12px,2vw,18px);
 display:grid;gap:12px;background:var(--panel2);min-width:0
}
#circuit-lab .cl-practice-panel[hidden]{display:none!important}
#circuit-lab .cl-practice-head{
 display:flex;justify-content:space-between;align-items:center;
 flex-wrap:wrap;gap:10px
}
#circuit-lab .cl-practice-head>div{display:grid;gap:4px;flex:1 1 200px}
#circuit-lab .cl-practice-head h3{font-size:clamp(15px,2vw,19px);margin:0}
#circuit-lab .cl-practice-head select{
 min-height:44px;min-width:180px;max-width:100%;flex:1 1 220px;font-size:14px
}
#circuit-lab .cl-practice-kicker{font-size:11px;letter-spacing:.05em;text-transform:uppercase;color:var(--gold);font-weight:750}
#circuit-lab .cl-practice-complaint{
 border-left:3px solid var(--gold);padding:10px 12px;
 background:var(--panel);font-weight:750;font-size:13px;
 line-height:1.6;margin:0
}
#circuit-lab .cl-practice-record{display:flex;flex-wrap:wrap;gap:7px}
#circuit-lab .cl-practice-record>span{
 padding:6px 9px;border:1px solid var(--line);background:var(--panel);
 border-radius:8px;font-size:11px;font-weight:750
}
#circuit-lab .cl-practice-answers{
 padding:10px;border:1px solid var(--line);border-radius:10px;
 display:grid;gap:8px;min-width:0;margin:0
}
#circuit-lab .cl-practice-answers legend{font-weight:800;font-size:13px;padding:0 6px}
#circuit-lab .cl-practice-answer{
 display:flex;align-items:center;gap:10px;min-height:42px;padding:8px 11px;
 font-size:13px;background:var(--panel);border:1px solid var(--line);
 border-radius:8px;cursor:pointer
}
#circuit-lab .cl-practice-answer:has(input:checked){border-color:var(--gold);background:rgba(197,160,82,.10)}
#circuit-lab .cl-practice-answer input{min-width:20px;min-height:20px;accent-color:var(--gold)}
#circuit-lab .cl-practice-actions{display:flex;flex-wrap:wrap;gap:8px}
#circuit-lab .cl-practice-actions button{min-height:44px}
#circuit-lab .cl-practice-feedback{
 margin:0;font-size:13px;font-weight:750;line-height:1.55;
 padding:11px;border-radius:9px;background:rgba(189,114,66,.12);border:1px solid #aa794e
}
#circuit-lab .cl-practice-correct{background:rgba(88,159,104,.12);border-color:#508e65}
#circuit-lab .cl-practice-hint{
 margin:0;padding:10px 12px;border-left:3px solid #bd9b52;
 font-size:12px;line-height:1.55;background:var(--panel)
}
#circuit-lab .cl-practice-solution{
 display:grid;gap:8px;padding:12px;border:1px solid #4c9464;
 border-radius:9px;background:rgba(63,132,88,.10);
}
#circuit-lab .cl-practice-solution strong{font-size:13px}
#circuit-lab .cl-practice-solution p{margin:0;font-size:12px;line-height:1.6}
#circuit-lab.cl-practice #clAddParts,
#circuit-lab.cl-practice .cl-full-add,
#circuit-lab.cl-practice #clUndo,
#circuit-lab.cl-practice .cl-bottom-row,
#circuit-lab.cl-practice [data-cl-mode="wire"],
#circuit-lab.cl-practice .cl-results-card,
#circuit-lab.cl-practice .cl-details-card,
#circuit-lab.cl-practice .cl-help{display:none!important}
#circuit-lab.cl-practice .cl-layout{grid-template-columns:minmax(0,1fr)}
#circuit-lab.cl-practice .cl-tools{display:none}
#circuit-lab.cl-practice .cl-tool-row [data-cl-mode="probe"]{flex:2 1 145px}
#circuit-lab.cl-fullscreen .cl-view-tabs{margin:0 0 10px}
@media(max-width:620px){
 #circuit-lab .cl-practice-actions button{flex:1 1 140px}
 #circuit-lab .cl-practice-head select{flex:1 1 100%}
 #circuit-lab.cl-practice .cl-board-meter{position:sticky;top:8px}
}

/* Difficulty-first blind troubleshooting. Never show a diagram or a fault name
   until a random exercise has actually been generated. */
#circuit-lab.cl-practice-setup .cl-layout,
#circuit-lab.cl-practice-setup.cl-fullscreen .cl-layout{
 grid-template-columns:minmax(0,1fr);max-width:850px;min-height:0
}
#circuit-lab.cl-practice-setup .cl-board-stage,
#circuit-lab.cl-practice-setup .cl-board-toolbar,
#circuit-lab.cl-practice-setup #clCanvasScroll,
#circuit-lab.cl-practice-setup #clToolModes,
#circuit-lab.cl-practice-setup #clModeHelp,
#circuit-lab.cl-practice-setup #clFeedback,
#circuit-lab.cl-practice-setup .cl-tools{display:none!important}
#circuit-lab.cl-practice-setup.cl-fullscreen .cl-work-area>.cl-card{
 min-height:0;height:auto
}
#circuit-lab.cl-practice .cl-practice-head select{cursor:pointer}

/* Safety interlock for passive resistance / continuity training. */
#circuit-lab .cl-power-row{
 display:flex;align-items:center;flex-wrap:wrap;gap:10px;
 border:1px solid var(--line);border-radius:10px;
 padding:10px 12px;background:var(--panel2)
}
#circuit-lab .cl-power-row button{
 min-height:44px;flex:0 0 auto;max-width:100%;font-weight:750
}
#circuit-lab .cl-power-row .cl-small{flex:1 1 180px;line-height:1.5}
#circuit-lab #clPowerToggle.cl-power-off{border-color:#659873;color:#a6e2ba}
#circuit-lab .cl-meter-warning{
 font-size:12px;line-height:1.65;margin:0;padding:11px;
 background:rgba(177,86,48,.15);border:1px solid #a9794c;
 border-radius:8px;color:var(--text)
}
#circuit-lab .cl-continuity-yes{color:#9ee3b5}
#circuit-lab .cl-continuity-no{color:#ebbd96}
#circuit-lab .cl-ohms-reading{
 margin:0;font:750 clamp(18px,2.2vw,25px)/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;
 font-variant-numeric:tabular-nums;color:var(--text);overflow-wrap:anywhere
}
#circuit-lab .cl-high-resistance{
 margin:0;padding:8px 10px;border:1px solid #ad8150;
 border-radius:8px;background:rgba(173,129,80,.13);
 color:#edc488;font-size:12px;font-weight:850;letter-spacing:.025em
}
:root[data-theme="light"] #circuit-lab .cl-high-resistance{color:#85551c}

#circuit-lab.cl-practice-setup .cl-power-row{display:none!important}
#circuit-lab.cl-fullscreen .cl-power-row{flex-shrink:0}
:root[data-theme="light"] #circuit-lab #clPowerToggle.cl-power-off{color:#22653c}
:root[data-theme="light"] #circuit-lab .cl-continuity-yes{color:#23643a}
:root[data-theme="light"] #circuit-lab .cl-continuity-no{color:#755126}
@media(max-width:560px){
 #circuit-lab .cl-power-row button{flex:1 1 100%}
}

/* Keep the meter in the board row instead of a tall scrolling results column. */
#circuit-lab .cl-board-toolbar{
 display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;
 gap:10px;padding:8px 2px;min-width:0;
}
#circuit-lab .cl-zoom-controls{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
#circuit-lab .cl-zoom-controls button{min-height:44px;min-width:44px}
#circuit-lab .cl-zoom-value{
 min-width:46px;text-align:center;font-size:13px;
 font-weight:800;font-variant-numeric:tabular-nums;color:var(--gold)
}
#circuit-lab .cl-board-stage{
 display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,260px);
 gap:12px;align-items:start;min-width:0
}
#circuit-lab .cl-board-stage>.cl-scroll{width:100%;min-width:0}
#circuit-lab .cl-board-meter{
 position:sticky;top:12px;z-index:2;align-self:start;
 min-width:0;max-height:calc(100dvh - 24px);overflow:auto;
 display:grid;gap:10px;padding:14px;
 box-shadow:0 4px 14px rgba(0,0,0,.13)
}
#circuit-lab .cl-board-meter button{min-height:44px}
#circuit-lab .cl-board-meter #clMeter{overflow-wrap:anywhere}
#circuit-lab .cl-board-meter .cl-reading{font-size:clamp(20px,2.5vw,28px)}
#circuit-lab .cl-board-stage #clDiagram{margin:0}
#circuit-lab.cl-fullscreen .cl-board-stage{
 flex:1 1 auto;min-height:0;align-items:start
}
#circuit-lab.cl-fullscreen .cl-board-meter{top:8px}
@media(max-width:700px){
 #circuit-lab .cl-board-stage{grid-template-columns:minmax(0,1fr)}
 #circuit-lab .cl-board-meter{
  grid-row:1;position:sticky;top:8px;
  max-height:min(220px,34dvh);padding:11px
 }
 #circuit-lab .cl-board-meter .cl-reading{font-size:23px}
 #circuit-lab .cl-board-stage>.cl-scroll{grid-row:2}
 #circuit-lab .cl-zoom-controls{width:100%;justify-content:flex-start}
}

/* Read-only component nameplate shown beside the live meter during fault labs.
   Only rated properties are disclosed, never hidden fault/voltage diagnostics. */
#circuit-lab .cl-nameplate{
 display:grid;gap:7px;min-width:0;padding:12px;
 border:1px solid var(--line);border-radius:10px;background:var(--panel2)
}
#circuit-lab .cl-nameplate>strong{font-size:13px;color:var(--text)}
#circuit-lab .cl-nameplate-rating{
 font:800 clamp(22px,2.4vw,30px)/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;
 color:var(--gold);font-variant-numeric:tabular-nums
}
#circuit-lab .cl-nameplate>.cl-small{line-height:1.5}
#circuit-lab.cl-practice .cl-control .cl-component-body{cursor:pointer}
#circuit-lab.cl-practice .cl-control:focus-visible .cl-component-body{
 stroke:var(--gold);stroke-width:4
}

/* Circuit gestures belong solely to the SVG scroll pane. The sticky meter
   and coil nameplate remain normal, independently scrolling UI regions. */
#circuit-lab #clMeterPanel{
 touch-action:pan-y;overscroll-behavior:contain;
 -webkit-overflow-scrolling:touch
}
#circuit-lab #clMeterPanel button{touch-action:manipulation}

/* Build & Simulate: the board uses the entire wide workspace.
   The meter moves into the right-hand results/selected-component column.
   Troubleshooting retains its separate meter alongside the board. */
#circuit-lab:not(.cl-practice) .cl-board-stage{
 display:block;min-width:0
}
#circuit-lab:not(.cl-practice) .cl-board-stage>.cl-scroll{
 width:100%;min-height:570px;height:min(730px,76dvh);
 max-height:none;grid-row:auto;overflow:auto
}
#circuit-lab:not(.cl-practice) .cl-tools>.cl-board-meter{
 grid-row:auto;position:sticky;top:12px;z-index:3;
 align-self:start;max-height:min(470px,55dvh);width:100%
}
#circuit-lab:not(.cl-practice) .cl-tools>.cl-results-card{
 grid-column:auto
}
#circuit-lab.cl-fullscreen:not(.cl-practice) .cl-board-stage{
 display:block;flex:1 1 auto;min-width:0
}
#circuit-lab.cl-fullscreen:not(.cl-practice) .cl-board-stage>.cl-scroll{
 min-height:360px;height:clamp(410px,calc(100dvh - 250px),900px);
 max-height:none;flex:none
}
@media(max-width:1140px){
 #circuit-lab:not(.cl-practice) .cl-tools>.cl-board-meter{
  grid-column:1/-1;max-height:none
 }
}
@media(max-width:700px){
 #circuit-lab:not(.cl-practice) .cl-board-stage>.cl-scroll{
  min-height:390px;height:min(580px,64dvh)
 }
 #circuit-lab.cl-fullscreen:not(.cl-practice) .cl-board-stage>.cl-scroll{
  min-height:300px;height:min(630px,55dvh)
 }
}
