:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1f0eb;
  --line: #e2e0d8;
  --text: #18181b;
  --muted: #5c5b57;
  --accent: #4338ca;
  --accent-soft: #e8e6ff;
  --good: #0f7a4a;
  --good-soft: #dff5ea;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --warn-soft: #fff4d6;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121214; --surface: #1b1b1f; --surface-2: #232329; --line: #34343c;
    --text: #ececec; --muted: #a6a6ad; --accent: #a5b4fc; --accent-soft: #2b2a52;
    --good: #5fd39a; --good-soft: #163527; --bad: #ff8a80; --bad-soft: #3d1c1a; --warn-soft: #3a3016;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121214; --surface: #1b1b1f; --surface-2: #232329; --line: #34343c;
  --text: #ececec; --muted: #a6a6ad; --accent: #a5b4fc; --accent-soft: #2b2a52;
  --good: #5fd39a; --good-soft: #163527; --bad: #ff8a80; --bad-soft: #3d1c1a; --warn-soft: #3a3016;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 20px; margin-bottom: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 700; color: var(--accent); margin: 0 0 8px; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; padding: 6px 0; }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 700 21px var(--display); color: var(--text); text-decoration: none; }
.logo-mark { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; }
.logo-mark i { width: 6px; border-radius: 2px; background: var(--accent); }
.logo-mark i:nth-child(1) { height: 9px; opacity: 0.5; }
.logo-mark i:nth-child(2) { height: 15px; opacity: 0.75; }
.logo-mark i:nth-child(3) { height: 22px; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex: 1; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 18px; }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; padding: 9px 16px; font-weight: 600; font-size: 14.5px; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: background 0.15s, transform 0.1s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--bg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small { padding: 6px 11px; font-size: 13px; }
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; min-width: 0;
}
input[type="number"] { width: 74px; }
textarea { width: 100%; resize: vertical; }
input.wide { flex: 1; min-width: 200px; }
input.short { width: 120px; }
input.right, select.right { border-color: var(--good); background: var(--good-soft); }
input.wrong, select.wrong { border-color: var(--bad); background: var(--bad-soft); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; }
.stack { display: grid; gap: 6px; margin: 10px 0; font-weight: 600; font-size: 14px; }
.icon { border: 0; background: transparent; cursor: pointer; font-size: 18px; color: var(--muted); padding: 2px 8px; }
.icon:disabled { opacity: 0.3; cursor: default; }

/* Layout */
main { padding: 28px 0 60px; outline: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); gap: 16px; align-items: start; }
.grid-2 > .card { margin: 0; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; font-variant-numeric: tabular-nums; }
thead th { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tbody th, tfoot th { text-align: left; font-weight: 600; }
tfoot td, tfoot th { font-weight: 700; border-bottom: 0; }
tr.current th, tr.current td { background: var(--accent-soft); }
.badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--good-soft); color: var(--good); font: 600 11.5px var(--body); vertical-align: middle; }
td.dim input { opacity: 0.4; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; }
.notice { padding: 11px 14px; border-radius: 10px; margin: 10px 0; font-size: 14.5px; }
.notice.error, .notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.good { background: var(--good-soft); color: var(--good); }
.notice.info { background: var(--warn-soft); }

/* Tool page */
.tool-head { margin-bottom: 12px; }
.tool-head h1 { font-size: clamp(30px, 5vw, 44px); }
.lede { color: var(--muted); font-size: 17px; max-width: 46em; margin: 8px 0 0; }
.theory { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; margin: 16px 0; }
.theory summary { cursor: pointer; font-weight: 600; }
.theory p, .theory ul { margin: 10px 0; }
.conventions { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-size: 14px; }
.conventions ul { margin: 6px 0 0; padding-left: 20px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; }
.tabs button { border: 0; background: transparent; padding: 10px 16px; font-weight: 600; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* Step player */
.stepper { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--surface-2); border-radius: 12px; padding: 8px 10px; margin-bottom: 14px; }
.stepper .ctl { min-width: 38px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; }
.stepper .ctl.play { background: var(--accent); color: var(--bg); border-color: var(--accent); min-width: 48px; }
.stepper input[type="range"] { flex: 1; min-width: 120px; accent-color: var(--accent); }
.step-count { font: 600 13px var(--mono); color: var(--muted); min-width: 92px; text-align: right; }
.step-note { background: var(--accent-soft); border-radius: 10px; padding: 11px 14px; margin: 12px 0 0; font-weight: 500; }
.step-note.good { background: var(--good-soft); color: var(--good); }
.step-note.bad { background: var(--bad-soft); color: var(--bad); }
.notes { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.notes li::marker { color: var(--accent); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; display: grid; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat b { font: 700 24px var(--display); }

/* CPU scheduling */
.gantt { margin: 6px 0 18px; }
.gantt-track { position: relative; height: 46px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.seg { position: absolute; top: 0; bottom: 0; background: var(--c); color: #fff; font: 700 13px var(--mono); display: grid; place-items: center; border-right: 2px solid var(--surface); overflow: hidden; transition: width 0.25s; }
.seg.idle { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--line) 6px, var(--line) 12px); color: var(--muted); }
.seg.hatch { background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.25) 0 4px, transparent 4px 9px); }
.seg.live { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25); }
.gantt-axis { position: relative; height: 22px; font: 500 12px var(--mono); color: var(--muted); }
.gantt-axis span { position: absolute; transform: translateX(-50%); top: 4px; }
.cpu-row { display: grid; grid-template-columns: auto 1fr 1fr; gap: 14px; align-items: stretch; }
.cpu { display: grid; justify-items: center; align-content: center; gap: 2px; background: var(--surface-2); border-radius: 12px; padding: 10px 18px; min-width: 110px; }
.cpu b { font: 700 26px var(--mono); padding: 2px 12px; border-radius: 8px; }
.cpu b.busy { background: var(--c); color: #fff; }
.cpu span, .cpu small, .queue > small { font-size: 12px; color: var(--muted); font-weight: 600; }
.queue { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 2px solid var(--c, var(--accent)); font: 700 13px var(--mono); }
.chip small { font: 500 11px var(--body); color: var(--muted); }
.chip.done { background: var(--c); color: #fff; }

/* Page replacement */
table.frames th, table.frames td { padding: 6px 4px; min-width: 32px; font-family: var(--mono); border: 1px solid var(--line); }
table.frames thead th { text-transform: none; font-size: 14px; color: var(--text); background: var(--surface-2); }
table.frames .future { color: transparent; background: transparent; }
table.frames thead th.future { color: var(--muted); }
table.frames .now { outline: 2px solid var(--accent); outline-offset: -2px; }
table.frames td.loaded { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
table.frames td.hitcell { background: var(--good-soft); color: var(--good); font-weight: 700; }
table.frames tr.outcome td.hit { color: var(--good); font-weight: 700; }
table.frames tr.outcome td.miss { color: var(--bad); font-weight: 700; }
td.anomaly { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.prompt { margin-top: 12px; }

/* Banker's */
table.bank th.group { text-align: center; border-bottom: 2px solid var(--line); }
table.bank td.need { font-weight: 700; color: var(--accent); }
table.bank tr.fits th, table.bank tr.fits td { background: var(--good-soft); }
table.bank tr.waits th, table.bank tr.waits td { background: var(--bad-soft); }
table.bank tr.finished td, table.bank tr.finished th { opacity: 0.6; }
table.bank-edit input { width: 58px; }
.work { gap: 12px; }
.work > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.vector { font: 700 18px var(--mono); }
.sequence { min-height: 34px; margin: 10px 0; }

/* B+ tree */
.tree-wrap { overflow-x: auto; background: var(--surface-2); border-radius: 12px; padding: 8px; }
svg.tree { display: block; margin: 0 auto; max-width: none; }
svg.tree .node rect { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
svg.tree .node.leaf rect { fill: var(--accent-soft); }
svg.tree .node text { fill: var(--text); font: 600 14px var(--mono); }
svg.tree .divider { stroke: var(--line); }
svg.tree .edge { stroke: var(--muted); stroke-width: 1.5; }
svg.tree .leaf-link { stroke: var(--accent); stroke-width: 1.3; stroke-dasharray: 4 3; }
svg.tree .arrowhead { fill: var(--accent); }
svg.tree .node.lit rect { stroke-width: 3; }
svg.tree .node.lit.path rect { stroke: var(--series-1); }
svg.tree .node.lit.changed rect, svg.tree .node.lit.found rect { stroke: var(--good); fill: var(--good-soft); }
svg.tree .node.lit.overflow rect, svg.tree .node.lit.missing rect { stroke: var(--bad); fill: var(--bad-soft); }
svg.tree .node.lit.split rect { stroke: var(--series-4); }
svg.tree .node.lit.merge rect { stroke: var(--series-7); }
.history { margin: 6px 0 0; }
.keys-list { font: 700 20px var(--mono); letter-spacing: 0.02em; }
.qa { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; margin: 14px 0; }
.qa label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.qa input, .qa select { width: 100%; }
.score { font-weight: 600; }

/* Normalisation */
.big-answer { font: 600 18px var(--body); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.big-answer b { font: 700 22px var(--mono); color: var(--accent); }
.key, .rel { display: inline-block; padding: 4px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.relations { display: flex; flex-wrap: wrap; gap: 8px; }
.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ladder > li { padding: 10px 14px; border-radius: 10px; }
.ladder > li.ok { background: var(--good-soft); color: var(--good); }
.ladder > li.no { background: var(--bad-soft); }
.ladder > li.no b { color: var(--bad); }
.ladder ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; color: var(--text); }
.notes.reveal li { animation: rise 0.25s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.fds { font-size: 16px; }

/* Home */
.hero { padding: 26px 0 30px; max-width: 760px; }
.hero h1 { font-size: clamp(44px, 9vw, 84px); letter-spacing: -0.035em; }
.hero .lede { font-size: 19px; margin: 14px 0 20px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.tool-card { display: grid; gap: 4px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; color: var(--text); text-decoration: none; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.tool-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08); }
.tool-card h2 { margin: 0; font-size: 22px; }
.tool-card p { margin: 4px 0 8px; color: var(--muted); font-size: 15px; }
.tool-card .eyebrow { margin: 10px 0 0; }
.tag { justify-self: start; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.art { height: 86px; border-radius: 12px; background: var(--surface-2); padding: 14px; display: flex; align-items: center; gap: 4px; }
.gantt-art i { height: 30px; border-radius: 5px; background: var(--c); }
.frames-art { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; }
.frames-art i, .matrix-art i { border-radius: 4px; background: color-mix(in srgb, var(--muted) 35%, transparent); }
.frames-art i.hot { background: var(--series-8); }
.matrix-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.matrix-art i.hot { background: var(--series-3); }
.tree-art { flex-direction: column; justify-content: center; gap: 10px; }
.tree-art i { display: block; width: 44px; height: 16px; border-radius: 4px; background: var(--line); border: 2px solid var(--muted); }
.tree-art i.r { width: 40px; }
.tree-art div { display: flex; gap: 10px; }
.tree-art div i { background: var(--accent-soft); border-color: var(--accent); }
.fd-art { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; font: 600 13px var(--mono); }
.fd-art .hot { color: var(--accent); }
.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; margin: 36px 0; }
.why h3 { font-size: 18px; margin-bottom: 6px; }
.why p { margin: 0; color: var(--muted); }
.next ul { columns: 2 260px; padding-left: 20px; color: var(--muted); }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 24px 0 40px; border-top: 1px solid var(--line); font-size: 14px; }

@media (max-width: 720px) {
  .cpu-row { grid-template-columns: 1fr 1fr; }
  .cpu { grid-column: 1 / -1; grid-template-columns: auto auto auto; justify-content: start; gap: 12px; }
  .card { padding: 16px; }
  .step-count { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

main:focus, main:focus-visible { outline: none; }

/* --- Navigation menus (generated from the tool registry) --- */
.nav { gap: 6px; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 7px 12px; border-radius: 9px; font-size: 14.5px; font-weight: 600; user-select: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; color: var(--muted); font-size: 12px; }
.menu summary:hover, .menu[open] summary { background: var(--surface-2); }
.menu.current summary { color: var(--accent); background: var(--accent-soft); }
.menu ul { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; list-style: none; margin: 0; padding: 6px; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14); }
.menu ul a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14.5px; }
.menu ul a:hover { background: var(--surface-2); }
.menu ul a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* --- App states --- */
.loading { color: var(--muted); padding: 40px 0; }
.error-page { padding: 40px 0; max-width: 640px; }
.error-page h1 { font-size: clamp(30px, 5vw, 44px); }
.toast { position: fixed; bottom: 18px; left: 50%; translate: -50% 0; z-index: 50; display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18); }
h1:focus { outline: none; }

/* --- Home --- */
.tool-search { width: min(520px, 100%); margin-top: 6px; padding: 12px 14px; font-size: 16px; border-radius: 12px; }
.subject { margin-top: 30px; }
.subject h2 { font-size: 24px; margin-bottom: 14px; }
.subject .count { color: var(--muted); font-weight: 500; font-size: 16px; }
.tool-card h3 { font-size: 20px; margin: 10px 0 0; }
.disk-art svg { width: 100%; height: 100%; }
.disk-art polyline { fill: none; stroke: var(--series-1); stroke-width: 3; stroke-linejoin: round; }
.graph-art { display: grid; grid-template-columns: repeat(2, auto); justify-content: center; gap: 6px 26px; font: 700 12px var(--mono); }
.graph-art .p { border: 2px solid var(--series-8); border-radius: 50%; padding: 4px 6px; }
.graph-art .r { border: 2px solid var(--muted); border-radius: 5px; padding: 3px 7px; }
.sync-art, .fd-art { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; font: 600 13px var(--mono); }
.sync-art .hot { color: var(--bad); }
.join-art { justify-content: center; }
.join-art i { width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--series-1); margin: 0 -10px; }
.join-art i.hot { border-color: var(--series-3); background: color-mix(in srgb, var(--series-3) 25%, transparent); }
.hash-art { grid-template-columns: repeat(5, 1fr); }
.hash-art i.hot { background: var(--series-4); }

/* --- Shared bits for the new tools --- */
.chart-wrap { overflow-x: auto; background: var(--surface-2); border-radius: 12px; padding: 8px; }
.row.spread { justify-content: space-between; }
.grid-2.tight { gap: 12px; }
.wide-stat { grid-column: span 2; }
.order { font-size: 15px !important; overflow-wrap: anywhere; }
.btn.toggle[aria-pressed="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.step-note.warn { background: var(--warn-soft); }
.notice.info { color: var(--text); }
.big-mono { font-size: 18px; overflow-wrap: anywhere; }
pre.sql { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; font: 500 14px var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }

/* Disk chart */
svg.disk-chart { width: 100%; min-width: 520px; height: auto; display: block; }
.disk-chart text { fill: var(--muted); font: 500 11px var(--mono); }
.disk-chart text.head-label { fill: var(--accent); font-weight: 700; }
.disk-chart .axis { stroke: var(--muted); }
.disk-chart .grid { stroke: var(--line); stroke-dasharray: 2 4; }
.disk-chart .seek { stroke: var(--series-1); stroke-width: 2.5; }
.disk-chart .seek.edge { stroke: var(--muted); }
.disk-chart .seek.jump { stroke: var(--series-8); stroke-dasharray: 6 5; }
.disk-chart .seek.current { stroke-width: 4; }
.disk-chart circle { fill: var(--surface); stroke: var(--series-1); stroke-width: 2.5; }
.disk-chart circle.start { fill: var(--accent); stroke: var(--accent); }
.disk-chart circle.served { fill: var(--series-1); }
.disk-chart circle.edge { stroke: var(--muted); }

/* Resource-allocation graph */
svg.rag { width: 100%; min-width: 420px; height: auto; display: block; }
.rag-edge { stroke-width: 2; }
.rag-edge.request { stroke: var(--series-2); stroke-dasharray: 6 4; }
.rag-edge.assign { stroke: var(--series-1); }
.rag-edge.dead { stroke: var(--bad); }
.rag .arrowhead { fill: var(--muted); }
.rag-node.process circle { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.rag-node.process.cycle circle { stroke: var(--series-4); stroke-width: 3; }
.rag-node.process.dead circle { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 3; }
.rag-node.resource rect { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.rag-node .dot { fill: var(--text); stroke: none; }
.rag-node text { fill: var(--text); font: 700 14px var(--mono); }
.legend .key-req { color: var(--series-2); font-weight: 600; }
.legend .key-asg { color: var(--series-1); font-weight: 600; }
.cycle-edge { color: var(--bad); font-weight: 700; }

/* Semaphores */
.sync-board { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.procs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 12px; }
.proc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.proc.blocked { border-color: var(--bad); background: color-mix(in srgb, var(--bad-soft) 50%, var(--surface)); }
.proc header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proc header b { font: 700 18px var(--mono); }
.proc header small { color: var(--muted); }
.status { margin-left: auto; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--good-soft); color: var(--good); }
.status.blocked { background: var(--bad-soft); color: var(--bad); }
.program { margin: 0; padding-left: 22px; font: 500 13px var(--mono); display: grid; gap: 2px; }
.program li { padding: 1px 6px; border-radius: 5px; }
.program li.pc { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.program li.pc::marker { content: "▶ "; color: var(--accent); }
.shared { display: grid; gap: 12px; }
.shared section { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.shared h3 { font-size: 14px; margin-bottom: 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.sems { display: grid; gap: 6px; }
.sem { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 10px; background: var(--surface-2); border-radius: 10px; padding: 6px 10px; }
.sem b { font: 700 22px var(--mono); }
.sem small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.sem.negative b { color: var(--bad); }
.buffer { display: flex; gap: 6px; }
.buffer span { flex: 1; height: 42px; border-radius: 8px; border: 2px dashed var(--line); display: grid; place-items: center; font: 600 11px var(--mono); }
.buffer span.full { border-style: solid; border-color: var(--series-3); background: color-mix(in srgb, var(--series-3) 18%, transparent); }
.notes.log { max-height: 320px; overflow-y: auto; }

/* SQL joins */
.join-stage { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; margin-bottom: 4px; }
table.sqltable { font-family: var(--mono); font-size: 14px; }
table.sqltable caption { text-align: left; font: 700 14px var(--body); padding: 0 0 6px; }
table.sqltable td.null { color: var(--muted); font-style: italic; }
table.sqltable tr.active td { background: var(--accent-soft); }
table.sqltable tr.match td { background: var(--good-soft); }
table.sqltable tr.nomatch td { background: var(--bad-soft); }
table.sqltable.result tr.fresh td { background: var(--good-soft); font-weight: 700; }
svg.venn { width: 110px; height: 60px; }
.venn circle.off { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.venn circle.on { fill: color-mix(in srgb, var(--accent) 35%, transparent); stroke: var(--accent); stroke-width: 1.5; }
.venn circle.both.off { fill: var(--surface); stroke: none; }
.venn circle.both.on { fill: color-mix(in srgb, var(--accent) 55%, transparent); stroke: none; }
.venn text { fill: var(--text); font: 700 11px var(--mono); }

/* Schedules */
table.schedule-grid td.op { font: 600 14px var(--mono); }
table.schedule-grid td.read { color: var(--series-1); }
table.schedule-grid td.write { color: var(--series-2); }
table.schedule-grid td.end { color: var(--muted); }
table.schedule-grid td.hot { background: var(--warn-soft); outline: 2px solid var(--series-4); outline-offset: -2px; }
svg.precedence { width: 100%; max-width: 320px; height: auto; display: block; margin: 0 auto; }
.pg-edge { stroke: var(--muted); stroke-width: 2; }
.pg-edge.latest { stroke: var(--series-4); stroke-width: 3; }
.pg-edge.cycle { stroke: var(--bad); stroke-width: 3; }
.precedence .arrowhead { fill: var(--muted); }
.pg-node circle { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.pg-node.cycle circle { stroke: var(--bad); fill: var(--bad-soft); }
.pg-node text { fill: var(--text); font: 700 14px var(--mono); }
.ladder > li.info { background: var(--warn-soft); }

/* Hashing */
ol.hash-table { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-width: 520px; }
.hash-table li { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-family: var(--mono); min-height: 38px; }
.hash-table .idx { color: var(--muted); font-weight: 700; }
.hash-table .val { font-weight: 700; }
.hash-table .chain { display: flex; flex-wrap: wrap; gap: 6px; }
.hash-table .chain b { padding: 1px 8px; border-radius: 6px; background: var(--surface-2); }
.hash-table .chain b.new { background: var(--good-soft); color: var(--good); }
.hash-table li.probed { background: var(--warn-soft); }
.hash-table li.landed { background: var(--good-soft); border-color: var(--good); }
.hash-table li.fail { background: var(--bad-soft); border-color: var(--bad); }
.probe-no { color: var(--muted); font: 600 11px var(--body); }
.ext { display: grid; grid-template-columns: minmax(170px, auto) 1fr; gap: 16px; align-items: start; }
.ext h3 { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.dir ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 14px; }
.dir li { padding: 4px 10px; border-radius: 7px; background: var(--surface-2); }
.dir li.hot { background: var(--accent-soft); color: var(--accent); }
.buckets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.bucket { border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.bucket.hot { border-color: var(--accent); }
.bucket.new { border-color: var(--series-4); }
.bucket header { display: flex; justify-content: space-between; align-items: baseline; }
.bucket header small { color: var(--muted); font-size: 12px; }
.bucket .keys { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; font: 600 14px var(--mono); }
.bucket .keys span { padding: 1px 7px; border-radius: 6px; background: var(--surface-2); }
.bucket .keys span.new { background: var(--good-soft); color: var(--good); }

@media (max-width: 860px) {
  .sync-board { grid-template-columns: 1fr; }
  .ext { grid-template-columns: 1fr; }
  .wide-stat { grid-column: auto; }
}
@media (max-width: 720px) {
  .menu ul { position: fixed; left: 12px; right: 12px; top: auto; min-width: 0; }
}

.static-content h2 { font-size: 20px; margin-top: 22px; }
.static-content ul { padding-left: 20px; }
.frames-art, .matrix-art { align-items: stretch; }
.program li.pc.stuck { background: var(--bad-soft); color: var(--bad); }
.program li.pc.stuck::marker { content: "⏸ "; color: var(--bad); }
.menu .short { display: none; }
@media (max-width: 720px) {
  .top-inner { gap: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; }
  .menu .long { display: none; }
  .menu .short { display: inline; }
  .menu ul { top: auto; margin-top: 6px; }
}
.top-inner .icon-btn { margin-left: auto; }

/* --- Computer networks --- */
.bad-text { color: var(--bad); }
tr.failed th, tr.failed td { background: var(--bad-soft); }
.inline-row { margin: 0; }
.mono-notes li { font: 500 13px var(--mono); overflow-wrap: anywhere; }

/* Subnetting */
.bits-grid { display: grid; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.bits-row { display: grid; grid-template-columns: 120px auto 1fr; align-items: center; gap: 12px; min-width: 560px; }
.bits-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.bits { display: inline-flex; font: 600 14px var(--mono); }
.bits i { font-style: normal; width: 13px; text-align: center; border-radius: 3px; }
.bits i.net { background: color-mix(in srgb, var(--series-1) 18%, transparent); color: var(--series-1); }
.bits i.host { background: color-mix(in srgb, var(--series-2) 18%, transparent); color: var(--series-2); }
.bits i.dot { width: 8px; color: var(--muted); background: none; }
.bits-dec { font-size: 14px; }
.key-net { color: var(--series-1); font-weight: 600; }
.key-host { color: var(--series-2); font-weight: 600; }
.space-bar { position: relative; height: 44px; border-radius: 10px; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--line) 6px, var(--line) 12px); overflow: hidden; margin: 6px 0; }
.space-bar i { position: absolute; top: 0; bottom: 0; background: var(--c); color: #fff; font: 700 12px var(--body); display: grid; place-items: center; border-right: 2px solid var(--surface); overflow: hidden; white-space: nowrap; }

/* Sliding window timeline */
.timeline-wrap { overflow-x: auto; background: var(--surface-2); border-radius: 12px; padding: 6px; max-height: 620px; overflow-y: auto; }
svg.timeline { width: 100%; min-width: 360px; height: auto; display: block; }
.timeline .lane { stroke: var(--text); stroke-width: 3; }
.timeline .lane-label { fill: var(--text); font: 700 13px var(--body); }
.timeline .tick { fill: var(--muted); font: 500 10px var(--mono); }
.timeline .tick.now { fill: var(--accent); font-weight: 700; }
.timeline .now-line { stroke: var(--accent); stroke-dasharray: 3 4; opacity: 0.6; }
.timeline .msg line { stroke-width: 2; }
.timeline .msg.frame line { stroke: var(--series-1); }
.timeline .msg.ack line { stroke: var(--series-3); stroke-dasharray: 5 3; }
.timeline .msg.lost line { stroke: var(--bad); }
.timeline .msg.discarded line { stroke: var(--muted); }
.timeline .msg.flying { opacity: 0.45; }
.timeline .msg-label { fill: var(--text); font: 600 11px var(--mono); }
.timeline .result-label { fill: var(--muted); font: 600 10px var(--body); }
.timeline .cross { fill: var(--bad); font: 700 16px var(--body); }
.timeline marker path { fill: var(--muted); }
.win-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.win-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.win-label { width: 72px; font-size: 13px; font-weight: 600; color: var(--muted); }
.win-row i { font: 700 13px var(--mono); font-style: normal; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; border: 2px solid transparent; }
.win-row i.acked { background: var(--good-soft); color: var(--good); }
.win-row i.sent { background: var(--warn-soft); border-color: var(--series-4); }
.win-row i.usable { border-color: var(--accent); }
.win-row i.out { background: var(--surface-2); color: var(--muted); }
.key { font-weight: 600; }
.key.acked { color: var(--good); } .key.sent { color: var(--series-4); } .key.usable { color: var(--accent); } .key.out { color: var(--muted); }

/* Routing */
svg.net { width: 100%; max-width: 440px; height: auto; display: block; margin: 0 auto; }
.net-link line { stroke: var(--muted); stroke-width: 2; }
.net-link.tree line { stroke: var(--good); stroke-width: 4; }
.net-link text { fill: var(--text); font: 700 12px var(--mono); }
.net-link .cost-bg { fill: var(--surface); stroke: var(--line); }
.net-node circle { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.net-node.done circle { fill: var(--good-soft); stroke: var(--good); }
.net-node.current circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3; }
.net-node.changed circle { stroke: var(--series-4); stroke-width: 3; }
.net-node text { fill: var(--text); font: 700 14px var(--mono); }
table.dv td { font: 500 13px var(--mono); white-space: nowrap; }
table.dv td.changed { background: var(--warn-soft); font-weight: 700; }

/* Congestion window chart */
svg.cwnd-chart { width: 100%; min-width: 480px; height: auto; display: block; }
.cwnd-chart text { fill: var(--muted); font: 500 11px var(--mono); }
.cwnd-chart .axis-title { font: 600 11px var(--body); }
.cwnd-chart .grid { stroke: var(--line); }
.cwnd-chart .line { fill: none; stroke-width: 2.5; }
.cwnd-chart .line.main { stroke: var(--series-1); }
.cwnd-chart .line.other { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 2 3; opacity: 0.8; }
.cwnd-chart .line.ssthresh { stroke: var(--series-2); stroke-dasharray: 6 4; stroke-width: 1.5; }
.cwnd-chart circle.pt { fill: var(--series-1); }
.cwnd-chart circle.event { fill: var(--surface); stroke: var(--bad); stroke-width: 3; }
.cwnd-chart .legend text { fill: var(--text); font: 600 11px var(--body); }

/* Error detection */
pre.division { margin: 0; font: 600 15px/1.5 var(--mono); white-space: pre; }
.division .by u { text-decoration-thickness: 2px; }
.division .current { color: var(--accent); }
.division .dividend { font-weight: 700; }
.crc-bits { color: var(--series-2); }
table.hamming td.parity { color: var(--series-2); font-weight: 700; }
table.hamming td.covered { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
table.hamming td.bad { background: var(--bad-soft); color: var(--bad); font-weight: 700; }

/* Fragmentation */
.frag-bar { display: flex; gap: 3px; margin: 8px 0 14px; }
.frag { background: color-mix(in srgb, var(--c) 22%, var(--surface)); border: 2px solid var(--c); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; min-width: 0; font-size: 12.5px; overflow: hidden; }
.frag b { font: 700 14px var(--display); }
.frag span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }

/* Home art for CN */
.win-art { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; align-items: center; align-content: center; }
.win-art i { height: 30px; border-radius: 5px; background: color-mix(in srgb, var(--muted) 30%, transparent); }
.win-art i.acked { background: var(--series-3); }
.win-art i.sent { background: var(--series-4); }
.routing-art { grid-template-columns: repeat(4, auto); gap: 14px; }
.routing-art .p.hot { border-color: var(--good); }
.frag-art { gap: 4px; }
.frag-art i { height: 34px; border-radius: 6px; background: var(--series-7); opacity: 0.75; }
.frag-art i:nth-child(2) { background: var(--series-1); }
.frag-art i:nth-child(3) { background: var(--series-3); }

@media (max-width: 720px) {
  .bits-row { grid-template-columns: 90px auto; }
  .bits-dec { grid-column: 2; }
}
.stat b.mono { font: 700 18px/1.3 var(--mono); overflow-wrap: anywhere; }
.stats-row.facts { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.division .down { color: var(--series-2); }
.division .final b { color: var(--good); }

/* Diagrams (state diagrams, item sets, parse trees, DAGs) */
svg.diagram { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; }
.d-edge { fill: none; stroke: var(--muted); stroke-width: 1.6; transition: stroke 0.25s, stroke-width 0.25s; }
.d-edge.lit { stroke: var(--accent); stroke-width: 3; }
.d-edge.start { stroke: var(--text); }
.d-arrow { fill: var(--muted); }
.d-label { fill: var(--text); font: 600 13px var(--mono); paint-order: stroke; stroke: var(--surface-2); stroke-width: 5px; stroke-linejoin: round; }
.d-label.lit { fill: var(--accent); font-weight: 800; }
.d-node circle, .d-node rect { fill: var(--surface); stroke: var(--muted); stroke-width: 1.8; transition: fill 0.3s, stroke 0.3s, stroke-width 0.3s; }
.d-node .inner { fill: none; stroke-width: 1.4; }
.d-node text { fill: var(--text); font: 600 13px var(--mono); }
.d-node.accept circle { stroke: var(--text); }
.d-node.active circle, .d-node.active rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3.2; }
.d-node.active .inner { fill: none; }
.d-node.grp circle, .d-node.grp rect { fill: color-mix(in srgb, var(--c) 20%, var(--surface)); stroke: var(--c); stroke-width: 2.6; }
.d-node.grp .inner { fill: none; }
.d-node.dim { opacity: 0.32; }
.d-node.good circle, .d-node.good rect { fill: var(--good-soft); stroke: var(--good); stroke-width: 3; }
.d-node.bad circle, .d-node.bad rect { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 3; }
.d-node.conflict rect { stroke: var(--bad); stroke-width: 2.6; }
.d-node.leaf circle { fill: var(--surface-2); }
.d-node.reused circle { fill: var(--good-soft); stroke: var(--good); stroke-width: 3; }
.d-node .d-title { font: 700 13px var(--display); fill: var(--accent); }
.d-node .d-item { font: 500 12.5px var(--mono); }
.d-node .d-names { font: 700 12.5px var(--mono); fill: var(--accent); }
.d-token { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.t-edge { stroke: var(--muted); stroke-width: 1.5; }
.t-edge.pending { stroke-dasharray: 4 4; }
.t-node rect { fill: var(--surface); stroke: var(--muted); stroke-width: 1.6; transition: fill 0.3s, stroke 0.3s; }
.t-node text { fill: var(--text); font: 600 13px var(--mono); }
.t-node.open rect { stroke-dasharray: 4 3; fill: var(--surface-2); }
.t-node.open text { fill: var(--muted); }
.t-node.matched rect { fill: var(--accent-soft); stroke: var(--accent); }
.t-node.error rect { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 2.6; }
.t-node.lit rect { stroke: var(--series-2); stroke-width: 3; }
.glide { transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.enter { animation: d-pop 0.4s ease-out both; transform-box: fill-box; transform-origin: center; }
.enter-late { animation: d-fade 0.35s 0.3s ease-out both; }
@keyframes d-pop { from { opacity: 0; transform: scale(0.5); } }
@keyframes d-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .glide, .enter, .enter-late { transition: none; animation: none; } }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.legend-row i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 6px; border: 2px solid var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 20%, var(--surface)); }

/* Tape (Turing machines) */
.tape-wrap { overflow: hidden; background: var(--surface-2); border-radius: 12px; padding: 34px 0 14px; position: relative; }
.tape { display: flex; gap: 0; transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); will-change: transform; }
.tape span { flex: 0 0 44px; height: 46px; display: grid; place-items: center; font: 700 20px var(--mono); background: var(--surface); border: 1.5px solid var(--line); margin-left: -1.5px; transition: background 0.3s; }
.tape span.blank { color: var(--muted); font-weight: 400; }
.tape span.head { background: var(--accent-soft); border-color: var(--accent); position: relative; z-index: 1; border-width: 2.5px; }
.tape span.wrote { animation: d-flash 0.6s ease-out; }
@keyframes d-flash { from { background: var(--warn-soft); } }
.tape-head { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); font: 700 13px var(--mono); color: var(--accent); background: var(--surface); border: 2px solid var(--accent); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.tape-head::after { content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .tape { transition: none; } }

/* Grammar tables */
table.parse { border-collapse: collapse; font: 500 13.5px var(--mono); }
table.parse th, table.parse td { border: 1px solid var(--line); padding: 5px 9px; text-align: center; white-space: nowrap; }
table.parse thead th { background: var(--surface-2); }
table.parse th[scope="row"] { background: var(--surface-2); text-align: left; }
table.parse td.conflict { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
table.parse td.hot, table.parse tr.hot td { background: var(--accent-soft); }
table.parse td.hot { outline: 2.5px solid var(--accent); outline-offset: -2px; }
table.parse td.added { background: var(--good-soft); color: var(--good); font-weight: 700; }
table.parse td.left { text-align: left; }
table.parse .muted { color: var(--muted); }
.trace td:nth-child(2) { text-align: left; }
.trace td:nth-child(3) { text-align: right; }
.trace td:last-child { text-align: left; white-space: normal; font-family: var(--body); min-width: 220px; }
.grammar-box { font: 500 14px/1.7 var(--mono); background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.grammar-box .new { color: var(--good); font-weight: 700; }
.prod-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; font: 500 13.5px var(--mono); }
.prod-list li { padding: 3px 8px; border-radius: 6px; }
.prod-list li.hot { background: var(--accent-soft); }
.prod-list li b { color: var(--muted); font-weight: 500; margin-right: 8px; }

/* CYK pyramid */
.cyk { display: grid; gap: 4px; justify-content: center; }
.cyk-row { display: flex; gap: 4px; justify-content: center; }
.cyk-cell { width: 76px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); display: grid; place-items: center; font: 600 13px var(--mono); padding: 4px; text-align: center; transition: background 0.3s, border-color 0.3s; }
.cyk-cell.empty { color: var(--muted); }
.cyk-cell.todo { background: transparent; border-style: dashed; color: transparent; }
.cyk-cell.hot { background: var(--accent-soft); border-color: var(--accent); border-width: 2.5px; }
.cyk-cell.left { background: color-mix(in srgb, var(--series-1) 18%, var(--surface)); border-color: var(--series-1); }
.cyk-cell.right { background: color-mix(in srgb, var(--series-2) 18%, var(--surface)); border-color: var(--series-2); }
.cyk-cell.win { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.cyk-cell.lose { background: var(--bad-soft); border-color: var(--bad); }
.cyk-word { display: flex; gap: 4px; justify-content: center; }
.cyk-word span { width: 76px; text-align: center; font: 700 16px var(--mono); color: var(--accent); }
@media (max-width: 560px) { .cyk-cell, .cyk-word span { width: 50px; font-size: 11.5px; } }

/* Partition groups (DFA minimisation) */
.partition { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.partition span { border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-radius: 999px; padding: 3px 12px; font: 600 13.5px var(--mono); }
.partition-k { font: 700 13px var(--display); color: var(--muted); margin-top: 8px; }
.input-chars { display: flex; flex-wrap: wrap; gap: 3px; margin: 10px 0 0; }
.input-chars span { min-width: 30px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); font: 700 16px var(--mono); padding: 0 6px; transition: background 0.25s, color 0.25s; }
.input-chars span.done { color: var(--muted); }
.input-chars span.now { background: var(--accent); color: var(--surface); }
.btn.right { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.btn.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn:disabled { cursor: default; }
.btn:disabled:not(.right):not(.wrong) { opacity: 0.55; }
.d-node.dim-src circle { stroke: var(--series-2); stroke-width: 2.6; stroke-dasharray: 5 3; }
.d-node .d-item.complete { fill: var(--good); font-weight: 700; }
.d-node .d-item.kernel { font-weight: 700; }
b.added-x { color: var(--good); background: var(--good-soft); border-radius: 4px; padding: 0 3px; }
.btn.pre { white-space: pre; text-align: left; font-size: 13.5px; line-height: 1.5; }
.ll-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; margin: 12px 0 0; }
.ll-stack { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 10px; }
.ll-stack span { min-width: 30px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); font: 700 15px var(--mono); padding: 0 8px; border: 1.5px solid var(--line); }
.ll-stack span.nt { color: var(--accent); }
.ll-stack span.top { border-color: var(--accent); background: var(--accent-soft); }
.kind-compare td, .kind-compare th { text-align: left; }
.kind-compare tr.hot td, .kind-compare tr.hot th { background: var(--accent-soft); }
.kind-compare button { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0; }
.states-art { justify-content: center; }
.states-art svg { width: 100%; max-width: 170px; height: 58px; overflow: visible; }
.states-art circle { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.states-art circle.on { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3; }
.states-art .a { fill: none; stroke: var(--muted); stroke-width: 2; }
.part-art { justify-content: center; gap: 6px; flex-wrap: wrap; }
.part-art span { border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 18%, var(--surface)); border-radius: 999px; padding: 4px 12px; font: 700 13px var(--mono); }
.cyk-art { flex-direction: column-reverse; justify-content: center; gap: 4px; }
.cyk-art div { display: flex; gap: 4px; justify-content: center; }
.cyk-art i { width: 30px; height: 16px; border-radius: 4px; border: 2px solid var(--muted); background: var(--surface); }
.cyk-art i.hot { border-color: var(--good); background: var(--good-soft); }
.tape-art { justify-content: center; gap: 0; }
.tape-art i { width: 34px; height: 38px; display: grid; place-items: center; font: 700 15px var(--mono); font-style: normal; border: 2px solid var(--line); background: var(--surface); margin-left: -2px; }
.tape-art i.hot { border-color: var(--accent); background: var(--accent-soft); position: relative; z-index: 1; }
.prod-list li.later { opacity: 0.3; }

/* Pseudocode and variables */
.trace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 14px; align-items: start; margin-top: 12px; }
@media (max-width: 860px) { .trace-grid { grid-template-columns: 1fr; } }
.trace-main { min-width: 0; }
.trace-side { display: grid; gap: 12px; position: sticky; top: 76px; }
@media (max-width: 860px) { .trace-side { position: static; } }
.panel-title { font: 700 12px var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.code-panel, .vars-panel { background: var(--surface-2); border-radius: 12px; padding: 10px 10px 8px; }
.code-lines { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; font: 500 12.8px/1.55 var(--mono); position: relative; }
.code-lines li { display: flex; gap: 8px; padding: 1px 6px; border-radius: 6px; transition: background 0.2s, color 0.2s; }
.code-lines .ln { flex: 0 0 18px; text-align: right; color: var(--muted); opacity: 0.6; user-select: none; }
.code-lines code { font: inherit; white-space: pre-wrap; padding-left: calc(var(--indent, 0) * 0.9ch); color: var(--text); }
.code-lines .cmt { color: var(--muted); font-style: italic; }
.code-lines li.on { background: var(--accent); }
.code-lines li.on code, .code-lines li.on .ln, .code-lines li.on .cmt { color: var(--surface); opacity: 1; }
.vars { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font: 500 13px var(--mono); }
.vars dt { color: var(--accent); font-weight: 700; }
.vars dd { margin: 0; overflow-wrap: anywhere; border-radius: 4px; padding: 0 4px; }
.vars dd.changed { animation: d-flash 0.8s ease-out; }
table.complexity td, table.complexity th { text-align: left; }

/* Bars (sorting) */
svg.bars { display: block; width: 100%; height: auto; }
.bar rect { fill: var(--series-1); transition: fill 0.25s, height 0.35s, y 0.35s; }
.bar text { fill: var(--text); font: 600 12px var(--mono); }
.bar.cmp rect { fill: var(--series-4); }
.bar.swap rect { fill: var(--series-8); }
.bar.pivot rect { fill: var(--series-7); }
.bar.sorted rect { fill: var(--series-3); }
.bar.min rect { fill: var(--series-2); }
.bar.dim rect { opacity: 0.35; }
.bar.key rect { fill: var(--series-5); }
.range-mark { fill: none; stroke: var(--muted); stroke-dasharray: 4 3; }
.ptr text { fill: var(--accent); font: 700 12px var(--mono); }
.ptr path { fill: var(--accent); }
.rbuckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: 6px; margin-top: 10px; }
.rbucket { background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 4px; min-height: 64px; display: flex; flex-direction: column-reverse; gap: 3px; align-items: stretch; }
.rbucket b { font: 700 11px var(--mono); color: var(--muted); text-align: center; order: -1; }
.rbucket span { font: 700 12.5px var(--mono); text-align: center; background: color-mix(in srgb, var(--series-1) 22%, var(--surface)); border-radius: 5px; padding: 2px 0; animation: d-pop 0.3s ease-out; }
.rbucket.hot { border-color: var(--accent); }
.legend-chips { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend-chips i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }
svg.bars .idx { fill: var(--muted); font: 500 10.5px var(--mono); }
svg.bars .row-label { fill: var(--muted); font: 700 13px var(--mono); }
.counts { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 10px; }
.count-cell { width: 34px; border: 1.5px solid var(--line); border-radius: 6px; display: grid; text-align: center; font: 600 11px var(--mono); background: var(--surface); transition: background 0.25s; }
.count-cell b { color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); }
.count-cell span { font-size: 13px; font-weight: 700; }
.count-cell.zero span { color: var(--muted); font-weight: 400; }
.count-cell.hot { border-color: var(--accent); background: var(--accent-soft); }
td.spark { width: 30%; min-width: 80px; }
td.spark i { display: block; height: 10px; border-radius: 3px; background: var(--series-1); min-width: 2px; }
button.linkish { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0; }
.bars-art { align-items: flex-end; justify-content: center; gap: 5px; }
.bars-art i { width: 14px; border-radius: 3px 3px 0 0; background: var(--series-1); }
.bars-art i.hot { background: var(--series-4); }

/* DSA: trees, heaps, tries, union-find */
svg.dsa-tree { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; }
.dt-stage { min-height: 120px; }
.dt-edge { stroke: var(--muted); stroke-width: 1.6; transition: stroke 0.25s, stroke-width 0.25s; }
.dt-edge.lit { stroke: var(--accent); stroke-width: 2.6; }
.dt-arrowhead { fill: var(--muted); }
.dt-elabel { fill: var(--text); font: 700 13px var(--mono); paint-order: stroke; stroke: var(--surface-2); stroke-width: 5px; stroke-linejoin: round; }
.dt-elabel.lit { fill: var(--accent); }
.dt-node circle { fill: var(--surface); stroke: var(--muted); stroke-width: 1.8; transition: fill 0.3s, stroke 0.3s, stroke-width 0.3s; }
.dt-node circle.ring { fill: none; stroke-width: 1.4; }
.dt-node .dt-label { fill: var(--text); font: 700 13px var(--mono); }
.dt-node .dt-badge { fill: var(--muted); font: 700 11px var(--mono); paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; stroke-linejoin: round; }
.dt-node .dt-badge.lean { fill: var(--series-1); }
.dt-node .dt-badge.bad { fill: var(--bad); font-size: 13px; }
.dt-node .dt-badge.word { font: 600 10.5px var(--mono); }
.dt-node .dt-sub { fill: var(--muted); font: 600 10.5px var(--mono); paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; stroke-linejoin: round; }
.dt-node.path circle { stroke: var(--series-1); stroke-width: 2.6; }
.dt-node.cur circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3.2; }
.dt-node.found circle, .dt-node.new circle { fill: var(--good-soft); stroke: var(--good); stroke-width: 3; }
.dt-node.bad circle { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 3; }
.dt-node.succ circle { fill: color-mix(in srgb, var(--series-4) 22%, var(--surface)); stroke: var(--series-4); stroke-width: 3; }
.dt-node.queued circle { stroke: var(--series-7); stroke-width: 2.6; stroke-dasharray: 4 3; }
.dt-node.done circle { fill: var(--surface-2); }
.dt-node.done .dt-label { fill: var(--muted); }
.dt-node.rot circle { fill: color-mix(in srgb, var(--series-7) 20%, var(--surface)); stroke: var(--series-7); stroke-width: 3; }
.dt-node.cmp circle { stroke: var(--series-4); stroke-width: 3; }
.dt-node.best circle { fill: color-mix(in srgb, var(--series-3) 20%, var(--surface)); stroke: var(--series-3); stroke-width: 3; }
.dt-node.swap circle { fill: color-mix(in srgb, var(--series-8) 20%, var(--surface)); stroke: var(--series-8); stroke-width: 3; }
.dt-node.root circle { stroke-width: 2.4; }
.trie .dt-node.root .dt-label { font-size: 10px; fill: var(--muted); }
.trie .dt-node.end circle:not(.ring) { stroke: var(--text); }
.trie .dt-node.end.found circle, .trie .dt-node.end.new circle { stroke: var(--good); }
.dt-cell rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; transition: fill 0.3s, stroke 0.3s; }
.dt-cell text { fill: var(--text); font: 700 13px var(--mono); }
.dt-cell.cur rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.6; }
.dt-cell.cmp rect { stroke: var(--series-4); stroke-width: 2.6; }
.dt-cell.best rect { fill: color-mix(in srgb, var(--series-3) 20%, var(--surface)); stroke: var(--series-3); stroke-width: 2.6; }
.dt-cell.swap rect { fill: color-mix(in srgb, var(--series-8) 20%, var(--surface)); stroke: var(--series-8); stroke-width: 2.6; }
.dt-cell.new rect, .dt-cell.found rect { fill: var(--good-soft); stroke: var(--good); stroke-width: 2.6; }
.dt-cell.bad rect { fill: var(--bad-soft); stroke: var(--bad); }
.dt-cell.done rect { stroke: var(--good); }
.dt-cell.outside { opacity: 0.4; }
.dt-cell.out rect { fill: var(--warn-soft); stroke: var(--series-4); stroke-width: 2.6; stroke-dasharray: 5 3; }
.dt-cell.changed rect { fill: color-mix(in srgb, var(--series-4) 25%, var(--surface)); stroke: var(--series-4); stroke-width: 2.6; }
.dt-cell.changed text { animation: d-pop 0.4s ease-out both; transform-box: fill-box; transform-origin: center; }
.dt-cell.probe rect { fill: var(--accent); stroke: var(--accent); }
.dt-cell.probe text { fill: var(--surface); }
.dt-idx { fill: var(--muted); font: 500 10.5px var(--mono); }
.dt-rowlabel { fill: var(--muted); font: 700 12px var(--mono); }
.dt-empty { fill: var(--muted); font: 600 14px var(--body); }
.dt-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 10px 0 0; font: 600 13px var(--mono); }
.dt-chips-label { font: 600 12.5px var(--body); color: var(--muted); margin-right: 4px; }
.dt-chips i { font-style: normal; padding: 2px 9px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); }
.dt-chips.visit i { border-color: var(--good); }
.dt-chips.stack i { border-color: var(--series-7); }
.dt-chips.queue i { border-color: var(--series-7); border-style: dashed; }
.dt-chips i.last { animation: d-pop 0.35s ease-out; background: var(--accent-soft); }
.dt-chips em { color: var(--muted); font: italic 500 13px var(--body); }
.dt-word { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 10px; }
.dt-word span { min-width: 26px; padding: 3px 6px; text-align: center; border: 1.5px solid var(--line); border-radius: 6px; background: var(--surface); font: 700 14px var(--mono); }
.dt-word span.done { border-color: var(--series-1); color: var(--series-1); }
.dt-word span.now { border-color: var(--accent); background: var(--accent-soft); }
table.dt-ops td.left { white-space: normal; min-width: 220px; font-family: var(--body); }
.sub-h { font-size: 16px; margin: 16px 0 8px; }
.dt-art svg { width: 100%; height: 100%; }
.dt-art line { stroke: var(--muted); stroke-width: 2; }
.dt-art circle { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.dt-art circle.on { fill: var(--accent-soft); stroke: var(--accent); }
.avl-art circle.on { fill: color-mix(in srgb, var(--series-7) 25%, var(--surface)); stroke: var(--series-7); }
.dt-art text { fill: var(--muted); font: 700 9px var(--mono); }
.heap-art { justify-content: center; gap: 0; }
.heap-art i { width: 34px; height: 36px; display: grid; place-items: center; font: 700 14px var(--mono); font-style: normal; border: 2px solid var(--line); background: var(--surface); margin-left: -2px; }
.heap-art i.hot { border-color: var(--series-3); background: color-mix(in srgb, var(--series-3) 20%, var(--surface)); position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .dt-chips i.last, .dt-cell.changed text { animation: none; } }
/* DSA: graphs */
svg.graph-svg { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; }
.g-edge { fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; transition: stroke 0.3s, stroke-width 0.3s, opacity 0.3s; }
.g-edge.seen { stroke-dasharray: 5 4; opacity: 0.6; }
.g-edge.tree { stroke: var(--accent); stroke-width: 3.4; }
.g-edge.back { stroke: var(--series-8); stroke-width: 2.8; stroke-dasharray: 7 4; }
.g-edge.forward { stroke: var(--series-7); stroke-width: 2.8; stroke-dasharray: 2 4; }
.g-edge.cross { stroke: var(--series-5); stroke-width: 2.8; stroke-dasharray: 9 3 2 3; }
.g-edge.candidate { stroke: var(--accent); stroke-width: 2.4; stroke-dasharray: 6 4; }
.g-edge.mst { stroke: var(--good); stroke-width: 4.4; }
.g-edge.rejected { stroke: var(--bad); stroke-width: 2.2; stroke-dasharray: 3 4; opacity: 0.7; }
.g-edge.removed { stroke-dasharray: 3 4; opacity: 0.22; }
.g-edge.dim { opacity: 0.25; }
.g-edge.relaxed { stroke: var(--series-3); stroke-width: 4.4; animation: g-glow 0.7s ease-out; }
.g-edge.path { stroke: var(--series-2); stroke-width: 4.6; }
.g-edge.cycle { stroke: var(--bad); stroke-width: 4.4; animation: g-march 0.9s linear infinite; stroke-dasharray: 10 5; }
.g-edge.active { stroke: var(--series-4); stroke-width: 4.4; opacity: 1; }
.g-arrow path { fill: var(--muted); }
.g-arrow.tree path, .g-arrow.candidate path { fill: var(--accent); }
.g-arrow.back path, .g-arrow.rejected path, .g-arrow.cycle path { fill: var(--series-8); }
.g-arrow.forward path { fill: var(--series-7); }
.g-arrow.cross path { fill: var(--series-5); }
.g-arrow.mst path { fill: var(--good); }
.g-arrow.relaxed path { fill: var(--series-3); }
.g-arrow.path path { fill: var(--series-2); }
.g-arrow.active path { fill: var(--series-4); }
.g-arrow.removed path, .g-arrow.dim path, .g-arrow.seen path { fill: var(--muted); opacity: 0.4; }
.g-w rect { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.g-w text { fill: var(--text); font: 600 12px var(--mono); }
.g-w.active rect { stroke: var(--series-4); stroke-width: 2; }
.g-w.removed, .g-w.dim, .g-w.rejected, .g-w.seen { opacity: 0.45; }
.g-node rect { fill: var(--surface); stroke: var(--muted); stroke-width: 2; transition: fill 0.3s, stroke 0.3s, stroke-width 0.3s; }
.g-node text { fill: var(--text); font: 700 13.5px var(--mono); transition: fill 0.3s; }
.g-node.visited rect { stroke: var(--accent); }
.g-node.frontier rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.6; animation: g-ring 1.4s ease-in-out infinite; }
.g-node.done rect { fill: color-mix(in srgb, var(--text) 14%, var(--surface)); stroke: var(--text); }
.g-node.grp rect { fill: color-mix(in srgb, var(--c) 24%, var(--surface)); stroke: var(--c); stroke-width: 2.8; }
.g-node.hl-i rect { fill: color-mix(in srgb, var(--series-1) 22%, var(--surface)); stroke: var(--series-1); stroke-width: 3; }
.g-node.hl-j rect { fill: color-mix(in srgb, var(--series-5) 22%, var(--surface)); stroke: var(--series-5); stroke-width: 3; }
.g-node.path rect { fill: color-mix(in srgb, var(--series-2) 24%, var(--surface)); stroke: var(--series-2); stroke-width: 3; }
.g-node.bad rect { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 3; }
.g-node.current rect { fill: var(--accent); stroke: var(--accent); stroke-width: 3; animation: g-pop 0.45s ease-out; transform-box: fill-box; transform-origin: center; }
.g-node.current text { fill: var(--surface); }
.g-node.grp.current rect { fill: var(--c); stroke: var(--text); }
.g-badge rect { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.g-badge text { fill: var(--text); font: 700 11.5px var(--mono); }
.g-badge.flash { animation: g-pop 0.5s ease-out; transform-box: fill-box; transform-origin: center; }
.g-badge.flash rect { animation: g-badge 1s ease-out; }
.g-token { fill: var(--series-4); stroke: var(--surface); stroke-width: 2.5; pointer-events: none; }
@keyframes g-ring { 50% { stroke-width: 5; } }
@keyframes g-pop { 40% { transform: scale(1.18); } }
@keyframes g-badge { from { fill: var(--series-4); stroke: var(--series-4); } }
@keyframes g-glow { from { stroke-width: 9; opacity: 0.6; } }
@keyframes g-march { to { stroke-dashoffset: -30; } }
@media (prefers-reduced-motion: reduce) {
  .g-token { display: none; }
  .g-node rect, .g-badge, .g-badge rect, .g-edge { animation: none !important; transition: none; }
}
.g-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.g-legend span { display: inline-flex; align-items: center; gap: 6px; }
.g-legend svg { overflow: visible; flex: none; }
.g-legend .g-edge { stroke-width: 3; animation: none; }
.g-legend .g-node rect { stroke-width: 2; animation: none; }
.g-legend .g-node.current rect { stroke-width: 2; }
.g-side { display: grid; gap: 10px; margin-top: 12px; min-width: 0; }
.g-strip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13.5px; margin-bottom: 4px; }
.g-strip-head b { font: 700 12px var(--display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.g-cells { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 34px; }
.g-cells > span { min-width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0 8px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); font: 700 13.5px var(--mono); white-space: nowrap; transition: background 0.25s, border-color 0.25s; }
.g-cells > small { font: 600 10.5px var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.g-cells > span.new { animation: d-pop 0.35s ease-out; border-color: var(--accent); }
.g-cells > span.hot { background: var(--accent-soft); border-color: var(--accent); }
.g-strip.queue .g-cells > span:first-of-type { border-color: var(--accent); }
.g-strip.stack .g-cells > span:last-of-type { border-color: var(--accent); background: var(--accent-soft); }
.g-edges > span { font-size: 12.5px; height: 28px; }
.g-edges > span.accepted { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.g-edges > span.rejected { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); text-decoration: line-through; }
.g-edges > span.skipped { opacity: 0.45; }
.g-edges > span.hot { outline: 2.5px solid var(--series-4); outline-offset: 1px; }
.g-cells > span.scc { border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 18%, var(--surface)); }
.g-table td.changed, .g-matrix td.changed { animation: d-flash 0.9s ease-out; font-weight: 700; }
table.parse.g-matrix td.src { background: color-mix(in srgb, var(--series-2) 20%, var(--surface)); outline: 2px solid var(--series-2); outline-offset: -2px; }
table.parse.g-matrix td.kband:not(.hot):not(.src) { background: var(--surface-2); }
table.parse td.wrap { white-space: normal; min-width: 200px; }
.g-pass { margin: 0; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: 14px; justify-self: start; }
.g-pass.two { background: var(--accent-soft); color: var(--accent); }
.gart { justify-content: center; }
.gart svg { width: 100%; max-width: 180px; height: 62px; overflow: visible; }
.gart line { stroke: var(--muted); stroke-width: 2; }
.gart line.on { stroke: var(--accent); stroke-width: 3; }
.gart line.good { stroke: var(--good); stroke-width: 3.5; }
.gart line.faint { opacity: 0.35; stroke-dasharray: 3 3; }
.gart line.path { stroke: var(--series-2); stroke-width: 3.5; }
.gart circle { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.gart circle.on { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; }
.gart circle.done { fill: var(--accent); stroke: var(--accent); }
.gart text { font: 700 8.5px var(--mono); fill: var(--text); }
.gart ellipse { stroke-width: 1.5; stroke-dasharray: 4 3; }
.gart .c1 { fill: color-mix(in srgb, var(--series-1) 16%, transparent); stroke: var(--series-1); }
.gart .c2 { fill: color-mix(in srgb, var(--series-2) 16%, transparent); stroke: var(--series-2); }
.gart circle.c1, .gart circle.c2 { fill: var(--surface); stroke-width: 2.4; stroke-dasharray: none; }
table.g-table thead th, table.g-matrix thead th, table.g-table tbody th, table.g-matrix tbody th { text-transform: none; letter-spacing: 0; }
/* DSA: searching, stacks, lists, DP */
.tw-in { animation: d-fade 0.4s ease-out both; }
@media (prefers-reduced-motion: reduce) { .tw-in { animation: none; } }
.dsa-head { fill: var(--muted); }
.dsa-head.on, .dsa-head.best { fill: var(--series-2); }
.dsa-head.dep { fill: var(--series-4); }
/* Searching */
svg.srch-svg { display: block; width: 100%; height: auto; }
.srch-cell rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.6; transition: fill 0.3s, stroke 0.3s, opacity 0.3s; }
.srch-cell .v { fill: var(--text); font: 700 14px var(--mono); }
.srch-cell .idx { fill: var(--muted); font: 500 10.5px var(--mono); }
.srch-cell.out rect { fill: var(--surface-2); stroke: var(--line); }
.srch-cell.out .v { fill: var(--muted); opacity: 0.55; }
.srch-cell.probe rect { fill: color-mix(in srgb, var(--series-4) 30%, var(--surface)); stroke: var(--series-4); stroke-width: 2.6; }
.srch-cell.probe .v { opacity: 1; fill: var(--text); }
.srch-cell.found rect { fill: var(--good-soft); stroke: var(--good); stroke-width: 3; }
.srch-cell.found .v { fill: var(--good); }
.srch-cell.ghost rect { fill: none; stroke-dasharray: 4 3; }
.srch-cell.ghost .v { fill: var(--muted); font-size: 11px; font-weight: 500; }
.srch-range { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--accent); stroke-width: 2; }
.srch-ptr path { fill: var(--accent); }
.srch-ptr text { fill: var(--accent); font: 700 12.5px var(--mono); }
.srch-ptr.p-mid path, .srch-ptr.p-pos path, .srch-ptr.p-i path { fill: var(--series-2); }
.srch-ptr.p-mid text, .srch-ptr.p-pos text, .srch-ptr.p-i text { fill: var(--series-2); }
.srch-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.srch-trail b { font: 600 12.5px var(--mono); background: var(--surface-2); border-radius: 6px; padding: 2px 8px; animation: d-pop 0.3s ease-out; }
.srch-trail b.hit { background: var(--good-soft); color: var(--good); }
/* Stacks and queues */
svg.sq-svg { display: block; width: 100%; height: auto; }
.sq-slot rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.sq-slot .idx, .sq-ring .idx { fill: var(--muted); font: 500 11px var(--mono); }
.sq-wall { fill: none; stroke: var(--muted); stroke-width: 2.5; stroke-linejoin: round; }
.sq-item rect, .sq-item circle { fill: color-mix(in srgb, var(--series-1) 22%, var(--surface)); stroke: var(--series-1); stroke-width: 1.8; transition: fill 0.3s, stroke 0.3s; }
.sq-item text { fill: var(--text); font: 700 14px var(--mono); }
.sq-item.hot rect, .sq-item.hot circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.8; }
.sq-item.in rect, .sq-item.out rect { fill: color-mix(in srgb, var(--series-4) 25%, var(--surface)); stroke: var(--series-4); stroke-dasharray: 5 3; }
.sq-item.good rect { fill: var(--good-soft); stroke: var(--good); stroke-width: 2.6; }
.sq-item.bad rect { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 2.6; }
.sq-item.tok.done rect { fill: var(--surface-2); stroke: var(--line); }
.sq-item.tok.done text { fill: var(--muted); }
.sq-item.tok.now rect { stroke: var(--accent); stroke-width: 2.6; }
.sq-item.tok.todo rect { fill: var(--surface); stroke: var(--line); }
.sq-tag { fill: var(--muted); font: 700 11px var(--display); text-transform: uppercase; letter-spacing: 0.06em; }
.sq-eq { fill: var(--text); font: 700 16px var(--mono); }
.sq-ptr path { fill: var(--accent); }
.sq-ptr .sq-arrow { fill: none; stroke: var(--accent); stroke-width: 2.4; }
.sq-ptr text { fill: var(--accent); font: 700 12.5px var(--mono); }
.sq-ptr.rear path { fill: var(--series-2); }
.sq-ptr.rear text { fill: var(--series-2); }
.sq-pair { display: grid; gap: 10px; }
.ring-wrap { width: 100%; max-width: 240px; margin: 0 auto; }
svg.sq-ring { display: block; width: 100%; height: auto; }
.sq-ring .ring { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 3 4; }
.sq-ring .ring-slot { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.ring-hand line { stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; }
.ring-hand path { fill: var(--accent); }
.ring-hand.rear line { stroke: var(--series-2); }
.ring-hand.rear path { fill: var(--series-2); }
.ring-hub { fill: var(--text); }
.op-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.op-chips span { font: 600 12.5px var(--mono); padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1.5px solid transparent; transition: background 0.25s, border-color 0.25s; }
.op-chips span.done { color: var(--muted); }
.op-chips span.now { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.op-chips span.bad { border-color: var(--bad); color: var(--bad); }
/* Linked lists */
svg.ll-svg { display: block; width: 100%; height: auto; }
.ll-node rect { fill: var(--surface); stroke: var(--text); stroke-width: 1.8; transition: fill 0.3s, stroke 0.3s, opacity 0.3s; }
.ll-node .ll-div { stroke: var(--text); stroke-width: 1.4; }
.ll-node text { fill: var(--text); font: 700 14px var(--mono); }
.ll-nullbox text { fill: var(--muted); font: 600 11px var(--mono); }
.ll-node .ll-slash { stroke: var(--muted); stroke-width: 1.5; }
.ll-node.hot rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.8; }
.ll-node.found rect, .ll-node.meet rect { fill: var(--good-soft); stroke: var(--good); stroke-width: 3; }
.ll-node.gone { opacity: 0.6; }
.ll-node.gone rect { fill: var(--bad-soft); stroke: var(--bad); stroke-dasharray: 5 3; }
.ll-link { fill: none; stroke: var(--muted); stroke-width: 1.8; transition: stroke 0.25s; }
.ll-link.prev { stroke-dasharray: 5 3; }
.ll-link.on { stroke: var(--series-2); stroke-width: 3; }
.ll-link.gone { opacity: 0.45; }
.ll-tag path { fill: var(--accent); }
.ll-tag text { fill: var(--accent); font: 700 12px var(--mono); }
.ll-tag.t-head text, .ll-tag.t-head path { fill: var(--text); }
.ll-tag.t-fast text, .ll-tag.t-next text, .ll-tag.t-tail text { fill: var(--series-2); }
.ll-tag.t-prev text { fill: var(--series-7); }
.ll-tag.t-node text { fill: var(--series-6); }
/* Dynamic programming */
svg.dp-svg { display: block; width: 100%; height: auto; }
.dp-head { fill: var(--muted); font: 700 12.5px var(--mono); }
.dp-cell { fill: var(--surface); stroke: var(--line); stroke-width: 1; transition: fill 0.3s; }
.dp-cell.unused { fill: var(--surface-2); }
.dp-cell.base { fill: color-mix(in srgb, var(--muted) 18%, var(--surface)); stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 4 3; }
.dp-cell.dep { fill: color-mix(in srgb, var(--series-4) 26%, var(--surface)); }
.dp-cell.best { fill: color-mix(in srgb, var(--series-2) 30%, var(--surface)); }
.dp-cell.path { fill: var(--good-soft); }
.dp-cell.take { fill: color-mix(in srgb, var(--good) 35%, var(--surface)); }
.dp-val text { fill: var(--text); font: 700 13px var(--mono); }
.dp-val .dp-sub { fill: var(--muted); font: 500 10px var(--mono); }
.dp-val .dp-sub.base { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 8.5px; }
.dp-cur { fill: none; stroke: var(--accent); stroke-width: 3; }
.dp-arrow { fill: none; stroke: var(--series-4); stroke-width: 2; }
.dp-arrow.best { stroke: var(--series-2); stroke-width: 2.6; }
.dp-path { fill: none; stroke: var(--good); stroke-width: 2.5; stroke-dasharray: 5 4; opacity: 0.8; }
/* Home cards */
.search-art { justify-content: center; gap: 3px; }
.search-art i { width: 26px; height: 30px; display: grid; place-items: center; font: 700 11px var(--mono); font-style: normal; border-radius: 5px; border: 2px solid var(--line); background: var(--surface); }
.search-art i.out { opacity: 0.4; }
.search-art i.hot { border-color: var(--series-4); background: color-mix(in srgb, var(--series-4) 25%, var(--surface)); }
.stack-art { justify-content: center; gap: 18px; }
.stack-art div { display: flex; flex-direction: column; gap: 3px; border: 2px solid var(--muted); border-top: 0; padding: 3px; border-radius: 0 0 6px 6px; }
.stack-art i { width: 34px; height: 16px; display: grid; place-items: center; font: 700 11px var(--mono); font-style: normal; border-radius: 3px; background: color-mix(in srgb, var(--series-1) 25%, var(--surface)); }
.stack-art i.hot { background: var(--accent-soft); outline: 2px solid var(--accent); }
.stack-art span { font: 600 13px var(--mono); color: var(--accent); }
.list-art { justify-content: center; gap: 4px; }
.list-art i { min-width: 34px; height: 28px; display: grid; place-items: center; font: 700 12px var(--mono); font-style: normal; border: 2px solid var(--text); border-radius: 5px; background: var(--surface); box-shadow: inset -9px 0 0 var(--surface-2); padding-right: 8px; }
.list-art i.hot { border-color: var(--accent); background: var(--accent-soft); }
.list-art b { font: 700 13px var(--mono); color: var(--muted); }
.dp-art { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; align-items: stretch; }
.dp-art i { border-radius: 3px; background: color-mix(in srgb, var(--muted) 25%, transparent); }
.dp-art i.dep { background: var(--series-4); }
.dp-art i.path { background: var(--good-soft); outline: 1.5px solid var(--good); }
.dp-art i.hot { background: var(--accent); }
/* OS depth */
/* CPU scheduling: growing Gantt bars and process tokens moving between queues */
.gantt .seg { transition: width 0.45s ease-out; }
.q-wrap { margin-bottom: 4px; }
svg.q-svg { display: block; width: 100%; height: auto; }
.q-svg .q-label { fill: var(--muted); font: 600 11px var(--body); }
.q-svg .q-idle { fill: var(--muted); font: 500 12px var(--mono); }
.q-svg .q-cpu { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.q-svg .q-cpu.busy { stroke: var(--accent); stroke-width: 3; }
.q-svg .q-lane { fill: var(--surface); stroke: var(--line); stroke-dasharray: 4 3; }
.tok rect { fill: var(--c); }
.tok text { fill: #fff; pointer-events: none; }
.tok .tok-id { font: 700 12.5px var(--mono); }
.tok .tok-rem { font: 500 9.5px var(--body); }
.tok.fin rect { opacity: 0.45; }
.tok.on-cpu rect { stroke: var(--text); stroke-width: 2; }

/* Page replacement: pages dropping into frames, and the clock */
.pf-wrap { display: grid; justify-items: center; }
svg.pf-svg { display: block; width: 100%; height: auto; }
.pf-svg .pf-label { fill: var(--muted); font: 600 11.5px var(--body); }
.pf-frame { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.pf-frame.loaded { stroke: var(--bad); stroke-width: 2.5; }
.pf-frame.hit { stroke: var(--good); stroke-width: 2.5; }
.pf-tok rect { fill: var(--series-1); }
.pf-tok text { fill: #fff; font: 700 15px var(--mono); }
.pf-tok.new rect { fill: var(--series-8); }
.pf-tok.hit rect { fill: var(--series-3); animation: pf-pulse 0.6s ease-out; transform-box: fill-box; transform-origin: center; }
.pf-tok.incoming rect { fill: var(--surface); stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; }
.pf-tok.incoming text { fill: var(--accent); }
.pf-tok.evicted { opacity: 0.4; }
.pf-tok.evicted rect { fill: var(--muted); }
@keyframes pf-pulse { 40% { transform: scale(1.15); } }
svg.ck-svg { display: block; width: min(100%, 300px); height: auto; margin: 0 auto; }
.ck-ring { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 3 5; }
.ck-hub { fill: var(--accent); }
.ck-hand { transform-box: view-box; transform-origin: 130px 130px; transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.3, 1); }
.ck-hand line { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.ck-hand path { fill: var(--accent); }
.ck-frame { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; transition: fill 0.3s, stroke 0.3s; }
.ck-frame.loaded { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 2.5; }
.ck-frame.hit { fill: var(--good-soft); stroke: var(--good); stroke-width: 2.5; }
.ck-frame.swept { fill: var(--warn-soft); stroke: var(--series-4); stroke-width: 2.5; }
.ck-svg .ck-page { fill: var(--text); font: 700 16px var(--mono); }
.ck-svg .ck-bit { fill: var(--muted); font: 600 10.5px var(--mono); }
.ck-svg .pf-label { fill: var(--muted); font: 600 10.5px var(--body); }
table.ws td.ws-set { font-size: 12px; white-space: nowrap; }
table.ws td.ws-peak { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* Disk scheduling: the newest seek draws itself; the head glides along the platter */
.disk-chart .seek.current[pathLength] { stroke-dasharray: 1; animation: seek-draw 0.6s ease-out both; }
@keyframes seek-draw { from { stroke-dashoffset: 1; } }
svg.disk-strip { display: block; width: 100%; min-width: 520px; height: auto; }
.ds-track { fill: var(--surface); stroke: var(--line); }
.ds-req { fill: var(--series-1); }
.ds-done { fill: var(--muted); opacity: 0.35; }
.ds-head path { fill: var(--accent); }
.ds-head text { fill: var(--accent); font: 700 11px var(--mono); }

/* Banker's: Work as unit blocks; the request timeline */
svg.work-bars { display: block; width: 100%; height: auto; }
.work-bars .wb-label { fill: var(--muted); font: 700 12px var(--mono); }
.wb-unit { fill: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.wb-unit.back { fill: var(--c); }
.chip-in { animation: d-pop 0.35s ease-out both; }
.req-chips { margin: 10px 0 4px; }
.chip.req.later { opacity: 0.5; }
.chip.req.now { border-color: var(--accent); background: var(--accent-soft); }
.chip.req.granted { border-color: var(--good); }
.chip.req.wait, .chip.req.unsafe, .chip.req.error { border-color: var(--bad); }

/* Deadlock detection: released edges fade as processes finish */
.rag-edge.released { opacity: 0.15; }
.rag-edge.just { animation: rag-release 0.7s ease-out both; }
@keyframes rag-release { from { opacity: 1; stroke-width: 4; } }
.rag-edge.request.ok { stroke: var(--good); stroke-width: 3; }
.rag-edge.request.blocked { stroke: var(--bad); stroke-width: 3; }
.rag-node.process.finished circle { fill: var(--good-soft); stroke: var(--good); }
.rag-node.process.checking circle { stroke: var(--accent); stroke-width: 4; }

/* Semaphores: the order processes ran in */
.run-strip { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin: 10px 0 0; }
.run-strip i { font: 700 11px var(--mono); font-style: normal; color: #fff; background: var(--c); border-radius: 5px; padding: 1px 5px; animation: d-pop 0.3s ease-out both; }
.run-strip i:not(:last-child) { animation: none; opacity: 0.75; }

/* Memory allocation */
svg.mem-bar { display: block; width: 100%; min-width: 460px; height: auto; }
.mem-stage { margin-top: 8px; }
.mem-seg rect { stroke: var(--surface); stroke-width: 1.5; transition: fill 0.25s, stroke 0.25s; }
.mem-seg.used rect { fill: var(--c); }
.mem-seg.fixed rect { fill: color-mix(in srgb, var(--muted) 45%, var(--surface)); }
.mem-seg.hole rect { fill: var(--surface); stroke: var(--line); stroke-dasharray: 5 3; }
.mem-seg.scan rect { stroke: var(--series-4); stroke-width: 3; stroke-dasharray: none; }
.mem-seg.pick rect, .mem-seg.merging rect { stroke: var(--accent); stroke-width: 3; stroke-dasharray: none; fill: var(--accent-soft); }
.mem-seg.used.pick rect { fill: var(--c); }
.mem-seg rect.mem-waste { fill: url(#mem-hatch); stroke: none; }
.mem-hatch-bg { fill: transparent; }
.mem-hatch-line { stroke: rgba(255, 255, 255, 0.7); stroke-width: 2.5; }
.mem-seg text { font: 700 12px var(--mono); fill: var(--text); pointer-events: none; }
.mem-seg.used text { fill: #fff; }
.mem-seg .mem-size { font-weight: 500; font-size: 11px; }
.mem-new { animation: mem-grow 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; transform-box: fill-box; transform-origin: left center; }
@keyframes mem-grow { from { transform: scaleX(0); } }
.mem-merged rect { animation: mem-flash 0.8s ease-out; }
@keyframes mem-flash { from { fill: var(--good-soft); stroke: var(--good); } }
.mem-ptr path { fill: var(--series-4); }
.mem-ptr text, .mem-rover text { font: 700 12px var(--mono); fill: var(--text); }
.mem-rover path { fill: var(--series-7); }
.mem-ticks text, .mem-label { font: 500 10.5px var(--mono); fill: var(--muted); }
.mem-edge { stroke: var(--muted); stroke-width: 1.4; }
.mem-node rect { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; transition: fill 0.25s, stroke 0.25s; }
.mem-node.split rect { fill: var(--surface-2); stroke-dasharray: 4 3; }
.mem-node.split text { fill: var(--muted); }
.mem-node.hole rect { fill: var(--surface); stroke: var(--text); }
.mem-node.used rect { fill: var(--c); stroke: var(--c); }
.mem-node.used text { fill: #fff; }
.mem-node.hot rect { stroke: var(--accent); stroke-width: 3; }
.mem-node.buddy rect { stroke: var(--series-4); stroke-width: 3; stroke-dasharray: none; }
.mem-node text { font: 700 11.5px var(--mono); fill: var(--text); pointer-events: none; }
.mem-ops { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.mem-ops li { padding: 2px 9px; border-radius: 999px; border: 2px solid var(--c); font: 600 12.5px var(--mono); background: var(--surface); transition: background 0.2s, opacity 0.2s; }
.mem-ops li.past { opacity: 0.55; }
.mem-ops li.now { background: var(--c); color: #fff; opacity: 1; }
.mem-ops li.failed { text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 2px; }
.legend-chips i.mem-key-hole { background: var(--surface); border: 1.5px dashed var(--muted); }
.legend-chips i.mem-key-fixed { background: color-mix(in srgb, var(--muted) 45%, var(--surface)); }
.legend-chips i.mem-key-split { background: var(--surface-2); border: 1.5px dashed var(--muted); }
.legend-chips i.mem-key-waste { background: repeating-linear-gradient(45deg, var(--series-1) 0 3px, #fff 3px 5px); }
.legend-chips i.mem-key-pick { background: var(--accent-soft); border: 2px solid var(--accent); }
.legend-chips i.mem-key-buddy { background: var(--surface); border: 2px solid var(--series-4); }
@media (prefers-reduced-motion: reduce) { .mem-new, .mem-merged rect { animation: none; } }

/* Address translation */
svg.xl-svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.xl-stage { padding: 10px; }
.xl-svg text { fill: var(--text); font: 600 12.5px var(--mono); }
.xl-svg .xl-title { font: 700 13px var(--body); fill: var(--text); }
.xl-svg .xl-title.bad { fill: var(--bad); }
.xl-svg .xl-head, .xl-svg .xl-hint, .xl-svg .xl-axis { fill: var(--muted); font: 500 11px var(--mono); }
.xl-bit rect { fill: var(--surface); stroke: var(--muted); stroke-width: 1.4; transition: fill 0.35s, stroke 0.35s; }
.xl-bit.p0 rect { fill: color-mix(in srgb, var(--series-1) 22%, var(--surface)); stroke: var(--series-1); }
.xl-bit.p1 rect { fill: color-mix(in srgb, var(--series-7) 22%, var(--surface)); stroke: var(--series-7); }
.xl-bit.p2 rect { fill: color-mix(in srgb, var(--series-2) 22%, var(--surface)); stroke: var(--series-2); }
.xl-bit.off rect { fill: color-mix(in srgb, var(--series-3) 22%, var(--surface)); stroke: var(--series-3); }
.xl-bit.fr rect { fill: color-mix(in srgb, var(--series-4) 25%, var(--surface)); stroke: var(--series-4); }
.xl-brace path { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.xl-svg .xl-field { font: 700 12px var(--mono); animation: d-fade 0.4s 0.25s ease-out both; }
.xl-svg .xl-field.p0 { fill: var(--series-1); }
.xl-svg .xl-field.p1 { fill: var(--series-7); }
.xl-svg .xl-field.p2 { fill: var(--series-2); }
.xl-svg .xl-field.off { fill: var(--series-3); }
.xl-svg .xl-field.fr { fill: var(--series-4); }
.xl-slot { fill: none; stroke: var(--line); stroke-dasharray: 4 3; }
.xl-row rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.3; transition: fill 0.3s, stroke 0.3s; }
.xl-row.invalid text { fill: var(--muted); }
.xl-row.lit rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.2; }
.xl-row.new rect { fill: var(--good-soft); stroke: var(--good); stroke-width: 2.2; }
.xl-row.bad rect { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 2.2; }
.xl-row.out { animation: xl-out 0.7s ease-in both; }
.xl-row.out rect { fill: var(--bad-soft); stroke: var(--bad); }
@keyframes xl-out { to { opacity: 0; transform: translateX(-24px); } }
.xl-token { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.xl-token.bad { fill: var(--bad); }
.xl-arrow { fill: none; stroke: var(--accent); stroke-width: 1.8; animation: d-fade 0.35s 0.2s ease-out both; }
.xl-arrowhead { fill: var(--accent); }
.xl-mem { fill: var(--surface); stroke: var(--muted); stroke-width: 1.3; }
.xl-seg rect { fill: color-mix(in srgb, var(--c) 25%, var(--surface)); stroke: var(--c); stroke-width: 1.2; transition: fill 0.3s; }
.xl-seg.lit rect { fill: color-mix(in srgb, var(--c) 50%, var(--surface)); stroke-width: 2.4; }
.xl-seg.bad rect { stroke: var(--bad); stroke-width: 2.4; }
.xl-seg text { font: 600 11px var(--mono); }
.xl-marker line { stroke: var(--accent); stroke-width: 2.4; }
.xl-marker path { fill: var(--accent); }
.xl-marker text { fill: var(--accent); font-weight: 700; }
.xl-marker.bad line { stroke: var(--bad); stroke-dasharray: 5 3; }
.xl-marker.bad path, .xl-marker.bad text { fill: var(--bad); }
.xl-limit { stroke: var(--bad); stroke-width: 2; stroke-dasharray: 3 3; }
td.xl-hit { color: var(--good); font-weight: 700; }
td.xl-miss { color: var(--bad); font-weight: 700; }
.xl-eat { font-size: 14.5px; overflow-wrap: anywhere; margin: 10px 0 4px; }
@media (prefers-reduced-motion: reduce) { .xl-row.out { animation: none; opacity: 0; } .xl-field, .xl-arrow { animation: none; } }

/* Home art: memory allocation and address translation */
.mem-art { gap: 3px; }
.mem-art i { height: 36px; border-radius: 4px; border: 2px dashed var(--muted); background: var(--surface); }
.mem-art i.used { background: var(--c); border: 0; }
.mem-art i.hot { background: var(--accent-soft); border: 2px solid var(--accent); }
.translate-art { justify-content: center; gap: 10px; font: 700 14px var(--mono); }
.translate-art span { display: flex; gap: 3px; }
.translate-art b { padding: 6px 7px; border-radius: 6px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 20%, var(--surface)); }
.translate-art .p { --c: var(--series-1); }
.translate-art .f { --c: var(--series-4); }
.translate-art .d { --c: var(--series-3); }
.translate-art .arrow { color: var(--muted); }
/* DBMS depth */
/* Keyed tree keys (B+ tree and B-tree): every key glides on its own */
svg.keytree .node rect { fill: var(--surface); }
svg.keytree .node.leaf rect { fill: var(--accent-soft); }
svg.keytree .tkey rect { fill: color-mix(in srgb, var(--series-1) 14%, var(--surface)); stroke: none; transition: fill 0.3s; }
svg.keytree .tkey text { fill: var(--text); font: 600 14px var(--mono); }
svg.keytree .tkey.hot rect { fill: color-mix(in srgb, var(--series-4) 45%, var(--surface)); }
svg.keytree .tkey.dup rect { fill: none; stroke: var(--muted); stroke-dasharray: 3 2; }
svg.keytree .tkey.dup text { fill: var(--muted); }
svg.keytree .tkey.flying rect { fill: color-mix(in srgb, var(--series-4) 60%, var(--surface)); }
svg.keytree .tkey.glide { transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
.btree-art i { width: auto; height: auto; padding: 1px 8px; font: 700 11px var(--mono); font-style: normal; color: var(--text); }
.btree-art div i.hot { background: color-mix(in srgb, var(--series-4) 35%, var(--surface)); border-color: var(--series-4); }

/* Extendible hashing: keep its buckets a grid (the sorting buckets reuse the class names) */
.ext .buckets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 0; }
.ext .bucket { display: block; min-height: 0; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.ext .bucket.hot { border-color: var(--accent); }
.ext .bucket.new { border-color: var(--series-4); }
.ext .bucket .keys span { animation: d-pop 0.3s ease-out; background: var(--surface-2); font-size: 14px; padding: 1px 7px; text-align: left; }
.ext .bucket .keys span.new { background: var(--good-soft); color: var(--good); }
.ext .dir li.hot { color: var(--accent); font-weight: 700; }
/* SQL joins: pulses, result rows and the join-algorithm disk view */
.jn-wrap table.sqltable tr.match td, .jn-wrap table.sqltable tr.nomatch td, .jn-wrap table.sqltable tr.active td { animation: jn-pulse 0.55s ease-out; }
.jn-wrap table.sqltable.result tr.fresh td { animation: jn-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes jn-pulse { from { box-shadow: inset 0 0 0 2px var(--accent); } }
@keyframes jn-in { from { opacity: 0; transform: translateY(-14px); } }
.jn-stage { display: grid; gap: 10px; margin-bottom: 10px; }
.jn-disk { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 10px; }
.jn-label { font: 700 12px var(--display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.jn-rel, .jn-memory, .jn-parts { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.jn-blocks { display: flex; flex-wrap: wrap; gap: 6px; }
.jn-block, .jn-buf { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; border: 1.5px dashed var(--line); border-radius: 9px; padding: 4px 6px; background: var(--surface); transition: border-color 0.25s, background 0.25s; }
.jn-block > b, .jn-buf > b { font: 600 10.5px var(--mono); color: var(--muted); flex-basis: 100%; }
.jn-block.mem { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.jn-memory { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; border: 2px solid var(--accent); }
.jn-memory > .jn-label { flex-basis: 100%; color: var(--accent); }
.jn-buf { border-style: solid; }
.jn-t { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1.5px solid var(--line); font: 700 13px var(--mono); white-space: nowrap; }
.jn-t small { font: 500 10.5px var(--mono); color: var(--muted); }
.jn-t.hot { border-color: var(--series-4); background: color-mix(in srgb, var(--series-4) 22%, var(--surface)); animation: jn-pulse 0.5s ease-out; }
.jn-t.hot.match { border-color: var(--good); background: var(--good-soft); }
.jn-t.hot.nomatch { border-color: var(--bad); background: var(--bad-soft); }
.jn-ptr { font: 700 10.5px var(--mono); font-style: normal; color: var(--surface); background: var(--accent); border-radius: 4px; padding: 1px 4px; }
.jn-glide { transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); position: relative; z-index: 2; }
.jn-parts { display: grid; gap: 4px; }
.jn-part { display: grid; grid-template-columns: 22px 1fr 1fr; gap: 6px; align-items: start; border-radius: 8px; padding: 4px 6px; background: var(--surface); border: 1.5px solid var(--line); transition: border-color 0.25s; }
.jn-part > b { font: 700 13px var(--mono); color: var(--muted); }
.jn-part > div { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
.jn-part small { font: 600 10.5px var(--mono); color: var(--muted); }
.jn-part.landed { border-color: var(--series-4); }
.jn-part.probing { border-color: var(--accent); background: var(--accent-soft); }
.jn-cost-in { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 10px; }
.jn-cost-in input[type="number"] { width: 92px; }
table.jn-cost td.jn-formula { white-space: normal; min-width: 220px; font-family: var(--body); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .jn-glide, .jn-t.hot, .jn-wrap table.sqltable tr td { transition: none; animation: none; } }
/* Query processing */
.qp-plan { min-height: 220px; }
.qp-plan .t-node text { font-size: 12.5px; }
table.qp-sel th[scope="row"] { white-space: normal; }
table.qp-sel td.left { white-space: normal; min-width: 200px; font-family: var(--body); }
.algebra-art span:first-child { color: var(--muted); }
/* Concurrency control */
.cc-strip { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.cc-op { font: 700 13px var(--mono); padding: 3px 8px; border-radius: 7px; border: 2px solid color-mix(in srgb, var(--c) 55%, transparent); color: var(--c); background: var(--surface); transition: background 0.25s, color 0.25s, opacity 0.25s; }
.cc-op.implicit { border-style: dashed; }
.cc-op.done { background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--text); }
.cc-op.wait { background: var(--warn-soft); border-color: var(--series-4); color: var(--text); animation: cc-pulse 1.2s ease-in-out infinite; }
.cc-op.fail { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); text-decoration: line-through; }
.cc-op.ignored { opacity: 0.6; text-decoration: line-through; border-style: dotted; }
.cc-op.skip { opacity: 0.35; text-decoration: line-through; }
.cc-op.now { outline: 3px solid var(--accent); outline-offset: 1px; }
@keyframes cc-pulse { 50% { border-color: transparent; } }
.cc-sub { font: 700 12px var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 14px 0 6px; }
.cc-stage > .cc-sub:first-child, .cc-two .cc-sub { margin-top: 10px; }
.cc-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); gap: 12px; align-items: start; }
.cc-two > div { min-width: 0; }
svg.cc-locks { display: block; width: 100%; height: auto; }
.cc-locks .cc-head { fill: var(--muted); font: 700 11px var(--display); text-transform: uppercase; letter-spacing: 0.06em; }
.cc-locks .cc-sep { stroke: var(--line); stroke-dasharray: 3 3; }
.cc-locks .cc-row { fill: var(--surface); transition: fill 0.25s; }
.cc-locks .cc-row.hot { fill: var(--accent-soft); }
.cc-locks .cc-item { fill: var(--text); font: 700 15px var(--mono); }
.cc-chip rect { fill: color-mix(in srgb, var(--c) 22%, var(--surface)); stroke: var(--c); stroke-width: 2; }
.cc-chip.held.X rect { fill: var(--c); }
.cc-chip.held.X text { fill: var(--surface); }
.cc-chip.queued rect { fill: var(--surface); stroke-dasharray: 5 3; }
.cc-chip text { fill: var(--text); font: 700 12.5px var(--mono); }
.cc-table td.cc-changed { animation: d-flash 0.9s ease-out; font-weight: 700; }
.cc-table tr.hot td, .cc-table tr.hot th { background: var(--accent-soft); }
.cc-table th[scope="row"] { white-space: nowrap; }
.cc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.cc-st.waiting { color: var(--series-4); font-weight: 700; }
.cc-st.committed { color: var(--good); font-weight: 700; }
.cc-st.aborted { color: var(--bad); font-weight: 700; }
.cc-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; max-height: 150px; overflow-y: auto; }
.cc-h { font: 500 12px var(--mono); padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border-left: 3px solid var(--c); }
.cc-h b { color: var(--c); }
.cc-h.lock { background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.cc-h.unlock { color: var(--muted); }
.cc-h.wait { background: var(--warn-soft); }
.cc-h.aborted { background: var(--bad-soft); color: var(--bad); }
.cc-h.committed { background: var(--good-soft); color: var(--good); }
.cc-h.new { animation: d-pop 0.35s ease-out; }
.cc-tsline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cc-tsline em { color: var(--muted); font-size: 13px; }
.cc-ts { display: grid; text-align: center; padding: 4px 12px; border-radius: 10px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); transition: opacity 0.3s; }
.cc-ts b { font: 700 14px var(--mono); }
.cc-ts small { font: 500 11.5px var(--mono); color: var(--muted); }
.cc-ts.aborted { opacity: 0.45; text-decoration: line-through; }
svg.cc-occ { display: block; width: 100%; height: auto; }
.cc-occ .cc-tick { fill: var(--muted); font: 500 10px var(--mono); }
.cc-occ .cc-tick.now { fill: var(--accent); font-weight: 800; }
.cc-occ .cc-item { fill: var(--text); font: 700 12px var(--mono); }
.cc-bar { fill: color-mix(in srgb, var(--c) 30%, var(--surface)); stroke: var(--c); stroke-width: 1.5; transition: width 0.35s ease-out; }
.cc-bar.committed { fill: var(--c); }
.cc-bar.aborted { fill: var(--bad-soft); stroke: var(--bad); }
.cc-val { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.cc-val.aborted { stroke: var(--bad); }
.cc-legend .cc-key i { display: inline-block; width: 14px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 2px solid var(--muted); background: var(--surface); }
.cc-legend .cc-key.done i { background: color-mix(in srgb, var(--series-1) 25%, var(--surface)); border-color: var(--series-1); }
.cc-legend .cc-key.now i { border-color: var(--accent); border-width: 3px; }
.cc-legend .cc-key.wait i { background: var(--warn-soft); border-color: var(--series-4); }
.cc-legend .cc-key.fail i { background: var(--bad-soft); border-color: var(--bad); }
.cc-legend .cc-key.ignored i { border-style: dotted; }
.cc-legend .cc-key.skip i { opacity: 0.35; }
@media (prefers-reduced-motion: reduce) { .cc-op.wait, .cc-h.new, .cc-table td.cc-changed { animation: none; } .cc-bar { transition: none; } }

.locks-art { flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px; }
.locks-art div { display: flex; gap: 5px; align-items: center; font: 700 12px var(--mono); }
.locks-art i { font-style: normal; padding: 2px 7px; border-radius: 6px; border: 2px solid var(--series-1); background: color-mix(in srgb, var(--series-1) 20%, var(--surface)); }
.locks-art i.x { background: var(--series-1); color: var(--surface); }
.locks-art i.q { border-style: dashed; border-color: var(--series-2); background: var(--surface); }
/* Log-based recovery */
.rc-stage { display: grid; gap: 14px; min-width: 0; }
.rc-phases { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rc-phases li { padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font: 600 13px var(--body); transition: background 0.3s, color 0.3s; }
.rc-phases li.past { color: var(--good); }
.rc-phases li.on { background: var(--accent); color: var(--surface); }
.rc-log { position: relative; max-height: 420px; overflow: auto; background: var(--surface-2); border-radius: 12px; padding: 8px 8px 8px 28px; }
.rc-log.rc-static { padding-left: 8px; margin: 10px 0; }
.rc-records { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font: 500 13px var(--mono); }
.rc-rec { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 4px 8px; border-radius: 7px; background: var(--surface); border-left: 4px solid var(--c, var(--line)); transition: background 0.25s; min-width: 0; }
.rc-rec code { font: inherit; overflow-wrap: anywhere; min-width: 0; }
.rc-lsn { color: var(--muted); min-width: 1.6em; text-align: right; font-weight: 700; }
.rc-meta { color: var(--muted); font-size: 11.5px; }
.rc-rec.rc-ck { background: var(--warn-soft); }
.rc-rec.rc-added { background: var(--good-soft); }
.rc-rec.on { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }
.rc-rec.rc-in { animation: rc-slide 0.45s ease-out both; }
@keyframes rc-slide { from { opacity: 0; transform: translateX(-28px); } }
.rc-crash { text-align: center; font: 700 12px var(--body); color: var(--bad); border-top: 2px dashed var(--bad); padding-top: 3px; margin: 6px 0 4px; }
.rc-ptr { position: absolute; left: 8px; top: 0; color: var(--accent); font-size: 14px; line-height: 20px; opacity: 0; pointer-events: none; transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s; }
.rc-values { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-val { display: grid; justify-items: center; min-width: 88px; padding: 6px 10px; border-radius: 10px; background: var(--surface); border: 2px solid var(--line); transition: border-color 0.3s; }
.rc-val .rc-item { font: 700 12px var(--mono); color: var(--muted); }
.rc-val b { font: 700 20px var(--mono); border-radius: 6px; padding: 0 4px; }
.rc-val s { font: 500 12px var(--mono); color: var(--bad); min-height: 1.2em; }
.rc-val small { font-size: 11px; color: var(--muted); text-align: center; }
.rc-val.changed { border-color: var(--accent); }
.rc-val.dirty { border-style: dashed; border-color: var(--series-4); }
.rc-val.changed.dirty { border-color: var(--accent); }
.rc-val.flash b { animation: rc-flash 0.8s ease-out; }
@keyframes rc-flash { from { background: var(--warn-soft); transform: scale(1.18); } }
.rc-sets { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.rc-box { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; min-width: 0; max-width: 100%; }
.rc-chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 28px; align-items: center; }
.rc-chip { padding: 2px 10px; border-radius: 999px; border: 2px solid var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 15%, var(--surface)); font: 700 13px var(--mono); }
.rc-chip.new { animation: rc-pop 0.35s ease-out; }
@keyframes rc-pop { from { opacity: 0; transform: scale(0.5); } }
table.rc-table { width: auto; font-size: 13px; }
table.rc-table th, table.rc-table td { padding: 3px 10px; }
.rc-crash-range { width: 100%; accent-color: var(--bad); }
.log-art .hot { color: var(--bad); }

/* Normalisation step-through */
.nf-stage { background: var(--surface-2); border-radius: 12px; padding: 12px; display: grid; gap: 12px; }
.nf-attrs { display: flex; flex-wrap: wrap; gap: 6px; }
.nf-attrs span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; border: 2px solid var(--line); background: var(--surface); font: 700 16px var(--mono); color: var(--muted); transition: background 0.3s, border-color 0.3s, color 0.3s; }
.nf-attrs span.in { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.nf-attrs span.new { border-color: var(--good); background: var(--good-soft); color: var(--good); animation: d-pop 0.45s ease-out; }
.nf-fds { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font: 600 13.5px var(--mono); }
.nf-fds li { padding: 4px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); transition: background 0.25s, border-color 0.25s, opacity 0.25s; }
.nf-fds li.hot { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.nf-fds li.fire { border-color: var(--good); background: var(--good-soft); }
.nf-fds li.done { border-color: var(--good); }
.nf-fds li.skip { opacity: 0.55; border-style: dashed; }
.nf-fds li.warn { border-color: var(--series-4); background: var(--warn-soft); }
.nf-fds li.bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.nf-rels { display: flex; flex-wrap: wrap; gap: 8px; }
.nf-rels .rel { transition: background 0.3s; }
.nf-rels .rel.new { background: var(--good-soft); color: var(--good); animation: d-pop 0.45s ease-out; }
.nf-rels .rel.hot { outline: 2.5px solid var(--series-4); }
.nf-rels .rel.good { background: var(--good-soft); color: var(--good); }

/* Serialisability: edges draw themselves in; Kahn's order builds up */
.pg-edge.latest { stroke-dasharray: 220; animation: sg-draw 0.6s ease-out both; }
@keyframes sg-draw { from { stroke-dashoffset: 220; } to { stroke-dashoffset: 0; } }
.pg-edge.gone { opacity: 0.2; }
.pg-node circle { transition: fill 0.3s, stroke 0.3s, opacity 0.3s; }
.pg-node.pick circle { fill: var(--good-soft); stroke: var(--good); stroke-width: 3.5; }
.pg-node.gone { opacity: 0.35; }
.sg-order { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font: 700 14px var(--mono); }
.sg-order b { padding: 2px 10px; border-radius: 999px; background: var(--good-soft); color: var(--good); }
.sg-order b.new { animation: d-pop 0.4s ease-out; }

/* Hashing: the slot being probed pulses */
.hash-table li { transition: background 0.25s, border-color 0.25s; }
.hash-table li.now { background: var(--bad-soft); border-color: var(--bad); animation: hs-shake 0.35s ease-out; }
.hash-table li.landed .val, .hash-table li.landed .chain b.new { animation: d-pop 0.4s ease-out; display: inline-block; }
@keyframes hs-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* TOC and CD depth */
/* Pushdown automata */
.pda-stage { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 560px) { .pda-stage { grid-template-columns: 1fr; } }
.pda-stack-box { background: var(--surface-2); border-radius: 12px; padding: 8px; display: flex; justify-content: center; }
svg.pda-stack { display: block; width: 150px; max-width: 100%; height: auto; overflow: visible; }
.pda-floor, .pda-walls { stroke: var(--muted); stroke-width: 2; fill: none; stroke-linecap: round; }
.pda-item rect { fill: color-mix(in srgb, var(--series-1) 18%, var(--surface)); stroke: var(--series-1); stroke-width: 1.6; transition: fill 0.3s, stroke 0.3s; }
.pda-item text { fill: var(--text); font: 700 14px var(--mono); }
.pda-item.top rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.6; }
.pda-item.pushed rect { fill: var(--good-soft); stroke: var(--good); }
.pda-item.pushed { animation: pda-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.pda-item.gone { animation: pda-out 0.6s ease-in both; pointer-events: none; }
.pda-item.gone rect { fill: var(--bad-soft); stroke: var(--bad); }
@keyframes pda-in { from { opacity: 0; transform: translateY(-40px); } }
@keyframes pda-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translate(46px, -46px); } }
.pda-top-label { fill: var(--accent); font: 700 11.5px var(--mono); }
.pda-empty { fill: var(--muted); font: 500 12px var(--mono); }
.pda-side { min-width: 0; }
.pda-form { font: 700 18px/1.6 var(--mono); display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0; overflow-wrap: anywhere; }
.pda-form .pda-read { color: var(--good); background: var(--good-soft); border-radius: 6px; padding: 0 6px; }
.pda-form .pda-left { color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 0 6px; }
.pda-moves li { overflow-wrap: anywhere; }
.pda-art { justify-content: center; gap: 18px; }
.pda-art .stk { display: flex; flex-direction: column; gap: 3px; width: 46px; padding: 0 4px 3px; border: 2px solid var(--muted); border-top: 0; border-radius: 0 0 6px 6px; }
.pda-art .stk i { height: 13px; border-radius: 3px; background: color-mix(in srgb, var(--series-1) 30%, var(--surface)); }
.pda-art .stk i.hot { background: var(--series-3); }
.pda-art span { font: 600 13px var(--mono); }
@media (prefers-reduced-motion: reduce) { .pda-item.pushed, .pda-item.gone { animation: none; } .pda-item.gone { display: none; } }
/* CFG to Chomsky normal form */
.cnf-phases { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 12px 0 0; }
.cnf-phases li { display: grid; padding: 4px 10px; border-radius: 10px; background: var(--surface-2); border: 1.5px solid var(--line); line-height: 1.25; transition: background 0.3s, border-color 0.3s; }
.cnf-phases b { font: 700 12.5px var(--mono); }
.cnf-phases span { font-size: 11.5px; color: var(--muted); }
.cnf-phases li.on { background: var(--accent-soft); border-color: var(--accent); }
.cnf-phases li.on b { color: var(--accent); }
.cnf-phases li.done { border-color: var(--good); }
.cnf-phases li.done b::after { content: " ✓"; color: var(--good); }
.cnf-stage { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.cnf-grammar { display: grid; gap: 6px; }
.cnf-rule { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: start; }
.cnf-lhs { font: 700 14.5px/30px var(--mono); color: var(--accent); min-width: 2.2em; }
.cnf-arrow { font: 600 14px/30px var(--mono); color: var(--muted); }
.cnf-alts { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.cnf-alt { font: 600 13.5px var(--mono); padding: 4px 9px; border-radius: 8px; background: var(--surface); border: 1.5px solid var(--line); overflow-wrap: anywhere; transition: background 0.3s, border-color 0.3s; }
.cnf-alt.todo { border-style: dashed; border-color: var(--muted); }
.cnf-alt.focus { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 2px var(--accent-soft); }
.cnf-alt.new { background: var(--good-soft); border-color: var(--good); color: var(--good); animation: cnf-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.cnf-alt.gone { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); text-decoration: line-through; animation: cnf-out 1.1s ease-in both; }
@keyframes cnf-in { from { opacity: 0; transform: scale(0.6); } }
@keyframes cnf-out { 0%, 45% { opacity: 1; transform: none; } to { opacity: 0.35; transform: scale(0.85); } }
.cnf-art { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; font: 600 13px var(--mono); }
.cnf-art .gone { color: var(--bad); text-decoration: line-through; }
.cnf-art .hot { color: var(--good); }
@media (prefers-reduced-motion: reduce) { .cnf-alt.new, .cnf-alt.gone { animation: none; } .cnf-alt.gone { opacity: 0.5; } }
/* DFA to regex (state elimination) */
.d-node.elim-new circle { stroke: var(--series-7); stroke-dasharray: 4 3; }
.d-node.elim-going { opacity: 0.55; transition: opacity 0.4s; }
.d-node.elim-going circle { stroke: var(--bad); stroke-width: 2.6; stroke-dasharray: 5 3; fill: var(--bad-soft); }
table.parse td.elim-re { white-space: normal; overflow-wrap: anywhere; text-align: left; min-width: 120px; }
table.parse tr.elim-via td { background: color-mix(in srgb, var(--bad-soft) 60%, transparent); }
table.parse.elim-table th[scope="row"] { white-space: normal; }
.elim-sub { margin: 12px 0 6px; }
.elim-regex b { overflow-wrap: anywhere; word-break: break-all; font-size: 20px; }
@media (prefers-reduced-motion: reduce) { .d-node.elim-going { transition: none; } }
/* Pumping lemma game */
.pump-panel { margin-top: 14px; }
.pump-panel h3 { margin-bottom: 6px; }
.pump-str { display: flex; flex-wrap: wrap; gap: 8px 4px; align-items: flex-start; margin: 6px 0; max-width: 100%; }
.pump-seg { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; max-width: 100%; --c: var(--series-1); }
.pump-seg.pump-y { --c: var(--series-2); }
.pump-seg.pump-z { --c: var(--series-3); }
.pump-chars { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 8px; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); max-width: 100%; }
.pump-chars span { min-width: 22px; height: 28px; display: grid; place-items: center; font: 700 15px var(--mono); border-radius: 5px; background: var(--surface); padding: 0 4px; }
.pump-chars .pump-none { color: var(--muted); font-weight: 400; }
.pump-seg small { font: 700 11.5px var(--mono); color: var(--c); }
.pump-seg.pump-copy { animation: pump-in 0.4s ease-out both; animation-delay: calc(var(--n, 0) * 90ms); }
.pump-seg.pump-gone .pump-chars { opacity: 0.4; border-style: dashed; animation: pump-out 0.5s ease-out both; }
.pump-seg.pump-gone .pump-chars span { text-decoration: line-through; }
table.parse td.pump-z-cell { white-space: normal; overflow-wrap: anywhere; }
@keyframes pump-in { from { opacity: 0; transform: translateY(-8px) scale(0.6); } }
@keyframes pump-out { from { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pump-seg.pump-copy, .pump-seg.pump-gone .pump-chars { animation: none; } }
.pump-art { justify-content: center; gap: 4px; }
.pump-art i { font: 700 14px var(--mono); font-style: normal; padding: 6px 8px; border-radius: 6px; border: 2px solid var(--series-1); background: color-mix(in srgb, var(--series-1) 14%, var(--surface)); }
.pump-art i.y { border-color: var(--series-2); background: color-mix(in srgb, var(--series-2) 14%, var(--surface)); }
.pump-art i.z { border-color: var(--series-3); background: color-mix(in srgb, var(--series-3) 14%, var(--surface)); }
/* Lexical analysis */
.lex-src { display: flex; flex-wrap: wrap; gap: 2px; background: var(--surface-2); border-radius: 12px; padding: 8px; }
.lex-ch { min-width: 22px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: var(--surface); border: 1.5px solid var(--line); font: 700 14px var(--mono); padding: 0 3px; transition: background 0.25s, border-color 0.25s, color 0.25s; }
.lex-ch.space { color: var(--muted); font-weight: 400; }
.lex-ch.done { opacity: 0.45; }
.lex-ch.scan { background: var(--accent-soft); border-color: var(--accent); }
.lex-ch.emit { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.lex-ch.err { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.lex-ch.back { background: var(--warn-soft); border-color: var(--series-4); border-style: dashed; }
.lex-ch.next { box-shadow: 0 3px 0 var(--accent); }
.lex-ch.eof { font-size: 10px; color: var(--muted); border-style: dashed; }
.lex-br { flex-basis: 100%; height: 0; }
.lex-gap { margin-top: 14px; }
.lex-stream { display: flex; flex-wrap: wrap; gap: 5px; min-height: 44px; background: var(--surface-2); border-radius: 12px; padding: 8px; align-items: center; }
.lex-tok { display: inline-grid; justify-items: center; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-radius: 9px; padding: 2px 8px; max-width: 100%; }
.lex-tok b { font: 700 12.5px var(--mono); overflow-wrap: anywhere; }
.lex-tok small { font: 500 11px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.lex-new { animation: lex-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes lex-in { from { opacity: 0; transform: translateX(-14px) scale(0.85); } }
tr.lex-new td { animation: lex-row 0.9s ease-out both; }
@keyframes lex-row { from { background: var(--good-soft); } }
table.lex-sym td.left { font-weight: 700; }
tr.lex-err td { color: var(--bad); }
@media (prefers-reduced-motion: reduce) { .lex-new, tr.lex-new td { animation: none; } .lex-ch { transition: none; } }
/* Operator-precedence parsing */
table.op-rel td { min-width: 30px; font-size: 15px; }
table.op-rel td.op-lt { color: var(--series-1); }
table.op-rel td.op-eq { color: var(--series-7); }
table.op-rel td.op-gt { color: var(--series-2); }
table.op-rel td.added { animation: op-flash 0.8s ease-out; }
@keyframes op-flash { from { background: var(--warn-soft); } }
.op-gap { margin-top: 14px; }
.op-stack { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 10px; align-items: flex-end; }
.op-stack span { min-width: 30px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); font: 700 15px var(--mono); padding: 0 8px; border: 1.5px solid var(--line); }
.op-stack span.nt { color: var(--accent); background: var(--accent-soft); }
.op-stack span.top { border-color: var(--accent); border-width: 2.5px; }
.op-stack span.op-pushed { animation: op-push 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.op-stack span.op-reduced { animation: op-reduce 0.5s ease-out both; }
@keyframes op-push { from { opacity: 0; transform: translateY(-18px); } }
@keyframes op-reduce { from { opacity: 0; transform: scaleX(1.8); background: var(--good-soft); } }
@media (prefers-reduced-motion: reduce) { .op-stack span.op-pushed, .op-stack span.op-reduced, table.op-rel td.added { animation: none; } }
/* Syntax-directed translation */
.sdt-gap { margin: 14px 0 6px; }
.sdt-order { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; counter-reset: sdt; }
.sdt-order li { counter-increment: sdt; display: inline-flex; gap: 6px; align-items: center; padding: 3px 9px; border-radius: 999px; font: 600 12.5px var(--mono); border: 1.5px solid var(--series-1); background: color-mix(in srgb, var(--series-1) 12%, var(--surface)); transition: opacity 0.3s, background 0.3s; }
.sdt-order li::before { content: counter(sdt); font: 600 10.5px var(--body); color: var(--muted); }
.sdt-order li.inh { border-color: var(--series-4); background: color-mix(in srgb, var(--series-4) 14%, var(--surface)); }
.sdt-order li.todo { opacity: 0.4; border-style: dashed; }
.sdt-order li.now { box-shadow: 0 0 0 2.5px var(--accent); animation: sdt-pop 0.35s ease-out; }
.sdt-order li b { color: var(--accent); }
table.sdt-rules td.left { white-space: normal; }
@keyframes sdt-pop { from { transform: scale(0.8); } }
@media (prefers-reduced-motion: reduce) { .sdt-order li.now { animation: none; } }
.t-node text.sdt-val { font: 600 11.5px var(--mono); fill: var(--accent); }
.t-node.open text.sdt-val { fill: var(--muted); }
/* Code optimisation */
.opt-listing { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; font: 500 13.5px var(--mono); }
.opt-listing li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 3px 8px; border-radius: 6px; border-left: 4px solid transparent; transition: background 0.25s, border-color 0.25s; }
.opt-listing li.in-block { border-left-color: var(--c); background: color-mix(in srgb, var(--c) 9%, transparent); }
.opt-listing li.now { outline: 2px solid var(--accent); outline-offset: -2px; }
.opt-listing code { font: inherit; overflow-wrap: anywhere; min-width: 0; }
.opt-num { color: var(--muted); min-width: 34px; }
.opt-badge { margin-left: auto; font: 700 11px var(--body); padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); animation: opt-pop 0.35s ease-out; }
.opt-listing li.in-block .opt-badge { background: var(--c); color: var(--surface); }
.opt-pass-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.opt-chip { font: 600 12px var(--body); padding: 2px 10px; border-radius: 999px; border: 1.5px solid var(--line); color: var(--muted); transition: background 0.25s, color 0.25s; }
.opt-chip.on { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.opt-chip.off { text-decoration: line-through; opacity: 0.55; }
.opt-where { margin-left: auto; font: 600 12.5px var(--mono); color: var(--muted); }
.opt-diff { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; font: 500 14px var(--mono); }
.opt-diff li { padding: 3px 10px; border-radius: 6px; background: var(--surface-2); overflow-wrap: anywhere; }
.opt-diff li code { font: inherit; }
.opt-diff li.del { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; animation: opt-strike 0.5s ease-out; }
.opt-diff li.del::before { content: "− "; }
.opt-diff li.ins { background: var(--good-soft); color: var(--good); font-weight: 700; animation: opt-slide 0.45s 0.15s ease-out both; }
.opt-diff li.ins::before { content: "+ "; }
.opt-gap { margin: 14px 0 6px; }
.opt-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 10px; }
.opt-block { border: 1.5px solid var(--c); border-radius: 10px; padding: 8px 10px; background: color-mix(in srgb, var(--c) 6%, var(--surface)); min-width: 0; }
.opt-block > b { font: 700 13px var(--display); color: var(--c); }
.opt-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-mini { list-style: none; margin: 4px 0 0; padding: 0; font: 500 12.5px var(--mono); display: grid; gap: 1px; min-width: 0; }
.opt-mini li { overflow-wrap: anywhere; }
.opt-mini li.gone { color: var(--bad); text-decoration: line-through; opacity: 0.75; }
.opt-mini li.new { color: var(--good); font-weight: 700; }
.opt-art .gone { color: var(--bad); text-decoration: line-through; }
@keyframes opt-strike { from { background: var(--surface-2); color: var(--text); text-decoration-color: transparent; } }
@keyframes opt-slide { from { opacity: 0; transform: translateY(-8px); } }
@keyframes opt-pop { from { opacity: 0; transform: scale(0.6); } }
@media (max-width: 520px) { .opt-two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .opt-badge, .opt-diff li.del, .opt-diff li.ins { animation: none; } }
.opt-cfg { margin-top: 12px; }
/* Register allocation */
.ra-graph-wrap { display: flex; justify-content: center; }
svg.ra-graph { width: 100%; height: auto; display: block; margin: 0 auto; }
.ra-edge { stroke: var(--muted); stroke-width: 1.8; transition: opacity 0.4s, stroke 0.3s, stroke-width 0.3s; }
.ra-edge.hidden { opacity: 0; }
.ra-edge.fresh { stroke: var(--accent); stroke-width: 3.2; }
.ra-edge.faded { opacity: 0.12; }
.ra-node circle { fill: var(--surface); stroke: var(--muted); stroke-width: 2; transition: fill 0.4s, stroke 0.4s, stroke-width 0.3s; }
.ra-node text { fill: var(--text); font: 700 13.5px var(--mono); }
.ra-node text.ra-reg { font: 700 11.5px var(--mono); fill: var(--c, var(--bad)); }
.ra-node { transition: opacity 0.45s; }
.ra-node.gone { opacity: 0.18; }
.ra-node.hi circle { fill: var(--accent-soft); stroke: var(--accent); }
.ra-node.cur circle { stroke: var(--accent); stroke-width: 3.5; }
.ra-node.col circle { fill: color-mix(in srgb, var(--c) 28%, var(--surface)); stroke: var(--c); stroke-width: 3; }
.ra-node.maybe circle { stroke-dasharray: 5 3; stroke: var(--series-4); }
.ra-node.spill circle { fill: var(--bad-soft); stroke: var(--bad); stroke-dasharray: 4 3; }
.ra-node.spill text.ra-reg { fill: var(--bad); }
.ra-colour { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.ra-stack { display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 4px; min-width: 76px; min-height: 120px; padding: 8px; border: 2px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: var(--surface-2); }
.ra-stack span { font: 700 14px var(--mono); text-align: center; padding: 4px 10px; border-radius: 7px; background: var(--surface); border: 1.5px solid var(--line); }
.ra-stack span.maybe { border-color: var(--series-4); border-style: dashed; }
.ra-stack span.push { animation: ra-push 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); border-color: var(--accent); }
.ra-stack .ra-stack-label { order: 99; border: 0; background: none; font: 700 11px var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0; }
.ra-gap { margin: 14px 0 6px; }
table.ra-ranges td.live { background: color-mix(in srgb, var(--series-1) 22%, var(--surface)); }
table.ra-ranges td { min-width: 34px; font-size: 11.5px; color: var(--muted); }
table.ra-ranges td.left { color: var(--text); font-size: 13px; }
.ra-assign { display: flex; flex-wrap: wrap; gap: 8px; }
.ra-assign span { display: inline-flex; gap: 8px; align-items: center; padding: 4px 12px; border-radius: 999px; font: 600 13.5px var(--mono); border: 2px solid var(--c, var(--bad)); background: color-mix(in srgb, var(--c, var(--bad)) 16%, var(--surface)); }
.ra-assign span.spill { border-style: dashed; }
.ra-art .p { border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
@keyframes ra-push { from { opacity: 0; transform: translateY(-36px); } }
@media (max-width: 520px) { .ra-colour { grid-template-columns: 1fr; } .ra-stack { flex-direction: row-reverse; flex-wrap: wrap; justify-content: flex-end; min-height: 0; border: 2px solid var(--line); border-left: 0; border-radius: 0 12px 12px 0; } }
@media (prefers-reduced-motion: reduce) { .ra-edge, .ra-node, .ra-node circle { transition: none; } .ra-stack span.push { animation: none; } }
/* Upgraded TOC/CD tools: stacked visuals beside the code, parser stacks that push and pop */
.tcd-stack { display: grid; gap: 12px; min-width: 0; }
.tcd-stack > * { min-width: 0; }
.tcd-sub { margin: 12px 0 6px; }
.cyk-word span { border-radius: 6px; transition: background 0.25s; }
.cyk-word span.on { background: var(--accent-soft); }
.cyk-word span.l { background: color-mix(in srgb, var(--series-1) 18%, transparent); }
.cyk-word span.r { background: color-mix(in srgb, var(--series-2) 18%, transparent); }
.ll-stack span { max-width: 140px; overflow: hidden; }
.ll-stack span.push { animation: tcd-push 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.ll-stack span.ghost { border-style: dashed; color: var(--muted); animation: tcd-pop 0.5s ease-in forwards; }
.lr-stack span.st { color: var(--muted); font-size: 13px; min-width: 26px; background: var(--surface); }
.lr-stack span.top { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@keyframes tcd-push { from { opacity: 0; transform: translateY(-14px) scale(0.85); } }
@keyframes tcd-pop { 0% { opacity: 0.9; } 55% { opacity: 0; transform: translateY(-14px); max-width: 140px; } 100% { opacity: 0; transform: translateY(-14px); max-width: 0; min-width: 0; padding: 0; margin-left: -3px; border-width: 0; } }
@media (prefers-reduced-motion: reduce) { .ll-stack span.push, .ll-stack span.ghost { animation: none; } .ll-stack span.ghost { display: none; } }
/* CN depth */
/* Moving packets (views/net.js) */
.pkt rect { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.pkt text { fill: var(--text); font: 700 10.5px var(--mono); }
.pkt.frame rect, .pkt.data rect, .pkt.syn rect, .pkt.query rect, .pkt.get rect, .pkt.lsp rect { stroke: var(--series-1); fill: color-mix(in srgb, var(--series-1) 16%, var(--surface)); }
.pkt.ack rect, .pkt.answer rect, .pkt.resp rect, .pkt.ok rect, .pkt.cts rect { stroke: var(--series-3); fill: color-mix(in srgb, var(--series-3) 16%, var(--surface)); }
.pkt.referral rect, .pkt.fin rect, .pkt.probe rect, .pkt.dv rect, .pkt.rts rect { stroke: var(--series-4); fill: color-mix(in srgb, var(--series-4) 18%, var(--surface)); }
.pkt.doomed rect, .pkt.bad rect, .pkt.collide rect { stroke: var(--bad); fill: var(--bad-soft); }
.pkt.sig rect { rx: 7; stroke-width: 0; opacity: 0.75; }
.pkt.sig.ok rect { fill: var(--series-1); }
.pkt.sig.bad rect { fill: var(--bad); }
.timeline.seq { min-width: 0; }
.timeline .msg.syn line, .timeline .msg.query line, .timeline .msg.get line, .timeline .msg.data line { stroke: var(--series-1); }
.timeline .msg.answer line, .timeline .msg.resp line, .timeline .msg.cts line { stroke: var(--series-3); }
.timeline .msg.ack line { stroke: var(--series-3); }
.timeline .msg.referral line, .timeline .msg.fin line, .timeline .msg.rts line { stroke: var(--series-4); }
.timeline .msg.live line { stroke-dasharray: 3 4; opacity: 0.55; }
.timeline .msg-label { paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; stroke-linejoin: round; }
.seq-mark { fill: var(--muted); font: 600 10.5px var(--mono); }
.seq-mark.now { fill: var(--accent); font-weight: 800; }
.seq-span rect { fill: var(--series-7); opacity: 0.6; }
.seq-span text { fill: var(--muted); font: 600 10.5px var(--mono); }

/* Subnetting trace */
.bits-row.hot .bits-label { color: var(--accent); font-weight: 700; }
.bits i.oct { outline: 2px solid var(--accent); outline-offset: -1px; }
.bits i.miss { background: var(--bad-soft); color: var(--bad); font-weight: 800; }
.bits i.pending { color: var(--muted); }
svg.space-svg { width: 100%; height: auto; display: block; }
.space-bg { fill: var(--surface); stroke: var(--line); }
.space-blk rect { fill: var(--c); }
.space-blk text { fill: #fff; font: 700 12px var(--body); }

/* Routing */
.net-link.path line { stroke: var(--series-1); stroke-width: 5; }
.net-link.hot line { stroke: var(--series-4); stroke-width: 4; stroke-dasharray: 7 4; }
.net-drop { fill: var(--bad); font: 800 15px var(--body); }
tr.hot-row td, tr.hot-row th { background: var(--warn-soft); }
tr.win-row td, tr.win-row th { background: var(--good-soft); }
tr.current td, tr.current th { background: var(--accent-soft); }

/* TCP */
.cwnd-chart .wmax line { stroke: var(--series-7); stroke-dasharray: 2 4; }
.cwnd-chart .wmax text { fill: var(--series-7); }
.cwnd-chart .now-dot { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.cwnd-chart .now-dot.pure { stroke: var(--series-2); }
.cwnd-chart .line.pure { stroke: var(--series-2); }
.cwnd-chart .g-now { stroke: var(--accent); stroke-dasharray: 3 4; }
.cwnd-chart .peak circle { fill: var(--surface); stroke: var(--series-1); stroke-width: 2.5; }
.cwnd-chart .peak.pure circle { stroke: var(--series-2); }
.cwnd-chart .peak text { fill: var(--text); font: 600 11px var(--body); }
.pipe-wrap { margin-top: 8px; }
svg.pipe { width: 100%; min-width: 420px; height: auto; display: block; }
.pipe-bg { fill: var(--surface); stroke: var(--line); }
.seg-pkt rect { fill: var(--series-1); }
.seg-pkt.lost rect { fill: var(--bad); }
.pipe-end, .pipe-more { fill: var(--muted); font: 600 11px var(--body); }

/* Error detection, fragmentation */
table.hamming td.pbit { outline: 2.5px solid var(--series-2); outline-offset: -2px; }
.notes li.hot { color: var(--accent); font-weight: 700; }
svg.frag-svg { width: 100%; min-width: 520px; height: auto; display: block; }
.frag-title { fill: var(--muted); font: 600 11.5px var(--body); }
.frag-link { stroke: var(--muted); stroke-dasharray: 4 4; }
.frag-hdr rect { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.frag-hdr text { fill: var(--text); font: 700 11px var(--mono); }
.frag-piece rect { fill: color-mix(in srgb, var(--c) 30%, var(--surface)); stroke: var(--c); stroke-width: 1.5; }
.frag-piece.now rect { stroke-width: 3; }
.frag-piece text, .frag-mf { fill: var(--text); font: 600 11px var(--mono); }

/* MAC protocols */
svg.lanes, svg.bus, svg.bucket, svg.flow, svg.router, svg.blocks { width: 100%; height: auto; display: block; }
svg.lanes, svg.bus, svg.bucket { min-width: 480px; }
.lanes .slot-line { stroke: var(--line); stroke-width: 1.5; }
.lanes .grid { stroke: var(--line); stroke-dasharray: 2 4; }
.lanes .tick { fill: var(--muted); font: 500 10px var(--mono); }
.lanes .lane-name { fill: var(--text); font: 700 12px var(--mono); }
.lanes .now-band { fill: var(--accent-soft); opacity: 0.6; }
.lanes .now-line { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; }
.frame-bar rect { stroke-width: 1.5; }
.frame-bar.ok rect { fill: color-mix(in srgb, var(--series-3) 30%, var(--surface)); stroke: var(--series-3); }
.frame-bar.bad rect { fill: var(--bad-soft); stroke: var(--bad); }
.frame-bar rect.chan { opacity: 0.55; }
.bus-line { stroke: var(--text); stroke-width: 5; stroke-linecap: round; transition: stroke 0.3s; }
.bus-line.busy { stroke: var(--series-1); }
.bus-line.jam { stroke: var(--bad); }
.bus-st rect { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.bus-st.tx rect { fill: var(--accent-soft); stroke: var(--series-1); stroke-width: 3; }
.bus-st.coll rect { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 3; }
.bus-st .tap { stroke: var(--muted); stroke-width: 2; }
.bus-st .st-name { fill: var(--text); font: 700 15px var(--mono); }
.bus .st-state { fill: var(--muted); font: 600 10.5px var(--body); }
.burst circle { fill: var(--bad); }
.burst text { fill: #fff; font: 800 14px var(--body); }
.burst text.st-state { fill: var(--bad); }
table.slot-grid { border-collapse: collapse; font: 600 11.5px var(--mono); }
table.slot-grid th, table.slot-grid td { border: 1px solid var(--line); padding: 4px 5px; min-width: 30px; white-space: nowrap; }
table.slot-grid th.now { color: var(--accent); }
table.slot-grid td.now { outline: 2px solid var(--accent); outline-offset: -2px; }
table.slot-grid td.tx { background: color-mix(in srgb, var(--series-1) 25%, var(--surface)); }
table.slot-grid td.collide { background: var(--bad-soft); color: var(--bad); }
table.slot-grid td.wait { background: var(--warn-soft); }
table.slot-grid td.backoff { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, color-mix(in srgb, var(--series-7) 20%, var(--surface)) 4px, color-mix(in srgb, var(--series-7) 20%, var(--surface)) 8px); }
table.slot-grid td.done { color: var(--good); }
table.slot-grid td.gave-up { color: var(--bad); }
.ca-bar rect { stroke-width: 1.5; }
.ca-bar text { fill: var(--text); font: 700 10.5px var(--mono); }
.ca-bar.difs rect, .ca-key.difs i { fill: var(--surface-2); background: var(--surface-2); stroke: var(--muted); stroke-dasharray: 3 2; }
.ca-bar.backoff rect, .ca-key.backoff i { fill: color-mix(in srgb, var(--series-7) 22%, var(--surface)); background: color-mix(in srgb, var(--series-7) 22%, var(--surface)); stroke: var(--series-7); }
.ca-bar.rts rect, .ca-bar.cts rect, .ca-key.rts i { fill: color-mix(in srgb, var(--series-4) 30%, var(--surface)); background: color-mix(in srgb, var(--series-4) 30%, var(--surface)); stroke: var(--series-4); }
.ca-bar.data rect, .ca-key.data i { fill: color-mix(in srgb, var(--series-1) 28%, var(--surface)); background: color-mix(in srgb, var(--series-1) 28%, var(--surface)); stroke: var(--series-1); }
.ca-bar.ack rect, .ca-key.ack i { fill: color-mix(in srgb, var(--series-3) 30%, var(--surface)); background: color-mix(in srgb, var(--series-3) 30%, var(--surface)); stroke: var(--series-3); }
.ca-bar.nav rect, .ca-key.nav i { fill: var(--warn-soft); background: var(--warn-soft); stroke: var(--series-4); stroke-dasharray: 4 3; }
.ca-bar.collide rect, .ca-key.collide i { fill: var(--bad-soft); background: var(--bad-soft); stroke: var(--bad); }
.ca-bar .nav-label { font: 700 9px var(--mono); fill: var(--muted); }
.ca-key i { display: inline-block; width: 14px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1.5px solid var(--muted); }
.ca-key.data i { border-color: var(--series-1); }
.ca-key.collide i { border-color: var(--bad); }

/* Traffic shaping */
.bucket-wall { fill: none; stroke: var(--text); stroke-width: 4; stroke-linejoin: round; }
.bucket-label { fill: var(--muted); font: 600 11.5px var(--body); }
.bucket .wire { stroke: var(--line); stroke-width: 3; }
.bucket .hole { fill: var(--surface-2); }
.bucket .tap { fill: var(--muted); }
.in-bucket { fill: color-mix(in srgb, var(--series-1) 35%, var(--surface)); stroke: var(--series-1); stroke-width: 1.5; }
.bucket .token { fill: var(--series-4); stroke: var(--surface); stroke-width: 1.5; }
.bucket .queued { fill: var(--warn-soft); stroke: var(--series-4); stroke-width: 1.5; }
.mv.pkt rect { fill: var(--series-1); }
.mv.token circle { fill: var(--series-4); }
.mv.drop rect { fill: var(--bad); }
.mv.sent rect { fill: var(--series-3); }
.flow .in { fill: color-mix(in srgb, var(--muted) 45%, transparent); }
.flow .out { fill: var(--series-1); }
.flow .later { opacity: 0.12; }
.flow .now rect { stroke: var(--accent); stroke-width: 1.5; }
.flow .drop-mark { fill: var(--bad); font: 800 11px var(--body); }
.flow .tick, .flow text { fill: var(--muted); font: 500 10px var(--mono); }
.flow .grid { stroke: var(--line); }

/* DNS & HTTP */
h3.sub { font-size: 16px; margin: 16px 0 8px; }

/* CIDR */
.router .wire { stroke: var(--muted); stroke-width: 3; }
.router .iface line { stroke: var(--line); stroke-width: 3; }
.router .iface text { fill: var(--muted); font: 700 12px var(--mono); }
.router .iface.hit line { stroke: var(--series-4); }
.router .iface.win line { stroke: var(--good); stroke-width: 5; }
.router .iface.win text { fill: var(--good); }
.router-box { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; }
.router-label { fill: var(--accent); font: 800 16px var(--display); }
.blocks .tick { fill: var(--muted); font: 600 10.5px var(--body); }
.blk rect { stroke-width: 1.5; }
.blk.orig rect { fill: color-mix(in srgb, var(--series-1) 22%, var(--surface)); stroke: var(--series-1); }
.blk.sum rect { fill: color-mix(in srgb, var(--series-3) 25%, var(--surface)); stroke: var(--series-3); }
.blk.merged rect { fill: color-mix(in srgb, var(--series-4) 35%, var(--surface)); stroke: var(--series-4); stroke-width: 3; }
.blk text { fill: var(--text); font: 700 11px var(--mono); }
.blocks .supernet { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; }

/* Home art for the new CN tools */
.aloha-art path { fill: none; stroke-width: 3; }
.aloha-art .s { stroke: var(--series-1); }
.aloha-art .p { stroke: var(--series-2); }
.bucket-art { justify-content: center; gap: 12px; font: 700 14px var(--mono); color: var(--series-1); }
.bucket-art .b { width: 46px; height: 52px; border: 3px solid var(--text); border-top: 0; border-radius: 0 0 8px 8px; display: flex; flex-wrap: wrap-reverse; align-content: flex-start; gap: 3px; padding: 4px; }
.bucket-art .b i { width: 15px; height: 12px; border-radius: 2px; background: var(--series-1); }
@media (prefers-reduced-motion: reduce) { .bus-line { transition: none; } }
.mv.arrive, .mv.drip { animation: cn-fade 0.3s 0.75s forwards; }
@keyframes cn-fade { to { opacity: 0; } }

/* Practise on other platforms */
.elsewhere-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 10px 24px; }
.elsewhere-group h3 { font-size: 15px; margin: 8px 0 6px; }
.elsewhere-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.elsewhere-group li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 8px; border-radius: 8px; }
.elsewhere-group li:hover { background: var(--surface-2); }
.elsewhere-group a { display: inline; text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.elsewhere-group a:hover { text-decoration: underline; }
.elsewhere-group .ext-ico { color: var(--muted); font-size: 12px; }
.diff { flex: none; font: 600 11.5px var(--body); border-radius: 999px; padding: 1px 8px; background: var(--surface-2); color: var(--muted); }
.diff.easy { background: var(--good-soft); color: var(--good); }
.diff.medium { background: var(--warn-soft); color: color-mix(in srgb, var(--series-4) 70%, var(--text)); }
.diff.hard, .diff.expert, .diff.advanced { background: var(--bad-soft); color: var(--bad); }
/* F-SCAN queues */
.fq-wrap { margin-bottom: 8px; }
svg.fq-svg { display: block; width: 100%; max-width: 520px; height: auto; margin: 0 auto; }
.fq-svg .pf-label { fill: var(--muted); font: 600 12px var(--body); }
.fq-lane { fill: var(--surface); stroke: var(--line); }
.fq-lane.active { stroke: var(--series-1); }
.fq-tok rect { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.fq-tok text.fq-cyl { fill: var(--text); font: 700 14px var(--mono); }
.fq-tok text.fq-at { fill: var(--muted); font: 600 10px var(--mono); }
.fq-tok.active rect { fill: var(--series-1); stroke: var(--series-1); }
.fq-tok.active text { fill: #fff; }
.fq-tok.waiting rect { fill: var(--warn-soft); stroke: var(--series-4); stroke-width: 2; }
.fq-tok.later rect { stroke-dasharray: 4 3; }
.fq-tok.later text { fill: var(--muted); }
.fq-tok.served rect { fill: var(--good-soft); stroke: var(--good); }
.fq-tok.now rect { stroke: var(--accent); stroke-width: 3; }
/* NRU: R/M bits and the four classes */
table.frames.nru td small.rm { display: block; font: 600 10px var(--mono); color: var(--muted); letter-spacing: 1px; }
table.frames.nru th .tick { display: block; font-size: 11px; line-height: 1; }
.pf-svg .pf-bits { fill: var(--muted); font: 600 10.5px var(--mono); }
svg.nru-svg { max-width: 360px; margin-top: 6px; }
.nru-bucket { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.nru-bucket.lowest { stroke: var(--bad); stroke-width: 2.5; }
.pf-tok.small text { font-size: 13px; }
.pf-tok.evicted-pick rect { fill: var(--bad); }
/* ER to relational */
.er-wrap { margin-top: 12px; }
.er-svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.er-svg text { fill: var(--text); font: 600 12.5px var(--body); }
.er-attr text { font-size: 11.5px; font-weight: 500; }
.er-node rect, .er-node path, .er-node ellipse, .er-node circle { fill: var(--surface); stroke: var(--text); stroke-width: 1.6; transition: fill 0.3s, stroke 0.3s; }
.er-node .inner { fill: none; }
.er-rel path { stroke: var(--series-7); }
.er-attr ellipse { stroke: var(--muted); stroke-width: 1.3; }
.er-attr ellipse.derived { stroke-dasharray: 4 3; }
.er-isa text { font: 700 13px var(--mono); }
.er-svg .uline { stroke: var(--text); stroke-width: 1.2; }
.er-svg .uline.partial { stroke-dasharray: 3 2.5; }
.er-edge line { stroke: var(--muted); stroke-width: 1.4; transition: stroke 0.3s; }
.er-edge.hot line { stroke: var(--accent); stroke-width: 2; }
.er-card { font: 700 12px var(--mono) !important; fill: var(--series-7) !important; }
.er-role { font: italic 500 11px var(--body) !important; fill: var(--muted) !important; }
.er-subset { fill: none; stroke: var(--text); stroke-width: 1.5; }
.er-node.done rect, .er-node.done path, .er-node.done ellipse, .er-node.done circle { fill: var(--good-soft); stroke: var(--good); }
.er-node.done .inner { fill: none; }
.er-node.hot rect, .er-node.hot path, .er-node.hot ellipse, .er-node.hot circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.4; }
.er-node.hot .inner { fill: none; }
.er-node.hot text { fill: var(--accent); }
.er-stage { background: var(--surface-2); border-radius: 12px; padding: 10px; min-width: 0; }
.er-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.er-table { background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; transition: border-color 0.3s; }
.er-table.new { border-color: var(--good); animation: cnf-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.er-tname { font: 700 13.5px var(--mono); color: var(--accent); margin-bottom: 6px; overflow-wrap: anywhere; }
.er-cols { display: flex; flex-wrap: wrap; gap: 4px; }
.er-col { font: 500 12.5px var(--mono); padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); overflow-wrap: anywhere; max-width: 100%; }
.er-col.pk { text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.er-col.fk { font-style: italic; border-color: var(--series-7); }
.er-col.new { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.er-fks { list-style: none; margin: 6px 0 0; padding: 0; font: 500 11.5px var(--mono); color: var(--muted); }
.er-fks li { overflow-wrap: anywhere; }
.er-fks li::before { content: "FK "; color: var(--series-7); font-weight: 700; }
.er-art svg { width: 100%; height: 100%; }
.er-art rect, .er-art path, .er-art ellipse { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.er-art .in { fill: none; }
.er-art path.hot { fill: var(--accent-soft); stroke: var(--accent); }
.er-art line { stroke: var(--muted); stroke-width: 1.5; }
.er-art line.u { stroke: var(--text); stroke-width: 1; }
@media (prefers-reduced-motion: reduce) { .er-table.new { animation: none; } }

/* Ask about this step (AI tutor) */
.tutor-fab { position: fixed; right: 18px; bottom: 18px; z-index: 30; display: inline-flex; align-items: center; gap: 6px; padding: 11px 18px; border: 0; border-radius: 999px; background: var(--accent); color: var(--surface); font: 700 15px var(--body); cursor: pointer; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform 0.15s; }
.tutor-fab:hover { transform: translateY(-2px); }
.tutor-fab[aria-expanded="true"] { display: none; }
.tutor-panel { position: fixed; right: 18px; bottom: 18px; z-index: 31; width: min(400px, calc(100vw - 24px)); height: min(600px, calc(100vh - 100px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgb(0 0 0 / 0.22); overflow: hidden; animation: d-pop 0.2s ease-out; transform-origin: bottom right; }
.tutor-panel[hidden] { display: none; }
.tutor-panel header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 16px; font: 700 15px var(--display); }
.tutor-panel header .icon-btn { width: 32px; height: 32px; font-size: 20px; line-height: 1; }
.tutor-where { margin: 0 16px 6px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.tutor-log { flex: 1; overflow-y: auto; padding: 8px 14px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.tutor-msg { max-width: 90%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.tutor-msg p { margin: 0 0 6px; } .tutor-msg p:last-child { margin: 0; }
.tutor-msg ul, .tutor-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.tutor-msg code { font: 500 12.5px var(--mono); background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.tutor-msg.user { align-self: flex-end; background: var(--accent); color: var(--surface); border-bottom-right-radius: 4px; }
.tutor-msg.tutor { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.tutor-msg.thinking { color: var(--muted); animation: tutor-pulse 1.2s ease-in-out infinite; }
.tutor-msg.error { background: var(--bad-soft); color: var(--bad); }
@keyframes tutor-pulse { 50% { opacity: 0.45; } }
.tutor-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; }
.tutor-chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 11px; font: 500 12.5px var(--body); cursor: pointer; }
.tutor-chip:hover { border-color: var(--accent); color: var(--accent); }
.tutor-form { display: flex; gap: 8px; padding: 10px 14px 4px; align-items: flex-end; }
.tutor-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; font-size: 14px; }
.tutor-foot { margin: 0; padding: 2px 14px 10px; font-size: 11.5px; color: var(--muted); }
@media (max-width: 560px) { .tutor-panel { right: 8px; left: 8px; bottom: 8px; width: auto; height: min(560px, calc(100vh - 80px)); } .tutor-fab { right: 12px; bottom: 12px; } }
@media (prefers-reduced-motion: reduce) { .tutor-panel, .tutor-msg.thinking { animation: none; } }

/* 3D views */
.three-stage { position: relative; width: 100%; border-radius: 12px; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--accent) 10%, var(--surface-2)), var(--surface-2) 70%); cursor: grab; }
.three-stage.dragging { cursor: grabbing; }
.three-stage canvas { display: block; width: 100%; height: 100%; }
.three-hint { position: absolute; left: 10px; bottom: 8px; font-size: 11.5px; color: var(--muted); pointer-events: none; }
.view-toggle { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.view-toggle .btn { border: 0; border-radius: 0; padding: 6px 14px; }

/* ------------------------------------------------------------------------- */
/* Visual refresh: depth, glow and motion (overrides earlier rules)          */
/* ------------------------------------------------------------------------- */
:root { --shadow: 0 1px 2px rgb(20 20 40 / 0.05), 0 10px 30px -12px rgb(20 20 60 / 0.14); --shadow-lift: 0 2px 4px rgb(20 20 40 / 0.06), 0 22px 44px -16px color-mix(in srgb, var(--accent) 40%, transparent); --glow: color-mix(in srgb, var(--accent) 22%, transparent); }
:root[data-theme="dark"] { --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 32px -14px rgb(0 0 0 / 0.7); --shadow-lift: 0 2px 6px rgb(0 0 0 / 0.5), 0 24px 50px -18px color-mix(in srgb, var(--accent) 55%, transparent); }
body { background:
  radial-gradient(1100px 520px at 85% -120px, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
  radial-gradient(800px 420px at -10% 0, color-mix(in srgb, var(--series-5) 8%, transparent), transparent 70%),
  var(--bg); background-repeat: no-repeat; }

/* Cards and surfaces */
.card { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--line) 80%, transparent); }
.card h2 { letter-spacing: -0.02em; }

/* Home hero */
.hero-wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.hero-wrap .hero { max-width: none; }
.hero h1 { background: linear-gradient(100deg, var(--text) 10%, var(--accent) 55%, var(--series-5) 95%); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: 0.06em; }
.hero-3d { height: 440px; min-width: 0; border-radius: 24px; overflow: hidden; }
.hero-3d .three-stage { height: 100% !important; background: radial-gradient(ellipse at 50% 60%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); border-radius: 24px; }
.hero-facts { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-facts li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; color: var(--muted); box-shadow: var(--shadow); }
.hero-facts b { color: var(--text); }
@media (max-width: 860px) { .hero-wrap { grid-template-columns: 1fr; } .hero-3d { height: 280px; order: 2; } }
.tool-search { box-shadow: var(--shadow); transition: box-shadow 0.2s, border-color 0.2s; }
.tool-search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--glow), var(--shadow); outline: none; }

/* Tool cards */
.tool-card { position: relative; box-shadow: var(--shadow); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s, border-color 0.25s; }
.tool-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.tool-card .art { background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 9%, var(--surface-2)), var(--surface-2) 60%); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.tool-card:hover .art { transform: scale(1.03); }
.subject h2 { display: flex; align-items: center; gap: 10px; }
.subject h2::before { content: ""; width: 10px; height: 26px; border-radius: 4px; background: linear-gradient(var(--accent), var(--series-5)); }

/* Buttons and controls */
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--series-5))); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.ghost { box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.btn { transition: background 0.15s, transform 0.15s, box-shadow 0.2s, filter 0.15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.stepper { box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.04); }
.stepper .ctl { transition: transform 0.12s, background 0.15s, box-shadow 0.2s; }
.stepper .ctl:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.stepper .ctl.play { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--series-5))); box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--accent) 80%, transparent); }

/* Tabs: an underline that slides in */
.tabs button { position: relative; border-bottom: 0; transition: color 0.2s; }
.tabs button::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); transform: scaleX(0); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.tabs button[aria-selected="true"]::after { transform: scaleX(1); }
.tabs button:hover { color: var(--text); }

/* Step notes: an accent edge, and a small entrance each step */
.step-note { border-left: 4px solid var(--accent); box-shadow: var(--shadow); }
.step-note.good { border-left-color: var(--good); }
.step-note.bad { border-left-color: var(--bad); }
.step-note.note-in { animation: note-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes note-in { from { opacity: 0.25; transform: translateY(5px); } }

/* Code panel: the active line slides and glows */
.code-lines li { transition: background 0.25s, color 0.25s, box-shadow 0.25s; }
.code-lines li.on { box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--accent) 80%, transparent); }

/* Livelier glides: a slight overshoot so moves feel physical */
.glide { transition: transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1); }
.enter { animation: d-pop 0.45s cubic-bezier(0.34, 1.5, 0.64, 1) both; }

/* Page entrance */
#app > .tool, #app > .hero-wrap { animation: page-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

/* Header */
.top { box-shadow: 0 1px 0 var(--line), 0 8px 24px -20px rgb(0 0 0 / 0.25); border-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .tool-card, .tool-card .art, .btn, .stepper .ctl, .tabs button::after { transition: none; }
  .step-note.note-in, #app > .tool, #app > .hero-wrap, .enter { animation: none; }
  .glide { transition: none; }
}
.subject h2 { display: block; }
.subject h2::before { display: inline-block; vertical-align: -4px; margin-right: 10px; }
@media (max-width: 480px) {
  .nav { gap: 0; }
  .menu summary { padding: 7px 7px; font-size: 13.5px; }
  .menu summary::after { font-size: 10px; }
}
/* 3D: graphs */
.g-view-bar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.g-stage3d { min-width: 0; }
.g-stage3d .three-stage { height: 400px !important; border: 1px solid var(--line); }
.g-stage3d .three-hint { background: color-mix(in srgb, var(--surface) 75%, transparent); padding: 2px 8px; border-radius: 999px; }
@media (max-width: 600px) { .g-stage3d .three-stage { height: 300px !important; } }
/* 3D: networks */
.net3d-stage { min-width: 0; }
.net3d-wrap { position: relative; min-width: 0; max-width: 100%; }
.net3d-wrap[hidden] { display: none; }
.net3d-box { min-height: 300px; display: grid; }
.net3d-box > .three-stage { min-width: 0; }
.net3d-loading { place-self: center; margin: 0; }
.net3d-wrap .three-hint { left: 12px; bottom: 8px; margin: 0; background: color-mix(in srgb, var(--surface) 75%, transparent); padding: 2px 8px; border-radius: 6px; }
@media (min-width: 561px) { .net3d-box { min-height: 400px; } }
@media (hover: none) { .net3d-wrap .three-hint { display: none; } }
/* 3D: disk and memory */
.d3-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.d3-head h2 { margin-right: auto; }
.d3-host { margin: 6px 0 10px; min-width: 0; }
.d3-host[hidden] { display: none; }
.d3-hud { position: absolute; top: 8px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; font: 500 12.5px var(--body); }
.d3-hud span { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; color: var(--muted); }
.d3-hud b { color: var(--text); font-family: var(--mono); }
.d3-legend { position: absolute; top: 8px; right: 10px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; max-width: 60%; pointer-events: none; font-size: 11.5px; color: var(--muted); }
.d3-legend .k { display: inline-flex; align-items: center; gap: 5px; }
.d3-legend .k::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--c, var(--accent)); }
.d3-legend .k.pending::before { --c: var(--series-2); border-radius: 50%; }
.d3-legend .k.served::before { --c: var(--good); border-radius: 50%; opacity: 0.6; }
.d3-legend .k.path::before { --c: var(--accent); height: 3px; border-radius: 2px; }
@media (max-width: 600px) { .d3-hud { font-size: 11.5px; } .d3-legend { top: auto; bottom: 8px; right: 8px; max-width: 70%; } }

/* 2D | 3D | Both: side by side when there's room, stacked when not */
.view-pair.both, .net3d-stage.both { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); gap: 12px; align-items: start; }
.view-pair.both > *, .net3d-stage.both > * { min-width: 0; margin: 0; }

/* 3D: OS */
.sync3d-run { margin: 6px 0 0; gap: 6px; }
.sync3d-run[hidden] { display: none; }
.view-pair .d3-host { margin-top: 6px; }
.d3-legend .k.think::before { --c: var(--muted); border-radius: 50%; }
.d3-legend .k.hungry::before { --c: var(--series-4); background: transparent; border: 2px solid var(--c); border-radius: 50%; width: 7px; height: 7px; }
.d3-legend .k.eat::before { --c: var(--good); border-radius: 50%; box-shadow: 0 0 6px var(--good); }
.d3-legend .k.cycle::before { --c: var(--bad); height: 3px; border-radius: 2px; }
.d3-legend .k.item::before { --c: var(--series-1); }
.d3-legend .k.height::before { --c: var(--muted); width: 5px; height: 11px; border-radius: 1px; }
.d3-hud span, .d3-legend { max-width: 100%; }
@media (max-width: 600px) { .sync3d-legend, .d3-legend:has(.k.height) { font-size: 10.5px; gap: 2px 8px; } }
.d3-host > .d3-legend { position: static; justify-content: flex-start; max-width: none; margin: 6px 2px 0; }
.d3-legend .k.fork::before { --c: var(--accent); width: 12px; height: 3px; border-radius: 2px; }
/* 3D: TOC and CN */
.d3-legend .k.toc-head::before { --c: var(--accent); border-radius: 50%; }
.d3-legend .k.toc-good::before { --c: var(--good); }
.d3-legend .k.toc-bad::before { --c: var(--bad); }
.d3-legend .k.toc-push::before { --c: var(--series-1); }
.d3-legend .k.toc-ghost::before { --c: var(--muted); opacity: 0.45; }
.d3-legend .k.toc-slot::before { --c: var(--series-4); }
.d3-hud .toc-verdict.accept { border-color: var(--good); }
.d3-hud .toc-verdict.accept b { color: var(--good); }
.d3-hud .toc-verdict.reject, .d3-hud .toc-verdict.limit { border-color: var(--bad); }
.d3-hud .toc-verdict.reject b, .d3-hud .toc-verdict.limit b { color: var(--bad); }
.view-pair > .tape-wrap { min-width: 0; }
.view-pair.both > .pda-stage { grid-template-columns: minmax(0, 1fr); }
.three-stage.toc3d { container-type: inline-size; }
@container (max-width: 560px) {
  .toc3d .d3-legend { top: auto; bottom: 8px; right: 8px; max-width: 64%; }
  .toc3d .d3-hud { font-size: 11.5px; right: 10px; }
}
@container (max-width: 420px) { .toc3d .three-hint { display: none; } }
/* 3D: DSA and DBMS */
.fw-head { align-items: center; }
.fw-head .view-toggle { margin-left: auto; }
.fw-flat { min-width: 0; }
.fw-flat[hidden] { display: none; }
.view-pair > [hidden] { display: none; }
.d3-legend .k.inf::before { background: color-mix(in srgb, var(--muted) 45%, var(--surface)); border: 1px solid var(--line); }
@media (max-width: 600px) { .fw-head .view-toggle { margin-left: 0; } }
.d3-legend.low { top: auto; bottom: 8px; right: 10px; max-width: 64%; }
.d3-dsa .three-hint { background: color-mix(in srgb, var(--surface) 75%, transparent); padding: 2px 8px; border-radius: 999px; }
@media (hover: none) { .d3-dsa .three-hint { display: none; } }
@media (max-width: 600px) { .d3-legend.low { max-width: calc(100% - 20px); left: 10px; right: 10px; justify-content: flex-start; } .d3-dsa .three-hint { display: none; } }
