/* ==========================================================================
   Electrical Engineering Fundamentals — interactive companion
   Design system
   --------------------------------------------------------------------------
   Semantic colour language (used site-wide, never decoratively):
     VOLTAGE = blue      CURRENT = orange     POWER = aqua
   Validated for CVD safety + contrast in both light and dark modes.
   ========================================================================== */

:root {
  color-scheme: light;

  /* surfaces & ink */
  --plane:        #f4f3ef;
  --surface:      #faf9f6;
  --surface-2:    #efeee9;
  --ink:          #0b0b0b;
  --ink-2:        #52514e;
  --muted:        #898781;
  --grid:         #e1e0d9;
  --rule:         #c3c2b7;
  --border:       rgba(11, 11, 11, .10);
  --border-2:     rgba(11, 11, 11, .16);
  --shadow:       0 1px 2px rgba(11,11,11,.05), 0 8px 24px -12px rgba(11,11,11,.14);

  /* the three quantities */
  --volt:         #2a78d6;
  --volt-soft:    rgba(42, 120, 214, .12);
  --curr:         #eb6834;
  --curr-soft:    rgba(235, 104, 52, .12);
  --pow:          #1baf7a;
  --pow-ink:      #0d7a53;           /* darker step for small text (contrast relief) */
  --pow-soft:     rgba(27, 175, 122, .12);

  /* status */
  --good:         #0ca30c;
  --good-ink:     #006300;
  --warn:         #fab219;
  --crit:         #d03b3b;
  --good-soft:    rgba(12, 163, 12, .10);
  --crit-soft:    rgba(208, 59, 59, .10);
  --warn-soft:    rgba(250, 178, 25, .16);

  /* brand */
  --gold:         #c8a45c;

  --radius:       10px;
  --radius-lg:    16px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane:     #0f1013;
    --surface:   #17181c;
    --surface-2: #1f2026;
    --ink:       #ffffff;
    --ink-2:     #c3c2b7;
    --muted:     #898781;
    --grid:      #2c2c2a;
    --rule:      #383835;
    --border:    rgba(255,255,255,.10);
    --border-2:  rgba(255,255,255,.18);
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
    --volt:      #3987e5;  --volt-soft: rgba(57,135,229,.16);
    --curr:      #d95926;  --curr-soft: rgba(217,89,38,.18);
    --pow:       #199e70;  --pow-ink: #2bbd8b; --pow-soft: rgba(25,158,112,.16);
    --good-ink:  #0ca30c;
    --gold:      #d8b979;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:     #0f1013;
  --surface:   #17181c;
  --surface-2: #1f2026;
  --ink:       #ffffff;
  --ink-2:     #c3c2b7;
  --muted:     #898781;
  --grid:      #2c2c2a;
  --rule:      #383835;
  --border:    rgba(255,255,255,.10);
  --border-2:  rgba(255,255,255,.18);
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
  --volt:      #3987e5;  --volt-soft: rgba(57,135,229,.16);
  --curr:      #d95926;  --curr-soft: rgba(217,89,38,.18);
  --pow:       #199e70;  --pow-ink: #2bbd8b; --pow-soft: rgba(25,158,112,.16);
  --good-ink:  #0ca30c;
  --gold:      #d8b979;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--plane);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 620; letter-spacing: -0.015em; }
p { margin: 0 0 1em; }
a { color: var(--volt); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--volt); outline-offset: 2px; border-radius: 4px; }

/* ---------- layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 24px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-in { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 640; letter-spacing: -.02em; color: var(--ink); text-decoration: none; font-size: 15px; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-sub { color: var(--muted); font-weight: 450; }
.topbar-spacer { flex: 1; }
.topnav { display: flex; gap: 4px; align-items: center; }
.topnav a { color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.topnav a:hover { background: var(--surface-2); color: var(--ink); }

.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border); border-radius: 9px;
  cursor: pointer; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
[data-theme="dark"] .i-sun, :root:not([data-theme="light"]) .i-sun { display: none; }
[data-theme="dark"] .i-moon, :root:not([data-theme="light"]) .i-moon { display: block; }
.i-moon { display: none; }
[data-theme="light"] .i-sun { display: block; }
[data-theme="light"] .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .i-sun { display: block; }
  :root:not([data-theme="dark"]) .i-moon { display: none; }
}

/* ---------- hero ---------- */
.hero { padding: 72px 0 40px; position: relative; overflow: hidden; }
.hero h1 { font-size: clamp(34px, 5.4vw, 54px); font-weight: 680; letter-spacing: -.032em; max-width: 17ch; }
.hero .lede { font-size: clamp(16px, 2vw, 19px); color: var(--ink-2); max-width: 58ch; margin-top: 18px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--gold); border-radius: 2px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--ink); font-weight: 550; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--plane); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); color: var(--plane); border-color: var(--ink-2); }
.btn-sm { padding: 6px 12px; font-size: 13.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- the three quantities: legend + chips ---------- */
.qlegend { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 520;
  padding: 5px 11px 5px 9px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-2);
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chip.v .dot { background: var(--volt); } .chip.v { background: var(--volt-soft); }
.chip.i .dot { background: var(--curr); } .chip.i { background: var(--curr-soft); }
.chip.p .dot { background: var(--pow);  } .chip.p { background: var(--pow-soft); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* chapter cards on landing */
.ch-card {
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; transition: border-color .14s, transform .14s, box-shadow .14s;
  position: relative; overflow: hidden;
}
.ch-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--rule);
  transition: background .14s;
}
.ch-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); color: inherit; }
.ch-card.live::before { background: var(--gold); }
.ch-card.live:hover::before { background: var(--curr); }
.ch-card .num { font-size: 12px; font-weight: 640; letter-spacing: .1em; color: var(--muted); }
.ch-card .ttl { font-size: 16.5px; font-weight: 600; letter-spacing: -.015em; }
.ch-card .meta { font-size: 13.5px; color: var(--ink-2); }
.ch-card.soon { opacity: .62; }
.ch-card.soon:hover { transform: none; box-shadow: none; }

.tag {
  display: inline-block; font-size: 11px; font-weight: 640; letter-spacing: .07em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.tag.live { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }

/* ---------- section headers ---------- */
.sec { padding: 44px 0; }
.sec-head { margin-bottom: 22px; }
.sec-head h2 { font-size: clamp(21px, 3vw, 27px); letter-spacing: -.022em; }
.sec-head p { color: var(--ink-2); margin: 8px 0 0; max-width: 62ch; }

/* ---------- math typography ---------- */
.eq { font-family: var(--mono); font-size: .95em; white-space: nowrap; }
.eq i, var { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.06em; }
.frac { display: inline-flex; flex-direction: column; vertical-align: -0.55em; text-align: center; margin: 0 .18em; line-height: 1.15; }
.frac > span:first-child { border-bottom: 1px solid currentColor; padding: 0 .25em .06em; }
.frac > span:last-child { padding: .06em .25em 0; }
.eqblock {
  display: block; text-align: center; margin: 14px 0; padding: 14px 16px;
  background: var(--surface-2); border-radius: var(--radius); font-size: 17px;
  border: 1px solid var(--border);
}
.u { color: var(--muted); font-family: var(--sans); font-size: .88em; margin-left: .15em; }
.tv { color: var(--volt); font-weight: 600; }
.ti { color: var(--curr); font-weight: 600; }
.tp { color: var(--pow-ink); font-weight: 600; }

/* ---------- exercise list ---------- */
.ex-list { display: grid; gap: 12px; }
.ex-card {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; cursor: pointer; text-align: left; width: 100%;
  transition: border-color .14s, transform .14s, box-shadow .14s;
}
.ex-card:hover { border-color: var(--border-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.ex-num {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 640; font-size: 15px; color: var(--ink-2);
  border: 1px solid var(--border); position: relative;
}
.ex-card.done .ex-num { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.ex-body h3 { font-size: 16.5px; margin-bottom: 3px; }
.ex-body p { font-size: 14px; color: var(--ink-2); margin: 0; }
.ex-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.badge {
  font-size: 11px; font-weight: 640; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted);
  background: var(--surface-2); white-space: nowrap;
}
.badge.sim { color: var(--curr); background: var(--curr-soft); border-color: transparent; }
.badge.drill { color: var(--volt); background: var(--volt-soft); border-color: transparent; }
.badge.concept { color: var(--pow-ink); background: var(--pow-soft); border-color: transparent; }
.ex-ref { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- exercise stage ---------- */
.stage { display: none; }
.stage.on { display: block; }
.stage-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--border);
}
.stage-head h2 { font-size: clamp(20px, 3vw, 26px); letter-spacing: -.022em; }
.stage-head .sub { color: var(--ink-2); font-size: 14.5px; margin-top: 5px; }
.stage-head .spacer { flex: 1; }
.backlink {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2);
  text-decoration: none; background: none; border: none; cursor: pointer; padding: 6px 0; margin-bottom: 4px;
}
.backlink:hover { color: var(--ink); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel-title { font-size: 12px; font-weight: 640; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* bench: full-width schematic on top, control cards beneath */
.bench { display: grid; gap: 16px; }
.bench-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }

/* schematic canvas */
.canvas {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; display: block; width: 100%; overflow: hidden;
}
.canvas svg { display: block; width: 100%; height: auto; }
svg text { font-family: var(--sans); }

/* ---------- controls ---------- */
.ctrl-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ctrl-row + .ctrl-row { margin-top: 12px; }

.toggle {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; width: 100%;
  text-align: left; transition: border-color .12s, background .12s;
}
.toggle:hover { border-color: var(--border-2); }
.toggle .sw {
  width: 38px; height: 22px; border-radius: 999px; background: var(--rule); flex: none;
  position: relative; transition: background .16s;
}
.toggle .sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .16s;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.toggle[aria-pressed="true"] .sw { background: var(--curr); }
.toggle[aria-pressed="true"] .sw::after { transform: translateX(16px); }
.toggle .lbl { flex: 1; min-width: 0; }
.toggle .lbl b { display: block; font-weight: 570; font-size: 14.5px; }
.toggle .lbl span { display: block; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 560; color: var(--ink-2); }
input[type="text"], input[type="number"], select {
  font: inherit; font-size: 15px; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--ink);
  min-width: 0; width: 100%; font-variant-numeric: tabular-nums;
}
input.mono { font-family: var(--mono); font-size: 14px; }
input[aria-invalid="true"] { border-color: var(--crit); background: var(--crit-soft); }
input.ok { border-color: var(--good); background: var(--good-soft); }
input[type="range"] { width: 100%; accent-color: var(--volt); }

.answer-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.answer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

.verdict { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 550; margin-top: 12px; min-height: 22px; }
.verdict.ok { color: var(--good-ink); }
.verdict.no { color: var(--crit); }
.verdict svg { width: 16px; height: 16px; flex: none; }

.note {
  font-size: 14px; color: var(--ink-2); background: var(--surface-2); border-left: 3px solid var(--rule);
  padding: 12px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin: 14px 0 0;
}
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.note.good { border-left-color: var(--good); background: var(--good-soft); }
.note.crit { border-left-color: var(--crit); background: var(--crit-soft); }
.note b { font-weight: 620; }

/* readout / stat tile */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-size: 30px; font-weight: 640; letter-spacing: -.03em; line-height: 1.1; }
.stat .v small { font-size: .5em; font-weight: 550; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.stat.v-volt .v { color: var(--volt); }
.stat.v-curr .v { color: var(--curr); }
.stat.v-pow  .v { color: var(--pow-ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 18px; }

/* meter */
.meter { margin-top: 4px; }
.meter-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); position: relative; }
.meter-fill { height: 100%; background: var(--curr); border-radius: 999px; transition: width .25s ease, background .25s; }
.meter-fill.over { background: var(--crit); }
.meter-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 5px; font-variant-numeric: tabular-nums; }

/* table */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 640; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num { text-align: right; }
table.data tr.hl td { background: var(--surface-2); }

details.reveal { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
details.reveal summary { cursor: pointer; font-size: 14px; font-weight: 560; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 7px; }
details.reveal summary::-webkit-details-marker { display: none; }
details.reveal summary::before { content: "▸"; color: var(--muted); transition: transform .15s; display: inline-block; }
details.reveal[open] summary::before { transform: rotate(90deg); }
details.reveal .body { margin-top: 12px; font-size: 14.5px; color: var(--ink-2); }
details.reveal .body p:last-child { margin-bottom: 0; }

/* progress ring */
.ring { width: 46px; height: 46px; flex: none; }
.ring circle { fill: none; stroke-width: 4; }
.ring .bg { stroke: var(--grid); }
.ring .fg { stroke: var(--good); stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.ring-wrap { display: flex; align-items: center; gap: 12px; }
.ring-wrap .txt b { display: block; font-size: 14.5px; font-weight: 600; }
.ring-wrap .txt span { font-size: 13px; color: var(--muted); }

/* chart */
.chart-title { font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.chart-title .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px; box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums; white-space: nowrap; opacity: 0; transition: opacity .1s; z-index: 5;
}
.chart-host { position: relative; }

/* footer */
footer.site {
  border-top: 1px solid var(--border); margin-top: 56px; padding: 32px 0 48px;
  font-size: 14px; color: var(--ink-2);
}
footer.site a { color: var(--ink-2); }
.fgrid { display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; }

.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- questions & options ---------- */
.q + .q { margin-top: 4px; }
.q-text { font-size: 15px; margin-bottom: 12px; line-height: 1.55; }
.q-text b { font-weight: 640; }
hr.qsep { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.opts { display: grid; gap: 8px; }
.opts-inline { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.opt {
  display: flex; align-items: flex-start; gap: 11px; text-align: left; width: 100%;
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-size: 14.5px; line-height: 1.45;
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--border-2); }
.opt .mark {
  width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--rule);
  flex: none; margin-top: 2px; position: relative; transition: border-color .12s;
}
.opt .mark.sq { border-radius: 5px; }
.opt[aria-checked="true"] { border-color: var(--volt); background: var(--volt-soft); }
.opt[aria-checked="true"] .mark { border-color: var(--volt); }
.opt[aria-checked="true"] .mark::after {
  content: ""; position: absolute; inset: 2.5px; border-radius: inherit; background: var(--volt);
}
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.correct .mark { border-color: var(--good); }
.opt.correct .mark::after { background: var(--good); }
.opt.wrong { border-color: var(--crit); background: var(--crit-soft); }
.opt.wrong .mark { border-color: var(--crit); }
.opt.wrong .mark::after { background: var(--crit); }

/* ---------- streak dots ---------- */
.streak { display: flex; align-items: center; gap: 7px; margin-top: 14px; }
.streak .dot {
  width: 11px; height: 11px; border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--rule); transition: background .2s, border-color .2s;
}
.streak .dot.on { background: var(--good); border-color: var(--good); }
.streak-txt { font-size: 12.5px; color: var(--muted); margin-left: 5px; }

/* ---------- multimeter ---------- */
.dmm { border: 1px solid var(--border-2); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.dmm-screen {
  background: #101512; border-radius: 8px; padding: 14px 16px; text-align: right;
  font-family: var(--mono); font-size: 32px; font-weight: 600; color: #7ce8b0;
  letter-spacing: .02em; font-variant-numeric: tabular-nums; line-height: 1.1;
  box-shadow: inset 0 1px 6px rgba(0,0,0,.5);
}
.dmm-unit { font-size: 16px; color: #4fbf8a; margin-left: 6px; }
.dmm-leads { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.dmm-leads b { font-family: Georgia, serif; font-style: italic; font-size: 15px; color: var(--ink); }
.lead { width: 10px; height: 10px; border-radius: 50%; display: inline-block; vertical-align: -1px; margin-right: 3px; }
.lead.red { background: var(--crit); }
.lead.black { background: var(--ink); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--ink); color: var(--plane); padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 550; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 30px -8px rgba(0,0,0,.5); opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 100;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 15px; height: 15px; }

.nodehit:hover circle:nth-child(2) { stroke: var(--volt); }

@media (max-width: 640px) {
  .wrap, .wrap-narrow { padding: 0 16px; }
  .hero { padding: 44px 0 28px; }
  .ex-card { grid-template-columns: 38px 1fr; }
  .ex-side { grid-column: 2; flex-direction: row; align-items: center; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand-sub { display: none; }
  .brand { font-size: 14px; }
  .topnav a { padding: 6px 6px; }
}
/* On a phone a full circuit at 350px is unreadable — let it scroll instead of shrink. */
@media (max-width: 560px) {
  .canvas { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .canvas svg { min-width: 470px; }
  .canvas::after {
    content: "swipe the diagram sideways to see all of it";
    display: block; font-size: 11px; color: var(--muted); padding: 6px 2px 0; position: sticky; left: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
