/* =========================================================
   Lab simulators — labs/electronics.html, labs/chemistry.html
   ========================================================= */

.lab-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lab-col { display: flex; flex-direction: column; gap: 16px; }
.lab-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 1.05rem; }
.lab-card h3 small { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.lab-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 86px; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 0.88rem; }
.lab-row label { color: var(--muted); font-weight: 600; }
.lab-row input[type="range"] { width: 100%; accent-color: var(--primary); }
.lab-row output, .lab-value { font: 700 0.86rem "JetBrains Mono", ui-monospace, monospace; text-align: right; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lab-chips .chip { font-size: 0.82rem; }
.lab-note { margin: 8px 0 0; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.lab-select { min-width: 0; max-width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 600 0.85rem var(--font-ui); }

/* Instrument bodies: dark panels like real lab gear */
.instrument { background: #1f2329; color: #e9eef3; border: 1px solid #2f353d; }
.instrument h3 { color: #e9eef3; }
.instrument h3 small, .instrument .lab-row label, .instrument .lab-note { color: #9aa6b2; }
.instrument .chip { background: #2a3038; color: #dfe6ec; border-color: #3a424c; }
.instrument .chip.is-active { background: #5dadec; color: #0d1b26; border-color: #5dadec; }
.instrument .lab-select { background: #2a3038; color: #e9eef3; border-color: #3a424c; }

.scope-screen { width: 100%; aspect-ratio: 10 / 8; display: block; border-radius: 10px; background: #08140c; box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8); }
.scope-meas { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-top: 10px; font: 600 0.8rem "JetBrains Mono", ui-monospace, monospace; }
.scope-meas span { padding: 5px 8px; border-radius: 6px; background: #2a3038; }
.scope-meas .ch1 { color: #f7e463; }
.scope-meas .ch2 { color: #5dd3ff; }
.lcd {
  padding: 10px 14px; border-radius: 8px; background: #9fb08a; color: #1d2616;
  font: 700 2rem "JetBrains Mono", ui-monospace, monospace; text-align: right; letter-spacing: 0.04em;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
}
.lcd small { font-size: 1rem; }
.led-lamp { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto; background: #4a1010; border: 3px solid #2a2f36; transition: background 0.2s, box-shadow 0.2s; }

/* Circuit diagram */
.circuit-svg { width: 100%; height: auto; display: block; }
.circuit-svg text { font: 600 12px var(--font-ui); fill: currentColor; }

/* Resistor colour code */
.resistor-svg { width: 100%; max-width: 360px; display: block; margin: 0 auto 10px; }
.band-pickers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }

/* Component shelf */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.shelf-item { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; padding: 12px; }
.shelf-item .shelf-emoji { font-size: 1.8rem; line-height: 1; }
.shelf-item h4 { margin: 0 0 3px; font-size: 0.92rem; }
.shelf-item p { margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }

/* ---------- Chemistry ---------- */
.bench { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 30px; min-height: 300px; padding: 20px; border-radius: var(--radius); background: linear-gradient(180deg, #e8eef2 0 78%, #b9a58a 78%); }
:root[data-theme="dark"] .bench { background: linear-gradient(180deg, #1d252c 0 78%, #4a3c2c 78%); }
.flask-svg, .burette-svg, .tube-svg, .beaker-svg { display: block; }
.liquid { transition: fill 0.5s, height 0.3s, y 0.3s; }
.ph-meter { min-width: 120px; }
.ph-scale { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #e53935, #fb8c00, #fdd835, #7cb342, #43a047, #00897b, #1e88e5, #3949ab, #6a1b9a); position: relative; margin-top: 8px; }
.ph-scale i { position: absolute; top: -4px; width: 4px; height: 20px; border-radius: 2px; background: #111; transform: translateX(-2px); transition: left 0.3s; }
.chem-chart { width: 100%; height: 240px; display: block; border-radius: var(--radius-sm); background: var(--surface-2); }
.reaction-box { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.reaction-result { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.reaction-result .eq { font: 600 0.95rem "JetBrains Mono", ui-monospace, monospace; }
.bubble { animation: bubble-up 1.4s ease-in infinite; }
@keyframes bubble-up { from { transform: translateY(0); opacity: 0.9; } to { transform: translateY(-60px); opacity: 0; } }
.flame { transform-origin: 50% 100%; animation: flicker 0.25s ease-in-out infinite alternate; }
@keyframes flicker { to { transform: scaleY(1.12) scaleX(0.94); } }
.safety { border-left: 4px solid #e53935; }

@media (max-width: 900px) {
  .lab-grid { grid-template-columns: minmax(0, 1fr); }
  .lab-row { grid-template-columns: 90px minmax(0, 1fr) 76px; }
  .bench { gap: 14px; }
}

/* =========================================================
   Lab bench mode (labs/bench.js): breadboard + instruments
   The instrument boxes are cream-coloured like the real bench gear.
   ========================================================= */
.lab-modes { max-width: 520px; margin-top: 18px; }
.bench-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.bench-main, .bench-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bench-side { position: sticky; top: 76px; max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); overflow: auto; }
.bench-status { margin: 0 0 8px; font-weight: 700; color: var(--primary-text); min-height: 1.4em; }
.bench-group { margin-bottom: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.bench-group summary { padding: 8px 10px; font-weight: 700; cursor: pointer; }
.bench-group .chip-row { padding: 2px 10px 10px; }
#benchPalette .chip, #benchCables .chip { font-size: 0.8rem; }
#benchPalette .chip b { font-family: "JetBrains Mono", ui-monospace, monospace; margin-right: 3px; }
#benchPalette .panel-title:not(:first-child) { margin-top: 14px; }
.bench-dot { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 50%; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, 0.3); }
#benchCables { margin-top: 8px; }
#benchInspector label { display: block; margin-bottom: 8px; font-size: 0.86rem; font-weight: 700; }

/* Breadboard */
.bb-svg { width: 100%; height: auto; display: block; user-select: none; }
.bb-base { fill: #f4f1e6; stroke: #cfc9b6; stroke-width: 2; }
.bb-gap { fill: #e2dcc8; }
.bb-hole { fill: #3a3a3a; cursor: pointer; }
.bb-hole:hover { fill: #1e88e5; }
.bb-hole.is-picked { fill: #ff9800; stroke: #ff9800; stroke-width: 3; }
.bb-text { font: 700 9px Inter, sans-serif; text-anchor: middle; fill: #666; pointer-events: none; }
.bb-num { fill: #999; }
.bb-tag { fill: #111; font-size: 8px; paint-order: stroke; stroke: #f4f1e6; stroke-width: 3px; }
/* No name over a plugged cable end: it covered the holes around it. The cable keeps its colour, and the
   socket it comes from is named on the instrument; the Vin / Vout flags stay. */
.bb-plug .bb-tag { display: none; }
.bb-pinname { fill: #b23; font-size: 8px; }
.bb-label { fill: #111; font-size: 10px; }
.bb-wire { fill: none; stroke-width: 3.5; stroke-linecap: round; pointer-events: none; }
.bb-plug { pointer-events: none; }
.bb-leg { stroke: #8d8d8d; stroke-width: 2.5; stroke-linecap: round; }
.bb-pin { fill: #c9c9c9; stroke: #555; }
.bb-body { fill: #ffe9b0; stroke: #8a6d1f; stroke-width: 1.2; }
.bb-part { cursor: pointer; }
.bb-part.is-selected .bb-body { fill: #b9e3ff; stroke: #0b6fb3; stroke-width: 2.2; }
.bb-part.is-selected .bb-leg { stroke: #0b6fb3; }
.bb-part.is-dead .bb-body { fill: #555; }
.bb-part.is-dead .bb-label { fill: #fff; }
.is-placing .bb-part { pointer-events: none; }

/* Instruments */
.bench-instruments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.bench-box { padding: 14px; border-radius: 12px; background: #ebe7da; color: #23262b; border: 1px solid #c9c3b0; box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(0, 0, 0, 0.15); }
.bench-scope { grid-column: 1 / -1; background: #e9ebee; }
.bench-box h3 { margin: 0 0 8px; font-size: 0.95rem; color: #1d3a8a; text-transform: uppercase; letter-spacing: 0.04em; }
.bench-box h3 small { float: right; color: #595959; font-weight: 600; text-transform: none; letter-spacing: 0; }
.bench-box label { display: block; margin-top: 8px; font-size: max(12px, 0.72rem); font-weight: 800; color: #1d3a8a; letter-spacing: 0.04em; }
.bench-box .chip { background: #f7f4ea; color: #23262b; border-color: #b9b29c; font-size: 0.82rem; }
.bench-box .chip.is-active { background: #1d3a8a; color: #fff; border-color: #1d3a8a; }
.bench-lcd { margin-bottom: 8px; padding: 8px 12px; border-radius: 6px; background: #0c1a0c; color: #5cff4a; font: 700 1.5rem "JetBrains Mono", ui-monospace, monospace; text-align: right; min-height: 1.6em; }
.bench-lcd--red { color: #ff4a3d; background: #1a0c0c; }
.bench-lcd--grey { color: #1c2418; background: #a9b59c; }
.bench-num { display: grid; grid-template-columns: 1fr 78px auto; gap: 6px; align-items: center; margin-top: 3px; }
.bench-num input[type="range"] { width: 100%; accent-color: #1d3a8a; }
.bench-num input[type="text"] { width: 100%; padding: 4px 6px; border: 1px solid #b9b29c; border-radius: 6px; background: #fff; color: #111; font: 700 0.82rem "JetBrains Mono", ui-monospace, monospace; text-align: right; }
.bench-num b { font-size: 0.78rem; min-width: 1.4em; }
#benchInspector .bench-num input[type="text"] { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.bench-ports { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.bench-port { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 6px; border: 0; background: none; color: #23262b; font: 700 max(12px, 0.68rem) Inter, sans-serif; cursor: pointer; }
.bench-port i { width: 26px; height: 26px; border-radius: 50%; border: 5px solid #d32f2f; background: #2b2b2b; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.bench-port--bnc i { border: 5px solid #b9bcc2; background: radial-gradient(circle, #d8b24a 0 22%, #f4f4f4 24% 48%, #777 50%); }
.bench-port.is-black i { border-color: #1b1b1b; }
.bench-port.is-blue i { border-color: #1e63c8; }
.bench-port:hover i, .bench-port.is-picked i { outline: 3px solid #ff9800; outline-offset: 2px; }
.bench-port em { font-style: normal; color: #0b6fb3; }
#benchScope { width: 100%; height: auto; display: block; border-radius: 8px; border: 6px solid #2e3440; }
.bench-read { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font: 700 0.8rem "JetBrains Mono", ui-monospace, monospace; }
.bench-read .ch1, .bench-row .ch1 { color: #8a7400; }
.bench-read .ch2, .bench-row .ch2 { color: #0b6fb3; }
.bench-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 14px; }
.bench-row select { display: block; width: 100%; margin-top: 3px; padding: 5px 6px; border: 1px solid #b9b29c; border-radius: 6px; background: #fff; color: #111; font: 700 0.82rem Inter, sans-serif; }
@media (max-width: 900px) {
  .bench-layout, .bench-instruments { grid-template-columns: minmax(0, 1fr); }
  .bench-side { position: static; max-height: none; }
}

/* =========================================================
   "Good one" tab (labs/bench-pro.js): drawn parts, sockets above the board, cables you pull
   ========================================================= */
.lab-modes { max-width: 720px; }
.is-pro .bench-ports, .is-pro #benchCables, .is-pro #benchStatus { display: none; }   /* the sockets are on the board picture instead */
.pro-svg { touch-action: none; }
.pro-shelf { fill: #ebe7da; stroke: #c9c3b0; stroke-width: 2; }
.pro-group { text-anchor: start; fill: #1d3a8a; font-size: 8.5px; letter-spacing: 0.08em; }
.pro-socket { cursor: grab; }
.pro-socket-name { fill: #333; font-size: 7.5px; }
.pro-socket-glow { fill: var(--c); opacity: 0; transition: opacity 0.2s; }
.pro-socket:hover .pro-socket-glow { opacity: 0.3; }
.pro-socket.is-used .pro-socket-glow { opacity: 0.22; }
.pro-socket.is-live .pro-socket-glow { opacity: 0.55; filter: blur(2.5px); animation: pro-pulse 1.6s ease-in-out infinite; }
@keyframes pro-pulse { 50% { opacity: 0.2; } }
.pro-wire-line { fill: none; stroke-width: 4; stroke-linecap: round; }
.pro-wire-shadow { fill: none; stroke: rgba(0, 0, 0, 0.28); stroke-width: 6; stroke-linecap: round; transform: translate(1.5px, 2.5px); }
.pro-wire-flow { fill: none; stroke: rgba(255, 255, 255, 0.75); stroke-width: 1.4; stroke-dasharray: 3 11; stroke-linecap: round; animation: pro-flow 0.9s linear infinite; pointer-events: none; }
@keyframes pro-flow { to { stroke-dashoffset: -14; } }
.pro-wire { cursor: pointer; }
.pro-wire.is-on .pro-wire-line { filter: drop-shadow(0 0 2.5px rgba(255, 255, 255, 0.7)); }
.pro-plug { cursor: grab; }
.pro-plug-top { pointer-events: none; }
.pro-drag-wire { pointer-events: none; stroke-dasharray: 7 5; opacity: 0.9; }
.pro-aim { fill: none; stroke: #ff9800; stroke-width: 2.5; pointer-events: none; }
.pro-click-ring { fill: none; stroke: #ffeb3b; stroke-width: 3; pointer-events: none; animation: pro-ring 0.6s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes pro-ring { to { transform: scale(4); opacity: 0; } }
.pro-part { cursor: grab; }
.pro-part.is-dragging { cursor: grabbing; opacity: 0.85; }
.pro-hit { fill: transparent; stroke: transparent; }
.pro-part:hover .pro-hit { fill: rgba(30, 136, 229, 0.08); }
.pro-part.is-selected .pro-hit { fill: rgba(30, 136, 229, 0.14); stroke: #1e88e5; stroke-width: 1.4; stroke-dasharray: 4 3; }
.bb-value { fill: #333; font-size: 8px; paint-order: stroke; stroke: #f4f1e6; stroke-width: 2.5px; }
.bb-pinname { font-size: max(12px, 8px); font-weight: 800; paint-order: stroke; stroke: #f4f1e6; stroke-width: 2.5px; }
.bench-spin { transform-box: fill-box; transform-origin: center; animation: pro-flow 0.5s linear infinite, bench-turn 0.6s linear infinite; }
@keyframes bench-turn { to { transform: rotate(360deg); } }
/* the parts shelf: little pictures, names underneath */
.pro-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; margin: 6px 0 10px; }
.bench-group .pro-tiles { padding: 0 8px 8px; margin: 0; }
.pro-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--border); border-radius: 10px; background: #f4f1e6; color: #222; font: 600 max(12px, 0.62rem)/1.2 var(--font-ui); text-align: center; cursor: grab; touch-action: none; }
.pro-tile svg { width: 100%; height: 44px; pointer-events: none; }
.pro-tile:hover, .pro-tile.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-tint); }
.pro-ghost { position: fixed; z-index: 500; width: 96px; height: 70px; margin: -40px 0 0 -48px; pointer-events: none; display: none; filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.4)); }
.pro-tools { margin-bottom: 10px; }
/* the four demonstration pictures */
.pro-demo { margin: 0 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 0 14px; }
.pro-demo summary { padding: 11px 0; font-weight: 700; cursor: pointer; }
.pro-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding-bottom: 14px; }
.pro-step { position: relative; padding: 8px; border-radius: 12px; background: #f4f1e6; color: #222; font-size: 0.78rem; font-weight: 600; text-align: center; }
.pro-step svg { display: block; width: 100%; height: 76px; }
.pro-step b { position: absolute; top: 6px; left: 8px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #1d3a8a; color: #fff; font-size: max(12px, 0.72rem); }
.pro-demo-arrow { fill: none; stroke: #1d3a8a; stroke-width: 2; stroke-dasharray: 4 3; }
.lab-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lab-modes button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =========================================================
   Lab bench, real-bench order: 1 generator, 2 supply + meter, 3 oscilloscope, 4 breadboard.
   Cables are drawn on a clear sheet (.bench-wires) over the whole bench.
   ========================================================= */
.bench-flow { position: relative; display: flex; flex-direction: column; gap: 16px; }
.bench-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 6; }
.bw-line { fill: none; stroke-width: 4.5; stroke-linecap: round; opacity: 0.85; }
.bw-shadow { fill: none; stroke: rgba(0, 0, 0, 0.25); stroke-width: 7; stroke-linecap: round; transform: translate(2px, 3px); }
.bw-flow { fill: none; stroke: rgba(255, 255, 255, 0.8); stroke-width: 1.5; stroke-dasharray: 3 11; stroke-linecap: round; animation: pro-flow 0.9s linear infinite; }
.bw-held { stroke-dasharray: 9 6; opacity: 1; }
.is-pro .bench-instruments { order: 3 !important; }
.is-pro .bench-nav, .is-pro .bench-wires, .is-pro .bench-stage-n, .is-pro #benchBoardTools { display: none; }

/* the strip that stays on top: where you are, and what is in your hand */
.bench-nav { position: sticky; top: 70px; z-index: 20; padding: 8px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
.bench-steps { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
.bench-steps button { display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font: 700 0.8rem var(--font-ui); white-space: nowrap; cursor: pointer; }
.bench-steps button:hover { border-color: var(--primary); }
.bench-steps b, .bench-stage-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #1d3a8a; color: #fff; font: 800 0.78rem var(--font-ui); flex: none; }
.bench-steps i { color: var(--muted); font-style: normal; }
.bench-nav .bench-status { margin: 6px 0 0; font-size: 0.86rem; min-height: 0; }
.bench-status.is-busy { padding: 6px 10px; border-radius: 10px; background: #fff3cd; color: #5f4200; }
.bench-stage-n { margin-right: 6px; vertical-align: 1px; }

/* instruments */
.bench-gen { grid-column: 1 / -1; }
.bench-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 6px 22px; align-items: start; }
.bench-lcd small { font-size: max(12px, 0.6em); opacity: 0.85; }
.bench-decade { float: right; display: inline-flex; gap: 4px; }
.bench-decade button, .bench-knob button { padding: 2px 9px; border: 1px solid #8f8a78; border-radius: 6px; background: linear-gradient(#fdfbf3, #d9d4c2); color: #23262b; font: 800 0.78rem var(--font-ui); cursor: pointer; }
.bench-decade button:active, .bench-knob button:active { background: #c9c3b0; }
.bench-knob { display: grid; grid-template-columns: 38px 1fr 38px; gap: 6px; align-items: center; margin-top: 3px; }
.bench-knob button { padding: 6px 0; font-size: 0.9rem; }
.bench-knob output { padding: 5px 6px; border-radius: 6px; background: #10161c; color: #dfe9f2; font: 700 0.84rem "JetBrains Mono", ui-monospace, monospace; text-align: center; }
.psu-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.psu-meters .bench-lcd { margin-bottom: 6px; font-size: 1.25rem; }
.psu-lamps { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bench-lamp { display: inline-flex; align-items: center; gap: 5px; font: 800 max(12px, 0.7rem) var(--font-ui); color: #666; }
.bench-lamp::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: #2c4a2c; border: 1px solid #222; }
.bench-lamp--red::before { background: #4a2020; }
.bench-lamp.is-on { color: #111; }
.bench-lamp.is-on::before { background: #4cff4c; box-shadow: 0 0 8px #4cff4c; }
.bench-lamp--red.is-on::before { background: #ff4033; box-shadow: 0 0 8px #ff4033; }
.bench-hint { margin: 8px 0 0; flex-basis: 100%; font-size: 0.76rem; line-height: 1.4; color: #555; }
#benchBoardTools .bench-hint { color: var(--muted); margin-top: 2px; }
.scope-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(230px, 1fr); gap: 14px; align-items: start; }
.scope-panel { display: flex; flex-direction: column; gap: 8px; }
.scope-block { padding: 8px 10px; border-radius: 10px; background: #dcdfe4; border: 1px solid #c2c6cd; }
.scope-block.ch1 { border-left: 5px solid #d8b800; }
.scope-block.ch2 { border-left: 5px solid #1e88e5; }
.scope-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.scope-head b { font-size: max(12px, 0.74rem); letter-spacing: 0.06em; color: #1d3a8a; }
.scope-head .chip-row { gap: 4px; }
.scope-block .chip { padding: 3px 9px; font-size: max(12px, 0.74rem); }
.bench-box .chip.is-stop { background: #d32f2f; color: #fff; border-color: #d32f2f; }
.bench-read { flex-direction: column; gap: 3px; font-size: max(12px, 0.72rem); }

/* sockets: the ones a cable in the hand fits blink; a used one shows where it goes */
.bench-port { border-radius: 10px; }
.bench-port.is-fit i { outline: 3px solid #ff9800; outline-offset: 2px; animation: bench-blink 0.9s ease-in-out infinite; }
:root[data-gfx="low"] .bench-port.is-fit i { outline: 4px solid #ff9800 !important; }
@keyframes bench-blink { 50% { outline-color: transparent; } }
.bench-port.is-used i { box-shadow: 0 0 0 3px rgba(11, 111, 179, 0.35); }

/* board */
#benchBoard { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.is-pro #benchBoard .bb-svg { width: 100% !important; }
.bb-strip { stroke: #43a047; stroke-width: 12; stroke-linecap: round; opacity: 0.17; pointer-events: none; }
.bench-boardtools { align-items: center; margin-bottom: 8px; }
.bench-boardtools .chip { font-size: 0.78rem; }
.bench-zoom { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; }
.bench-zoom .chip { min-width: 34px; font-size: 1rem; font-weight: 800; }
.bench-zoom .chip:disabled { opacity: 0.4; }
#benchBoard:not(.is-placing) .bb-hole { cursor: default; }
.is-placing .bb-hole { fill: #1b1b1b; }
.is-placing .bb-hole:hover { fill: #ff9800; stroke: #ff9800; stroke-width: 4; }

/* the selected part, right under the board */
.bench-inspector { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.bench-inspector .panel-title { margin-top: 0; }
.bench-none { margin: 0; }
.bench-value { margin-bottom: 12px; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.bench-value-head { display: grid; grid-template-columns: 1fr 44px minmax(90px, auto) 44px; gap: 8px; align-items: center; font-weight: 700; font-size: 0.9rem; }
.bench-value-head output { padding: 6px 10px; border-radius: 8px; background: #10161c; color: #5cff4a; font: 700 1.05rem "JetBrains Mono", ui-monospace, monospace; text-align: center; white-space: nowrap; }
.bench-pm { height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font: 800 1.3rem var(--font-ui); cursor: pointer; }
.bench-pm:hover { border-color: var(--primary); }
.bench-bands { display: block; width: 150px; max-width: 100%; margin: 8px auto 0; }
.bench-presets { margin-top: 8px; gap: 5px; }
.bench-presets .chip { padding: 4px 9px; font-size: 0.76rem; }
.bench-move { align-items: center; margin-bottom: 8px; }
.bench-move span { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.bench-move .chip { font-size: 0.8rem; }

@media (max-width: 900px) {
  .bench-cols, .scope-body { grid-template-columns: minmax(0, 1fr); }
  .bench-nav { top: 62px; padding: 6px 8px; }
  .bench-steps button span { display: none; }
  .bench-steps button { padding: 4px; }
  .bench-nav .bench-status { font-size: 0.8rem; }
  .bench-value-head { grid-template-columns: 1fr 40px minmax(80px, auto) 40px; }
}

/* ---------- Lab bench: coloured connections, 3D view, folded instruments ---------- */
.bb-netstrip { stroke-width: 13; stroke-linecap: round; opacity: 0.5; pointer-events: none; }
.bb-hole.is-net { stroke-width: 2.2; }
.bench-nets { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.bench-nets h4 { margin: 0 0 4px; }
.bench-nets .bench-hint { color: var(--muted); margin: 0 0 8px; }
.bench-nets ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.bench-nets li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; padding: 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 0.82rem; line-height: 1.45; }
.bench-nets li i { width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.25); }
.bench-nets code { font: 700 0.8rem "JetBrains Mono", ui-monospace, monospace; }
.bench-nets small { color: var(--muted); }
.bench-nets .notice { margin: 4px 0 0; }
.bench-ok { background: #e6f6ea; color: #1b5e20; border-color: #9ccc9f; }
/* the board seen from the front edge, parts casting shadows */
#benchBoard.is-3d { perspective: 1100px; perspective-origin: 50% 0; padding: 0 0 26px; overflow: visible; }
#benchBoard.is-3d .bb-svg { transform: rotateX(46deg); transform-origin: 50% 100%; margin-top: -9%; filter: drop-shadow(0 10px 0 #b9b29c) drop-shadow(0 26px 16px rgba(0, 0, 0, 0.45)); }
#benchBoard.is-3d .bb-part { filter: drop-shadow(2px 7px 2px rgba(0, 0, 0, 0.5)); }
#benchBoard.is-3d .bb-plug { filter: drop-shadow(2px 9px 2px rgba(0, 0, 0, 0.5)); }
#benchBoard.is-3d .bb-wire { filter: drop-shadow(1px 6px 1px rgba(0, 0, 0, 0.45)); }
/* an instrument folded down to its title, its display and its sockets */
.bench-fold { float: left; width: 26px; height: 22px; margin-right: 6px; border: 1px solid #8f8a78; border-radius: 6px; background: #fdfbf3; color: #23262b; font-weight: 800; cursor: pointer; }
.is-pro .bench-fold { display: none; }
.bench-box.is-folded { padding: 10px 14px; }
.bench-box.is-folded label, .bench-box.is-folded .chip-row, .bench-box.is-folded .scope-panel, .bench-box.is-folded #benchScope, .bench-box.is-folded .bench-hint, .bench-box.is-folded .psu-lamps { display: none; }
.bench-box.is-folded .bench-lcd { display: inline-block; margin: 0 8px 0 0; padding: 3px 10px; font-size: 0.95rem; min-height: 0; vertical-align: middle; }
.bench-box.is-folded .psu-meters { display: inline-flex; gap: 0; }
.bench-box.is-folded .bench-ports { display: inline-flex; margin-top: 4px; vertical-align: middle; }
.bench-box.is-folded .bench-cols, .bench-box.is-folded .scope-body { display: block; }
.bench-box.is-folded .bench-read { font-size: max(12px, 0.68rem); margin-top: 4px; }
.bench-box.is-folded h3 { margin-bottom: 6px; }

/* ---------- ELECNora: the whole bench on one screen (the layout itself is at the end of this file) ----------
   top row:    breadboard | parts | multimeter
   bottom row: power supply | function generator | oscilloscope   (details under the two sources) */
.bench-details .panel-title { margin-bottom: 8px; }
.bench-details .bench-inspector { margin-top: 0; }
@media (min-width: 1100px) {
  body[data-site="elec"] main#bench { width: calc(100% - 20px); max-width: 1680px; padding-left: 0; padding-right: 0; }
  .is-dash .bench-instruments, .is-dash .bench-layout, .is-dash .bench-main, .is-dash .bench-side { display: contents; }
  .is-dash .bench-cablebar { grid-area: cab; }
  .is-dash .bench-actbar { grid-area: act; }
  .is-dash .bench-bar { align-self: stretch; }
  .is-dash .bench-main > .card:first-child { grid-area: brd; }
  .is-dash #benchPalette { grid-area: prt; align-self: stretch; height: 0; min-height: 100%; overflow-y: auto; }
  .is-dash .card, .is-dash .bench-box { padding: 10px 12px; margin: 0; }
  .is-dash .bench-cols { grid-template-columns: minmax(0, 1fr); }
  .is-dash .bench-boardtools { gap: 5px; margin-bottom: 6px; }
  .is-dash .bench-boardtools .chip { padding: 4px 8px; font-size: max(12px, 0.72rem); }
  .is-dash .bench-boardtools .bench-hint { display: none; }
  .is-dash .bench-lcd { font-size: 1.15rem; padding: 5px 10px; margin-bottom: 6px; }
  .is-dash .bench-box label { margin-top: 5px; }
  .is-dash .bench-ports { margin-top: 8px; gap: 6px; }
  .is-dash .bench-box .chip { padding: 4px 9px; font-size: 0.76rem; }
  /* scope: screen left, run buttons and the two channels right, horizontal and trigger underneath */
  .is-dash .scope-body { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; grid-template-areas: "scr top" "scr ch1" "scr ch2" "hor trg"; }
  .is-dash .scope-body > div:first-child { grid-area: scr; }
  .is-dash .scope-panel { display: contents; }
  .is-dash .scope-panel > :nth-child(1) { grid-area: top; }
  .is-dash .scope-panel > :nth-child(2) { grid-area: ch1; }
  .is-dash .scope-panel > :nth-child(3) { grid-area: ch2; }
  .is-dash .scope-panel > :nth-child(4) { grid-area: hor; }
  .is-dash .scope-panel > :nth-child(5) { grid-area: trg; }
  body[data-page="elec-sim"] .page-intro { display: none; }
  body[data-page="elec-sim"] #elecTask { margin-top: 10px; }
  body[data-page="elec-sim"] #elecTask .card { padding: 8px 12px; }
  body[data-page="elec-sim"] #elecTask .card-note { display: none; }
  body[data-page="elec-sim"] #elecTask .panel-title { margin: 0 0 6px; font-size: 0.9rem; }
  body[data-page="elec-sim"] main#bench { padding-top: 10px; }
  .is-dash .scope-block { padding: 6px 8px; }
  .is-dash .scope-panel { gap: 6px; }
  .is-dash #benchPalette .chip { font-size: max(12px, 0.74rem); padding: 4px 8px; }
  .is-dash .bench-group summary { padding: 6px 8px; }
  .is-dash .bench-nets ul { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .is-dash .bench-fold { display: none; }
}

/* cables: plugs at both ends; the one you point at stands out */
.bw-line { opacity: 0.92; }
.is-hot .bw-line { stroke-width: 7; opacity: 1; filter: drop-shadow(0 0 5px #fff); }
.bw-ring { fill: none; stroke: #ffeb3b; stroke-width: 3; animation: bench-blink 0.9s ease-in-out infinite; }
/* hints that appear when the pointer rests on something */
.bench-tip { position: fixed; z-index: 400; max-width: 300px; padding: 8px 11px; border-radius: 10px; background: #10161c; color: #f1f5f9; font: 600 0.8rem/1.45 var(--font-ui); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); pointer-events: none; opacity: 0; visibility: hidden; }
.bench-tip.is-on { opacity: 1; visibility: visible; }
/* instruments and shelf: adjustable size, and leaning back in the 3D view */
#bench .bench-box, #bench #benchPalette { zoom: var(--dz, 1); }
#bench.is-tilt .bench-instruments, #bench.is-tilt .bench-side { perspective: 1400px; }
#bench.is-tilt .bench-box, #bench.is-tilt #benchPalette { transform: perspective(1400px) rotateX(14deg); transform-origin: 50% 100%; box-shadow: 0 10px 0 #b9b29c, 0 26px 22px rgba(0, 0, 0, 0.4); }
#bench.is-tilt .bench-port i { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.55); }
#bench.is-tilt .bench-knob button, #bench.is-tilt .bench-box .chip { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }

/* ---------- Bars between the rows: every cable by device, and what is active with undo ---------- */
.bench-bar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 7px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.bench-bar > b { font-size: 0.8rem; white-space: nowrap; }
.bench-bar #benchCables { margin: 0; gap: 5px; flex: 1 1 200px; display: flex; flex-wrap: wrap; min-width: 0; max-width: 100%; }   /* socket groups wrap on narrow phones (needed 356 px) */
.bench-bar #benchCables .chip { padding: 3px 8px; font-size: max(12px, 0.74rem); border-width: 2px; }
.bench-bar .bench-status { margin: 0; flex: 1 1 220px; font-size: 0.82rem; min-height: 0; }
.bench-undo { display: inline-flex; gap: 5px; }
.bench-undo .chip { padding: 4px 9px; font-size: 0.78rem; }
.is-pro .bench-bar { display: none; }
/* sockets and instruments wear their cable colour */
.bench-port i { border-color: var(--pc, #d32f2f) !important; }
.bench-port--bnc i { border-color: var(--pc, #b9bcc2) !important; }
.bench-gen { border-top: 5px solid #8e24aa; }
.bench-psu { border-top: 5px solid #e53935; }
.bench-dmm { border-top: 5px solid #fb8c00; }
.bench-scope { border-top: 5px solid #f9a825; }
/* ---------- The live circuit diagram ---------- */
.bench-diagram { margin-bottom: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.bench-diagram .chip-row { align-items: center; gap: 6px; margin-bottom: 6px; }
.bench-diagram .chip-row b { margin-right: auto; font-size: 0.86rem; }
.bench-diagram .chip { padding: 3px 10px; font-size: max(12px, 0.74rem); }
.bench-diagram .bench-hint { color: var(--muted); margin: 6px 0 0; }
.sc-stage { border-radius: 10px; background: #fffdf6; overflow: hidden; }
.sc-svg { display: block; width: 100%; height: auto; font-family: Inter, sans-serif; }
.sc-line { fill: none; stroke: #23262b; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sc-thick { stroke-width: 3; }
.sc-rail { stroke-width: 3; }
.sc-fill { fill: #23262b; stroke: #23262b; stroke-width: 1.5; stroke-linejoin: round; }
.sc-body { fill: #fffdf6; stroke: #23262b; stroke-width: 2; }
.sc-dot { fill: #23262b; }
.sc-meter { stroke: #fb8c00; stroke-dasharray: 5 4; }
.sc-flow { fill: none; stroke: #ff5722; stroke-width: 3; stroke-dasharray: 2 12; stroke-linecap: round; animation: pro-flow 0.7s linear infinite; pointer-events: none; }
.sc-label { font-size: 11px; font-weight: 700; fill: #1d3a8a; paint-order: stroke; stroke: #fffdf6; stroke-width: 3px; }
.sc-volt { font: 700 10px "JetBrains Mono", monospace; fill: #2e7d32; text-anchor: end; paint-order: stroke; stroke: #fffdf6; stroke-width: 3px; }
.sc-railname { font-size: 10px; font-weight: 800; fill: #23262b; text-anchor: end; }
.sc-in { font-size: 9px; font-weight: 800; fill: #23262b; text-anchor: middle; }
.sc-pm { font-size: 11px; font-weight: 800; fill: #23262b; text-anchor: middle; }
.sc-pin { font-size: max(12px, 10px); font-weight: 800; text-anchor: middle; paint-order: stroke; stroke: #fffdf6; stroke-width: 3px; }
.sc-part { cursor: pointer; }
.sc-part.is-selected .sc-line, .sc-part.is-selected .sc-body { stroke: #0b6fb3; stroke-width: 3; }
.sc-part.is-dead { opacity: 0.4; }
/* 3D: the sheet lies back and the drawing stands off it */
.sc-stage.is-3d { perspective: 900px; background: none; overflow: visible; padding: 0 4% 18px; }
.sc-stage.is-3d .sc-svg { transform: rotateX(48deg); transform-origin: 50% 100%; margin-top: -12%; background: #fffdf6; border-radius: 10px; box-shadow: 0 12px 0 #c9c3b0, 0 30px 22px rgba(0, 0, 0, 0.4); overflow: visible; }
.sc-stage.is-3d .sc-part, .sc-stage.is-3d .sc-rail { filter: drop-shadow(2px 9px 2px rgba(0, 0, 0, 0.45)); }

@media (min-width: 1100px) { #bench.is-dash > .card-note { display: none; } .is-dash .bench-bar .bench-status { font-size: 0.76rem; line-height: 1.35; } }

/* ---------- Board type, and the drawn shelf in the click-to-place bench ---------- */
.bench-boards { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; flex-basis: 100%; font-size: 0.8rem; }
.bench-boards b { margin-right: 4px; }
.bench-boards .chip small { opacity: 0.7; font-weight: 600; }
.bench-boardabout { display: block !important; margin: 0 0 2px !important; }
#benchBoard .bb-svg { margin: 0 auto; }
#bench:not(.is-pro) .pro-tile { touch-action: auto; cursor: pointer; }
#bench:not(.is-pro) .pro-tiles { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.pro-tile span { overflow-wrap: anywhere; }

/* ---------- All sockets in one row beside the board, grouped by instrument ---------- */
.bench-cablebar { align-items: flex-start; }
.bench-cablebar > b { align-self: center; }
.bench-bar #benchCables { display: flex; flex-wrap: wrap; gap: 6px 10px; flex: 1 1 300px; }
.bench-sockets { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 5px; border-radius: 10px; background: #ebe7da; color: #23262b; border-top: 4px solid var(--dc, #999); }
.bench-sockets > span { font: 800 max(12px, 0.66rem) var(--font-ui); text-transform: uppercase; letter-spacing: 0.04em; color: #444; }
.bench-sockets .bench-ports { margin: 0; gap: 4px; flex-wrap: nowrap; }
.bench-sockets .bench-port { padding: 2px 4px; font-size: max(12px, 0.62rem); }
.bench-sockets .bench-port i { width: 22px; height: 22px; border-width: 4px; }
.bench-sockets .chip { padding: 3px 8px; font-size: max(12px, 0.72rem); background: #f7f4ea; color: #23262b; }
.is-pro .bench-cablebar { display: none; }

/* colour families: supply red, generator purple, oscilloscope blue, multimeter green */
.bench-psu { border-top-color: #e53935; }
.bench-gen { border-top-color: #8e24aa; }
.bench-scope { border-top-color: #1e88e5; }
.bench-dmm { border-top-color: #2e7d32; }
.scope-block.ch1 { border-left-color: #29b6f6; }
.scope-block.ch2 { border-left-color: #1a47b8; }
.bench-read .ch1, .bench-row .ch1 { color: #0277bd; }
.bench-read .ch2, .bench-row .ch2 { color: #1a47b8; }
.bench-port--bnc i, .bench-port i { background: #2b2b2b; }
.bench-port--bnc i { background: radial-gradient(circle, #d8b24a 0 22%, #f4f4f4 24% 48%, #777 50%); }

/* the tilted board and diagram must never cover the buttons above them */
#benchBoardTools, .bench-diagram .chip-row, .bench-main > .card > .panel-title { position: relative; z-index: 8; }
#benchBoard.is-3d, .sc-stage.is-3d { position: relative; z-index: 1; }
#benchBoard.is-3d .bb-svg, .sc-stage.is-3d .sc-svg { margin-top: 0; }
#benchBoard.is-3d { padding-top: 0; margin-top: -4%; }
.sc-stage.is-3d { margin-top: -6%; pointer-events: none; }
.sc-stage.is-3d .sc-svg { pointer-events: auto; }

/* ---------- Measurements panel; third layout: board + sockets + sources + meter left, shelf / measurements / actions right ---------- */
.bench-measure .panel-title { margin: 0 0 6px; font-size: 0.9rem; }
.bench-measure .bench-read { margin: 0; display: block; }
.bench-meas { width: 100%; border-collapse: collapse; font: 700 0.76rem "JetBrains Mono", ui-monospace, monospace; }
.bench-meas th, .bench-meas td { padding: 2px 6px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bench-meas td:first-child, .bench-meas th:first-child { text-align: left; color: var(--muted); }
.bench-meas .ch1 { color: #0288d1; }
.bench-meas .ch2 { color: #3f63d6; }
.bench-measure .bench-hint { margin: 6px 0 0; color: var(--muted); font-weight: 700; }
.is-pro .bench-measure { display: none; }
@media (min-width: 1100px) {
  .is-dash .bench-cablebar > b { display: none; }
  .is-dash .bench-cablebar { padding: 6px 8px; }
  .is-dash .bench-bar #benchCables { gap: 6px; flex-wrap: nowrap; overflow-x: auto; }
  .is-dash .bench-sockets { flex: none; }
  .is-dash .bench-measure { grid-area: mea; padding: 10px 12px; }
  .is-dash .bench-details .bench-diagram { max-width: 760px; }
}

/* measurements for the chosen cable */
.bench-measpick { gap: 4px; margin-bottom: 6px; }
.bench-measpick .chip { padding: 2px 7px; font-size: max(12px, 0.7rem); }
.bench-measpick .chip.is-active { background: var(--pc); border-color: var(--pc); color: #fff; }
.bench-measof { margin: 0 0 4px; padding: 3px 8px; border-left: 4px solid; border-radius: 4px; font-size: 0.78rem; background: var(--surface-2); }
.bench-meas th[colspan] { padding-top: 6px; text-align: left; font: 800 max(12px, 0.66rem) var(--font-ui); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 2px solid var(--border); }
.bench-meas tr[title] { cursor: help; }
.bench-meas td:last-child { color: var(--text); }

/* three tidy columns: symbol, value, what it is for */
.bench-meas--uses { table-layout: fixed; }
.bench-meas--uses thead th { position: sticky; top: 0; background: var(--surface); text-align: left; font: 800 max(12px, 0.66rem) var(--font-ui); color: var(--muted); padding: 4px 6px; }
.bench-meas--uses th:nth-child(1), .bench-meas--uses td:nth-child(1) { width: 42px; text-align: left; color: #1d3a8a; }
:root[data-theme="dark"] .bench-meas--uses td:nth-child(1) { color: #8fb4ff; }
.bench-meas--uses th:nth-child(2), .bench-meas--uses td:nth-child(2) { width: 84px; text-align: right; }
.bench-meas--uses td.use { white-space: normal; text-align: left; font: 500 max(12px, 0.7rem)/1.3 var(--font-ui); color: var(--muted); }

/* the little settings window beside the selected part */
.bench-pop { position: absolute; z-index: 12; width: 310px; max-width: calc(100% - 8px); padding: 10px 12px; border: 2px solid #0b6fb3; border-radius: 14px; background: var(--surface); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4); }
.bench-pop::before { content: ""; position: absolute; top: -9px; left: 50%; width: 14px; height: 14px; margin-left: -7px; transform: rotate(45deg); background: var(--surface); border-left: 2px solid #0b6fb3; border-top: 2px solid #0b6fb3; }
.bench-pop .panel-title { margin: 0 26px 8px 0; font-size: 0.92rem; }
.bench-pop .bench-value { margin-bottom: 8px; padding: 8px; }
.bench-pop .card-note, .bench-pop .field-hint { margin: 4px 0; font-size: max(12px, 0.74rem); }
.bench-pop .chip { padding: 3px 8px; font-size: max(12px, 0.72rem); }
.bench-pop-x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); font-weight: 800; cursor: pointer; }
.is-pro .bench-pop { display: none; }

/* dragging on the click-to-place bench */
#bench:not(.is-pro) .pro-tile { user-select: none; cursor: grab; }
#bench:not(.is-pro) #benchBoard .bb-part { cursor: grab; }
body.is-carrying, body.is-carrying * { cursor: grabbing !important; }
body.is-carrying #benchBoard .bb-hole { fill: #1b1b1b; }
body.is-carrying #benchBoard .bb-hole:hover { fill: #ff9800; stroke: #ff9800; stroke-width: 4; }
body.is-carrying #benchBoard .bb-part, body.is-carrying #benchBoard .bb-plug { pointer-events: none; }

/* the wide, unseen path that says where a cable runs (for double-click) */
.bw-hit { fill: none; stroke: transparent; stroke-width: 18; stroke-linecap: round; pointer-events: none; }
.bench-cabletip { flex-basis: 100%; color: var(--muted); font-size: max(12px, 0.72rem); }

/* the black (ground) lead of a BNC cable */
.bw-ground { stroke-width: 3.5; }

/* Vin and Vout: flags on the board, a summary in the measurements, names in the diagram */
.bb-vio { pointer-events: none; }
.bb-vio rect { fill: #8e24aa; stroke: #fff; stroke-width: 1.5; }
.bb-vio.is-out rect { fill: #1565c0; }
.bb-vio text { fill: #fff; font: 800 10px Inter, sans-serif; text-anchor: middle; }
.bench-vio { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; margin-bottom: 8px; }
.bench-vio > div { padding: 6px 8px; border-radius: 10px; color: #fff; background: #8e24aa; line-height: 1.25; }
.bench-vio > div.is-out { background: #1565c0; }
.bench-vio b { display: block; font-size: 0.9rem; }
.bench-vio span { display: block; font-size: max(12px, 0.66rem); opacity: 0.85; }
.bench-vio output { display: block; font: 700 0.86rem "JetBrains Mono", ui-monospace, monospace; }
.bench-vio > i { font-style: normal; font-weight: 800; color: var(--muted); }
.bench-vio > p { grid-column: 1 / -1; margin: 0; font-size: 0.78rem; color: var(--muted); }
.bench-vio > p b { color: var(--text); font-family: "JetBrains Mono", ui-monospace, monospace; }
.sc-vio { font: 800 12px Inter, sans-serif; text-anchor: middle; paint-order: stroke; stroke: #fffdf6; stroke-width: 3px; }

.bench-vio b { font-size: 0.78rem; }
.bench-vio b small { font-weight: 600; opacity: 0.85; }
.bb-vio text { font-size: max(12px, 9px); }

/* input volts → output volts, large, above the board */
.bench-viobig { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: stretch; margin-bottom: 8px; }
.bench-viobig:empty { display: none; }
.bench-viobig > div { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 10px; padding: 6px 12px; border-radius: 12px; color: #fff; background: #8e24aa; }
.bench-viobig > div.is-out { background: #1565c0; }
.bench-viobig span { font: 800 0.8rem var(--font-ui); text-transform: uppercase; letter-spacing: 0.05em; }
.bench-viobig output { font: 800 1.6rem "JetBrains Mono", ui-monospace, monospace; text-align: right; white-space: nowrap; }
.bench-viobig small { grid-column: 1 / -1; font-size: max(12px, 0.68rem); opacity: 0.85; }
.bench-viobig > i { align-self: center; font-style: normal; font-size: 1.3rem; font-weight: 800; color: var(--muted); }

/* the card that says where both heads of a cable are */
.bench-cablepop { width: 290px; border-color: #ff9800; }
.bench-cablepop::before { border-color: #ff9800; }
.bench-heads { list-style: none; margin: 0 0 8px; padding: 0; }
.bench-heads li { display: grid; grid-template-columns: 16px 1fr; gap: 2px 8px; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 0.82rem; }
.bench-heads i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.3); grid-row: span 2; }
.bench-heads span { color: var(--muted); font-size: max(12px, 0.72rem); }
.bench-heads b { grid-column: 2; }

/* Phone: one column in working order — scope, measurements, parts, sockets, board, status, the other devices, then the diagram */
@media (max-width: 760px) {
  .is-dash .bench-flow { display: flex; flex-direction: column; gap: 10px; }
  .is-dash .bench-instruments, .is-dash .bench-layout, .is-dash .bench-main, .is-dash .bench-side { display: contents; }
  .is-dash .bench-flow .card, .is-dash .bench-flow .bench-box { margin: 0; }
  .is-dash .bench-nav { order: 0; }
  .is-dash .bench-scope { order: 1 !important; }
  .is-dash .bench-measure { order: 2 !important; max-height: 300px; overflow-y: auto; }
  .is-dash #benchPalette { order: 3 !important; max-height: 340px; overflow-y: auto; }
  .is-dash .bench-cablebar { order: 4 !important; }
  .is-dash .bench-main > .card:first-child { order: 5 !important; }
  .is-dash .bench-actbar { order: 6; }
  .is-dash .bench-psu { order: 7; }
  .is-dash .bench-gen { order: 8; }
  .is-dash .bench-dmm { order: 9; }
  .is-dash .bench-details { order: 10; }
}

/* swap an instrument for the other model in the lab: round button in the top-left corner; each model has its own colours */
.bench-swap { float: left; width: 26px; height: 26px; margin: -3px 6px 0 0; border-radius: 50%; border: 2px solid #1d3a8a; background: #fff; color: #1d3a8a; font-weight: 900; line-height: 1; cursor: pointer; transition: transform 0.25s; }
.bench-swap:hover { transform: rotate(180deg); background: #1d3a8a; color: #fff; }
.is-pro .bench-swap { display: none; }
.bench-box[data-model] { border-top: 5px solid #b9b29c; }
.bench-gen[data-model="sfg"], .bench-scope[data-model="gds"] { border-top-color: #f26a1b; }                 /* GW Instek orange */
.bench-box[data-model="us"] { border-top-color: #2a3fb5; background: #ece8d6; }                                /* US-9170A cream and blue */
.bench-box[data-model="utp"], .bench-box[data-model="ut"] { border-top-color: #d32f2f; }                       /* UNI-T red */
.bench-dmm[data-model="ut"] { background: #f1d9d6; }
.bench-scope[data-model="rigol"] { border-top-color: #f6c400; background: #efead9; }                           /* RIGOL yellow */
.bench-scope[data-model="rigol"] .scope-block.ch1 { box-shadow: inset 4px 0 0 #f6c400; }
.bench-scope[data-model="rigol"] .scope-block.ch2 { box-shadow: inset 4px 0 0 #29b6f6; }

/* the graph under the simulator */
.bench-graph { margin-top: 16px; }
.bg-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 8px 0; }
.bg-bar label { display: grid; gap: 3px; font-size: max(12px, 0.72rem); font-weight: 700; color: var(--muted); }
.bg-bar select, .bg-bar input, .bg-find input, .bench-graph textarea { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.86rem; }
.bg-bar input { width: 84px; }
.bg-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; margin-top: 10px; align-items: start; }
.bg-plots { display: grid; gap: 8px; }
.bg-plot { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); display: block; }
.bg-side { display: grid; gap: 10px; }
.bg-box { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.bg-box h4 { margin: 0 0 6px; font-size: 0.88rem; }
.bg-find { display: flex; gap: 8px; align-items: flex-end; }
.bg-find label { flex: 1; display: grid; gap: 3px; font-size: max(12px, 0.72rem); font-weight: 700; color: var(--muted); min-width: 0; }
.bg-find span { display: flex; align-items: center; gap: 4px; }
.bg-find input { width: 100%; min-width: 0; font-weight: 700; }
.bg-find i { font-style: normal; font-size: 1.2rem; padding-bottom: 6px; }
.bench-graph textarea { width: 100%; box-sizing: border-box; font-family: "JetBrains Mono", monospace; resize: vertical; }
.bg-why { margin: 0; padding-left: 18px; font-size: 0.84rem; line-height: 1.6; }
.bg-why li { margin-bottom: 4px; }
@media (max-width: 900px) { .bg-grid { grid-template-columns: minmax(0, 1fr); } }

.bg-presets .chip { font-size: 0.76rem; }
.bg-useli { list-style: none; margin-left: -18px; }
.bg-use { padding: 8px 10px; border-radius: 8px; border-left: 4px solid #2e9e5b; background: var(--surface); }
.bg-use p { margin: 0 0 4px; }

/* ---------- The checker: what is wrong, why, what to do instead (labs/bench-check.js) ---------- */
#benchCheck .ck { margin-top: 10px; }
.ck { --ck: var(--success, #2e7d32); margin: 0 0 10px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--ck) 45%, var(--border)); border-left: 5px solid var(--ck); border-radius: 12px; background: color-mix(in srgb, var(--ck) 7%, var(--surface)); color: var(--text); }
.ck-is-err { --ck: var(--danger, #c62828); }
.ck-is-warn { --ck: var(--warning, #b26a00); }
.ck-is-tip { --ck: var(--info, #1565c0); }
.ck p { margin: 0; }
.ck-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 0.92rem; }
.ck-head > .ic { color: var(--ck); width: 1.3em; height: 1.3em; }
.ck-pill { margin-left: auto; padding: 2px 10px; border-radius: 999px; font: 700 0.78rem var(--font-ui); color: #fff; background: color-mix(in srgb, var(--ck) 60%, #000); } /* white reads 4.6:1+ on every status colour */
.ck-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; max-height: 300px; overflow: auto; }
.ck-row { --ck: var(--danger, #c62828); padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ck); font-size: 0.88rem; line-height: 1.45; }
.ck-row.ck-warn { --ck: var(--warning, #b26a00); }
.ck-what { display: flex; gap: 6px; align-items: flex-start; }
.ck-what .ic { color: var(--ck); margin-top: 0.15em; }
.ck-why, .ck-fix { margin-top: 2px !important; color: var(--muted); }
.ck-why span, .ck-fix span { font-weight: 700; color: var(--text); }
.ck-fix { color: var(--text); }
.ck-fix span { color: var(--success, #2e7d32); }
:root:not([data-theme="dark"]) .ck-fix span, :root:not([data-theme="dark"]) .bx-saved { color: #17734c; } /* 5.2:1 on light cards (were 3.8-4.1:1) */
.ck-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ck-acts:empty { display: none; }
.ck-note { margin-top: 4px !important; font-size: 0.78rem; color: var(--muted); }
.ck-bad .sc-body, .ck-bad rect, .ck-bad circle, .ck-bad path, .lgs-part.ck-bad .lgs-body { stroke: var(--danger, #c62828); }
.ck-bad { filter: drop-shadow(0 0 3px var(--danger, #c62828)); }
.ck-warned { filter: drop-shadow(0 0 3px var(--warning, #f9a825)); }
.ck-flash { animation: ck-flash 0.4s ease-in-out 4; }
@keyframes ck-flash { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .ck-flash { animation: none; outline: 3px solid var(--danger, #c62828); } }

/* ---------- Bench extras: tools row, shortcut list, notes that only explain (labs/bench-extras.js) ---------- */
.ck-row.ck-info { --ck: var(--info, #1565c0); }
.bx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 8px; font-size: 0.85rem; }
.bx-row > b { margin-right: 4px; color: var(--muted); font-size: max(12px, 0.72rem); text-transform: uppercase; letter-spacing: 0.05em; }
.bx-row .chip .ic { width: 1.05em; height: 1.05em; }
.bx-sound { display: inline-flex; align-items: center; gap: 6px; }
.bx-sound input[type="range"] { width: 84px; accent-color: var(--primary); }
.bx-saved { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--success, #2e7d32); font-weight: 700; font-size: 0.8rem; }
.bx-how { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); }
.bx-how summary { cursor: pointer; font-weight: 700; color: var(--text); }
.bx-how p { margin: 6px 0 0; line-height: 1.5; }
.bx-keys { max-width: min(520px, calc(100vw - 32px)); padding: 18px 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); }
.bx-keys::backdrop { background: rgba(0, 0, 0, 0.5); }
.bx-keys h3 { margin: 0 0 10px; }
.bx-keys table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 0.9rem; }
.bx-keys td { padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.bx-keys td:first-child { white-space: nowrap; padding-right: 14px; }
.bx-keys kbd { display: inline-block; padding: 1px 7px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); font: 600 0.8rem ui-monospace, monospace; }

/* ---------- Library, share box, daily challenge, task hints (labs/bench-cloud.js, elec/daily.js) ---------- */
.bc-login { flex-basis: 100%; margin: 6px 0 0; font-size: 0.85rem; color: var(--muted); }
.bc-lib { width: min(680px, calc(100vw - 24px)); }
.bc-body { max-height: 62vh; overflow: auto; margin-bottom: 12px; }
.bc-filters { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; font-size: 0.82rem; }
.bc-filters span { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.bc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bc-item { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 6px 10px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.bc-thumb svg { display: block; width: 100%; border-radius: 6px; }
.bc-thumb path { stroke: var(--primary); stroke-width: 0.7; stroke-linecap: round; fill: none; }
.bc-tb { fill: var(--surface); stroke: var(--border); stroke-width: 0.3; }
.bc-thumb--big { max-width: 220px; margin: 8px 0; }
.bc-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bc-meta b { overflow-wrap: anywhere; }
.bc-meta small { color: var(--muted); }
.bc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.bc-tags i { font-style: normal; padding: 0 7px; border-radius: 999px; background: var(--accent-tint); }
.bc-shared { font-size: 0.75rem; font-weight: 700; color: var(--success, #2e7d32); }
.bc-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; }
.bc-sharedbox { margin-top: 10px; }
.dl-card { border-left: 5px solid var(--primary); }
.dl-card.is-done { border-left-color: var(--success, #2e7d32); }
.dl-card .panel-title small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.dl-goal { font-size: 1.02rem; font-weight: 700; margin: 4px 0 6px; }
.dl-status { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; margin: 0 0 8px; font-size: 0.9rem; color: var(--muted); }
.dl-status.is-ok, .dl-status.is-ok .ic { color: var(--success, #2e7d32); }
.dl-board { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 4px; max-width: 420px; }
.dl-board li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); font-size: 0.9rem; }
.dl-board li.is-me { outline: 2px solid var(--primary); }
.dl-board i { font-style: normal; color: var(--muted); }
.dl-top1 span { color: #b8860b; font-weight: 800; }
.dl-top2 span { color: #7d8791; font-weight: 800; }
.dl-top3 span { color: #a0623a; font-weight: 800; }
.th-box { margin: 8px 0; }
.th-hint { display: flex; gap: 6px; margin: 0 0 6px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--warning, #f9a825) 14%, var(--surface)); font-size: 0.9rem; line-height: 1.45; }
.th-hint .ic { flex: none; margin-top: 0.15em; color: var(--warning, #b26a00); }

/* ---------- Board skins: the colours of the breadboard and of the logic canvas ---------- */
body[data-bench-skin="blueprint"] .bb-base { fill: #0b3d91; stroke: #dfe9ff; }
body[data-bench-skin="blueprint"] .bb-gap { fill: #072c6b; }
body[data-bench-skin="blueprint"] .bb-hole { fill: #e8f0ff; }
body[data-bench-skin="blueprint"] .bb-strip { stroke: #9db8ee; }
body[data-bench-skin="blueprint"] .bb-text { fill: #fff; }
body[data-bench-skin="blueprint"] .lgs-stage { background-color: #0b3d91; }
body[data-bench-skin="neon"] .bb-base { fill: #08080f; stroke: #ff2bd6; }
body[data-bench-skin="neon"] .bb-gap { fill: #14142a; }
body[data-bench-skin="neon"] .bb-hole { fill: #00e5ff; }
body[data-bench-skin="neon"] .bb-strip { stroke: #7a2cff; }
body[data-bench-skin="neon"] .bb-text { fill: #00e5ff; }
body[data-bench-skin="neon"] #benchBoard .bb-svg { filter: drop-shadow(0 0 6px rgba(255, 43, 214, 0.45)); }
body[data-bench-skin="neon"] .lgs-stage { background-color: #08080f; }
body[data-bench-skin="paper"] .bb-base { fill: #fbf5e3; stroke: #5b5347; stroke-dasharray: 7 3; }
body[data-bench-skin="paper"] .bb-gap { fill: #efe6cd; }
body[data-bench-skin="paper"] .bb-hole { fill: #fbf5e3; stroke: #4a443b; stroke-width: 1.4; }
body[data-bench-skin="paper"] .bb-strip { stroke: #b9ae95; stroke-dasharray: 3 3; }
body[data-bench-skin="paper"] .bb-text { fill: #4a443b; }
body[data-bench-skin="paper"] .lgs-stage { background-color: #fbf5e3; }
body[data-bench-skin="crt"] .bb-base { fill: #020a04; stroke: #33ff66; }
body[data-bench-skin="crt"] .bb-gap { fill: #062010; }
body[data-bench-skin="crt"] .bb-hole { fill: #33ff66; }
body[data-bench-skin="crt"] .bb-strip { stroke: #1c8f3b; }
body[data-bench-skin="crt"] .bb-text { fill: #33ff66; }
body[data-bench-skin="crt"] #benchBoard { position: relative; }
body[data-bench-skin="crt"] #benchBoard::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 10px; background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px); }
body[data-bench-skin="crt"] .lgs-stage { background-color: #020a04; }
/* ---------- Colour modes: orange and blue in place of red and green; or stronger lines ---------- */
body[data-bench-vision="safe"] #bench, body[data-bench-vision="safe"] #logicSim, body[data-bench-vision="safe"] #elecDaily, body[data-bench-vision="safe"] #elecTask { --danger: #d55e00; --success: #0072b2; --warning: #b8860b; --info: #6a3d9a; }
body[data-bench-vision="safe"] .lgs-wire.is-on, body[data-bench-vision="safe"] .lgs-pin.is-on { stroke: #0072b2; }
body[data-bench-vision="safe"] .lgs-pin.is-on, body[data-bench-vision="safe"] .lgs-led.is-on { fill: #56b4e9; }
body[data-bench-vision="safe"] .ck-row.ck-err { border-left-style: double; border-left-width: 7px; }
body[data-bench-vision="contrast"] #bench, body[data-bench-vision="contrast"] #logicSim { --border: currentColor; --muted: var(--text); }
body[data-bench-vision="contrast"] .bb-hole { fill: #000; stroke: #fff; stroke-width: 1; }
body[data-bench-vision="contrast"] .bb-base { fill: #fff; stroke: #000; stroke-width: 3; }
body[data-bench-vision="contrast"] .bb-strip { stroke: #000; opacity: 1; }
body[data-bench-vision="contrast"] .bb-text { fill: #000; font-weight: 800; }
body[data-bench-vision="contrast"] .ck, body[data-bench-vision="contrast"] .ck-row { border-width: 2px; border-left-width: 7px; }
body[data-bench-vision="contrast"] .lgs-wire { stroke-width: 4; }

/* ---------- Tidy bench: folded boxes around the board, one-line checker when all is well ---------- */
.bx-fold { margin: 0 0 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); position: relative; z-index: 8; }
.bx-fold > summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-weight: 700; font-size: 0.88rem; list-style: none; }
.bx-fold > summary::-webkit-details-marker { display: none; }
.bx-fold > summary::after { content: "+"; margin-left: auto; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.bx-fold[open] > summary::after { content: "\2212"; }
.bx-fold[open] > summary { border-bottom: 1px solid var(--border); }
.bx-fold > :not(summary) { padding: 8px 12px 2px; }
.bx-fold #benchTools, .bx-fold #benchCloud, .bx-fold #benchBoardTools { margin: 0; }
#benchCheck { position: relative; z-index: 8; }
#benchCheck .ck { margin: 0 0 8px; }
.ck-is-ok { padding: 7px 12px; }
.ck-is-ok .ck-note { display: none; }
.ck-is-ok .ck-head > b { display: none; }
.ck-is-ok .ck-pill { margin-left: 0; background: none; color: var(--ck); padding: 0; font-size: 0.88rem; }
.ck-is-ok .ck-list:empty { display: none; }
.ck-head > b { font-size: 0.88rem; }
.dl-card { padding-top: 12px; padding-bottom: 10px; }
.dl-card .elec-more { margin-top: 2px; }

/* ---------- The simulator as a workspace (elec/workspace.js): a bar that stays, views, side panels ---------- */
body[data-page="elec-sim"] .page-intro { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; padding: 0; margin: -1px; border: 0; }
.ws-bar { position: sticky; top: var(--ws-top, 64px); z-index: 60; display: flex; flex-wrap: nowrap; gap: 8px 16px; align-items: center; padding: 6px max(12px, calc((100vw - 1260px) / 2)); overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); }
.ws-bar::-webkit-scrollbar { display: none; }
.ws-group { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); flex: none; }
.ws-right { margin-left: auto; background: none; gap: 6px; padding: 0; }
.ws-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--muted); font: 600 0.88rem var(--font-ui); white-space: nowrap; cursor: pointer; }
.ws-btn .ic { width: 1.1em; height: 1.1em; }
.ws-btn:hover, .ws-btn:focus-visible { color: var(--text); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.ws-btn.is-active { color: #fff; background: var(--primary); }
.ws-right .ws-btn { border-color: var(--border); background: var(--surface-2); }
.ws-right .ws-btn.is-active { color: #fff; background: var(--primary); border-color: var(--primary); }
.ws-problems[data-state="ok"] { color: var(--success, #2e7d32); }
:root:not([data-theme="dark"]) .ws-problems[data-state="ok"] { color: #17734c; } /* 5.2:1 on light buttons (was 3.7:1) */
.ws-problems[data-state="warn"] { color: var(--warning, #b26a00); border-color: currentColor; }
.ws-problems[data-state="err"] { color: #fff; background: var(--danger, #c62828); border-color: var(--danger, #c62828); }
/* one view at a time */
body[data-ws="board"] :is(#benchGraph, #logicSim, #benchSee), body[data-ws="graph"] :is(#bench, #logicSim, #elecModesBox, #benchSee), body[data-ws="logic"] :is(#bench, #benchGraph, #elecModesBox, #benchSee),
body[data-ws="see"] :is(#bench, #benchGraph, #logicSim, #elecModesBox) { display: none !important; }
body[data-ws="see"] #benchSee { margin-top: 14px; }
body[data-ws] #bench { padding-top: 14px; }
body[data-ws="graph"] #benchGraph, body[data-ws="logic"] #logicSim { margin-top: 14px; }
/* side panels: the task card and the daily challenge wait off screen and slide in from the right */
body[data-ws] :is(#elecTask, #elecDaily) { position: fixed; top: calc(var(--ws-top, 64px) + var(--ws-bar, 50px)); right: 0; bottom: 0; z-index: 55; width: min(430px, 100vw); max-width: none; margin: 0; padding: 48px 14px 90px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-left: 1px solid var(--border); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.18); transform: translateX(105%); visibility: hidden; transition: transform 0.2s ease, visibility 0s 0.2s; }
body[data-ws][data-ws-panel="tasks"] #elecTask, body[data-ws][data-ws-panel="daily"] #elecDaily { transform: none; visibility: visible; transition: transform 0.2s ease; }
body[data-ws] :is(#elecTask, #elecDaily) .card { margin-bottom: 12px; }
.ws-close { position: fixed; top: calc(var(--ws-top, 64px) + var(--ws-bar, 50px) + 8px); right: 12px; z-index: 56; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.ws-close[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { body[data-ws] :is(#elecTask, #elecDaily) { transition: none; } }
@media (max-width: 760px) {
  .ws-btn { padding: 7px 9px; font-size: 0.8rem; }
  .ws-right .ws-btn:not(.ws-problems) span { display: none; }
  .ws-problems span { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; }
}
body[data-ws] .bench-main > .card > .panel-title, body[data-ws] .bench-measure .panel-title { justify-content: flex-start; gap: 8px; text-align: left; }

/* ---------- "See it": voltage as height, current as flow (labs/bench-see.js) ---------- */
#benchSee { margin-bottom: 18px; }
.se-stage { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.se-svg { display: block; width: 100%; min-width: 520px; height: auto; }
.se-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; }
.se-tick, .se-name { fill: var(--muted); font: 600 10px var(--font-ui); }
.se-v { fill: var(--text); font: 700 11px ui-monospace, monospace; }
.se-pipe { cursor: pointer; outline: none; }
.se-hit { fill: none; stroke: transparent; stroke-width: 26; }
.se-tube { fill: none; stroke: var(--text); opacity: 0.32; stroke-linecap: round; }
.se-flow { fill: none; stroke: #ffca28; stroke-linecap: round; stroke-dasharray: 2 14; animation: se-flow 1s linear infinite; }
.se-svg.is-water .se-tube { stroke: #0288d1; opacity: 0.5; }
.se-svg.is-water .se-flow { stroke: #e1f5fe; }
.se-pipe.is-selected .se-tube, .se-pipe:focus-visible .se-tube { stroke: var(--primary); opacity: 0.9; }
.se-pipe.is-dead .se-tube { stroke-dasharray: 4 6; opacity: 0.25; }
.se-label { fill: var(--text); font: 700 10.5px var(--font-ui); paint-order: stroke; stroke: var(--surface-2); stroke-width: 3; }
.se-amps { fill: var(--muted); font: 600 10px ui-monospace, monospace; paint-order: stroke; stroke: var(--surface-2); stroke-width: 3; }
@keyframes se-flow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { .se-flow { animation: none; } }
.se-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 12px; }
.se-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 8px; font-size: 0.92rem; }
.se-h small { margin-left: auto; font-weight: 600; color: var(--muted); }
.se-gauges { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.se-g { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 2px 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 0.86rem; }
.se-g.is-selected, .se-g:focus-visible { border-color: var(--primary); outline: none; }
.se-gname small { color: var(--muted); }
.se-gtext { grid-column: 1 / -1; color: var(--muted); font: 600 0.76rem ui-monospace, monospace; }
.se-bar { height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; }
.se-bar i { display: block; height: 100%; border-radius: 5px; background: var(--success, #2e7d32); }
.se-bar.is-warn i { background: var(--warning, #f9a825); }
.se-bar.is-bad i { background: var(--danger, #c62828); }
.se-bar.is-tank { height: 14px; border-radius: 3px; border: 1px solid #0288d1; background: none; }
.se-bar.is-tank i { border-radius: 0; background: #29b6f6; }
.se-fbox { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.se-fname { margin: 0 0 6px; font-weight: 700; }
.se-formula { margin: 0 0 6px; font: 600 0.95rem ui-monospace, monospace; line-height: 1.6; }
.se-fv { color: #1e88e5; } .se-fi { color: #f9a825; } .se-fr { color: var(--text); } .se-fp { color: #e53935; }
.se-val { min-width: 5em; text-align: center; align-self: center; }
.se-split { display: flex; height: 18px; border-radius: 9px; overflow: hidden; gap: 2px; }
.se-split i { min-width: 3px; }
.se-legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 0.84rem; }
.se-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.se-legend small { color: var(--muted); }
/* ---------- Phones: the thumb bar and larger targets ---------- */
.bx-thumb { position: fixed; left: 8px; right: 8px; bottom: calc(var(--tabbar-h, 0px) + env(safe-area-inset-bottom, 0px) + 8px); z-index: 94; padding: 8px 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28); }
.bx-thumb[hidden] { display: none; }
.bx-thumb p { margin: 0 0 6px; font-size: 0.84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-thumb p b { color: var(--text); }
.bx-thumb > div { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.bx-thumb button { flex: 1 0 auto; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 52px; min-height: 48px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font: 600 max(12px, 0.68rem) var(--font-ui); }
.bx-thumb button .ic { width: 20px; height: 20px; }
.bx-thumb button.is-step { font-size: 1.5rem; font-weight: 800; min-width: 56px; }
.bx-thumb button.is-main { flex-direction: row; gap: 8px; width: 100%; font-size: 0.95rem; color: #fff; background: var(--danger, #c62828); border-color: transparent; }
@media (max-width: 760px) {
  .se-cols { grid-template-columns: minmax(0, 1fr); }
  .se-svg { min-width: 560px; }
  body[data-page="elec-sim"] #bench { padding-bottom: 96px; }
  .bx-fold > summary { padding: 12px; min-height: 46px; }
  .bx-row .chip, .ck-acts .chip, .tk-opt { min-height: 42px; }
  .ck-list { max-height: none; }
  .bx-sound input[type="range"] { width: 120px; height: 30px; }
  .ws-btn { min-height: 42px; }
}
.se-v { paint-order: stroke; stroke: var(--surface-2); stroke-width: 3.5; }

/* =========================================================
   The wide one-screen bench (labs/bench.js sets #bench.is-desk on ELECNora at 1100 px and wider).
   Nothing scrolls the page: instruments stand small on the left and grow when pointed at or pinned;
   the board with all its sockets is in the middle at full size; the shelf and the measurements are on
   the right; the dock in the bottom-left corner holds the guide, the examples and the tasks.
   Everywhere else (phones, the classic lab page) the new wrappers are invisible and the old order stays.
   ========================================================= */
.bench-left, .bench-slot, .bench-slot-well { display: contents; }
.bench-dock, .bench-slot-cap, .bench-pin, .bench-card-x, .bench-detailsbtn, .bench-details-x { display: none; }

#bench.is-desk { --bl: clamp(270px, 21vw, 400px); scroll-margin-top: calc(var(--ws-top, 64px) + var(--ws-bar, 50px) + 6px); }
body[data-page="elec-sim"] main#bench.is-desk { padding-top: 8px; padding-bottom: 10px; }
#bench.is-desk .bench-flow { display: grid; gap: 10px; align-items: stretch; height: var(--bench-h, calc(100vh - 170px)); height: var(--bench-h, calc(100dvh - 170px)); min-height: 540px;
  grid-template-columns: var(--bl) minmax(0, 1fr) clamp(236px, 19vw, 330px);
  grid-template-rows: auto minmax(0, 1fr) 96px auto;
  grid-template-areas: "left act prt" "left brd prt" "left brd mea" "left cab mea"; }
#bench.is-desk .bench-nav, #bench.is-desk .bench-ex, #bench.is-desk [data-bench-fold="all"] { display: none; }
#bench.is-desk .card, #bench.is-desk .bench-bar { margin: 0; }

/* left: the four instruments, two by two */
#bench.is-desk .bench-left { grid-area: left; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
#bench.is-desk .bench-instruments { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; flex: none; perspective: none; }
#bench.is-desk .bench-slot { display: block; position: relative; min-width: 0; cursor: zoom-in; }
#bench.is-desk .bench-slot.is-big { z-index: 30; cursor: auto; }
#bench.is-desk .bench-slot.is-big:not(.is-pinned) { z-index: 31; }
#bench.is-desk .bench-slot-cap { display: flex; align-items: baseline; gap: 5px; padding: 0 2px 3px; font: 800 max(12px, 0.68rem) var(--font-ui); color: var(--text); white-space: nowrap; overflow: hidden; }
.bench-slot-cap i { font-style: normal; }
.bench-slot-cap output { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 700 max(12px, 0.68rem) "JetBrains Mono", ui-monospace, monospace; color: var(--muted); }
#bench.is-desk .bench-slot-well { display: block; position: relative; min-height: 36px; border-radius: 8px; }
#bench.is-desk .bench-slot:not(.is-big):hover .bench-slot-well, #bench.is-desk .bench-slot:not(.is-big):focus-within .bench-slot-well { outline: 2px solid var(--primary); outline-offset: 2px; }
#bench.is-desk .bench-slot .bench-box { --w: 420px; position: absolute; left: 0; top: 0; width: var(--w); margin: 0; padding: 14px; zoom: 1; grid-column: auto;
  transform-origin: 0 0; transform: scale(var(--s, 0.3)); transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.12); }
#bench.is-desk .bench-slot .bench-gen { --w: 430px; }
#bench.is-desk .bench-slot .bench-psu { --w: 400px; }
#bench.is-desk .bench-slot .bench-dmm { --w: 400px; }
#bench.is-desk .bench-slot .bench-scope { --w: 740px; }
#bench.is-desk .bench-slot:not(.is-big) .bench-box { pointer-events: none; user-select: none; }
#bench.is-desk .bench-slot.is-big .bench-box { transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--S, 1)); outline: 2px solid var(--primary); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); }
#bench.is-desk .bench-slot.is-pinned .bench-box { outline-color: #1d3a8a; }
#bench.is-desk .bench-slot.is-pinned .bench-slot-well { outline: 2px dashed var(--border); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { #bench.is-desk .bench-slot .bench-box { transition: none; } }
/* the pin in the card's top-left corner keeps it large; the X just outside its top-right corner closes it */
#bench.is-desk .bench-pin { display: inline-grid; place-items: center; float: left; width: 28px; height: 28px; margin: -4px 6px 0 -2px; padding: 0; border: 2px solid #1d3a8a; border-radius: 8px; background: #fff; color: #1d3a8a; cursor: pointer; }
#bench.is-desk .bench-pin .ic { width: 16px; height: 16px; }
#bench.is-desk .bench-pin:hover, #bench.is-desk .bench-pin[aria-pressed="true"] { background: #1d3a8a; color: #fff; }
#bench.is-desk .bench-slot.is-big .bench-card-x { display: grid; place-items: center; position: absolute; left: calc(100% + 8px); top: 0; width: 34px; height: 34px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #10161c; color: #fff; font: 800 0.95rem var(--font-ui); cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
#bench.is-desk .bench-card-x::before { content: ""; position: absolute; right: 100%; top: -2px; width: 12px; height: 38px; }   /* the gap to the card belongs to the button, so the card stays open on the way */
#bench.is-desk .bench-card-x:hover { background: var(--danger, #c62828); }

/* bottom-left: guide, examples, tasks */
#bench.is-desk .bench-dock { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; padding: 0; overflow: hidden; }
.bench-dock-tabs { display: flex; gap: 2px; flex: none; padding: 4px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.bench-dock-tabs button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; padding: 6px 4px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: 700 0.78rem var(--font-ui); white-space: nowrap; cursor: pointer; }
.bench-dock-tabs button:hover { color: var(--text); }
.bench-dock-tabs button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16); }
.bench-dock-n { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger, #c62828); color: #fff; font: 800 max(12px, 0.68rem)/18px var(--font-ui); }
.bench-dock-n[data-state="warn"] { background: var(--warning, #b26a00); }
.bench-dock-n[hidden] { display: none; }
.bench-dock-pane { flex: 1 1 0; min-height: 0; padding: 8px 10px; overflow-y: auto; overscroll-behavior: contain; }
.bench-dock-pane[hidden] { display: none; }
.bench-dock-pane > .card-note { margin: 0 0 8px; font-size: 0.8rem; }
.bench-dock-pane .chip { padding: 4px 9px; font-size: 0.78rem; }
.bench-dock #benchCheck .ck { margin: 0; }
.bench-dock .ck-list { max-height: none; overflow: visible; }
.bench-dock .ck-row { font-size: 0.82rem; }
body[data-ws] #benchDock #elecTask { position: static; z-index: auto; width: auto; max-width: none; margin: 0; padding: 0; overflow: visible; background: none; border: 0; box-shadow: none; transform: none; visibility: visible; transition: none; }
#benchDock #elecTask .card { padding: 8px 10px; margin: 0 0 8px; }
#benchDock #elecTask .card:last-child { margin-bottom: 0; }
#benchDock #elecTask ol { padding-left: 1.2em; font-size: 0.86rem; }

/* middle: what is in the hand, the board, every socket under it */
#bench.is-desk .bench-actbar { grid-area: act; flex-flow: row nowrap; align-items: center; min-height: 46px; padding: 5px 10px; }
#bench.is-desk .bench-actbar .bench-status { flex: 1 1 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#bench.is-desk .bench-actbar .bench-status.is-busy { display: block; }
@media (max-width: 1599px) { #bench.is-desk .bench-undo .chip span { display: none; } #bench.is-desk .bench-undo .chip { padding: 5px 11px; font-size: 0.95rem; } }
#bench.is-desk .bench-undo { flex: none; }
#bench.is-desk .bench-detailsbtn { display: inline-flex; }
#bench.is-desk .bench-main > .card:first-child { grid-area: brd; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); gap: 6px 8px; min-height: 0; padding: 8px 10px; }
#bench.is-desk .bench-main > .card:first-child > .panel-title { display: none; }
#bench.is-desk #benchVioBig { grid-column: 1 / -1; grid-row: 2; margin: 0; }
#bench.is-desk .bench-viobig > div { padding: 3px 12px; }
#bench.is-desk .bench-viobig output { font-size: 1.25rem; }
#bench.is-desk #benchBoard { grid-column: 1 / -1; grid-row: 3; min-height: 0; overflow: auto; container-type: size; }
#bench.is-desk #benchBoard .bb-svg { width: min(calc(var(--bb-z, 1) * 100%), calc(100cqh * var(--bb-r, 1.9) * var(--bb-z, 1))) !important; }
#bench.is-desk #benchBoard.is-3d { overflow: visible; margin-top: 0; padding: 0; }
#bench.is-desk #benchBoard.is-3d .bb-svg { width: min(86%, calc(100cqh * var(--bb-r, 1.9) * 1.1)) !important; transform-origin: 50% 60%; }
/* board settings and tools: two buttons over the board that open downwards and cover it, so the board never moves */
#bench.is-desk .bx-fold { grid-row: 1; margin: 0; min-width: 0; }
#bench.is-desk .bx-fold > summary { padding: 6px 10px; font-size: 0.8rem; }
#bench.is-desk .bx-fold > summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bench.is-desk .bx-fold[open] { z-index: 28; }
#bench.is-desk .bx-fold[open] > .bx-fold-body { position: absolute; top: calc(100% + 4px); left: 0; width: min(640px, 200%); max-height: min(62vh, 430px); overflow: auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); }
#bench.is-desk #benchFoldTools[open] > .bx-fold-body { left: auto; right: 0; }
#bench.is-desk .bench-cablebar { grid-area: cab; padding: 6px 8px; }
#bench.is-desk .bench-cabletip { display: none; }

/* right: the shelf, the measurements under it */
#bench.is-desk #benchPalette { grid-area: prt; height: 0; min-height: 100%; overflow-y: auto; }
#bench.is-desk .bench-measure { grid-area: mea; align-self: stretch; height: 0; min-height: 100%; overflow-y: auto; }

/* the diagram and the details: a sheet over the board and the shelf, opened from the bar */
#bench.is-desk .bench-details { grid-area: auto; position: absolute; z-index: 25; top: 0; bottom: 0; right: 0; left: calc(var(--bl) + 10px); overflow: auto; visibility: hidden; opacity: 0; pointer-events: none; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4); }
#bench.is-desk.is-details .bench-details { visibility: visible; opacity: 1; pointer-events: auto; }
#bench.is-desk .bench-details > .panel-title { display: flex; align-items: center; justify-content: flex-start; }
#bench.is-desk .bench-details-x { display: block; position: static; margin-left: auto; }
#bench.is-desk .bench-pop.is-above::before { top: auto; bottom: -9px; transform: rotate(225deg); }

/* ---------- What the guide marks on the bench (labs/bench-check.js) ----------
   red or amber: the thing that is wrong; green and dashed: what to do instead */
.ck-ring { fill: none; stroke: var(--danger, #c62828); stroke-width: 2.5; pointer-events: none; animation: ck-pulse 1.1s ease-in-out infinite; }
.ck-ring--warn { stroke: var(--warning, #f9a825); }
.ck-ring--go { stroke: var(--success, #2e9e5b); stroke-dasharray: 4 3; }
.ck-halo { fill: var(--danger, #c62828); opacity: 0.16; stroke: var(--danger, #c62828); stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none; animation: ck-pulse 1.1s ease-in-out infinite; }
.ck-halo--warn { fill: var(--warning, #f9a825); stroke: var(--warning, #f9a825); }
.ck-ghost { pointer-events: none; }
.ck-ghost .ck-ghost-art { opacity: 0.55; }
.ck-ghost-box { fill: color-mix(in srgb, var(--success, #2e9e5b) 14%, transparent); stroke: var(--success, #2e9e5b); stroke-width: 2; stroke-dasharray: 6 4; animation: ck-march 0.9s linear infinite; }
.ck-ghost-wire { fill: none; stroke: var(--success, #2e9e5b); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 9 7; opacity: 0.95; animation: ck-march 0.9s linear infinite; }
.ck-ghost-under { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; opacity: 0.75; }
.ck-ghost-tag rect { fill: var(--success, #2e9e5b); }
.ck-ghost-tag text { fill: #fff; font: 800 10px Inter, sans-serif; text-anchor: middle; }
.ck-ghost-arrow { fill: none; stroke: var(--success, #2e9e5b); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.is-ckbad .bw-line { filter: drop-shadow(0 0 4px var(--danger, #c62828)) drop-shadow(0 0 2px var(--danger, #c62828)); }
.is-ckbad .bw-shadow { stroke: var(--danger, #c62828); opacity: 0.55; animation: ck-pulse 1.1s ease-in-out infinite; }
.bench-port.ck-glow i { outline: 3px solid var(--danger, #c62828); outline-offset: 2px; animation: ck-pulse 1.1s ease-in-out infinite; }
.bench-port.ck-go i { outline: 3px dashed var(--success, #2e9e5b); outline-offset: 2px; }
.bench-box.ck-glow, #bench.is-desk .bench-slot.ck-glow:not(.is-big) .bench-slot-well { outline: 3px solid var(--danger, #c62828); outline-offset: 2px; animation: ck-pulse 1.1s ease-in-out infinite; }
#bench.is-desk .bench-slot .bench-box.ck-glow { animation: none; }
#bench.is-desk .bench-slot:not(.is-big) .bench-box.ck-glow { outline: 0; }
.bench-box .ck-press { outline: 3px dashed var(--success, #2e9e5b); outline-offset: 2px; }
.ck-row[data-ck-row] { cursor: pointer; }
.ck-row.is-focus { box-shadow: 0 0 0 2px var(--ck); }
.ck-legend { display: flex; align-items: center; gap: 6px; margin-top: 6px !important; font-size: 0.76rem; color: var(--muted); }
.ck-legend i { flex: none; width: 22px; height: 0; border-top: 3px dashed var(--success, #2e9e5b); }
.ck-legend i.is-bad { border-top: 3px solid var(--danger, #c62828); }
#benchBoard .ck-bad, #benchBoard .ck-warned { animation: ck-pulse 1.1s ease-in-out infinite; }
@keyframes ck-pulse { 50% { opacity: 0.45; } }
@keyframes ck-march { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { .ck-ring, .ck-halo, .ck-ghost-box, .ck-ghost-wire, .is-ckbad .bw-shadow, .bench-port.ck-glow i, .bench-box.ck-glow, .bench-slot.ck-glow .bench-slot-well, #benchBoard .ck-bad, #benchBoard .ck-warned { animation: none !important; } }
.bench-dock .ck-head > b { display: none; }
.bench-dock .ck-pill { margin-left: 0; }
#bench.is-desk .bench-viobig > div { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
#bench.is-desk .bench-viobig small { grid-column: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bench.is-desk .bench-viobig output { grid-column: 3; grid-row: 1; }
#bench.is-desk #benchBoard:not(.is-3d) { display: grid; align-content: safe center; }

/* ---------- UNI-T UTP3303: the front panel laid out like the device ----------
   dark display with both channels (left), knobs, lamps and TRACKING (right), POWER and the eight posts (bottom) */
.utp-top { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: stretch; }
.utp-screen { flex: 1 1 250px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; padding: 10px 14px 14px; border-radius: 12px; background: #0d0d10; color: #f3f3f3; }
.utp-brand { display: flex; align-items: center; gap: 8px; font: 800 max(12px, 0.72rem) var(--font-ui); letter-spacing: 0.03em; }
.utp-brand b { margin-left: auto; padding: 1px 7px; background: #d32f2f; color: #fff; font-style: italic; }
.utp-brand i { font-style: normal; }
.utp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: end; }
.utp-row > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 4px; }
.utp-row small { grid-column: 1 / -1; font: 700 max(12px, 0.62rem) var(--font-ui); letter-spacing: 0.04em; color: #ddd; }
.utp-row output { min-height: 1.5em; padding: 2px 6px; border-radius: 4px; background: #17070a; color: #ff4a3d; font: 700 1.35rem/1.5 "JetBrains Mono", ui-monospace, monospace; text-align: right; }
.utp-row output.is-amp { background: #07140a; color: #5cff4a; }
.utp-row em { font: 800 0.8rem var(--font-ui); font-style: normal; }
.utp-row > span { padding-bottom: 4px; font: 800 max(12px, 0.58rem)/1.3 var(--font-ui); text-align: center; color: #ddd; }
.utp-ctl { flex: 1.25 1 300px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.utp-ch { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding-bottom: 12px; }
.utp-ch > em { position: absolute; left: 0; right: 0; bottom: 0; font: 800 max(12px, 0.6rem) var(--font-ui); font-style: normal; letter-spacing: 0.08em; text-align: center; color: #555; }
.bench-box .utp-knobbox { margin: 0; text-align: center; }
.utp-knobbox.is-off { opacity: 0.45; }
.utp-knob { position: relative; display: block; width: 46px; height: 46px; margin: 2px auto 3px; border-radius: 50%; border: 1px solid #a9a38e; background: radial-gradient(circle at 35% 30%, #fff, #e1dccb 70%); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); transform: rotate(var(--a, 0deg)); }
.utp-knob::after { content: ""; position: absolute; left: 50%; top: 4px; width: 3px; height: 13px; margin-left: -1.5px; border-radius: 2px; background: #555; }
.utp-knobbox .bench-num { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 4px; }
.utp-knobbox .bench-num input[type="range"] { grid-column: 1 / -1; }
.utp-lamps, .utp-side { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.utp-lamps b { font: 800 max(12px, 0.74rem) var(--font-ui); color: #23262b; }
.utp-side small { font: 800 max(12px, 0.56rem)/1.25 var(--font-ui); text-align: center; color: #444; }
.utp-side .chip { padding: 3px 8px; font-size: max(12px, 0.7rem); }
.utp-track { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 5px 0; border-top: 1px solid #c9c3b0; border-bottom: 1px solid #c9c3b0; }
.utp-track span { margin-right: auto; font: 800 max(12px, 0.66rem) var(--font-ui); letter-spacing: 0.05em; color: #1d3a8a; }
.utp-track .chip { padding: 3px 9px; font-size: max(12px, 0.72rem); }
.utp-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; padding-top: 8px; border-top: 2px solid #c9c3b0; }
.utp-posts { display: flex; flex-wrap: nowrap; gap: 10px; }
.utp-posts-g { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.utp-posts-g { --pw: 40px; }
.utp-posts-g .bench-ports { margin: 0; gap: 0; flex-wrap: nowrap; align-items: flex-start; }
.utp-posts-g .bench-port { width: var(--pw); padding: 2px 0; }
.utp-posts-g .bench-port > span { display: none; }                 /* the names are printed over the posts, as on the device */
.utp-posts-g .bench-port em { font-size: max(12px, 0.6rem); white-space: nowrap; }
.utp-posts-h, .utp-posts-f { display: flex; color: #23262b; }
.utp-posts-h b { width: var(--pw); font: 800 max(12px, 0.62rem) var(--font-ui); text-align: center; }
.utp-posts-h b.is-ch { width: calc(var(--pw) * 2); display: flex; justify-content: space-between; padding: 0 12px; }
.utp-posts-h b.is-ch i { font-style: normal; font-size: 0.8rem; line-height: 0.8; }
.utp-posts-f small { width: calc(var(--pw) * 2); padding-top: 1px; border: 2px solid #8f8a78; border-top: 0; border-radius: 0 0 8px 8px; font: 800 max(12px, 0.54rem) var(--font-ui); text-align: center; color: #444; white-space: nowrap; }
.utp-posts-f small.is-gnd { width: var(--pw); border: 0; font-size: 0.8rem; line-height: 1; }
.bench-sockets .utp-posts { gap: 8px; }
#bench.is-desk .bench-slot .bench-psu[data-model="utp"] { --w: 690px; }
#bench.is-desk .bench-sockets { padding: 4px 6px 5px; }
.utp-bottom .utp-posts { flex-wrap: wrap; row-gap: 6px; }

/* ---------- Cable heads, socket kinds and roles, the BNC T-connector (labs/bench.js cableHeadSVG) ---------- */
.bh-letter { fill: #fff; font: 800 8px Inter, sans-serif; text-anchor: middle; pointer-events: none; }
.bh-clip .bh-letter { font-size: max(12px, 8.5px); }
/* a BNC socket shows its bayonet lugs, a banana socket its 4 mm hole */
.bench-port--bnc i { position: relative; background: radial-gradient(circle, #d8b24a 0 18%, #f4f4f4 20% 42%, #8a9099 44%) !important; }
.bench-port--bnc i::before, .bench-port--bnc i::after { content: ""; position: absolute; top: 50%; width: 5px; height: 4px; margin-top: -2px; border-radius: 1px; background: #7d838c; }
.bench-port--bnc i::before { left: -9px; }
.bench-port--bnc i::after { right: -9px; }
.bench-port--banana i { background: radial-gradient(circle, #111 0 30%, #3a3a3a 32%) !important; }
.bench-port:disabled { opacity: 0.55; cursor: not-allowed; }
/* which instruments give a signal and which measure one */
.bench-role { margin-left: 4px; padding: 0 5px; border-radius: 999px; font: 700 max(12px, 0.56rem) var(--font-ui); text-transform: none; letter-spacing: 0; color: #fff; background: #2e7d32; white-space: nowrap; }
.bench-sockets.is-out .bench-role { background: #c62828; }
.bench-sockets.is-in .bench-role { background: #1565c0; }
/* the T sits on OUTPUT 50Ω: two sockets on a bar, the stem going down into the output */
.bench-tee { display: inline-flex; flex-direction: column; align-items: center; gap: 0; padding: 2px 4px; border: 2px solid #9aa0a8; border-radius: 8px; background: linear-gradient(#e7e9ec, #cfd3d8); }
.bench-tee-top { display: flex; align-items: center; gap: 0; }
.bench-tee-top > b { padding: 0 2px; font: 900 0.8rem var(--font-ui); color: #4a4f57; }
.bench-tee > .bench-port { padding-top: 0; }
.bench-teebtn { align-self: center; padding: 3px 8px !important; font-size: max(12px, 0.68rem) !important; }
/* the values of the parts on the board: larger, darker, with a light halo so they read over holes and wires */
.bb-value { fill: #10161c; font-size: 10.5px; font-weight: 800; stroke: #fffdf6; stroke-width: 3.2px; stroke-linejoin: round; }
:root[data-theme="dark"] .bb-value { fill: #10161c; }
.bench-role i { font-style: normal; }
@media (max-width: 1599px) {
  #bench.is-desk .bench-role i { display: none; }
  #bench.is-desk .bench-sockets .utp-posts-g { --pw: 33px; }
  #bench.is-desk .bench-sockets .utp-posts { gap: 6px; }
  #bench.is-desk .bench-sockets { padding: 3px 4px 4px; }
  #bench.is-desk .bench-sockets .bench-port { padding: 2px 2px; }
  #bench.is-desk .bench-bar #benchCables { gap: 4px; }
}
/* four tabs in a narrow dock: the open one keeps its word, the others show their icon */
@media (max-width: 1599px) {
  .bench-dock-tabs button:not(.is-active) span { display: none; }
  .bench-dock-tabs button:not(.is-active) { flex: 0 0 auto; padding: 6px 9px; }
}
/* the BNC T drawn like the real part (replaces the boxed look above) */
.bench-tee { position: relative; display: inline-grid; grid-template-columns: auto 18px auto; grid-template-areas: "l m r" ". s ." "o o o"; justify-items: center; align-items: start; gap: 0; padding: 2px 0 0; border: 0; background: none; }
.bench-tee::before { content: ""; position: absolute; z-index: 0; left: 12px; right: 12px; top: 5px; height: 22px; border-radius: 7px; border: 1px solid #6f757e;
  background: linear-gradient(#fdfdfe, #c3c7cd 40%, #8a9099 62%, #e6e8eb); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); }
.bench-tee > .bench-port { position: relative; z-index: 1; }
.bench-tee > [data-port="gt1"] { grid-area: l; }
.bench-tee > [data-port="gt2"] { grid-area: r; }
.bench-tee > [data-port="gen"] { grid-area: o; margin-top: -4px; opacity: 1; }
.bench-tee > [data-port="gen"] i { box-shadow: 0 0 0 3px #8a9099; }
.bench-tee-mid { grid-area: m; position: relative; z-index: 1; width: 18px; height: 28px; margin-top: 2px; border: 1px solid #6f757e; border-radius: 4px;
  background: repeating-linear-gradient(90deg, #8a9099 0 2px, #eceef1 2px 4px); }
.bench-tee-stem { grid-area: s; position: relative; z-index: 0; width: 14px; height: 12px; margin-top: -2px; border: 1px solid #6f757e; border-top: 0;
  background: repeating-linear-gradient(#8a9099 0 2px, #eceef1 2px 4px); }
.bench-tee > .bench-port:not([data-port="gen"]) span { display: none; }
/* ---------- The socket bar: the four instruments share the whole width, each laid out with room ---------- */
.bench-bar #benchCables { align-items: stretch; }
#bench.is-desk .bench-bar #benchCables { flex-wrap: nowrap; }
.bench-bar #benchCables > .bench-sockets { flex: 1 1 auto; min-width: max-content; }
.bench-sockets > span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.bench-sockets > span .bench-role { margin-left: auto; }
.bench-sockets > .bench-ports, .bench-sockets > .utp-posts { flex: 1 1 auto; justify-content: space-evenly; align-items: flex-start; gap: 10px; }
.bench-sockets .bench-teebtn { margin-left: 6px; padding: 1px 8px !important; font-size: max(12px, 0.64rem) !important; text-transform: none; letter-spacing: 0; }
.bench-tee { margin-right: 6px; }
@media (max-width: 1599px) {
  #bench.is-desk .bench-sockets > .bench-ports, #bench.is-desk .bench-sockets > .utp-posts { gap: 4px; }
  #bench.is-desk .bench-sockets .bench-teebtn { margin-left: 2px; padding: 1px 5px !important; }
}
/* the T in one row with the other sockets: jack · OUTPUT 50Ω under the T's knurled body · jack, on one silver barrel */
.bench-tee { grid-template-columns: auto auto auto; grid-template-areas: "l o r"; }
.bench-tee::before { left: 14px; right: 14px; top: 4px; height: 20px; }
.bench-tee > [data-port="gen"] { grid-area: o; margin-top: 0; }
.bench-tee > [data-port="gen"] i { border-color: #8a9099 !important; background: repeating-conic-gradient(#8a9099 0 10deg, #eceef1 10deg 20deg) !important; box-shadow: 0 0 0 2px #6f757e; }
.bench-tee > [data-port="gen"] i::before, .bench-tee > [data-port="gen"] i::after { display: none; }
.bench-tee-mid, .bench-tee-stem { display: none; }
.bench-box label.is-off { opacity: 0.5; }
.bench-choose { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px; margin-bottom: 6px; }
/* jumpers listed after the instruments take their own line on the wide bench, so the four instruments keep the whole width */
#bench.is-desk .bench-bar #benchCables { flex-wrap: wrap; }
#bench.is-desk .bench-bar #benchCables > .bench-sockets:nth-child(-n+4) { flex: 1 1 0; }
#bench.is-desk .bench-bar #benchCables > .bench-sockets:nth-child(5) { flex: 1 1 100%; flex-direction: row; align-items: center; gap: 8px; padding: 2px 8px; border-top-width: 2px; }
#bench.is-desk .bench-bar #benchCables > .bench-sockets:nth-child(5) .chip-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }

/* ---------- The 3D viewer (labs/bench-3d.js) ---------- */
.v3 { position: fixed; inset: 0; z-index: 900; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); background: color-mix(in srgb, #0b1016 88%, transparent); color: #eef2f6; }
.v3[hidden] { display: none; }
.v3:fullscreen { background: #0b1016; }
body.v3-open { overflow: hidden; }
.v3-stage { position: relative; overflow: hidden; perspective: 1400px; perspective-origin: 50% 40%; cursor: grab; touch-action: none; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 60%, #2a3440 0%, #121820 70%); }
.v3-stage:active { cursor: grabbing; }
.v3-world { position: relative; width: 0; height: 0; transform-style: preserve-3d; transition: transform 0.06s linear; }
.v3-box, .v3-sprite { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.v3-box { transform: translate(-50%, -50%); }
.v3-face { position: absolute; left: 50%; top: 50%; overflow: hidden; backface-visibility: visible; transform-origin: 50% 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }
.v3-face > svg, .v3-raised > svg { display: block; width: 100%; height: 100%; }
.v3-raised { position: absolute; left: 50%; top: 50%; pointer-events: none; filter: drop-shadow(2px 4px 2px rgba(0, 0, 0, 0.45)); }
.v3-raised .bb-svg { width: 100% !important; min-width: 0 !important; max-width: none !important; }
.v3-front { background: #e9e5d6; }
.v3-panel { width: 100%; height: 100%; overflow: hidden; }
.v3-panel .bench-box { zoom: 1 !important; font-size: 12px; pointer-events: none; }
.v3-panel .bench-card-x, .v3-panel .v3-btn, .v3-panel .bench-pin { display: none !important; }
.v3-sheet { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; }
.v3-sheet > svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45)); }
.v3-shadow { position: absolute; left: 0; top: 0; border-radius: 50%; background: radial-gradient(rgba(0, 0, 0, 0.55), transparent 70%); }
.v3-hint { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; font-size: 0.78rem; opacity: 0.7; pointer-events: none; }
.v3-side { overflow-y: auto; padding: 14px 16px; background: #141b23; border-left: 1px solid #2a3440; font-size: 0.88rem; line-height: 1.5; }
.v3-side h3 { margin: 6px 0 6px; font-size: 1.1rem; }
.v3-side h4 { margin: 14px 0 4px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: #9fb3c8; }
.v3-side p { margin: 0 0 6px; color: #cdd6df; }
.v3-bar { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.v3-bar .chip { padding: 4px 9px; font-size: 0.76rem; background: #1f2a35; color: #eef2f6; border-color: #33414f; }
.v3-bar .chip[aria-pressed="true"] { background: var(--primary); }
.v3-x { margin-left: auto; width: 34px; height: 34px; border: 1px solid #33414f; border-radius: 50%; background: #1f2a35; color: #fff; font-weight: 800; cursor: pointer; }
.v3-dims, .v3-cols { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.v3-dims li { display: flex; justify-content: space-between; border-bottom: 1px dashed #2a3440; padding: 2px 0; }
.v3-dims b { font-family: "JetBrains Mono", ui-monospace, monospace; }
.v3-cols li { display: flex; align-items: center; gap: 8px; }
.v3-cols i { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.4); }
.v3-note { font-size: max(12px, 0.72rem); opacity: 0.7; }
@media (max-width: 760px) { .v3 { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; } .v3-side { max-height: 42vh; border-left: 0; border-top: 1px solid #2a3440; } }
@media (prefers-reduced-motion: reduce) { .v3-world { transition: none; } }
/* the 3D buttons */
.pro-tile { position: relative; }
.v3-btn { position: absolute; right: 3px; bottom: 3px; z-index: 2; padding: 0 5px; border: 1px solid #1d3a8a; border-radius: 5px; background: #fff; color: #1d3a8a; font: 800 max(12px, 0.6rem)/1.5 var(--font-ui); cursor: pointer; }
.v3-btn:hover, .v3-btn:focus-visible { background: #1d3a8a; color: #fff; }
.bench-box { position: relative; }
.v3-btn--dev { bottom: 8px; right: 10px; padding: 2px 8px; font-size: max(12px, 0.7rem); }
.bench-viewbar { position: absolute; z-index: 9; right: 14px; bottom: 12px; display: flex; gap: 4px; }
.bench-viewbar .chip { padding: 3px 9px; font-size: 0.8rem; background: var(--surface); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.bench-main > .card:first-child { position: relative; }
/* full screen: the bench alone */
#bench:fullscreen { overflow: auto; padding: 8px 10px; background: var(--bg); }
/* theatre: the page around the bench is hidden; on a wide screen the instruments stand in a row over the board */
body.bench-theatre :is(#site-header, .ws-bar, .page-intro, #site-footer, #elecModesBox, #saleStrip, .sale-strip) { display: none !important; }
body.bench-theatre { --ws-top: 0px; --ws-bar: 0px; }
body.bench-theatre main#bench { max-width: none; width: 100%; padding: 6px 10px 8px !important; }
#bench.is-desk.is-theatre .bench-flow { grid-template-rows: auto auto minmax(0, 1fr) 96px auto;
  grid-template-areas: "ins ins ins" "dock act prt" "dock brd prt" "dock brd mea" "dock cab mea"; }
#bench.is-desk.is-theatre .bench-left { display: contents; }
#bench.is-desk.is-theatre .bench-instruments { grid-area: ins; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
#bench.is-desk.is-theatre .bench-dock { grid-area: dock; }
#bench.is-desk.is-theatre .bench-slot-well { max-height: 210px; overflow: hidden; }
#bench.is-desk.is-theatre .bench-slot.is-big .bench-slot-well { overflow: visible; }

/* Phones under 400 px: an instrument's terminal posts and its label line wrap instead of running 70 px past the
   screen (the power supply and generator panels needed 356 px) */
@media (max-width: 400px) {
  .bench-bar #benchCables > .bench-sockets { min-width: 0; max-width: 100%; }   /* min-width: max-content held it at 356 px */
  .utp-posts { flex-wrap: wrap; }
  .bench-sockets > span { flex-wrap: wrap; white-space: normal; }
  /* the big input → output readout: input above output, the arrow pointing down (side by side needed 338 px) */
  .bench-viobig { grid-template-columns: minmax(0, 1fr); }
  .bench-viobig > i { justify-self: center; transform: rotate(90deg); }
}

/* Last in the file so it wins over the rules it calms: the endless loops of this sheet (bubbles, flame, live sockets, current along cables, motors, aim rings) stand still for
   visitors who asked their system for less motion; the colours still say which socket is live and where current runs */
@media (prefers-reduced-motion: reduce) {
  .bubble, .flame, .pro-socket.is-live .pro-socket-glow, .pro-wire-flow, .bench-spin, .bw-flow, .bench-port.is-fit i, .bw-ring, .sc-flow { animation: none; }
  .ph-scale i, .liquid { transition: none; }
}

/* ---------- the bench on a phone, window by window (labs/bench-phone.js adds .bph on #bench at ≤ 640 px) ---------- */
@media (max-width: 640px) {
  #bench.bph .bph-off { display: none !important; }
  #bench.bph .bench-flow { display: flex !important; flex-direction: column; gap: 10px; }
  #bench.bph .bench-left, #bench.bph .bench-layout, #bench.bph .bench-main, #bench.bph .bench-side { display: contents !important; }
  #bench.bph .bench-nav { display: none !important; }
  #bench.bph .bench-actbar { order: 1 !important; }
  #bench.bph .bench-main > section:first-child { order: 2 !important; margin: 0; }
  #bench.bph .bench-cablebar { order: 3 !important; margin: 0; padding: 8px; }
  #bench.bph .bph-sheets { order: 4 !important; }
  #bench.bph #benchPalette, #bench.bph #benchInstruments, #bench.bph .bench-measure, #bench.bph #benchDock, #bench.bph .bench-details { order: 5 !important; margin: 0; }
  #bench.bph .bench-cablebar > b, #bench.bph .bench-cabletip { font-size: .8rem; }
  /* the socket strip right under the board: every instrument's sockets in one row that slides sideways */
  #bench.bph #benchCables { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
  #bench.bph #benchCables > .bench-sockets { flex: none; scroll-snap-align: start; min-width: 0; }
  /* the tab rows: one row, never wrapping */
  #bench.bph .bph-row { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px; border-radius: 14px; background: var(--surface-2, var(--surface)); border: 1px solid var(--border); }
  #bench.bph .bph-row::-webkit-scrollbar { display: none; }
  #bench.bph .bph-tab { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
  #bench.bph .bph-tab i { font-style: normal; }
  #bench.bph .bph-tab.is-on { background: var(--primary, #2e7d32); color: var(--on-primary, #fff); }
  #bench.bph .bph-insts, #bench.bph .bph-cats { margin-bottom: 10px; }
  /* parts: a grid of tiles, four in a row */
  #bench.bph #benchPalette .pro-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  #bench.bph #benchPalette .bench-cat > .panel-title, #bench.bph #benchPalette .bench-group > summary { display: none; }
  /* instruments: the chosen one takes the whole window */
  #bench.bph #benchInstruments { display: block !important; }
  #bench.bph #benchInstruments .bench-slot:not(.bph-off), #bench.bph #benchInstruments .bench-slot-well { display: block !important; }
  #bench.bph #benchInstruments .bench-box { order: 0 !important; margin: 0; }
  #bench.bph #benchPalette { max-height: none; overflow: visible; }
  #bench.bph #benchInstruments .bench-slot { width: 100%; max-width: none; }
  #bench.bph #benchInstruments .bench-slot-well, #bench.bph #benchInstruments .bench-box { width: 100%; max-width: none; }
}