/* code-bench.css — the bench labs on /code/labs/<lab> (web/static/js/labs/_bench.js). Chrome is the
   muted steel of the viz tokens; bright colour is for the equipment and data only. Scoped under .bl. */
.bl { display: flex; flex-direction: column; gap: .7rem; }
.bl-board { position: relative; width: 100%; border-radius: .9rem; overflow: hidden; border: 1px solid rgba(148, 163, 184, .3); background: #0b1220; }
.bl-canvas { display: block; }
.bl-fx { position: absolute; top: 0; left: 0; pointer-events: none; }
.bl-board-wrap { position: relative; }
.bl-board.bl-zoomed { overflow-x: auto; overscroll-behavior-x: contain; }
.bl-zoom { position: absolute; top: .4rem; right: .4rem; z-index: 2; border-radius: 999px; border: 1px solid rgba(148, 163, 184, .45); background: rgba(2, 6, 23, .8); color: #e2e8f0; padding: .25rem .65rem; font-size: .8rem; font-weight: 600; cursor: pointer; }
.bl-zoom[hidden] { display: none; }
.bl-goal { display: flex; align-items: center; gap: .55rem; padding: .5rem .75rem; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .3); color: #e2e8f0; }
.bl-goal-mark { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #e2e8f0; border: 1px solid rgba(148, 163, 184, .4); }
.bl-goal.bl-done { border-color: rgba(253, 224, 71, .55); background: rgba(253, 224, 71, .08); }
.bl-goal.bl-done .bl-goal-mark { color: #0b1220; background: #fde047; border-color: #fde047; }
.bl-read { margin: 0; min-height: 1.3em; color: #e2e8f0; font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-read b, .bl-read .katex .mathbf, .bl-read .katex .textbf { color: #fde68a; }
.bl-controls { display: flex; flex-direction: column; gap: .45rem; }
.bl-slider { display: grid; grid-template-columns: minmax(8rem, auto) 1fr 6rem; align-items: center; gap: .6rem; color: #e2e8f0; font-size: .9rem; }
.bl-slider input { width: 100%; accent-color: #7dd3fc; }
.bl-slider output { text-align: right; color: #f1f5f9; font-variant-numeric: tabular-nums; }
.bl-choice { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: #e2e8f0; font-size: .9rem; }
.bl-choice-label { min-width: 8rem; }
.bl-seg { display: flex; flex-wrap: wrap; gap: .3rem; }
.bl-seg .bl-btn[aria-pressed="true"] { background: rgba(125, 211, 252, .18); border-color: #7dd3fc; color: #e0f2fe; font-weight: 700; }
.bl-buttons, .bl-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.bl-btn { border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .3); background: rgba(15, 23, 42, .55); color: #e2e8f0; padding: .35rem .85rem; font-size: .88rem; cursor: pointer; }
.bl-btn:hover { border-color: #7d93ad; }
.bl-btn:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 2px; }
.bl-btn:disabled { opacity: .5; cursor: default; }
.bl-primary { background: #0ea5e9; border-color: #0ea5e9; color: #04121f; font-weight: 700; }
.bl-primary:hover { background: #38bdf8; border-color: #38bdf8; }
.bl-answer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: #e2e8f0; font-size: .9rem; }
.bl-answer input { width: 7rem; padding: .3rem .5rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #0b1220; color: #f1f5f9; font-variant-numeric: tabular-nums; }
.bl-note { margin: 0; padding: .45rem .7rem; border-radius: .6rem; font-size: .9rem; background: rgba(148, 163, 184, .1); color: #e2e8f0; }
.bl-note[hidden] { display: none; }
.bl-note.bl-ok { background: rgba(16, 185, 129, .14); color: #d1fae5; }
.bl-note.bl-warn { background: rgba(251, 191, 36, .12); color: #fde68a; }
.bl-data { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: flex-start; }
.bl-data[hidden] { display: none; }
.bl-table-wrap { max-height: 14rem; overflow: auto; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .25); }
.bl-table { border-collapse: collapse; font-size: .85rem; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.bl-table th, .bl-table td { padding: .3rem .7rem; text-align: right; border-bottom: 1px solid rgba(148, 163, 184, .15); }
.bl-table th { position: sticky; top: 0; background: #111a2b; color: #e2e8f0; font-weight: 600; }
.bl-empty { color: #e2e8f0; text-align: center !important; }
.bl-graph { display: block; border-radius: .6rem; background: rgba(2, 6, 23, .5); }
.bl-fit { margin: .3rem 0 0; font-size: .82rem; color: #fde68a; }
@media (max-width: 520px) { .bl-slider { grid-template-columns: 1fr auto; } .bl-slider label { grid-column: 1 / -1; } .bl-choice-label { min-width: 0; width: 100%; } }
/* The light theme's global border colour outranks .bl-*: restore the edges (the bench stays dark). */
html[data-theme="light"] .bl .bl-btn, html[data-theme="light"] .bl .bl-board, html[data-theme="light"] .bl .bl-goal { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .bl .bl-goal.bl-done { border-color: rgba(253, 224, 71, .55); }

/* /code/labs: the bench-lab cards */
.bx-grid { list-style: none; margin: 0 0 2rem; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.bx-card { --h: 200; display: flex; flex-direction: column; gap: .35rem; height: 100%; padding: .9rem 1rem; border-radius: 1rem; text-decoration: none; color: #e2e8f0;
  background: linear-gradient(150deg, hsla(var(--h), 80%, 45%, .22), hsla(var(--h), 70%, 30%, .08)); border: 1px solid hsla(var(--h), 80%, 60%, .4); transition: transform .15s; }
.bx-card:hover { transform: translateY(-2px) rotate(-.4deg); border-color: hsla(var(--h), 85%, 65%, .8); }
.bx-emoji { font-size: 1.6rem; line-height: 1; }
.bx-card strong { color: #fff; font-size: 1.02rem; }
.bx-card span.bx-sub { color: #e2e8f0; font-size: .86rem; line-height: 1.4; flex: 1; }
.bx-meta { display: flex; justify-content: space-between; color: #e2e8f0; font-size: .78rem; }
.bx-meta .bx-done { color: #6ee7b7; font-weight: 600; }
.bx-h2 { font-size: 1.3rem; font-weight: 700; color: #fff; margin: .5rem 0 .75rem; }
@media (prefers-reduced-motion: reduce) { .bx-card { transition: none; } .bx-card:hover { transform: none; } }
html[data-theme="light"] .bx-card { color: #334155; } html[data-theme="light"] .bx-card strong, html[data-theme="light"] .bx-h2 { color: #0f172a; }
html[data-theme="light"] .bx-card span.bx-sub { color: #475569; }
.bx-h3 { font-size: 1.05rem; font-weight: 700; color: #e2e8f0; margin: .25rem 0 .6rem; }
html[data-theme="light"] .bx-h3 { color: #1e293b; }

/* ── AI labs (ai-perceptron, ai-network, ai-robot, ai-tree): own layouts for phones, so no Zoom ── */
.cx-lab-sec[data-bench^="ai-"] .bl-zoom { display: none !important; }
.cx-lab-sec[data-bench^="ai-"] .bl-read { font-weight: 500; line-height: 1.55; font-size: .92rem; }
.bl-read .ai-rule, .bl-read .ai-math, .bl-read > span { display: block; }
.bl-read .ai-rule { color: #bae6fd; }
.bl-read .ai-math { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bl-read .ai-good { font-style: normal; color: #86efac; font-weight: 700; }
.bl-read .ai-bad { font-style: normal; color: #fca5a5; font-weight: 700; }

/* prac-* — the 9702 Paper 3 practical labs (labs/_prac.js): results table, graph controls, answer
   fields, mark-scheme feedback and the score card. Dark like the rest of the bench in both themes. */
.pr { display: flex; flex-direction: column; gap: .75rem; color: #e2e8f0; }
.pr-sample { margin: 0; padding: .45rem .7rem; border-radius: .6rem; background: rgba(56, 189, 248, .1); border: 1px dashed rgba(56, 189, 248, .45); color: #bae6fd; font-size: .88rem; }
.pr-tip { margin: 0; color: #e2e8f0; font-size: .9rem; line-height: 1.45; }
.pr-tip b { color: #f1f5f9; }
.pr input[type="text"], .pr select { min-width: 0; padding: .32rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font: inherit; font-size: .92rem; font-variant-numeric: tabular-nums; }
.pr input[type="text"]:focus, .pr select:focus { outline: 2px solid #7dd3fc; outline-offset: 1px; border-color: #7dd3fc; }
.pr-tablewrap { overflow-x: auto; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .3); background: rgba(2, 6, 23, .35); }
.pr-table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.pr-table th, .pr-table td { padding: .3rem .35rem; border-bottom: 1px solid rgba(148, 163, 184, .16); text-align: center; }
.pr-table th { background: #111a2b; color: #e2e8f0; font-weight: 600; white-space: nowrap; }
.pr-table th input.pr-hq { width: 5.2rem; text-align: center; font-style: italic; }
.pr-table th select { max-width: 5.2rem; }
.pr-slash { margin: 0 .25rem; color: #e2e8f0; }
.pr-table td input { width: 100%; min-width: 4.2rem; text-align: center; }
.pr-table td.pr-calc input { background: #10192b; border-style: dashed; }
.pr-table .pr-rn { width: 1.6rem; color: #e2e8f0; font-size: .8rem; }
.pr-del { border: 0; background: none; color: #e2e8f0; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: .1rem .35rem; border-radius: .3rem; }
.pr-del:hover { color: #fca5a5; background: rgba(248, 113, 113, .12); }
.pr-row-acts, .pr-hand { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.pr-count, .pr-tally { color: #e2e8f0; font-size: .85rem; }
.pr-ro .pr-table td { padding: .25rem .6rem; font-variant-numeric: tabular-nums; }
.pr-copy { max-width: 32rem; }
.pr-fields { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.pr-field { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; color: #e2e8f0; font-size: .95rem; }
.pr-fl { font-style: italic; min-width: 2.2rem; }
.pr-field input { width: 6.5rem; }
.pr-field small { flex-basis: 100%; color: #e2e8f0; }
.pr-u { color: #e2e8f0; font-size: .85rem; }
.pr-axes { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .6rem; }
.pr-axes fieldset { margin: 0; padding: .5rem .7rem .65rem; border: 1px solid rgba(148, 163, 184, .3); border-radius: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.pr-axes legend { padding: 0 .3rem; color: #fde68a; font-weight: 700; font-size: .9rem; }
.pr-axes label { display: flex; align-items: center; justify-content: space-between; gap: .5rem; color: #e2e8f0; font-size: .9rem; }
.pr-axes input { width: 6.5rem; }
.pr-axes select { max-width: 10rem; }
.pr-formula { padding: .6rem .8rem; border-radius: .6rem; background: rgba(250, 204, 21, .07); border: 1px solid rgba(250, 204, 21, .3); color: #e2e8f0; font-size: .92rem; line-height: 1.5; }
.pr-formula p { margin: .15rem 0; }
.pr-formula b { color: #fde68a; }
.pr-eq { font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; color: #fef9c3; }
.pr-eq span { color: #7dd3fc; }
.pr-small { color: #e2e8f0; font-size: .85rem; }
.pr-marks { padding: .6rem .8rem; border-radius: .7rem; border: 1px solid rgba(148, 163, 184, .3); background: rgba(2, 6, 23, .5); }
.pr-marks[hidden], .pr-card[hidden], .pr-formula[hidden] { display: none; }
.pr-mh { margin: 0 0 .4rem; font-weight: 600; }
.pr-mh b { color: #fde68a; font-size: 1.05rem; }
.pr-marks ul, .pr-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.pr-marks li { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; }
.pr-tick { flex: none; width: 1.35rem; height: 1.35rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.pr-ok .pr-tick { background: #34d399; color: #04261a; }
.pr-no .pr-tick { background: rgba(248, 113, 113, .2); color: #fca5a5; border: 1px solid rgba(248, 113, 113, .6); }
.pr-ml { display: block; line-height: 1.4; }
.pr-why { display: block; }
.pr-ml b { color: #f1f5f9; font-weight: 600; }
.pr-mx { color: #e2e8f0; font-weight: 500; margin-left: .2rem; }
.pr-why { color: #fde68a; }
.pr-card { padding: 1rem 1.1rem; border-radius: .9rem; border: 1px solid rgba(253, 224, 71, .55); background: linear-gradient(150deg, rgba(250, 204, 21, .16), rgba(56, 189, 248, .08)); text-align: center; }
.pr-card-h { margin: 0; font-size: 1.2rem; font-weight: 800; color: #fff; }
.pr-card-big { margin: .2rem 0; font-size: 1.1rem; color: #e2e8f0; }
.pr-card-big b { font-size: 2.4rem; color: #fde047; }
.pr-card-sub { margin: 0 0 .6rem; color: #e2e8f0; font-size: .9rem; }
.pr-card li { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem .4rem; border-bottom: 1px solid rgba(148, 163, 184, .18); font-size: .9rem; text-align: left; }
.pr-card li b { color: #fde68a; }
.pr-eval { display: flex; flex-direction: column; gap: .5rem; }
.pr-h3 { margin: .3rem 0 0; font-size: 1rem; color: #f1f5f9; }
.pr-h3 small { color: #e2e8f0; font-weight: 500; }
.pr-chks { display: flex; flex-direction: column; gap: .3rem; }
.pr-chk { display: flex; gap: .55rem; align-items: flex-start; padding: .4rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .22); color: #e2e8f0; font-size: .92rem; cursor: pointer; }
.pr-chk:hover { border-color: rgba(125, 211, 252, .6); }
.pr-chk input { margin-top: .2rem; accent-color: #38bdf8; }
.pr-hcell { display: inline-flex; align-items: center; }
@media (max-width: 520px) {
  .pr-hcell { flex-direction: column; gap: .15rem; }
  .pr-table th { white-space: normal; padding: .3rem .2rem; }
  .pr-table th input.pr-hq, .pr-table th select { width: 100%; max-width: none; min-width: 4.4rem; }
  .pr-slash { margin: 0; line-height: 1; font-size: .8rem; }
  .pr-table td { padding: .25rem .15rem; }
  .pr-table td input { min-width: 0; padding: .3rem .2rem; }
  .pr-field input { width: 5.4rem; }
}

/* ===== cpu: Tiny CPU lab (/code/labs/cpu, web/static/js/labs/cpu.js). The bench stays dark in both themes. ===== */
.cpu-lab .bl-board-wrap, .cpu-lab .bl-read, .cpu-lab .bl-controls, .cpu-lab .bl-data { display: none !important; }
.cpu { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.cpu h3 { margin: 0; font-size: .95rem; font-weight: 700; color: #f1f5f9; }
.cpu-hint { font-size: .78rem; color: #e2e8f0; }
.cpu-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.cpu-panel > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .7rem; margin-bottom: .5rem; }
.cpu-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.cpu-run { display: flex; flex-wrap: wrap; gap: .4rem; }
.cpu-bar .bl-btn { font-weight: 600; }
.cpu-speed { display: flex; align-items: center; gap: .45rem; font-size: .85rem; color: #e2e8f0; }
.cpu-speed input { width: 7rem; accent-color: #7dd3fc; }
.cpu-speed output { min-width: 4.6rem; color: #f1f5f9; font-weight: 600; }
.cpu-check { margin-left: auto; background: #22c55e; border-color: #22c55e; color: #04130a; font-weight: 700 !important; }
.cpu-check:hover { background: #4ade80; border-color: #4ade80; }
.cpu-msg:empty, .cpu-panel[hidden], .cpu-io[hidden] { display: none; }
.cpu-results { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; font-size: .88rem; }
.cpu-results[hidden] { display: none; }
.cpu-results li { display: flex; align-items: center; gap: .5rem; padding: .3rem .55rem; border-radius: .5rem; background: rgba(148, 163, 184, .08); }
.cpu-results li > span:nth-child(2) { flex: 1; min-width: 0; }
.cpu-results .bl-btn { padding: .15rem .6rem; font-size: .8rem; }
.cpu-rmark { font-weight: 800; width: 1rem; text-align: center; }
.cpu-results .is-ok .cpu-rmark { color: #4ade80; } .cpu-results .is-bad .cpu-rmark { color: #f87171; }
.cpu-actions { margin-top: .2rem; }

/* machine layout */
.cpu-machine { position: relative; display: flex; flex-direction: column; gap: 0; }
.cpu-top { display: grid; gap: .7rem; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
@container (min-width: 660px) { .cpu-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); } }
.cpu-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

/* editor */
.cpu-ed { display: grid; grid-template-columns: auto minmax(0, 1fr); border-radius: .55rem; background: #060b16; border: 1px solid rgba(148, 163, 184, .18); overflow: hidden; }
.cpu-gut, .cpu-hl, .cpu-ed textarea { font-family: var(--mono); font-size: 14px; line-height: 21px; }
.cpu-gut { padding: 8px 0; background: #0a1426; border-right: 1px solid rgba(148, 163, 184, .15); user-select: none; }
.cpu-g { display: block; position: relative; width: 2.9rem; height: 21px; padding: 0 .45rem 0 1.05rem; border: 0; background: none; color: #e2e8f0; font: inherit; text-align: right; cursor: pointer; }
.cpu-g:hover { color: #e2e8f0; }
.cpu-g.no-ins { cursor: default; }
.cpu-g.is-bp::before { content: ""; position: absolute; left: .3rem; top: 5px; width: 11px; height: 11px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, .8); }
.cpu-g.is-cur { color: #fde047; font-weight: 700; }
.cpu-g.is-cur::after { content: "▶"; position: absolute; left: .25rem; top: 0; font-size: 10px; color: #fde047; }
.cpu-g.is-bp.is-cur::after { left: .35rem; color: #fff; }
.cpu-g.is-err { color: #fca5a5; background: rgba(239, 68, 68, .16); }
.cpu-codebox { position: relative; overflow: hidden; min-height: 120px; }
.cpu-hl, .cpu-ed textarea { margin: 0; padding: 8px .7rem; white-space: pre; tab-size: 4; letter-spacing: 0; }
.cpu-hl { position: absolute; top: 0; left: 0; min-width: 100%; color: #e2e8f0; pointer-events: none; }
.cpu-l { min-width: 100%; padding-right: .7rem; margin: 0 -.7rem; padding-left: .7rem; }
.cpu-l.is-cur { background: rgba(253, 224, 71, .13); box-shadow: inset 3px 0 0 #fde047; }
.cpu-l.is-done { background: rgba(74, 222, 128, .1); }
.cpu-l.is-err { background: rgba(239, 68, 68, .16); text-decoration: underline wavy rgba(248, 113, 113, .8); text-underline-offset: 4px; }
.cpu-l.is-bp:not(.is-cur) { background: rgba(239, 68, 68, .07); }
.cpu-ed textarea { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0; outline: 0; background: transparent; color: transparent; caret-color: #f8fafc; overflow-x: auto; overflow-y: hidden; }
.cpu-ed textarea::selection { background: rgba(125, 211, 252, .3); color: transparent; }
.cpu-ed:focus-within { border-color: rgba(125, 211, 252, .6); }
.cpu-ed textarea[readonly] { caret-color: transparent; cursor: default; }
.t-op { color: #7dd3fc; font-weight: 700; } .t-num { color: #fbbf24; } .t-opd { color: #f9a8d4; } .t-ref { color: #f9a8d4; }
.t-lab { color: #e879f9; font-weight: 700; } .t-reg { color: #86efac; font-weight: 600; } .t-addr { color: #e2e8f0; } .t-com { color: #e2e8f0; font-style: italic; }
.cpu-errs { list-style: none; margin: .45rem 0 0; padding: 0; display: grid; gap: .25rem; font-size: .85rem; color: #fecaca; }
.cpu-errs:empty { display: none; }
.cpu-exsel { margin-left: auto; max-width: 100%; padding: .2rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #e2e8f0; font-size: .85rem; }
.cpu-errs li { padding: .25rem .5rem; border-radius: .45rem; background: rgba(239, 68, 68, .12); }
.cpu-errs button { border: 0; background: rgba(239, 68, 68, .3); color: #fff; font-weight: 700; border-radius: .35rem; padding: 0 .35rem; margin-right: .3rem; cursor: pointer; font-size: .8rem; }

/* processor */
.cpu-proc, .cpu-edit { display: flex; flex-direction: column; }
.cpu-proc { container-type: inline-size; }
.cpu-edit .cpu-ed { flex: 1 1 auto; }
.cpu-proc > header { align-items: center; }
.cpu-state { font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: rgba(148, 163, 184, .16); color: #e2e8f0; }
.cpu-state[data-k="run"] { background: rgba(56, 189, 248, .2); color: #bae6fd; } .cpu-state[data-k="done"] { background: rgba(74, 222, 128, .18); color: #bbf7d0; }
.cpu-state[data-k="err"] { background: rgba(239, 68, 68, .2); color: #fecaca; } .cpu-state[data-k="pause"] { background: rgba(253, 224, 71, .16); color: #fef08a; }
.cpu-cycles { margin-left: auto; font-size: .82rem; color: #e2e8f0; }
.cpu-cycles b { font-family: var(--mono); color: #fde047; font-size: .95rem; }
.cpu-stars { color: #fde047; letter-spacing: .05em; }
.cpu-rtn { list-style: none; margin: 0 0 .6rem; padding: .35rem .5rem; border-radius: .55rem; background: #060b16; border: 1px solid rgba(148, 163, 184, .15); font-family: var(--mono); font-size: 12.5px; line-height: 1.55; max-height: 12.5rem; overflow: auto; }
.cpu-rtn li { padding: 0 .35rem; border-radius: .3rem; color: #e2e8f0; overflow-wrap: anywhere; }
.cpu-rtn li.cpu-ph { font-family: system-ui, sans-serif; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #e2e8f0; margin-top: .15rem; }
.cpu-rtn li.cpu-dim { color: #e2e8f0; }
.cpu-rtn li.is-past { color: #e2e8f0; }
.cpu-rtn li.is-now { background: #fde047; color: #111827; font-weight: 700; }
.cpu-rtn li.cpu-rtn-err { color: #fecaca; background: rgba(239, 68, 68, .18); font-family: system-ui, sans-serif; }
.cpu-regs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin-top: auto; }
@container (max-width: 420px) { .cpu-regs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cpu-r-flag { grid-column: 1 / -1; order: 3; } .cpu-r-cu { order: 1; } .cpu-r-alu { order: 2; } .cpu-r-cir { order: 4; } .cpu-r-pc { order: 5; } .cpu-r-acc { order: 6; } .cpu-r-ix { order: 7; } .cpu-r-mar { order: 8; } .cpu-r-mdr { order: 9; } }
.cpu-reg { position: relative; display: flex; flex-direction: column; gap: .05rem; padding: .35rem .5rem .4rem; border-radius: .55rem; border: 1px solid rgba(148, 163, 184, .28); background: #111b2e; min-width: 0; transition: box-shadow .2s, border-color .2s; }
.cpu-rn { font-weight: 800; font-size: .82rem; color: #7dd3fc; }
.cpu-rl { font-size: .75rem; color: #e2e8f0; line-height: 1.2; min-height: 1.2em; }
.cpu-rv { font-family: var(--mono); font-size: 1rem; font-weight: 700; color: #f8fafc; overflow-wrap: anywhere; line-height: 1.25; }
.cpu-rb { font-family: var(--mono); font-size: .75rem; color: #e2e8f0; min-height: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpu-r-acc .cpu-rn, .cpu-r-ix .cpu-rn { color: #86efac; }
.cpu-r-cu .cpu-rn, .cpu-r-alu .cpu-rn { color: #c4b5fd; }
.cpu-r-cu, .cpu-r-alu { background: #17132b; border-color: rgba(167, 139, 250, .35); }
.cpu-r-flag .cpu-rn { color: #fcd34d; }
.cpu-r-flag.is-true .cpu-rv { color: #4ade80; } .cpu-r-flag.is-false .cpu-rv { color: #f87171; }
.cpu-r-mar { border-color: rgba(56, 189, 248, .45); } .cpu-r-mdr { border-color: rgba(251, 191, 36, .45); }
.cpu-reg.is-hot { border-color: #fde047; box-shadow: 0 0 0 2px rgba(253, 224, 71, .45), 0 0 18px rgba(253, 224, 71, .25); }
.cpu-reg.is-flash .cpu-rv { animation: cpu-flash .6s ease-out; }
@keyframes cpu-flash { 0% { color: #fde047; } 100% { color: #f8fafc; } }

/* buses */
.cpu-bus { position: relative; height: 3.3rem; margin: 0 .2rem; }
.cpu-lane { position: absolute; left: 0; right: 0; height: 6px; border-radius: 3px; transition: box-shadow .2s, background .2s; }
.cpu-lane span { position: absolute; left: .4rem; top: -1.12rem; font-size: .7rem; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.cpu-lane-a { top: 1.15rem; background: rgba(56, 189, 248, .35); } .cpu-lane-a span { color: #7dd3fc; }
.cpu-lane-d { top: 2.55rem; background: rgba(251, 191, 36, .32); } .cpu-lane-d span { color: #fcd34d; }
.cpu-lane-a.is-on { background: #38bdf8; box-shadow: 0 0 12px rgba(56, 189, 248, .8); }
.cpu-lane-d.is-on { background: #fbbf24; box-shadow: 0 0 12px rgba(251, 191, 36, .8); }
.cpu-wire { position: absolute; width: 4px; margin-left: -2px; border-radius: 2px; }
.cpu-wire-a { background: rgba(56, 189, 248, .35); } .cpu-wire-d { background: rgba(251, 191, 36, .32); }
.cpu-wire-a.is-on { background: #38bdf8; box-shadow: 0 0 10px rgba(56, 189, 248, .8); }
.cpu-wire-d.is-on { background: #fbbf24; box-shadow: 0 0 10px rgba(251, 191, 36, .8); }
.cpu-tok { position: absolute; left: 0; top: 0; padding: .1rem .45rem; border-radius: 999px; font-family: var(--mono); font-size: 12.5px; font-weight: 800; white-space: nowrap; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); will-change: transform; }
.cpu-tok.is-addr { background: #38bdf8; color: #04121f; } .cpu-tok.is-data { background: #fbbf24; color: #1c1203; }
.cpu-tok.is-ins { background: #a78bfa; color: #12062b; } .cpu-tok.is-flag { background: #4ade80; color: #05230f; }

/* memory */
.cpu-mem > header { align-items: center; }
.cpu-fmt { margin-left: auto; display: inline-flex; border: 1px solid rgba(148, 163, 184, .3); border-radius: .5rem; overflow: hidden; }
.cpu-fmt button { border: 0; background: transparent; color: #e2e8f0; font-size: .78rem; padding: .2rem .55rem; cursor: pointer; }
.cpu-fmt button[aria-pressed="true"] { background: rgba(125, 211, 252, .2); color: #e0f2fe; font-weight: 700; }
.cpu-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.6rem, 1fr)); gap: .35rem; }
.cpu-cell { position: relative; display: flex; flex-direction: column; gap: .05rem; padding: .25rem .45rem .3rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .2); background: #0f172a; min-width: 0; min-height: 3.15rem; }
.cpu-ca { font-family: var(--mono); font-size: .7rem; color: #e2e8f0; }
.cpu-cl { position: absolute; top: .2rem; right: .35rem; max-width: 60%; font-size: .72rem; font-weight: 800; color: #f0abfc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpu-cv { font-family: var(--mono); font-size: .86rem; font-weight: 700; color: #f1f5f9; overflow-wrap: anywhere; line-height: 1.25; }
.cpu-cell.is-ins { background: rgba(139, 92, 246, .1); border-color: rgba(167, 139, 250, .3); }
.cpu-cell.is-ins .cpu-cv { color: #ddd6fe; }
.cpu-cell.is-data { background: rgba(16, 185, 129, .08); border-color: rgba(52, 211, 153, .3); }
.cpu-cell.is-data .cpu-cv { color: #bbf7d0; }
.cpu-cell.is-empty { border-style: dashed; opacity: .7; }
.cpu-cell.is-pc { box-shadow: inset 3px 0 0 #fde047; border-color: rgba(253, 224, 71, .6); }
.cpu-pctag { position: absolute; bottom: .2rem; right: .3rem; font-size: .7rem; font-weight: 800; color: #111827; background: #fde047; border-radius: .25rem; padding: 0 .25rem; }
.cpu-cell.is-mar { outline: 2px solid rgba(56, 189, 248, .75); outline-offset: -1px; }
.cpu-cell.is-hot { box-shadow: 0 0 0 2px #fde047, 0 0 16px rgba(253, 224, 71, .35); }
.cpu-cell.is-flash { animation: cpu-cellflash .9s ease-out; }
@keyframes cpu-cellflash { 0% { background: rgba(253, 224, 71, .45); } 100% { background: rgba(16, 185, 129, .08); } }
.cpu-gap { display: grid; place-items: center; color: #e2e8f0; font-weight: 800; letter-spacing: .1em; min-height: 3.15rem; border-radius: .45rem; border: 1px dashed rgba(148, 163, 184, .15); }
.cpu-empty { margin: 0; color: #e2e8f0; font-size: .85rem; }

/* input / output */
.cpu-io { display: grid; gap: .7rem; grid-template-columns: minmax(0, 1fr); margin-top: .7rem; }
@container (min-width: 620px) { .cpu-io { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); } }
.cpu-inbox { width: 100%; box-sizing: border-box; margin-bottom: .45rem; padding: .3rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; }
.cpu-inbox:disabled { opacity: .55; }
.cpu-chips { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 2.4rem; align-items: flex-start; }
.cpu-chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 1.9rem; padding: .1rem .3rem; border-radius: .4rem; background: #1e293b; border: 1px solid rgba(148, 163, 184, .3); font-family: var(--mono); font-weight: 800; font-size: 1rem; color: #f8fafc; line-height: 1.2; }
.cpu-chip small { font-size: .72rem; font-weight: 600; color: #e2e8f0; }
.cpu-chip.is-used { opacity: .35; text-decoration: line-through; }
.cpu-tape .cpu-chip { background: #052e1a; border-color: rgba(74, 222, 128, .45); color: #bbf7d0; }
.cpu-tape .cpu-chip.is-odd { background: #3b0d0d; border-color: rgba(248, 113, 113, .5); color: #fecaca; }
.cpu-chipnone { color: #e2e8f0; font-size: .85rem; padding-top: .3rem; }
.cpu-symlist { display: flex; flex-wrap: wrap; gap: .3rem; }
.cpu-sym-row { display: inline-flex; border-radius: .4rem; overflow: hidden; border: 1px solid rgba(240, 171, 252, .35); font-family: var(--mono); font-size: .85rem; }
.cpu-sym-row b { padding: .1rem .4rem; background: rgba(232, 121, 249, .14); color: #f0abfc; }
.cpu-sym-row span { padding: .1rem .45rem; color: #e2e8f0; }
.cpu-lamprow { display: flex; gap: .3rem; justify-content: space-between; }
.cpu-lamp { display: flex; flex-direction: column; align-items: center; gap: .2rem; flex: 1; }
.cpu-lamp i { width: 100%; max-width: 2rem; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #475569, #1e293b 70%); border: 2px solid #334155; }
.cpu-lamp.is-on i { background: radial-gradient(circle at 35% 30%, #fffbeb, #fde047 45%, #f59e0b 90%); border-color: #fcd34d; box-shadow: 0 0 14px rgba(253, 224, 71, .75); }
.cpu-lamp small { font-family: var(--mono); font-size: .72rem; color: #e2e8f0; }

/* trace table */
.cpu-tracewrap { max-height: 17rem; overflow: auto; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .18); }
.cpu-tt { border-collapse: collapse; width: 100%; font-size: .82rem; font-variant-numeric: tabular-nums; }
.cpu-tt th, .cpu-tt td { padding: .22rem .55rem; border-bottom: 1px solid rgba(148, 163, 184, .12); text-align: center; white-space: nowrap; }
.cpu-tt th { position: sticky; top: 0; background: #142035; color: #e2e8f0; font-weight: 700; z-index: 1; }
.cpu-tt th small { display: block; font-weight: 500; font-size: .72rem; color: #e2e8f0; }
.cpu-tt td { font-family: var(--mono); color: #e2e8f0; }
.cpu-tt td:nth-child(2) { text-align: left; color: #ddd6fe; }
.cpu-tt code { font-family: var(--mono); }
.cpu-ttstart td { color: #e2e8f0; font-style: italic; }
.cpu-ttempty { color: #e2e8f0 !important; font-family: system-ui, sans-serif !important; white-space: normal !important; padding: .6rem !important; }

/* trace prediction */
.cpu-pcols { display: grid; gap: .45rem; }
.cpu-pcol { display: grid; grid-template-columns: 7rem minmax(0, 1fr); align-items: center; gap: .5rem; font-size: .88rem; font-weight: 700; color: #e2e8f0; }
.cpu-pcol input { width: 100%; box-sizing: border-box; padding: .35rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; }
.cpu-pcol.is-ok input { border-color: #4ade80; box-shadow: 0 0 0 1px rgba(74, 222, 128, .4); }
.cpu-pcol.is-bad input { border-color: #f87171; box-shadow: 0 0 0 1px rgba(248, 113, 113, .4); }
.cpu-pact { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .55rem; }

/* reference card */
.cpu-refwrap { overflow-x: auto; }
.cpu-reftab { border-collapse: collapse; width: 100%; font-size: .84rem; }
.cpu-reftab th, .cpu-reftab td { padding: .22rem .5rem; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(148, 163, 184, .1); }
.cpu-reftab thead th { color: #e2e8f0; font-size: .75rem; }
.cpu-reftab td:first-child { white-space: nowrap; }
.cpu-reftab code, .cpu-notes code { font-family: var(--mono); color: #7dd3fc; font-weight: 700; }
.cpu-reftab td:last-child { color: #e2e8f0; }
.cpu-refgroup th { padding-top: .5rem; color: #c4b5fd; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; }
.cpu-notes { margin: .55rem 0 0; padding-left: 1.1rem; font-size: .84rem; color: #e2e8f0; display: grid; gap: .2rem; }

@media (max-width: 600px) {
  .cpu-gut, .cpu-hl, .cpu-ed textarea { font-size: 16px; line-height: 23px; }
  .cpu-g { height: 23px; width: 2.6rem; }
  .cpu-g.is-bp::before { top: 6px; }
  .cpu-check { margin-left: 0; }
  .cpu-regs { gap: .3rem; }
  .cpu-reg { padding: .3rem .4rem; }
  .cpu-rv { font-size: .92rem; }
  .cpu-pcol { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .cpu-cells { grid-template-columns: repeat(auto-fill, minmax(5.9rem, 1fr)); }
  .cpu-reftab thead { display: none; }
  .cpu-reftab tr { display: block; padding: .3rem 0; border-bottom: 1px solid rgba(148, 163, 184, .1); }
  .cpu-reftab td, .cpu-reftab th { display: block; border: 0; padding: .05rem .3rem; }
  .cpu-reftab td:first-child { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .cpu-reg.is-flash .cpu-rv, .cpu-cell.is-flash { animation: none; } }
html[data-theme="light"] .cpu-panel, html[data-theme="light"] .cpu-reg, html[data-theme="light"] .cpu-cell { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .cpu-r-cu, html[data-theme="light"] .cpu-r-alu { border-color: rgba(167, 139, 250, .35); }
html[data-theme="light"] .cpu-cell.is-ins { border-color: rgba(167, 139, 250, .3); } html[data-theme="light"] .cpu-cell.is-data { border-color: rgba(52, 211, 153, .3); }
html[data-theme="light"] .cpu-cell.is-pc { border-color: rgba(253, 224, 71, .6); }
/* cpu: the site styles every pre and textarea (background, border, shadow, radius): the editor's two layers must stay bare */
.cpu .cpu-ed pre.cpu-hl, .cpu .cpu-ed textarea { background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; max-width: none; }
.cpu .cpu-ed textarea { color: transparent !important; -webkit-text-fill-color: transparent; }
/* bench pages, light theme: the breadcrumb's current-page name (a plain span) kept the dark-theme slate and was too faint (2.2:1) */
html[data-theme="light"] .cx-crumbs { color: #475569; }
/* ai-tree: the question panel under the tree */
.ait-panel { display: flex; flex-direction: column; gap: .4rem; color: #e2e8f0; font-size: .9rem; }
.ait-panel p { margin: 0; }
.ait-panel b { color: #f1f5f9; }
.ait-pure { color: #86efac; font-weight: 700; }
.ait-ask { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ait-qs { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .4rem; }
.ait-q { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; text-align: left; }
.ait-q.ait-best { border-color: #4ade80; }
.ait-gain { position: relative; display: block; width: 100%; height: 1.1rem; border-radius: .3rem; background: rgba(148, 163, 184, .15); font-size: .75rem; line-height: 1.1rem; padding-left: .35rem; color: #e2e8f0; font-variant-numeric: tabular-nums; overflow: hidden; isolation: isolate; }
.ait-gain i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(74, 222, 128, .35); z-index: -1; }
html[data-theme="light"] .bl .ait-q.ait-best { border-color: #4ade80; }
/* ai-path: the exam-style table of distances (Dijkstra / A*) */
.aip-table { overflow-x: auto; }
.aip-table table { border-collapse: collapse; width: 100%; font-size: .88rem; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.aip-table th, .aip-table td { border: 1px solid rgba(148, 163, 184, .28); padding: .25rem .45rem; text-align: center; }
.aip-table thead th { color: #e2e8f0; font-weight: 700; background: rgba(148, 163, 184, .1); white-space: nowrap; }
.aip-table tbody th { color: #f1f5f9; }
.aip-table tr.aip-done td, .aip-table tr.aip-done th { background: rgba(22, 101, 52, .35); }
.aip-table tr.aip-next td, .aip-table tr.aip-next th { background: rgba(253, 224, 71, .14); }
/* ai-words: quiz buttons, the training text and adding sentences */
.aiw-panel { display: flex; flex-direction: column; gap: .45rem; color: #e2e8f0; font-size: .92rem; }
.aiw-panel p { margin: 0; }
.aiw-panel b { color: #f1f5f9; }
.aiw-opts { display: flex; flex-wrap: wrap; gap: .4rem; }
.aiw-h { font-weight: 700; color: #e2e8f0; }
.aiw-h span { font-weight: 500; color: #e2e8f0; font-size: .82rem; }
.aiw-text-ro { line-height: 1.6; color: #e2e8f0; }
.aiw-text-ro mark { background: rgba(74, 222, 128, .18); color: #dcfce7; border-radius: .3rem; padding: .05rem .3rem; white-space: nowrap; }
.aiw-text-ro mark button { margin-left: .3rem; border: 0; background: none; color: #fca5a5; font-weight: 800; cursor: pointer; padding: 0 .15rem; }
.aiw-text { width: 100%; box-sizing: border-box; background: #0b1220; color: #e2e8f0; border: 1px solid rgba(148, 163, 184, .35); border-radius: .5rem; padding: .5rem .6rem; font: inherit; }
.aiw-add { display: flex; gap: .4rem; }
.aiw-add input { flex: 1; min-width: 0; background: #0b1220; color: #e2e8f0; border: 1px solid rgba(148, 163, 184, .35); border-radius: .5rem; padding: .4rem .6rem; font: inherit; }
.aiw-left { color: #e2e8f0; font-size: .85rem; }
/* ai-expert: inference trace and rule editor */
.aix-panel { display: grid; gap: .5rem; margin-bottom: .6rem; }
.aix-h { font-weight: 700; color: #e2e8f0; margin: .2rem 0 0; }
.aix-h span { font-weight: 500; color: #e2e8f0; font-size: .85rem; }
.aix-trace { margin: 0; padding-left: 0; list-style: none; display: grid; gap: .3rem; }
.aix-trace li { border-radius: .5rem; padding: .35rem .6rem; background: rgba(148, 163, 184, .08); color: #e2e8f0; line-height: 1.45; }
.aix-trace li em { display: block; font-style: normal; font-size: .85rem; color: #e2e8f0; }
.aix-trace .aix-fire { background: rgba(74, 222, 128, .15); color: #dcfce7; }
.aix-trace .aix-fire em { color: #86efac; font-weight: 700; }
.aix-trace .aix-no em { color: #fca5a5; }
.aix-trace .aix-skip { opacity: .55; }
.aix-ans { margin: 0; color: #e2e8f0; }
.aix-ans .ai-good { color: #4ade80; font-weight: 700; }
.aix-ans .ai-bad { color: #f87171; font-weight: 700; }
.aix-rules { display: grid; gap: .4rem; }
.aix-rule { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .4rem .5rem; border-radius: .5rem; background: rgba(148, 163, 184, .08); color: #e2e8f0; font-weight: 700; font-size: .85rem; }
.aix-rule select { background: #0b1220; color: #e2e8f0; border: 1px solid rgba(148, 163, 184, .35); border-radius: .4rem; padding: .25rem .35rem; font: inherit; font-weight: 500; max-width: 100%; }
.aix-n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #312e81; color: #e0e7ff; }
.aix-btns { margin-left: auto; display: flex; gap: .25rem; }
.aix-btns .bl-btn { padding: .2rem .55rem; }
.aix-chat { display: flex; flex-wrap: wrap; gap: .3rem; }
.aix-q { padding: .25rem .55rem; border-radius: .8rem; background: rgba(129, 140, 248, .15); color: #e0e7ff; font-size: .9rem; }
.aix-q .aix-yes { color: #86efac; }
.aix-q .aix-no { color: #fca5a5; }
.aix-q.aix-end { background: rgba(253, 224, 71, .15); color: #fef9c3; font-weight: 700; }
/* ai-spam: inbox labelling and word counts */
.ais-panel { display: grid; gap: .45rem; margin-bottom: .6rem; }
.ais-h { font-weight: 700; color: #e2e8f0; margin: .2rem 0 0; }
.ais-inbox { display: grid; gap: .35rem; }
.ais-msg { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .35rem .55rem; border-radius: .5rem; background: rgba(148, 163, 184, .08); }
.ais-text { flex: 1 1 12rem; color: #e2e8f0; }
.ais-lab { display: flex; gap: .3rem; }
.ais-lab .bl-btn { padding: .25rem .6rem; }
.ais-lab .ais-on-spam { background: rgba(239, 68, 68, .3); border-color: #ef4444; color: #fee2e2; }
.ais-lab .ais-on-ham { background: rgba(34, 197, 94, .3); border-color: #22c55e; color: #dcfce7; }
.ais-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .4rem; }
.ais-counts > div { padding: .4rem .6rem; border-radius: .5rem; line-height: 1.5; color: #e2e8f0; }
.ais-counts span { color: #e2e8f0; font-size: .88rem; }
.ais-c-spam { background: rgba(239, 68, 68, .12); }
.ais-c-ham { background: rgba(34, 197, 94, .12); }
.ais-note { margin: 0; color: #e2e8f0; font-size: .85rem; }
/* ai-minimax: value pad and move buttons */
.aim-pad { display: grid; gap: .4rem; margin-bottom: .5rem; }
.aim-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.aim-lab { color: #e2e8f0; font-weight: 700; margin-right: .2rem; }
.aim-row .aim-on { background: rgba(253, 224, 71, .25); border-color: #fde047; color: #fef9c3; }
.aim-hint { margin: 0; color: #e2e8f0; font-size: .9rem; }
/* ai-chat: rule editor (pattern → reply) and the say box */
.aic-panel { display: grid; gap: .5rem; margin-bottom: .6rem; }
.aic-panel p { margin: 0; }
.aic-rules { display: grid; gap: .45rem; }
.aic-rule { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: .5rem; align-items: end; padding: .5rem .6rem; border-radius: .6rem; background: rgba(148, 163, 184, .08); }
.aic-rule label { display: grid; gap: .15rem; font-size: .78rem; color: #e2e8f0; font-weight: 600; }
.aic-rule input, .aic-say input { width: 100%; min-width: 0; box-sizing: border-box; padding: .45rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .35); background: #0f172a; color: #f1f5f9; font: inherit; font-size: .95rem; }
.aic-rule input:focus, .aic-say input:focus { outline: 2px solid #fde047; outline-offset: 1px; }
.aic-say { display: flex; gap: .5rem; }
.aic-log { display: grid; gap: .3rem; }
.aic-log .aic-you { justify-self: end; background: #2563eb; color: #fff; padding: .35rem .7rem; border-radius: .8rem; max-width: 85%; }
.aic-log .aic-bot { justify-self: start; background: #1e293b; color: #e2e8f0; padding: .35rem .7rem; border-radius: .8rem; max-width: 85%; }
.aic-log em { font-style: normal; font-size: .8rem; color: #e2e8f0; }
@media (max-width: 600px) { .aic-rule { grid-template-columns: auto 1fr; } .aic-rule label { grid-column: 2; } .aic-rule .aix-btns { grid-column: 2; } }
html[data-theme="light"] .aic-rule input, html[data-theme="light"] .aic-say input { background: #fff; color: #0f172a; border-color: #cbd5e1; }
/* ai-mood: word scores */
.aimo-panel { display: grid; gap: .45rem; margin-bottom: .6rem; }
.aimo-panel p { margin: 0; }
.aimo-words { display: flex; flex-wrap: wrap; gap: .4rem; }
.aimo-w { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .4rem; border-radius: .6rem; background: rgba(148, 163, 184, .12); color: #e2e8f0; font-weight: 600; }
.aimo-w b { min-width: 1.4rem; text-align: center; }
.aimo-w .bl-btn { padding: .1rem .5rem; }
.aimo-pos { background: rgba(74, 222, 128, .18); } .aimo-pos b { color: #86efac; }
.aimo-neg { background: rgba(248, 113, 113, .18); } .aimo-neg b { color: #fca5a5; }
.aimo-note { font-size: .85rem; color: #e2e8f0; line-height: 1.5; }
.aimo-stuck { color: #fca5a5; font-weight: 600; }
.aimo-own { display: grid; gap: .35rem; margin: 0 0 .7rem; }
.aimo-own label { display: grid; gap: .3rem; }
.aimo-own input { width: 100%; padding: .5rem .65rem; border-radius: .55rem; border: 1px solid rgba(148, 163, 184, .35); background: rgba(15, 23, 42, .8); color: #e2e8f0; font: inherit; }
.aimo-ownout { margin: 0; color: #e2e8f0; line-height: 1.6; }
.aimo-ownout em { color: #e2e8f0; font-size: .85rem; }
.aimo-done { color: #86efac; font-weight: 600; }
/* ai-nim: your-turn buttons */
.ain-take { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; font-weight: 700; color: #fde68a; }
.ain-take[hidden] { display: none; }
.ain-take .cl-btn { min-width: 3rem; padding: .45rem .9rem; font-size: 1.05rem; font-weight: 800; color: #0f172a; background: #fde047; border: 0; border-radius: 10px; cursor: pointer; }
.ain-take .cl-btn:disabled { opacity: .35; }
/* "In the exam" under a bench lab (bench_lab.html, lab YAML `exam:`): past-paper questions, open, with the points that gain marks */
/* "In the exam" (bench_lab.html): a past-paper question per card, its mark points as green ticks, what to
   try in the lab, and the printed question (with its figures) as a picture beside it. Text stays near-white
   on the dark card: never grey on dark blue (owner). */
.bx-exam { margin: 2.25rem 0 1.75rem; display: grid; gap: 1rem; }
.bx-exam-head { display: flex; align-items: center; gap: .85rem; }
.bx-exam-head .bx-h2 { margin: 0; font-size: 1.45rem; }
.bx-exam-head p { margin: .15rem 0 0; color: #e2e8f0; font-size: 1rem; }
.bx-exam-ico { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 28%; color: #422006;
  background: linear-gradient(140deg, #fde047, #f59e0b); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 16px rgba(245, 158, 11, .25); }
.bx-exam-ico .lab-ic { width: 56%; height: 56%; stroke-width: 2.5; }
.bx-exq { display: grid; gap: 1.1rem 1.4rem; border: 1px solid rgba(250, 204, 21, .3); border-radius: 16px; padding: 1.15rem 1.3rem 1.2rem;
  background: linear-gradient(160deg, rgba(30, 41, 59, .92), rgba(15, 23, 42, .92)); color: #f1f5f9; font-size: 1.05rem; line-height: 1.6;
  box-shadow: 0 10px 28px rgba(2, 6, 23, .35); }
.bx-exq--fig { grid-template-columns: minmax(0, 1fr) minmax(15rem, 22rem); }
.bx-exq p { margin: 0; }
.bx-exq-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .55rem !important; }
.bx-exq-src { font-size: .9rem; font-weight: 700; color: #fde68a; }
.bx-exq-marks { font-size: .82rem; font-weight: 800; color: #1c1917; background: #facc15; border-radius: 999px; padding: .1rem .6rem; }
.bx-exq-q { font-weight: 700; color: #fff; font-size: 1.1rem; }
.bx-exq-h { display: flex; align-items: center; gap: .4rem; margin: 1rem 0 .5rem; font-size: 1rem; font-weight: 800; color: #86efac; }
.bx-exq-pts { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; counter-reset: pt; }
.bx-exq-pts li { position: relative; padding: .5rem .75rem .5rem 2.6rem; border-radius: 10px; background: rgba(34, 197, 94, .1);
  border: 1px solid rgba(74, 222, 128, .22); color: #f1f5f9; counter-increment: pt; }
.bx-exq-pts li::before { content: counter(pt); position: absolute; left: .6rem; top: .55rem; width: 1.45rem; height: 1.45rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #052e16; background: #4ade80; }
.bx-exq-lab { display: flex; gap: .6rem; align-items: flex-start; margin-top: .85rem !important; padding: .65rem .8rem; border-radius: 10px;
  background: rgba(56, 189, 248, .12); border: 1px solid rgba(56, 189, 248, .3); color: #e0f2fe; }
.bx-ic { flex: none; width: 1.15em; height: 1.15em; stroke-width: 2.2; }
.bx-exq-lab > .bx-ic { margin-top: .2rem; color: #7dd3fc; }
html[data-theme="light"] .bx-exq-lab > .bx-ic { color: #0369a1; }
.bx-exq-lab b { color: #7dd3fc; }
.bx-exq .katex { font-size: 1.08em; }
.bx-exq-fig { align-self: start; display: flex; flex-direction: column; padding: 0; border: 1px solid rgba(148, 163, 184, .45); border-radius: 12px; overflow: hidden;
  background: #fff; cursor: zoom-in; font: inherit; transition: transform .15s, box-shadow .15s; }
.bx-exq-fig:hover, .bx-exq-fig:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(2, 6, 23, .5); }
.bx-exq-fig-win { position: relative; display: block; width: 100%; height: 12rem; overflow: hidden; background: #fff; }
.bx-exq-fig-win img { position: absolute; left: 50%; top: 0; width: 100%; height: auto; max-width: none; transform: translateX(-50%); }
.bx-exq-fig-cap { display: flex; align-items: center; gap: .4rem; padding: .5rem .75rem; font-size: .92rem; font-weight: 700; color: #fff; background: #0f172a; text-align: left; }
.bx-exq-paper { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .65rem; border-radius: 999px; cursor: zoom-in; font: 700 .82rem system-ui, sans-serif;
  color: #e0f2fe; background: rgba(56, 189, 248, .16); border: 1px solid rgba(56, 189, 248, .45); }
.bx-exq-paper:hover { background: rgba(56, 189, 248, .3); }
html[data-theme="light"] .bx-exq-paper { color: #075985; background: #e0f2fe; border-color: #7dd3fc; }
.bx-fig-dlg { padding: 0; border: 0; border-radius: 14px; max-width: min(56rem, 94vw); max-height: 92vh; background: #fff; overflow: auto; }
.bx-fig-dlg::backdrop { background: rgba(2, 6, 23, .78); }
.bx-fig-dlg img { display: block; width: 100%; height: auto; }
.bx-fig-dlg form { position: sticky; top: 0; height: 0; text-align: right; }
.bx-fig-x { margin: .6rem; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 0; background: #0f172a; color: #fff; font-size: 1.1rem; cursor: pointer; }
@media (max-width: 760px) {
  .bx-exq--fig { grid-template-columns: 1fr; }
  .bx-exq { padding: 1rem; font-size: 1rem; }
}
html[data-theme="light"] .bx-exq { background: #fff; color: #1e293b; border-color: #fcd34d; box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }
html[data-theme="light"] .bx-exam-head p { color: #334155; }
html[data-theme="light"] .bx-exq-q { color: #0f172a; }
html[data-theme="light"] .bx-exq-src { color: #92400e; }
html[data-theme="light"] .bx-exq-h { color: #15803d; }
html[data-theme="light"] .bx-exq-pts li { background: #f0fdf4; border-color: #bbf7d0; color: #1e293b; }
html[data-theme="light"] .bx-exq-pts li::before { background: #16a34a; color: #fff; }
html[data-theme="light"] .bx-exq-lab { background: #f0f9ff; border-color: #bae6fd; color: #0c4a6e; }
html[data-theme="light"] .bx-exq-lab b { color: #0369a1; }

/* ===== pointers: Pointer Lab (/code/labs/pointers, web/static/js/labs/pointers.js). The bench stays dark in both themes. ===== */
.pt-lab .bl-board-wrap, .pt-lab .bl-read, .pt-lab .bl-controls, .pt-lab .bl-data { display: none !important; }
.pt { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.pt h3 { margin: 0 0 .45rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.pt-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.pt-msg:empty { display: none; }
.pt-tabs { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.pt-tabs button { border-radius: 999px; border: 1px solid rgba(148, 163, 184, .35); background: rgba(15, 23, 42, .6); color: #e2e8f0; padding: .3rem .9rem; font-weight: 600; cursor: pointer; }
.pt-tabs button[aria-selected="true"] { background: rgba(192, 132, 252, .22); border-color: #c084fc; color: #f5f3ff; }
.pt-none { color: #e2e8f0; font-size: .85rem; }
.pt-dim { color: #e2e8f0; }
.pt-chips { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 2.2rem; align-items: flex-start; }
.pt-chip { display: inline-grid; place-items: center; min-width: 2.2rem; height: 2.2rem; padding: 0 .5rem; border-radius: .5rem; background: #1e293b; border: 1px solid rgba(148, 163, 184, .35); font-family: var(--mono); font-weight: 800; font-size: 1.05rem; color: #f8fafc; }
.pt-chip.is-next { border-color: #fde047; box-shadow: 0 0 0 2px rgba(253, 224, 71, .35); }
.pt-out .pt-chip { background: #052e1a; border-color: rgba(74, 222, 128, .5); color: #bbf7d0; }
.pt-wagon { border-radius: .45rem .45rem .7rem .7rem; background: linear-gradient(#b45309, #78350f); border-color: #f59e0b; color: #fff7ed; position: relative; margin-bottom: .35rem; }
.pt-wagon::before, .pt-wagon::after { content: ""; position: absolute; bottom: -.4rem; width: .5rem; height: .5rem; border-radius: 50%; background: #334155; border: 1px solid #94a3b8; }
.pt-wagon::before { left: .3rem; } .pt-wagon::after { right: .3rem; }
.pt-out .pt-wagon { background: linear-gradient(#15803d, #14532d); border-color: #4ade80; color: #f0fdf4; }
.pt-chip.is-flash { animation: pt-pop .45s ease-out; }
@keyframes pt-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.pt-ops { display: flex; flex-wrap: wrap; gap: .45rem; }
.pt-ops .bl-btn { font-family: var(--mono); font-weight: 800; letter-spacing: .02em; padding: .45rem 1rem; }
.pt-vars { margin: .5rem 0 0; font-size: .88rem; color: #e2e8f0; }
.pt-vars b { font-family: var(--mono); color: #fde047; font-size: 1rem; }

/* stack */
.pt-stack, .pt-queue { display: grid; gap: .7rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 620px) { .pt-stack { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; } }
.pt-slots { display: flex; flex-direction: column; gap: 3px; }
.pt-slot { display: grid; grid-template-columns: 2rem 4.2rem minmax(0, 1fr); align-items: center; gap: .5rem; min-height: 2.15rem; }
.pt-idx { font-family: var(--mono); font-size: .8rem; color: #e2e8f0; text-align: right; }
.pt-slot .pt-val { display: grid; place-items: center; height: 2.05rem; border-radius: .4rem; border: 1px dashed rgba(148, 163, 184, .3); font-family: var(--mono); font-weight: 800; font-size: 1.05rem; color: #f8fafc; }
.pt-slot.is-full .pt-val { border: 1px solid rgba(192, 132, 252, .55); background: rgba(168, 85, 247, .18); }
.pt-slot.is-flash .pt-val { animation: pt-drop .45s ease-out; }
@keyframes pt-drop { 0% { transform: translateY(-1.2rem); opacity: .2; } 100% { transform: none; opacity: 1; } }
.pt-marks { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pt-ptr { font-size: .8rem; font-weight: 700; white-space: nowrap; }
.pt-ptr.is-top { color: #fde047; } .pt-ptr.is-bot { color: #e2e8f0; }

/* queue */
.pt-qrow { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .3rem; }
.pt-qcell { display: grid; grid-template-rows: 1.2rem 2.4rem 1rem 1.2rem; justify-items: center; align-items: center; min-width: 0; }
.pt-qcell .pt-val { width: 100%; height: 100%; display: grid; place-items: center; border-radius: .45rem; border: 1px dashed rgba(148, 163, 184, .3); font-family: var(--mono); font-weight: 800; font-size: 1.05rem; color: #f8fafc; }
.pt-qcell.is-full .pt-val { border: 1px solid rgba(56, 189, 248, .55); background: rgba(56, 189, 248, .16); }
.pt-qcell.is-flash .pt-val { animation: pt-pop .45s ease-out; }
.pt-qh { font-size: .75rem; font-weight: 800; color: #fde047; white-space: nowrap; }
.pt-qt { font-size: .75rem; font-weight: 800; color: #f472b6; white-space: nowrap; }
.pt-wrap { margin: .1rem .8rem 0; height: .9rem; border: 2px dashed rgba(148, 163, 184, .45); border-top: 0; border-radius: 0 0 .8rem .8rem; position: relative; }
.pt-wrap span { position: absolute; left: 50%; top: .55rem; transform: translateX(-50%); background: #0b1220; padding: 0 .4rem; font-size: .75rem; color: #e2e8f0; white-space: nowrap; }
.pt-ring .pt-vars { margin-top: 1.1rem; }

/* linked list */
.pt-list { display: grid; gap: .7rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 640px) { .pt-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.pt-varsrow { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.pt-var { display: inline-flex; align-items: center; gap: .45rem; border-radius: .5rem; border: 1px solid rgba(253, 224, 71, .45); background: rgba(253, 224, 71, .08); color: #fef9c3; padding: .25rem .6rem; font-size: .85rem; cursor: pointer; }
.pt-var b { font-family: var(--mono); font-size: 1.05rem; color: #fde047; }
.pt-var:disabled { cursor: default; opacity: .85; }
.pt-var.is-sel, .pt-cell.is-sel { outline: 2px solid #fde047; outline-offset: 1px; }
.pt-tab { border-collapse: collapse; width: 100%; font-size: .9rem; }
.pt-tab th, .pt-tab td { padding: .18rem .35rem; border-bottom: 1px solid rgba(148, 163, 184, .12); text-align: center; }
.pt-tab thead th { color: #e2e8f0; font-size: .78rem; font-weight: 700; }
.pt-tab tbody th { font-family: var(--mono); color: #e2e8f0; font-weight: 600; width: 3rem; }
.pt-cell { width: 100%; min-height: 2rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .3); background: #111b2e; color: #f1f5f9; font-family: var(--mono); font-weight: 700; font-size: .95rem; cursor: pointer; }
.pt-cell:hover:not(:disabled) { border-color: #c084fc; }
.pt-cell:disabled { cursor: default; }
.pt-num { color: #fde047; }
.pt-role { font-size: .75rem; color: #e2e8f0; white-space: nowrap; width: 5.5rem; text-align: left !important; }
.pt-r.is-list .pt-role { color: #86efac; } .pt-r.is-free .pt-role { color: #e2e8f0; } .pt-r.is-lost .pt-role { color: #fca5a5; font-weight: 700; }
.pt-r.is-list .pt-data { border-color: rgba(74, 222, 128, .5); background: rgba(22, 163, 74, .14); }
.pt-r.is-crossed .pt-data { text-decoration: line-through; color: #e2e8f0; }
.pt-r.is-crossed .pt-role { color: #f87171; }
.pt-r.is-flash .pt-cell { animation: pt-pop .45s ease-out; }
.pt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pt-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .55rem; padding: .45rem; border-radius: .55rem; background: rgba(253, 224, 71, .08); border: 1px solid rgba(253, 224, 71, .35); }
.pt-pick > span { font-family: var(--mono); font-weight: 800; color: #fde047; margin-right: .2rem; }
.pt-pick .bl-btn { font-family: var(--mono); font-weight: 700; min-width: 2.3rem; padding: .25rem .55rem; }
.pt-pick .pt-cancel { font-family: inherit; font-weight: 500; }
.pt-hint { margin: .45rem 0 0; font-size: .8rem; color: #e2e8f0; }
.pt-chain { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .3rem; margin-bottom: .7rem; }
.pt-start { font-family: var(--mono); font-size: .85rem; font-weight: 800; color: #fde047; }
.pt-node { display: inline-grid; grid-template-columns: auto auto; grid-template-rows: auto auto; border-radius: .45rem; overflow: hidden; border: 1px solid rgba(74, 222, 128, .55); font-family: var(--mono); }
.pt-node small { grid-column: 1 / -1; font-size: .72rem; color: #e2e8f0; padding: 0 .35rem; background: rgba(2, 6, 23, .4); }
.pt-node b { padding: .15rem .45rem; color: #f0fdf4; background: rgba(22, 163, 74, .2); }
.pt-node i { font-style: normal; padding: .15rem .4rem; color: #fde047; background: rgba(2, 6, 23, .5); border-left: 1px solid rgba(148, 163, 184, .3); }
.pt-freechain .pt-node { border-color: rgba(148, 163, 184, .45); }
.pt-freechain .pt-node b { background: rgba(148, 163, 184, .12); color: #e2e8f0; }
.pt-node.is-flash { animation: pt-pop .45s ease-out; }
.pt-arrow { color: #e2e8f0; font-weight: 800; }
.pt-null { font-family: var(--mono); font-size: .8rem; color: #e2e8f0; border: 1px dashed rgba(148, 163, 184, .4); border-radius: .4rem; padding: .1rem .35rem; }
.pt-bad { font-size: .82rem; font-weight: 700; color: #fecaca; background: rgba(239, 68, 68, .18); border-radius: .4rem; padding: .1rem .4rem; }

/* steps and answers */
.pt-rule ol { margin: 0; padding-left: 1.3rem; display: grid; gap: .15rem; font-family: var(--mono); font-size: .88rem; color: #e2e8f0; }
.pt-rule li.pt-dim { list-style: none; margin-left: -1.3rem; font-family: system-ui, sans-serif; }
.pt-qs { display: grid; gap: .5rem; }
.pt-qs h3 { margin: 0; }
.pt-q { display: grid; gap: .25rem; font-size: .9rem; color: #e2e8f0; }
.pt-q input { padding: .35rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; }
.pt-q.is-ok input { border-color: #4ade80; } .pt-q.is-bad input { border-color: #f87171; }
.pt-qs .bl-btn { justify-self: start; }
@media (prefers-reduced-motion: reduce) { .pt-chip.is-flash, .pt-slot.is-flash .pt-val, .pt-qcell.is-flash .pt-val, .pt-r.is-flash .pt-cell, .pt-node.is-flash { animation: none; } }
/* pointers: the site's light theme recolours every border (html[data-theme=light] *); the bench stays dark, so restore ours. */
html[data-theme="light"] .pt .pt-panel, html[data-theme="light"] .pt .pt-cell, html[data-theme="light"] .pt .pt-chip, html[data-theme="light"] .pt .pt-tabs button, html[data-theme="light"] .pt .pt-q input { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .pt .pt-tab th, html[data-theme="light"] .pt .pt-tab td { border-color: rgba(148, 163, 184, .12); }
html[data-theme="light"] .pt .pt-tabs button[aria-selected="true"] { border-color: #c084fc; }
html[data-theme="light"] .pt .pt-chip.is-next { border-color: #fde047; }
html[data-theme="light"] .pt .pt-out .pt-chip { border-color: rgba(74, 222, 128, .5); }
html[data-theme="light"] .pt .pt-wagon { border-color: #f59e0b; } html[data-theme="light"] .pt .pt-out .pt-wagon { border-color: #4ade80; }
html[data-theme="light"] .pt .pt-wagon::before, html[data-theme="light"] .pt .pt-wagon::after { border-color: #94a3b8; }
html[data-theme="light"] .pt .pt-slot .pt-val, html[data-theme="light"] .pt .pt-qcell .pt-val { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .pt .pt-slot.is-full .pt-val { border-color: rgba(192, 132, 252, .55); }
html[data-theme="light"] .pt .pt-qcell.is-full .pt-val { border-color: rgba(56, 189, 248, .55); }
html[data-theme="light"] .pt .pt-wrap { border-color: rgba(148, 163, 184, .45); }
html[data-theme="light"] .pt .pt-var { border-color: rgba(253, 224, 71, .45); }
html[data-theme="light"] .pt .pt-pick { border-color: rgba(253, 224, 71, .35); }
html[data-theme="light"] .pt .pt-cell:hover:not(:disabled) { border-color: #c084fc; }
html[data-theme="light"] .pt .pt-r.is-list .pt-data { border-color: rgba(74, 222, 128, .5); }
html[data-theme="light"] .pt .pt-node { border-color: rgba(74, 222, 128, .55); } html[data-theme="light"] .pt .pt-freechain .pt-node { border-color: rgba(148, 163, 184, .45); }
html[data-theme="light"] .pt .pt-node i { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .pt .pt-null { border-color: rgba(148, 163, 184, .4); }
html[data-theme="light"] .pt .pt-q.is-ok input { border-color: #4ade80; } html[data-theme="light"] .pt .pt-q.is-bad input { border-color: #f87171; }
/* pointers: binary tree view */
.pt-treegrid { display: grid; gap: .7rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 700px) { .pt-treegrid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; } }
.pt-tree { position: relative; margin: .3rem .4rem 0; }
.pt-tree canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pt-tn { position: absolute; transform: translateX(-50%); display: grid; justify-items: center; min-width: 2.6rem; max-width: 5.4rem; padding: .1rem .35rem .2rem; border-radius: .55rem; border: 1px solid rgba(74, 222, 128, .6); background: #0f2a1d; font-family: var(--mono); z-index: 1; }
.pt-tn small { font-size: .7rem; color: #e2e8f0; line-height: 1.1; }
.pt-tn b { font-size: .9rem; color: #f0fdf4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pt-tn.is-at { border-color: #fde047; box-shadow: 0 0 0 3px rgba(253, 224, 71, .35); }
.pt-tn.is-done { background: #312e81; border-color: #a5b4fc; }
.pt-tn.is-cur { box-shadow: 0 0 0 3px rgba(165, 180, 252, .6); transform: translateX(-50%) scale(1.08); }
.pt-tn.is-flash { animation: pt-tn-pop .45s ease-out; }
@keyframes pt-tn-pop { 0% { transform: translateX(-50%) scale(.5); } 100% { transform: translateX(-50%) scale(1); } }
.pt-newnode { margin: 0 0 .4rem; font-size: .9rem; color: #fef9c3; background: rgba(253, 224, 71, .08); border: 1px solid rgba(253, 224, 71, .35); border-radius: .5rem; padding: .35rem .55rem; }
.pt-newnode b { font-family: var(--mono); color: #fde047; }
.pt-trav { margin-top: .6rem; font-size: .88rem; color: #e2e8f0; }
.pt-trav > b { color: #c7d2fe; }
.pt-trav .pt-chips { margin-top: .35rem; }
.pt-trav .pt-chip { background: #312e81; border-color: #a5b4fc; height: 2rem; font-size: .92rem; }
.pt-tin { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .85rem; color: #e2e8f0; margin-right: .3rem; }
.pt-tin .pt-chip { height: 2rem; font-size: .9rem; }
.pt-lh { color: #7dd3fc !important; } .pt-rh { color: #f9a8d4 !important; }
.pt-static { display: grid; place-items: center; cursor: default; }
.pt-treebox .pt-bad { display: inline-block; margin-top: .5rem; }
@media (prefers-reduced-motion: reduce) { .pt-tn.is-flash { animation: none; } .pt-tn.is-cur { transform: translateX(-50%); } }
html[data-theme="light"] .pt .pt-tn { border-color: rgba(74, 222, 128, .6); }
html[data-theme="light"] .pt .pt-tn.is-at { border-color: #fde047; }
html[data-theme="light"] .pt .pt-tn.is-done, html[data-theme="light"] .pt .pt-trav .pt-chip { border-color: #a5b4fc; }
html[data-theme="light"] .pt .pt-newnode { border-color: rgba(253, 224, 71, .35); }
.pt-travops .bl-btn { font-family: inherit; font-weight: 600; letter-spacing: 0; }
.pt-ops .bl-btn:disabled { opacity: .45; }
.pt-ttab .pt-role { width: 2.6rem; }
.pt-ttab th, .pt-ttab td { padding: .18rem .2rem; }
.pt-ttab tbody th { width: 2rem; }
.pt-ttab .pt-data { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 .2rem; }
.pt-tn { width: max-content; }
/* cpu: narrow trace tables (phones) keep every column in view */
@container (max-width: 420px) { .cpu-tt th, .cpu-tt td { padding: .22rem .3rem; } }

/* ===== sorting: Sort and Search (/code/labs/sorting, web/static/js/labs/sorting.js). The bench stays dark in both themes; tabs reuse .pt-tabs. ===== */
.so-lab .bl-board-wrap, .so-lab .bl-read, .so-lab .bl-controls, .so-lab .bl-data { display: none !important; }
.so { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.so h3 { margin: 0 0 .45rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.so-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.so-msg:empty { display: none; }
.so-free { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.so-freebtns { display: flex; flex-wrap: wrap; gap: .35rem; }
.so-arrhead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem; }
.so-item { font-size: .88rem; color: #e2e8f0; border: 1px solid rgba(253, 224, 71, .45); background: rgba(253, 224, 71, .08); border-radius: .5rem; padding: .2rem .55rem; }
.so-item b { font-family: var(--mono); color: #fde047; font-size: 1.05rem; margin-left: .25rem; }
.so-arr { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .3rem; margin-top: .3rem; }
.so-col { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.so-card { display: grid; grid-template-rows: auto auto auto; justify-items: center; gap: .15rem; padding: .3rem .1rem .25rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .3); background: #111b2e; color: #f8fafc; font: inherit; min-width: 0; transition: background .2s, border-color .2s, opacity .2s; }
button.so-card { cursor: pointer; border-color: rgba(253, 224, 71, .55); }
button.so-card:hover { background: #1e2a44; }
.so-barbox { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 4.5rem; }
.so-bar { width: 62%; max-width: 1.6rem; border-radius: .25rem .25rem 0 0; background: linear-gradient(#fb923c, #c2410c); transition: height .3s; }
.so-v { font-family: var(--mono); font-weight: 800; font-size: 1.02rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-i { font-family: var(--mono); font-size: .72rem; color: #e2e8f0; }
.so-card.is-cmp { border-color: #fde047; box-shadow: 0 0 0 2px rgba(253, 224, 71, .4); background: #2a2610; }
.so-card.is-final { border-color: rgba(74, 222, 128, .6); background: #0f2a1d; }
.so-card.is-final .so-bar { background: linear-gradient(#4ade80, #15803d); }
.so-card.is-sorted { border-color: rgba(56, 189, 248, .5); }
.so-card.is-sorted .so-bar { background: linear-gradient(#38bdf8, #0369a1); }
.so-card.is-hole { border-style: dashed; background: transparent; }
.so-card.is-seen, .so-card.is-out { opacity: .38; }
.so-card.is-found { border-color: #4ade80; background: #14532d; box-shadow: 0 0 0 3px rgba(74, 222, 128, .45); }
.so-card.is-flash { animation: so-pop .4s ease-out; }
@keyframes so-pop { 0% { transform: translateY(-.5rem); } 100% { transform: none; } }
.so-mks { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 1.1rem; margin-top: .2rem; }
.so-mk { font-size: .74rem; font-weight: 800; white-space: nowrap; line-height: 1.15; }
.so-mk.is-a { color: #fde047; } .so-mk.is-b { color: #7dd3fc; }
.so-sh { display: none; }
.so-arr.is-many .so-lg { display: none; } .so-arr.is-many .so-sh { display: inline; }
@container (max-width: 520px) { .so-arr .so-lg { display: none; } .so-arr .so-sh { display: inline; } .so-arr.is-many .so-v { font-size: .8rem; } .so-arr.is-many .so-i { font-size: .72rem; } .so-arr.is-many { gap: .15rem; } .so-barbox { height: 3.2rem; } .so-arr.is-words .so-v { font-size: .82rem; } }
.so-legend { margin: .35rem 0 0; font-size: .78rem; color: #e2e8f0; }
@container (max-width: 520px) { .so-legend.so-legend { display: block; } }
.so-acts { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-top: .7rem; }
.so-acts .bl-btn { font-weight: 700; }
.so-acts .bl-btn:disabled { opacity: .45; }
.so-ask { font-size: .9rem; color: #fde047; font-weight: 700; }
.so-done { margin: 0; font-weight: 700; color: #86efac; }
.so-two { display: grid; gap: .7rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 660px) { .so-two { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; } }
.so-code ol { margin: 0; padding: 0; list-style: none; counter-reset: so; overflow-x: auto; }
.so-code li { counter-increment: so; display: flex; gap: .5rem; padding: .05rem .3rem; border-radius: .3rem; font-size: .84rem; white-space: nowrap; }
.so-code li::before { content: counter(so); font-family: var(--mono); font-size: .74rem; color: #e2e8f0; min-width: 1.2rem; text-align: right; padding-top: .1rem; }
.so-code code { font-family: var(--mono); color: #e2e8f0; }
.so-code li.is-now { background: rgba(253, 224, 71, .16); box-shadow: inset 3px 0 0 #fde047; }
.so-code li.is-now code { color: #fef9c3; }
.so-vars dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); gap: .3rem; }
.so-vars dl > div { border: 1px solid rgba(148, 163, 184, .22); border-radius: .45rem; padding: .2rem .45rem; background: #0e182b; }
.so-vars dt { font-size: .74rem; color: #e2e8f0; }
.so-vars dd { margin: 0; font-family: var(--mono); font-weight: 800; color: #fde047; font-size: 1rem; }
.so-h3b { margin-top: .7rem !important; }
.so-steps ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .15rem; font-size: .88rem; }
.so-steps code { font-family: var(--mono); color: #e2e8f0; }
.so-why { color: #fef9c3; list-style: none; margin-left: -1.1rem; margin-bottom: .2rem; }
.so-dim { color: #e2e8f0; list-style: none; margin-left: -1.1rem; }
@media (prefers-reduced-motion: reduce) { .so-card.is-flash { animation: none; } .so-bar { transition: none; } }
html[data-theme="light"] .so .so-panel, html[data-theme="light"] .so .so-card, html[data-theme="light"] .so .pt-tabs button { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .so .so-vars dl > div { border-color: rgba(148, 163, 184, .22); }
html[data-theme="light"] .so button.so-card, html[data-theme="light"] .so .so-card.is-cmp { border-color: #fde047; }
html[data-theme="light"] .so .so-card.is-final { border-color: rgba(74, 222, 128, .6); } html[data-theme="light"] .so .so-card.is-sorted { border-color: rgba(56, 189, 248, .5); }
html[data-theme="light"] .so .so-card.is-found { border-color: #4ade80; }
html[data-theme="light"] .so .so-item { border-color: rgba(253, 224, 71, .45); }
html[data-theme="light"] .so .pt-tabs button[aria-selected="true"] { border-color: #c084fc; }
.so-code li { white-space: normal; }
.so-code code { display: block; white-space: pre-wrap; text-indent: -2ch; margin-left: 2ch; }
@container (max-width: 520px) { .so-arr.is-many .so-card { padding-left: 0; padding-right: 0; } .so-arr.is-many .so-v { font-size: .74rem; } .so-arr.is-many .so-i { font-size: .72rem; } .so-code li { font-size: .78rem; } }

/* ===== bits: Bits and Bytes (/code/labs/bits, web/static/js/labs/bits.js). The bench stays dark in both themes. ===== */
.by-lab .bl-board-wrap, .by-lab .bl-read, .by-lab .bl-controls, .by-lab .bl-data { display: none !important; }
.by { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.by h3 { margin: 0 0 .55rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.by-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.by-msg:empty { display: none; }
.by-row { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) 3.4rem; align-items: center; gap: .4rem; }
.by-main > .by-row:not(.by-plain) { grid-template-columns: minmax(0, 1fr); max-width: 40rem; margin: 0 auto; }
.by-rl { font-family: var(--mono); font-weight: 800; color: #e2e8f0; text-align: right; font-size: .95rem; }
.by-rr { font-family: var(--mono); font-weight: 800; color: #fde047; font-size: 1rem; }
.by-bits { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .3rem; }
.by-bit { display: grid; justify-items: center; gap: .25rem; padding: .35rem .1rem .4rem; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .3); background: #111b2e; color: #f8fafc; font: inherit; min-width: 0; }
button.by-bit { cursor: pointer; }
button.by-bit:hover { border-color: #fde047; }
.by-bit.is-gap, .by-d.is-gap { margin-right: .35rem; }
.by-pv { font-family: var(--mono); font-size: .78rem; font-weight: 700; color: #e2e8f0; white-space: nowrap; }
.by-bit.is-on .by-pv { color: #fde047; }
.by-sw { position: relative; width: 1.5rem; height: 2.5rem; border-radius: .75rem; background: #1e293b; border: 1px solid #475569; }
.by-sw i { position: absolute; left: .15rem; right: .15rem; height: 1.1rem; bottom: .15rem; border-radius: .55rem; background: #64748b; transition: bottom .15s, background .15s; }
.by-bit.is-on .by-sw { background: #3f3a12; border-color: #ca8a04; }
.by-bit.is-on .by-sw i { bottom: 1.2rem; background: #fde047; box-shadow: 0 0 10px rgba(253, 224, 71, .7); }
.by-bit b { font-family: var(--mono); font-size: 1.2rem; }
.by-bit.is-fixed { opacity: .85; }
.by-bit.is-flash .by-sw i { animation: by-pulse .35s ease-out; }
@keyframes by-pulse { 0% { transform: scale(1.25); } 100% { transform: none; } }
.by-sum { display: grid; gap: .3rem; }
.by-plain .by-d { display: grid; place-items: center; font-family: var(--mono); font-weight: 800; font-size: 1.15rem; height: 1.9rem; color: #e2e8f0; }
.by-carry .by-d { color: #f472b6; font-size: .9rem; height: 1.2rem; }
.by-plain.is-over .by-d, .by-plain.is-over .by-rr { color: #fca5a5; }
.by-sum .by-row.is-edit { border-top: 2px solid rgba(148, 163, 184, .5); padding-top: .35rem; }
.by-carrybtn { margin-top: .5rem; }
.by-ovl { margin: .55rem 0 0; font-size: .92rem; color: #e2e8f0; }
.by-ovl b { font-family: var(--mono); color: #fde047; }
.by-ovl.is-over { color: #fecaca; } .by-ovl.is-over b { color: #fca5a5; }
.by-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .7rem; }
.by-tools .bl-btn { font-weight: 700; }
.by-press { font-size: .85rem; color: #e2e8f0; margin-left: .3rem; } .by-press b { color: #fde047; font-family: var(--mono); }
.by-mode { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .6rem; font-size: .85rem; color: #e2e8f0; }
.by-mode .bl-btn[aria-pressed="true"] { border-color: #fde047; color: #fef9c3; background: rgba(253, 224, 71, .12); }
.by-hint { margin: .5rem 0 0; font-size: .8rem; color: #e2e8f0; }
.by-float.is-read .by-bit:disabled { cursor: default; opacity: 1; }
.by-ans { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: .7rem 0 .2rem; font-weight: 700; font-size: .92rem; color: #f1f5f9; }
.by-ans input { width: 8rem; font: inherit; font-size: 1rem; font-family: ui-monospace, Menlo, Consolas, monospace; padding: .35rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .5); background: #111a2e; color: #f8fafc; }
.by-ans input:focus { outline: 2px solid #fde047; outline-offset: 1px; }
.by-read { margin: 0; display: grid; gap: .45rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 620px) { .by-read { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.by-read > div { border: 1px solid rgba(148, 163, 184, .22); border-radius: .55rem; padding: .35rem .6rem .45rem; background: #0e182b; min-width: 0; }
.by-read dt { font-size: .8rem; color: #e2e8f0; }
.by-read dd { margin: 0; font-family: var(--mono); font-weight: 800; font-size: 1.45rem; color: #fde047; }
.by-read p { margin: .1rem 0 0; font-family: var(--mono); font-size: .8rem; color: #e2e8f0; overflow-wrap: anywhere; }
.by-last { margin: .55rem 0 0; font-family: var(--mono); font-size: .82rem; color: #c7d2fe; white-space: pre-wrap; overflow-wrap: anywhere; }
@container (max-width: 460px) { .by-pv { font-size: .72rem; } .by-bits { gap: .2rem; } .by-bit.is-gap, .by-d.is-gap { margin-right: .2rem; } .by-row { grid-template-columns: 1.8rem minmax(0, 1fr) 2.6rem; gap: .25rem; } .by-rr { font-size: .85rem; } .by-bit b { font-size: 1.05rem; } }
@media (prefers-reduced-motion: reduce) { .by-sw i { transition: none; } .by-bit.is-flash .by-sw i { animation: none; } }
html[data-theme="light"] .by .by-panel, html[data-theme="light"] .by .by-bit { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .by .by-sw { border-color: #475569; } html[data-theme="light"] .by .by-bit.is-on .by-sw { border-color: #ca8a04; }
html[data-theme="light"] .by .by-read > div { border-color: rgba(148, 163, 184, .22); }
html[data-theme="light"] .by .by-sum .by-row.is-edit { border-color: rgba(148, 163, 184, .5); }
html[data-theme="light"] .by .by-mode .bl-btn[aria-pressed="true"] { border-color: #fde047; }
html[data-theme="light"] .by button.by-bit:hover { border-color: #fde047; }
@container (max-width: 460px) {
  .by-row:not(.by-main > .by-row) { grid-template-columns: 2.4rem minmax(0, 1fr); column-gap: .25rem; row-gap: 0; }
  .by-row .by-rl { grid-column: 1; grid-row: 1; align-self: end; }
  .by-row .by-rr { grid-column: 1; grid-row: 2; text-align: right; align-self: start; font-size: .8rem; }
  .by-row .by-bits { grid-column: 2; grid-row: 1 / span 2; }
  .by-bit { padding-left: 0; padding-right: 0; }
  .by-pv { letter-spacing: -.04em; }
}
/* sorting: hash tables */
.so-empty { font-family: system-ui, sans-serif; font-weight: 500; font-size: .72rem; color: #e2e8f0; }
.so-card.is-empty { border-style: dashed; background: transparent; }
.so-next { font-size: .82rem; color: #e2e8f0; }
.so-arrhead > div { display: flex; flex-wrap: wrap; gap: .35rem; }
/* bits: floating point */
.by-float { display: grid; gap: .6rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 640px) { .by-float { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.by-frow h4 { margin: 0 0 .3rem; font-size: .82rem; font-weight: 700; color: #e2e8f0; }
.by-frow.is-long .by-pv { font-size: .7rem; letter-spacing: -.04em; white-space: nowrap; }
.by-frow.is-long .by-bits { gap: 2px; }
.by-frow.is-long .by-bit { padding-left: 0; padding-right: 0; min-width: 0; }
.by-bit.is-point { position: relative; margin-right: .45rem; }
.by-bit.is-point::after { content: ""; position: absolute; right: -.4rem; bottom: .5rem; width: .3rem; height: .3rem; border-radius: 50%; background: #fde047; }
.by-pv sup, .by-pv sub { font-size: .72rem; line-height: 0; } .by-pv sub { letter-spacing: -.04em; }
.by-fread { margin-top: .7rem; }
.by-fread > div.is-ok dd { color: #86efac; } .by-fread > div.is-no dd { color: #fca5a5; }
html[data-theme="light"] .by .by-fread > div { border-color: rgba(148, 163, 184, .22); }
/* sorting: the race table when a run ends */
.so-acts:has(.so-race) { flex-direction: column; align-items: flex-start; }
.so-race { border-collapse: collapse; font-size: .88rem; margin-top: .2rem; }
.so-race caption { text-align: left; font-weight: 700; color: #e2e8f0; padding-bottom: .3rem; font-size: .85rem; }
.so-race th, .so-race td { padding: .2rem .7rem; border-bottom: 1px solid rgba(148, 163, 184, .18); text-align: left; }
.so-race thead th { font-size: .78rem; color: #e2e8f0; font-weight: 600; }
.so-race td { font-family: var(--mono); color: #fde047; font-weight: 700; }
.so-race tr.is-me th { color: #86efac; }
.so-race tr.is-me th::after { content: " (you)"; font-weight: 500; color: #e2e8f0; }
html[data-theme="light"] .so .so-race th, html[data-theme="light"] .so .so-race td { border-color: rgba(148, 163, 184, .18); }
/* cpu, pointers, sorting, bits: binary numbers, arrays, code and trees always read left to right, also on right-to-left pages */
.cpu .cpu-edit, .cpu .cpu-ed, .cpu .cpu-cells, .cpu .cpu-tracewrap, .cpu .cpu-bus,
.pt .pt-slots, .pt .pt-qrow, .pt .pt-tab, .pt .pt-chain, .pt .pt-tree, .pt .pt-rule ol, .pt .pt-pick,
.so .so-arr, .so .so-code, .so .so-steps ul, .so .so-race,
.by .by-row, .by .by-bits, .by .by-frow, .by .by-read p, .by .by-last { direction: ltr; unicode-bidi: isolate; }
.cpu code, .cpu .cpu-rtn, .cpu .cpu-rv, .cpu .cpu-symlist, .cpu .cpu-outtape, .pt code, .so code, .by code { direction: ltr; unicode-bidi: isolate; }

/* ===== media: Pixels and Sound (/code/labs/media, web/static/js/labs/media.js). The bench stays dark in both themes; tabs and answers reuse .pt-tabs / .pt-q. ===== */
.md-lab .bl-board-wrap, .md-lab .bl-read, .md-lab .bl-controls, .md-lab .bl-data { display: none !important; }
.md { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.md h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.md h4 { margin: 0 0 .35rem; font-size: .82rem; font-weight: 700; color: #e2e8f0; }
.md-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.md-msg:empty { display: none; }
.md-free { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.md-depth { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .85rem; color: #e2e8f0; }
.md-depth .bl-btn[aria-pressed="true"] { border-color: #fde047; color: #fef9c3; background: rgba(253, 224, 71, .12); }
.md-pal { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.md-sw { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .5rem .25rem .3rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .35); background: #111b2e; color: #e2e8f0; font: inherit; font-size: .82rem; cursor: pointer; }
.md-sw i { width: 1.15rem; height: 1.15rem; border-radius: .3rem; border: 1px solid rgba(148, 163, 184, .6); }
.md-sw code { font-family: var(--mono); font-size: .76rem; color: #fde047; }
.md-sw.is-on { border-color: #fde047; box-shadow: 0 0 0 2px rgba(253, 224, 71, .35); }
.md-stage { display: flex; flex-wrap: wrap; gap: .9rem; align-items: flex-start; }
.md-grid { display: grid; grid-template-columns: repeat(var(--w), 1fr); gap: 1px; background: #475569; border: 1px solid #475569; width: min(100%, 22rem); touch-action: none; user-select: none; }
.md-grid > span { aspect-ratio: 1; }
.md-px { cursor: crosshair; }
.md-grid.is-locked .md-px { cursor: default; }
.md-mini { width: 7rem; pointer-events: none; }
.md-target { min-width: 0; }
.md-binrows { margin: 0; padding-left: 1.6rem; font-size: .8rem; display: grid; gap: .05rem; }
.md-binrows li::marker { color: #e2e8f0; font-family: var(--mono); font-size: .72rem; }
.md-binrows code { font-family: var(--mono); color: #e2e8f0; letter-spacing: .04em; overflow-wrap: anywhere; }
.md-hint { margin: .55rem 0 0; font-size: .8rem; color: #e2e8f0; }
.md-size { margin: .6rem 0 0; font-size: .88rem; color: #e2e8f0; }
.md-size b { color: #fde047; font-family: var(--mono); }
.md-size b.is-good { color: #86efac; } .md-size b.is-bad { color: #fca5a5; }
.md-info h3 + * { margin-top: 0; }
.md-info h3:not(:first-child) { margin-top: .8rem; }
.md-runs { display: flex; flex-wrap: wrap; gap: .25rem; }
.md-run { display: inline-flex; align-items: center; gap: .2rem; padding: .1rem .3rem; border-radius: .35rem; background: #111b2e; border: 1px solid rgba(148, 163, 184, .3); font-family: var(--mono); font-size: .78rem; }
.md-run i { width: .8rem; height: .8rem; border-radius: .2rem; border: 1px solid rgba(148, 163, 184, .6); }
.md-more { font-size: .78rem; color: #e2e8f0; align-self: center; }
/* sound */
.md-plotwrap { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: .3rem; }
.md-levels { position: relative; }
.md-levels span { position: absolute; right: 0; transform: translateY(-50%); font-family: var(--mono); font-size: .74rem; color: #fde047; }
.md-plot { position: relative; height: 15rem; border-radius: .5rem; background: #060b16; border: 1px solid rgba(148, 163, 184, .25); }
.md-plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.md-dot { position: absolute; width: 1.3rem; height: 1.3rem; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid rgba(148, 163, 184, .55); background: rgba(15, 23, 42, .85); cursor: pointer; padding: 0; z-index: 1; }
.md-dot:hover:not(:disabled) { border-color: #fde047; }
.md-dot.is-on { background: #fde047; border-color: #fef9c3; box-shadow: 0 0 8px rgba(253, 224, 71, .7); }
.md-dot:disabled { cursor: default; opacity: .7; }
.md-dot:disabled:not(.is-on) { opacity: .25; }
.md-key { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .45rem; font-size: .8rem; color: #e2e8f0; }
.md-key span::before { content: ""; display: inline-block; width: 1.3rem; height: 3px; vertical-align: middle; margin-right: .35rem; border-radius: 2px; }
.md-k-wave::before { background: #38bdf8; } .md-k-step::before { background: #fde047; }
.md-samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.2rem, 1fr)); gap: .3rem; }
.md-samples > div { display: grid; justify-items: center; border: 1px solid rgba(148, 163, 184, .22); border-radius: .45rem; padding: .15rem .2rem; background: #0e182b; }
.md-samples small { font-size: .72rem; color: #e2e8f0; }
.md-samples code { font-family: var(--mono); font-weight: 800; color: #fde047; }
@container (max-width: 460px) { .md-plot { height: 13rem; } .md-dot { width: 1.1rem; height: 1.1rem; } .md-plotwrap { grid-template-columns: 1.9rem minmax(0, 1fr); } .md-grid { width: 100%; } .md-mini { width: 6rem; } }
.md .md-binrows, .md .md-plotwrap, .md .md-grid, .md .md-runs, .md code { direction: ltr; unicode-bidi: isolate; }
html[data-theme="light"] .md .md-panel, html[data-theme="light"] .md .md-sw, html[data-theme="light"] .md .md-run, html[data-theme="light"] .md .pt-tabs button { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .md .md-grid { border-color: #475569; }
html[data-theme="light"] .md .md-sw i, html[data-theme="light"] .md .md-run i { border-color: rgba(148, 163, 184, .6); }
html[data-theme="light"] .md .md-sw.is-on, html[data-theme="light"] .md .md-depth .bl-btn[aria-pressed="true"], html[data-theme="light"] .md .md-dot:hover:not(:disabled) { border-color: #fde047; }
html[data-theme="light"] .md .md-dot { border-color: rgba(148, 163, 184, .55); } html[data-theme="light"] .md .md-dot.is-on { border-color: #fef9c3; }
html[data-theme="light"] .md .md-plot, html[data-theme="light"] .md .md-samples > div { border-color: rgba(148, 163, 184, .25); }
html[data-theme="light"] .md .pt-tabs button[aria-selected="true"] { border-color: #c084fc; }
html[data-theme="light"] .md .pt-q input { border-color: rgba(148, 163, 184, .35); }
.md .md-binrows { list-style: decimal; }
.md .md-binrows li { padding: .08rem 0; border-bottom: 1px solid rgba(148, 163, 184, .12); }
html[data-theme="light"] .md .md-binrows li { border-color: rgba(148, 163, 184, .12); }
.md .md-grid { box-shadow: 0 0 0 4px #cbd5e1; margin: 4px; border-color: #94a3b8; background: #94a3b8; }
.md .md-mini { box-shadow: 0 0 0 3px #cbd5e1; }
html[data-theme="light"] .md .md-grid { border-color: #94a3b8; }

/* ===== trace: Trace Tables (/code/labs/trace, web/static/js/labs/trace.js). The bench stays dark in both themes. ===== */
.tr-lab .bl-board-wrap, .tr-lab .bl-read, .tr-lab .bl-controls, .tr-lab .bl-data { display: none !important; }
.tr { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.tr h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.tr-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.tr-msg:empty { display: none; }
.tr-bar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tr-bar .bl-btn:disabled { opacity: .45; cursor: not-allowed; }
.tr-speed { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: #e2e8f0; }
.tr-speed select { padding: .3rem .4rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font: inherit; font-size: .85rem; }
.tr-checkp { margin-inline-start: auto; border-color: #4ade80 !important; color: #bbf7d0 !important; }
.tr-lock { margin: 0; padding: .45rem .7rem; border-radius: .6rem; background: rgba(56, 189, 248, .1); border: 1px solid rgba(56, 189, 248, .35); color: #bae6fd; font-size: .88rem; }
.tr-lock[hidden] { display: none; }
.tr-top { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .7rem; align-items: start; }
@container (max-width: 640px) { .tr-top { grid-template-columns: minmax(0, 1fr); } }
.tr-side { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.tr-code { margin: 0; padding: 0; list-style: none; counter-reset: ln; font-family: var(--mono); font-size: .84rem; line-height: 1.5; overflow-x: auto; }
.tr-code li { counter-increment: ln; display: flex; border-radius: .3rem; border-inline-start: 3px solid transparent; }
.tr-code li::before { content: counter(ln); flex: 0 0 2.2em; text-align: end; padding-inline-end: .7em; color: #e2e8f0; user-select: none; }
.tr-code code { white-space: pre; font-family: inherit; color: #e2e8f0; background: none; padding: 0; }
.tr-code li.is-now { background: rgba(253, 224, 71, .14); border-inline-start-color: #fde047; }
.tr-code li.is-now::before { color: #fde047; }
.tr-code li.is-err { background: rgba(248, 113, 113, .14); border-inline-start-color: #f87171; }
.tr-kw { color: #7dd3fc; font-weight: 700; }
.tr-st { color: #fdba74; }
.tr-cm { color: #e2e8f0; font-style: italic; }
.tr-ed { display: flex; border: 1px solid rgba(148, 163, 184, .35); border-radius: .5rem; background: #060b16; overflow: hidden; }
.tr-gut { margin: 0; padding: .5rem 0; list-style: none; flex: 0 0 2.6em; text-align: end; font-family: var(--mono); font-size: .84rem; line-height: 1.5; color: #e2e8f0; overflow: hidden; user-select: none; }
.tr-gut li { padding-inline-end: .55em; }
.tr-gut li.is-err { color: #fca5a5; background: rgba(248, 113, 113, .18); }
.tr-ed textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: vertical; padding: .5rem .6rem; background: transparent; color: #f8fafc; font-family: var(--mono); font-size: max(16px, .84rem); line-height: 1.5; white-space: pre; overflow-x: auto; tab-size: 4; }
@media (min-width: 700px) { .tr-ed textarea, .tr-gut { font-size: .84rem; } }
@media (max-width: 699.98px) { .tr-gut { line-height: calc(max(16px, .84rem) * 1.5); } } /* the textarea is 16px on phones (no iOS zoom): keep each line number level with its line */
.tr-errs { margin: .4rem 0 0; padding: 0; list-style: none; color: #fca5a5; font-size: .85rem; }
.tr-errs:empty { display: none; }
.tr-dim { margin: 0; color: #e2e8f0; font-size: .85rem; }
.tr-vars { display: flex; flex-wrap: wrap; gap: .35rem; }
.tr-var { display: inline-flex; align-items: baseline; gap: .4rem; padding: .25rem .5rem; border-radius: .45rem; background: #111b2e; border: 1px solid rgba(148, 163, 184, .3); font-size: .82rem; color: #e2e8f0; }
.tr-var b, .tr-arr i { font-family: var(--mono); color: #fde047; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.tr-var.is-new, .tr-arr i.is-new { border-color: #fde047; box-shadow: 0 0 0 2px rgba(253, 224, 71, .25); }
.tr-arr { width: 100%; font-size: .82rem; color: #e2e8f0; }
.tr-arr > div { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; direction: ltr; }
.tr-arr i { font-style: normal; display: inline-flex; flex-direction: column; align-items: center; min-width: 2.4rem; padding: .15rem .3rem; border-radius: .4rem; background: #111b2e; border: 1px solid rgba(148, 163, 184, .3); }
.tr-arr small { font-size: .68rem; color: #e2e8f0; font-weight: 400; }
.tr-arr2 table { margin-top: .25rem; border-collapse: separate; border-spacing: 3px; direction: ltr; font-family: var(--mono); }
.tr-grid2 th { font-size: .68rem; color: #e2e8f0; font-weight: 400; padding: 0 .2rem; text-align: center; }
.tr-grid2 td { min-width: 2.2rem; padding: .15rem .3rem; text-align: center; border-radius: .35rem; background: #111b2e; border: 1px solid rgba(148, 163, 184, .3); color: #e2e8f0; }
.tr-grid2 td.is-new { border-color: #facc15; background: rgba(250, 204, 21, .16); }
.tr-arr2 { overflow-x: auto; }
.tr-arr > span small { font-size: .68rem; color: #e2e8f0; font-weight: 400; }
.tr-rec table { margin-top: .25rem; border-collapse: separate; border-spacing: 3px; direction: ltr; font-family: var(--mono); font-size: .82rem; }
.tr-rec .tr-grid2 th { text-align: right; padding-right: .4rem; }
.tr-rec .tr-grid2 td { text-align: left; }
.tr-recs .tr-scroll { overflow-x: auto; max-width: 100%; }
.tr-recs .tr-grid2 td { white-space: nowrap; min-width: 1.6rem; padding: .1rem .25rem; font-size: .76rem; }
.tr-recs .tr-grid2 th { font-size: .62rem; padding: 0 .1rem; }
.tr-recs table { border-spacing: 2px; }
.tr-chips { display: flex; flex-wrap: wrap; gap: .3rem; direction: ltr; }
.tr-chip { font-family: var(--mono); font-size: .84rem; padding: .15rem .5rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .35); background: #111b2e; color: #e2e8f0; }
.tr-chip.is-used { opacity: .4; text-decoration: line-through; }
.tr-chip.is-next { border-color: #38bdf8; color: #bae6fd; box-shadow: 0 0 0 2px rgba(56, 189, 248, .25); }
.tr-inedit { display: grid; gap: .2rem; margin-top: .45rem; font-size: .8rem; color: #e2e8f0; }
.tr-inedit input, .tr-guessgrid input { padding: .35rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; min-width: 0; }
.tr-out { font-family: var(--mono); font-size: .86rem; color: #bbf7d0; background: #04070e; border-radius: .45rem; padding: .35rem .55rem; min-height: 2rem; direction: ltr; unicode-bidi: isolate; text-align: left; }
.tr-out .tr-dim { font-family: inherit; }
.tr-files[hidden] { display: none; }
.tr-file + .tr-file { margin-top: .5rem; }
.tr-file p { margin: 0 0 .25rem; font-size: .8rem; color: #e2e8f0; }
.tr-file code { color: #fde68a; font-weight: 700; }
.tr-fmode { font-size: .72rem; color: #e2e8f0; }
.tr-file ol { margin: 0; padding: .3rem .45rem .3rem 2rem; border-radius: .45rem; background: #04070e; font-family: var(--mono); font-size: .82rem; color: #e2e8f0; direction: ltr; text-align: left; overflow-wrap: anywhere; }
.tr-file li::marker { color: #e2e8f0; font-size: .72rem; }
.tr-file li.is-read { color: #e2e8f0; }
.tr-file li.is-next { color: #fde047; font-weight: 700; }
.tr-hint { margin: 0 0 .5rem; color: #e2e8f0; font-size: .85rem; }
.tr-guessgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .5rem; margin-bottom: .6rem; }
.tr-guessgrid label { display: grid; gap: .2rem; }
.tr-guessgrid span { font-family: var(--mono); font-size: .84rem; font-weight: 700; color: #f1f5f9; }
.tr-guessgrid .is-ok input { border-color: #4ade80; }
.tr-guessgrid .is-bad input { border-color: #f87171; background: rgba(248, 113, 113, .08); }
.tr-testlist { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .45rem; }
.tr-testlist .is-on { border-color: #38bdf8; color: #bae6fd; background: rgba(56, 189, 248, .12); }
.tr-hint [data-expect] { font-family: var(--mono); color: #bbf7d0; }
.tr-ttwrap { max-height: 22rem; overflow: auto; }
.tr-tt { border-collapse: collapse; font-family: var(--mono); font-size: .84rem; direction: ltr; min-width: 100%; }
.tr-tt th, .tr-tt td { border: 1px solid rgba(148, 163, 184, .3); padding: .25rem .6rem; text-align: center; white-space: nowrap; }
.tr-tt th { position: sticky; top: 0; background: #16213a; color: #f1f5f9; }
.tr-tt td { color: #e2e8f0; }
.tr-tt tr.is-last td { background: rgba(253, 224, 71, .1); }
html[data-theme="light"] .tr .tr-panel, html[data-theme="light"] .tr .tr-var, html[data-theme="light"] .tr .tr-arr i, html[data-theme="light"] .tr .tr-chip, html[data-theme="light"] .tr .tr-ed, html[data-theme="light"] .tr input, html[data-theme="light"] .tr select, html[data-theme="light"] .tr .tr-tt th, html[data-theme="light"] .tr .tr-tt td { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .tr .tr-lock { border-color: rgba(56, 189, 248, .35); }
html[data-theme="light"] .tr .tr-guessgrid .is-ok input { border-color: #4ade80; }
html[data-theme="light"] .tr .tr-guessgrid .is-bad input { border-color: #f87171; }
html[data-theme="light"] .tr .tr-chip.is-next, html[data-theme="light"] .tr .tr-testlist .is-on { border-color: #38bdf8; }
html[data-theme="light"] .tr .tr-var.is-new, html[data-theme="light"] .tr .tr-arr i.is-new { border-color: #fde047; }
.tr .tr-code, .tr .tr-ed, .tr .tr-guessgrid input { direction: ltr; unicode-bidi: isolate; text-align: left; }
@container (max-width: 640px) { .tr-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .tr-side > :first-child, .tr-side > .tr-files { grid-column: 1 / -1; } }
@container (max-width: 640px) { .tr .tr-code { font-size: .8rem; } .tr .tr-code code { display: block; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; padding-inline-start: 2ch; text-indent: -2ch; } }
.tr-frames { width: 100%; display: grid; gap: .35rem; margin-top: .3rem; }
.tr-frames h4 { margin: 0; font-size: .8rem; font-weight: 700; color: #e2e8f0; }
.tr-frame { border: 1px dashed rgba(148, 163, 184, .4); border-radius: .55rem; padding: .3rem .45rem .4rem; }
.tr-frame.is-live { border-style: solid; border-color: #a78bfa; background: rgba(167, 139, 250, .08); }
.tr-frame p { margin: 0 0 .3rem; font-size: .8rem; color: #e2e8f0; }
.tr-frame code { font-family: var(--mono); color: #ddd6fe; direction: ltr; unicode-bidi: isolate; }
html[data-theme="light"] .tr .tr-frame { border-color: rgba(148, 163, 184, .4); }
html[data-theme="light"] .tr .tr-frame.is-live { border-color: #a78bfa; }
.tr-exsel { margin-inline-start: auto; padding: .35rem .5rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font: inherit; font-size: .85rem; max-width: 100%; }
html[data-theme="light"] .tr .tr-exsel { border-color: rgba(148, 163, 184, .35); }
.tr .tr-code code { display: block; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; padding-inline-start: 2ch; text-indent: -2ch; }
.tr .tr-code code { padding-inline-start: calc((var(--ind, 0) + 2) * 1ch); text-indent: -2ch; }
.tr .tr-top { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
.tr .tr-top.is-wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@container (max-width: 640px) { .tr .tr-top, .tr .tr-top.is-wide { grid-template-columns: minmax(0, 1fr); } .tr .tr-code code { padding-inline-start: calc((var(--ind, 0) + 2) * 1ch); } }

/* ===== normalise: Normal Forms (/code/labs/normalise, web/static/js/labs/normalise.js). The bench stays dark in both themes; each attribute has its own hue (--h). ===== */
.nf-lab .bl-board-wrap, .nf-lab .bl-read, .nf-lab .bl-controls, .nf-lab .bl-data { display: none !important; }
.nf { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.nf h3 { margin: 0 0 .45rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.nf-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.nf-msg:empty { display: none; }
.nf-cap { margin: .4rem 0 0; color: #e2e8f0; font-size: .84rem; }
.nf-panel > .nf-cap:first-of-type { margin-top: 0; margin-bottom: .45rem; }
.nf-swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: .2rem; background: rgba(251, 146, 60, .35); border: 1px solid #fb923c; vertical-align: -.12rem; }
.nf-dwrap { overflow-x: auto; }
.nf-data { border-collapse: collapse; font-size: .8rem; min-width: 100%; }
.nf-data th, .nf-data td { border: 1px solid rgba(148, 163, 184, .25); padding: .22rem .45rem; text-align: start; white-space: nowrap; }
.nf-data th { background: hsl(var(--h) 45% 18%); color: hsl(var(--h) 85% 85%); font-weight: 700; font-size: .76rem; }
.nf-data th.is-key { text-decoration: underline; text-underline-offset: 3px; }
.nf-data td { color: #e2e8f0; }
.nf-data td.is-rep { background: rgba(251, 146, 60, .22); color: #fed7aa; }
.nf-more { margin: .3rem 0 0; font-size: .78rem; color: #e2e8f0; }
.nf-a { display: inline-flex; align-items: center; gap: .25rem; padding: .18rem .5rem; border-radius: 999px; border: 1px solid hsl(var(--h) 70% 60% / .7); background: hsl(var(--h) 45% 16%); color: hsl(var(--h) 85% 85%); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.nf-fds { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.nf-fds li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.nf-arrow { color: #fde047; font-size: 1.05rem; padding: 0 .15rem; }
.nf-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.nf-pick { cursor: pointer; font: inherit; font-size: .84rem; font-weight: 600; padding: .3rem .65rem; min-height: 2rem; }
.nf-pick.is-in { background: hsl(var(--h) 70% 55%); color: #0b1220; border-color: hsl(var(--h) 80% 70%); }
.nf-pick.is-unused { border-style: dashed; border-color: #f87171; }
.nf-pick small { font-size: .7rem; opacity: .85; }
.nf-warn { margin: .45rem 0 0; color: #fca5a5; font-size: .84rem; }
.nf-bar { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; }
.nf-stats { display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: center; font-size: .84rem; color: #e2e8f0; }
.nf-stats b { color: #fde047; font-family: var(--mono); }
.nf-stats small { color: #e2e8f0; }
.nf-stats .is-ok { color: #86efac; } .nf-stats .is-bad { color: #fca5a5; }
.nf-nf { font-weight: 800; padding: .15rem .55rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .4); color: #f1f5f9; }
.nf-nf.nf-nf3 { border-color: #4ade80; color: #bbf7d0; background: rgba(74, 222, 128, .12); }
.nf-nf.nf-nf2 { border-color: #fde047; color: #fef08a; }
.nf-nf.nf-nf1, .nf-nf.nf-nf0 { border-color: #fb923c; color: #fed7aa; }
.nf-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: .7rem; align-items: start; }
.nf-card { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.nf-card.is-active { border-color: #38bdf8; box-shadow: 0 0 0 2px rgba(56, 189, 248, .3); }
.nf-card header { display: flex; align-items: center; gap: .4rem; margin-bottom: .45rem; }
.nf-card header h3 { margin: 0; font-family: var(--mono); }
.nf-name { flex: 1; min-width: 0; padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; font-weight: 700; text-transform: uppercase; }
.nf-on { font-size: .72rem; font-weight: 700; color: #7dd3fc; text-transform: uppercase; letter-spacing: .04em; }
.nf-x, .nf-rm { border: 0; background: none; color: #e2e8f0; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: .15rem .35rem; border-radius: .35rem; }
.nf-x:hover, .nf-rm:hover { color: #fca5a5; background: rgba(248, 113, 113, .12); }
.nf-attrs { display: flex; flex-direction: column; gap: .3rem; }
.nf-row { display: flex; align-items: center; gap: .35rem; padding: .15rem .3rem; border-radius: .5rem; border: 1px solid hsl(var(--h) 60% 55% / .45); background: hsl(var(--h) 40% 13%); color: hsl(var(--h) 85% 85%); font-size: .86rem; font-weight: 600; }
.nf-row > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nf-row.is-key > span { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.nf-row.is-fk > span { text-decoration: underline dotted; text-underline-offset: 3px; }
.nf-row small { font-size: .68rem; font-weight: 800; color: #c4b5fd; border: 1px solid #a78bfa; border-radius: .3rem; padding: 0 .25rem; }
.nf-key { border: 1px solid transparent; background: none; cursor: pointer; font-size: .95rem; line-height: 1; padding: .2rem .25rem; border-radius: .35rem; filter: grayscale(1); opacity: .45; }
.nf-key[aria-pressed="true"] { filter: none; opacity: 1; border-color: #fde047; background: rgba(253, 224, 71, .15); }
.nf-key:hover { opacity: 1; }
.nf-sig { margin: .5rem 0 .35rem; font-family: var(--mono); font-size: .8rem; color: #e2e8f0; overflow-wrap: anywhere; direction: ltr; unicode-bidi: isolate; text-align: left; }
.nf-sig u { text-underline-offset: 3px; text-decoration-thickness: 2px; color: #fef08a; }
.nf-fkl { text-decoration: underline dotted; text-underline-offset: 3px; color: #ddd6fe; }
.nf-checks { list-style: none; margin: 0 0 .45rem; padding: 0; display: grid; gap: .25rem; font-size: .82rem; }
.nf-checks li { padding-inline-start: 1.2rem; position: relative; }
.nf-checks li::before { position: absolute; inset-inline-start: 0; }
.nf-checks .is-bad { color: #fecaca; } .nf-checks .is-bad::before { content: "✗"; color: #f87171; }
.nf-checks .is-ok { color: #bbf7d0; } .nf-checks .is-ok::before { content: "✓"; color: #4ade80; }
.nf-legend { margin: 0; font-size: .8rem; color: #e2e8f0; }
.nf-legend u { text-underline-offset: 3px; text-decoration-thickness: 2px; }
html[data-theme="light"] .nf .nf-panel, html[data-theme="light"] .nf .nf-data th, html[data-theme="light"] .nf .nf-data td, html[data-theme="light"] .nf .nf-name, html[data-theme="light"] .nf .nf-nf { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .nf .nf-a, html[data-theme="light"] .nf .nf-row { border-color: hsl(var(--h) 60% 55% / .55); }
html[data-theme="light"] .nf .nf-pick.is-unused { border-color: #f87171; }
html[data-theme="light"] .nf .nf-card.is-active { border-color: #38bdf8; }
html[data-theme="light"] .nf .nf-nf.nf-nf3 { border-color: #4ade80; } html[data-theme="light"] .nf .nf-nf.nf-nf2 { border-color: #fde047; } html[data-theme="light"] .nf .nf-nf.nf-nf1, html[data-theme="light"] .nf .nf-nf.nf-nf0 { border-color: #fb923c; }
html[data-theme="light"] .nf .nf-key[aria-pressed="true"] { border-color: #fde047; }
html[data-theme="light"] .nf .nf-row small { border-color: #a78bfa; }
html[data-theme="light"] .nf .nf-swatch { border-color: #fb923c; }
.nf .nf-dwrap, .nf .nf-data { direction: ltr; }
.nf-addrow { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .45rem; font-size: .8rem; color: #e2e8f0; }
.nf .nf-mini { font-size: .76rem; padding: .15rem .5rem; min-height: 1.7rem; }
.nf .nf-bar[hidden] { display: none; }
.nf .nf-checks[hidden] { display: none; }
.nf-er { position: relative; width: 100%; min-height: 90px; }
.nf-er canvas { position: absolute; inset: 0; }
.nf-erbox { position: absolute; transform: translate(-50%, -50%); padding: .4rem .7rem; border-radius: .4rem; border: 2px solid #38bdf8; background: #0f1b31; color: #f1f5f9; font-family: var(--mono); font-weight: 700; font-size: .82rem; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
html[data-theme="light"] .nf .nf-erbox { border-color: #38bdf8; }
.nf .nf-er { direction: ltr; }

/* ===== scheduler: CPU Scheduler (/code/labs/scheduler, web/static/js/labs/scheduler.js). The bench stays dark in both themes; algorithm tabs reuse .pt-tabs; each process has a colour (--c). ===== */
.sc-lab .bl-board-wrap, .sc-lab .bl-read, .sc-lab .bl-controls, .sc-lab .bl-data { display: none !important; }
.sc { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.sc h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.sc-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.sc-msg:empty { display: none; }
.sc-free { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.sc-q { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: #e2e8f0; }
.sc-q select { padding: .3rem .4rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font: inherit; }
.sc-algo { margin: 0; font-size: .9rem; color: #e2e8f0; }
.sc-algo b { color: #f1f5f9; }
.sc-t { font-family: var(--mono); font-weight: 800; color: #fde047; }
.sc-bad { font-weight: 800; color: #fca5a5; }
.sc-gwrap { overflow-x: auto; padding-bottom: .2rem; }
.sc-gantt { --cw: 2rem; min-width: calc(var(--n) * var(--cw)); position: relative; padding: 1.3rem .6rem 0 .6rem; direction: ltr; }
.sc-arr { position: absolute; top: 0; left: .6rem; right: .6rem; height: 1.2rem; }
.sc-arr span { position: absolute; left: calc(var(--t) * 100% / var(--n)); transform: translateX(-50%); font-size: .7rem; font-weight: 800; color: var(--c); font-family: var(--mono); white-space: nowrap; }
.sc-cells { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); border: 1px solid rgba(148, 163, 184, .4); border-radius: .35rem; overflow: hidden; }
.sc-cell { height: 2.3rem; display: grid; place-items: center; font-family: var(--mono); font-weight: 800; font-size: .9rem; border-inline-end: 1px solid rgba(148, 163, 184, .18); color: #0b1220; }
.sc-cell:last-child { border-inline-end: 0; }
.sc-cell.is-run { background: var(--c); }
.sc-cell.is-idle { background: repeating-linear-gradient(45deg, #1e293b 0 5px, #0f172a 5px 10px); color: #e2e8f0; font-size: .68rem; font-weight: 600; }
.sc-cell.is-now { box-shadow: inset 0 0 0 2px #fde047; }
.sc-ticks { position: relative; height: 1.1rem; }
.sc-ticks span { position: absolute; left: calc(var(--t) * 100% / var(--n)); transform: translateX(-50%); font-size: .7rem; color: #e2e8f0; font-family: var(--mono); }
.sc-queue { margin: .55rem 0 0; font-size: .85rem; color: #e2e8f0; }
.sc-queue b, .sc-queue i { display: inline-block; min-width: 1.6rem; text-align: center; padding: .05rem .4rem; border-radius: .35rem; background: var(--c); color: #0b1220; font-family: var(--mono); font-style: normal; }
.sc-queue i { background: none; color: #e2e8f0; }
.sc-choose { border-color: rgba(253, 224, 71, .45); }
.sc-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.sc-run { display: inline-flex; flex-direction: column; align-items: center; min-width: 4.6rem; padding: .4rem .7rem; border-radius: .6rem; border: 2px solid var(--c, #64748b); background: #111b2e; color: #f1f5f9; cursor: pointer; font: inherit; }
.sc-run b { font-family: var(--mono); font-size: 1.15rem; color: var(--c, #e2e8f0); }
.sc-run small { font-size: .74rem; color: #e2e8f0; }
.sc-run:hover { background: #18243b; }
.sc-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.sc-tools .bl-btn:disabled { opacity: .45; cursor: not-allowed; }
.sc-twrap { overflow-x: auto; }
.sc-tab { border-collapse: collapse; font-size: .82rem; min-width: 100%; direction: ltr; }
.sc-tab th, .sc-tab td { border: 1px solid rgba(148, 163, 184, .25); padding: .3rem .5rem; text-align: center; white-space: nowrap; }
.sc-tab thead th { background: #16213a; color: #f1f5f9; font-weight: 700; }
.sc-tab thead small { font-weight: 400; color: #e2e8f0; font-size: .7rem; }
.sc-tab tbody th { text-align: start; font-family: var(--mono); color: #f1f5f9; }
.sc-tab td b { color: #fde047; }
.sc-tab tr.is-later td, .sc-tab tr.is-later th { color: #e2e8f0; }
.sc-tab tr.is-done th { text-decoration: none; }
.sc-tab tr.is-best td, .sc-tab tr.is-best th { background: rgba(74, 222, 128, .1); color: #bbf7d0; }
.sc-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--c); margin-inline-end: .4rem; }
.sc-bar { display: inline-block; width: 3rem; height: .45rem; border-radius: 99px; background: #1e293b; margin-inline-end: .35rem; vertical-align: middle; overflow: hidden; }
.sc-bar i { display: block; height: 100%; background: var(--c); }
.sc-avg { margin: .5rem 0 0; font-size: .88rem; color: #e2e8f0; direction: ltr; unicode-bidi: isolate; }
.sc-avg b { color: #fde047; font-family: var(--mono); font-size: 1rem; }
html[data-theme="light"] .sc .sc-panel, html[data-theme="light"] .sc .sc-cells, html[data-theme="light"] .sc .sc-cell, html[data-theme="light"] .sc .sc-tab th, html[data-theme="light"] .sc .sc-tab td, html[data-theme="light"] .sc .sc-q select { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .sc .sc-choose { border-color: rgba(253, 224, 71, .45); }
html[data-theme="light"] .sc .sc-run { border-color: var(--c, #64748b); }
@container (max-width: 520px) {
  .sc .sc-gantt { --cw: 1.2rem; padding-inline: .4rem; }
  .sc .sc-cell { font-size: .78rem; height: 2rem; }
  .sc .sc-cell.is-idle { font-size: 0; }
  .sc .sc-ticks span, .sc .sc-arr span { font-size: .62rem; }
  .sc .sc-bar { display: none; }
  .sc .sc-tab { font-size: .74rem; }
  .sc .sc-tab th, .sc .sc-tab td { padding: .25rem .25rem; white-space: normal; }
  .sc .sc-tab thead small { display: none; }
}
@container (max-width: 520px) { .sc .sc-times th:nth-child(4), .sc .sc-times td:nth-child(4) { display: none; } .sc .sc-dot { margin-inline-end: .2rem; } }
@container (max-width: 520px) { .sc .sc-times { table-layout: fixed; width: 100%; min-width: 0; } .sc .sc-times thead th { font-size: .66rem; overflow-wrap: anywhere; hyphens: auto; } .sc .sc-times td { overflow-wrap: anywhere; } }
@container (max-width: 520px) { .sc .sc-times thead th { overflow-wrap: normal; hyphens: manual; } }
.sc .sc-race tbody th { font-family: inherit; font-weight: 600; }
@container (max-width: 520px) { .sc .sc-arr span { font-size: .72rem; } .sc .sc-ticks span { font-size: .7rem; } .sc .sc-times thead th { font-size: .72rem; } }

/* ===== paging: Page Replacement (/code/labs/paging, web/static/js/labs/paging.js). The bench stays dark in both themes; algorithm tabs reuse .pt-tabs. ===== */
.pg-lab .bl-board-wrap, .pg-lab .bl-read, .pg-lab .bl-controls, .pg-lab .bl-data { display: none !important; }
.pg { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.pg h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.pg-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.pg-msg:empty { display: none; }
.pg-free { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pg-sel { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: #e2e8f0; }
.pg-sel select { padding: .3rem .4rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font: inherit; }
.pg-line { margin: 0; font-size: .9rem; color: #e2e8f0; }
.pg-line b { color: #f1f5f9; }
.pg-num { font-family: var(--mono); font-weight: 800; color: #fde047; }
.pg-f { color: #fb7185; font-weight: 800; font-family: var(--mono); }
.pg-h { color: #4ade80; font-weight: 800; font-family: var(--mono); }
.pg-bad { color: #fca5a5; font-weight: 800; }
.pg-twrap { overflow-x: auto; scroll-behavior: smooth; }
.pg-tab { border-collapse: collapse; font-family: var(--mono); font-size: .9rem; direction: ltr; }
.pg-tab th, .pg-tab td { border: 1px solid rgba(148, 163, 184, .28); min-width: 2.2rem; height: 2.1rem; padding: .15rem .3rem; text-align: center; }
.pg-tab th[scope="row"] { font-family: inherit; font-size: .78rem; font-weight: 700; color: #e2e8f0; white-space: nowrap; text-align: start; padding-inline: .5rem; background: #0f1a2e; position: sticky; left: 0; z-index: 1; }
.pg-tab thead th[scope="col"] { background: #16213a; color: #f1f5f9; font-weight: 800; }
.pg-tab .is-now { background: rgba(253, 224, 71, .12); }
.pg-tab thead th.is-now { background: #fde047; color: #0b1220; }
.pg-tab td { color: #e2e8f0; font-weight: 700; }
.pg-tab td.is-new { background: rgba(251, 113, 133, .25); color: #fecdd3; }
.pg-tab td.is-hit { background: rgba(74, 222, 128, .2); color: #bbf7d0; }
.pg-fh td { height: 1.7rem; font-size: .82rem; }
.pg-cap { margin: .45rem 0 0; font-size: .8rem; color: #e2e8f0; }
.pg-choose { border-color: rgba(253, 224, 71, .45); }
.pg-page { display: inline-block; min-width: 1.8rem; text-align: center; padding: 0 .35rem; border-radius: .4rem; background: #fde047; color: #0b1220; font-family: var(--mono); }
.pg-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.pg-btn { display: inline-flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-width: 7.5rem; padding: .45rem .7rem; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .4); background: #111b2e; color: #f1f5f9; cursor: pointer; font: inherit; text-align: start; }
.pg-btn b { font-size: .95rem; }
.pg-btn small { font-size: .76rem; color: #e2e8f0; }
.pg-btn:hover { background: #18243b; border-color: #94a3b8; }
.pg-hitbtn { border-color: #4ade80; }
.pg-hitbtn b { color: #86efac; }
.pg-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.pg-rate { margin: 0; font-size: .92rem; color: #e2e8f0; }
.pg-rate b { color: #fde047; font-family: var(--mono); font-size: 1.05rem; }
.pg-cmp th[scope="row"] { position: static; }
@container (max-width: 520px) { .pg .pg-btn { min-width: 0; flex: 1 1 8.5rem; } .pg .pg-tab th, .pg .pg-tab td { min-width: 1.9rem; } }
html[data-theme="light"] .pg .pg-panel, html[data-theme="light"] .pg .pg-tab th, html[data-theme="light"] .pg .pg-tab td, html[data-theme="light"] .pg .pg-btn, html[data-theme="light"] .pg .pg-sel select { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .pg .pg-choose { border-color: rgba(253, 224, 71, .45); }
html[data-theme="light"] .pg .pg-hitbtn { border-color: #4ade80; }

/* ===== crypto: Secret Messages (/code/labs/crypto, web/static/js/labs/crypto.js). The bench stays dark in both themes. ===== */
.cr-lab .bl-board-wrap, .cr-lab .bl-read, .cr-lab .bl-controls, .cr-lab .bl-data { display: none !important; }
.cr { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.cr h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.cr-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.cr-msg:empty { display: none; }
.cr-you { margin: 0; font-size: .9rem; color: #e2e8f0; }
.cr-you b { color: #fde047; }
.cr-cap { margin: .4rem 0 0; font-size: .82rem; color: #e2e8f0; }
.cr-dim { color: #e2e8f0; }
.cr-row { display: flex; flex-wrap: wrap; gap: .3rem; direction: ltr; }
.cr-cell { display: inline-flex; flex-direction: column; align-items: center; min-width: 2.2rem; padding: .2rem .3rem; border-radius: .45rem; background: #111b2e; border: 1px solid rgba(148, 163, 184, .3); }
.cr-cell b { font-family: var(--mono); font-size: 1.05rem; color: #f1f5f9; }
.cr-cell i { font-style: normal; font-family: var(--mono); font-size: .76rem; color: #fde047; }
.cr-cell.cr-num i { font-size: 1rem; padding: .25rem 0; }
.cr-row.is-good .cr-cell { border-color: #4ade80; background: rgba(74, 222, 128, .1); }
.cr-row.is-bad .cr-cell { border-color: #f87171; background: rgba(248, 113, 113, .08); }
.cr-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); gap: .45rem; }
.cr-key { display: grid; grid-template-columns: auto 1fr; column-gap: .45rem; align-items: center; text-align: start; padding: .45rem .6rem; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .4); background: #111b2e; color: #f1f5f9; font: inherit; cursor: pointer; }
.cr-key .cr-kico { grid-row: span 3; font-size: 1.3rem; }
.cr-key b { font-size: .86rem; }
.cr-key small { font-size: .74rem; color: #e2e8f0; font-family: var(--mono); }
.cr-key small.cr-who { font-family: inherit; }
.cr-key.is-pub { border-color: rgba(56, 189, 248, .55); }
.cr-key.is-priv { border-color: rgba(244, 114, 182, .55); }
.cr-key.is-on { box-shadow: 0 0 0 2px #fde047; border-color: #fde047; }
.cr-key:disabled { opacity: .55; cursor: not-allowed; }
.cr-key:not(:disabled):hover { background: #18243b; }
.cr-clear { margin-top: .5rem; }
.cr-step { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed rgba(148, 163, 184, .3); }
.cr-step p { margin: 0 0 .35rem; font-size: .86rem; color: #e2e8f0; }
.cr-work { margin: .4rem 0 .5rem; padding: 0; list-style: none; font-family: var(--mono); font-size: .8rem; color: #e2e8f0; display: grid; gap: .15rem; overflow-wrap: anywhere; direction: ltr; text-align: left; }
.cr-work b { color: #fde047; }
.cr-calc { margin: .45rem 0 0; font-family: var(--mono); font-size: .84rem; color: #e2e8f0; overflow-wrap: anywhere; direction: ltr; unicode-bidi: isolate; text-align: left; }
.cr-calc b { color: #fde047; font-size: 1rem; }
.cr-chan { margin-top: .6rem; display: grid; gap: .4rem; font-size: .88rem; color: #e2e8f0; }
.cr-chan p { margin: 0; }
.cr-chan b { font-family: var(--mono); color: #f1f5f9; }
.cr-big { margin: .2rem 0; font-family: var(--mono); font-size: 1.35rem; font-weight: 800; letter-spacing: .12em; color: #f1f5f9; direction: ltr; unicode-bidi: isolate; text-align: left; overflow-wrap: anywhere; }
.cr-out { color: #fde047; }
.cr-shift { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; font-size: .9rem; color: #e2e8f0; }
.cr-shift .bl-btn { min-width: 2.6rem; font-size: 1.1rem; }
.cr-shift b { font-family: var(--mono); color: #fde047; font-size: 1.1rem; }
.cr-map { margin: 0; font-family: var(--mono); font-size: .8rem; color: #e2e8f0; direction: ltr; text-align: left; }
.cr-all { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .3rem; margin-top: .6rem; }
.cr-try { display: flex; gap: .45rem; align-items: baseline; padding: .25rem .45rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .3); background: #111b2e; color: #e2e8f0; font-family: var(--mono); font-size: .82rem; cursor: pointer; text-align: start; }
.cr-try small { color: #e2e8f0; min-width: 1.4rem; }
.cr-try.is-on { border-color: #fde047; color: #fef08a; }
.cr-in { display: grid; gap: .25rem; margin-bottom: .5rem; font-size: .82rem; color: #e2e8f0; max-width: 18rem; }
.cr-in input { padding: .35rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; text-transform: uppercase; }
.cr-inbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: .6rem; }
.cr-mail { border: 1px solid rgba(148, 163, 184, .3); border-radius: .7rem; padding: .55rem .65rem; background: #0f1a2e; display: grid; gap: .3rem; align-content: start; }
.cr-mail.is-on { border-color: #fde047; box-shadow: 0 0 0 2px rgba(253, 224, 71, .25); }
.cr-mail .cr-big { font-size: 1.05rem; }
.cr-mail .bl-btn { justify-self: start; }
.cr-yes { margin: 0; color: #86efac; font-weight: 700; }
.cr-no { margin: 0; color: #fca5a5; font-weight: 700; }
html[data-theme="light"] .cr .cr-panel, html[data-theme="light"] .cr .cr-cell, html[data-theme="light"] .cr .cr-key, html[data-theme="light"] .cr .cr-try, html[data-theme="light"] .cr .cr-in input, html[data-theme="light"] .cr .cr-mail, html[data-theme="light"] .cr .cr-step { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .cr .cr-key.is-pub { border-color: rgba(56, 189, 248, .55); } html[data-theme="light"] .cr .cr-key.is-priv { border-color: rgba(244, 114, 182, .55); }
html[data-theme="light"] .cr .cr-key.is-on, html[data-theme="light"] .cr .cr-try.is-on, html[data-theme="light"] .cr .cr-mail.is-on { border-color: #fde047; }
html[data-theme="light"] .cr .cr-row.is-good .cr-cell { border-color: #4ade80; } html[data-theme="light"] .cr .cr-row.is-bad .cr-cell { border-color: #f87171; }
.cr .cr-keys { grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.4rem), 1fr)); }
.cr .cr-all { grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); }
@container (max-width: 420px) { .cr .cr-keys { grid-template-columns: 1fr 1fr; } .cr .cr-key { grid-template-columns: 1fr; padding: .4rem .5rem; } .cr .cr-key .cr-kico { grid-row: auto; font-size: 1.05rem; } }

/* ===== rpn: Reverse Polish (/code/labs/rpn, web/static/js/labs/rpn.js). The bench stays dark in both themes. ===== */
.rp-lab .bl-board-wrap, .rp-lab .bl-read, .rp-lab .bl-controls, .rp-lab .bl-data { display: none !important; }
.rp { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.rp h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.rp-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.rp-panel p { margin: .35rem 0; font-size: .88rem; color: #e2e8f0; }
.rp-msg:empty { display: none; }
.rp-dim { color: #e2e8f0; font-size: .85rem; }
.rp-two { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: .7rem; }
@container (max-width: 480px) { .rp .rp-two { grid-template-columns: 1fr; } }
.rp-strip { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; direction: ltr; }
.rp-tok { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 .4rem; border-radius: .45rem; font-family: var(--mono); font-weight: 800; font-size: 1rem; border: 1px solid rgba(148, 163, 184, .35); background: #111b2e; color: #f1f5f9; }
.rp-tok.is-val { color: #7dd3fc; border-color: rgba(56, 189, 248, .5); }
.rp-tok.is-op { color: #fcd34d; border-color: rgba(251, 191, 36, .55); }
.rp-tok.is-done { opacity: 1; background: #0a2a1a; border-color: rgba(74, 222, 128, .45); color: #86efac; }
.rp-tok.is-now { box-shadow: 0 0 0 2px #fde047; }
.rp-tok.is-match { border-color: #4ade80; }
.rp-tok.is-miss { border-color: #f87171; background: rgba(248, 113, 113, .12); }
.rp-tok.is-wrong { border-color: #f87171; box-shadow: 0 0 0 2px rgba(248, 113, 113, .45); }
.rp-pick { cursor: pointer; font: inherit; font-family: var(--mono); font-weight: 800; font-size: 1.1rem; min-width: 2.5rem; height: 2.5rem; }
.rp-pick:not(:disabled):hover { background: #18243b; }
.rp-pick:disabled { cursor: default; }
.rp-br { font-family: var(--mono); font-size: 1.2rem; font-weight: 700; color: #e2e8f0; padding: 0 .05rem; }
.rp-out { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; direction: ltr; }
.rp-cursor { display: inline-block; width: 2px; height: 1.6rem; background: #fde047; animation: rp-blink 1s steps(2) infinite; }
@keyframes rp-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rp-cursor { animation: none; } }
.rp-vars { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.rp-vars span { font-family: var(--mono); font-size: .92rem; padding: .2rem .5rem; border-radius: .45rem; background: #0b1220; border: 1px solid rgba(56, 189, 248, .4); color: #e2e8f0; }
.rp-vars b { color: #7dd3fc; }
.rp-stack { display: flex; flex-direction: column; align-items: stretch; gap: .25rem; min-height: 6rem; justify-content: flex-end; padding: .35rem; border: 2px solid #475569; border-top: 0; border-radius: 0 0 .6rem .6rem; max-width: 10rem; }
.rp-sv { font-family: var(--mono); font-weight: 800; font-size: 1.05rem; text-align: center; padding: .3rem .4rem; border-radius: .4rem; background: #16213a; border: 1px solid rgba(148, 163, 184, .35); color: #f1f5f9; overflow-wrap: anywhere; }
.rp-sv.is-pop { border-color: #fbbf24; background: rgba(251, 191, 36, .14); color: #fde68a; }
.rp-empty { text-align: center; color: #e2e8f0; font-size: .85rem; padding: .4rem; }
.rp-base { text-align: center; font-size: .72rem; color: #e2e8f0; border-top: 1px dashed rgba(148, 163, 184, .4); padding-top: .15rem; }
.rp-act p b { font-family: var(--mono); color: #fde047; }
.rp-ans { font-size: 1.3rem; }
.rp-btns { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .4rem; }
.rp-q { display: grid; gap: .3rem; font-size: .86rem; color: #e2e8f0; margin: .3rem 0 .5rem; }
.rp-q input { padding: .45rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; max-width: 26rem; direction: ltr; }
.rp-q input:focus { outline: 2px solid #fde047; outline-offset: 1px; }
.rp-err { color: #fca5a5 !important; font-weight: 600; }
.rp-rule { font-size: .84rem !important; }
.rp-rule b { color: #f1f5f9; }
.rp-tree { display: block; width: 100%; height: 160px; margin: .3rem 0; }
.rp-twrap { overflow-x: auto; }
.rp-tab { border-collapse: collapse; width: 100%; font-size: .88rem; }
.rp-tab th, .rp-tab td { border: 1px solid rgba(148, 163, 184, .28); padding: .3rem .45rem; text-align: start; vertical-align: middle; }
.rp-tab thead th { background: #16213a; color: #f1f5f9; font-size: .8rem; }
.rp-tab tbody th { width: 3.2rem; text-align: center; }
.rp-tab td { direction: ltr; unicode-bidi: isolate; text-align: left; }
.rp-cell { display: inline-block; font-family: var(--mono); font-weight: 700; padding: .1rem .4rem; margin: .1rem .25rem .1rem 0; border-radius: .35rem; background: #16213a; border: 1px solid rgba(148, 163, 184, .3); color: #e2e8f0; }
.rp-tab .rp-tok { min-width: 1.7rem; height: 1.7rem; font-size: .9rem; }
html[data-theme="light"] .rp .rp-panel, html[data-theme="light"] .rp .rp-tok, html[data-theme="light"] .rp .rp-sv, html[data-theme="light"] .rp .rp-tab th, html[data-theme="light"] .rp .rp-tab td, html[data-theme="light"] .rp .rp-cell, html[data-theme="light"] .rp .rp-q input, html[data-theme="light"] .rp .rp-vars span { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .rp .rp-tok.is-val { border-color: rgba(56, 189, 248, .5); } html[data-theme="light"] .rp .rp-tok.is-op { border-color: rgba(251, 191, 36, .55); }
html[data-theme="light"] .rp .rp-tok.is-done { border-color: rgba(74, 222, 128, .45); } html[data-theme="light"] .rp .rp-tok.is-match { border-color: #4ade80; }
html[data-theme="light"] .rp .rp-tok.is-miss, html[data-theme="light"] .rp .rp-tok.is-wrong { border-color: #f87171; } html[data-theme="light"] .rp .rp-sv.is-pop { border-color: #fbbf24; }
html[data-theme="light"] .rp .rp-stack { border-color: #475569; }

/* ===== assembler: Two-Pass Assembler (/code/labs/assembler, web/static/js/labs/assembler.js). The bench stays dark in both themes. ===== */
.as-lab .bl-board-wrap, .as-lab .bl-read, .as-lab .bl-controls, .as-lab .bl-data { display: none !important; }
.as { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.as h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.as-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.as-msg:empty { display: none; }
.as-line { margin: 0; font-size: .9rem; color: #e2e8f0; }
.as-line b { color: #fde047; font-family: var(--mono); }
.as-cap { margin: .45rem 0 0; font-size: .82rem; color: #e2e8f0; }
.as-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.as-twrap { overflow-x: auto; }
.as-tab { border-collapse: collapse; width: 100%; font-size: .88rem; direction: ltr; }
.as-tab th, .as-tab td { border: 1px solid rgba(148, 163, 184, .26); padding: .28rem .5rem; text-align: left; white-space: nowrap; }
.as-tab thead th { background: #16213a; color: #f1f5f9; font-size: .8rem; }
.as-tab td { font-family: var(--mono); color: #e2e8f0; }
.as-tab .as-addr { color: #fde047; font-weight: 700; min-width: 3.2rem; }
.as-tab .as-lab-c { color: #c4b5fd; font-weight: 700; }
.as-lbl { color: #c4b5fd; font-weight: 700; }
.as-tab tr.is-def td, .as-tab tr.is-def th { background: rgba(196, 181, 253, .16); }
.as-tab tr.is-use td { background: rgba(253, 224, 71, .09); }
.as-tab tr.is-picked td { background: rgba(253, 224, 71, .16); }
.as-sym th[scope="row"] { font-family: var(--mono); color: #c4b5fd; font-weight: 800; }
.as-sym td b, .as-obj b { color: #fde047; }
.as-seen { font-family: inherit !important; font-size: .8rem; color: #e2e8f0 !important; white-space: normal !important; }
.as-fwd { display: inline-block; margin-inline-start: .3rem; padding: 0 .4rem; border-radius: 999px; background: rgba(251, 146, 60, .18); border: 1px solid rgba(251, 146, 60, .55); color: #fdba74; font-size: .74rem; font-weight: 700; }
.as-in { width: 4.6rem; padding: .25rem .4rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .45); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; }
.as-in:focus { outline: 2px solid #fde047; outline-offset: 1px; }
.as-in.is-bad { border-color: #f87171; background: rgba(248, 113, 113, .12); }
.as-pick { padding: .15rem .5rem; font-size: .8rem; }
.as-free { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-start; }
.as-q { display: grid; gap: .3rem; font-size: .84rem; color: #e2e8f0; flex: 1 1 16rem; }
.as-q textarea, .as-q input { padding: .45rem .55rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; direction: ltr; }
.as-start { flex: 0 0 8rem; }
.as-errs { margin: .5rem 0 0; padding-inline-start: 1.1rem; color: #fca5a5; font-size: .84rem; }
html[data-theme="light"] .as .as-panel, html[data-theme="light"] .as .as-tab th, html[data-theme="light"] .as .as-tab td, html[data-theme="light"] .as .as-q textarea, html[data-theme="light"] .as .as-q input { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .as .as-in { border-color: rgba(148, 163, 184, .45); } html[data-theme="light"] .as .as-in.is-bad { border-color: #f87171; } html[data-theme="light"] .as .as-fwd { border-color: rgba(251, 146, 60, .55); }
.as-tab .as-ln { width: 2.6rem; color: #e2e8f0; font-size: .78rem; text-align: center; font-family: inherit; }
@container (max-width: 520px) { .as .as-tab.has-obj th:nth-child(4), .as .as-tab.has-obj td:nth-child(4) { display: none; } .as .as-tab th, .as .as-tab td { padding: .25rem .35rem; } .as .as-tab .as-ln { width: 1.8rem; } .as .as-in { width: 3.9rem; } }
@container (max-width: 520px) { .as .as-tab.has-obj th:nth-child(1), .as .as-tab.has-obj td:nth-child(1) { display: none; } }

/* ===== interrupts: Interrupts (/code/labs/interrupts, web/static/js/labs/interrupts.js). The bench stays dark in both themes. ===== */
.ir-lab .bl-board-wrap, .ir-lab .bl-read, .ir-lab .bl-controls, .ir-lab .bl-data { display: none !important; }
.ir { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.ir h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.ir-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.ir-msg:empty { display: none; }
.ir-line { margin: 0; font-size: .9rem; color: #e2e8f0; }
.ir-num { font-family: var(--mono); font-weight: 800; color: #fde047; }
.ir-bad { color: #fca5a5; font-weight: 800; }
.ir-cap { margin: .4rem 0 0; font-size: .8rem; color: #e2e8f0; }
.ir-top { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: .7rem; }
@container (max-width: 640px) { .ir .ir-top { grid-template-columns: 1fr 1fr; } .ir .ir-top > :first-child { grid-column: 1 / -1; } }
.ir-reg { display: flex; flex-wrap: wrap; gap: .4rem; direction: ltr; }
.ir-bit { display: inline-flex; flex-direction: column; align-items: center; min-width: 4.6rem; padding: .3rem .4rem; border-radius: .5rem; background: #111b2e; border: 1px solid rgba(148, 163, 184, .35); }
.ir-bit b { font-family: var(--mono); font-size: 1.3rem; color: #e2e8f0; }
.ir-bit small { font-size: .74rem; color: #e2e8f0; }
.ir-bit.is-on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 12px color-mix(in srgb, var(--c) 40%, transparent); }
.ir-bit.is-on b { color: var(--c); }
.ir-pc { margin: 0; font-family: var(--mono); font-size: 1.2rem; color: #e2e8f0; }
.ir-pc b { color: #fde047; }
.ir-stack { display: flex; flex-direction: column; gap: .25rem; min-height: 4.5rem; justify-content: flex-end; padding: .3rem; border: 2px solid #475569; border-top: 0; border-radius: 0 0 .6rem .6rem; }
.ir-sv { font-family: var(--mono); font-size: .8rem; font-weight: 700; padding: .25rem .4rem; border-radius: .4rem; background: #16213a; border: 1px solid var(--c); color: #f1f5f9; }
.ir-empty { text-align: center; color: #e2e8f0; font-size: .82rem; }
.ir-base { text-align: center; font-size: .72rem; color: #e2e8f0; border-top: 1px dashed rgba(148, 163, 184, .4); padding-top: .1rem; }
.ir-choose { border-color: rgba(253, 224, 71, .45); }
.ir-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.ir-opt { padding: .5rem .8rem; border-radius: .6rem; border: 1px solid var(--c); background: #111b2e; color: #f1f5f9; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; }
.ir-opt:hover { background: #18243b; }
.ir-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.ir-twrap { overflow-x: auto; }
.ir-tl, .ir-src { border-collapse: collapse; font-size: .84rem; direction: ltr; }
.ir-src { width: 100%; }
.ir-tl th, .ir-tl td, .ir-src th, .ir-src td { border: 1px solid rgba(148, 163, 184, .26); padding: .25rem .35rem; text-align: center; }
.ir-tl thead th, .ir-src thead th { background: #16213a; color: #f1f5f9; font-size: .78rem; }
.ir-tl thead th.is-now { background: #fde047; color: #0b1220; }
.ir-tl th[scope="row"], .ir-src th[scope="row"] { text-align: left; white-space: nowrap; font-size: .82rem; background: #0f1a2e; }
.ir-tl th[scope="row"] { position: sticky; left: 0; z-index: 1; }
.ir-tl th[scope="row"] small { display: block; font-size: .72rem; color: #e2e8f0; font-weight: 500; margin-inline-start: 1rem; }
.ir-tl td { min-width: 2.3rem; height: 2rem; font-family: var(--mono); font-size: .76rem; font-weight: 700; color: #0b1220; position: relative; }
.ir-tl td.is-run { background: var(--c); }
.ir-tl td.is-arr { box-shadow: inset 3px 0 0 #fde047; }
.ir-arrkey { display: inline-block; width: 3px; height: .9rem; background: #fde047; vertical-align: middle; }
.ir-src td { color: #e2e8f0; font-family: var(--mono); }
.ir-src td:last-child { font-family: inherit; font-size: .8rem; color: #e2e8f0; }
.ir-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c); margin-inline-end: .4rem; }
html[data-theme="light"] .ir .ir-panel, html[data-theme="light"] .ir .ir-bit, html[data-theme="light"] .ir .ir-tl th, html[data-theme="light"] .ir .ir-tl td, html[data-theme="light"] .ir .ir-src th, html[data-theme="light"] .ir .ir-src td { border-color: rgba(148, 163, 184, .26); }
html[data-theme="light"] .ir .ir-choose { border-color: rgba(253, 224, 71, .45); } html[data-theme="light"] .ir .ir-stack { border-color: #475569; }
html[data-theme="light"] .ir .ir-bit.is-on, html[data-theme="light"] .ir .ir-sv, html[data-theme="light"] .ir .ir-opt { border-color: var(--c); }
@container (max-width: 520px) { .ir .ir-src th:last-child, .ir .ir-src td:last-child { display: none; } .ir .ir-src th, .ir .ir-src td { padding: .22rem .25rem; } .ir .ir-src th[scope="row"] { white-space: normal; } .ir .ir-sv { font-size: .74rem; } }

/* ===== pipeline: Pipelining (/code/labs/pipeline, web/static/js/labs/pipeline.js). The bench stays dark in both themes; tabs reuse .pt-tabs. ===== */
.pl-lab .bl-board-wrap, .pl-lab .bl-read, .pl-lab .bl-controls, .pl-lab .bl-data { display: none !important; }
.pl { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.pl h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.pl-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.pl-msg:empty { display: none; }
.pl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pl-free { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pl-sel { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: #e2e8f0; }
.pl-sel select { padding: .3rem .4rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font: inherit; }
.pl-line { margin: 0; font-size: .9rem; color: #e2e8f0; }
.pl-line b { color: #f1f5f9; }
.pl-twrap { overflow-x: auto; }
.pl-grid { border-collapse: collapse; font-size: .82rem; direction: ltr; }
.pl-grid th, .pl-grid td { border: 1px solid rgba(148, 163, 184, .22); padding: 0; text-align: center; }
.pl-grid thead th { background: #16213a; color: #f1f5f9; font-size: .76rem; padding: .25rem .3rem; min-width: 2.1rem; }
.pl-grid tbody th[scope="row"] { font-family: var(--mono); font-weight: 700; text-align: left; white-space: nowrap; padding: .25rem .5rem; background: #0f1a2e; color: #f1f5f9; position: sticky; left: 0; z-index: 1; }
.pl-addr { font-family: var(--mono); color: #fde047; font-weight: 700; padding: .25rem .4rem !important; }
.pl-c button { display: block; width: 100%; min-width: 2.1rem; height: 2rem; border: 0; background: transparent; color: #0b1220; font-family: var(--mono); font-weight: 800; font-size: .74rem; cursor: pointer; }
.pl-c button:hover { background: rgba(253, 224, 71, .18); }
.pl-c.pl-IF, .pl-st.pl-IF { background: #38bdf8; } .pl-c.pl-ID, .pl-st.pl-ID { background: #a78bfa; } .pl-c.pl-OF, .pl-st.pl-OF { background: #34d399; } .pl-c.pl-IE, .pl-st.pl-IE { background: #fbbf24; } .pl-c.pl-WB, .pl-st.pl-WB { background: #fb923c; }
.pl-c.is-bad, .pl-stages td.is-bad { box-shadow: inset 0 0 0 3px #ef4444; }
.pl-grid tr.is-drop .pl-c[class*="pl-I"], .pl-grid tr.is-drop .pl-c.pl-OF { background-image: repeating-linear-gradient(135deg, rgba(11, 18, 32, .55) 0 4px, transparent 4px 8px); }
.pl-grid tr.is-drop th { text-decoration: line-through; color: #e2e8f0; }
.pl-drop { padding: .2rem .5rem; font-size: .78rem; margin: 0 .3rem; white-space: nowrap; }
.pl-drop[aria-pressed="true"] { border-color: #f87171; color: #fecaca; }
.pl-st { display: inline-block; min-width: 1.9rem; padding: 0 .25rem; border-radius: .3rem; color: #0b1220; font-family: var(--mono); font-weight: 800; font-size: .76rem; text-align: center; }
.pl-legend { margin: .55rem 0 0; font-size: .8rem; color: #e2e8f0; line-height: 1.9; }
.pl-sum { margin: .4rem 0 0; font-size: .88rem; color: #e2e8f0; }
.pl-sum b { color: #fde047; font-family: var(--mono); font-size: 1rem; }
.pl-stages td { min-width: 2.1rem; height: 1.8rem; font-family: var(--mono); font-weight: 700; color: #e2e8f0; padding: 0 .2rem; }
.pl-stages tbody th[scope="row"] { padding: .2rem .4rem; }
.pl-x { text-decoration: line-through; color: #f87171; }
.pl-cap { margin: .45rem 0 0; font-size: .8rem; color: #e2e8f0; }
.pl-qs { margin: 0; padding-inline-start: 1.3rem; display: grid; gap: .7rem; }
.pl-qs li p { margin: 0 0 .35rem; font-size: .9rem; color: #e2e8f0; }
.pl-qs li.is-bad p { color: #fca5a5; }
.pl-in { width: 6rem; padding: .35rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 16px; }
.pl-ch { display: grid; gap: .35rem; }
.pl-ch label { display: flex; gap: .5rem; align-items: flex-start; font-size: .86rem; color: #e2e8f0; padding: .35rem .5rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .25); background: #0f1a2e; cursor: pointer; }
.pl-ch input { margin-top: .2rem; }
.pl-qs + .bl-btn { margin-top: .7rem; }
html[data-theme="light"] .pl .pl-panel, html[data-theme="light"] .pl .pl-grid th, html[data-theme="light"] .pl .pl-grid td, html[data-theme="light"] .pl .pl-in, html[data-theme="light"] .pl .pl-ch label, html[data-theme="light"] .pl .pl-sel select { border-color: rgba(148, 163, 184, .25); }
html[data-theme="light"] .pl .pl-drop[aria-pressed="true"] { border-color: #f87171; }
.pl-grid tbody th[scope="row"] .pl-addr { padding: 0 !important; margin-inline-end: .35rem; }
.pl-grid tr.is-drop th { text-decoration: none; } .pl-grid tr.is-drop .pl-ins { text-decoration: line-through; color: #e2e8f0; }
.pl-grid .pl-drop { margin: 0 0 0 .45rem; padding: .1rem .45rem; font-family: system-ui, sans-serif; font-weight: 600; }
@container (max-width: 520px) { .pl .pl-grid tbody th[scope="row"] { white-space: normal; min-width: 6.5rem; font-size: .76rem; } .pl .pl-grid .pl-drop { display: block; margin: .2rem 0 0; } }
.pl .pl-grid thead th, .pl .pl-c button, .pl .pl-stages td { min-width: 1.95rem; }
.pl .pl-qs { list-style: decimal; } .pl .pl-qs li::marker { color: #fde047; font-weight: 800; }

/* ===== hashing: Hashing a File (/code/labs/hashing, web/static/js/labs/hashing.js). The bench stays dark in both themes; method tabs reuse .pt-tabs. ===== */
.hs-lab .bl-board-wrap, .hs-lab .bl-read, .hs-lab .bl-controls, .hs-lab .bl-data { display: none !important; }
.hs { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.hs h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.hs .hs-h3b { margin-top: .8rem; }
.hs-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.hs-msg:empty { display: none; }
.hs-free { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hs-sel { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: #e2e8f0; }
.hs-sel select { padding: .3rem .4rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font: inherit; }
.hs-line { margin: 0; font-size: .9rem; color: #e2e8f0; }
.hs-line b { color: #f1f5f9; }
.hs-bad { color: #fca5a5; font-weight: 800; }
.hs-queue { display: flex; flex-wrap: wrap; gap: .35rem; direction: ltr; }
.hs-q { font-family: var(--mono); font-weight: 700; padding: .2rem .5rem; border-radius: .45rem; background: #111b2e; border: 1px solid rgba(148, 163, 184, .3); color: #e2e8f0; }
.hs-q.is-now { background: #fde047; border-color: #fde047; color: #0b1220; }
.hs-q.is-done { color: #e2e8f0; text-decoration: line-through; }
.hs-choose { border-color: rgba(253, 224, 71, .45); }
.hs-key { display: inline-block; padding: 0 .4rem; border-radius: .4rem; background: #fde047; color: #0b1220; font-family: var(--mono); }
.hs-work { margin: 0; font-family: var(--mono); font-size: .95rem; color: #e2e8f0; direction: ltr; text-align: start; }
.hs-work b { color: #fde047; }
.hs-none { margin-top: .55rem; }
.hs-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.hs-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: .45rem; direction: ltr; }
.hs-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: .05rem; padding: .35rem .2rem .3rem; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .4); background: #111b2e; color: #f1f5f9; cursor: pointer; font: inherit; }
.hs-slot:hover:not(:disabled) { background: #18243b; border-color: #94a3b8; }
.hs-slot:disabled { cursor: default; }
.hs-slot small { font-size: .72rem; color: #e2e8f0; font-weight: 700; }
.hs-slot b { font-family: var(--mono); font-size: 1.02rem; color: #f8fafc; }
.hs-slot i { font-style: normal; font-size: .7rem; color: #86efac; }
.hs-slot.is-empty b { color: #475569; }
.hs-slot.is-empty i { color: #e2e8f0; }
.hs-slot.is-moved { border-color: #fb923c; background: rgba(251, 146, 60, .12); }
.hs-slot.is-moved i { color: #fdba74; }
.hs-slot.is-path { box-shadow: 0 0 0 2px #38bdf8; }
.hs-slot.is-hit { box-shadow: 0 0 0 2px #4ade80; background: rgba(74, 222, 128, .14); }
.hs-step { position: absolute; top: -.45rem; inset-inline-end: -.35rem; min-width: 1.2rem; height: 1.2rem; padding: 0 .2rem; border-radius: 999px; background: #38bdf8; color: #0b1220; font-size: .72rem; font-weight: 800; line-height: 1.2rem; text-align: center; }
.hs-ov .hs-slot { background: #1a1428; }
.hs-cap { margin: .5rem 0 0; font-size: .8rem; color: #e2e8f0; }
.hs-cap b { color: #fde047; font-family: var(--mono); }
.hs-mv { color: #fdba74; font-weight: 700; }
.hs-look { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .45rem; }
.hs-look input { width: 9rem; padding: .4rem .55rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 1rem; }
.hs-twrap { overflow-x: auto; }
.hs-tab { border-collapse: collapse; width: 100%; font-size: .88rem; direction: ltr; }
.hs-tab th, .hs-tab td { border: 1px solid rgba(148, 163, 184, .28); padding: .3rem .45rem; text-align: center; }
.hs-tab thead th { background: #16213a; color: #f1f5f9; font-weight: 700; font-size: .8rem; }
.hs-tab thead small { font-size: .75rem; font-weight: 400; color: #e2e8f0; font-family: var(--mono); white-space: nowrap; }
.hs-o { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-weight: 700; }
.hs-tab td { font-family: var(--mono); color: #e2e8f0; }
.hs-tab td.hs-dim, .hs-dim { color: #e2e8f0; font-family: inherit; }
.hs-tab td.hs-ok, .hs-tab td.hs-no { font-family: inherit; font-weight: 700; white-space: nowrap; }
.hs-ok { color: #4ade80 !important; }
.hs-no { color: #fb7185 !important; }
.hs-mvt { color: #fdba74 !important; }
@container (max-width: 520px) { .hs .hs-slots { grid-template-columns: repeat(auto-fill, minmax(3.9rem, 1fr)); gap: .4rem; } .hs .hs-tab { font-size: .8rem; } .hs .hs-tab th, .hs .hs-tab td { padding: .25rem .3rem; } }
html[data-theme="light"] .hs .hs-panel, html[data-theme="light"] .hs .hs-tab th, html[data-theme="light"] .hs .hs-tab td, html[data-theme="light"] .hs .hs-q, html[data-theme="light"] .hs .hs-sel select, html[data-theme="light"] .hs .hs-look input { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .hs .hs-slot { border-color: rgba(148, 163, 184, .4); }
html[data-theme="light"] .hs .hs-slot.is-moved { border-color: #fb923c; }
html[data-theme="light"] .hs .hs-choose { border-color: rgba(253, 224, 71, .45); }

/* prac-moire — Moiré Fringes: the long heading sin(F−G) fits its phone column */
@media (max-width: 480px) { [data-bench="prac-moire"] .pr-table th input.pr-hq { font-size: .8rem; letter-spacing: -.02em; padding-inline: 2px; } }

/* prac-beats — Beating Springs: five table columns (z, P, M, 1/√M, 1/P) fit a phone */
@media (max-width: 480px) {
  [data-bench="prac-beats"] .pr-table { font-size: .78rem; }
  [data-bench="prac-beats"] .pr-table th input.pr-hq, [data-bench="prac-beats"] .pr-table th select { min-width: 2.9rem; font-size: .76rem; padding-inline: 1px; }
  [data-bench="prac-beats"] .pr-table th, [data-bench="prac-beats"] .pr-table td { padding-inline: 1px; }
  [data-bench="prac-beats"] .pr-table td input { font-size: .74rem; padding: .3rem 0; letter-spacing: -.02em; }
  [data-bench="prac-beats"] .pr-table .pr-rn { width: 1rem; }
}

/* ===== prolog: Facts and Rules (/code/labs/prolog, web/static/js/labs/prolog.js). The bench stays dark in both themes. ===== */
.fr-lab .bl-board-wrap, .fr-lab .bl-read, .fr-lab .bl-controls, .fr-lab .bl-data { display: none !important; }
.fr { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.fr h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.fr-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.fr-task { border-color: rgba(253, 224, 71, .45); display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.fr-task > * { margin: 0; }
.fr-task h3 { margin: 0; }
.fr-msg:empty { display: none; }
.fr code { font-family: var(--mono); font-size: .92em; color: #e2e8f0; direction: ltr; unicode-bidi: isolate; }
.fr-kw { color: #f472b6; font-weight: 700; }
.fr-pred { color: #38bdf8; }
.fr-var { color: #fde047; }
.fr-goal { font-size: 1.05rem; padding: .3rem .6rem; border-radius: .5rem; background: #060b16; border: 1px solid rgba(148, 163, 184, .3); }
.fr-res { font-size: .92rem; color: #e2e8f0; }
.fr-res b { color: #fde047; font-family: var(--mono); font-weight: 700; }
.fr-cap { font-size: .82rem; color: #e2e8f0; }
.fr-bad { color: #fb7185; font-weight: 800; }
.fr-good { color: #4ade80; font-weight: 800; }
.fr-miss { color: #fdba74; font-weight: 800; }
.fr-kb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; direction: ltr; }
.fr-cl { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; width: 100%; padding: .2rem .45rem; border-radius: .45rem; border: 1px solid transparent; background: none; color: inherit; font: inherit; text-align: start; }
button.fr-cl { cursor: pointer; border-color: rgba(148, 163, 184, .18); background: #0f1729; }
button.fr-cl:hover { border-color: #94a3b8; background: #16213a; }
.fr-cl.is-ok { border-color: #4ade80; background: rgba(74, 222, 128, .12); }
.fr-no { font-family: var(--mono); font-size: .8rem; color: #e2e8f0; min-width: 1.6rem; }
.fr-bind { font-size: .78rem; font-weight: 700; color: #0b1220; background: #4ade80; border-radius: .35rem; padding: 0 .35rem; font-family: var(--mono); }
.fr-bind.is-no { background: #fb7185; }
.fr-new .fr-cl { border-color: rgba(56, 189, 248, .5); background: rgba(56, 189, 248, .1); }
.fr-new .fr-bind { background: #38bdf8; }
.fr-mean { margin-top: .6rem; font-size: .82rem; color: #e2e8f0; }
.fr-mean summary { cursor: pointer; font-weight: 700; color: #e2e8f0; }
.fr-mean table { margin-top: .35rem; border-collapse: collapse; }
.fr-mean th { font-family: var(--mono); color: #e2e8f0; padding: .1rem .6rem .1rem 0; text-align: start; vertical-align: top; }
.fr-mean td { padding: .1rem 0; }
.fr-row { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; width: 100%; }
.fr-lab { font-family: var(--mono); color: #fde047; font-weight: 700; }
.fr-in { flex: 1 1 12rem; min-width: 0; padding: .45rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .95rem; direction: ltr; }
.fr-wide { width: 100%; box-sizing: border-box; }
.fr-ta { width: 100%; box-sizing: border-box; padding: .5rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .92rem; line-height: 1.5; resize: vertical; direction: ltr; }
.fr-in:focus, .fr-ta:focus { outline: 2px solid #38bdf8; outline-offset: 1px; }
.fr-live:empty { display: none; }
.fr-live { width: 100%; }
.fr-live > p { margin: 0 0 .35rem; }
.fr-err { font-size: .88rem; color: #fda4af; }
.fr-okline { font-size: .9rem; color: #e2e8f0; }
.fr-okline b { color: #fde047; font-family: var(--mono); font-weight: 700; }
.fr-ans { display: flex; flex-wrap: wrap; gap: .3rem; direction: ltr; }
.fr-ans span { font-family: var(--mono); font-size: .82rem; padding: .1rem .4rem; border-radius: .35rem; border: 1px solid rgba(148, 163, 184, .3); }
.fr-ans .is-ok { border-color: #4ade80; color: #bbf7d0; }
.fr-ans .is-no { border-color: #fb7185; color: #fecdd3; }
.fr-gwrap { overflow-x: auto; max-width: 100%; }
.fr-grid { border-collapse: collapse; font-size: .8rem; direction: ltr; }
.fr-grid th, .fr-grid td { border: 1px solid rgba(148, 163, 184, .25); padding: .2rem .35rem; text-align: center; }
.fr-grid thead th { font-family: var(--mono); font-weight: 600; color: #e2e8f0; background: #16213a; white-space: nowrap; }
.fr-grid thead th:first-child { color: #fde047; }
.fr-grid th[scope="row"] { font-family: var(--mono); font-weight: 600; color: #e2e8f0; text-align: start; white-space: nowrap; background: #0f1a2e; position: sticky; left: 0; }
.fr-grid td { min-width: 2rem; font-weight: 800; }
.fr-grid td.is-ok { background: rgba(74, 222, 128, .18); color: #4ade80; }
.fr-grid td.is-no { background: rgba(251, 113, 133, .28); color: #fb7185; }
.fr-grid td.is-miss { box-shadow: inset 0 0 0 2px #fb923c; color: #fdba74; }
@container (max-width: 520px) { .fr .fr-goal { font-size: .95rem; } .fr .fr-cl { padding: .2rem .35rem; } .fr .fr-grid { font-size: .74rem; } }
html[data-theme="light"] .fr .fr-panel, html[data-theme="light"] .fr .fr-in, html[data-theme="light"] .fr .fr-ta, html[data-theme="light"] .fr .fr-goal, html[data-theme="light"] .fr .fr-grid th, html[data-theme="light"] .fr .fr-grid td, html[data-theme="light"] .fr .fr-ans span { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .fr .fr-task { border-color: rgba(253, 224, 71, .45); }
html[data-theme="light"] .fr button.fr-cl { border-color: rgba(148, 163, 184, .18); }
html[data-theme="light"] .fr .fr-cl.is-ok { border-color: #4ade80; }
html[data-theme="light"] .fr .fr-new .fr-cl { border-color: rgba(56, 189, 248, .5); }

/* ===== bnf: BNF and Syntax Diagrams (/code/labs/bnf, web/static/js/labs/bnf.js). The bench stays dark in both themes; diagrams are canvas. ===== */
.bn-lab .bl-board-wrap, .bn-lab .bl-read, .bn-lab .bl-controls, .bn-lab .bl-data { display: none !important; }
.bn { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.bn h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.bn-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.bn-task { border-color: rgba(253, 224, 71, .45); }
.bn-msg:empty { display: none; }
.bn code, .bn-str { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.bn-str { font-weight: 700; color: #f8fafc; }
.bn-cap { margin: .4rem 0; font-size: .82rem; color: #e2e8f0; }
.bn-bad { color: #fb7185; font-weight: 800; }
.bn-nt { color: #38bdf8; }
.bn-def { color: #f472b6; font-weight: 700; }
.bn-bar { color: #f472b6; font-weight: 700; }
.bn-t { color: #fde047; }
.bn-bnf { margin: 0 0 .6rem; padding: .5rem .6rem; border-radius: .5rem; background: #060b16; border: 1px solid rgba(148, 163, 184, .2); font-family: var(--mono); font-size: .86rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; direction: ltr; text-align: left; }
.bn-figs { display: flex; flex-wrap: wrap; gap: .5rem .9rem; overflow-x: auto; direction: ltr; }
.bn-figs:empty { display: none; }
.bn-fig { margin: 0; padding: .3rem .4rem; border-radius: .5rem; background: #0b1220; min-width: 0; max-width: 100%; overflow-x: auto; box-sizing: border-box; }
.bn-fig canvas { display: block; }
.bn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.bn-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; padding: .35rem .5rem; border-radius: .55rem; background: #0f1729; border: 1px solid rgba(148, 163, 184, .18); }
.bn-list .bn-str { min-width: 9.5rem; font-size: 1rem; }
.bn-btns { display: inline-flex; gap: .35rem; }
.bn-btns .bl-btn[aria-pressed="true"].bn-v { background: rgba(74, 222, 128, .2); border-color: #4ade80; color: #bbf7d0; }
.bn-btns .bl-btn[aria-pressed="true"].bn-i { background: rgba(251, 113, 133, .2); border-color: #fb7185; color: #fecdd3; }
.bn-why { flex: 1 1 14rem; font-size: .85rem; }
.bn-why.is-ok { color: #86efac; }
.bn-why.is-no { color: #fda4af; }
.bn-form { margin: .2rem 0 .5rem; font-family: var(--mono); font-size: 1.15rem; font-weight: 700; padding: .45rem .6rem; border-radius: .5rem; background: #060b16; border: 1px solid rgba(148, 163, 184, .3); overflow-wrap: anywhere; direction: ltr; text-align: left; }
.bn-form .bn-nt.is-hot { background: #fde047; color: #0b1220; border-radius: .3rem; padding: 0 .15rem; }
.bn-alts { display: flex; flex-wrap: wrap; gap: .4rem; direction: ltr; }
.bn-alt { font-family: var(--mono); }
.bn-hist { margin: .6rem 0 0; padding: 0; list-style: none; font-family: var(--mono); font-size: .85rem; color: #e2e8f0; display: flex; flex-direction: column; gap: .15rem; direction: ltr; text-align: left; overflow-wrap: anywhere; }
.bn-twrap { overflow-x: auto; padding-bottom: .2rem; direction: ltr; }
.bn-node { display: inline-flex; flex-direction: column; align-items: center; gap: .25rem; padding: .25rem .3rem .3rem; border: 1px solid rgba(56, 189, 248, .45); border-radius: .5rem; background: rgba(56, 189, 248, .06); vertical-align: top; }
.bn-nl { font-size: .72rem; font-weight: 700; color: #7dd3fc; white-space: nowrap; }
.bn-kids { display: flex; gap: .25rem; align-items: flex-start; }
.bn-leaf { display: inline-block; min-width: 1.3rem; text-align: center; padding: .1rem .3rem; border-radius: .4rem; border: 1px solid #fde047; color: #fde047; font-family: var(--mono); font-weight: 800; }
.bn-ta { width: 100%; box-sizing: border-box; padding: .5rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .9rem; line-height: 1.5; resize: vertical; direction: ltr; }
.bn-ta:focus, .bn-in:focus { outline: 2px solid #38bdf8; outline-offset: 1px; }
.bn-live:empty { display: none; }
.bn-live { margin: .4rem 0; }
.bn-live > p { margin: 0 0 .3rem; }
.bn-err { font-size: .88rem; color: #fda4af; }
.bn-task > .bl-btn { margin-top: .5rem; }
.bn-task .bn-figs { margin-top: .4rem; }
.bn-tab { border-collapse: collapse; font-size: .86rem; direction: ltr; }
.bn-tab th, .bn-tab td { border: 1px solid rgba(148, 163, 184, .28); padding: .28rem .55rem; text-align: start; }
.bn-tab thead th { background: #16213a; color: #f1f5f9; font-size: .8rem; }
.bn-tab td.is-ok { color: #4ade80; font-weight: 700; }
.bn-tab td.is-no { color: #fb7185; font-weight: 700; background: rgba(251, 113, 133, .1); }
.bn-row { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.bn-in { flex: 1 1 12rem; min-width: 0; padding: .45rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .95rem; direction: ltr; }
.bn-sel { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: #e2e8f0; }
.bn-sel select { padding: .35rem .4rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .35); background: #060b16; color: #f8fafc; font: inherit; max-width: 12rem; }
.bn-res { font-weight: 700; }
.bn-res.is-ok { color: #4ade80; }
.bn-res.is-no { color: #fb7185; }
@container (max-width: 520px) { .bn .bn-list .bn-str { min-width: 0; flex: 1 1 100%; } .bn .bn-form { font-size: 1rem; } }
html[data-theme="light"] .bn .bn-panel, html[data-theme="light"] .bn .bn-bnf, html[data-theme="light"] .bn .bn-list li, html[data-theme="light"] .bn .bn-form, html[data-theme="light"] .bn .bn-ta, html[data-theme="light"] .bn .bn-in, html[data-theme="light"] .bn .bn-tab th, html[data-theme="light"] .bn .bn-tab td, html[data-theme="light"] .bn .bn-sel select { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .bn .bn-task { border-color: rgba(253, 224, 71, .45); }
html[data-theme="light"] .bn .bn-node { border-color: rgba(56, 189, 248, .45); }
html[data-theme="light"] .bn .bn-leaf { border-color: #fde047; }

/* ===== packets: Packet Switching (/code/labs/packets, web/static/js/labs/packets.js). The bench stays dark in both themes; the map is canvas. ===== */
.nw-lab .bl-board-wrap, .nw-lab .bl-read, .nw-lab .bl-controls, .nw-lab .bl-data { display: none !important; }
.nw { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.nw h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.nw h4 { margin: 0 0 .35rem; font-size: .8rem; font-weight: 800; color: #e2e8f0; text-transform: uppercase; letter-spacing: .05em; text-align: center; }
.nw-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.nw-task { border-color: rgba(253, 224, 71, .45); }
.nw-msg:empty { display: none; }
.nw-line { margin: 0; font-size: .95rem; }
.nw-cap { margin: .45rem 0 0; font-size: .84rem; color: #e2e8f0; }
.nw-dn { color: #fca5a5; }
.nw-bad { color: #fb7185; font-weight: 800; }
.nw-mapw { direction: ltr; }
.nw-map { display: block; width: 100%; max-width: 650px; height: auto; margin: 0 auto; }
.nw-pks { display: flex; flex-wrap: wrap; gap: .5rem; }
.nw-pkw { border-radius: .6rem; opacity: .75; }
.nw-pkw.is-now { opacity: 1; box-shadow: 0 0 0 2px #fde047; }
.nw-pkw.is-done { opacity: .5; }
.nw-pk { display: grid; grid-template-columns: auto auto auto; gap: 1px; border-radius: .55rem; overflow: hidden; border: 2px solid var(--c); background: var(--c); font-size: .74rem; direction: ltr; text-align: left; }
.nw-h { padding: .2rem .4rem; background: #111c30; color: #e2e8f0; white-space: nowrap; }
.nw-h b { display: block; font-size: .7rem; color: #e2e8f0; font-weight: 700; }
.nw-pay { grid-column: 1 / -1; padding: .3rem .45rem; background: #060b16; font-family: var(--mono); font-size: 1.05rem; font-weight: 800; color: #f8fafc; letter-spacing: .06em; }
.nw-tr { grid-column: 1 / -1; padding: .15rem .45rem; background: #111c30; color: #e2e8f0; font-size: .74rem; white-space: nowrap; }
.nw-tr b { color: #e2e8f0; margin-inline-end: .3rem; }
.nw-twrap { overflow-x: auto; }
.nw-tab { border-collapse: collapse; font-size: .86rem; min-width: 100%; }
.nw-tab th { text-align: left; padding: .3rem .5rem; font-size: .76rem; color: #e2e8f0; font-weight: 700; border-bottom: 1px solid rgba(148, 163, 184, .3); }
.nw-tab td { padding: .3rem .5rem; border-bottom: 1px solid rgba(148, 163, 184, .12); white-space: nowrap; }
.nw-go { padding: .25rem .6rem; font-size: .8rem; }
.nw-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--c); margin-inline-end: .35rem; vertical-align: -1px; }
.nw-pkb { position: relative; display: flex; flex-direction: column; gap: .2rem; padding: 0; border: 0; background: none; cursor: pointer; color: inherit; font: inherit; border-radius: .6rem; }
.nw-pkb:hover:not(:disabled) .nw-pk, .nw-pkb:focus-visible .nw-pk { box-shadow: 0 0 0 2px #fde047; }
.nw-pkb.is-used { opacity: .35; cursor: default; }
.nw-t, .nw-again { font-size: .74rem; color: #e2e8f0; }
.nw-again { color: #fde047; font-weight: 700; }
.nw-ask { margin-top: .6rem; }
.nw-out { display: flex; flex-wrap: wrap; gap: .3rem; direction: ltr; }
.nw-slot { display: inline-flex; align-items: baseline; gap: .25rem; padding: .3rem .5rem; border-radius: .45rem; border: 1px dashed rgba(148, 163, 184, .4); font-family: var(--mono); font-size: 1.05rem; font-weight: 800; color: #e2e8f0; }
.nw-slot small { font-family: system-ui, sans-serif; font-size: .7rem; color: #e2e8f0; font-weight: 700; }
.nw-slot.is-in { border-style: solid; border-color: #4ade80; color: #f8fafc; background: rgba(74, 222, 128, .1); }
.nw-layers { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(0, 1.6fr) minmax(7rem, 1fr); gap: .7rem; align-items: start; }
.nw-stack { display: flex; flex-direction: column; gap: .35rem; }
.nw-layer { padding: .55rem .5rem; border-radius: .5rem; border: 1px solid rgba(56, 189, 248, .45); background: #0f2a3d; color: #e0f2fe; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; }
.nw-layer:hover, .nw-layer:focus-visible { border-color: #fde047; }
.nw-layer.is-done { background: rgba(74, 222, 128, .16); border-color: #4ade80; color: #bbf7d0; }
.nw-frame { display: flex; flex-wrap: wrap; gap: 2px; margin-top: .3rem; direction: ltr; }
.nw-hd { padding: .3rem .45rem; border-radius: .35rem; font-size: .76rem; font-weight: 700; color: #0b1220; }
.nw-hd-link { background: #fbbf24; }
.nw-hd-internet { background: #c084fc; }
.nw-hd-transport { background: #38bdf8; }
.nw-data { background: #e2e8f0; font-family: var(--mono); }
.nw-did { margin: .6rem 0 0; font-size: .86rem; color: #e2e8f0; }
.nw-sort { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.nw-sort li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .7rem; padding: .4rem .55rem; border-radius: .55rem; background: #0f1729; border: 1px solid rgba(148, 163, 184, .18); font-size: .9rem; }
.nw-sort li > span:first-child { flex: 1 1 14rem; }
.nw-sort li.is-circuit { border-color: rgba(251, 191, 36, .6); }
.nw-sort li.is-packet { border-color: rgba(56, 189, 248, .6); }
.nw-sbtn { display: inline-flex; gap: .35rem; }
.nw-sbtn .bl-btn[aria-pressed="true"] { background: rgba(74, 222, 128, .2); border-color: #4ade80; color: #bbf7d0; }
.nw-chips { display: flex; flex-wrap: wrap; gap: .35rem; direction: ltr; }
.nw-chip[aria-pressed="true"] { background: rgba(248, 113, 113, .2); border-color: #f87171; color: #fecaca; }
html[data-theme="light"] .nw .nw-panel, html[data-theme="light"] .nw .nw-h, html[data-theme="light"] .nw .nw-tab th, html[data-theme="light"] .nw .nw-tab td, html[data-theme="light"] .nw .nw-sort li, html[data-theme="light"] .nw .nw-slot, html[data-theme="light"] .nw .nw-layer { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .nw .nw-task { border-color: rgba(253, 224, 71, .45); } html[data-theme="light"] .nw .nw-pk { border-color: var(--c); }
html[data-theme="light"] .nw .nw-layer { border-color: rgba(56, 189, 248, .45); } html[data-theme="light"] .nw .nw-layer.is-done, html[data-theme="light"] .nw .nw-slot.is-in { border-color: #4ade80; }
html[data-theme="light"] .nw .nw-sort li.is-circuit { border-color: rgba(251, 191, 36, .6); } html[data-theme="light"] .nw .nw-sort li.is-packet { border-color: rgba(56, 189, 248, .6); }
@container (max-width: 520px) { .nw-layers { grid-template-columns: 1fr 1fr; } .nw-mid { grid-column: 1 / -1; grid-row: 2; } }

/* ===== ipaddr: IP Addresses (/code/labs/ipaddr, web/static/js/labs/ipaddr.js). The bench stays dark in both themes. ===== */
.ia-lab .bl-board-wrap, .ia-lab .bl-read, .ia-lab .bl-controls, .ia-lab .bl-data { display: none !important; }
.ia { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.ia h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.ia-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.ia-task { border-color: rgba(253, 224, 71, .45); }
.ia-msg:empty { display: none; }
.ia-addr { font-family: var(--mono); font-weight: 700; color: #f8fafc; overflow-wrap: anywhere; direction: ltr; unicode-bidi: isolate; }
.ia-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.ia-list > li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; padding: .45rem .55rem; border-radius: .55rem; background: #0f1729; border: 1px solid rgba(148, 163, 184, .18); min-width: 0; }
.ia-list > li.ia-col { flex-direction: column; align-items: stretch; }
.ia-list > li > .ia-addr { min-width: 12rem; flex: 1 1 12rem; font-size: .98rem; }
.ia-txt { flex: 1 1 14rem; font-size: .92rem; }
.ia-given { margin: 0; font-size: .9rem; }
.ia-btns { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.ia-btns .bl-btn[aria-pressed="true"] { background: rgba(56, 189, 248, .2); border-color: #38bdf8; color: #e0f2fe; }
.ia-why { flex: 1 1 100%; margin: .3rem 0 0; font-size: .85rem; }
.ia-why.is-ok { color: #86efac; }
.ia-why.is-no { color: #fda4af; }
.ia-cap { margin: .45rem 0 0; font-size: .84rem; color: #e2e8f0; }
.ia-in { width: 100%; box-sizing: border-box; padding: .45rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: 1rem; direction: ltr; text-align: left; }
.ia-in:focus { outline: 2px solid #38bdf8; outline-offset: 1px; }
.ia-in.is-ok { border-color: #4ade80; background: rgba(74, 222, 128, .08); }
.ia-ids { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.ia-ids label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; font-weight: 700; color: #e2e8f0; }
.ia-live { min-width: 0; }
.ia-bin { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; padding: .45rem .5rem; border-radius: .5rem; background: #060b16; overflow-x: auto; direction: ltr; }
.ia-row { display: grid; grid-template-columns: 7.5rem auto 1fr; align-items: center; gap: .6rem; }
.ia-rl { font-size: .76rem; font-weight: 700; color: #e2e8f0; }
.ia-row.is-ok .ia-rl { color: #86efac; }
.ia-bits { font-family: var(--mono); font-size: .86rem; white-space: nowrap; letter-spacing: .02em; }
.ia-b.is-net { color: #7dd3fc; }
.ia-b.is-host { color: #fdba74; }
.ia-mask .ia-b { color: #e2e8f0; }
.ia-mask .ia-b.is-net { color: #e2e8f0; font-weight: 700; }
.ia-b.is-bad { background: rgba(251, 113, 133, .3); color: #fecdd3; border-radius: 2px; }
.ia-dot { color: #e2e8f0; }
.ia-den { font-family: var(--mono); font-size: .86rem; font-weight: 700; color: #f8fafc; }
.ia-g6 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; margin-top: .45rem; direction: ltr; }
.ia-g { display: flex; flex-direction: column; align-items: center; padding: .25rem .2rem; border-radius: .4rem; border: 1px solid rgba(74, 222, 128, .5); background: rgba(74, 222, 128, .07); }
.ia-g.is-bad { border-color: #fb7185; background: rgba(251, 113, 133, .12); }
.ia-g b { font-family: var(--mono); font-size: .95rem; color: #f8fafc; }
.ia-g small { font-family: var(--mono); font-size: .62rem; color: #e2e8f0; white-space: nowrap; }
@container (max-width: 560px) {
  .ia-row { grid-template-columns: 1fr auto; gap: .1rem .5rem; }
  .ia-rl { grid-column: 1; grid-row: 1; }
  .ia-den { grid-column: 2; grid-row: 1; }
  .ia-bits { grid-column: 1 / -1; font-size: .74rem; }
  .ia-g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ia-g small { font-size: .7rem; }
  .ia-ids { grid-template-columns: 1fr; }
  .ia-in { font-size: .9rem; }
}
html[data-theme="light"] .ia .ia-panel, html[data-theme="light"] .ia .ia-list > li, html[data-theme="light"] .ia .ia-in { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .ia .ia-task { border-color: rgba(253, 224, 71, .45); } html[data-theme="light"] .ia .ia-in.is-ok { border-color: #4ade80; }
html[data-theme="light"] .ia .ia-g { border-color: rgba(74, 222, 128, .5); } html[data-theme="light"] .ia .ia-g.is-bad { border-color: #fb7185; }

/* ===== tls: Secure Connections (/code/labs/tls, web/static/js/labs/tls.js). The bench stays dark in both themes. ===== */
.sx-lab .bl-board-wrap, .sx-lab .bl-read, .sx-lab .bl-controls, .sx-lab .bl-data { display: none !important; }
.sx { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.sx h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.sx-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.sx-task { border-color: rgba(253, 224, 71, .45); }
.sx-msgbox:empty { display: none; }
.sx-cap { margin: .4rem 0 0; font-size: .84rem; color: #e2e8f0; }
.sx-bad { color: #fb7185; font-weight: 800; }
.sx-pool { display: flex; flex-direction: column; gap: .4rem; }
.sx-step { text-align: start; padding: .5rem .65rem; border-radius: .55rem; border: 1px solid rgba(56, 189, 248, .4); background: #0f2a3d; color: #e0f2fe; font: inherit; font-size: .9rem; cursor: pointer; }
.sx-step:hover, .sx-step:focus-visible { border-color: #fde047; }
.sx-done { margin: 0; padding-inline-start: 1.4rem; display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.sx-seq { display: flex; flex-direction: column; gap: .3rem; }
.sx-actors { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); text-align: center; }
.sx-actor { justify-self: center; padding: .3rem .8rem; border-radius: .5rem; background: #1e293b; border: 1px solid #64748b; font-weight: 800; font-size: .88rem; }
.sx-lanes { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-auto-rows: minmax(2.4rem, auto); row-gap: .35rem; padding: .3rem 0;
  background: linear-gradient(#475569, #475569) 25% 0 / 2px 100% no-repeat, linear-gradient(#475569, #475569) 75% 0 / 2px 100% no-repeat; }
.sx-act { justify-self: center; align-self: center; max-width: 95%; z-index: 1; padding: .3rem .5rem; border-radius: .45rem; background: #1a2238; border: 1px solid rgba(192, 132, 252, .55); font-size: .8rem; text-align: center; }
.sx-act b, .sx-lbl b { display: inline-block; min-width: 1.2rem; padding: 0 .25rem; margin-inline-end: .2rem; border-radius: .3rem; background: #fde047; color: #0b1220; font-size: .72rem; }
.sx-msg { display: flex; flex-direction: column; justify-content: center; padding-inline: 25%; z-index: 1; }
.sx-lbl { font-size: .8rem; text-align: center; padding: 0 .3rem .15rem; }
.sx-arrow { position: relative; height: 3px; background: #38bdf8; border-radius: 2px; }
.sx-arrow::after { content: ""; position: absolute; top: -5px; border: 6.5px solid transparent; }
.sx-msg.to-r .sx-arrow::after { right: -3px; border-left: 10px solid #38bdf8; border-right: 0; }
.sx-msg.to-l .sx-arrow::after { left: -3px; border-right: 10px solid #38bdf8; border-left: 0; }
.sx-key { display: block; margin-top: .15rem; font-size: .72rem; font-weight: 700; color: #fde047; }
.sx-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.sx-list > li { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .7rem; padding: .5rem .6rem; border-radius: .6rem; background: #0f1729; border: 1px solid rgba(148, 163, 184, .18); min-width: 0; }
.sx-txt { flex: 1 1 14rem; font-size: .92rem; }
.sx-visit { flex: 1 1 100%; margin: 0; font-size: .9rem; }
.sx-btns { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.sx-btns .bl-btn[aria-pressed="true"] { background: rgba(56, 189, 248, .2); border-color: #38bdf8; color: #e0f2fe; }
.sx-why { flex: 1 1 100%; margin: 0; font-size: .86rem; }
.sx-why.is-ok { color: #86efac; }
.sx-why.is-no { color: #fda4af; }
.sx-ca { display: inline-block; padding: .1rem .45rem; border-radius: .35rem; background: rgba(74, 222, 128, .12); border: 1px solid rgba(74, 222, 128, .4); color: #bbf7d0; font-weight: 700; font-size: .8rem; }
.sx-cert { flex: 1 1 100%; max-width: 30rem; border-radius: .55rem; border: 1px solid rgba(253, 224, 71, .35); background: #fefce8; color: #1e293b; overflow: hidden; font-size: .84rem; }
.sx-ch { padding: .3rem .6rem; background: #fde68a; font-weight: 800; color: #713f12; }
.sx-f { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .5rem; padding: .22rem .6rem; border-top: 1px solid rgba(113, 63, 18, .12); }
.sx-f span { color: #e2e8f0; font-size: .78rem; }
.sx-f b { font-family: var(--mono); font-size: .82rem; overflow-wrap: anywhere; direction: ltr; text-align: start; }
.sx-f.is-bad { background: #fee2e2; } .sx-f.is-bad b { color: #b91c1c; }
.sx-checks { flex: 1 1 100%; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; font-size: .84rem; }
.sx-checks li { display: flex; gap: .4rem; align-items: baseline; }
.sx-checks li.is-ok { color: #e2e8f0; } .sx-checks li.is-no { color: #fda4af; }
.sx-i { font-weight: 800; } .sx-checks li.is-ok .sx-i { color: #4ade80; }
.sx-dg { display: flex; flex-direction: column; gap: .15rem; margin-top: .3rem; padding: .35rem .5rem; border-radius: .45rem; background: #060b16; color: #e2e8f0; font-size: .8rem; }
.sx-dg b { font-family: var(--mono); color: #f8fafc; margin-inline-start: .3rem; }
.sx-dg b.is-bad { color: #fb7185; }
.sx-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .5rem; }
.sx-edit label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; font-weight: 700; color: #e2e8f0; }
.sx-in { padding: .4rem .55rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .9rem; }
@container (max-width: 520px) { .sx-f { grid-template-columns: 1fr; gap: 0; } .sx-act, .sx-lbl { font-size: .74rem; } .sx-msg { padding-inline: 22%; } }
html[data-theme="light"] .sx .sx-panel, html[data-theme="light"] .sx .sx-list > li, html[data-theme="light"] .sx .sx-in, html[data-theme="light"] .sx .sx-actor { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .sx .sx-task { border-color: rgba(253, 224, 71, .45); } html[data-theme="light"] .sx .sx-step { border-color: rgba(56, 189, 248, .4); }
html[data-theme="light"] .sx .sx-act { border-color: rgba(192, 132, 252, .55); } html[data-theme="light"] .sx .sx-ca { border-color: rgba(74, 222, 128, .4); }
html[data-theme="light"] .sx .sx-cert { border-color: rgba(253, 224, 71, .35); } html[data-theme="light"] .sx .sx-f { border-color: rgba(113, 63, 18, .12); }
.sx-chg { display: block; font-family: system-ui, sans-serif; font-style: normal; font-weight: 700; font-size: .74rem; color: #b91c1c; }

/* ===== bigo: Big O (/code/labs/bigo, web/static/js/labs/bigo.js). The bench stays dark in both themes; the chart is canvas. ===== */
.ox-lab .bl-board-wrap, .ox-lab .bl-read, .ox-lab .bl-controls, .ox-lab .bl-data { display: none !important; }
.ox { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.ox h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.ox .ox-h3b { margin-top: .8rem; }
.ox-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.ox-task { border-color: rgba(253, 224, 71, .45); }
.ox-msg:empty { display: none; }
.ox-cap { margin: .45rem 0 0; font-size: .84rem; color: #e2e8f0; }
.ox-runs { display: flex; flex-wrap: wrap; gap: .4rem; }
.ox-runs .bl-btn[aria-pressed="true"] { background: rgba(74, 222, 128, .15); border-color: #4ade80; color: #bbf7d0; }
.ox-play { margin-top: .5rem; }
.ox-now { margin: 0 0 .4rem; font-size: .9rem; }
.ox-count { font-family: var(--mono); font-size: 1.1rem; color: #fde047; }
.ox-strip { display: flex; flex-wrap: wrap; gap: 3px; direction: ltr; }
.ox-cell { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9rem; height: 1.6rem; padding: 0 .15rem; border-radius: .3rem; background: #1e293b; border: 1px solid #334155; font-family: var(--mono); font-size: .72rem; color: #e2e8f0; box-sizing: border-box; }
.ox-strip.is-small .ox-cell { min-width: 1.05rem; height: 1.05rem; font-size: 0; padding: 0; }
.ox-cell.is-hit { background: rgba(253, 224, 71, .22); border-color: rgba(253, 224, 71, .6); color: #fef9c3; }
.ox-cell.is-now { background: #fde047; border-color: #fde047; color: #0b1220; }
.ox-twrap { overflow-x: auto; }
.ox-tab { border-collapse: collapse; font-size: .88rem; min-width: 60%; }
.ox-tab th { text-align: start; padding: .3rem .6rem; font-size: .76rem; color: #e2e8f0; border-bottom: 1px solid rgba(148, 163, 184, .3); }
.ox-tab td { padding: .3rem .6rem; border-bottom: 1px solid rgba(148, 163, 184, .12); font-family: var(--mono); white-space: nowrap; }
.ox-tab td small { font-family: system-ui, sans-serif; color: #e2e8f0; }
.ox-cw { margin-top: .6rem; }
.ox-chart { display: block; width: 100%; max-width: 620px; height: auto; }
.ox-pred { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; margin-bottom: .45rem; font-size: .9rem; }
.ox-pred span { flex: 1 1 12rem; }
.ox-in { padding: .4rem .55rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .95rem; min-width: 0; }
.ox-pred .ox-in { width: 9rem; }
.ox-in.is-ok { border-color: #4ade80; background: rgba(74, 222, 128, .08); }
.ox-bigs { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.ox-big { font-family: var(--mono); font-weight: 800; }
.ox-big[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 22%, transparent); border-color: var(--c); color: #f8fafc; }
.ox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.ox-list > li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; padding: .45rem .55rem; border-radius: .55rem; background: #0f1729; border: 1px solid rgba(148, 163, 184, .18); }
.ox-txt { flex: 1 1 14rem; font-size: .92rem; }
.ox-why { flex: 1 1 100%; margin: 0; font-size: .85rem; }
.ox-why.is-ok { color: #86efac; } .ox-why.is-no { color: #fda4af; }
.ox-free { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .5rem; align-items: end; }
.ox-free label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; font-weight: 700; color: #e2e8f0; }
.ox-go { justify-self: start; }
.ox select.ox-in, .ox-tab td.ox-alg { font-family: inherit; }
html[data-theme="light"] .ox .ox-panel, html[data-theme="light"] .ox .ox-list > li, html[data-theme="light"] .ox .ox-in, html[data-theme="light"] .ox .ox-cell { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .ox .ox-task { border-color: rgba(253, 224, 71, .45); } html[data-theme="light"] .ox .ox-in.is-ok { border-color: #4ade80; }
html[data-theme="light"] .ox .ox-cell.is-hit { border-color: rgba(253, 224, 71, .6); } html[data-theme="light"] .ox .ox-cell.is-now { border-color: #fde047; }
html[data-theme="light"] .ox .ox-runs .bl-btn[aria-pressed="true"] { border-color: #4ade80; } html[data-theme="light"] .ox .ox-big[aria-pressed="true"] { border-color: var(--c); }

/* ===== recursion: Recursion and the Call Stack (/code/labs/recursion, web/static/js/labs/recursion.js). The bench stays dark in both themes. ===== */
.rx-lab .bl-board-wrap, .rx-lab .bl-read, .rx-lab .bl-controls, .rx-lab .bl-data { display: none !important; }
.rx { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.rx h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.rx-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.rx-task { border-color: rgba(253, 224, 71, .45); }
.rx-msg:empty { display: none; }
.rx-cap { margin: .45rem 0 0; font-size: .82rem; color: #e2e8f0; }
.rx-cap:empty { display: none; }
.rx-bad { color: #fb7185; font-weight: 800; }
.rx-do { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.rx-row { display: flex; align-items: center; gap: .5rem; margin: 0; min-width: 0; }
.rx-sig { font-family: var(--mono); font-size: .95rem; font-weight: 700; display: inline-flex; align-items: center; gap: .1rem; direction: ltr; }
.rx-in { padding: .38rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .95rem; min-width: 0; }
.rx-arg { width: 8.5rem; } .rx-val { width: 6.5rem; }
.rx-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: .7rem; }
.rx-stack { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.rx-stack li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; padding: .35rem .55rem; border-radius: .5rem; background: #13203a; border: 1px solid rgba(56, 189, 248, .35); }
.rx-stack li.is-top { background: rgba(253, 224, 71, .14); border-color: #fde047; }
.rx-fr { font-weight: 800; color: #7dd3fc; }
.rx-stack li.is-top .rx-fr { color: #fde047; }
.rx-args { font-family: var(--mono); font-size: .86rem; color: #f8fafc; direction: ltr; unicode-bidi: isolate; }
.rx-st { flex: 1 1 100%; font-size: .76rem; color: #e2e8f0; }
.rx-stack li.is-top .rx-st { color: #fef3c7; }
.rx-code { margin: 0; padding: .5rem .55rem; border-radius: .5rem; background: #060b16; font-family: var(--mono); font-size: .76rem; line-height: 1.55; overflow-x: auto; direction: ltr; text-align: left; white-space: pre; }
.rx-ln { display: inline-block; min-width: 100%; color: #e2e8f0; border-radius: .2rem; }
.rx-ln.is-now { background: rgba(253, 224, 71, .2); color: #fef9c3; }
.rx-tree, .rx-tree ul { list-style: none; margin: 0; padding-inline-start: 1.1rem; }
.rx-tree { padding: 0; direction: ltr; text-align: left; }
.rx-tree li { position: relative; padding: .12rem 0; }
.rx-tree ul li::before { content: ""; position: absolute; left: -.75rem; top: .9rem; width: .55rem; border-top: 1px solid #475569; }
.rx-tree ul { border-left: 1px solid #475569; margin-left: .35rem; }
.rx-node { display: inline-block; padding: .12rem .45rem; border-radius: .4rem; font-family: var(--mono); font-size: .82rem; background: #13203a; border: 1px solid rgba(148, 163, 184, .3); }
.rx-node.is-now { border-color: #fde047; color: #fef9c3; }
.rx-node.is-done { border-color: rgba(74, 222, 128, .5); }
.rx-node b { color: #86efac; }
.rx-arr { display: flex; flex-wrap: wrap; gap: 3px; direction: ltr; }
.rx-cell { display: inline-flex; flex-direction: column; align-items: center; min-width: 2.3rem; padding: .15rem .2rem; border-radius: .35rem; background: #111827; border: 1px solid #1f2937; color: #475569; font-family: var(--mono); font-weight: 700; font-size: .88rem; }
.rx-cell small { font-size: .66rem; color: #e2e8f0; font-weight: 600; }
.rx-cell em { font-style: normal; font-family: system-ui, sans-serif; font-size: .64rem; color: #fde047; min-height: .8rem; }
.rx-cell.is-in { background: #13203a; border-color: rgba(56, 189, 248, .45); color: #e0f2fe; }
.rx-cell.is-mid { background: rgba(253, 224, 71, .2); border-color: #fde047; color: #fef9c3; }
.rx-free { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .5rem; }
.rx-free label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; font-weight: 700; color: #e2e8f0; }
.rx-free select.rx-in { font-family: inherit; }
.rx-btns { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
@container (max-width: 620px) { .rx-grid { grid-template-columns: 1fr; } }
html[data-theme="light"] .rx .rx-panel, html[data-theme="light"] .rx .rx-in, html[data-theme="light"] .rx .rx-node, html[data-theme="light"] .rx .rx-cell { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .rx .rx-task { border-color: rgba(253, 224, 71, .45); } html[data-theme="light"] .rx .rx-stack li { border-color: rgba(56, 189, 248, .35); }
html[data-theme="light"] .rx .rx-stack li.is-top, html[data-theme="light"] .rx .rx-node.is-now, html[data-theme="light"] .rx .rx-cell.is-mid { border-color: #fde047; }
html[data-theme="light"] .rx .rx-node.is-done { border-color: rgba(74, 222, 128, .5); } html[data-theme="light"] .rx .rx-cell.is-in { border-color: rgba(56, 189, 248, .45); }

/* ===== files: Serial and Sequential Files (/code/labs/files, web/static/js/labs/files.js). The bench stays dark in both themes. ===== */
.fz-lab .bl-board-wrap, .fz-lab .bl-read, .fz-lab .bl-controls, .fz-lab .bl-data { display: none !important; }
.fz { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.fz h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.fz-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.fz-task { border-color: rgba(251, 191, 36, .45); }
.fz-msg:empty { display: none; }
.fz-cap { margin: 0 0 .45rem; font-size: .84rem; color: #e2e8f0; }
.fz-card { padding: .45rem .65rem; border-radius: .6rem; background: rgba(251, 191, 36, .1); border: 1px solid rgba(251, 191, 36, .4); color: #fef3c7; margin: 0; }
.fz-t { font-family: var(--mono); color: #fbbf24; }
.fz-bad { color: #fb7185; font-weight: 800; }
.fz-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.fz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.fz-file { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.fz-rec { display: flex; align-items: center; gap: .6rem; padding: .3rem .55rem; border-radius: .45rem; background: #13203a; border: 1px solid rgba(56, 189, 248, .3); min-height: 2rem; }
.fz-key { font-family: var(--mono); font-weight: 800; color: #7dd3fc; min-width: 2.6rem; direction: ltr; unicode-bidi: isolate; }
.fz-name { flex: 1; min-width: 0; color: #f1f5f9; }
.fz-rec em { font-style: normal; font-size: .72rem; font-weight: 700; color: #fde68a; }
.fz-rec.is-hidden { background: #0f172a; border-style: dashed; border-color: rgba(148, 163, 184, .3); }
.fz-rec.is-hidden .fz-key, .fz-rec.is-hidden .fz-name { color: #e2e8f0; }
.fz-rec.is-read { opacity: .8; }
.fz-rec.is-cur, .fz-rec.is-next { border-color: #fbbf24; border-style: solid; background: rgba(251, 191, 36, .12); }
.fz-rec.is-hit { border-color: #4ade80; background: rgba(74, 222, 128, .14); }
.fz-rec.is-hit .fz-key { color: #86efac; }
.fz-rec.is-skip { border-color: rgba(251, 113, 133, .55); background: rgba(251, 113, 133, .08); }
.fz-rec.is-skip .fz-name, .fz-rec.is-skip .fz-key { text-decoration: line-through; color: #fda4af; }
.fz-eof, .fz-empty { padding: .25rem .55rem; border-radius: .45rem; font-size: .76rem; color: #e2e8f0; border: 1px dashed rgba(148, 163, 184, .3); text-align: center; }
.fz-eof.is-next { border-color: #fbbf24; color: #fde68a; border-style: solid; }
.fz-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.fz-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.fz-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.fz-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.fz-cat[aria-pressed="true"] { background: rgba(251, 191, 36, .22); border-color: #fbbf24; color: #fef3c7; }
.fz-why { margin: .4rem 0 0; font-size: .8rem; } .fz-why.is-ok { color: #86efac; } .fz-why.is-no { color: #fda4af; }
.fz-free { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .5rem; margin-bottom: .55rem; }
.fz-free label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; font-weight: 700; color: #e2e8f0; }
.fz-in { padding: .38rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-size: .95rem; font-family: inherit; min-width: 0; }
@container (max-width: 520px) { .fz-grid { grid-template-columns: 1fr; } }
html[data-theme="light"] .fz .fz-panel, html[data-theme="light"] .fz .fz-in, html[data-theme="light"] .fz .fz-eof, html[data-theme="light"] .fz .fz-empty, html[data-theme="light"] .fz .fz-rec.is-hidden { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .fz .fz-task, html[data-theme="light"] .fz .fz-card { border-color: rgba(251, 191, 36, .45); } html[data-theme="light"] .fz .fz-rec { border-color: rgba(56, 189, 248, .3); }
html[data-theme="light"] .fz .fz-rec.is-cur, html[data-theme="light"] .fz .fz-rec.is-next, html[data-theme="light"] .fz .fz-eof.is-next, html[data-theme="light"] .fz .fz-cat[aria-pressed="true"] { border-color: #fbbf24; }
html[data-theme="light"] .fz .fz-rec.is-hit { border-color: #4ade80; } html[data-theme="light"] .fz .fz-rec.is-skip { border-color: rgba(251, 113, 133, .55); }

/* ===== datatypes: User-Defined Data Types (/code/labs/datatypes, web/static/js/labs/datatypes.js). The bench stays dark in both themes. ===== */
.ut-lab .bl-board-wrap, .ut-lab .bl-read, .ut-lab .bl-controls, .ut-lab .bl-data { display: none !important; }
.ut { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.ut h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.ut .ut-h3b { margin-top: .7rem; }
.ut-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.ut-task { border-color: rgba(34, 211, 238, .45); }
.ut-msg:empty { display: none; }
.ut-cap { margin: .4rem 0 0; font-size: .82rem; color: #e2e8f0; }
.ut-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: .7rem; align-items: start; }
.ut-col { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.ut-code { width: 100%; box-sizing: border-box; resize: vertical; padding: .55rem .6rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .86rem; line-height: 1.5; tab-size: 3; white-space: pre-wrap; overflow-wrap: anywhere; direction: ltr; text-align: left; }
.ut-dup { flex-basis: 100%; margin: 0; }
.ut-code:focus { outline: 2px solid #22d3ee; outline-offset: 1px; }
.ut-errs { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.ut-errs li { padding: .4rem .55rem; border-radius: .45rem; background: rgba(251, 113, 133, .1); border: 1px solid rgba(251, 113, 133, .45); font-size: .82rem; color: #fecdd3; overflow-wrap: anywhere; }
.ut-errs b { color: #fda4af; }
.ut-errs code { font-family: var(--mono); color: #f8fafc; direction: ltr; unicode-bidi: isolate; }
.ut-okline { color: #86efac; }
.ut-need { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
.ut-need li { display: flex; gap: .45rem; color: #e2e8f0; }
.ut-need li span { color: #e2e8f0; font-weight: 800; }
.ut-need li.is-ok { color: #bbf7d0; } .ut-need li.is-ok span { color: #4ade80; }
.ut-types { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.ut-type { padding: .45rem .55rem; border-radius: .55rem; background: #111a2e; border: 1px solid rgba(148, 163, 184, .3); }
.ut-th { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.ut-th b { font-family: var(--mono); color: #f8fafc; direction: ltr; }
.ut-th span { font-size: .72rem; font-weight: 700; color: #e2e8f0; text-transform: uppercase; letter-spacing: .03em; }
.ut-type.is-enum { border-color: rgba(250, 204, 21, .45); } .ut-type.is-enum .ut-th span { color: #fde68a; }
.ut-type.is-record { border-color: rgba(34, 211, 238, .45); } .ut-type.is-record .ut-th span { color: #a5f3fc; }
.ut-type.is-pointer { border-color: rgba(244, 114, 182, .45); } .ut-type.is-pointer .ut-th span { color: #fbcfe8; }
.ut-type.is-set { border-color: rgba(74, 222, 128, .45); } .ut-type.is-set .ut-th span { color: #bbf7d0; }
.ut-enum { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; direction: ltr; }
.ut-enum li { display: inline-flex; align-items: baseline; gap: .3rem; padding: .15rem .45rem; border-radius: .4rem; background: rgba(250, 204, 21, .12); font-family: var(--mono); font-size: .84rem; color: #fef9c3; }
.ut-enum small { font-size: .66rem; color: #fde047; }
.ut-fields { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; direction: ltr; }
.ut-fields li { display: flex; justify-content: space-between; gap: .6rem; padding: .15rem .45rem; border-radius: .35rem; background: rgba(34, 211, 238, .08); font-family: var(--mono); font-size: .82rem; }
.ut-fields b { color: #67e8f9; font-weight: 700; }
.ut-set { margin: .3rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.ut-set > b { font-family: var(--mono); }
.ut-el { display: inline-block; padding: .1rem .45rem; border-radius: 999px; border: 1px solid rgba(74, 222, 128, .55); font-family: var(--mono); font-size: .84rem; color: #dcfce7; direction: ltr; }
.ut-mem { width: 100%; border-collapse: collapse; font-size: .82rem; }
.ut-mem th { text-align: start; font-size: .72rem; color: #e2e8f0; font-weight: 700; padding: .2rem .35rem; border-bottom: 1px solid rgba(148, 163, 184, .3); }
.ut-mem td { padding: .3rem .35rem; border-bottom: 1px solid rgba(148, 163, 184, .14); vertical-align: top; overflow-wrap: anywhere; }
.ut-mem td:nth-child(3) { font-family: var(--mono); direction: ltr; }
.ut-mem td:nth-child(2) { overflow-wrap: normal; }
.ut-mem td small { display: block; font-size: .72rem; color: #e2e8f0; }
.ut-addr { font-family: var(--mono); color: #f9a8d4; }
.ut-mem tr.is-pointed td { background: rgba(244, 114, 182, .1); }
.ut-ptr { color: #f9a8d4; font-weight: 700; }
.ut-none { color: #e2e8f0; font-style: italic; font-family: system-ui, sans-serif; }
.ut-fv { list-style: none; margin: 0; padding: 0; }
.ut-fv span { color: #67e8f9; }
.ut-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.ut-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.ut-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.ut-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.ut-cat[aria-pressed="true"] { background: rgba(34, 211, 238, .2); border-color: #22d3ee; color: #ecfeff; }
.ut-why { margin: .4rem 0 0; font-size: .8rem; } .ut-why.is-ok { color: #86efac; } .ut-why.is-no { color: #fda4af; }
@container (max-width: 700px) { .ut-grid { grid-template-columns: 1fr; } }
@container (max-width: 480px) { .ut-code { font-size: .78rem; } }
.ut-code { min-height: 10rem; overflow: hidden; }
html[data-theme="light"] .ut .ut-panel, html[data-theme="light"] .ut .ut-code, html[data-theme="light"] .ut .ut-type { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .ut .ut-task { border-color: rgba(34, 211, 238, .45); } html[data-theme="light"] .ut .ut-errs li { border-color: rgba(251, 113, 133, .45); }
html[data-theme="light"] .ut .ut-type.is-enum { border-color: rgba(250, 204, 21, .45); } html[data-theme="light"] .ut .ut-type.is-record { border-color: rgba(34, 211, 238, .45); }
html[data-theme="light"] .ut .ut-type.is-pointer { border-color: rgba(244, 114, 182, .45); } html[data-theme="light"] .ut .ut-type.is-set, html[data-theme="light"] .ut .ut-el { border-color: rgba(74, 222, 128, .5); }
html[data-theme="light"] .ut .ut-mem th { border-color: rgba(148, 163, 184, .3); } html[data-theme="light"] .ut .ut-mem td { border-color: rgba(148, 163, 184, .14); } html[data-theme="light"] .ut .ut-cat[aria-pressed="true"] { border-color: #22d3ee; }

/* ===== compiler: Inside a Compiler (/code/labs/compiler, web/static/js/labs/compiler.js). The bench stays dark in both themes. ===== */
.cg-lab .bl-board-wrap, .cg-lab .bl-read, .cg-lab .bl-controls, .cg-lab .bl-data { display: none !important; }
.cg { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; --kw: #c4b5fd; --op: #fda4af; --id: #7dd3fc; --lit: #86efac; }
.cg h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.cg-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.cg-task { border-color: rgba(251, 146, 60, .5); }
.cg-msg:empty { display: none; }
.cg-own { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .6rem; font-size: .78rem; font-weight: 700; color: #e2e8f0; }
.cg-in { width: 100%; box-sizing: border-box; padding: .45rem .55rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font-family: var(--mono); resize: vertical; direction: ltr; }
.cg-cap { margin: .45rem 0 0; font-size: .82rem; color: #e2e8f0; }
.cg-bad { color: #fb7185; font-weight: 800; }
.cg code, .cg-src, .cg-toks { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.cg-cur { padding: .05rem .4rem; border-radius: .35rem; background: rgba(253, 224, 71, .18); color: #fef08a; }
.cg-btns, .cg-pal { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cg-pal + .cg-cap { margin-bottom: .35rem; }
.cg-lbl { font-size: .78rem; font-weight: 700; color: #e2e8f0; }
.cg-c.is-kw { border-color: var(--kw); } .cg-c.is-op { border-color: var(--op); } .cg-c.is-id { border-color: var(--id); } .cg-c.is-lit { border-color: var(--lit); }
.cg-src { margin: 0; padding: .55rem .6rem; border-radius: .5rem; background: #060b16; font-size: .9rem; line-height: 1.8; white-space: pre-wrap; text-align: left; }
.cg-lx { padding: .05rem .2rem; border-radius: .3rem; border: 1px solid rgba(148, 163, 184, .35); color: #e2e8f0; }
.cg-lx.is-now { border-color: #fde047; background: rgba(253, 224, 71, .18); color: #fef9c3; }
.cg-lx.is-kw { border-color: var(--kw); color: var(--kw); } .cg-lx.is-op { border-color: var(--op); color: var(--op); }
.cg-lx.is-id { border-color: var(--id); color: var(--id); } .cg-lx.is-lit { border-color: var(--lit); color: var(--lit); }
.cg-cm { color: #e2e8f0; text-decoration: line-through; }
.cg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; align-items: start; }
.cg-t { width: 100%; border-collapse: collapse; font-size: .82rem; }
.cg-t th { text-align: start; font-size: .72rem; color: #e2e8f0; font-weight: 700; padding: .2rem .35rem; border-bottom: 1px solid rgba(148, 163, 184, .3); }
.cg-t td { padding: .22rem .35rem; border-bottom: 1px solid rgba(148, 163, 184, .14); vertical-align: top; }
.cg-kt { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(6.6rem, 1fr)); gap: 3px; direction: ltr; }
.cg-kt li { display: flex; justify-content: space-between; gap: .4rem; padding: .18rem .45rem; border-radius: .35rem; background: #111a2e; font-family: var(--mono); font-size: .82rem; }
.cg-kt b { color: #fdba74; }
.cg-toks { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.cg-tok { padding: .12rem .4rem; border-radius: .35rem; font-weight: 700; background: #111a2e; border: 1px solid; }
.cg-tok.is-kw { color: var(--kw); } .cg-tok.is-op { color: var(--op); } .cg-tok.is-id { color: var(--id); } .cg-tok.is-lit { color: var(--lit); }
.cg-v small { color: #e2e8f0; font-weight: 600; }
.cg-o[aria-pressed="true"], .cg-cat[aria-pressed="true"] { background: rgba(251, 146, 60, .22); border-color: #fb923c; color: #ffedd5; }
.cg-cm2 { color: #e2e8f0; font-family: var(--mono); font-size: .78rem; }
.cg-trace tr.is-err td { background: rgba(251, 113, 133, .1); }
.cg-chg { color: #fde68a; font-weight: 700; }
.cg-ok { color: #86efac; font-weight: 700; } .cg-no { color: #fda4af; font-weight: 700; }
.cg-code { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.cg-line { display: flex; align-items: baseline; gap: .6rem; width: 100%; padding: .35rem .55rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .3); background: #111a2e; color: #f1f5f9; font: inherit; text-align: start; cursor: pointer; }
.cg-line span { font-family: var(--mono); color: #e2e8f0; font-size: .78rem; }
.cg-line code { font-weight: 700; min-width: 5.5rem; }
.cg-line em { font-style: normal; color: #e2e8f0; font-family: var(--mono); font-size: .78rem; }
.cg-line.is-del { border-color: rgba(251, 113, 133, .5); background: rgba(251, 113, 133, .08); }
.cg-line.is-del code, .cg-line.is-del em { text-decoration: line-through; color: #fda4af; }
.cg-fold { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.cg-fold li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; padding: .45rem .55rem; border-radius: .55rem; background: #111a2e; direction: ltr; }
.cg-lhs { color: #f1f5f9; font-weight: 700; }
.cg-ex { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .25rem; font-family: var(--mono); font-size: 1rem; }
.cg-num { padding: .05rem .35rem; border-radius: .3rem; background: rgba(74, 222, 128, .12); color: #bbf7d0; font-family: var(--mono); }
.cg-num.is-fold { background: rgba(251, 146, 60, .25); color: #ffedd5; border: 1px solid #fb923c; }
.cg-idv { padding: .05rem .35rem; border-radius: .3rem; background: rgba(56, 189, 248, .12); color: #bae6fd; font-family: var(--mono); }
.cg-par { color: #e2e8f0; }
.cg-opb { min-width: 2.1rem; min-height: 2.1rem; border-radius: .45rem; border: 1px solid #fb923c; background: #1c1917; color: #fed7aa; font: 700 1rem var(--mono); cursor: pointer; }
.cg-opb:hover, .cg-opb:focus-visible { background: rgba(251, 146, 60, .25); }
.cg-okm { color: #4ade80; font-weight: 800; margin-inline-start: .3rem; }
.cg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.cg-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.cg-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.cg-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.cg-why { margin: .4rem 0 0; font-size: .8rem; } .cg-why.is-ok { color: #86efac; } .cg-why.is-no { color: #fda4af; }
@container (max-width: 560px) { .cg-grid { grid-template-columns: 1fr; } }
html[data-theme="light"] .cg .cg-panel, html[data-theme="light"] .cg .cg-line { border-color: rgba(148, 163, 184, .35); } html[data-theme="light"] .cg .cg-task { border-color: rgba(251, 146, 60, .5); }
html[data-theme="light"] .cg .cg-lx { border-color: rgba(148, 163, 184, .35); } html[data-theme="light"] .cg .cg-lx.is-now { border-color: #fde047; }
html[data-theme="light"] .cg .cg-lx.is-kw, html[data-theme="light"] .cg .cg-c.is-kw { border-color: var(--kw); } html[data-theme="light"] .cg .cg-lx.is-op, html[data-theme="light"] .cg .cg-c.is-op { border-color: var(--op); }
html[data-theme="light"] .cg .cg-lx.is-id, html[data-theme="light"] .cg .cg-c.is-id { border-color: var(--id); } html[data-theme="light"] .cg .cg-lx.is-lit, html[data-theme="light"] .cg .cg-c.is-lit { border-color: var(--lit); }
html[data-theme="light"] .cg .cg-tok { border-color: currentColor; } html[data-theme="light"] .cg .cg-opb, html[data-theme="light"] .cg .cg-num.is-fold, html[data-theme="light"] .cg .cg-o[aria-pressed="true"], html[data-theme="light"] .cg .cg-cat[aria-pressed="true"] { border-color: #fb923c; }
html[data-theme="light"] .cg .cg-line.is-del { border-color: rgba(251, 113, 133, .5); } html[data-theme="light"] .cg .cg-t th { border-color: rgba(148, 163, 184, .3); } html[data-theme="light"] .cg .cg-t td { border-color: rgba(148, 163, 184, .14); }

/* ===== oop: Classes and Objects (/code/labs/oop, web/static/js/labs/oop.js). The bench stays dark in both themes. ===== */
.oo-lab .bl-board-wrap, .oo-lab .bl-read, .oo-lab .bl-controls, .oo-lab .bl-data { display: none !important; }
.oo { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.oo h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.oo-inh { font-weight: 600; font-size: .78rem; color: #f9a8d4; }
.oo-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.oo-task { border-color: rgba(244, 114, 182, .5); }
.oo-msg:empty { display: none; }
.oo-cap { margin: .45rem 0 0; font-size: .82rem; color: #e2e8f0; }
.oo code, .oo-code, .oo-screen, .oo-in, .oo-gap, .oo-hint, .oo-fl { font-family: var(--mono); }
.oo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; align-items: start; }
.oo-rows { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.oo-rows li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; padding: .3rem .5rem; border-radius: .45rem; background: #111a2e; border: 1px solid rgba(148, 163, 184, .2); font-size: .84rem; }
.oo-rows li.is-err { border-color: rgba(251, 113, 133, .5); background: rgba(251, 113, 133, .08); }
.oo-rows code { color: #f8fafc; direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }
.oo-out { color: #fde68a; font-weight: 700; } .oo-ret { color: #e2e8f0; font-size: .8rem; }
.oo-err { flex-basis: 100%; color: #fecdd3; font-size: .8rem; }
.oo-look { flex-basis: 100%; font-size: .76rem; color: #f9a8d4; }
.oo-form { display: flex; gap: .4rem; margin: 0; }
.oo-in { flex: 1; min-width: 0; padding: .45rem .55rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; direction: ltr; }
.oo-in:focus { outline: 2px solid #f472b6; outline-offset: 1px; }
.oo-hints { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .5rem; font-size: .76rem; color: #e2e8f0; }
.oo-hint { padding: .2rem .45rem; border-radius: .4rem; border: 1px dashed rgba(244, 114, 182, .55); background: transparent; color: #fbcfe8; font-size: .78rem; cursor: pointer; direction: ltr; text-align: start; }
.oo-btns { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.oo-need { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
.oo-need li { display: flex; gap: .45rem; color: #e2e8f0; } .oo-need li span { color: #e2e8f0; font-weight: 800; }
.oo-need li.is-ok { color: #bbf7d0; } .oo-need li.is-ok span { color: #4ade80; }
.oo-objs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.oo-obj { padding: .45rem .55rem; border-radius: .55rem; background: #111a2e; border: 1px solid rgba(244, 114, 182, .4); }
.oo-oh { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .55rem; margin-bottom: .3rem; }
.oo-oh b { font-family: var(--mono); color: #fbcfe8; } .oo-oh span { font-size: .76rem; color: #e2e8f0; }
.oo-t { width: 100%; border-collapse: collapse; font-size: .82rem; }
.oo-t td { padding: .18rem .3rem; border-bottom: 1px solid rgba(148, 163, 184, .14); }
.oo-t td small { color: #e2e8f0; font-size: .7rem; }
.oo-t td code { color: #fde68a; direction: ltr; unicode-bidi: isolate; }
.oo-lock { margin-inline-end: .25rem; font-size: .72rem; }
.oo-screen { margin: 0; padding: .5rem .6rem; border-radius: .45rem; background: #020617; color: #bef264; font-size: .86rem; white-space: pre-wrap; overflow-wrap: anywhere; direction: ltr; text-align: left; }
.oo-code { margin: 0; padding: .5rem .55rem; border-radius: .5rem; background: #060b16; font-size: .74rem; line-height: 1.5; white-space: pre; overflow-x: auto; direction: ltr; text-align: left; }
.oo-ln { display: inline-block; min-width: 100%; color: #e2e8f0; border-radius: .2rem; }
.oo-ln.is-ran { background: rgba(244, 114, 182, .22); color: #fdf2f8; }
.oo-fill { padding: .5rem .55rem; border-radius: .5rem; background: #060b16; font-size: .84rem; line-height: 2.1; direction: ltr; text-align: left; }
.oo-fl { white-space: pre-wrap; overflow-wrap: anywhere; }
.oo-gap { max-width: 100%; box-sizing: border-box; vertical-align: middle; padding: .15rem .35rem; border-radius: .35rem; border: 1px solid rgba(148, 163, 184, .5); background: #0f172a; color: #f8fafc; font-size: .84rem; }
.oo-gap.is-ok { border-color: #4ade80; background: rgba(74, 222, 128, .1); } .oo-gap.is-no { border-color: #fb7185; background: rgba(251, 113, 133, .08); }
.oo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.oo-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.oo-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.oo-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.oo-cat[aria-pressed="true"] { background: rgba(244, 114, 182, .2); border-color: #f472b6; color: #fdf2f8; }
.oo-why { margin: .4rem 0 0; font-size: .8rem; } .oo-why.is-ok { color: #86efac; } .oo-why.is-no { color: #fda4af; }
@container (max-width: 600px) { .oo-grid { grid-template-columns: 1fr; } }
html[data-theme="light"] .oo .oo-panel, html[data-theme="light"] .oo .oo-in, html[data-theme="light"] .oo .oo-rows li, html[data-theme="light"] .oo .oo-gap { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .oo .oo-task, html[data-theme="light"] .oo .oo-obj { border-color: rgba(244, 114, 182, .45); } html[data-theme="light"] .oo .oo-hint { border-color: rgba(244, 114, 182, .55); }
html[data-theme="light"] .oo .oo-rows li.is-err { border-color: rgba(251, 113, 133, .5); } html[data-theme="light"] .oo .oo-gap.is-ok { border-color: #4ade80; } html[data-theme="light"] .oo .oo-gap.is-no { border-color: #fb7185; }
html[data-theme="light"] .oo .oo-t td { border-color: rgba(148, 163, 184, .14); } html[data-theme="light"] .oo .oo-cat[aria-pressed="true"] { border-color: #f472b6; }

/* ===== testing: Test Plans and Hidden Bugs (/code/labs/testing, web/static/js/labs/testing.js). The bench stays dark in both themes. ===== */
.tq-lab .bl-board-wrap, .tq-lab .bl-read, .tq-lab .bl-controls, .tq-lab .bl-data { display: none !important; }
.tq { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.tq h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.tq-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.tq-task { border-color: rgba(163, 230, 53, .45); }
.tq-msg:empty { display: none; }
.tq-cap { margin: .45rem 0 0; font-size: .82rem; color: #e2e8f0; }
.tq-code { margin: 0; padding: .5rem .55rem; border-radius: .5rem; background: #060b16; font-family: var(--mono); font-size: .76rem; line-height: 1.5; white-space: pre; overflow-x: auto; direction: ltr; text-align: left; color: #e2e8f0; }
.tq-scroll { overflow-x: auto; }
.tq-t { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tq-t th { text-align: start; font-size: .72rem; color: #e2e8f0; font-weight: 700; padding: .2rem .3rem; border-bottom: 1px solid rgba(148, 163, 184, .3); white-space: nowrap; }
.tq-t td { padding: .25rem .3rem; border-bottom: 1px solid rgba(148, 163, 184, .14); vertical-align: middle; }
.tq-n { color: #e2e8f0; font-family: var(--mono); }
.tq-in { padding: .32rem .4rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font: inherit; font-size: .84rem; max-width: 100%; }
.tq-v { width: 4.6rem; font-family: var(--mono); }
.tq-x { color: #fb7185; font-weight: 800; margin-inline-start: .25rem; }
.tq-act { font-family: var(--mono); white-space: nowrap; }
.tq-ok { color: #86efac; font-weight: 700; } .tq-no { color: #fda4af; font-weight: 700; }
.tq-del { border: 0; background: transparent; color: #e2e8f0; font-size: .9rem; cursor: pointer; padding: .2rem .35rem; border-radius: .3rem; }
.tq-del:hover { color: #fda4af; }
.tq-btns { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .5rem; }
.tq-btns .tq-cap { margin: 0; }
.tq-bugs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tq-bugs li { padding: .35rem .55rem; border-radius: .45rem; background: #111a2e; border: 1px dashed rgba(148, 163, 184, .35); font-size: .84rem; color: #e2e8f0; }
.tq-bugs li b { color: #e2e8f0; margin-inline-end: .2rem; }
.tq-bugs li.is-caught { border: 1px solid rgba(74, 222, 128, .55); background: rgba(74, 222, 128, .08); color: #dcfce7; }
.tq-bugs li.is-caught b::before { content: "🐞 "; }
.tq-rules { margin: 0 0 .6rem; padding-inline-start: 1.1rem; font-size: .85rem; color: #e2e8f0; }
.tq-std { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem; }
.tq-state { position: relative; display: grid; place-items: center; min-width: 5.5rem; min-height: 4.2rem; padding: .4rem .6rem; border-radius: 999px; border: 2px solid #a3e635; background: #111a2e; text-align: center; }
.tq-state b { font-size: .9rem; }
.tq-startarrow { position: absolute; top: -1.35rem; left: 50%; transform: translateX(-50%); font-size: .72rem; color: #bef264; white-space: nowrap; }
.tq-state.is-start { margin-top: 1.2rem; }
.tq-std .tq-state:last-child { margin-top: 1.2rem; }
.tq-arrows { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.tq-arrow { display: flex; align-items: center; gap: .3rem; min-width: 0; }
.tq-arrow .tq-lbl { flex: 1; min-width: 0; }
.tq-ah { font-size: 1.3rem; color: #bef264; line-height: 1; }
.tq-day { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: 4px; }
.tq-day li { display: flex; flex-direction: column; align-items: center; padding: .3rem .2rem; border-radius: .45rem; background: #111a2e; border: 1px solid rgba(148, 163, 184, .25); font-size: .76rem; }
.tq-day li.is-on { background: rgba(251, 146, 60, .18); border-color: rgba(251, 146, 60, .6); }
.tq-day li.is-moved { box-shadow: inset 0 0 0 2px #fde047; }
.tq-temp { font-family: var(--mono); font-weight: 700; font-size: .88rem; color: #f8fafc; }
.tq-st { color: #e2e8f0; text-align: center; }
.tq-day em { font-style: normal; color: #fde047; font-size: .68rem; font-weight: 700; }
.tq-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.tq-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.tq-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.tq-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.tq-cat[aria-pressed="true"] { background: rgba(163, 230, 53, .2); border-color: #a3e635; color: #f7fee7; }
.tq-why { margin: .4rem 0 0; font-size: .8rem; } .tq-why.is-ok { color: #86efac; } .tq-why.is-no { color: #fda4af; }
.tq-ah i { font-style: normal; } .tq-ah .v { display: none; }
@container (max-width: 560px) {
  .tq-t thead { display: none; }
  .tq-t tr { display: grid; grid-template-columns: 1.4rem 5.2rem 1fr auto; grid-template-areas: "n v w d" ". e e e" ". a a a"; align-items: center; gap: .35rem; padding: .45rem 0; border-bottom: 1px solid rgba(148, 163, 184, .2); }
  .tq-t td { border: 0; padding: 0; min-width: 0; }
  .tq-n { grid-area: n; } .tq-vc { grid-area: v; } .tq-wc { grid-area: w; } .tq-ec { grid-area: e; } .tq-ec.tq-e1 { grid-area: w; } .tq-act { grid-area: a; } .tq-dc { grid-area: d; }
  .tq-act { white-space: normal; }
  .tq-act::before { content: attr(data-label) " "; color: #e2e8f0; font-family: system-ui, sans-serif; font-size: .74rem; }
  .tq-t select.tq-in { width: 100%; }
  .tq-v { width: 100%; }
  .tq-std { grid-template-columns: 1fr; justify-items: center; }
  .tq-std .tq-state:last-child { margin-top: 0; }
  .tq-arrows { width: 100%; }
  .tq-ah .h { display: none; } .tq-ah .v { display: inline; }
}
html[data-theme="light"] .tq .tq-panel, html[data-theme="light"] .tq .tq-in, html[data-theme="light"] .tq .tq-bugs li, html[data-theme="light"] .tq .tq-day li { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .tq .tq-task { border-color: rgba(163, 230, 53, .45); } html[data-theme="light"] .tq .tq-bugs li.is-caught { border-color: rgba(74, 222, 128, .55); }
html[data-theme="light"] .tq .tq-state, html[data-theme="light"] .tq .tq-cat[aria-pressed="true"] { border-color: #a3e635; } html[data-theme="light"] .tq .tq-day li.is-on { border-color: rgba(251, 146, 60, .6); }
html[data-theme="light"] .tq .tq-t th { border-color: rgba(148, 163, 184, .3); } html[data-theme="light"] .tq .tq-t td { border-color: rgba(148, 163, 184, .14); }

/* ===== risc: RISC, CISC and Parallel Processors (/code/labs/risc, web/static/js/labs/risc.js). The bench stays dark in both themes. ===== */
.rk-lab .bl-board-wrap, .rk-lab .bl-read, .rk-lab .bl-controls, .rk-lab .bl-data { display: none !important; }
.rk { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.rk h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.rk-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.rk-task { border-color: rgba(56, 189, 248, .5); }
.rk-msg:empty { display: none; }
.rk-cap { margin: .45rem 0 0; font-size: .82rem; color: #e2e8f0; }
.rk code { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.rk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; align-items: start; }
.rk-code { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; counter-reset: rk; }
.rk-code li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem .6rem; padding: .3rem .5rem; border-radius: .4rem; background: #111a2e; border: 1px solid rgba(56, 189, 248, .3); counter-increment: rk; }
.rk-code li::before { content: counter(rk); color: #e2e8f0; font-family: var(--mono); font-size: .74rem; min-width: 1.1rem; }
.rk-code li code { flex: 1; font-weight: 700; color: #e0f2fe; }
.rk-code.is-cisc li { border-color: rgba(251, 191, 36, .45); } .rk-code.is-cisc li code { color: #fef3c7; }
.rk-code li small { font-size: .72rem; color: #e2e8f0; }
.rk-code li.is-err { border-color: rgba(251, 113, 133, .55); background: rgba(251, 113, 133, .08); }
.rk-code .rk-empty { border-style: dashed; color: #e2e8f0; font-size: .82rem; } .rk-code .rk-empty::before { content: none; }
.rk-build { margin-top: .6rem; display: flex; flex-direction: column; gap: .45rem; align-items: flex-start; }
.rk-ops { display: flex; flex-wrap: wrap; gap: .3rem; }
.rk-op[aria-pressed="true"] { background: rgba(56, 189, 248, .22); border-color: #38bdf8; color: #e0f2fe; }
.rk-args { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; direction: ltr; }
.rk-args > code { font-weight: 800; color: #7dd3fc; min-width: 3.4rem; }
.rk-comma { color: #e2e8f0; }
.rk-in { padding: .32rem .4rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font: inherit; font-family: var(--mono); }
.rk-regs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: .5rem; direction: ltr; }
.rk-reg { display: inline-flex; flex-direction: column; align-items: center; min-width: 3.2rem; padding: .25rem .4rem; border-radius: .4rem; background: #111a2e; border: 1px solid rgba(56, 189, 248, .35); font-family: var(--mono); font-size: .9rem; }
.rk-reg b { font-size: .7rem; color: #7dd3fc; }
.rk-t { width: 100%; border-collapse: collapse; font-size: .84rem; }
.rk-t th { text-align: start; font-size: .72rem; color: #e2e8f0; font-weight: 700; padding: .2rem .35rem; border-bottom: 1px solid rgba(148, 163, 184, .3); }
.rk-t td { padding: .28rem .35rem; border-bottom: 1px solid rgba(148, 163, 184, .14); vertical-align: top; }
.rk-t td:not(:first-child) { font-family: var(--mono); }
.rk-cmp td:not(:first-child), .rk-cmp th { white-space: nowrap; } .rk-cmp td.rk-cap2 { white-space: normal; }
.rk-cap2 { color: #e2e8f0; font-size: .76rem; font-family: system-ui, sans-serif !important; }
.rk-chg { color: #fde68a; font-weight: 700; }
.rk-bar { display: block; height: .35rem; margin-top: .2rem; border-radius: 999px; background: linear-gradient(90deg, #38bdf8, #a78bfa); }
.rk-cmp td:nth-child(2) .rk-bar { background: linear-gradient(90deg, #fbbf24, #fb923c); }
.rk-pipe { display: grid; grid-template-columns: repeat(var(--w), minmax(0, 1.7rem)); gap: 2px; margin-top: .6rem; direction: ltr; }
.rk-pipe span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 3px; background: #0f172a; font: 700 .62rem var(--mono); color: #0b1220; }
.rk-pipe .is-F { background: #7dd3fc; } .rk-pipe .is-D { background: #a5b4fc; } .rk-pipe .is-E { background: #f9a8d4; } .rk-pipe .is-W { background: #86efac; }
.rk-flybox { margin-top: .5rem; padding: .5rem; border-radius: .5rem; background: #0b1220; }
.rk-flybox > .rk-cap:first-child { margin-top: 0; }
.rk-fly { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; margin-top: .45rem; }
.rk-fly:has(> :only-child) { grid-template-columns: minmax(0, 8rem); }
.rk-pu { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .35rem .2rem; text-align: center; border-radius: .55rem; background: #111a2e; border: 1px solid rgba(148, 163, 184, .35); font-size: .82rem; }
.rk-is, .rk-ds { display: inline-block; padding: .05rem .4rem; border-radius: .3rem; font: 700 .76rem var(--mono); }
.rk-is { background: rgba(251, 191, 36, .2); color: #fde68a; } .rk-ds { background: rgba(56, 189, 248, .2); color: #bae6fd; }
.rk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.rk-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.rk-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.rk-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.rk-cat[aria-pressed="true"] { background: rgba(56, 189, 248, .2); border-color: #38bdf8; color: #e0f2fe; }
.rk-why { margin: .4rem 0 0; font-size: .8rem; } .rk-why.is-ok { color: #86efac; } .rk-why.is-no { color: #fda4af; }
@container (max-width: 640px) { .rk-grid { grid-template-columns: 1fr; } }
html[data-theme="light"] .rk .rk-panel, html[data-theme="light"] .rk .rk-in, html[data-theme="light"] .rk .rk-pu { border-color: rgba(148, 163, 184, .35); } html[data-theme="light"] .rk .rk-task { border-color: rgba(56, 189, 248, .5); }
html[data-theme="light"] .rk .rk-code li, html[data-theme="light"] .rk .rk-reg { border-color: rgba(56, 189, 248, .35); } html[data-theme="light"] .rk .rk-code.is-cisc li { border-color: rgba(251, 191, 36, .45); }
html[data-theme="light"] .rk .rk-code li.is-err { border-color: rgba(251, 113, 133, .55); } html[data-theme="light"] .rk .rk-op[aria-pressed="true"], html[data-theme="light"] .rk .rk-cat[aria-pressed="true"] { border-color: #38bdf8; }
html[data-theme="light"] .rk .rk-t th { border-color: rgba(148, 163, 184, .3); } html[data-theme="light"] .rk .rk-t td { border-color: rgba(148, 163, 184, .14); }

/* ===== chem-titration: Titration (/code/labs/chem-titration, web/static/js/labs/chem-titration.js). The bench stays dark in both themes. ===== */
.ct { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.ct-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.ct-step[hidden] { display: none; }
.ct-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.ct-step h4 span { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(236, 72, 153, .22); color: #fbcfe8; font-size: .8rem; }
.ct-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.ct-lab { min-width: 10.5rem; color: #e2e8f0; }
.ct-hint { color: #e2e8f0; font-size: .84rem; }
.ct .bl-btn.ct-open { background: #f59e0b; border-color: #f59e0b; color: #1c1206; }
.ct-read { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .9rem; }
.ct-read label { display: flex; flex-direction: column; gap: .2rem; font-size: .84rem; color: #e2e8f0; }
.ct-read label span { display: none; }
.ct input { width: 6.2rem; padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-variant-numeric: tabular-nums; font-size: .95rem; }
.ct input:focus { outline: 2px solid #f472b6; outline-offset: 1px; }
.ct-table-wrap { overflow-x: auto; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .25); }
.ct-table { border-collapse: collapse; font-variant-numeric: tabular-nums; color: #e2e8f0; font-size: .88rem; }
.ct-table th, .ct-table td { padding: .3rem .55rem; border-bottom: 1px solid rgba(148, 163, 184, .15); text-align: center; white-space: nowrap; }
.ct-table thead th { background: #111a2b; color: #f1f5f9; font-weight: 700; }
.ct-table tbody th { text-align: left; color: #e2e8f0; font-weight: 600; background: rgba(17, 26, 43, .6); position: sticky; left: 0; }
.ct-table td input { width: 4.8rem; text-align: center; }
.ct-titre td { color: #fde68a; font-weight: 700; }
.ct-ticks td { color: #86efac; font-weight: 800; }
.ct-mean { margin: 0; color: #e2e8f0; }
.ct-mean[hidden] { display: none; }
.ct-mean b { color: #86efac; }
.ct-eq { margin: 0; color: #e2e8f0; }
.ct-eq b { color: #f9a8d4; font-weight: 700; }
.ct-calc { display: flex; flex-direction: column; gap: .5rem; }
.ct-cstep { display: grid; grid-template-columns: 1.4rem 1fr auto; gap: .3rem .55rem; align-items: center; }
.ct-n { color: #f9a8d4; font-weight: 800; }
.ct-ctext { color: #e2e8f0; font-variant-numeric: tabular-nums; line-height: 1.45; }
.ct-cin { display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.ct-cin > span:first-of-type { color: #e2e8f0; min-width: 3.6rem; }
.ct-ok { color: #86efac; font-weight: 800; }
.ct-bad { color: #fca5a5; font-weight: 800; }
@media (max-width: 560px) {
  .ct-lab { min-width: 0; width: 100%; }
  .ct-cstep { grid-template-columns: 1.4rem 1fr; }
  .ct-cin { grid-column: 2; }
}
html[data-theme="light"] .ct .ct-step, html[data-theme="light"] .ct .ct-table-wrap, html[data-theme="light"] .ct input { border-color: rgba(148, 163, 184, .35); }
.cx-lab-sec[data-bench="chem-titration"] .bl-zoom { display: none !important; }   /* phones get a portrait bench instead */

/* ===== chem-salts: Mystery Salt (/code/labs/chem-salts, web/static/js/labs/chem-salts.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-salts"] .bl-zoom { display: none !important; }   /* phones get a two-shelf bench instead */
.cs { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cs-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .5rem; }
.cs-step h4 { margin: 0; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.cs-step h4 span { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(250, 204, 21, .2); color: #fde68a; font-size: .8rem; }
.cs-step h4 small { font-weight: 500; color: #e2e8f0; font-size: .82rem; }
.cs-tgroup { display: flex; flex-direction: column; gap: .3rem; }
.cs-glabel { color: #e2e8f0; font-size: .82rem; font-weight: 600; }
.cs-tests { display: flex; flex-wrap: wrap; gap: .35rem; }
.cs .bl-btn.cs-wait { opacity: .55; }
.cs select { padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .9rem; max-width: 100%; }
.cs-nb-wrap { max-height: 15rem; overflow: auto; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .25); }
.cs-nb { border-collapse: collapse; width: 100%; font-size: .88rem; color: #e2e8f0; }
.cs-nb th { position: sticky; top: 0; background: #111a2b; color: #f1f5f9; text-align: left; padding: .3rem .6rem; font-weight: 700; }
.cs-nb td { padding: .32rem .6rem; border-top: 1px solid rgba(148, 163, 184, .15); vertical-align: top; line-height: 1.4; }
.cs-nb td:first-child { color: #e2e8f0; width: 42%; }
.cs-nb tr.cs-last td { background: rgba(250, 204, 21, .08); }
.cs-nb tr.cs-last td:last-child { color: #fde68a; font-weight: 600; }
.cs-empty { color: #e2e8f0; text-align: center; }
.cs-sus { display: flex; flex-wrap: wrap; gap: .3rem; }
.cs-ion { border-radius: 999px; border: 1px solid rgba(148, 163, 184, .35); background: rgba(15, 23, 42, .6); color: #e2e8f0; padding: .2rem .6rem; font-size: .82rem; cursor: pointer; }
.cs-ion b { color: #fde68a; margin-right: .15rem; }
.cs-ion[aria-pressed="true"] { opacity: .45; text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: #f87171; }
.cs-ion:focus-visible { outline: 2px solid #fde047; outline-offset: 2px; }
.cs-answer { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.cs-answer label { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
html[data-theme="light"] .cs .cs-step, html[data-theme="light"] .cs .cs-nb-wrap, html[data-theme="light"] .cs .cs-ion, html[data-theme="light"] .cs select { border-color: rgba(148, 163, 184, .35); }

/* ===== structure: Structure Charts (/code/labs/structure, web/static/js/labs/structure.js). The bench stays dark in both themes. ===== */
.sk-lab .bl-board-wrap, .sk-lab .bl-read, .sk-lab .bl-controls, .sk-lab .bl-data { display: none !important; }
.sk { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.sk h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.sk-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.sk-task { border-color: rgba(52, 211, 153, .45); }
.sk-msg:empty { display: none; }
.sk-cap { margin: .45rem 0 0; font-size: .82rem; color: #e2e8f0; }
.sk code { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
.sk-code { margin: 0; padding: .5rem .55rem; border-radius: .5rem; background: #060b16; font-family: var(--mono); font-size: .74rem; line-height: 1.55; white-space: pre; overflow-x: auto; direction: ltr; text-align: left; color: #e2e8f0; }
.sk-desc { margin: .5rem 0 0; padding-inline-start: 1.1rem; font-size: .86rem; color: #e2e8f0; }
.sk-desc li + li { margin-top: .2rem; }
.sk-cvwrap { width: 100%; direction: ltr; }
.sk-cv { display: block; width: 100%; }
.sk-lost code { color: #fda4af; margin-inline-end: .35rem; }
.sk-key { display: flex; flex-wrap: wrap; gap: .25rem .8rem; margin: .5rem 0 0; font-size: .76rem; color: #e2e8f0; }
.sk-key i { font-style: normal; font-weight: 700; margin-inline-end: .2rem; }
.sk-key .k-d { color: #fde68a; } .sk-key .k-f { color: #fda4af; } .sk-key .k-s { color: #fbbf24; } .sk-key .k-l { color: #f472b6; }
.sk-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.sk-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: .86rem; }
.sk-rows li code { font-weight: 700; color: #a7f3d0; min-width: 6.5rem; }
.sk-rows li > span { color: #e2e8f0; }
.sk-in { padding: .32rem .4rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font: inherit; font-size: .86rem; max-width: 100%; }
.sk-mod + .sk-mod { margin-top: .6rem; padding-top: .55rem; border-top: 1px solid rgba(148, 163, 184, .18); }
.sk-hd { display: block; margin-bottom: .35rem; font-size: .76rem; color: #e0f2fe; overflow-wrap: anywhere; }
.sk-pn { font-family: var(--mono); font-size: .8rem; flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; color: #e2e8f0 !important; }
.sk-mod .sk-rows li { flex-wrap: nowrap; justify-content: space-between; } .sk-mod .sk-in { flex: 0 0 auto; }
.sk-dirkey { margin: 0 0 .6rem; }
.sk-letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .4rem; }
.sk-letters li b { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: .35rem; background: #111a2e; border: 1px solid #7dd3fc; font-family: var(--mono); }
.sk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.sk-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.sk-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.sk-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.sk-cat[aria-pressed="true"] { background: rgba(52, 211, 153, .2); border-color: #34d399; color: #ecfdf5; }
.sk-why { margin: .4rem 0 0; font-size: .8rem; } .sk-why.is-ok { color: #86efac; } .sk-why.is-no { color: #fda4af; }
html[data-theme="light"] .sk .sk-panel, html[data-theme="light"] .sk .sk-in { border-color: rgba(148, 163, 184, .35); } html[data-theme="light"] .sk .sk-task { border-color: rgba(52, 211, 153, .45); }
html[data-theme="light"] .sk .sk-mod + .sk-mod { border-color: rgba(148, 163, 184, .18); } html[data-theme="light"] .sk .sk-letters li b { border-color: #7dd3fc; } html[data-theme="light"] .sk .sk-cat[aria-pressed="true"] { border-color: #34d399; }

/* ===== chem-rates: Rates of Reaction (/code/labs/chem-rates, web/static/js/labs/chem-rates.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-rates"] .bl-zoom { display: none !important; }   /* phones get a two-level bench instead */
.cr { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cr-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.cr-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.cr-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(56, 189, 248, .2); color: #bae6fd; font-size: .8rem; }
.cr-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.cr-lab { min-width: 10rem; }
.cr-fixed { margin: 0; color: #e2e8f0; font-size: .84rem; }
.cr-hint { color: #e2e8f0; font-size: .84rem; }
.cr-res { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-start; }
.cr-tw { max-height: 19rem; overflow: auto; border-radius: .6rem; border: 1px solid rgba(148, 163, 184, .25); flex: none; }
.cr-table { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .86rem; color: #e2e8f0; }
.cr-table th { position: sticky; top: 0; background: #111a2b; color: #f1f5f9; padding: .3rem .6rem; font-weight: 700; }
.cr-table td { padding: .25rem .6rem; text-align: right; border-top: 1px solid rgba(148, 163, 184, .14); }
.cr-empty { color: #e2e8f0; text-align: center !important; }
.cr-gw { flex: 1 1 18rem; min-width: 0; display: flex; flex-direction: column; gap: .4rem; }
.cr-graph { display: block; border-radius: .6rem; background: rgba(2, 6, 23, .55); max-width: 100%; }
.cr-legend { display: flex; flex-wrap: wrap; gap: .3rem; }
.cr-run { border-radius: 999px; border: 1px solid var(--c); background: rgba(15, 23, 42, .6); color: #e2e8f0; padding: .15rem .6rem; font-size: .8rem; cursor: pointer; }
.cr-run.is-sel { background: color-mix(in srgb, var(--c) 25%, transparent); font-weight: 700; }
.cr-grad { margin: 0; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.cr-grad b { color: #fde047; }
.cr-q { display: flex; flex-direction: column; gap: .4rem; }
.cr-q label { display: flex; gap: .5rem; align-items: flex-start; line-height: 1.4; cursor: pointer; }
.cr-q input { margin-top: .25rem; accent-color: #38bdf8; }
.cr input[inputmode] { width: 6rem; padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .95rem; font-variant-numeric: tabular-nums; }
.cr-ans { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.cr-calc { display: flex; flex-direction: column; gap: .45rem; }
.cr-cstep { display: grid; grid-template-columns: 1.4rem 1fr auto; gap: .3rem .55rem; align-items: center; }
.cr-n { color: #7dd3fc; font-weight: 800; }
.cr-cin { white-space: nowrap; }
.cr-ok { color: #86efac; font-weight: 800; } .cr-bad { color: #fca5a5; font-weight: 800; }
@media (max-width: 560px) { .cr-lab { min-width: 0; width: 100%; } .cr-cstep { grid-template-columns: 1.4rem 1fr; } .cr-cin { grid-column: 2; } .cr-tw { max-height: 12rem; } }
html[data-theme="light"] .cr .cr-step, html[data-theme="light"] .cr .cr-tw, html[data-theme="light"] .cr input { border-color: rgba(148, 163, 184, .35); }

/* ===== chem-electrolysis: Electrolysis (/code/labs/chem-electrolysis, web/static/js/labs/chem-electrolysis.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-electrolysis"] .bl-zoom { display: none !important; }   /* phones get the cell drawn bigger instead */
.cx-lab-sec[data-bench="chem-electrolysis"] .bl-read { font-weight: 500; line-height: 1.5; }
.ce { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.ce-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.ce-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.ce-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(74, 222, 128, .2); color: #bbf7d0; font-size: .8rem; }
.ce-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.ce-row [hidden] { display: none; }
.ce-lab { min-width: 9.5rem; }
.ce-hint { color: #e2e8f0; font-size: .84rem; }
.ce select { padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .9rem; }
.ce-pred label { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ce-half { border-radius: .6rem; background: rgba(2, 6, 23, .55); padding: .5rem .7rem; }
.ce-half[hidden] { display: none; }
.ce-half p { margin: .2rem 0; line-height: 1.5; }
.ce-half i { color: #e2e8f0; font-size: .84rem; margin-left: .3rem; }
.ce-eq { font-weight: 700; color: #fde68a; white-space: nowrap; }
.ce-c { color: #f9a8d4; } .ce-a { color: #7dd3fc; }
@media (max-width: 560px) { .ce-lab { min-width: 0; width: 100%; } .ce-eq { white-space: normal; } }
html[data-theme="light"] .ce .ce-step, html[data-theme="light"] .ce select { border-color: rgba(148, 163, 184, .35); }

/* ===== ide: Debug in an IDE (/code/labs/ide, web/static/js/labs/ide.js). The bench stays dark in both themes. ===== */
.ie-lab .bl-board-wrap, .ie-lab .bl-read, .ie-lab .bl-controls, .ie-lab .bl-data { display: none !important; }
.ie { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.ie h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; white-space: normal; overflow-wrap: anywhere; }
.ie-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.ie-task { border-color: rgba(251, 146, 60, .5); }
.ie-msg:empty { display: none; }
.ie-cap { margin: .45rem 0 0; font-size: .82rem; color: #e2e8f0; }
.ie-dim { color: #e2e8f0; font-size: .82rem; }
.ie-bar { display: flex; flex-wrap: wrap; gap: .4rem; }
.ie-status { margin: 0; padding: .4rem .6rem; border-radius: .5rem; background: #111a2e; font-size: .85rem; color: #e2e8f0; border-inline-start: 3px solid #fb923c; }
.ie-status.is-err { border-color: #fb7185; color: #fecdd3; }
.ie-kw { color: #7dd3fc; font-weight: 700; } .ie-st { color: #fde68a; } .ie-cm { color: #e2e8f0; font-style: italic; }
/* debugger code view */
.ie-code { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: .8rem; line-height: 1.55; direction: ltr; text-align: left; overflow-x: auto; }
.ie-code li { display: flex; align-items: stretch; min-width: max-content; border-radius: .3rem; }
.ie-code li.is-now { background: rgba(250, 204, 21, .16); box-shadow: inset 3px 0 0 #facc15; }
.ie-code li.is-err { background: rgba(251, 113, 133, .14); }
.ie-code li.is-bug { background: rgba(74, 222, 128, .14); } .ie-code li.is-notbug { background: rgba(251, 113, 133, .12); }
.ie-gut { display: inline-flex; align-items: center; justify-content: flex-end; gap: .3rem; width: 3.6rem; padding: 0 .35rem 0 .15rem; border: 0; background: transparent; color: #e2e8f0; font: inherit; cursor: pointer; }
.ie-n { min-width: 2ch; text-align: right; }
.ie-dot { width: .62rem; height: .62rem; border-radius: 50%; border: 1px dashed rgba(148, 163, 184, .7); }
.ie-code li.is-bp .ie-dot { background: #ef4444; border: 1px solid #fca5a5; }
.ie-code li.is-bp .ie-gut { color: #fecaca; }
.ie-fold { display: inline-grid; place-items: center; width: 1.2rem; border: 0; background: transparent; color: #e2e8f0; font: inherit; padding: 0; cursor: pointer; }
.ie-line { display: block; flex: 1; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; padding: 0 .4rem 0 0; cursor: default; }
button.ie-line { cursor: pointer; } button.ie-line:hover { background: rgba(148, 163, 184, .08); }
.ie-line code { display: block; white-space: pre; padding-inline-start: calc(var(--ind) * 1ch); font-family: inherit; }
.ie-more { color: #e2e8f0; font-style: italic; }
.ie-two { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.ie-watch { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ie-watch li { display: flex; align-items: center; gap: .5rem; padding: .25rem .45rem; border-radius: .4rem; background: #111a2e; font-family: var(--mono); font-size: .85rem; }
.ie-watch li code { color: #a5b4fc; } .ie-watch li b { flex: 1; color: #f8fafc; }
.ie-x { border: 0; background: transparent; color: #e2e8f0; cursor: pointer; }
.ie-add { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.ie-in { padding: .32rem .45rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font: inherit; font-family: var(--mono); font-size: .86rem; max-width: 100%; }
.ie-out { min-height: 2.2rem; padding: .4rem .5rem; border-radius: .45rem; background: #060b16; font-family: var(--mono); font-size: .85rem; color: #bbf7d0; overflow-wrap: anywhere; }
.ie-ans { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .9rem; }
.ie-ans .ie-in { width: 7rem; }
.ie-fix { width: 100%; box-sizing: border-box; }
/* editor: a transparent textarea over a highlighted copy */
.ie-ed { display: flex; border-radius: .5rem; background: #060b16; border: 1px solid rgba(148, 163, 184, .3); overflow: hidden; direction: ltr; }
.ie-gutl { display: flex; flex-direction: column; padding: .5rem .4rem; color: #e2e8f0; text-align: right; user-select: none; border-inline-end: 1px solid rgba(148, 163, 184, .18); }
.ie-gutl .is-err { color: #fb7185; font-weight: 700; }
.ie-edw { position: relative; flex: 1; min-width: 0; overflow-x: auto; }
.ie-hl, .ie-ta, .ie-gutl { font-family: var(--mono); font-size: 14px; line-height: 21px; tab-size: 4; }
.ie-hl { margin: 0; padding: .5rem .6rem; white-space: pre; color: #e2e8f0; pointer-events: none; min-width: max-content; }
.ie-ta { position: absolute; inset: 0; width: 100%; min-width: max-content; box-sizing: border-box; margin: 0; padding: .5rem .6rem; border: 0; outline: 0; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: #f8fafc; white-space: pre; }
.ie .ie-ta, .ie .ie-ta:focus { background: transparent !important; box-shadow: none !important; }
.ie-ta::selection { background: rgba(125, 211, 252, .3); color: transparent; }
.ie-wavy { text-decoration: underline wavy #fb7185; text-decoration-skip-ink: none; text-underline-offset: 3px; }
@media (max-width: 640px) { .ie-hl, .ie-ta, .ie-gutl { font-size: 16px; line-height: 23px; } }
.ie-prompts { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-height: 2rem; margin-top: .45rem; }
.ie-ptitle { font-size: .76rem; color: #e2e8f0; }
.ie-p { padding: .2rem .5rem; border-radius: .35rem; border: 1px solid rgba(125, 211, 252, .5); background: rgba(14, 165, 233, .14); color: #e0f2fe; font-family: var(--mono); font-size: .82rem; cursor: pointer; }
.ie-errs { list-style: none; margin: .35rem 0 0; padding: 0; font-size: .84rem; color: #fecdd3; }
.ie-errs li::before { content: "✗ "; } .ie-errs li.is-ok { color: #86efac; } .ie-errs li.is-ok::before { content: "✓ "; }
.ie-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.ie-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.ie-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.ie-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.ie-cat[aria-pressed="true"] { background: rgba(251, 146, 60, .2); border-color: #fb923c; color: #fff7ed; }
.ie-why { margin: .4rem 0 0; font-size: .8rem; } .ie-why.is-ok { color: #86efac; } .ie-why.is-no { color: #fda4af; }
@container (max-width: 560px) { .ie-two { grid-template-columns: 1fr; } }
html[data-theme="light"] .ie .ie-panel, html[data-theme="light"] .ie .ie-in, html[data-theme="light"] .ie .ie-ed { border-color: rgba(148, 163, 184, .35); } html[data-theme="light"] .ie .ie-task { border-color: rgba(251, 146, 60, .5); }
html[data-theme="light"] .ie .ie-status { border-color: #fb923c; } html[data-theme="light"] .ie .ie-status.is-err { border-color: #fb7185; } html[data-theme="light"] .ie .ie-p { border-color: rgba(125, 211, 252, .5); }
html[data-theme="light"] .ie .ie-gutl { border-color: rgba(148, 163, 184, .18); } html[data-theme="light"] .ie .ie-cat[aria-pressed="true"] { border-color: #fb923c; }
html[data-theme="light"] .ie .ie-dot { border-color: rgba(148, 163, 184, .7); } html[data-theme="light"] .ie .ie-code li.is-bp .ie-dot { border-color: #fca5a5; }

/* ===== chem-energy: Energy Changes (/code/labs/chem-energy, web/static/js/labs/chem-energy.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-energy"] .bl-zoom { display: none !important; }   /* phones get the apparatus drawn bigger instead */
.cx-lab-sec[data-bench="chem-energy"] .bl-read { font-weight: 500; line-height: 1.5; }
.cn { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cn [hidden] { display: none !important; }
.cn-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.cn-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.cn-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(251, 146, 60, .22); color: #fed7aa; font-size: .8rem; }
.cn-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.cn-lab { min-width: 8.5rem; }
.cn-lab2 { min-width: 0; margin-left: .6rem; }
.cn-what, .cn-hint { margin: 0; color: #e2e8f0; font-size: .86rem; line-height: 1.45; }
.cn-table { border-collapse: collapse; width: 100%; max-width: 30rem; }
.cn-table th { text-align: left; font-weight: 600; color: #e2e8f0; padding: .3rem .5rem .3rem 0; border-bottom: 1px solid rgba(148, 163, 184, .18); }
.cn-table td { padding: .25rem 0; border-bottom: 1px solid rgba(148, 163, 184, .18); width: 7.5rem; font-variant-numeric: tabular-nums; color: #fde68a; font-weight: 700; }
.cn-in { width: 6.5rem; padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .92rem; font-variant-numeric: tabular-nums; }
.cn-eq { margin: 0; color: #f9a8d4; font-weight: 600; line-height: 1.45; }
.cn-calc { display: flex; flex-direction: column; gap: .45rem; }
.cn-line { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; line-height: 1.45; }
.cn-line b { color: #fdba74; width: 1rem; }
.cn-line span { flex: 1 1 18rem; }
.cn-line i { font-style: normal; color: #e2e8f0; }
.cn-line em { font-style: normal; color: #4ade80; font-weight: 700; min-width: 1rem; }
.cn-book { margin: .2rem 0 0; padding: .45rem .6rem; border-radius: .5rem; background: rgba(2, 6, 23, .55); color: #bbf7d0; line-height: 1.45; }
.cn-q p { margin: .2rem 0 .35rem; font-weight: 600; color: #f1f5f9; }
.cn-q label { display: flex; gap: .45rem; align-items: flex-start; padding: .2rem 0; line-height: 1.4; }
@media (max-width: 560px) { .cn-lab { min-width: 0; width: 100%; } .cn-lab2 { margin-left: 0; } .cn-line span { flex-basis: 100%; } }

/* ===== chem-chroma: Chromatography (/code/labs/chem-chroma, web/static/js/labs/chem-chroma.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-chroma"] .bl-zoom { display: none !important; }   /* phones get the paper drawn bigger instead */
.cx-lab-sec[data-bench="chem-chroma"] .bl-read { font-weight: 500; line-height: 1.5; }
.cg { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cg [hidden] { display: none !important; }
.cg-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.cg-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.cg-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(168, 85, 247, .25); color: #e9d5ff; font-size: .8rem; }
.cg-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.cg-lab { min-width: 10rem; }
.cg-what { margin: 0; color: #e2e8f0; font-size: .86rem; line-height: 1.45; }
.cg-grid { display: flex; flex-direction: column; gap: .4rem; }
.cg-grid label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem .6rem; max-width: 30rem; }
.cg-in { width: 6.5rem; padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .92rem; font-variant-numeric: tabular-nums; }
.cg-eq { margin: .1rem 0 0; color: #f9a8d4; font-weight: 600; line-height: 1.45; }
.cg-eq b { color: #fde68a; }
.cg-pick { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border: 1px solid rgba(148, 163, 184, .3); border-radius: .5rem; }
@media (max-width: 560px) { .cg-lab { min-width: 0; width: 100%; } }

/* ===== chem-salt-prep: Making Salts (/code/labs/chem-salt-prep, web/static/js/labs/chem-salt-prep.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-salt-prep"] .bl-zoom { display: none !important; }   /* phones get the bench drawn bigger instead */
.cx-lab-sec[data-bench="chem-salt-prep"] .bl-read { font-weight: 500; line-height: 1.5; }
.cp { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cp-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .5rem; }
.cp-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.cp-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(56, 189, 248, .22); color: #bae6fd; font-size: .8rem; }
.cp-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.cp-lab { min-width: 10.5rem; }
.cp-eq { margin: 0; line-height: 1.5; }
.cp-eq b { color: #f9a8d4; }
.cp-eq span { color: #e2e8f0; font-size: .86rem; }
.cp-bank { display: flex; flex-wrap: wrap; gap: .4rem; }
.cp-bank .bl-btn { text-align: left; }
.cp-list { margin: .1rem 0 0; padding-left: 1.6rem; display: flex; flex-direction: column; gap: .2rem; color: #fde68a; }
.cp-list .cp-empty { list-style: none; margin-left: -1.6rem; color: #e2e8f0; }
@media (max-width: 560px) { .cp-lab { min-width: 0; width: 100%; } }

/* ===== errors: Error Detection (/code/labs/errors, web/static/js/labs/errors.js). The bench stays dark in both themes. ===== */
.ed-lab .bl-board-wrap, .ed-lab .bl-read, .ed-lab .bl-controls, .ed-lab .bl-data { display: none !important; }
.ed { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.ed h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; overflow-wrap: anywhere; }
.ed h4 { margin: 0 0 .35rem; font-size: .78rem; font-weight: 700; color: #e2e8f0; }
.ed-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.ed-task { border-color: rgba(45, 212, 191, .5); }
.ed-msg:empty { display: none; }
.ed-cap { margin: .5rem 0 0; font-size: .82rem; color: #e2e8f0; }
.ed-scroll { overflow-x: auto; }
.ed-bytes { display: flex; flex-direction: column; gap: .45rem; }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.ed-lbl { min-width: 4.6rem; font-size: .8rem; color: #e2e8f0; font-weight: 700; }
.ed-bits { display: inline-flex; gap: 3px; direction: ltr; }
.ed-b { display: inline-grid; place-items: center; width: 1.7rem; height: 1.9rem; border-radius: .35rem; border: 1px solid rgba(148, 163, 184, .35); background: #111a2e; color: #e2e8f0; font-family: var(--mono); font-size: .95rem; font-weight: 700; padding: 0; }
.ed-b.is-1 { color: #5eead4; background: #0f2a2a; }
.ed-b.ed-pb { box-shadow: inset 0 0 0 2px rgba(250, 204, 21, .35); background: #2a2410; }
.ed-b.ed-pb.is-1 { color: #fde047; }
.ed-b.is-diff { outline: 2px solid #fb7185; outline-offset: 1px; }
.ed-tap { cursor: pointer; }
.ed-tap:hover { border-color: #5eead4; }
.ed-tap:focus-visible { outline: 2px solid #5eead4; outline-offset: 1px; }
.ed-tap.is-empty { color: #fde047; border-style: dashed; border-color: #facc15; }
.ed-work { font-size: .84rem; color: #e2e8f0; font-family: var(--mono); overflow-wrap: anywhere; }
.ed .is-ok { color: #86efac; } .ed .is-no { color: #fda4af; }
.ed-opts { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.ed-opt[aria-pressed="true"], .ed-cat[aria-pressed="true"] { background: rgba(45, 212, 191, .2); border-color: #2dd4bf; color: #f0fdfa; }
.ed-vrow { padding: .4rem .5rem; border-radius: .55rem; background: #111a2e; }
.ed-vrow .ed-work { flex-basis: 100%; }
.ed-code { font-family: var(--mono); font-size: 1rem; letter-spacing: .06em; color: #f1f5f9; }
.ed-block { border-collapse: separate; border-spacing: 3px; direction: ltr; margin: 0 auto 0 0; }
.ed-block th { font-size: .72rem; color: #e2e8f0; font-weight: 700; padding: 0 .3rem 0 0; text-align: right; white-space: nowrap; }
.ed-block thead th { text-align: center; padding: 0; }
.ed-block td { padding: 0; text-align: center; }
.ed-block td.ed-pc .ed-b, .ed-pbyte .ed-b { background: #2a2410; }
.ed-block .ed-b.is-flip { outline: 2px solid #f472b6; outline-offset: 1px; }
.ed-block .ed-b.is-cross { border-color: #fb7185; border-width: 2px; }
.ed-mark { font-weight: 800; font-size: .95rem; min-width: 1.5rem; }
.ed-colmarks th { padding-top: .1rem; }
.ed-csrow + .ed-csrow { margin-top: .6rem; }
.ed-nums { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-family: var(--mono); }
.ed-num { padding: .25rem .45rem; border-radius: .4rem; background: #111a2e; border: 1px solid rgba(148, 163, 184, .3); font-weight: 700; }
.ed-op { color: #e2e8f0; }
.ed-in { width: 4.4rem; padding: .3rem .4rem; border-radius: .4rem; border: 1px solid rgba(45, 212, 191, .6); background: #060b16; color: #f8fafc; font-family: var(--mono); font-size: .95rem; }
.ed-cs { margin: .5rem 0 0; font-size: .86rem; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.ed-cs span { font-family: var(--mono); }
.ed-verdict { margin-top: .7rem; display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: .86rem; }
.ed-verdict > span { flex-basis: 100%; }
.ed-q { margin-inline-start: .15rem; color: #fde047; }
.ed-dt { border-collapse: separate; border-spacing: 2px; direction: ltr; font-family: var(--mono); }
.ed-dt th { font-size: .72rem; color: #e2e8f0; text-align: right; padding-right: .3rem; white-space: nowrap; font-family: inherit; }
.ed-dt td { min-width: 1.6rem; padding: .2rem .15rem; text-align: center; border-radius: .3rem; background: #111a2e; font-size: .88rem; }
.ed-dt td.ed-w { color: #e2e8f0; font-size: .72rem; white-space: nowrap; }
.ed-dt td.ed-cd { background: transparent; }
.ed-dt .ed-in { width: 2.4rem; text-align: center; padding: .2rem; }
.ed-arq { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.ed-log { margin: .25rem 0 0 .6rem; font-size: .8rem; color: #a5f3fc; }
.ed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.ed-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.ed-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.ed-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.ed-why { margin: .4rem 0 0; font-size: .8rem; }
@media (max-width: 640px) { .ed .ed-in { font-size: 16px !important; } .ed-b { width: 1.85rem; height: 2rem; } }
html[data-theme="light"] .ed .ed-panel, html[data-theme="light"] .ed .ed-b, html[data-theme="light"] .ed .ed-num { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .ed .ed-task, html[data-theme="light"] .ed .ed-in { border-color: rgba(45, 212, 191, .5); }
html[data-theme="light"] .ed .ed-tap.is-empty { border-color: #facc15; } html[data-theme="light"] .ed .ed-block .ed-b.is-cross { border-color: #fb7185; }
html[data-theme="light"] .ed .ed-opt[aria-pressed="true"], html[data-theme="light"] .ed .ed-cat[aria-pressed="true"] { border-color: #2dd4bf; }
.ed-dgrid { display: flex; flex-wrap: wrap; gap: 4px; direction: ltr; font-family: var(--mono); }
.ed-dcol { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 2rem; padding: .25rem .15rem; border-radius: .4rem; background: #111a2e; border: 1px solid rgba(148, 163, 184, .25); }
.ed-dcol b { font-size: 1rem; color: #f1f5f9; } .ed-dcol i { font-style: normal; font-size: .7rem; color: #e2e8f0; } .ed-dcol span { font-size: .86rem; color: #5eead4; border-top: 1px solid rgba(148, 163, 184, .3); width: 100%; text-align: center; padding-top: 2px; }
.ed-dcol.ed-cd { border-color: #facc15; background: #2a2410; } .ed-dcol.ed-cd .ed-in { width: 2.3rem; padding: .1rem; text-align: center; }
.ed-nums .ed-in { flex: 0 0 auto; }
html[data-theme="light"] .ed .ed-dcol { border-color: rgba(148, 163, 184, .25); } html[data-theme="light"] .ed .ed-dcol.ed-cd { border-color: #facc15; }

/* ===== chem-equilibrium: Reversible Reactions (/code/labs/chem-equilibrium, web/static/js/labs/chem-equilibrium.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-equilibrium"] .bl-zoom { display: none !important; }   /* phones get the apparatus drawn bigger instead */
.cx-lab-sec[data-bench="chem-equilibrium"] .bl-read { font-weight: 500; line-height: 1.5; }
.cq { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cq [hidden] { display: none !important; }
.cq-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.cq-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.cq-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(132, 204, 22, .22); color: #d9f99d; font-size: .8rem; }
.cq-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.cq-lab { min-width: 9.5rem; }
.cq-eq { margin: 0; color: #f9a8d4; font-weight: 700; line-height: 1.5; }
.cq-eq span { color: #e2e8f0; font-weight: 500; font-size: .86rem; }
.cq-live p { margin: .3rem 0 0; line-height: 1.5; }
.cq-live b { color: #fde68a; }
.cq-small { color: #e2e8f0; font-size: .86rem; }
.cq-table { border-collapse: collapse; }
.cq-table th { text-align: left; font-weight: 600; padding: .2rem .5rem .2rem 0; }
.cq-table td { padding: .2rem 1rem .2rem 0; color: #fde68a; font-weight: 700; font-variant-numeric: tabular-nums; }
.cq-q { margin: .2rem 0 0; font-weight: 600; color: #f1f5f9; }
.cq-r { display: flex; gap: .45rem; align-items: flex-start; line-height: 1.4; padding: .15rem 0; }
@media (max-width: 560px) { .cq-lab { min-width: 0; width: 100%; } .cq-table th, .cq-table td { display: block; } }
.ed-block .ed-b:disabled { cursor: default; opacity: 1; }
@container (max-width: 420px) { .ed-block .ed-b { width: 1.5rem; height: 1.8rem; font-size: .88rem; } .ed-block { border-spacing: 2px; } .ed-block th { padding-right: .15rem; } .ed-mark { min-width: 1.1rem; } }

/* ===== csma: CSMA/CD: Sharing a Cable (/code/labs/csma, web/static/js/labs/csma.js). The bench stays dark in both themes. ===== */
.cm-lab .bl-board-wrap, .cm-lab .bl-read, .cm-lab .bl-controls, .cm-lab .bl-data { display: none !important; }
.cm { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.cm h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; overflow-wrap: anywhere; }
.cm-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.cm-task { border-color: rgba(251, 146, 60, .5); }
.cm-msg:empty { display: none; }
.cm-cap, .cm-key { margin: .5rem 0 0; font-size: .8rem; color: #e2e8f0; }
.cm-key { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .45rem; font-size: .74rem; color: #e2e8f0; }
.cm-sw { display: inline-grid; place-items: center; width: 1rem; height: 1rem; border-radius: .2rem; font-size: .62rem; }
.cm .is-ok { color: #86efac; } .cm .is-no { color: #fda4af; }
.cm-ha { --c: #f59e0b; } .cm-hb { --c: #2dd4bf; } .cm-hc { --c: #f472b6; } .cm-hd { --c: #a78bfa; } .cm-he { --c: #a3e635; } .cm-hf { --c: #38bdf8; } .cm-hg { --c: #fb923c; } .cm-hh { --c: #fb7185; } .cm-hbus { --c: #94a3b8; }
.cm-scroll { overflow-x: auto; }
.cm-tl { border-collapse: separate; border-spacing: 2px; direction: ltr; font-family: var(--mono); }
.cm-tl th { font-size: .7rem; color: #e2e8f0; font-weight: 700; padding: 0 .3rem 0 0; text-align: right; white-space: nowrap; font-family: system-ui, sans-serif; }
.cm-tl thead th { text-align: center; padding: 0; min-width: 1.3rem; font-family: var(--mono); font-weight: 400; }
.cm-tl thead th.is-now { color: #fde047; font-weight: 800; }
.cm-tl th small { font-weight: 400; color: #5eead4; font-size: .72rem; }
.cm-tl td { width: 1.3rem; height: 1.35rem; padding: 0; text-align: center; border-radius: .2rem; background: #111a2e; font-size: .68rem; color: #0b1220; font-weight: 800; }
.cm-tl td.is-now { box-shadow: inset 0 0 0 2px #fde047; }
.cm-frame { background: var(--c) !important; }
.cm-broken { background: #be123c !important; color: #fff !important; }
.cm-jam { background: repeating-linear-gradient(135deg, #f43f5e 0 4px, #7f1d1d 4px 8px) !important; color: #fff !important; }
.cm-wait { background: rgba(148, 163, 184, .28) !important; color: #e2e8f0 !important; }
.cm-busrow th { color: #fde68a; }
.cm-mini td { width: .55rem; height: 1rem; border-radius: 2px; }
.cm-mini { border-spacing: 1px; }
.cm-bus { margin: .2rem 0 .4rem; }
.cm-stations { display: flex; gap: .4rem; justify-content: space-around; }
.cm-st { flex: 1; max-width: 9rem; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .35rem .3rem; border-radius: .55rem; border: 1px solid rgba(148, 163, 184, .35); background: #111a2e; position: relative; }
.cm-st::after { content: ""; position: absolute; bottom: -.62rem; left: 50%; width: 2px; height: .6rem; background: #64748b; }
.cm-st b { font-size: 1.05rem; } .cm-st span { font-size: .72rem; color: #e2e8f0; text-align: center; }
.cm-st.is-send { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; } .cm-st.is-send span { color: var(--c); font-weight: 700; }
.cm-st.is-crash { border-color: #f43f5e; } .cm-st.is-crash span { color: #fda4af; font-weight: 700; }
.cm-cable { margin-top: .6rem; height: 1.5rem; border-radius: 999px; background: #1e293b; border: 2px solid #475569; display: grid; place-items: center; font-size: .74rem; color: #e2e8f0; }
.cm-cable.is-busy { background: color-mix(in srgb, var(--c) 30%, #0b1220); border-color: var(--c); color: #f8fafc; }
.cm-cable.is-crash { background: #4c0519; border-color: #f43f5e; color: #fecdd3; }
.cm-cable.is-jam { background: repeating-linear-gradient(135deg, #7f1d1d 0 8px, #4c0519 8px 16px); border-color: #f43f5e; color: #fff; }
.cm-status { margin: .3rem 0 .5rem; font-size: .9rem; }
.cm-btns { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.cm-lbl { font-size: .85rem; display: inline-flex; align-items: center; gap: .35rem; }
.cm-lbl select { padding: .25rem .4rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .4); background: #060b16; color: #f8fafc; font: inherit; }
.cm-stats { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .5rem 0 0; font-size: .86rem; }
.cm-order { margin: 0 0 .6rem; padding-inline-start: 1.4rem; display: flex; flex-direction: column; gap: .3rem; }
.cm-order li { font-size: .88rem; } .cm-order li > span { margin-inline-end: .3rem; }
.cm-order .cm-empty { list-style: none; margin-inline-start: -1.4rem; color: #e2e8f0; }
.cm-x { border: 0; background: transparent; color: #e2e8f0; cursor: pointer; font-size: .85rem; padding: .1rem .3rem; }
.cm-x:hover { color: #fda4af; }
.cm-bank { display: flex; flex-wrap: wrap; gap: .4rem; }
.cm-bank .bl-btn { text-align: left; }
.cm-rounds { margin: 0 0 .5rem; padding-inline-start: 1.2rem; font-size: .86rem; display: flex; flex-direction: column; gap: .3rem; }
.cm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.cm-list > li { padding: .5rem .55rem; border-radius: .55rem; background: #111a2e; }
.cm-txt { display: block; margin-bottom: .4rem; font-size: .9rem; }
.cm-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.cm-cat[aria-pressed="true"] { background: rgba(251, 146, 60, .2); border-color: #fb923c; color: #fff7ed; }
.cm-why { margin: .4rem 0 0; font-size: .8rem; }
@media (max-width: 640px) { .cm .cm-lbl select { font-size: 16px !important; } }
html[data-theme="light"] .cm .cm-panel, html[data-theme="light"] .cm .cm-st { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .cm .cm-task { border-color: rgba(251, 146, 60, .5); } html[data-theme="light"] .cm .cm-cable { border-color: #475569; }
html[data-theme="light"] .cm .cm-st.is-send { border-color: var(--c); } html[data-theme="light"] .cm .cm-st.is-crash, html[data-theme="light"] .cm .cm-cable.is-crash, html[data-theme="light"] .cm .cm-cable.is-jam { border-color: #f43f5e; }
html[data-theme="light"] .cm .cm-cable.is-busy { border-color: var(--c); } html[data-theme="light"] .cm .cm-cat[aria-pressed="true"] { border-color: #fb923c; }
@container (max-width: 420px) { .cm-tl:not(.cm-mini) td { width: 1.02rem; height: 1.25rem; font-size: .7rem; } .cm-tl:not(.cm-mini) thead th { min-width: 1.02rem; font-size: .7rem; letter-spacing: -.04em; } .cm-tl th { padding-right: .15rem; } .cm-tl th small { display: none; } }

/* ===== chem-mgo: Magnesium Oxide (/code/labs/chem-mgo, web/static/js/labs/chem-mgo.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-mgo"] .bl-zoom { display: none !important; }   /* phones get the apparatus drawn bigger instead */
.cx-lab-sec[data-bench="chem-mgo"] .bl-read { font-weight: 500; line-height: 1.5; }
.cmg { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cmg-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.cmg-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.cmg-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(250, 204, 21, .2); color: #fef08a; font-size: .8rem; }
.cmg-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.cmg-eq { margin: 0; color: #f9a8d4; font-weight: 700; }
.cmg-w { margin: 0; color: #fde68a; font-variant-numeric: tabular-nums; }
.cmg-w:empty { display: none; }
.cmg-table { border-collapse: collapse; width: 100%; max-width: 34rem; }
.cmg-table th { text-align: left; font-weight: 600; padding: .3rem .5rem .3rem 0; border-bottom: 1px solid rgba(148, 163, 184, .18); }
.cmg-table td { padding: .25rem 0; border-bottom: 1px solid rgba(148, 163, 184, .18); width: 7.5rem; }
.cmg-in { width: 6.5rem; padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .92rem; font-variant-numeric: tabular-nums; }
.cmg-calc p { margin: .3rem 0; line-height: 1.5; }
.cmg-calc b { color: #fde68a; }
.cmg-line { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: .25rem 0; }
.cmg-line i { font-style: normal; color: #e2e8f0; }
.cmg-r { display: flex; gap: .45rem; align-items: flex-start; line-height: 1.4; padding: .15rem .3rem; }

/* ===== sensors: Automated Systems (/code/labs/sensors, web/static/js/labs/sensors.js). The bench stays dark in both themes. ===== */
.au-lab .bl-board-wrap, .au-lab .bl-read, .au-lab .bl-controls, .au-lab .bl-data { display: none !important; }
.au { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; }
.au h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; overflow-wrap: anywhere; }
.au h3 small { font-weight: 400; color: #e2e8f0; font-size: .78rem; }
.au-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.au-task { border-color: rgba(251, 146, 60, .5); }
.au-msg:empty { display: none; }
.au-cap { margin: .5rem 0 0; font-size: .8rem; color: #e2e8f0; }
.au .is-ok { color: #86efac; } .au .is-no { color: #fda4af; }
.au-rule { margin: .2rem 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-weight: 700; font-size: .95rem; }
.au-in { background: #111a2e; color: #f8fafc; border: 1px solid rgba(148, 163, 184, .45); border-radius: .45rem; padding: .3rem .45rem; font: inherit; font-size: 1rem; }
.au-num { width: 4.2rem; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }
.au-in:focus { outline: 2px solid #fb923c; outline-offset: 1px; }
.au-track { position: relative; height: 2.6rem; margin: .2rem 0 .6rem; border-bottom: 2px dashed rgba(148, 163, 184, .4); direction: ltr; }
.au-robot { position: absolute; bottom: .1rem; font-size: 1.7rem; line-height: 1; transform: scaleX(-1); transition: left .5s; }
.au-robot.is-crash { filter: drop-shadow(0 0 6px #f43f5e); }
.au-wall { position: absolute; right: 0; bottom: .1rem; font-size: 1.7rem; line-height: 1; }
.au-scroll { overflow-x: auto; }
.au-t { width: 100%; border-collapse: collapse; font-size: .82rem; }
.au-t th, .au-t td { padding: .28rem .4rem; border-bottom: 1px solid rgba(148, 163, 184, .18); text-align: left; }
.au-t th { color: #e2e8f0; font-weight: 700; font-size: .74rem; }
.au-t tr.is-hit td { background: rgba(34, 197, 94, .12); }
.au-t tr.is-crash td { color: #fda4af; font-weight: 700; }
.au-t tr.is-wrong td { background: rgba(244, 63, 94, .16); }
.au-t small { color: #e2e8f0; font-size: .74rem; }
.au-t b { font-family: ui-monospace, Menlo, Consolas, monospace; color: #e2e8f0; }
.au-t b.is-ok { color: #86efac; }
.au-chart { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 9rem; padding-top: 1rem; direction: ltr; }
.au-band { position: absolute; left: 0; right: 0; background: rgba(34, 197, 94, .12); border-top: 1px dashed rgba(134, 239, 172, .6); border-bottom: 1px dashed rgba(134, 239, 172, .6); pointer-events: none; }
.au-col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.au-bar { position: relative; display: block; width: 100%; background: #f59e0b; border-radius: .15rem .15rem 0 0; }
.au-bar.is-bad { background: #f43f5e; }
.au-bar i { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .62rem; color: #e2e8f0; font-family: ui-monospace, Menlo, Consolas, monospace; }
.au-acts { display: flex; flex-direction: column; gap: 2px; margin-top: .3rem; direction: ltr; }
.au-arow { display: flex; gap: 2px; align-items: center; }
.au-arow span { display: none; }
.au-arow i { flex: 1; min-width: 0; height: 1.05rem; display: grid; place-items: center; font-style: normal; font-size: .7rem; border-radius: .15rem; background: #111a2e; }
.au-arow i.is-heat { background: rgba(249, 115, 22, .35); }
.au-arow i.is-vent { background: rgba(56, 189, 248, .35); }
.au-hours i { background: none; color: #e2e8f0; font-size: .66rem; }
@container (min-width: 560px) { .au-arow span { display: block; width: 3.6rem; flex: none; font-size: .72rem; color: #e2e8f0; } .au-chart { margin-left: calc(3.6rem + 2px); } .au-bar i { font-size: .7rem; } }
@container (max-width: 420px) { .au-bar i { display: none; } .au-bar.is-bad i { display: block; color: #fda4af; } }
.au-order { margin: 0 0 .6rem; padding: 0; list-style: none; counter-reset: au; display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; }
.au-order li { counter-increment: au; padding: .3rem .45rem; border-radius: .45rem; background: rgba(251, 146, 60, .14); border: 1px solid rgba(251, 146, 60, .4); display: flex; gap: .45rem; align-items: flex-start; }
.au-order li::before { content: counter(au); flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center; background: #fb923c; color: #0b1220; font-weight: 800; font-size: .75rem; }
.au-order li span { flex: 1; }
.au-order li.au-empty::before { content: none; }
.au-order li.au-empty { background: none; border: 0; color: #e2e8f0; }
.au-x { background: none; border: 0; color: #fda4af; cursor: pointer; font-size: .9rem; padding: 0 .2rem; }
.au-bank { display: flex; flex-direction: column; gap: .35rem; }
.au-bank .bl-btn { text-align: left; white-space: normal; }
.au-list { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .6rem; font-size: .88rem; list-style: decimal; }
.au-cats { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.au-cat[aria-pressed="true"] { border-color: #fb923c; background: rgba(251, 146, 60, .2); }
.au-why { margin: .3rem 0 0; font-size: .8rem; }
:root[data-theme="light"] .au-panel:not(.au-task) { border-color: rgba(71, 85, 105, .45); }
/* au: the light theme sets every border colour (html[data-theme=light] *); keep the bench's own borders. */
html[data-theme="light"] .au-panel { border-color: rgba(148, 163, 184, .26); }
html[data-theme="light"] .au-task { border-color: rgba(251, 146, 60, .5); }
html[data-theme="light"] .au-in { border-color: rgba(148, 163, 184, .45); }
html[data-theme="light"] .au-track { border-bottom-color: rgba(148, 163, 184, .4); }
html[data-theme="light"] .au-t th, html[data-theme="light"] .au-t td { border-bottom-color: rgba(148, 163, 184, .18); }
html[data-theme="light"] .au-band { border-top-color: rgba(134, 239, 172, .6); border-bottom-color: rgba(134, 239, 172, .6); }
html[data-theme="light"] .au-order li { border-color: rgba(251, 146, 60, .4); }
html[data-theme="light"] .au-cat[aria-pressed="true"] { border-color: #fb923c; }

/* ===== chem-haber: The Haber Process (/code/labs/chem-haber, web/static/js/labs/chem-haber.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-haber"] .bl-zoom { display: none !important; }   /* phones get the plant and graph drawn bigger instead */
.cx-lab-sec[data-bench="chem-haber"] .bl-read { font-weight: 500; line-height: 1.5; }
.chb { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.chb-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.chb-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.chb-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(251, 146, 60, .22); color: #fed7aa; font-size: .8rem; }
.chb-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.chb-lab { min-width: 9.5rem; }
.chb-eq { margin: 0; color: #f9a8d4; font-weight: 700; line-height: 1.5; }
.chb-eq span { color: #e2e8f0; font-weight: 500; font-size: .86rem; }
.chb-live p { margin: .3rem 0 0; line-height: 1.5; }
.chb-live b { color: #fde68a; }
.chb-small { color: #e2e8f0; font-size: .86rem; }
.chb-table { border-collapse: collapse; }
.chb-table th { text-align: left; font-weight: 600; padding: .2rem .8rem .2rem 0; }
.chb-table td { padding: .2rem 0; color: #fde68a; font-weight: 700; font-variant-numeric: tabular-nums; }
.chb-q { margin: .2rem 0 0; font-weight: 600; color: #f1f5f9; }
.chb-r { display: flex; gap: .45rem; align-items: flex-start; line-height: 1.4; padding: .15rem 0; }
@media (max-width: 560px) { .chb-lab { min-width: 0; width: 100%; } }
.chb-in { width: 9rem; padding: .3rem .45rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .92rem; font-variant-numeric: tabular-nums; }
.chb-pp th { padding-right: .35rem; }
.chb-pp td { padding-right: 1rem; }
@media (max-width: 560px) { .chb-pp th, .chb-pp td { display: inline-block; } }

/* ===== transmit: Data Transmission (/code/labs/transmit, web/static/js/labs/transmit.js). The bench stays dark in both themes. ===== */
.tx-lab .bl-board-wrap, .tx-lab .bl-read, .tx-lab .bl-controls, .tx-lab .bl-data { display: none !important; }
.tx { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.tx h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; overflow-wrap: anywhere; }
.tx h3 small { font-weight: 400; color: #e2e8f0; font-size: .78rem; }
.tx-arrow { color: #7dd3fc; font-weight: 800; }
.tx-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.tx-task { border-color: rgba(56, 189, 248, .5); }
.tx-msg:empty { display: none; }
.tx-cap { margin: .5rem 0 0; font-size: .8rem; color: #e2e8f0; }
.tx .is-ok dd, .tx-why.is-ok { color: #86efac; } .tx .is-no dd, .tx-why.is-no { color: #fda4af; }
.tx-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: .25rem 0; }
.tx-pick > span { width: 5.2rem; font-size: .8rem; font-weight: 700; color: #e2e8f0; }
@container (max-width: 520px) { .tx-pick > span { width: 100%; } }
.tx-opt[aria-pressed="true"] { border-color: #38bdf8; background: rgba(56, 189, 248, .2); color: #f0f9ff; }
.tx-len { display: flex; align-items: center; gap: .4rem; margin-top: .4rem; font-size: .85rem; font-weight: 700; }
.tx-in { width: 4.5rem; background: #111a2e; color: #f8fafc; border: 1px solid rgba(148, 163, 184, .45); border-radius: .45rem; padding: .3rem .45rem; font: inherit; font-size: 1rem; font-family: var(--mono); text-align: center; }
.tx-in:focus { outline: 2px solid #38bdf8; outline-offset: 1px; }
.tx-wire { direction: ltr; overflow-x: auto; padding-bottom: .2rem; }
.tx-wl { flex: none; width: 3.6rem; font-size: .7rem; color: #e2e8f0; }
.tx-wire.is-serial { display: flex; align-items: flex-start; gap: .3rem; }
.tx-lane { display: flex; gap: .35rem; padding: .25rem .3rem; border-radius: .4rem; background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(125, 211, 252, .08) 6px 7px); border-top: 2px solid #7dd3fc; }
.tx-byte { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.tx-byte small { font-size: .72rem; color: #e2e8f0; font-family: var(--mono); }
.tx-bits { display: flex; gap: 1px; }
.tx-b { display: inline-grid; place-items: center; width: 1.05rem; height: 1.25rem; border-radius: .2rem; background: #1e293b; color: #e2e8f0; font-style: normal; font-family: var(--mono); font-size: .78rem; }
.tx-b.is-1 { background: #0ea5e9; color: #04131f; font-weight: 800; }
.tx-b.is-gap { background: transparent; color: #475569; }
.tx-wire.is-par { display: flex; flex-direction: column; gap: 2px; }
.tx-row { display: flex; align-items: center; gap: 2px; }
.tx-row .tx-b { flex: none; border-top: 1px solid rgba(125, 211, 252, .35); }
.tx-row.is-late .tx-wl { color: #fda4af; }
.tx-chars small { flex: none; width: 1.05rem; text-align: center; font-size: .72rem; color: #e2e8f0; font-family: var(--mono); }
.tx-got small { color: #86efac; font-weight: 700; } .tx-got small.is-bad { color: #fda4af; }
.tx-read { margin: .6rem 0 0; display: grid; gap: .45rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.tx-read > div { border: 1px solid rgba(148, 163, 184, .22); border-radius: .55rem; padding: .4rem .55rem; background: #0f172a; min-width: 0; }
.tx-read dt { font-size: .74rem; color: #e2e8f0; }
.tx-read dd { margin: .1rem 0; font-family: var(--mono); font-weight: 700; font-size: .95rem; color: #fde68a; overflow-wrap: anywhere; }
.tx-read p { margin: 0; font-size: .78rem; color: #e2e8f0; }
.tx-list { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .6rem; font-size: .88rem; list-style: decimal; }
.tx-cats { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.tx-why { margin: .3rem 0 0; font-size: .8rem; }
:root[data-theme="light"] .tx-panel:not(.tx-task) { border-color: rgba(71, 85, 105, .45); }
/* tx: the light theme sets every border colour (html[data-theme=light] *); keep the bench's own borders. */
html[data-theme="light"] .tx-panel { border-color: rgba(148, 163, 184, .26); }
html[data-theme="light"] .tx-task { border-color: rgba(56, 189, 248, .5); }
html[data-theme="light"] .tx-opt[aria-pressed="true"] { border-color: #38bdf8; }
html[data-theme="light"] .tx-in { border-color: rgba(148, 163, 184, .45); }
html[data-theme="light"] .tx-lane { border-top-color: #7dd3fc; }
html[data-theme="light"] .tx-row .tx-b { border-top-color: rgba(125, 211, 252, .35); }
html[data-theme="light"] .tx-read > div { border-color: rgba(148, 163, 184, .22); }


/* ===== storage: How Storage Works (/code/labs/storage, web/static/js/labs/storage.js). The bench stays dark in both themes. ===== */
.sg-lab .bl-board-wrap, .sg-lab .bl-read, .sg-lab .bl-controls, .sg-lab .bl-data { display: none !important; }
.sg { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.sg h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; overflow-wrap: anywhere; }
.sg-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.sg-task { border-color: rgba(167, 139, 250, .55); }
.sg-msg:empty { display: none; }
.sg-cap { margin: .5rem 0 0; font-size: .8rem; color: #e2e8f0; }
.sg-media, .sg-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.sg-opt[aria-pressed="true"] { border-color: #a78bfa; background: rgba(167, 139, 250, .22); color: #f5f3ff; }
.sg-reader { font-size: .76rem; color: #c4b5fd; font-weight: 700; margin-bottom: .25rem; }
.sg-track { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; direction: ltr; }
.sg-cell { position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; gap: .25rem; min-width: 0; height: 5.6rem; padding: .3rem .15rem .25rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .35); background: #111a2e; color: #e2e8f0; cursor: pointer; font: inherit; }
.sg-cell:focus-visible { outline: 2px solid #a78bfa; outline-offset: 2px; }
.sg-cell b { text-align: center; font-family: var(--mono); font-size: 1rem; }
.sg-cell.is-1 b { color: #fde047; }
.sg-mag { flex: 1; display: grid; place-items: center; border-radius: .35rem; font-size: 1.3rem; font-weight: 800; color: #fff; white-space: nowrap; background: linear-gradient(90deg, #dc2626 0 50%, #2563eb 50% 100%); }
.sg-magnetic.is-0 .sg-mag { background: linear-gradient(90deg, #2563eb 0 50%, #dc2626 50% 100%); }
.sg-ray { text-align: center; font-size: .95rem; height: 1.4rem; color: #fde047; }
.sg-optical.is-0 .sg-ray { color: #e2e8f0; }
.sg-surf { height: 1.4rem; border-radius: .2rem; background: linear-gradient(180deg, #e2e8f0, #94a3b8); }
.sg-optical.is-0 .sg-surf { background: linear-gradient(180deg, #0b1220 0 55%, #64748b 55% 100%); box-shadow: inset 0 0 0 2px #94a3b8; }
.sg-cg { height: .5rem; border-radius: .15rem; background: #a78bfa; }
.sg-fg { height: 1.6rem; border-radius: .2rem; border: 1px dashed #c4b5fd; display: grid; place-items: center; font-size: .7rem; font-weight: 800; color: #fde047; }
.sg-flash.is-0 .sg-fg { background: rgba(250, 204, 21, .16); border-style: solid; }
.sg-ch { height: .4rem; border-radius: .15rem; background: #475569; }
.sg-read { margin: 0; display: grid; gap: .45rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.sg-read > div { border: 1px solid rgba(148, 163, 184, .22); border-radius: .55rem; padding: .4rem .55rem; background: #0f172a; min-width: 0; }
.sg-read dt { font-size: .74rem; color: #e2e8f0; }
.sg-read dd { margin: .1rem 0; font-family: var(--mono); font-weight: 700; font-size: 1.05rem; color: #fde68a; overflow-wrap: anywhere; }
.sg-read p { margin: 0; font-size: .78rem; color: #e2e8f0; }
.sg .is-ok dd, .sg-why.is-ok { color: #86efac; } .sg .is-no dd, .sg-why.is-no { color: #fda4af; }
.sg-words { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.sg-words li { padding: .15rem .5rem; border-radius: 999px; border: 1px solid rgba(167, 139, 250, .45); font-size: .8rem; }
.sg-words li.is-used { opacity: .45; text-decoration: line-through; }
.sg-cloze p { margin: 0 0 .5rem; font-size: .92rem; line-height: 2.1; }
.sg-sel { max-width: 100%; background: #111a2e; color: #f8fafc; border: 1px solid rgba(167, 139, 250, .6); border-radius: .4rem; padding: .15rem .3rem; font: inherit; font-size: 1rem; }
.sg-sel.is-ok { border-color: #22c55e; } .sg-sel.is-no { border-color: #f43f5e; }
.sg-list { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .6rem; font-size: .88rem; list-style: decimal; }
.sg-cats { margin-top: .3rem; }
.sg-why { margin: .3rem 0 0; font-size: .8rem; }
:root[data-theme="light"] .sg-panel:not(.sg-task) { border-color: rgba(71, 85, 105, .45); }
/* sg: the light theme sets every border colour (html[data-theme=light] *); keep the bench's own borders. */
html[data-theme="light"] .sg-panel { border-color: rgba(148, 163, 184, .26); }
html[data-theme="light"] .sg-task { border-color: rgba(167, 139, 250, .55); }
html[data-theme="light"] .sg-opt[aria-pressed="true"] { border-color: #a78bfa; }
html[data-theme="light"] .sg-cell { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .sg-fg { border-color: #c4b5fd; }
html[data-theme="light"] .sg-read > div { border-color: rgba(148, 163, 184, .22); }
html[data-theme="light"] .sg-words li { border-color: rgba(167, 139, 250, .45); }
html[data-theme="light"] .sg-sel { border-color: rgba(167, 139, 250, .6); }
html[data-theme="light"] .sg-sel.is-ok { border-color: #22c55e; }
html[data-theme="light"] .sg-sel.is-no { border-color: #f43f5e; }

/* ===== validate: Validation Checks (/code/labs/validate, web/static/js/labs/validate.js). The bench stays dark in both themes. ===== */
.vd-lab .bl-board-wrap, .vd-lab .bl-read, .vd-lab .bl-controls, .vd-lab .bl-data { display: none !important; }
.vd { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.vd h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; overflow-wrap: anywhere; }
.vd h3 small { font-weight: 500; color: #e2e8f0; }
.vd-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.vd-task { border-color: rgba(52, 211, 153, .55); }
.vd-msg:empty { display: none; }
.vd-cap { margin: .5rem 0 0; font-size: .82rem; color: #e2e8f0; }
.vd-checks { margin: 0 0 .5rem; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.vd-check { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; padding: .4rem .5rem; border-radius: .55rem; background: #111a2e; border: 1px solid rgba(52, 211, 153, .3); font-size: .86rem; }
.vd-check > b { color: #6ee7b7; }
.vd-cbody { flex: 1 1 12rem; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; color: #e2e8f0; min-width: 0; }
.vd-cbody small, .vd-part small { color: #e2e8f0; font-size: .76rem; }
.vd-part { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; flex-basis: 100%; }
.vd-in { width: 4.2rem; background: #0b1220; color: #f8fafc; border: 1px solid rgba(148, 163, 184, .5); border-radius: .4rem; padding: .2rem .35rem; font: inherit; font-family: var(--mono); font-size: 1rem; }
.vd-in.is-wide { width: 8rem; }
.vd-sel { width: auto; font-family: inherit; font-size: .9rem; }
.vd-in:focus-visible { outline: 2px solid #34d399; outline-offset: 1px; }
.vd-x { margin-left: auto; border: 0; background: none; color: #e2e8f0; font-size: 1rem; cursor: pointer; padding: .1rem .3rem; border-radius: .3rem; }
.vd-x:hover { color: #fda4af; }
.vd-add, .vd-cats { display: flex; flex-wrap: wrap; gap: .35rem; }
.vd-opt[aria-pressed="true"] { border-color: #34d399; background: rgba(52, 211, 153, .2); color: #ecfdf5; }
.vd-ta { width: 100%; box-sizing: border-box; background: #111a2e; color: #f8fafc; border: 1px solid rgba(148, 163, 184, .45); border-radius: .5rem; padding: .4rem .5rem; font-family: var(--mono); font-size: 1rem; }
.vd-rows { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.vd-row { border: 1px solid rgba(148, 163, 184, .22); border-left-width: 4px; border-radius: .55rem; padding: .4rem .55rem; background: #0f172a; min-width: 0; }
.vd-row.is-right { border-left-color: #22c55e; }
.vd-row.is-wrong { border-left-color: #f43f5e; background: rgba(244, 63, 94, .1); }
.vd-top { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.vd-v { font-family: var(--mono); font-size: 1rem; font-weight: 700; color: #fde68a; overflow-wrap: anywhere; min-width: 0; }
.vd-v i { font-family: inherit; font-weight: 500; color: #e2e8f0; }
.vd-res { font-size: .8rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; }
.vd-res.is-acc { background: rgba(34, 197, 94, .18); color: #86efac; }
.vd-res.is-rej { background: rgba(244, 63, 94, .18); color: #fda4af; }
.vd-want { margin-left: auto; font-size: .8rem; color: #e2e8f0; }
.vd-row.is-wrong .vd-want { color: #fda4af; font-weight: 700; }
.vd-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.vd-chip { font-size: .76rem; padding: .1rem .45rem; border-radius: .4rem; border: 1px solid rgba(148, 163, 184, .3); color: #e2e8f0; overflow-wrap: anywhere; }
.vd-chip b { color: #e2e8f0; }
.vd-chip.is-pass { border-color: rgba(34, 197, 94, .45); }
.vd-chip.is-fail { border-color: rgba(244, 63, 94, .6); color: #fecdd3; }
.vd-list { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .6rem; font-size: .88rem; list-style: decimal; }
.vd-cats { margin-top: .3rem; }
.vd-why { margin: .3rem 0 0; font-size: .8rem; }
.vd-why.is-ok { color: #86efac; } .vd-why.is-no { color: #fda4af; }
.vd-td { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .45rem; }
.vd-td li { border: 1px solid rgba(148, 163, 184, .25); border-left-width: 4px; border-radius: .55rem; padding: .45rem .55rem; background: #111a2e; }
.vd-td li.is-right { border-left-color: #22c55e; } .vd-td li.is-wrong { border-left-color: #f43f5e; }
.vd-td label { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: .86rem; }
.vd-td label b { color: #6ee7b7; }
.vd-td label small { flex: 1 1 12rem; color: #e2e8f0; font-size: .78rem; }
.vd-tdsay { margin: .35rem 0 0; font-size: .82rem; color: #e2e8f0; }
.vd-td li.is-right .vd-tdsay { color: #86efac; } .vd-td li.is-wrong .vd-tdsay { color: #fda4af; }
:root[data-theme="light"] .vd-panel:not(.vd-task) { border-color: rgba(71, 85, 105, .45); }
/* vd: the light theme sets every border colour (html[data-theme=light] *); keep the bench's own borders. */
html[data-theme="light"] .vd-panel { border-color: rgba(148, 163, 184, .26); }
html[data-theme="light"] .vd-task { border-color: rgba(52, 211, 153, .55); }
html[data-theme="light"] .vd-check { border-color: rgba(52, 211, 153, .3); }
html[data-theme="light"] .vd-in { border-color: rgba(148, 163, 184, .5); }
html[data-theme="light"] .vd-opt[aria-pressed="true"] { border-color: #34d399; }
html[data-theme="light"] .vd-ta { border-color: rgba(148, 163, 184, .45); }
html[data-theme="light"] .vd-row { border-color: rgba(148, 163, 184, .22); }
html[data-theme="light"] .vd-row.is-right { border-left-color: #22c55e; }
html[data-theme="light"] .vd-row.is-wrong { border-left-color: #f43f5e; }
html[data-theme="light"] .vd-chip { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .vd-chip.is-pass { border-color: rgba(34, 197, 94, .45); }
html[data-theme="light"] .vd-chip.is-fail { border-color: rgba(244, 63, 94, .6); }
html[data-theme="light"] .vd-td li { border-color: rgba(148, 163, 184, .25); }
html[data-theme="light"] .vd-td li.is-right { border-left-color: #22c55e; }
html[data-theme="light"] .vd-td li.is-wrong { border-left-color: #f43f5e; }

/* ===== dns: Finding a Web Page (/code/labs/dns, web/static/js/labs/dns.js). The bench stays dark in both themes. ===== */
.dn-lab .bl-board-wrap, .dn-lab .bl-read, .dn-lab .bl-controls, .dn-lab .bl-data { display: none !important; }
.dn { container-type: inline-size; display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.dn h3 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 700; color: #f1f5f9; }
.dn h4 { margin: 0 0 .35rem; font-size: .86rem; font-weight: 700; color: #f1f5f9; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; }
.dn code { font-family: var(--mono); color: #fde68a; overflow-wrap: anywhere; }
.dn-panel { border: 1px solid rgba(148, 163, 184, .26); border-radius: .8rem; background: #0b1220; padding: .6rem .7rem .7rem; min-width: 0; }
.dn-task { border-color: rgba(251, 191, 36, .55); }
.dn-msg:empty { display: none; }
.dn-cap { margin: .5rem 0 0; font-size: .82rem; color: #e2e8f0; }
.dn-acts { display: flex; flex-wrap: wrap; gap: .35rem; }
.dn-act { text-align: left; }
.dn-undo { color: #e2e8f0; }
.dn-log { margin: 0; padding-left: 1.6rem; list-style: decimal; display: flex; flex-direction: column; gap: .25rem; font-size: .86rem; color: #e2e8f0; }
.dn-log li::marker { color: #fbbf24; font-weight: 700; }
.dn-net { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@container (min-width: 760px) { .dn-net { grid-template-columns: 1fr 1.5fr 1fr; align-items: start; } }
.dn-servers { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.dn-up { text-align: center; font-size: .76rem; color: #e2e8f0; }
.dn-box { border: 1px solid rgba(148, 163, 184, .3); border-radius: .65rem; padding: .5rem .6rem; background: #111a2e; min-width: 0; }
.dn-box p { margin: .25rem 0 0; font-size: .82rem; color: #e2e8f0; }
.dn-box.is-here { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, .25); }
.dn-box.is-far { opacity: .72; }
.dn-bar { font-family: var(--mono); font-size: .82rem; padding: .25rem .45rem; border-radius: .4rem; background: #0b1220; border: 1px solid rgba(148, 163, 184, .35); color: #e2e8f0; overflow-wrap: anywhere; }
.dn-bar b { color: #fde68a; }
.dn-urlin { width: 100%; box-sizing: border-box; font-size: 1rem; color: #f8fafc; }
.dn-parts { display: flex; flex-wrap: wrap; gap: .3rem .6rem; }
.dn-parts small { color: #e2e8f0; font-size: .74rem; }
.dn-badge { font-size: .72rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; }
.dn-badge.is-ok { background: rgba(34, 197, 94, .2); color: #86efac; }
.dn-badge.is-no { background: rgba(244, 63, 94, .2); color: #fda4af; }
.dn-t { width: 100%; border-collapse: collapse; font-size: .78rem; }
.dn-t th { text-align: left; font-weight: 600; color: #e2e8f0; padding: .15rem .3rem; border-bottom: 1px solid rgba(148, 163, 184, .25); }
.dn-t td { padding: .2rem .3rem; font-family: var(--mono); color: #e2e8f0; overflow-wrap: anywhere; border-bottom: 1px solid rgba(148, 163, 184, .12); }
.dn-t tr.is-hit td { background: rgba(34, 197, 94, .2); color: #bbf7d0; font-weight: 700; }
.dn-t tr.is-new td { background: rgba(251, 191, 36, .14); color: #fde68a; }
.dn-t small { display: block; font-family: inherit; color: #fbbf24; font-size: .7rem; }
.dn-page { display: flex; flex-direction: column; gap: .3rem; padding: .5rem; border-radius: .45rem; background: #f8fafc; color: #0f172a; }
.dn-page b { font-size: .86rem; }
.dn-page span { height: .45rem; border-radius: .2rem; background: #cbd5e1; }
.dn-page span.is-s { width: 60%; }
.dn-url { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .1rem; margin-bottom: .6rem; font-family: var(--mono); font-size: 1rem; }
.dn-seg { display: inline-flex; flex-direction: column; align-items: center; padding: .15rem .3rem; border-radius: .4rem; border: 1px dashed rgba(148, 163, 184, .5); color: #fde68a; overflow-wrap: anywhere; }
.dn-seg small { font-family: system-ui, sans-serif; font-size: .72rem; color: #e2e8f0; }
.dn-seg.is-ok { border: 1px solid #22c55e; } .dn-seg.is-ok small { color: #86efac; }
.dn-seg.is-no { border: 1px solid #f43f5e; } .dn-seg.is-no small { color: #fda4af; }
.dn-sep { padding-top: .2rem; color: #e2e8f0; }
.dn-list { margin: 0; padding-left: 1.3rem; list-style: decimal; display: flex; flex-direction: column; gap: .6rem; font-size: .88rem; }
.dn-cats { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.dn-opt[aria-pressed="true"] { border-color: #fbbf24; background: rgba(251, 191, 36, .2); color: #fffbeb; }
.dn-why { margin: .3rem 0 0; font-size: .8rem; }
.dn-why.is-ok { color: #86efac; } .dn-why.is-no { color: #fda4af; }
:root[data-theme="light"] .dn-panel:not(.dn-task) { border-color: rgba(71, 85, 105, .45); }
/* dn: the light theme sets every border colour (html[data-theme=light] *); keep the bench's own borders. */
html[data-theme="light"] .dn-panel { border-color: rgba(148, 163, 184, .26); }
html[data-theme="light"] .dn-task { border-color: rgba(251, 191, 36, .55); }
html[data-theme="light"] .dn-box { border-color: rgba(148, 163, 184, .3); }
html[data-theme="light"] .dn-box.is-here { border-color: #fbbf24; }
html[data-theme="light"] .dn-bar { border-color: rgba(148, 163, 184, .35); }
html[data-theme="light"] .dn-t th { border-bottom-color: rgba(148, 163, 184, .25); }
html[data-theme="light"] .dn-t td { border-bottom-color: rgba(148, 163, 184, .12); }
html[data-theme="light"] .dn-seg { border-color: rgba(148, 163, 184, .5); }
html[data-theme="light"] .dn-seg.is-ok { border-color: #22c55e; }
html[data-theme="light"] .dn-seg.is-no { border-color: #f43f5e; }
html[data-theme="light"] .dn-opt[aria-pressed="true"] { border-color: #fbbf24; }

/* ===== chem-gases: Gas Tests (/code/labs/chem-gases, web/static/js/labs/chem-gases.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-gases"] .bl-zoom { display: none !important; }   /* phones get the apparatus drawn bigger instead */
.cx-lab-sec[data-bench="chem-gases"] .bl-read { font-weight: 500; line-height: 1.5; }
.cgs { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cgs-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.cgs-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.cgs-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(45, 212, 191, .2); color: #99f6e4; font-size: .8rem; }
.cgs-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.cgs-eq { margin: 0; color: #f9a8d4; font-weight: 700; line-height: 1.5; }
.cgs-eq:empty { display: none; }
.cgs-small { margin: 0; color: #e2e8f0; font-size: .86rem; }
.cgs-table { border-collapse: collapse; width: 100%; }
.cgs-table th { text-align: left; font-weight: 700; color: #f1f5f9; padding: .25rem .6rem .25rem 0; border-bottom: 1px solid rgba(148, 163, 184, .3); }
.cgs-table td { padding: .3rem .6rem .3rem 0; border-bottom: 1px solid rgba(148, 163, 184, .15); vertical-align: top; }
.cgs-table td + td { color: #fde68a; }
.cgs-r { display: flex; gap: .4rem; align-items: center; padding: .15rem .4rem .15rem 0; }

/* ===== chem-reactivity: Reactivity Series (/code/labs/chem-reactivity, web/static/js/labs/chem-reactivity.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-reactivity"] .bl-zoom { display: none !important; }   /* phones get the grid drawn bigger instead */
.cx-lab-sec[data-bench="chem-reactivity"] .bl-canvas { cursor: pointer; }
.cx-lab-sec[data-bench="chem-reactivity"] .bl-read { font-weight: 500; line-height: 1.5; }
.crx { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.crx-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.crx-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.crx-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(251, 113, 133, .2); color: #fecdd3; font-size: .8rem; }
.crx-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.crx-row select { max-width: 100%; padding: .35rem .5rem; border-radius: .5rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .9rem; }
.crx-small { margin: 0; color: #e2e8f0; font-size: .86rem; }
.crx-small b { color: #fde68a; }
.crx-table { border-collapse: collapse; width: 100%; }
.crx-table th { text-align: left; font-weight: 600; padding: .25rem .6rem .25rem 0; border-bottom: 1px solid rgba(148, 163, 184, .15); white-space: nowrap; vertical-align: top; }
.crx-table td { padding: .25rem 0; border-bottom: 1px solid rgba(148, 163, 184, .15); color: #e2e8f0; }
.crx-table td.is-yes { color: #fde68a; }
.crx-order { margin: 0; padding-left: 1.6rem; display: flex; flex-direction: column; gap: .3rem; }
.crx-order li { display: flex; align-items: center; gap: .4rem; }
.crx-order li span { min-width: 7.5rem; font-weight: 700; color: #f1f5f9; }
.crx-order .bl-btn { padding: .2rem .6rem; }
.crx-q { margin: .2rem 0 0; font-weight: 600; color: #f1f5f9; }
.crx-r { display: flex; gap: .45rem; align-items: flex-start; line-height: 1.4; padding: .15rem 0; }
@media (max-width: 560px) { .crx-table th { white-space: normal; } }

/* ===== chem-cracking: Cracking (/code/labs/chem-cracking, web/static/js/labs/chem-cracking.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-cracking"] .bl-zoom { display: none !important; }   /* phones get the apparatus drawn bigger instead */
.cx-lab-sec[data-bench="chem-cracking"] .bl-read { font-weight: 500; line-height: 1.5; }
.ccr { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.ccr-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.ccr-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.ccr-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(234, 179, 8, .2); color: #fef08a; font-size: .8rem; }
.ccr-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.ccr-eq { margin: 0; color: #f9a8d4; font-weight: 700; line-height: 1.5; }
.ccr-eq span { color: #e2e8f0; font-weight: 500; font-size: .86rem; }
.ccr-small { margin: 0; color: #e2e8f0; font-size: .86rem; font-variant-numeric: tabular-nums; }
.ccr-res { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .2rem; }
.ccr-res:empty { display: none; }
.ccr-res b { color: #f1f5f9; }
.ccr-q { margin: .2rem 0 0; font-weight: 600; color: #f1f5f9; }
.ccr-r { display: flex; gap: .45rem; align-items: flex-start; line-height: 1.4; padding: .15rem 0; }

/* ===== chem-ferment: Fermentation (/code/labs/chem-ferment, web/static/js/labs/chem-ferment.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-ferment"] .bl-zoom { display: none !important; }   /* phones get the apparatus and graph drawn bigger instead */
.cx-lab-sec[data-bench="chem-ferment"] .bl-read { font-weight: 500; line-height: 1.5; }
.cfm { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.cfm-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.cfm-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.cfm-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(245, 158, 11, .2); color: #fde68a; font-size: .8rem; }
.cfm-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.cfm-lab { min-width: 6.5rem; }
.cfm-eq { margin: 0; color: #f9a8d4; font-weight: 700; line-height: 1.5; }
.cfm-eq span { color: #e2e8f0; font-weight: 500; font-size: .86rem; }
.cfm-small { color: #e2e8f0; font-size: .86rem; }
.cfm-table { border-collapse: collapse; max-width: 22rem; }
.cfm-table th { text-align: left; font-weight: 600; padding: .25rem 1rem .25rem 0; border-bottom: 1px solid rgba(148, 163, 184, .3); }
.cfm-table td { padding: .25rem 1rem .25rem 0; border-bottom: 1px solid rgba(148, 163, 184, .15); color: #fde68a; font-variant-numeric: tabular-nums; }
.cfm-q { margin: .2rem 0 0; font-weight: 600; color: #f1f5f9; }
.cfm-r { display: flex; gap: .45rem; align-items: flex-start; line-height: 1.4; padding: .15rem 0; }
@media (max-width: 560px) { .cfm-lab { min-width: 0; width: 100%; } }

/* ===== chem-esters: Esters (/code/labs/chem-esters, web/static/js/labs/chem-esters.js). The bench stays dark in both themes. ===== */
.cx-lab-sec[data-bench="chem-esters"] .bl-zoom { display: none !important; }   /* phones get the structure drawn bigger instead */
.cx-lab-sec[data-bench="chem-esters"] .bl-read { font-weight: 500; line-height: 1.5; }
.ces { display: flex; flex-direction: column; gap: .7rem; color: #e2e8f0; font-size: .9rem; }
.ces-step { border: 1px solid rgba(148, 163, 184, .25); border-radius: .75rem; padding: .6rem .75rem .7rem; background: rgba(15, 23, 42, .45); display: flex; flex-direction: column; gap: .45rem; }
.ces-step h4 { margin: 0 0 .1rem; font-size: .95rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: .45rem; }
.ces-step h4 span { flex: none; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: rgba(132, 204, 22, .2); color: #d9f99d; font-size: .8rem; }
.ces-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.ces-lab { min-width: 4.5rem; }
.ces-eq { margin: 0; color: #f9a8d4; font-weight: 700; line-height: 1.5; }
.ces-small { margin: 0; color: #e2e8f0; font-size: .86rem; }
.ces-small:empty { display: none; }
.ces-in { width: 14rem; max-width: 100%; padding: .35rem .5rem; border-radius: .45rem; border: 1px solid rgba(148, 163, 184, .45); background: #0b1220; color: #f1f5f9; font-size: .95rem; }
.ces-q { margin: .2rem 0 0; font-weight: 600; color: #f1f5f9; }
.ces-r { display: flex; gap: .45rem; align-items: flex-start; line-height: 1.4; padding: .15rem 0; }
@media (max-width: 560px) { .ces-lab { min-width: 0; width: 100%; } }
/* /code/labs tiles (code/_lab_tile.html): a big icon and a short title, no paragraph. */
.lt-jump { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.5rem; }
.lt-jump a { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border-radius: 99px; text-decoration: none;
  border: 1px solid rgba(148, 163, 184, .25); background: rgba(15, 23, 42, .55); color: #e2e8f0; font-weight: 600; font-size: .95rem; }
.lt-jump a span { font-size: 1.25rem; line-height: 1; }
.lt-jump a b { padding: 0 .45em; border-radius: 99px; background: rgba(148, 163, 184, .2); color: #e2e8f0; font-size: .78rem; }
.lt-jump a:hover { border-color: #a78bfa; color: #fff; }
.lt-h { display: flex; align-items: center; gap: .5rem; margin: 2rem 0 .9rem; font-size: 1.4rem; font-weight: 800; color: #fff; scroll-margin-top: 5rem; }
.lt-h > span:first-child { font-size: 1.7rem; }
.lt-n { padding: .05rem .55rem; border-radius: 99px; background: rgba(148, 163, 184, .18); color: #e2e8f0; font-size: .85rem; font-weight: 600; }
.lt-grid { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr)); }
.lt { --h: 200; display: flex; flex-direction: column; align-items: center; gap: .6rem; height: 100%; padding: 1.05rem .6rem .8rem; border-radius: 1.1rem;
  text-align: center; text-decoration: none; color: #f8fafc;
  background: radial-gradient(130% 75% at 50% 0%, hsla(var(--h), 85%, 60%, .16), transparent 62%), #0f172a; border: 1px solid rgba(148, 163, 184, .2);
  transition: transform .15s, border-color .15s, box-shadow .15s; }
.lt:hover, .lt:focus-visible { transform: translateY(-3px); border-color: hsla(var(--h), 85%, 70%, .8); box-shadow: 0 10px 26px hsla(var(--h), 80%, 45%, .28); color: #fff; }
/* A lab's icon (web/code_labs._paint): a bright chip in the lab's own colour, a dark line icon on it. */
.lt-ico, .lf-ico, .ld-door-ico, .lg-ico, .ld-door-peek i, .lh-art span, .lablink-ico, .labov-ico {
  display: grid; place-items: center; border-radius: 28%; color: hsl(var(--h), 75%, 13%);
  background: linear-gradient(140deg, hsl(var(--h), 90%, 72%), hsl(calc(var(--h) + 16), 82%, 60%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 6px 16px hsla(var(--h), 85%, 50%, .25); }
.lab-ic { width: 56%; height: 56%; stroke-width: 2.5; }
.lt-ico { width: 3.6rem; height: 3.6rem; }
.lt-name { font-weight: 700; font-size: .92rem; line-height: 1.25; }
.lt-meta { margin-top: auto; padding: .1rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 700; color: hsl(var(--h), 90%, 84%); background: hsla(var(--h), 85%, 60%, .14); }
@media (max-width: 480px) { .lt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; } .lt { padding: .8rem .35rem .6rem; }
  .lt-ico { width: 3rem; height: 3rem; } .lt-name { font-size: .8rem; } }
@media (prefers-reduced-motion: reduce) { .lt { transition: none; } .lt:hover { transform: none; } }
html[data-theme="light"] .lt { color: #0f172a; background: radial-gradient(130% 75% at 50% 0%, hsla(var(--h), 90%, 60%, .14), transparent 62%), #fff; border-color: #e2e8f0; }
html[data-theme="light"] .lt-meta { color: hsl(var(--h), 70%, 28%); background: hsla(var(--h), 85%, 55%, .14); }
html[data-theme="light"] .lt-h { color: #0f172a; }
html[data-theme="light"] .lt-jump a { background: #fff; color: #1e293b; border-color: #cbd5e1; }
html[data-theme="light"] .lt-jump a b, html[data-theme="light"] .lt-n { background: #e2e8f0; color: #334155; }
.lt-all { color: #c4b5fd; font-weight: 600; text-decoration: none; } .lt-all:hover { color: #fff; } html[data-theme="light"] .lt-all { color: #6d28d9; }
@media (max-width: 600px) { .lt-jump { gap: .4rem; } .lt-jump a { padding: .35rem .65rem; font-size: .82rem; } .lt-jump a span { font-size: 1.05rem; } }
/* Stationary Waves: the live formula as a card. */
.cx-lab-sec[data-bench="standing"] .bl-read { padding: .7rem .9rem; border-radius: .8rem; border: 1px solid rgba(167, 139, 250, .3);
  background: linear-gradient(135deg, rgba(76, 29, 149, .25), rgba(15, 23, 42, .6)); font-weight: 500; line-height: 1.65; font-size: .95rem; }
.cx-lab-sec[data-bench="standing"] .bl-read > span { display: block; }
html[data-theme="light"] .cx-lab-sec[data-bench="standing"] .bl-read { background: #f5f3ff; border-color: #ddd6fe; color: #1e1b4b; }
html[data-theme="light"] .cx-lab-sec[data-bench="standing"] .bl-read b, html[data-theme="light"] .cx-lab-sec[data-bench="standing"] .bl-read .katex .mathbf, html[data-theme="light"] .cx-lab-sec[data-bench="standing"] .bl-read .katex .textbf { color: #6d28d9; }
.pr-eq .katex { font-size: 1.08em; }
.pr-eq .katex-display, .pr-eq .katex { white-space: normal; }
.pr-eq { overflow-x: auto; overflow-y: hidden; }
