
/* Layout: floating pill bar (tabs left, word width right). Calm neutral surfaces, one teal accent, soft cards. Theme switch top right. */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --solid: #ffffff;
  --sunken: #f0f1f4;
  --ink: #0b0c0e;
  --muted: #5d636e;
  --line: #dde0e5;
  --grid: #e7e9ed;
  --accent: #0b5ed7;
  --accent-soft: #e5eefc;
  --on-accent: #ffffff;
  --good: #0f8a4a;
  --warn: #b85c00;
  --bad: #d4183d;
  --bar: rgba(243, 244, 246, 0.9);
  --shadow: 0 1px 2px rgba(10, 12, 20, 0.06);
  --m1: #0b5ed7; --m2: #c026d3; --poly: #e11d48; --diff: #16a34a; --via: #d4a300;
  --s1: #9cc0f5; --s2: #5f97ea; --s3: #2f72d9; --s4: #1652ad; --s5: #0b3478;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #000000; --solid: #0f0f10; --sunken: #141416; --ink: #f4f4f5; --muted: #8b8f98; --line: #26272b; --grid: #1d1e21;
    --accent: #ffd60a; --accent-soft: rgba(255, 214, 10, 0.13); --on-accent: #000000; --good: #30d158; --warn: #ff9f0a; --bad: #ff375f;
    --bar: rgba(0, 0, 0, 0.88); --shadow: none;
    --m1: #3d9bff; --m2: #ff4fd8; --poly: #ff375f; --diff: #30d158; --via: #ffd60a;
    --s1: #134a8a; --s2: #1f6fd0; --s3: #3d9bff; --s4: #7dbcff; --s5: #c2e0ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #000000; --solid: #0f0f10; --sunken: #141416; --ink: #f4f4f5; --muted: #8b8f98; --line: #26272b; --grid: #1d1e21;
    --accent: #ffd60a; --accent-soft: rgba(255, 214, 10, 0.13); --on-accent: #000000; --good: #30d158; --warn: #ff9f0a; --bad: #ff375f;
    --bar: rgba(0, 0, 0, 0.88); --shadow: none;
    --m1: #3d9bff; --m2: #ff4fd8; --poly: #ff375f; --diff: #30d158; --via: #ffd60a;
    --s1: #134a8a; --s2: #1f6fd0; --s3: #3d9bff; --s4: #7dbcff; --s5: #c2e0ff;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 14.5px; line-height: 1.5; padding-inline: 16px; padding-block: 20px 56px; -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1160px; margin-inline: auto; display: flex; flex-direction: column; gap: 18px; }
h1, h2, h3 { font-weight: 600; margin: 0; text-wrap: balance; }
h1 { font-size: 1.55rem; letter-spacing: -0.02em; font-weight: 650; }
h2 { font-size: 0.98rem; letter-spacing: -0.005em; }
h3 { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
sub, sup { line-height: 0; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.brand p { color: var(--muted); max-width: 58ch; font-size: 0.9rem; }
.brand > div { min-width: 0; }

.theme { flex: none; position: relative; width: 62px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--sunken); cursor: pointer; padding: 0; color: var(--muted); }
.theme .knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); display: grid; place-items: center; transition: transform 0.2s ease; }
.theme[aria-checked="true"] .knob { transform: translateX(28px); }
.theme .knob svg { grid-area: 1 / 1; width: 15px; height: 15px; }
.theme .moon { display: none; }
.theme[aria-checked="true"] .sun { display: none; }
.theme[aria-checked="true"] .moon { display: block; }

.bar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 8px); z-index: 5; background: var(--bar); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 16px; padding: 6px; box-shadow: var(--shadow); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; }
.bar { will-change: transform; }
.bar.bar-glide { transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
.bar.bar-hide { pointer-events: none; }
.tabs { display: flex; gap: 2px; background: var(--sunken); padding: 3px; border-radius: 12px; }
.tabs button { border: 0; background: transparent; color: var(--muted); font: 600 0.9rem var(--font-ui); padding: 8px 18px; min-height: 38px; border-radius: 9px; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.wctl { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding-inline: 6px; }
.seg { display: inline-flex; gap: 2px; background: var(--sunken); padding: 3px; border-radius: 11px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 500 0.84rem var(--font-mono); padding: 7px 11px; min-height: 34px; border-radius: 8px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.lbl { font-size: 0.8rem; color: var(--muted); }
.cw { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.cw input { width: 60px; font: 500 0.85rem var(--font-mono); background: var(--sunken); color: var(--ink); border: 1px solid transparent; border-radius: 9px; padding: 7px 8px; min-height: 34px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 820px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; box-shadow: var(--shadow); }
@media (max-width: 520px) { .card { padding: 16px; border-radius: 16px; } }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fields .wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .fields { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 0.8rem; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.field label small { font-weight: 400; color: var(--muted); }
.inrow { display: flex; gap: 6px; min-width: 0; align-items: flex-start; }
input.val, textarea.val, select { font: 500 0.92rem var(--font-mono); background: var(--sunken); color: var(--ink); border: 1px solid transparent; border-radius: 10px; padding: 9px 11px; min-height: 42px; min-width: 0; width: 100%; }
input.val:focus, textarea.val:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.val { resize: none; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; field-sizing: content; }
select { width: auto; font-family: var(--font-ui); font-weight: 500; }
input.val[aria-invalid="true"], textarea.val[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-size: 0.78rem; min-height: 1.1em; }
.copy { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 10px; font: 500 0.75rem var(--font-ui); padding: 0 12px; min-height: 42px; cursor: pointer; }
.copy.sm { min-height: 26px; padding: 0 9px; margin-left: 8px; border-radius: 8px; }
.copy:hover { color: var(--accent); border-color: var(--accent); }

.bitpanel { background: var(--sunken); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.bitrow { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 10px; }
.rowlbl { flex: none; width: 66px; font-size: 0.72rem; color: var(--muted); padding-top: 8px; }
.bytes { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.byte { display: flex; gap: 6px; }
.nib { display: flex; gap: 3px; }
.bitbtn { width: 30px; min-height: 46px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: 600 1.02rem var(--font-mono); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; padding: 0; }
.bitpanel.dense .bitbtn { width: 26px; font-size: 0.92rem; border-radius: 8px; }
.bitbtn small { font: 400 0.6rem var(--font-mono); opacity: 0.75; }
.bitbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.bitbtn.sign { box-shadow: 0 0 0 2px var(--warn); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; font: 500 0.82rem var(--font-mono); padding: 8px 12px; min-height: 38px; cursor: pointer; }
.chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

dl.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 0.84rem; }
dl.kv dd { margin: 0; font: 500 0.86rem var(--font-mono); overflow-wrap: anywhere; text-align: right; }
.steps { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: baseline; font-size: 0.84rem; overflow-x: auto; }
.steps .k { color: var(--muted); }
.scroll { overflow-x: auto; }
.note { font-size: 0.8rem; color: var(--muted); }
.hint { font-size: 0.8rem; color: var(--muted); }

.aluin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 640px) { .aluin { grid-template-columns: minmax(0, 1fr); } }
.opgroup { display: flex; flex-direction: column; gap: 8px; }
.flags { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.flag { border-radius: 12px; background: var(--sunken); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid transparent; }
.flag b { font: 650 1.3rem var(--font-mono); }
.flag span { font-size: 0.74rem; color: var(--muted); }
.flag.on { border-color: var(--warn); }
.flag.on b { color: var(--warn); }
.flag.na { opacity: 0.45; }
@media (max-width: 440px) { .flags { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.readout { background: var(--sunken); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.rd-main { font: 650 1.6rem/1.25 var(--font-mono); overflow-wrap: anywhere; letter-spacing: -0.01em; }
.rd-sub { font-size: 0.84rem; color: var(--muted); }
pre.work { margin: 0; font: 500 0.88rem/1.7 var(--font-mono); background: var(--sunken); border-radius: 12px; padding: 12px 14px; min-width: min-content; }
.work .c { color: var(--warn); }
.work .res { color: var(--accent); font-weight: 700; }
.verdict { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; }
.ok { color: var(--good); }
.bad { color: var(--bad); }
[hidden] { display: none !important; }

/* ---------- MOSFET ---------- */
.mos { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.mos-side, .mos-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 900px) {
  .mos { grid-template-columns: minmax(0, 1fr); }
  .mos-side, .mos-main { display: contents; }
  #c-dev { order: 1; } #c-bias { order: 2; } #c-plot { order: 3; } #c-op { order: 4; } #c-size { order: 5; } #c-inv { order: 6; } #c-notes { order: 7; }
}
.mfields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mfields .field label { font-weight: 500; }
details.fold { border-top: 1px solid var(--line); padding-top: 12px; }
details.fold > summary { cursor: pointer; font-weight: 600; font-size: 0.86rem; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
details.fold > summary::after { content: "+"; font-family: var(--font-mono); color: var(--muted); }
details.fold[open] > summary::after { content: "\2212"; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > .fold-body { padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.pair { display: flex; gap: 12px; align-items: center; }
.pair input[type=range] { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); height: 32px; }
.pair input.val { width: 92px; flex: none; }
.bias { display: flex; flex-direction: column; gap: 4px; }
.bias label { font-size: 0.84rem; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.bias label small { color: var(--muted); font-weight: 400; }

.pill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 5px 13px 5px 11px; font-weight: 600; font-size: 0.86rem; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.regiontext { max-width: 72ch; }
.tilegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--sunken); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tn { font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.tv { font-size: 1.05rem; font-weight: 650; overflow-wrap: anywhere; letter-spacing: -0.01em; }
.th { font-size: 0.72rem; color: var(--muted); overflow-wrap: anywhere; opacity: 0.9; }
.group { display: flex; flex-direction: column; gap: 10px; }

.plotsel { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.plotsel .seg button { font-family: var(--font-ui); font-weight: 500; }
.plotwrap { position: relative; min-width: 0; }
.plotwrap svg { display: block; width: 100%; touch-action: pan-y; overflow: visible; }
.plotwrap text { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.plotwrap text.ink { fill: var(--ink); }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font: 500 0.78rem var(--font-mono); color: var(--ink); white-space: nowrap; z-index: 2; box-shadow: var(--shadow); }
.tip div { display: flex; align-items: center; gap: 6px; }
.tip .th0 { color: var(--muted); margin-bottom: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
table.dt { border-collapse: collapse; font: 500 0.78rem var(--font-mono); min-width: 100%; }
table.dt th, table.dt td { padding: 5px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dt th { color: var(--muted); font-weight: 500; }

.notes { display: flex; flex-direction: column; gap: 0; }
.notes details { border-top: 1px solid var(--line); padding-block: 12px; }
.notes details:first-of-type { border-top: 0; }
.notes summary { cursor: pointer; font-weight: 600; }
.notes .nb { padding-top: 8px; display: flex; flex-direction: column; gap: 8px; max-width: 74ch; font-size: 0.9rem; }
.notes code, .nb code { font-family: var(--font-mono); font-size: 0.85em; background: var(--sunken); padding: 1px 6px; border-radius: 6px; }
.nb ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.eq { font-family: var(--font-mono); font-size: 0.82rem; background: var(--sunken); border-radius: 12px; padding: 10px 12px; overflow-x: auto; white-space: pre; }

/* ---------- RISC-V ---------- */
.rv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.rv-head h2 { margin-right: auto; }
.switchrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; }
.switchrow input { width: 18px; height: 18px; accent-color: var(--accent); }
textarea.code { font: 500 0.84rem/1.6 var(--font-mono); min-height: 250px; resize: vertical; white-space: pre; overflow: auto; tab-size: 2; field-sizing: fixed; }
.card { position: relative; }
.swapbtn { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: 600 1rem var(--font-mono); cursor: grab; opacity: 0.55; display: none; align-items: center; justify-content: center; padding: 0; }
#tab-mos .swapbtn, #tab-rv .swapbtn { display: inline-flex; }
.card:hover > .swapbtn, .swapbtn:focus-visible, .swap-pick > .swapbtn { opacity: 1; }
.swapbtn:hover { border-color: var(--accent); color: var(--accent); }
.swap-pick { outline: 2px solid var(--accent); outline-offset: 2px; }
.swap-over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.swap-flash { animation: swapflash .5s ease; }
@keyframes swapflash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
#tab-mos .card > h2, #tab-rv .card > h2 { padding-right: 40px; }
.rv-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .rv-grid { grid-template-columns: minmax(0, 1fr); } #rv-regs { order: -1; } }
table.ins { border-collapse: collapse; width: 100%; font: 500 0.8rem var(--font-mono); }
table.ins th, table.ins td { padding: 5px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.ins th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--surface); }
table.ins td.mean { color: var(--muted); font-family: var(--font-ui); font-weight: 400; }
table.ins td.enc { color: var(--muted); }
table.ins td.rvc { color: var(--accent); }
table.ins tr.lbl td { color: var(--accent); font-weight: 650; padding-top: 10px; border-bottom: 0; }
table.ins tr.src td { color: var(--muted); font-family: var(--font-mono); font-weight: 400; background: var(--sunken); }
table.ins tr.row { cursor: pointer; }
table.ins tr.row:hover { background: var(--sunken); }
table.ins tr.cur { background: var(--accent-soft); }
table.ins tr.cur td { color: var(--ink); }
table.ins tr.nxt td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.regs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.reg { background: var(--sunken); border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; border: 1px solid transparent; min-width: 0; }
.reg.ghost { opacity: 0.7; border-style: dashed; justify-content: center; }
.reg.chg { background: var(--accent-soft); border-color: var(--accent); }
.reg .rn { font-size: 0.72rem; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.reg .rx { font: 600 0.84rem var(--font-mono); }
.reg .rd { font: 400 0.72rem var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.stepper { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper .seg button { font-family: var(--font-ui); padding-inline: 12px; }
.stepper input[type=range] { flex: 1 1 140px; min-width: 0; accent-color: var(--accent); height: 32px; }
.banner { display: flex; flex-direction: column; gap: 4px; background: var(--sunken); border-radius: 14px; padding: 12px 14px; }
.banner .big { font: 650 1.25rem var(--font-mono); overflow-wrap: anywhere; }
.banner .sub { font-size: 0.82rem; color: var(--muted); }
.banner.bad { box-shadow: inset 0 0 0 1.5px var(--bad); }
.banner.warn { box-shadow: inset 0 0 0 1.5px var(--warn); }
table.tr { border-collapse: collapse; width: 100%; font: 500 0.78rem var(--font-mono); }
table.tr th, table.tr td { padding: 4px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.tr th { color: var(--muted); font-weight: 500; }
table.tr tr.row { cursor: pointer; }
table.tr tr.row:hover, table.tr tr.cur { background: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- look: plain panels, crisp 1px edges, layout-editor layer colours on true black ---------- */
html, body { background: var(--bg); }
body { margin: 0; font-size: 14.5px; }
.wrap { gap: 16px; }
.brand .site-name { color: var(--ink); max-width: none; }
h1, .site-name { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; margin: 0; }
.page-h1 { font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.7rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin: 6px 2px -4px; max-width: 40ch; }
h2 { font-size: 0.98rem; font-weight: 600; }
h3 { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.brand { gap: 14px; }
.brand p { margin-top: 3px; font-size: 0.9rem; max-width: 60ch; }

/* processor logo: package, die, pins that light round the edge like a clock */
.logo { width: 48px; height: 48px; border-radius: 0; background: none; display: block; flex: none; }
.logo svg { width: 48px; height: 48px; display: block; overflow: visible; }
.logo .pkg { fill: #16171a; stroke: #3a3b40; stroke-width: 1; }
.logo .die { fill: #232428; stroke: #45464c; stroke-width: 0.6; }
.logo .bus { stroke: var(--m1); stroke-width: 0.9; opacity: 0.55; fill: none; }
.logo .blk { fill: var(--via); }
.logo .b1 { animation: blink 1.4s steps(1) infinite; }
.logo .b2 { fill: var(--m2); animation: blink 1.4s steps(1) -0.45s infinite; }
.logo .b3 { fill: var(--diff); animation: blink 1.4s steps(1) -0.9s infinite; }
.logo .pin1 { fill: #6a6b72; }
.logo .pin { stroke: #9a9ca3; stroke-width: 2.4; stroke-linecap: butt; animation: pin 1.44s linear infinite; }
@keyframes pin { 0%, 12% { stroke: var(--via); } 13%, 100% { stroke: #9a9ca3; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.2; } }

.theme { background: var(--sunken); border-color: var(--line); }
.theme .knob { background: var(--solid); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.25); border: 1px solid var(--line); }

/* tab bar */
.bar { border-radius: 10px; padding: 6px; background: var(--bar); box-shadow: none; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.tabs { background: transparent; padding: 0; gap: 2px; }
.tabs button { border-radius: 6px; padding: 8px 16px; font-weight: 500; }
.tabs button:hover { background: var(--sunken); color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; font-weight: 600; }
/* hover: soft pill + 4% lift, mouse only; transform does not move the neighbours */
@media (hover: hover) and (pointer: fine) {
  .tabs button { transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease; }
  .tabs button:hover:not([aria-selected="true"]) { transform: scale(1.04); background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); }
}
@media (prefers-reduced-motion: reduce) { .tabs button:hover:not([aria-selected="true"]) { transform: none; } }
.seg { border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); padding: 2px; }
.seg button { border-radius: 6px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* panels */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; box-shadow: var(--shadow); }
input.val, textarea.val, select, .cw input { background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; }
input.val:focus, textarea.val:focus, select:focus { background: var(--solid); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip, .copy { border-radius: 6px; background: var(--solid); border-color: var(--line); }
.chip:hover:not(:disabled), .copy:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"], #rv-run { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
#rv-run:hover { color: var(--on-accent); filter: brightness(1.08); }
.bitpanel, .readout, .banner, pre.work, .eq { border-radius: 8px; border: 1px solid var(--line); }
.bitbtn { border-radius: 4px; background: var(--solid); }
.bitbtn:hover { border-color: var(--accent); }
.bitbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tile, .flag, .reg { border-radius: 6px; border: 1px solid var(--line); background: var(--sunken); }
.tile { border-left: 3px solid var(--m1); }
.group:nth-of-type(2) .tile { border-left-color: var(--m2); }
.group:nth-of-type(3) .tile { border-left-color: var(--diff); }
.group:nth-of-type(4) .tile { border-left-color: var(--poly); }
.group:nth-of-type(5) .tile { border-left-color: var(--via); }
.pill { border-radius: 6px; }
.reg.chg { background: var(--accent-soft); border-color: var(--accent); }
.flag.on { border-color: var(--warn); }
.swapbtn { border-radius: 6px; background: var(--solid); }
table.ins th, table.tr th, table.dt th { background: var(--surface); }
table.ins tr.cur { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tip { border-radius: 6px; background: var(--solid); }
#tab-rv .rv-head { padding-right: 40px; }
.inrow select { flex: none; min-width: 86px; padding-right: 28px; }
::selection { background: var(--accent); color: var(--on-accent); }


/* export + disassembler */
.xrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.xrow .seg button { font-family: var(--font-mono); }
#rv-xview { flex-wrap: wrap; max-width: 100%; }
.xw { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.xpre { margin: 0; font: 500 0.8rem/1.55 var(--font-mono); background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; max-height: 340px; overflow: auto; white-space: pre; tab-size: 8; }
textarea.dis-in { min-height: 130px; }
table.dis { border-collapse: collapse; width: 100%; font: 500 0.8rem var(--font-mono); }
table.dis th, table.dis td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
table.dis th { color: var(--muted); font-weight: 500; }
table.dis td.what { color: var(--muted); font-family: var(--font-ui); font-weight: 400; white-space: normal; min-width: 180px; }
table.dis td.bad { color: var(--bad); }
table.dis .cn { color: var(--accent); display: block; }
.fstrip { display: flex; gap: 2px; }
.fld { display: flex; flex-direction: column; align-items: center; border-radius: 4px; padding: 3px 5px; background: var(--sunken); border-top: 3px solid var(--muted); }
.fld b { font: 600 0.78rem var(--font-mono); letter-spacing: 0.06em; }
.fld span { font: 400 0.66rem var(--font-ui); color: var(--muted); white-space: nowrap; }
.fld.op { border-top-color: var(--m1); } .fld.rd { border-top-color: var(--diff); } .fld.rs { border-top-color: var(--m2); }
.fld.fn { border-top-color: var(--via); } .fld.im { border-top-color: var(--poly); }

/* ---------- pipeline ---------- */
textarea.p-code { min-height: 180px; }
.pstats { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 10px; }
.pstat { background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pstat span { font-size: 0.78rem; color: var(--muted); }
.pstat b { font-size: 1.25rem; font-weight: 600; }
.pstat em { font-style: normal; font-size: 0.72rem; color: var(--muted); }
.pstat.warn b { color: var(--warn); }
.pcompare { grid-column: 1 / -1; }
@media (max-width: 760px) { .pstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pstats > .pstat:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; } }
.pager { display: inline-flex; align-items: center; gap: 8px; }
.pager .chip { min-height: 34px; padding: 6px 12px; }
.plegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--muted); }
.plegend span { display: inline-flex; align-items: center; gap: 6px; }
.plegend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.pgrid-wrap { border: 1px solid var(--line); border-radius: 8px; }
table.pgrid { border-collapse: separate; border-spacing: 0; font: 500 0.74rem var(--font-mono); }
table.pgrid th { color: var(--muted); font-weight: 500; padding: 6px 0; min-width: 38px; text-align: center; position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); }
table.pgrid td { padding: 0; height: 30px; border-bottom: 1px solid var(--grid); }
table.pgrid .pin { position: sticky; left: 0; z-index: 2; background: var(--surface); color: var(--muted); text-align: right; padding: 0 8px; min-width: 34px; }
table.pgrid .pins { position: sticky; left: 34px; z-index: 2; background: var(--surface); text-align: left; padding: 0 12px 0 4px; white-space: nowrap; border-right: 1px solid var(--line); min-width: 190px; }
table.pgrid th.pins, table.pgrid th.pin { z-index: 3; }
td.pc { text-align: center; }
td.pc[class*="st-"] { font-weight: 600; font-size: 0.68rem; letter-spacing: 0.02em; }
.st-IF { background: color-mix(in srgb, var(--m1) 22%, transparent); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--m1) 55%, transparent); }
.st-ID { background: color-mix(in srgb, var(--m2) 20%, transparent); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--m2) 50%, transparent); }
.st-EX { background: color-mix(in srgb, var(--diff) 22%, transparent); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--diff) 55%, transparent); }
.st-MEM { background: color-mix(in srgb, var(--via) 26%, transparent); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--via) 60%, transparent); }
.st-WB { background: color-mix(in srgb, var(--poly) 18%, transparent); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--poly) 50%, transparent); }
.st-stall { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--warn) 28%, transparent) 0 4px, transparent 4px 8px); color: var(--warn); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 55%, transparent); }
.st-flush { background: var(--sunken); color: var(--muted); text-decoration: line-through; box-shadow: inset 0 0 0 1px var(--line); }
td.st-EX.fwd { position: relative; }
td.st-EX.fwd::before { content: ""; position: absolute; left: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--diff); }
.plegend .st-IF, .plegend .st-ID, .plegend .st-EX, .plegend .st-MEM, .plegend .st-WB, .plegend .st-stall, .plegend .st-flush { text-decoration: none; }
tr.prow { cursor: pointer; }
tr.prow:hover td.pins, tr.prow:hover td.pin { color: var(--accent); }
tr.prow.sel td.pins, tr.prow.sel td.pin { box-shadow: inset 3px 0 0 var(--accent); color: var(--ink); background: var(--accent-soft); }
tr.prow.sel td.pins { box-shadow: none; }
tr.pflush td.pins { color: var(--muted); }
.ptag { display: inline-block; margin-left: 8px; font: 600 0.64rem var(--font-ui); padding: 1px 6px; border-radius: 4px; background: var(--sunken); color: var(--muted); border: 1px solid var(--line); vertical-align: 1px; }
.ptag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pdetail { background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; min-height: 56px; }
.pdetail p { max-width: 90ch; }
.warnt { color: var(--warn); font-weight: 600; }
ul.pev { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: 600 0.86rem var(--font-mono); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- timing ---------- */
.sta { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.sta-side, .sta-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 900px) { .sta { grid-template-columns: minmax(0, 1fr); } }
.sgroup { display: flex; flex-direction: column; gap: 8px; }
.sfields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sf { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 6px; row-gap: 4px; align-items: center; min-width: 0; }
.sf span { grid-column: 1 / -1; font-size: 0.8rem; font-weight: 500; }
.sf input { min-width: 0; width: 100%; }
.sf em { font-style: normal; font-size: 0.78rem; color: var(--muted); }
#s-preset { width: 100%; }
.verdicts:empty, #s-kv:empty { display: none; }
.verdicts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.verdict-tile { border-radius: 8px; padding: 12px 14px; border: 1px solid var(--line); background: var(--sunken); display: flex; flex-direction: column; gap: 2px; border-left-width: 4px; }
.verdict-tile span { font-size: 0.8rem; color: var(--muted); }
.verdict-tile b { font-size: 1.45rem; font-weight: 600; }
.verdict-tile em { font-style: normal; font-size: 0.78rem; font-weight: 600; }
.verdict-tile.pass { border-left-color: var(--good); } .verdict-tile.pass em { color: var(--good); }
.verdict-tile.fail { border-left-color: var(--bad); } .verdict-tile.fail em, .verdict-tile.fail b { color: var(--bad); }
@media (max-width: 420px) { .verdicts { grid-template-columns: minmax(0, 1fr); } }
.fixes h3 { margin-bottom: 6px; }
ul.fixlist { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 5px; font-size: 0.88rem; }
.sdiag svg { width: 100%; height: auto; display: block; }
@media (max-width: 640px) { table.pgrid th { min-width: 30px; } td.pc[class*="st-"] { font-size: 0.6rem; } table.pgrid .pin { min-width: 26px; padding: 0 4px; } table.pgrid .pins { left: 26px; min-width: 0; max-width: 104px; font-size: 0.68rem; overflow: hidden; text-overflow: ellipsis; } table.pgrid .pins .ptag { display: none; } table.pgrid th { min-width: 34px; } }
.sd-lbl { font: 500 11px var(--font-ui); fill: var(--muted); }
.sd-val { font: 500 10px var(--font-mono); fill: var(--muted); }
.sd-edge { font: 500 10px var(--font-ui); fill: var(--muted); }
.sd-clk { fill: none; stroke: var(--m1); stroke-width: 1.8; }
.sd-bus { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.sd-chg { stroke: var(--warn); stroke-width: 1; }
.sd-hatch { stroke: var(--warn); stroke-width: 1.5; }
.sd-win { stroke: none; }
.sd-win.setup { fill: color-mix(in srgb, var(--poly) 18%, transparent); }
.sd-win.hold { fill: color-mix(in srgb, var(--m2) 18%, transparent); }
.sd-guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.sd-arr { stroke-width: 2; } .sd-arr.ok { stroke: var(--good); } .sd-arr.bad { stroke: var(--bad); }
.sd-dot.ok { fill: var(--good); } .sd-dot.bad { fill: var(--bad); }
.sd-txt { font: 600 11px var(--font-mono); } .sd-txt.ok { fill: var(--good); } .sd-txt.bad { fill: var(--bad); }
.legend .sw { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.setup { background: color-mix(in srgb, var(--poly) 30%, transparent); }
.sw.hold { background: color-mix(in srgb, var(--m2) 30%, transparent); }
.sw.chg { background: repeating-linear-gradient(135deg, var(--warn) 0 2px, transparent 2px 4px); }

/* ---------- about, pages, footer ---------- */
.about-tool { margin-top: 6px; }
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 32px; }
@media (max-width: 820px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }
.prose { display: flex; flex-direction: column; gap: 10px; font-size: 0.93rem; line-height: 1.6; }
.prose p, .prose li { max-width: 72ch; }
.prose ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.prose h3 { margin-top: 8px; font-size: 0.92rem; color: var(--ink); font-weight: 600; }
.prose .lead { font-size: 1.05rem; color: var(--ink); }
.faq { display: flex; flex-direction: column; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq details:first-child { border-top: 0; padding-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-family: var(--font-mono); }
.faq details[open] summary::after { content: "\2212"; }
.faq p { padding-top: 6px; font-size: 0.88rem; color: var(--muted); max-width: 70ch; line-height: 1.55; }
section.page { max-width: 820px; width: 100%; }
section.page .prose > h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 2px; }
.cform { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 6px; }
.cform .field span { font-size: 0.82rem; font-weight: 600; }
.cform .wide { grid-column: 1 / -1; }
.cform textarea { resize: vertical; min-height: 140px; }
.cform select { width: 100%; }
.cactions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.chip.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; padding-inline: 18px; }
.chip.primary:hover { color: var(--on-accent); filter: brightness(1.06); }
@media (max-width: 560px) { .cform { grid-template-columns: minmax(0, 1fr); } }
.site-foot { margin-top: 18px; padding: 26px 4px 8px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px 40px; }
.foot-name { font-weight: 600; font-size: 1rem; margin-bottom: 4px; }
.foot-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.foot-cols h3 { margin-bottom: 8px; color: var(--ink); font-size: 0.85rem; }
.foot-cols a { display: block; color: var(--muted); text-decoration: none; font-size: 0.88rem; padding: 4px 0; }
.foot-cols a:hover { color: var(--accent); }
.foot-legal { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .site-foot { grid-template-columns: minmax(0, 1fr); } }
a { color: var(--accent); }

/* tab bar: scroll sideways on narrow screens instead of wrapping into rows */
@media (max-width: 760px) {
  .tabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; }
  .bar { flex-direction: column; align-items: stretch; }
}

/* ---------- share, phone tab grid, solid bar, print, wide screens ---------- */
.bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
.wctl { order: 2; }
.sharebtn { order: 3; margin-left: auto; border: 1px solid var(--line); background: var(--solid); color: var(--ink); border-radius: 6px; font: 500 0.85rem var(--font-ui); padding: 7px 14px; min-height: 36px; cursor: pointer; }
.sharebtn:hover { border-color: var(--accent); }
@media (max-width: 760px) {
  .bar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; width: 100%; gap: 4px; }
  .tabs button { padding: 8px 4px; text-align: center; }
  .sharebtn { margin-left: auto; }
  .wctl { order: 3; padding-inline: 2px; }
  .sharebtn { order: 2; min-height: 32px; padding: 5px 14px; }
}
@media (min-width: 1600px) { .wrap { max-width: 1380px; } }

@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --solid: #fff; --sunken: #f4f5f7; --ink: #000; --muted: #444; --line: #ccc; --grid: #e5e5e5; color-scheme: light; }
  body { background: #fff !important; padding: 0; }
  .bar, .theme, .boot, .site-foot, .swapbtn, .sharebtn, .chips, .pager, #rv-xzip, #rv-xcopy, .boot-skip { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  .logo .pin, .logo .blk { animation: none !important; }
  a { color: #000; }
}

/* ---------- FSM designer ---------- */
.f-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 820px) { .f-grid { grid-template-columns: minmax(0, 1fr); } }
textarea.f-code { min-height: 230px; }
.f-help { display: flex; flex-direction: column; gap: 6px; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.f-help code, #tab-cmos code { font-family: var(--font-mono); font-size: 0.85em; background: var(--solid); border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; }
.f-svg svg { width: 100%; height: auto; display: block; max-height: 640px; }
.f-node { fill: var(--solid); stroke: var(--m1); stroke-width: 2; }
.f-node.rst { stroke: var(--accent); stroke-width: 3; }
.f-sname { font: 600 12px var(--font-mono); fill: var(--ink); }
.f-sout { font: 500 10px var(--font-mono); fill: var(--diff); }
.f-scode { font: 500 10px var(--font-mono); fill: var(--muted); }
.f-edge { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.f-edge.reset { stroke: var(--accent); stroke-width: 2; }
.f-arrowhead { fill: var(--muted); }
.f-elbl { font: 500 11px var(--font-mono); fill: var(--m2); }
.f-elbl.halo, .f-scode.halo { stroke: var(--surface); stroke-width: 4; fill: none; stroke-linejoin: round; }
.f-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .f-two { grid-template-columns: minmax(0, 1fr); } }
table.ftab { border-collapse: collapse; font: 500 0.8rem var(--font-mono); min-width: 100%; }
table.ftab th, table.ftab td { padding: 5px 10px; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.ftab th { color: var(--muted); font-weight: 500; border-bottom-color: var(--line); }
table.ftab tr.first td { border-top: 1px solid var(--line); }
table.ftab td.muted { color: var(--muted); font-style: italic; }
table.ftab.sim tr.hit td { background: var(--accent-soft); }
.feqs { display: flex; flex-direction: column; gap: 6px; }
.feq { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.fname { color: var(--muted); min-width: 64px; }
.fexpr { flex: 1 1 200px; font-size: 0.92rem; overflow-wrap: anywhere; }
.ov { text-decoration: overline; }
.chip.sm { min-height: 28px; padding: 3px 10px; font-size: 0.75rem; margin-left: auto; }
.c2-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.c2-out { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600; }
.c2-out input { width: 96px; }
.c2-eq { padding-bottom: 10px; color: var(--muted); }
.c2-expr { flex: 1 1 260px; font-size: 1rem; }
#c2-svg .cm-wrap { min-height: 120px; }
.cm-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.85rem; color: var(--muted); }
.cm-meta b { color: var(--ink); font-size: 1.05rem; }
.cm-wrap { overflow-x: auto; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.cm-svg { display: block; max-width: none; height: auto; margin: 0 auto; }
.cm-w { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.cm-rail { fill: none; stroke: var(--ink); stroke-width: 2.2; }
.cm-ch { fill: none; stroke: var(--ink); stroke-width: 3; }
.cm-p { fill: none; stroke: var(--m2); stroke-width: 3; }
.cm-n { fill: none; stroke: var(--m1); stroke-width: 3; }
.cm-gt { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.cm-bub { fill: var(--sunken); stroke: var(--ink); stroke-width: 1.4; }
.cm-dot { fill: var(--ink); }
.cm-inv { fill: var(--sunken); stroke: var(--ink); stroke-width: 1.4; }
.cm-g { font: 600 12px var(--font-mono); fill: var(--ink); }
.cm-lbl { font: 500 11px var(--font-ui); fill: var(--ink); }
.cm-lbl.out { font: 600 13px var(--font-mono); fill: var(--accent); }
.cm-lbl.muted { fill: var(--muted); }
input.f-mod { width: 120px; min-height: 34px; padding: 5px 8px; }
#f-seq { width: 100%; }
@media (max-width: 760px) { .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- home ---------- */
#brand { cursor: pointer; border-radius: 8px; }
.home-hero { padding: 18px 2px 6px; display: flex; flex-direction: column; gap: 8px; }
.home-h { font-size: clamp(1.35rem, 1.05rem + 1.2vw, 1.9rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; max-width: 30ch; }
.home-sub { color: var(--muted); font-size: 1rem; max-width: 60ch; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 1100px) { .home-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }   /* 10 cards: always full rows */
.home-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; overflow: hidden; }
.home-card b { font-size: 1.05rem; font-weight: 600; }
.home-card span { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.home-card i { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.home-card { transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease; }
.home-card:hover, .home-card:focus-visible { border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 7%, var(--surface)); transform: translateY(-1px); }
.home-card:focus-visible { outline: 2px solid var(--c, var(--accent)); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .home-card { transition: none; } .home-card:hover { transform: none; } }
article.guide h3 { margin-top: 10px; }
article.guide code { font-family: var(--font-mono); font-size: 0.86em; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
article.guide ol { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.faq h3 { margin-bottom: 4px; }
.about-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 820px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }


/* ---------- team, support ---------- */
.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
#tab-about.page { max-width: none; }
@media (max-width: 1100px) and (min-width: 761px) { .tabs button { padding: 8px 9px; } .chaibtn { padding: 7px 9px; } }
@media (max-width: 960px) and (min-width: 761px) { .tabs button { padding: 8px 7px; font-size: 0.86rem; } .chai-lbl { display: none; } .bar { gap: 6px 8px; } }
#tab-about .prose.card > p, #tab-about .prose.card li { max-width: 78ch; }
@media (max-width: 1100px) { .team-grid { grid-template-columns: minmax(0, 1fr); } }

.person { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.person img { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--line); background: var(--solid); }
.person-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 0.9rem; line-height: 1.55; }
.person h3 { font-size: 1.05rem; color: var(--ink); font-weight: 600; margin: 0; }
.person .role { color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.person .aff { color: var(--muted); font-size: 0.82rem; }
.person .links a { font-weight: 500; }
@media (max-width: 1100px) and (min-width: 600px) { .person { flex-direction: row; } }
@media (max-width: 460px) { .person img { width: 96px; height: 96px; } }
.chaibtn { order: 3; border: 1px solid color-mix(in srgb, var(--via) 55%, var(--line)); background: color-mix(in srgb, var(--via) 12%, var(--solid)); color: var(--ink); border-radius: 6px; font: 600 0.85rem var(--font-ui); padding: 7px 12px; min-height: 36px; display: inline-flex; align-items: center; text-decoration: none; margin-left: auto; white-space: nowrap; }
.chaibtn:hover { border-color: var(--via); }
.chaibtn + .sharebtn { margin-left: 8px; }
.chai-amts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
@media (max-width: 560px) { .chai-amts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chai-amt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--solid); color: var(--ink); cursor: pointer; font: inherit; }
.chai-amt b { font: 600 1.25rem var(--font-mono); display: inline-flex; align-items: center; gap: 2px; }
.chai-amt span { font-size: 0.8rem; color: var(--muted); }
.chai-amt[aria-pressed="true"], .chai-amt.custom.on { border-color: var(--accent); background: var(--accent-soft); }
.chai-amt input { width: 70px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: 600 1.15rem var(--font-mono); text-align: center; padding: 0; }
.chai-amt input:focus { outline: none; border-bottom-color: var(--accent); }
.chai-pay { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.chai-usd { margin-top: 12px; }
.chai-usd-ico { font-size: 2.2rem; line-height: 1; }
.usd-steps { margin: 4px 0 2px; padding: 0; list-style: none; counter-reset: us; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.usd-steps li { counter-increment: us; display: flex; gap: 10px; align-items: baseline; }
.usd-steps li::before { content: counter(us); flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font: 700 0.75rem/22px var(--font-mono); text-align: center; }
.usd-steps b { color: var(--ink); }
.usd-steps span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .chai-usd .chai-usd-ico { display: none; } }
.usd-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.chai-qr { background: #fff; padding: 10px; border-radius: 8px; line-height: 0; }
.chai-qr svg, .chai-qr img, .chai-qr canvas { display: block; width: 168px !important; height: 168px !important; }
.chai-paytext { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 220px; }
.chai-paytext .upi { font-family: var(--font-mono); font-size: 0.95rem; }
.chai-paytext .chip, .chai-rail .chip { align-self: flex-start; text-decoration: none; font-family: var(--font-ui); display: inline-flex; align-items: center; }
.chai-rail .chip { align-self: stretch; }
.chai-rail { position: fixed; right: 18px; top: 50%; transform: translateY(-50%); width: 176px; z-index: 4; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 14px; display: flex; flex-direction: column; gap: 8px; text-align: center; font-size: 0.85rem; }
.chai-rail .chip { justify-content: center; text-decoration: none; }
.chai-cup { font-size: 1.6rem; line-height: 1; }
.chai-x { position: absolute; top: 4px; right: 6px; border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 2px 6px; }
@media (max-width: 760px) { .chaibtn { order: 2; margin-left: 0; } .chaibtn + .sharebtn { margin-left: auto; } }
@media print { .chaibtn, .chai-rail { display: none !important; } }

.site-tag { color: var(--accent) !important; font-weight: 600; font-size: 0.86rem !important; letter-spacing: 0.01em; margin: 1px 0 2px !important; }
.boot-tag { color: var(--muted); font-size: 0.9rem; margin-top: -4px; }
@media (max-width: 640px) { .site-desc { display: none; } }
/* chai thank-you */
.chai-thx { margin-top: 18px; padding: 18px; border: 1px dashed color-mix(in srgb, var(--via) 60%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--via) 5%, var(--surface)); }
.chai-thx h3 { margin: 0 0 4px; }
.chai-thx-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 10px 0 12px; }
.chai-thx-row .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .chai-thx-row { grid-template-columns: minmax(0, 1fr); } }
.chai-thx small { color: var(--muted); font-weight: 400; }
.chai-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.chai-party { margin-top: 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--good, #2fd27a); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.chai-party[hidden] { display: none; }
.chai-party > b { color: var(--good, #2fd27a); }

/* trust badge under each tool title */
.verified { display: block; margin: 2px 2px 0; padding: 6px 12px; line-height: 1.5; border: 1px solid color-mix(in srgb, var(--good) 55%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--good) 9%, var(--surface)); font-size: 0.8rem; color: var(--ink); width: fit-content; max-width: 100%; }
.verified b { color: var(--good); font-weight: 700; margin-right: 6px; white-space: nowrap; }
.verified.model { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.verified.model b { color: var(--warn); }
.verified a { color: inherit; }

.ptag.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.bp-hist { letter-spacing: 1px; word-break: break-all; }
.bp-hist u { color: var(--bad); text-decoration: none; font-weight: 700; }
#p-bp h3 { margin: 14px 0 6px; }
#p-src .switchrow { flex-wrap: wrap; max-width: 100%; }
#p-pred { max-width: 100%; min-width: 0; }
@media (max-width: 640px) { #p-src label[for="p-pred"] { width: 100%; } #p-pred { flex: 1 1 100%; } }
/* CMOS minimization steps */
.advisors .role { color: var(--m2); }
.adv-intro { margin: -4px 0 14px; }
.c2-dcl input { width: 130px; margin-left: 6px; }
.c2-steps { margin: 0; padding-left: 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.c2-steps > li { line-height: 1.55; min-width: 0; }
.c2-steps dl.kv dd { text-align: left; }
.c2-steps dl.kv { margin-top: 6px; }
.c2-steps em { color: var(--muted); font-style: normal; font-size: 0.82rem; margin-left: 6px; }
.kmaps { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.kmap { border-collapse: collapse; font-size: 0.9rem; }
.kmap th { padding: 4px 8px; color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.kmap .kcorner { font-size: 0.75rem; }
.kmap td { position: relative; width: 52px; height: 46px; border: 1px solid var(--line); text-align: center; background: var(--surface); }
.kmap td b { font: 600 1rem var(--font-mono); }
.kmap td.k0 b { color: var(--muted); opacity: 0.55; font-weight: 400; }
.kmap td.kX b { color: var(--via); }
.kmap td sub { position: absolute; top: 2px; left: 4px; font-size: 0.62rem; color: var(--muted); }
.kmarks { position: absolute; left: 3px; right: 3px; bottom: 3px; display: flex; gap: 2px; }
.kmarks i { flex: 1; height: 4px; border-radius: 2px; }
.kdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.c2-pi s { color: var(--via); text-decoration: none; }
.c2-cand td:nth-child(2) { white-space: nowrap; }

/* practice: coming soon scene */
.soon-tag { width: fit-content; display: inline-flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 4px 12px; border: 1px solid var(--via); border-radius: 999px; color: var(--ink); font: 600 0.8rem var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; }
.soon-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--via); animation: soonPulse 1.4s ease-in-out infinite; }
@keyframes soonPulse { 50% { opacity: 0.25; } }
.soon-scene { margin: 14px 0 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); }
.soon-scene svg { display: block; width: 100%; height: auto; }
.soon-scene figcaption { text-align: center; margin-top: 4px; }
.soon-scene svg * { transform-box: view-box; }
.sc-floor { stroke: var(--line); stroke-width: 2; }
.sc-board line { stroke: var(--muted); stroke-width: 4; stroke-linecap: round; }
.sc-bd { fill: var(--surface); stroke: var(--muted); stroke-width: 3; }
.sc-ink { fill: none; stroke: var(--m1); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 240; stroke-dashoffset: 240; animation: scDraw 6s ease-in-out infinite; }
.sc-ink2 { stroke: var(--diff); animation-delay: 0.6s; } .sc-ink3 { stroke: var(--m2); animation-delay: 1.2s; } .sc-ink4 { stroke: var(--muted); animation-delay: 1.8s; }
.sc-clip .sc-ink { stroke: var(--muted); stroke-width: 2; stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
@keyframes scDraw { 0% { stroke-dashoffset: 240; } 35%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.sc-txt { fill: var(--m1); font: 600 12px var(--font-mono); opacity: 0; animation: scFade 6s ease-in-out infinite 0.9s; }
.sc-tick { fill: var(--diff); opacity: 0; animation: scFade 6s ease-in-out infinite 2.4s; }
.sc-tickm { fill: none; stroke: #000; stroke-width: 2; stroke-linecap: round; opacity: 0; animation: scFade 6s ease-in-out infinite 2.4s; }
@keyframes scFade { 0%, 15% { opacity: 0; } 30%, 80% { opacity: 1; } 100% { opacity: 0; } }
.sc-leg, .sc-leg2 { stroke: var(--ink); stroke-width: 9; stroke-linecap: round; }
.sc-leg2 { stroke: var(--muted); stroke-width: 6; }
.sc-arm { fill: none; stroke: var(--ink); stroke-width: 8; stroke-linecap: round; }
.sc-skin { fill: #c98b5e; }
.sc-shirt.s1 { fill: var(--m1); } .sc-shirt.s2 { fill: var(--m2); } .sc-shirt.s3 { fill: var(--diff); }
.sc-hair { fill: #5b3a29; }
.sc-paper { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.sc-point { transform-origin: 214px 152px; animation: scPoint 3s ease-in-out infinite; }
@keyframes scPoint { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(-12deg); } 60% { transform: rotate(6deg); } }
.sc-nod { transform-origin: 319px 214px; animation: scNod 3s ease-in-out infinite; }
@keyframes scNod { 0%, 100% { transform: rotate(0deg); } 40% { transform: rotate(-2deg); } 70% { transform: rotate(1.5deg); } }
.sc-think circle { fill: var(--muted); opacity: 0; animation: scThink 3s ease-in-out infinite; }
.sc-think circle:nth-child(2) { animation-delay: 0.3s; } .sc-think circle:nth-child(3) { animation-delay: 0.6s; }
@keyframes scThink { 20%, 70% { opacity: 0.8; } 0%, 100% { opacity: 0; } }
.sc-helm { fill: var(--via); }
.sc-visor { fill: #0b0c0e; stroke: var(--muted); stroke-width: 1.5; }
.sc-weld { transform-origin: 556px 156px; animation: scWeld 0.9s ease-in-out infinite; }
@keyframes scWeld { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-3deg); } }
.sc-torch { stroke: var(--muted); stroke-width: 5; stroke-linecap: round; }
.sc-bench { fill: var(--muted); }
.sc-pcb { fill: var(--diff); opacity: 0.85; }
.sc-chip { fill: var(--ink); }
.sc-pins { stroke: var(--via); stroke-width: 2; }
.sc-glow { fill: var(--via); opacity: 0.35; filter: blur(2px); animation: scGlow 0.25s steps(2) infinite alternate; }
@keyframes scGlow { from { opacity: 0.18; } to { opacity: 0.55; } }
.sc-sparks circle { fill: var(--via); transform-box: fill-box; transform-origin: center; animation: scSpark 1.2s ease-out infinite var(--d); opacity: 0; }
.sc-sparks circle:nth-child(odd) { fill: #ff8a1f; }
@keyframes scSpark { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), calc(var(--dy) + 30px)) scale(0.3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .soon-dot, .sc-point, .sc-nod, .sc-weld, .sc-glow, .sc-think circle { animation: none; }
  .sc-ink, .sc-txt, .sc-tick, .sc-tickm { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .sc-sparks circle { animation: none; opacity: 1; transform: translate(calc(var(--dx) / 2), calc(var(--dy) / 2)); }
}
.home-card.soon b::after { content: "Soon"; margin-left: 8px; padding: 1px 7px; border: 1px solid var(--via); border-radius: 999px; font: 600 0.7rem var(--font-mono); color: var(--muted); vertical-align: middle; }

/* boot screen: buses carry packets into the core while the 5-stage pipeline cycles */
.boot { position: fixed; inset: 0; z-index: 50; background: #000; color: #f4f4f5; display: grid; place-items: center; padding: 16px; transition: opacity 0.2s ease, visibility 0.2s; }
.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner { width: min(560px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.boot-die { width: 100%; height: auto; display: block; }
.boot .trace { fill: none; stroke-width: 1.6; opacity: 0.22; }
.boot .trace.m1 { stroke: #3d9bff; } .boot .trace.m2 { stroke: #ff4fd8; }
.boot .pkt { fill: none; stroke-width: 2.6; stroke-dasharray: 9 111; stroke-linecap: square; animation: flow 1.5s linear infinite; }
.boot .pkt.m1 { stroke: #6cb4ff; } .boot .pkt.m2 { stroke: #ff7ae3; }
.boot .pkt.out { stroke: #30d158; }
@keyframes flow { from { stroke-dashoffset: 120; } to { stroke-dashoffset: 0; } }
.boot .via { fill: #ffd60a; }
.boot .core { fill: #0c0c0e; stroke: #4a4b52; stroke-width: 1.2; }
.boot .pad { fill: #8a8b92; }
.boot .corelbl { fill: #f4f4f5; font: 600 15px "IBM Plex Mono", monospace; text-anchor: middle; letter-spacing: 0.04em; }
.boot .corepc { fill: #8b8f98; font: 500 10px "IBM Plex Mono", monospace; text-anchor: middle; }
.boot .stg rect { fill: #1a1b1f; stroke: #34353b; stroke-width: 0.8; }
.boot .stg text { fill: #8b8f98; font: 600 8.5px "IBM Plex Mono", monospace; text-anchor: middle; }
.boot .stg rect { animation: stgr 1.1s steps(1) infinite; animation-delay: inherit; }
.boot .stg text { animation: stgt 1.1s steps(1) infinite; animation-delay: inherit; }
@keyframes stgr { 0%, 19% { fill: #ffd60a; stroke: #ffd60a; } 20%, 100% { fill: #1a1b1f; stroke: #34353b; } }
@keyframes stgt { 0%, 19% { fill: #000; } 20%, 100% { fill: #8b8f98; } }
.boot-name { font: 600 1.15rem "IBM Plex Sans", sans-serif; letter-spacing: -0.01em; }
.boot-msg { font: 500 0.85rem "IBM Plex Mono", monospace; color: #8b8f98; min-height: 1.4em; }
.boot-skip { position: absolute; right: 16px; bottom: 16px; background: transparent; color: #8b8f98; border: 1px solid #2a2b30; border-radius: 6px; padding: 7px 14px; font: 500 0.82rem "IBM Plex Sans", sans-serif; cursor: pointer; }
.boot-skip:hover { color: #fff; border-color: #55565c; }

@media (max-width: 520px) { .card { padding: 16px; } .tabs button { padding: 8px 11px; } }
@media (prefers-reduced-motion: reduce) {
  .logo .pin, .logo .blk, .boot .pkt, .boot .stg, .boot .stg rect, .boot .stg text { animation: none !important; }
  .boot { transition: none; }
}


/* ---------- phone / desktop view switch ---------- */
.topctl { display: flex; gap: 8px; flex: none; }
.viewsw { display: none; }
.can-view .viewsw { display: block; }
.viewsw .pc { display: none; }
.viewsw[aria-checked="true"] .ph { display: none; }
.viewsw[aria-checked="true"] .pc { display: block; }
.foot-short { display: none; }
.readmore { display: none; }

/* ---------- phone layout (desktop view on a phone sets a 1200px viewport, so none of this applies) ---------- */
@media (max-width: 760px) {
  /* one swipeable row of tabs, chai and share beside it */
  .bar { flex-wrap: wrap; gap: 6px; padding: 5px; }
  .bar .tabs { display: flex; flex: 1 1 0; width: auto; min-width: 0; overflow-x: auto; flex-wrap: nowrap; gap: 2px; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); scroll-padding-inline: 24px; }
  .bar .tabs.at-end { -webkit-mask-image: none; mask-image: none; }
  .bar .tabs button { flex: none; padding: 8px 12px; min-height: 36px; }
  .chaibtn { order: 2; margin-left: 0; padding: 6px 10px; min-height: 36px; font-size: 1rem; }
  .chai-lbl { display: none; }
  .sharebtn { order: 3; margin-left: 0; min-height: 36px; padding: 5px 12px; }
  .chaibtn + .sharebtn { margin-left: 0; }
  .wctl { order: 4; flex: 1 1 100%; }
  /* every page heading says what the page is; the tagline repeats it */
  .site-tag { display: none; }
  .wctl { flex-wrap: nowrap; gap: 6px; }
  .wctl .lbl { display: none; }
  .wctl .seg button { padding-inline: 8px; }
  .wctl .cw input { width: 52px; }
  /* denser result tiles: two per row */
  .tilegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 9px 10px; border-radius: 10px; }
  .tile .tv { font-size: 0.98rem; overflow-wrap: anywhere; }
  .tile .th { font-size: 0.7rem; }
  /* tighter converter fields */
  .fields { gap: 8px; }
  .fields .err:empty { display: none; }
  /* home tool cards: two per row */
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .home-card { padding: 14px 12px; }
  .home-card b { font-size: 0.98rem; }
  .home-card span { font-size: 0.8rem; line-height: 1.4; }
  /* tool article: first part, then Read more */
  .guide.clamp { max-height: 330px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
  .readmore { display: inline-flex; margin: 4px 0 14px; justify-self: start; align-self: flex-start; width: auto; }
  /* short footer */
  .foot-long { display: none; }
  .foot-short { display: block; }
}

/* ---------- polish ---------- */
#p-bpc.empty #p-bp { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
#p-bpc.empty #p-bp .note { margin: 0; }
/* sideways-scrolling tables fade at the edge that has more to show */
.scroll.more-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.scroll.more-l { -webkit-mask-image: linear-gradient(270deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(270deg, #000 calc(100% - 36px), transparent); }
.scroll.more-l.more-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
/* coming-soon card reads as not ready yet */
.home-card.soon i { background: var(--line); }
.home-card.soon:hover, .home-card.soon:focus-visible { border-color: var(--muted); background: var(--surface); }
.home-card.soon span { opacity: 0.8; }
.home-card.soon:hover { transform: none; }
/* desktop MOSFET: the inputs column follows you down the page */
@media (min-width: 901px) { .mos-side { position: sticky; top: 16px; } }
@media (max-width: 760px) { textarea.code { min-height: 150px; field-sizing: content; max-height: 70vh; } }

/* ---------- Linux commands ---------- */
.lx { display: flex; flex-direction: column; gap: 18px; }
.lx-intro .lead { margin: 0; max-width: 80ch; }
.lx-search { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lx-search input { flex: 1 1 320px; font-family: var(--font-ui); font-size: 1rem; min-height: 46px; }
.lx-lvls { flex-wrap: wrap; align-self: flex-start; }
.lx-lvls button { font-family: var(--font-ui); }
.lx-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 18px; align-items: start; }
.lx-shell { position: sticky; top: 16px; order: 2; }
.lx-list { order: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lx-lvl { margin: 10px 0 0; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.lx-lvl::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--lc, var(--accent)); }
.lx-l1 { --lc: var(--diff); } .lx-l2 { --lc: var(--m1); } .lx-l3 { --lc: var(--m2); } .lx-l4 { --lc: var(--via); }
.lx-group { gap: 0; padding-block: 8px; }
.lx-g { margin: 8px 0 4px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.lx-cmd { border-top: 1px solid var(--line); }
.lx-g + .lx-cmd { border-top: 0; }
.lx-head { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 12px 0; cursor: pointer; list-style: none; }
.lx-head::-webkit-details-marker { display: none; }
.lx-head::after { content: "+"; color: var(--muted); font: 500 1.05rem var(--font-mono); line-height: 1; }
.lx-cmd[open] > .lx-head::after { content: "−"; }
.lx-head:hover .lx-name { text-decoration: underline; text-underline-offset: 3px; }
.lx-d { color: var(--ink); }
.lx-name { font: 600 0.98rem var(--font-mono); color: var(--accent); white-space: nowrap; }
.lx-more { display: flex; flex-direction: column; gap: 8px; padding: 0 0 14px; }
.lx-ex { display: flex; flex-direction: column; gap: 6px; }
.lx-row { display: grid; grid-template-columns: minmax(0, max-content) auto minmax(0, 1fr); align-items: center; gap: 4px 4px; }
.lx-code { margin: 0; font: 500 0.84rem/1.5 var(--font-mono); background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
.lx-row .copy.sm { margin-left: 2px; }
.lx-note { color: var(--muted); font-size: 0.84rem; padding-left: 8px; }
.lx-tip { margin: 0; font-size: 0.86rem; color: var(--muted); border-left: 3px solid var(--via); padding: 2px 0 2px 10px; }
.lx-try { align-self: flex-start; font-family: var(--font-ui); min-height: 32px; padding: 5px 12px; max-width: 100%; text-align: left; }
.lx-try span { font-family: var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.lx-files { gap: 6px; }
.lx-files .chip { min-height: 30px; padding: 4px 10px; font-size: 0.78rem; }
.lx-inrow { display: flex; align-items: center; gap: 8px; }
.lx-ps { font: 700 1rem var(--font-mono); color: var(--accent); }
.lx-inrow input { flex: 1; min-width: 0; }
.lx-out { margin: 0; min-height: 160px; max-height: 60vh; overflow: auto; font: 500 0.8rem/1.55 var(--font-mono); background: #0d1117; color: #e6edf3; border-radius: 8px; padding: 12px 14px; white-space: pre; }
.lx-prompt { color: #7ee787; }
.lx-err { color: #ff7b72; white-space: pre-wrap; }
.lx-dim { color: #8b949e; }
mark { background: color-mix(in srgb, var(--via) 45%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
@media (max-width: 1000px) {
  .lx-body { grid-template-columns: minmax(0, 1fr); }
  .lx-shell { position: static; order: 0; }
}
@media (max-width: 760px) {
  .lx-head { grid-template-columns: minmax(0, 1fr) auto; }
  .lx-d { grid-column: 1; font-size: 0.9rem; color: var(--muted); }
  .lx-head::after { grid-column: 2; grid-row: 1; }
  .lx-row { grid-template-columns: minmax(0, 1fr) auto; }
  .lx-note { grid-column: 1 / -1; padding-left: 2px; }
  .lx-out { max-height: 45vh; }
}

/* ---------- quote of the day: a band under the tool cards ---------- */
.qotd { margin: 22px 0 0; position: relative; overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 22px; align-items: start; padding: 26px 30px 24px; border: 1px solid var(--line); border-radius: 10px;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 60%), var(--surface); }
.qotd::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 20%, transparent)); }
.q-mark { grid-row: 1 / span 3; font: 700 4.4rem/0.8 Georgia, "Times New Roman", serif; color: var(--accent); user-select: none; padding-top: 4px; }
.q-label { margin: 0; font: 600 0.7rem var(--font-ui); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.q-text { margin: 2px 0 0; font-size: clamp(1.05rem, 0.9rem + 0.6vw, 1.35rem); line-height: 1.45; font-weight: 500; color: var(--ink); max-width: 70ch; text-wrap: balance; }
.q-who { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 0.9rem; }
.q-who b { color: var(--accent); font-weight: 600; }
.q-who b::before { content: "— "; }
.q-who span { color: var(--muted); font-size: 0.8rem; }
.qotd > * { animation: qIn 0.6s ease both; }
.qotd .q-text { animation-delay: 0.08s; } .qotd .q-who { animation-delay: 0.16s; }
@keyframes qIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .qotd > * { animation: none; } }
@media (max-width: 760px) { .qotd { padding: 18px 18px 18px 22px; gap: 2px 12px; } .q-mark { font-size: 3.2rem; } }
@media print { .qotd { display: none !important; } }

/* ---------- home: blueprint section labels, numbered cards, scroll reveals ---------- */
@property --sweep { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@property --glow { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
.sec-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; position: relative; margin: 26px 0 0; padding: 0 2px 8px; border-bottom: 1px solid var(--line);
  font: 500 0.7rem/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.sec-label::before, .sec-label::after { content: "+"; position: absolute; bottom: -0.62em; font: 400 0.85rem/1 var(--font-mono); color: var(--muted); background: var(--bg); padding: 0 2px; }
.sec-label::before { left: -6px; } .sec-label::after { right: -6px; }
.sec-label [data-scramble] { color: var(--ink); white-space: pre; }
.sec-label [data-scramble] i { font-style: normal; color: var(--muted); opacity: 0.7; }
.sec-meta { text-align: right; }
.sec-label + .home-grid, .sec-label + .qotd { margin-top: 14px; }
#tab-home .q-label { display: none; }
.page-h1 .hl { color: var(--accent); }


.home-grid { counter-reset: card; }
.home-card { counter-increment: card;
  background-color: var(--surface);
  background-image: linear-gradient(var(--c), var(--c)), radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--c) var(--glow), transparent), transparent 70%);
  background-size: var(--sweep) 2px, 100% 100%; background-position: 0 0, 0 0; background-repeat: no-repeat;
  transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.45s ease, --sweep 0.5s cubic-bezier(0.65, 0, 0.35, 1), --glow 0.35s ease; }
.home-card:hover, .home-card:focus-visible { --sweep: 100%; --glow: 16%; transform: translateY(-3px); box-shadow: 0 10px 28px -14px color-mix(in srgb, var(--c) 55%, transparent);
  background-color: color-mix(in srgb, var(--c) 5%, var(--surface)); }
.home-card::before { content: counter(card, decimal-leading-zero); align-self: flex-start; margin-bottom: 2px; padding: 1px 5px; border-radius: 4px;
  font: 600 0.68rem/1.3 var(--font-mono); color: color-mix(in srgb, var(--c) 78%, var(--ink)); background: color-mix(in srgb, var(--c) 14%, transparent); transition: background-color 0.3s ease; }
.home-card:hover::before { background: color-mix(in srgb, var(--c) 26%, transparent); }
.home-card::after { content: "Open ↗"; margin-top: auto; padding-top: 6px; font: 500 0.68rem/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); transition: color 0.3s ease, letter-spacing 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.home-card:hover::after, .home-card:focus-visible::after { color: var(--c); letter-spacing: 0.18em; }
.home-card.soon::after { content: "Coming soon"; }
.home-card.soon:hover::after { color: var(--muted); letter-spacing: 0.1em; }
.home-card.soon:hover { --sweep: 0%; --glow: 0%; box-shadow: none; }

/* 404 notice */
.nf-note { margin: 0; padding: 12px 16px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); color: var(--ink); }
/* card hover easing (content never fades in on scroll) */
.fx #tab-home .home-card { transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.45s ease, transform 0.3s ease, --sweep 0.5s cubic-bezier(0.65, 0, 0.35, 1), --glow 0.35s ease; }
.fx #tab-about .person { transition: border-color 0.3s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.45s ease; }
#team, #ab-how, #advisors { scroll-margin-top: 90px; }

@media (min-width: 1100px) {
  /* blueprint guides: hairlines down both sides of the home page, crossing the section labels */
  #tab-home { position: relative; }
  #tab-home::before, #tab-home::after { content: ""; position: absolute; top: -8px; bottom: -8px; width: 0; border-left: 1px dashed var(--line); pointer-events: none; }
  #tab-home::before { left: -20px; } #tab-home::after { right: -20px; }
  #tab-home .sec-label::before { left: -26px; } #tab-home .sec-label::after { right: -26px; }
}
@media (max-width: 760px) {
  .sec-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .home-card, .home-card::after { transition: none; }
  .home-card:hover { transform: none; }
}
@media print { .sec-label { display: none; } }

/* ---------- Linux page: install guides for open-source tools ---------- */
.lx-mode { align-self: flex-start; flex-wrap: wrap; }
.lx-mode button { font-family: var(--font-ui); min-height: 40px; }
.lx-new { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--accent); font: 600 0.62rem var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 1px; }
.lx-mode button[aria-pressed="true"] .lx-new { background: color-mix(in srgb, var(--on-accent) 85%, transparent); }
.lx-cmds { display: flex; flex-direction: column; gap: 18px; }
.eda { display: flex; flex-direction: column; gap: 18px; }
.eda[hidden], .lx-cmds[hidden] { display: none; }
.eda-lead { margin: 0; max-width: 72ch; color: var(--muted); }
.eda-flow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.eda-flow > div { display: flex; flex-direction: column; gap: 4px; padding: 12px 12px; border-left: 1px solid var(--line); background: var(--solid); min-width: 0; }
.eda-flow > div:first-child { border-left: 0; }
.eda-flow i { font: 500 0.64rem var(--font-mono); font-style: normal; letter-spacing: 0.1em; color: var(--muted); }
.eda-flow b { font-size: 0.9rem; }
.eda-flow span { font: 500 0.72rem var(--font-mono); color: var(--accent); overflow-wrap: anywhere; }
@media (max-width: 900px) { .eda-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } .eda-flow > div { border-left: 0; border-top: 1px solid var(--line); } .eda-flow > div:nth-child(-n+2) { border-top: 0; } .eda-flow > div:nth-child(even) { border-left: 1px solid var(--line); } }
.eda-sys { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-soft); }
.eda-sys > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }
.eda-sys b { font-size: 0.98rem; }
.eda-sys span { font-size: 0.86rem; color: var(--ink); }
.eda-sys code, .eda-step code { font-family: var(--font-mono); font-size: 0.85em; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
.eda-sys .seg button { font-family: var(--font-ui); }
.eda-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.eda-card { display: flex; flex-direction: column; gap: 9px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--solid); min-width: 0; transition: border-color 0.2s ease; }
.eda-card:hover { border-color: var(--c); }
.eda-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.eda-role { padding: 2px 8px; border-radius: 4px; background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 80%, var(--ink)); font: 600 0.64rem var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.eda-st { font: 500 0.7rem var(--font-mono); color: var(--muted); }
.eda-st.ok { color: var(--good); } .eda-st.bad { color: var(--bad); }
.eda-card h3 { margin: 0; font-size: 1.05rem; color: var(--ink); font-weight: 600; }
.eda-card p { margin: 0; font-size: 0.86rem; color: var(--muted); }
.eda-one { margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font: 0.78rem var(--font-mono); white-space: nowrap; overflow-x: auto; }
.eda-card .chip { align-self: flex-start; margin-top: auto; font-family: var(--font-ui); }
.eda-trust { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--solid); font-size: 0.88rem; color: var(--muted); }
.eda-trust b { color: var(--ink); }
.eda-guide { display: flex; flex-direction: column; gap: 16px; }
.eda-gh { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.eda-gh h2 { margin: 2px 0 4px; font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem); letter-spacing: -0.02em; color: var(--ink); }
.eda-gh p { margin: 0; color: var(--muted); max-width: 64ch; }
.eda-gh .eda-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 0.85rem; }
.eda-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.eda-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; }
.eda-n { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font: 700 0.85rem var(--font-mono); }
.eda-n.warn { background: transparent; border: 1px solid var(--bad); color: var(--bad); }
.eda-b { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.eda-b h3 { margin: 4px 0 0; font-size: 1rem; color: var(--ink); font-weight: 600; }
.eda-b > p { margin: 0; font-size: 0.88rem; color: var(--muted); max-width: 78ch; }
.eda-code, .eda-file { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--solid); overflow: hidden; }
.eda-code pre, .eda-file pre { margin: 0; padding: 12px 14px; font: 0.82rem/1.6 var(--font-mono); color: var(--ink); white-space: pre; overflow-x: auto; }
.eda-code pre { padding-right: 76px; }
.eda-code .copy { position: absolute; top: 8px; right: 8px; margin: 0; }
.eda-fh { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); font: 500 0.76rem var(--font-mono); color: var(--muted); }
.eda-fh .copy { margin: 0; }
.eda-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.eda-out { margin: 0; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 10px; font: 0.78rem/1.55 var(--font-mono); color: var(--good); white-space: pre; overflow-x: auto; background: var(--bg); }
.eda-outl { font: 500 0.66rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: -4px; }
.eda-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.eda-tag { padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; font: 500 0.7rem var(--font-mono); color: var(--muted); }
.eda-errs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.eda-err { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--solid); }
.eda-err code { font: 0.76rem var(--font-mono); color: var(--bad); overflow-wrap: anywhere; }
.eda-err span { font-size: 0.85rem; color: var(--muted); }
.eda-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.eda-nav .chip { font-family: var(--font-ui); }

/* readable by search engines and screen readers, not drawn */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* home: the big headline says it, so the header shows only the name; cards carry colour in the icon and number, not a side bar */
.on-home .brand .site-tag, .on-home .brand .site-desc { display: none; }
.home-card i { display: none; }
.home-card { padding-left: 18px; }

/* device view: grid paper, metal contacts, voltage tags, graded channel, field arrows */
.dv .dv-gl { fill: none; stroke: var(--grid); stroke-width: 1; }
.dv .dv-sub { stroke-opacity: 0.9; }
.dv .dv-ct { fill: color-mix(in srgb, var(--muted) 70%, var(--ink)); }
.dv .dv-tag { fill: var(--bg); stroke: var(--line); stroke-width: 1.2; }
.dv .dv-tag.g { stroke: var(--accent); }
.dv .dv-gate { fill: color-mix(in srgb, var(--muted) 75%, var(--surface)); }
.dv .dv-gate.hi { fill: color-mix(in srgb, var(--ink) 35%, var(--muted)); opacity: 0.55; }
.dv text.dv-t.g { fill: var(--ink); }
.dv text.dv-t.sd { font-weight: 600; fill: color-mix(in srgb, var(--ink) 85%, var(--n)); }
.dv.pmos text.dv-t.sd { fill: color-mix(in srgb, var(--ink) 85%, var(--p)); }
.dv text.dv-t.cap { letter-spacing: 0.1em; }
.dv .dv-ch { fill: url(#dv-chg); stroke: none; }
.dv .dv-c0 { stop-color: color-mix(in srgb, var(--n) 85%, white); }
.dv .dv-c1 { stop-color: var(--n); stop-opacity: 0.8; }
.dv.pmos .dv-c0 { stop-color: color-mix(in srgb, var(--p) 85%, white); }
.dv.pmos .dv-c1 { stop-color: var(--p); }
.dv .dv-ox { fill: color-mix(in srgb, #efe6c4 70%, var(--surface)); }
.dv .dv-fld { fill: none; stroke: var(--bad, #e5484d); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
#m-devtxt .dv-pill { display: inline-block; margin-right: 6px; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- About page: hero with a chip floorplan, rules strip, team with framed photos ---------- */
#tab-about.about { gap: 26px; max-width: 1160px; }
h2.sec-label { margin: 34px 0 0; }
.ab-hero { display: flex; flex-wrap: wrap; gap: 40px 48px; align-items: center; }
.ab-intro { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ab-intro h2.sec-label { margin-top: 6px; }
.ab-h { margin: 6px 0 0; font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3.1rem); line-height: 1.08; letter-spacing: -0.03em; font-weight: 700; color: var(--ink); text-wrap: balance; }
.ab-h .hl { color: var(--accent); }
.ab-intro .lead { margin: 0; font-size: 1.06rem; color: var(--ink); max-width: 56ch; }
.ab-p { margin: 0; color: var(--muted); max-width: 62ch; }
.ab-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.ab-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink); font-weight: 500; text-decoration: none; transition: border-color 0.25s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ab-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.ab-btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.ab-die { flex: 1 1 380px; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ab-die figcaption { display: flex; justify-content: space-between; font: 500 0.66rem/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.fp-pins { padding: 13px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 16px) top / 100% 7px no-repeat, repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 16px) bottom / 100% 7px no-repeat,
    repeating-linear-gradient(0deg, var(--line) 0 6px, transparent 6px 16px) left / 7px 100% no-repeat, repeating-linear-gradient(0deg, var(--line) 0 6px, transparent 6px 16px) right / 7px 100% no-repeat; }
.fp { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(70px, auto); gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--sunken); }
.fp-b { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--solid); color: var(--ink); text-decoration: none; overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease; }
.fp-b i { font: 500 0.62rem var(--font-mono); font-style: normal; color: color-mix(in srgb, var(--c) 80%, var(--ink)); }
.fp-b b { font-size: 0.86rem; font-weight: 600; }
.fp-b span { font-size: 0.74rem; line-height: 1.4; color: var(--muted); display: none; }
.fp-b.big { grid-column: span 2; grid-row: span 2; }
.fp-b.big span { display: block; }
.fp-b.wide { grid-column: span 2; }
.fp-b.ring { grid-column: span 4; flex-direction: row; align-items: center; border-style: dashed; background: transparent; }
.fp-b.ring b { order: -1; flex: none; }
.fp-b.ring i { order: 2; flex: none; }
.fp-b.ring span { display: block; flex: 1; min-width: 0; margin: 0 14px; }
@media (max-width: 560px) { .fp-b.ring span { display: none; } }
.fp-b:hover, .fp-b:focus-visible, .fp-b.lit { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--solid)); }
.fp-b:hover b, .fp-b:focus-visible b { color: color-mix(in srgb, var(--c) 70%, var(--ink)); }
.ab-cap { margin: 0; font-size: 0.8rem; color: var(--muted); }
.ab-rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ab-rule { display: flex; flex-direction: column; gap: 10px; padding: 24px; background: var(--bg); }
.ab-rule svg { width: 32px; height: 32px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ab-rule svg * { stroke-dasharray: 1; stroke-dashoffset: 0; }
.ab-rules.in .ab-rule svg * { animation: icoDraw 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.2s both; }
.ab-rule h3 { margin: 0; font-size: 1.05rem; color: var(--ink); font-weight: 600; }
.ab-rule p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.ab-note { margin: -8px 0 0; }
@media (max-width: 900px) { .ab-rules { grid-template-columns: minmax(0, 1fr); } }
#tab-about .team { display: flex; flex-direction: column; gap: 16px; }
#tab-about .team-grid { gap: 16px; }
#tab-about .person { position: relative; background: var(--solid); border-radius: 12px; padding: 20px;
  transition: border-color 0.3s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.45s ease; }
#tab-about .person:hover { border-color: var(--c); transform: translateY(-3px); box-shadow: 0 16px 40px -24px var(--c); }
#tab-about .person .role { color: color-mix(in srgb, var(--c) 82%, var(--ink)); font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
#tab-about .person .aff { color: color-mix(in srgb, var(--ink) 70%, var(--muted)); }
#tab-about .person-body > p:not(.role):not(.aff):not(.links) { color: var(--muted); }
/* photo in a chip frame: a coloured ring and pin ticks on all four sides */
.ph { position: relative; flex: none; display: block; padding: 9px; border-radius: 12px;
  background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 11px) top / 100% 5px no-repeat, repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 11px) bottom / 100% 5px no-repeat,
    repeating-linear-gradient(0deg, var(--line) 0 4px, transparent 4px 11px) left / 5px 100% no-repeat, repeating-linear-gradient(0deg, var(--line) 0 4px, transparent 4px 11px) right / 5px 100% no-repeat;
  transition: filter 0.3s ease; }
#tab-about .person .ph img { display: block; width: 104px; height: 104px; border-radius: 8px; border: 2px solid color-mix(in srgb, var(--c) 70%, var(--line)); transition: border-color 0.3s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
#tab-about .person:hover .ph img { border-color: var(--c); transform: scale(1.03); }
#tab-about .person:hover .ph { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 11px) top / 100% 5px no-repeat, repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 11px) bottom / 100% 5px no-repeat,
    repeating-linear-gradient(0deg, var(--c) 0 4px, transparent 4px 11px) left / 5px 100% no-repeat, repeating-linear-gradient(0deg, var(--c) 0 4px, transparent 4px 11px) right / 5px 100% no-repeat; }
#tab-about .advisors .person { background: transparent; }
#tab-about .adv-intro { margin: -4px 0 4px; }
@media (max-width: 460px) { #tab-about .person .ph img { width: 88px; height: 88px; } }
@media (max-width: 560px) { .fp { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fp-b.big { grid-row: span 1; } .fp-b.ring { grid-column: span 2; } }
.ab-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; padding: 26px 28px; border: 1px solid var(--line); border-radius: 14px;
  background: radial-gradient(420px circle at 85% 50%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%), var(--solid); }
.ab-cta > div:first-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ab-cta b { font-size: 1.35rem; letter-spacing: -0.01em; }
.ab-cta span { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .fp-b, .ab-btn, #tab-about .person, #tab-about .person .ph img { transition: none; } .ab-rules.in .ab-rule svg * { animation: none; } #tab-about .person:hover, .ab-btn:hover { transform: none; } }

/* home: a live byte to play with, and a wafer-dot grid behind the hero (desktop) */
.home-hero { position: relative; }
.home-hero > :not(canvas) { position: relative; z-index: 1; }
.wafer { position: absolute; inset: -14px -10px -10px; width: calc(100% + 20px); height: calc(100% + 24px); pointer-events: none; z-index: 0; }
.bclock { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin-top: 10px; }
.byte-cap { flex-basis: 100%; margin: 0 0 2px; font-size: 0.85rem; color: var(--muted); }
.byte-cap b { color: var(--ink); font-weight: 600; }
.bc-rows { display: flex; flex-direction: column; gap: 8px; }
.bc-row { display: flex; align-items: center; gap: 6px; }
.bc-lab { width: 22px; font: 600 0.78rem var(--font-mono); color: var(--muted); }
.bc-grp { display: flex; gap: 5px; }
.bc-grp + .bc-grp { margin-left: 10px; }
.bc-bit { position: relative; width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--line); background: var(--sunken); display: grid; place-items: center; font: 600 0.95rem var(--font-mono); color: var(--muted); transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease; }
.bc-bit.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.bc-bit::after { content: attr(data-w); position: absolute; top: -13px; left: 0; right: 0; text-align: center; font: 500 0.56rem var(--font-mono); color: var(--muted); opacity: 0.75; }
.bc-row:not(:first-child) .bc-bit::after { content: none; }
.bc-row.bcd .bc-bit::after { content: attr(data-w); }
.bc-rows:has(.bcd) { gap: 18px; }
.bc-bit.flip { animation: bitFlip 0.34s cubic-bezier(0.65, 0, 0.35, 1); }
@keyframes bitFlip { 0% { transform: perspective(240px) rotateX(0); } 50% { transform: perspective(240px) rotateX(90deg); } 100% { transform: perspective(240px) rotateX(0); } }
.bc-eq { min-width: 3.4em; margin-left: 8px; font: 600 0.9rem var(--font-mono); color: var(--ink); }
.bc-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bc-time { font: 600 clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem) var(--font-mono); letter-spacing: 0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.bc-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bc-act .seg button { font-family: var(--font-ui); }
.bc-act .chip { min-height: 34px; font-family: var(--font-ui); }
.bc-how { margin: 0; max-width: 38ch; font: 0.78rem/1.5 var(--font-mono); color: var(--muted); }
.bc-how b { color: var(--accent); font-weight: 600; }
@media (max-width: 560px) {
  .bc-bit { width: 30px; height: 30px; font-size: 0.85rem; }
  .bc-grp + .bc-grp { margin-left: 6px; }
}
@media (prefers-reduced-motion: reduce) { .bc-bit { transition: none; } }

/* theme switch drawn as a CMOS inverter: dark in (1) gives a light-low out (0), and the reverse */
#theme.inv { width: 92px; }
#theme.inv svg { width: 100%; height: 100%; display: block; }
.inv .w-in, .inv .w-out { fill: none; stroke: var(--line); stroke-width: 2.2; stroke-linecap: round; transition: stroke 0.18s ease; }
.inv .w-in.dot { fill: var(--line); stroke: none; transition: fill 0.18s ease; }
.inv .gate { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; transition: fill 0.2s ease 0.08s; }
.inv .w-out { transition-delay: 0.16s; }
.inv[aria-checked="true"] .w-in { stroke: var(--accent); }
.inv[aria-checked="true"] .w-in.dot { fill: var(--accent); }
.inv[aria-checked="false"] .w-out { stroke: var(--accent); }
.inv .sun, .inv .moon { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.inv .sun { stroke: var(--accent); } .inv .moon { stroke: var(--ink); }
.inv:hover .gate { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
@media (prefers-reduced-motion: reduce) { .inv * { transition: none !important; } }

/* plot hover readout: aligned columns, your curve highlighted, region at your Vgs */
.tip { display: grid; grid-template-columns: auto auto auto; column-gap: 8px; row-gap: 1px; align-items: center; white-space: nowrap; }
.tip div.tr { display: contents; }
.tip .tr b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.tip .tr span { color: var(--muted); }
.tip .tr.you span, .tip .tr.you b { color: var(--ink); font-weight: 700; }
.tip .th0, .tip .th1 { grid-column: 1 / -1; }
.tip .th1 { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); color: var(--muted); }
.tip .th1 b { color: var(--accent); }
.plotwrap text.zone { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--muted); opacity: 0.8; }

/* operating point: region pill pulses when the region changes; changed values slide in */
.pill.pulse { animation: pillPulse 0.7s ease-out both; }
@keyframes pillPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); transform: scale(1.06); } 100% { box-shadow: 0 0 0 10px transparent; transform: none; } }
.tile .tv.roll { animation: valRoll 0.32s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes valRoll { from { transform: translateY(45%); opacity: 0.2; } to { transform: none; opacity: 1; } }

/* copy buttons: a tick draws itself */
.copy.ok { color: var(--good); border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--surface)); }
.copy .tick { width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: tickDraw 0.35s ease-out forwards; }
@keyframes tickDraw { to { stroke-dashoffset: 0; } }

/* tab bar: a signal pulse runs from the old tab to the new one */
.tabs { position: relative; }
.tab-pulse { position: absolute; bottom: -1px; left: 0; width: 56px; height: 2px; pointer-events: none; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--accent)); opacity: 0; }
.tab-pulse::after { content: ""; position: absolute; right: -3px; top: -2.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent), 0 0 16px var(--accent); }
.tab-pulse.rev { background: linear-gradient(270deg, transparent, var(--accent)); }
.tab-pulse.rev::after { right: auto; left: -3px; }
.tabs button.arrive { animation: tabArrive 0.5s ease-out; }
@keyframes tabArrive { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); } to { box-shadow: 0 0 0 3px transparent; } }

@media (prefers-reduced-motion: reduce) { .pill.pulse, .tile .tv.roll, .copy .tick, .tabs button.arrive { animation: none; stroke-dashoffset: 0; } .tab-pulse { display: none; } }

/* home headline: clock waveform under the accent word */
.page-h1 .hl { position: relative; display: inline-block; }
.page-h1 .clk { position: absolute; left: 0; right: 0; bottom: -5px; width: 100%; height: 6px; overflow: visible; }
.page-h1:has(.clk) { line-height: 1.4; }
.page-h1 .clk path { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.fx .page-h1 .clk:not(.still) path { animation: clkDraw 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.25s both; }
@keyframes clkDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* home cards: line icon for each tool, redrawn on hover */
.home-card .ico { position: absolute; top: 16px; right: 16px; width: 26px; height: 26px; fill: none; stroke: var(--c); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.home-card .ico * { stroke-dasharray: 1; stroke-dashoffset: 0; }
.home-card:hover .ico *, .home-card:focus-visible .ico * { animation: icoDraw 0.75s cubic-bezier(0.65, 0, 0.35, 1) both; }
.home-card:hover .ico :nth-child(2) { animation-delay: 0.08s; } .home-card:hover .ico :nth-child(3) { animation-delay: 0.16s; }
.home-card:hover .ico :nth-child(4) { animation-delay: 0.24s; } .home-card:hover .ico :nth-child(n+5) { animation-delay: 0.3s; }
@keyframes icoDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.home-card.soon .ico { stroke: var(--muted); }
.home-card.soon:hover .ico * { animation: none; }
@media (max-width: 760px) { .home-card .ico { top: 12px; right: 12px; width: 22px; height: 22px; } }

/* switching pages: the new page fades and rises in */
.page-in { animation: pageIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .page-h1 .clk path, .home-card .ico *, .page-in { animation: none !important; }
}

/* ---------- MOSFET cross-section ---------- */
.dv { --n: var(--m1); --p: var(--m2); overflow: hidden !important; }
.dv .dv-sub { fill: color-mix(in srgb, var(--p) 13%, var(--surface)); stroke: var(--line); }
.dv.pmos .dv-sub { fill: color-mix(in srgb, var(--n) 13%, var(--surface)); }
.dv .dv-sd { fill: color-mix(in srgb, var(--n) 55%, var(--surface)); stroke: var(--n); stroke-width: 1; }
.dv.pmos .dv-sd { fill: color-mix(in srgb, var(--p) 55%, var(--surface)); stroke: var(--p); }
.dv .dv-dep { fill: color-mix(in srgb, var(--muted) 14%, transparent); stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.dv #dv-pin { opacity: 0; }
.dv .dv-e { will-change: transform; }
.dv .dv-ch { fill: color-mix(in srgb, var(--n) 85%, var(--surface)); stroke: var(--n); stroke-width: 0.8; }
.dv.pmos .dv-ch { fill: color-mix(in srgb, var(--p) 85%, var(--surface)); stroke: var(--p); }
.dv .dv-ch.weak { opacity: 0.6; stroke-dasharray: 3 2; }
.dv text.dv-t.s.r { fill: var(--bad, #e5484d); font-weight: 600; }
.dv .dv-ox { fill: color-mix(in srgb, var(--muted) 35%, var(--surface)); }
.dv .dv-gate { fill: color-mix(in srgb, var(--ink) 78%, var(--surface)); }
.dv .dv-wire { stroke: var(--muted); stroke-width: 1.5; }
.dv .dv-pin { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.dv .dv-e { fill: var(--accent); }
.dv .dv-mark { stroke: var(--bad, #e5484d); stroke-width: 2; stroke-dasharray: 3 2; }
.dv text.dv-t { font: 500 calc(12px * var(--fs, 1)) var(--font-ui); fill: var(--ink); }
.dv text.dv-t.b { font: 700 calc(13px * var(--fs, 1)) var(--font-mono); }
.dv text.dv-t.g { fill: var(--surface); font-weight: 600; }
.dv text.dv-t.s { font-size: calc(11px * var(--fs, 1)); fill: var(--muted); }
.dv text.dv-v, .dv tspan.dv-v { font: 500 calc(11px * var(--fs, 1)) var(--font-mono); fill: var(--accent); }
.dv-ctl { display: flex; flex-direction: column; gap: 10px; }
.dv-regs { flex-wrap: wrap; align-self: flex-start; }
.dv-regs button { font-family: var(--font-ui); }
.dv-tau { font-family: var(--font-mono); font-size: 0.78rem; margin: 0; }


/* ---------- CMOS inverter ---------- */
.iv-ctl { display: grid; grid-template-columns: minmax(0, 120px) minmax(0, 120px) minmax(0, 1fr); gap: 12px; align-items: end; }
.iv-ratio .inrow { align-items: center; }
.iv-ratio input[type=range] { flex: 1; }
.iv-ratio .val { width: 80px; flex: none; }
.iv-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 250px); gap: 16px; align-items: start; }
.iv-side { display: flex; flex-direction: column; gap: 10px; }
.iv-vinrow { align-items: center; gap: 8px; } .iv-vinrow input { flex: 1; } .iv-vinrow label { font-weight: 600; font-size: 0.85rem; }
.iv-svg .iv-grid { stroke: var(--grid, var(--line)); stroke-width: 1; }
.iv-svg .iv-diag { stroke: var(--muted); stroke-dasharray: 3 4; }
.iv-svg .iv-ghost { fill: none; stroke: var(--muted); stroke-width: 1; opacity: 0.45; }
.iv-svg .iv-gl { font-size: 10px; fill: var(--muted); }
.iv-svg .iv-curve { fill: none; stroke: var(--accent); stroke-width: 2.6; }
.iv-svg .iv-mark { stroke: var(--m2); stroke-dasharray: 3 3; }
.iv-svg .iv-tan { stroke: var(--m2); stroke-width: 1.5; }
.iv-svg .iv-pt { fill: var(--m2); }
.iv-svg .iv-vm { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.iv-svg text.iv-lab { fill: var(--ink); font-weight: 600; }
.iv-svg .iv-nml { fill: var(--m1); opacity: 0.6; } .iv-svg .iv-nmh { fill: var(--diff); opacity: 0.6; }
.iv-svg .iv-cur { stroke: var(--via); stroke-width: 1.5; }
.iv-svg text.iv-nl { font-size: 10px; fill: var(--muted); font-weight: 600; }
.iv-svg .iv-dot { fill: var(--via); stroke: var(--surface); stroke-width: 2; }
.iv-sch { width: 100%; max-width: 250px; display: block; }
.iv-sch .iv-w { stroke: var(--ink); stroke-width: 2; fill: none; }
.iv-sch .iv-w.g { stroke-width: 3; }
.iv-sch .iv-bub { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.iv-sch .iv-ch.n { fill: var(--m1); } .iv-sch .iv-ch.p { fill: var(--m2); }
.iv-sch .iv-ch { transition: opacity 0.12s linear; }
.iv-sch .iv-node { fill: var(--ink); }
.iv-sch text { font: 600 12px var(--font-ui); fill: var(--ink); }
.iv-sch text.iv-ts { font-weight: 500; font-size: 11px; fill: var(--muted); }
.iv-sch text.iv-ts.sat { fill: var(--diff); } .iv-sch text.iv-ts.triode { fill: var(--m1); } .iv-sch text.iv-ts.off { fill: var(--bad, #e5484d); }
.iv-sch text.iv-tv { font: 500 11px var(--font-mono); fill: var(--accent); }
dl.kv.iv-kv { grid-template-columns: repeat(2, minmax(0, max-content) minmax(0, 1fr)); column-gap: 24px; }
@media (max-width: 900px) { .iv-main { grid-template-columns: minmax(0, 1fr); } .iv-side { flex-direction: row; flex-wrap: wrap; align-items: center; } .iv-sch-w { flex: 0 0 200px; } }
@media (max-width: 560px) { .iv-ctl { grid-template-columns: repeat(2, minmax(0, 1fr)); } .iv-ratio { grid-column: 1 / -1; } dl.kv.iv-kv { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); } .iv-sch-w { flex: 1 1 100%; } }

/* ---------- IEEE 754 and fixed point ---------- */
.fp-fmt { flex-wrap: wrap; align-self: flex-start; }
.fp-fmt button { font-family: var(--font-ui); }
.fp-fmt small { opacity: 0.7; font-family: var(--font-mono); }
.fp-bits { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.fb { width: 18px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; font: 600 0.72rem var(--font-mono); background: var(--sunken); color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; }
.fb.on { color: var(--ink); }
.fb.s { background: color-mix(in srgb, var(--m2) 18%, var(--sunken)); border-color: color-mix(in srgb, var(--m2) 50%, var(--line)); }
.fb.e { background: color-mix(in srgb, var(--via) 20%, var(--sunken)); border-color: color-mix(in srgb, var(--via) 55%, var(--line)); }
.fb.m { background: color-mix(in srgb, var(--m1) 14%, var(--sunken)); border-color: color-mix(in srgb, var(--m1) 45%, var(--line)); }
.fb.on.s { background: color-mix(in srgb, var(--m2) 55%, var(--sunken)); } .fb.on.e { background: color-mix(in srgb, var(--via) 60%, var(--sunken)); } .fb.on.m { background: color-mix(in srgb, var(--m1) 45%, var(--sunken)); }
.fb-gap { width: 6px; }
.fp-legend .fb { cursor: default; width: 16px; height: 18px; vertical-align: middle; margin: 0 2px; }
.fp-exact { font-family: var(--font-mono); overflow-wrap: anywhere; }
.fx-ctl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.fx-ctl .chip { width: 100%; min-height: 42px; }
@media (max-width: 560px) { .fx-ctl { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fb { width: 16px; height: 22px; } }

/* offline note and install button */
.foot-app { display: none; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0; }
.is-offline .foot-app, .foot-app:has(#install:not([hidden])) { display: flex; }
.off-note { display: none; color: var(--diff); font-weight: 600; }
.is-offline .off-note { display: inline; }
