/* =========================================================
   sketch.css: Excalidraw-style design system for the site.
   Hand-drawn borders, hachure diagrams, and a CALM palette:
   warm paper instead of pure white, soft charcoal instead of
   pure black, muted accents. Easy on the eyes for long study.
   ========================================================= */

:root {
  --bg: #f6f3ec;        /* warm paper, not glaring white */
  --paper: #fbfaf6;
  --ink: #2f3133;       /* soft charcoal, not pure black */
  --muted: #6a6c70;
  --grid: #e4dfd3;
  --code-bg: #f3f0e8;

  /* calm palette: stroke / fill (muted, low-saturation) */
  --blue: #3e6d9c;   --blue-f: #d7e4f0;
  --green: #4b8160;  --green-f: #d9eadc;
  --yellow: #a8702e; --yellow-f: #f3e6c4;
  --red: #b0544c;    --red-f: #f2dbd6;
  --violet: #6b5b9e; --violet-f: #e3ddf0;
  --gray: #5b5f64;   --gray-f: #ebe7de;

  --hand: "Kalam", "Comic Sans MS", "Segoe Print", cursive;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;

  --wobble: 255px 15px 225px 15px / 15px 225px 15px 255px;   /* small things */
  --wobble-lg: 3% 6% 4% 5% / 6% 3% 7% 4%;                     /* big cards */
}

/* dark: soft graphite (not black), warm off-white text (not pure white), dimmed accents */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f2124; --paper: #25282b; --ink: #d9d5cc; --muted: #9b978f;
    --grid: #2b2e31; --code-bg: #282b2f;
    --blue: #8eb1d4;   --blue-f: #2c3a48;
    --green: #9cc3a5;  --green-f: #2c3b31;
    --yellow: #d4b07c; --yellow-f: #3d3526;
    --red: #d69b93;    --red-f: #43312e;
    --violet: #b2a7d6; --violet-f: #343047;
    --gray: #b3afa6;   --gray-f: #2f3235;
  }
}
:root[data-theme="dark"] {
  --bg: #1f2124; --paper: #25282b; --ink: #d9d5cc; --muted: #9b978f;
  --grid: #2b2e31; --code-bg: #282b2f;
  --blue: #8eb1d4;   --blue-f: #2c3a48;
  --green: #9cc3a5;  --green-f: #2c3b31;
  --yellow: #d4b07c; --yellow-f: #3d3526;
  --red: #d69b93;    --red-f: #43312e;
  --violet: #b2a7d6; --violet-f: #343047;
  --gray: #b3afa6;   --gray-f: #2f3235;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
}

h1, h2, h3, h4, .hand { font-family: var(--hand); font-weight: 700; line-height: 1.25; }
h1 { font-size: 2.6rem; margin: .2em 0 .3em; }
h2 { font-size: 1.9rem; margin: 2.2em 0 .6em; }
h3 { font-size: 1.4rem; margin: 1.6em 0 .4em; }
h4 { font-size: 1.15rem; margin: 1.2em 0 .3em; }
a { color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 3px; }
p { margin: .7em 0; }
ul, ol { padding-left: 1.4em; }
li { margin: .25em 0; }
hr { border: none; height: 2px; background: var(--ink); opacity: .25; border-radius: var(--wobble); margin: 2.5em 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
  padding: 9px 16px;
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
}
.topbar .brand { font-family: var(--hand); font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.topbar .crumbs { font-family: var(--hand); color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumbs a { color: var(--muted); text-decoration: none; }
.topbar .crumbs a:hover { color: var(--ink); }

/* ---------- buttons / tags ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--hand); font-size: 1rem; font-weight: 700;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: var(--wobble);
  padding: 4px 14px; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .15s;
}
.btn:hover { background: var(--yellow-f); transform: rotate(-1deg); }
.btn.primary { background: var(--blue-f); }
.btn.done { background: var(--green-f); }

.tag {
  display: inline-block; font-family: var(--hand); font-size: .85rem; font-weight: 700;
  padding: 0 10px; border: 2px solid var(--ink); border-radius: var(--wobble);
  background: var(--gray-f); line-height: 1.6; white-space: nowrap;
}
.tag.easy   { background: var(--green-f); }
.tag.medium { background: var(--yellow-f); }
.tag.hard   { background: var(--red-f); }
.tag.boss   { background: var(--violet-f); }
.tag.soon   { background: transparent; border-style: dashed; color: var(--muted); border-color: var(--muted); }

/* ---------- layout ---------- */
.wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 80px; }
/* lesson layout: the reading column is ALWAYS centred; the contents panel floats on the left */
.lesson-layout { padding: 28px 16px 96px; }
.lesson-layout > main { max-width: 800px; margin: 0 auto; }
.toc {
  position: fixed; top: 74px; left: 14px; z-index: 18; width: 214px;
  max-height: calc(100vh - 96px); overflow: auto; overscroll-behavior: contain;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 12px 16px 12px 14px / 14px 12px 16px 12px;
  padding: 8px 8px 10px; font-family: var(--hand); font-size: .86rem; line-height: 1.3;
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--ink) 12%, transparent);
  transition: transform .28s cubic-bezier(.3,.7,.2,1), opacity .2s;
  scrollbar-width: thin;
}
body.toc-hidden .toc { transform: translateX(calc(-100% - 30px)); opacity: 0; pointer-events: none; }
body.toc-overlay .toc { box-shadow: 8px 8px 0 color-mix(in srgb, var(--ink) 22%, transparent); }
.toc-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px; border-bottom: 1.5px dashed color-mix(in srgb, var(--ink) 30%, transparent); margin-bottom: 4px; }
.toc-head .hand { font-weight: 700; font-size: .95rem; }
.toc-close { font-family: var(--hand); font-size: 1rem; border: none; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; }
.toc-close:hover { color: var(--ink); }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a { display: flex; gap: 6px; align-items: baseline; padding: 3px 6px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); background: var(--gray-f); }
.toc a.active { color: var(--ink); background: var(--yellow-f); font-weight: 700; }
.toc a.passed .toc-n { background: var(--green-f); border-color: var(--green); }
.toc .toc-n { flex: none; min-width: 20px; height: 20px; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid color-mix(in srgb, var(--ink) 40%, transparent); border-radius: 50%; }
.toc .toc-t { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toc-toggle { padding: 2px 10px; font-size: 1.05rem; }
.toc-toggle.on { background: var(--yellow-f); }

/* ---------- sketchy card ---------- */
.card {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--wobble-lg);
  padding: 18px 22px;
  margin: 18px 0;
}
.card.tilt-l { transform: rotate(-.4deg); }
.card.tilt-r { transform: rotate(.4deg); }

/* hero */
.hero { padding: 26px 26px 18px; background: var(--paper); }
.hero .kicker { font-family: var(--hand); color: var(--muted); font-size: 1.1rem; }
.hero .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* highlighter marker */
.hl { background: linear-gradient(104deg, transparent .5%, var(--yellow-f) 2%, var(--yellow-f) 97%, transparent 99%); padding: 0 .15em; }
.hl-blue { background: linear-gradient(104deg, transparent .5%, var(--blue-f) 2%, var(--blue-f) 97%, transparent 99%); padding: 0 .15em; }
.underline-sketch { text-decoration: underline wavy var(--red); text-underline-offset: 5px; }

/* ---------- callouts ---------- */
.callout { position: relative; border: 2px solid var(--ink); border-radius: var(--wobble-lg); padding: 22px 20px 12px; margin: 28px 0 22px; background: var(--paper); }
.callout::before {
  content: attr(data-label);
  position: absolute; top: -15px; left: 16px;
  font-family: var(--hand); font-weight: 700; font-size: .95rem;
  padding: 0 10px; border: 2px solid var(--ink); border-radius: var(--wobble);
  background: var(--gray-f); transform: rotate(-2deg);
}
.callout.note { background: color-mix(in srgb, var(--blue-f) 30%, var(--paper)); }
.callout.note::before { background: var(--blue-f); }
.callout.tip { background: color-mix(in srgb, var(--green-f) 30%, var(--paper)); }
.callout.tip::before { background: var(--green-f); }
.callout.warn { background: color-mix(in srgb, var(--red-f) 30%, var(--paper)); }
.callout.warn::before { background: var(--red-f); }
.callout.hft { background: color-mix(in srgb, var(--violet-f) 30%, var(--paper)); }
.callout.hft::before { background: var(--violet-f); }
.callout > :first-child { margin-top: 0; }

/* ---------- code ---------- */
code { font-family: var(--mono); font-size: .88em; }
:not(pre) > code { background: var(--gray-f); padding: 1px 6px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); }
.code-wrap { position: relative; margin: 18px 0; }
.code-wrap .code-title {
  display: inline-block; font-family: var(--mono); font-size: .8rem; font-weight: 600;
  padding: 3px 14px; margin-left: 16px; margin-bottom: -2px;
  border: 2px solid var(--ink); border-bottom: none; border-radius: 10px 14px 0 0;
  background: var(--yellow-f); position: relative; z-index: 2;
}
.code-body {
  position: relative; display: flex; background: var(--code-bg);
  border: 2px solid var(--ink); border-radius: 6px 14px 8px 12px / 12px 6px 14px 8px;
  box-shadow: 4px 4px 0 color-mix(in srgb, var(--ink) 10%, transparent);
  transition: box-shadow .2s, border-color .2s;
}
.code-body .gutter {
  flex: none; padding: 16px 10px 16px 12px; text-align: right; white-space: pre; user-select: none;
  font-family: var(--mono); font-size: .9rem; line-height: 1.6; color: color-mix(in srgb, var(--muted) 70%, transparent);
  border-right: 1.5px dashed color-mix(in srgb, var(--ink) 22%, transparent); position: relative; z-index: 1;
}
pre.code-block {
  flex: 1; min-width: 0; margin: 0; padding: 16px 18px; overflow-x: auto;
  background: transparent; border: none; position: relative; z-index: 1;
  font-size: .9rem; line-height: 1.6; tab-size: 4;
}
pre.code-block code { background: none; border: none; padding: 0; font-size: inherit; }
.line-band { position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none; }
.line-band.hl { background: color-mix(in srgb, var(--yellow-f) 55%, transparent); box-shadow: inset 4px 0 0 var(--yellow); }
.line-band.error { background: color-mix(in srgb, var(--red-f) 55%, transparent); box-shadow: inset 4px 0 0 var(--red); }
.line-band.warning { background: color-mix(in srgb, var(--yellow-f) 40%, transparent); box-shadow: inset 4px 0 0 var(--yellow); }
.line-band.flash { animation: bandflash 1.2s ease; }
@keyframes bandflash { 0%, 40% { background: var(--blue-f); } }
.lang-badge {
  position: absolute; top: 8px; right: 62px; z-index: 2; font-family: var(--hand); font-size: .75rem; font-weight: 700;
  color: var(--muted); padding: 0 8px; border: 1.5px solid color-mix(in srgb, var(--ink) 30%, transparent); border-radius: var(--wobble);
  background: var(--paper); pointer-events: none;
}
.copy-btn {
  position: absolute; top: 7px; right: 8px; z-index: 3; font-family: var(--hand); font-weight: 700; font-size: .78rem;
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--wobble); padding: 0 8px; cursor: pointer;
  opacity: .55; transition: opacity .15s, background .15s;
}
.code-wrap:hover .copy-btn, .copy-btn:focus { opacity: 1; }
.copy-btn:hover { background: var(--yellow-f); }

figure.diagram { position: relative; }

/* Prism tokens — sketch palette */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--muted); font-style: italic; }
.token.keyword, .token.boolean { color: var(--violet); font-weight: 600; }
.token.string, .token.char, .token.attr-value { color: var(--green); }
.token.number { color: var(--yellow); }
.token.function, .token.class-name { color: var(--blue); }
.token.macro, .token.directive, .token.property { color: var(--red); }
.token.operator, .token.punctuation { color: var(--ink); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table.sk {
  border-collapse: separate; border-spacing: 0; width: 100%;
  border: 2px solid var(--ink); border-radius: 10px 4px 12px 6px; overflow: hidden;
  background: var(--paper); font-size: .95rem;
}
table.sk th { font-family: var(--hand); text-align: left; background: var(--blue-f); }
table.sk th, table.sk td { padding: 8px 12px; border-bottom: 1.5px solid color-mix(in srgb, var(--ink) 25%, transparent); vertical-align: top; }
table.sk tr:last-child td { border-bottom: none; }

/* ---------- diagrams ---------- */
figure.diagram { margin: 22px 0; text-align: center; }
figure.diagram svg { width: 100%; height: auto; max-width: 100%; overflow: visible; }
figure.diagram figcaption { font-family: var(--hand); color: var(--muted); font-size: 1rem; margin-top: 4px; }
figure.diagram script { display: none; }

/* ---------- Q&A ---------- */
details.qa {
  border: 2px solid var(--ink); border-radius: var(--wobble-lg);
  background: var(--paper); margin: 12px 0; padding: 0;
}
details.qa summary {
  cursor: pointer; list-style: none; padding: 12px 18px 12px 48px; position: relative;
  font-family: var(--hand); font-size: 1.15rem; font-weight: 700;
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::before {
  content: "Q"; position: absolute; left: 12px; top: 11px;
  width: 26px; height: 26px; line-height: 23px; text-align: center; font-size: .95rem;
  border: 2px solid var(--ink); border-radius: 50% 45% 55% 50%; background: var(--yellow-f);
}
details.qa[open] summary { border-bottom: 2px dashed color-mix(in srgb, var(--ink) 35%, transparent); }
details.qa[open] summary::before { content: "A"; background: var(--green-f); }
details.qa .answer { padding: 6px 20px 12px; }

/* ---------- quiz ---------- */
.quiz { border: 2px solid var(--ink); border-radius: var(--wobble-lg); padding: 16px 20px; margin: 16px 0; background: var(--paper); }
.quiz .q { font-family: var(--hand); font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.quiz .opts { display: grid; gap: 8px; }
.quiz .opts button {
  text-align: left; font-family: var(--body); font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--wobble);
  padding: 6px 14px; cursor: pointer;
}
.quiz .opts button:hover:not(:disabled) { background: var(--gray-f); }
.quiz .opts button.right { background: var(--green-f); }
.quiz .opts button.wrong { background: var(--red-f); text-decoration: line-through; }
.quiz .opts button:disabled { cursor: default; }
.quiz .explain { display: none; margin-top: 10px; padding: 8px 14px; border-left: 4px solid var(--green); background: color-mix(in srgb, var(--green-f) 30%, transparent); }
.quiz.answered .explain { display: block; }
.quiz-score { font-family: var(--hand); font-size: 1.2rem; }

/* ---------- exercises ---------- */
.exercise { border: 2px solid var(--ink); border-radius: var(--wobble-lg); padding: 16px 22px 14px; margin: 22px 0; background: var(--paper); }
.exercise .ex-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.exercise .ex-head h3 { margin: 0; flex: 1; min-width: 200px; }
.exercise details { margin: 10px 0; border: 2px dashed color-mix(in srgb, var(--ink) 50%, transparent); border-radius: 10px; padding: 4px 14px; }
.exercise details summary { cursor: pointer; font-family: var(--hand); font-weight: 700; font-size: 1.05rem; }
.exercise details.hint summary { color: var(--blue); }
.exercise details.solution summary { color: var(--green); }
.exercise .solved { display: inline-flex; align-items: center; gap: 6px; font-family: var(--hand); cursor: pointer; user-select: none; }
.exercise .solved input { width: 18px; height: 18px; accent-color: var(--green); }
.exercise.is-solved { border-color: var(--green); }

/* ---------- roadmap ---------- */
.phase { margin: 34px 0; }
.phase-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.phase-head h2 { margin: 0; }
.phase-head .phase-n { font-family: var(--hand); font-size: 1rem; padding: 0 10px; border: 2px solid var(--ink); border-radius: var(--wobble); }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 14px; }
.lesson-card {
  display: block; position: relative; color: var(--ink); text-decoration: none;
  border: 2px solid var(--ink); border-radius: var(--wobble-lg); padding: 14px 16px 12px;
  background: var(--paper); transition: transform .1s ease, background .15s;
}
a.lesson-card:hover { transform: rotate(-.8deg) translateY(-2px); background: color-mix(in srgb, var(--yellow-f) 45%, var(--paper)); }
.lesson-card .num { font-family: var(--hand); font-weight: 700; font-size: 1.8rem; line-height: 1; color: var(--muted); }
.lesson-card .title { font-family: var(--hand); font-weight: 700; font-size: 1.2rem; line-height: 1.25; margin: 6px 0 4px; }
.lesson-card .sum { font-size: .9rem; color: var(--muted); line-height: 1.5; }
.lesson-card .status { position: absolute; top: 12px; right: 12px; }
.lesson-card.locked { border-style: dashed; border-color: var(--muted); background: transparent; }
.lesson-card.completed { background: color-mix(in srgb, var(--green-f) 45%, var(--paper)); }

.progress { height: 18px; border: 2px solid var(--ink); border-radius: var(--wobble); overflow: hidden; background: var(--paper); }
.progress > span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--green) 0 3px, var(--green-f) 3px 9px); transition: width .4s; }

/* ---------- hub ---------- */
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

/* ---------- lesson footer ---------- */
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 40px; }
.complete-box { text-align: center; padding: 22px; }

/* misc */
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
kbd { font-family: var(--mono); font-size: .8em; border: 2px solid var(--ink); border-radius: 5px; padding: 0 5px; background: var(--paper); }
.theme-toggle { font-size: .9rem; }

/* =========================================================
   BEGINNER-FRIENDLY READING LAYER
   ========================================================= */
main { font-size: 18px; line-height: 1.8; }
main p, main li { max-width: 72ch; }
main h2 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2.6em; }
main h2 .num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; font-size: 1.3rem; border: 2.5px solid var(--ink);
  border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%; background: var(--yellow-f);
}
main h2 .time { font-family: var(--hand); font-size: .9rem; font-weight: 400; color: var(--muted); border: 1.5px dashed var(--muted); border-radius: var(--wobble); padding: 0 10px; }
main h3 { margin-top: 1.8em; }

/* one-sentence summary: a sticky note */
.tldr {
  position: relative; max-width: 640px; margin: 14px 0 22px; padding: 14px 20px 12px 20px;
  background: var(--yellow-f); color: var(--ink); border: 2px solid var(--ink);
  border-radius: 2px 6px 3px 8px / 6px 2px 8px 3px; transform: rotate(-.6deg);
  box-shadow: 4px 5px 0 color-mix(in srgb, var(--ink) 18%, transparent); font-size: 1.05rem;
}
.tldr::before { content: "in one sentence"; display: block; font-family: var(--hand); font-weight: 700; font-size: .9rem; color: var(--muted); margin-bottom: 2px; }
.tldr p { margin: 0; }

/* callout variants for teaching */
.callout.analogy { background: color-mix(in srgb, var(--yellow-f) 28%, var(--paper)); }
.callout.analogy::before { background: var(--yellow-f); }
.callout.mistake { background: color-mix(in srgb, var(--red-f) 25%, var(--paper)); }
.callout.mistake::before { background: var(--red-f); }
.callout.key { background: color-mix(in srgb, var(--blue-f) 30%, var(--paper)); border-width: 2.5px; }
.callout.key::before { background: var(--blue-f); }
.callout.try { background: color-mix(in srgb, var(--green-f) 28%, var(--paper)); }
.callout.try::before { background: var(--green-f); }
.callout ul, .callout ol { margin: .3em 0; }

/* optional depth, folded away */
details.deeper {
  margin: 18px 0; border: 2px dashed var(--violet); border-radius: var(--wobble-lg);
  background: color-mix(in srgb, var(--violet-f) 12%, var(--paper));
}
details.deeper > summary {
  cursor: pointer; list-style: none; padding: 10px 18px; font-family: var(--hand); font-weight: 700; font-size: 1.08rem; color: var(--violet);
}
details.deeper > summary::-webkit-details-marker { display: none; }
details.deeper > summary::before { content: "＋ "; }
details.deeper[open] > summary::before { content: "－ "; }
details.deeper > summary .muted { font-weight: 400; font-size: .9rem; }
details.deeper > .body { padding: 0 20px 12px; }

/* glossary terms */
dfn[data-def] {
  font-style: normal; font-weight: 700; cursor: help; position: relative;
  text-decoration: underline dotted var(--blue); text-decoration-thickness: 2px; text-underline-offset: 4px;
}
dfn[data-def]:hover::after, dfn[data-def]:focus::after {
  content: attr(data-def); position: absolute; left: 0; top: calc(100% + 6px); z-index: 30;
  width: max-content; max-width: min(340px, 80vw); white-space: normal;
  font-family: var(--body); font-weight: 400; font-size: .9rem; line-height: 1.5; color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 8px 12px;
  box-shadow: 3px 3px 0 var(--blue-f);
}
dfn[data-def]:focus { outline: none; background: var(--blue-f); }
.glossary-list { display: grid; gap: 8px; }
.glossary-list > div { border-bottom: 1.5px dashed color-mix(in srgb, var(--ink) 25%, transparent); padding: 4px 0; }
.glossary-list b { font-family: var(--hand); font-size: 1.05rem; }

/* annotated code: code on the left, plain words on the right */
.anno { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border: 2px solid var(--ink); border-radius: 10px 14px 10px 12px; overflow: hidden; margin: 16px 0; background: var(--paper); }
.anno > div { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 1.3fr); border-bottom: 1.5px dashed color-mix(in srgb, var(--ink) 25%, transparent); }
.anno > div:last-child { border-bottom: none; }
.anno code { display: block; background: var(--code-bg); border: none; border-radius: 0; padding: 10px 14px; white-space: pre; overflow-x: auto; font-size: .88rem; }
.anno span { padding: 10px 14px; font-size: .97rem; line-height: 1.55; }
@media (max-width: 640px) { .anno > div { grid-template-columns: 1fr; } }

/* a command broken into labelled parts */
.cmd-parts { display: flex; flex-wrap: wrap; gap: 10px 6px; margin: 16px 0; align-items: flex-start; }
.cmd-parts > div { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 170px; }
.cmd-parts code { font-size: .95rem; padding: 4px 10px; border: 2px solid var(--ink); border-radius: 8px; background: var(--code-bg); white-space: nowrap; }
.cmd-parts > div:nth-child(5n+1) code { background: var(--blue-f); }
.cmd-parts > div:nth-child(5n+2) code { background: var(--yellow-f); }
.cmd-parts > div:nth-child(5n+3) code { background: var(--green-f); }
.cmd-parts > div:nth-child(5n+4) code { background: var(--violet-f); }
.cmd-parts > div:nth-child(5n) code { background: var(--red-f); }
.cmd-parts small { font-family: var(--hand); font-size: .85rem; color: var(--muted); line-height: 1.3; margin-top: 4px; }
.cmd-parts small::before { content: "↑ "; }

/* lesson intro helpers */
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .92rem; }
.legend .sw { display: inline-block; font-family: var(--hand); font-weight: 700; font-size: .85rem; padding: 0 10px; border: 2px solid var(--ink); border-radius: var(--wobble); }
.checklist { list-style: none; padding-left: 0; }
.checklist li { padding-left: 30px; position: relative; }
.checklist li::before { content: "☐"; position: absolute; left: 2px; top: -1px; font-size: 1.15rem; color: var(--green); }

/* progressive hints */
.hints { margin: 10px 0; }
.hints .hint { display: none; margin: 6px 0; padding: 6px 14px; border-left: 4px solid var(--blue); background: color-mix(in srgb, var(--blue-f) 22%, transparent); border-radius: 0 8px 8px 0; }
.hints .hint.shown { display: block; animation: pop .18s ease; }
.hints .hint::before { content: attr(data-n); font-family: var(--hand); font-weight: 700; color: var(--blue); margin-right: 8px; }
.steps-list { counter-reset: s; list-style: none; padding-left: 0; }
.steps-list > li { counter-increment: s; position: relative; padding-left: 40px; margin: 10px 0; }
.steps-list > li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; text-align: center; line-height: 25px;
  font-family: var(--hand); font-weight: 700; border: 2px solid var(--ink); border-radius: 50%; background: var(--green-f);
}

/* Q&A short answer */
details.qa .answer .short { font-size: 1.02rem; padding: 6px 12px; border-left: 4px solid var(--green); background: color-mix(in srgb, var(--green-f) 25%, transparent); border-radius: 0 8px 8px 0; }


/* =========================================================
   INTERACTIVE LAYER — runner, generic widgets, custom widgets
   ========================================================= */

/* form controls, sketch style */
input[type="text"], input:not([type]), select, textarea {
  font-family: var(--mono); font-size: .9rem; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 8px 12px 9px 11px / 11px 8px 12px 9px; padding: 4px 10px;
}
input:focus, select:focus, textarea:focus, .bit:focus, .stepper:focus-visible { outline: 3px solid var(--yellow-f); outline-offset: 1px; }
input[type="range"] { accent-color: var(--blue); vertical-align: middle; width: min(320px, 70vw); }
fieldset { border: 2px dashed color-mix(in srgb, var(--ink) 45%, transparent); border-radius: 12px; padding: 6px 12px 10px; margin: 0; }
legend { padding: 0 6px; }
.chip {
  font-family: var(--hand); font-weight: 700; font-size: .9rem; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: var(--wobble); padding: 0 10px; cursor: pointer; line-height: 1.7;
}
.chip:hover { background: var(--gray-f); }
.chip.on { background: var(--yellow-f); }
.chip.seen { background: color-mix(in srgb, var(--green-f) 50%, var(--paper)); }
.chip.right { background: var(--green-f); }
.chip.wrong { background: var(--red-f); text-decoration: line-through; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.ok { color: var(--green); } .bad { color: var(--red); } .warn { color: var(--yellow); }

/* ---------- live code runner ---------- */
.editor { position: relative; flex: 1; min-width: 0; z-index: 1; }
.editor pre.editor-pre { overflow: hidden; white-space: pre; margin: 0; }
.editor-ta {
  position: absolute; inset: 0; width: 100%; resize: none; overflow-x: auto; overflow-y: hidden;
  margin: 0; padding: 16px 18px; border: 0; border-radius: 0;
  background: transparent; color: transparent; caret-color: var(--ink);
  font-family: var(--mono); font-size: .9rem; line-height: 1.6; tab-size: 4; white-space: pre; overflow-wrap: normal;
}
.editor-ta::selection { background: color-mix(in srgb, var(--blue-f) 70%, transparent); color: transparent; }
.editor-ta:focus { outline: none; }
.code-body:has(.editor) { cursor: text; }
.code-body:focus-within { border-color: var(--blue); box-shadow: 5px 5px 0 var(--blue-f); }
.code-wrap[data-run] .code-title::before, .runner .code-title::before { content: "✎ "; color: var(--blue); }
.code-wrap.edited .code-title::after { content: " · edited"; color: var(--red); }
.runner-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.runner-bar .r-flags { flex: 1; min-width: 180px; }
.runner-bar .r-right { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.runner-bar .r-modes { display: inline-flex; }
.runner-bar .r-modes .chip:first-child { border-radius: 10px 0 0 10px; }
.runner-bar .r-modes .chip:last-child { border-radius: 0 10px 10px 0; border-left: none; }
.r-flags.flash-hl { background: var(--yellow-f); transition: background .3s; }
.r-stdin { margin-top: 6px; font-family: var(--hand); }
.r-stdin summary { cursor: pointer; color: var(--muted); }
.r-stdin textarea { width: 100%; margin-top: 4px; }
.runner-out { margin-top: 8px; border: 2px solid var(--ink); border-radius: var(--wobble-lg); padding: 8px 14px 10px; background: var(--paper); }
.runner-out.good { border-color: var(--green); }
.runner-out.warn { border-color: var(--yellow); }
.runner-out.bad { border-color: var(--red); }
.runner-out.busy .r-status::before { content: "⟳ "; display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.runner-out .r-status { font-family: var(--hand); font-size: .95rem; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.runner-out .r-meta { color: var(--muted); font-size: .85rem; }
.runner-out .r-meta code { font-size: .78rem; }
.pill { font-family: var(--hand); font-weight: 700; padding: 0 12px; border: 2px solid var(--ink); border-radius: var(--wobble); }
.pill.ok { background: var(--green-f); } .pill.warn { background: var(--yellow-f); } .pill.bad { background: var(--red-f); }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.runner-out.busy .r-status::before { content: none; }
.runner-out .jump {
  font-family: var(--mono); font-size: .8rem; font-weight: 600; color: var(--ink); cursor: pointer;
  background: var(--yellow-f); border: 1.5px solid var(--ink); border-radius: 6px; padding: 0 6px;
}
.runner-out .jump.error { background: var(--red-f); }
.runner-out .jump:hover { transform: translateY(-1px); box-shadow: 2px 2px 0 var(--ink); }
.r-run { position: relative; }
.r-run .r-kbd { font-size: .62rem; padding: 0 4px; margin-left: 4px; opacity: .6; border-width: 1.5px; }
.r-run.running { pointer-events: none; }
.r-run.running::after {
  content: ""; position: absolute; inset: -5px; border: 2px solid var(--blue); border-radius: var(--wobble); animation: ring 1s ease-out infinite;
}
@keyframes ring { from { opacity: .9; transform: scale(.96); } to { opacity: 0; transform: scale(1.12); } }
.runner-out .r-label { font-family: var(--hand); font-size: .85rem; color: var(--muted); margin-top: 6px; }
.runner-out pre { margin: 2px 0 0; padding: 8px 12px; background: var(--code-bg); border-radius: 8px; overflow: auto; max-height: 380px; font-size: .85rem; line-height: 1.5; }
.runner-out pre.r-diag { border-left: 4px solid var(--yellow); }
.runner-out pre.r-stderr { border-left: 4px solid var(--red); }
.runner-out pre.r-stdout { border-left: 4px solid var(--green); }

/* ---------- stepper / tabs / sorter / predict / widget shells ---------- */
.stepper, .tabs, .sorter, .predict, .widget {
  border: 2px solid var(--ink); border-radius: var(--wobble-lg); background: var(--paper);
  padding: 14px 18px; margin: 22px 0;
}
.stepper-title, .w-title { font-size: 1.15rem; margin-bottom: 6px; }
.stepper-chips, .tabs-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.stepper > .step, .tabs > .tab { display: none; }
.stepper > .step.on, .tabs > .tab.on { display: block; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stepper-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; }
.widget, .stepper, .sorter, .predict { box-shadow: 5px 5px 0 color-mix(in srgb, var(--ink) 10%, transparent); }

.sorter-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.sorter-head .hand:first-child { font-size: 1.15rem; flex: 1; }
.sorter > .item { border-top: 1.5px dashed color-mix(in srgb, var(--ink) 30%, transparent); padding: 10px 0; display: grid; gap: 6px; }
.sorter > .item .item-body { font-family: var(--mono); font-size: .85rem; overflow-wrap: anywhere; }
.sorter > .item .item-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.sorter > .item .item-why { display: none; font-size: .92rem; padding-left: 10px; border-left: 4px solid var(--green); }
.sorter > .item.wrong .item-why { border-left-color: var(--red); }
.sorter > .item.done .item-why { display: block; }

.predict.locked .runner-bar, .predict.locked .runner-out, .predict.locked .r-stdin { display: none; }
.predict-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.predict-box label { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 240px; }
.predict-box input { flex: 1; }
.predict-box .p-msg { flex-basis: 100%; font-size: .95rem; }
.predict.p-right { border-color: var(--green); }
.predict .why { margin-top: 8px; padding: 6px 12px; border-left: 4px solid var(--blue); background: color-mix(in srgb, var(--blue-f) 25%, transparent); }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.flash { border-color: var(--violet); background: color-mix(in srgb, var(--violet-f) 18%, var(--paper)); }
.flash-top { display: flex; justify-content: space-between; align-items: center; }
.flash-q { font-size: 1.35rem; margin: 10px 0 4px; }
.flash-a { margin-top: 10px; padding-top: 8px; border-top: 2px dashed color-mix(in srgb, var(--ink) 30%, transparent); }
.flash-grade { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- bits ---------- */
.bits { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-start; margin: 8px 0; }
.bits .byte { display: inline-flex; gap: 3px; flex-wrap: nowrap; }
.bit {
  position: relative; width: 36px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: 1.05rem; border: 2px solid var(--ink);
  border-radius: 7px 10px 6px 9px / 9px 6px 10px 7px; background: var(--paper); user-select: none;
}
.bit[role="button"] { cursor: pointer; }
.bit[role="button"]:hover { transform: rotate(-3deg); }
.bit.one { background: var(--blue-f); }
.bit.sign { border-color: var(--red); }
.bit.sign.one { background: var(--red-f); }
.bit.mark { box-shadow: 0 0 0 3px var(--yellow); }
.bit small { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: .62rem; color: var(--muted); white-space: nowrap; margin-top: 2px; font-weight: 400; }
.bits:has(small) { margin-bottom: 22px; }
.bits.small .bit { width: 22px; height: 28px; font-size: .78rem; border-width: 1.5px; }
.bit.f-sign { background: color-mix(in srgb, var(--red-f) 45%, var(--paper)); } .bit.f-sign.one { background: var(--red-f); }
.bit.f-exp { background: color-mix(in srgb, var(--yellow-f) 40%, var(--paper)); } .bit.f-exp.one { background: var(--yellow-f); }
.bit.f-man { background: color-mix(in srgb, var(--blue-f) 30%, var(--paper)); } .bit.f-man.one { background: var(--blue-f); }
.f-sign-t { color: var(--red); } .f-exp-t { color: var(--yellow); } .f-man-t { color: var(--blue); }
.be-widths, .be-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.be-read { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 6px 0; }
.be-read > div { border: 2px dashed color-mix(in srgb, var(--ink) 35%, transparent); border-radius: 10px; padding: 4px 10px; display: flex; flex-direction: column; }
.be-read > div b { font-size: 1.25rem; font-family: var(--mono); overflow-wrap: anywhere; }
.be-read .be-sum { grid-column: 1 / -1; border: none; padding: 0; }
.be-msg { min-height: 1.5em; font-size: .95rem; }
.be-msg > div { margin: 2px 0; }

/* conversion / division / float / tricks / parser */
.cl-row, .cl-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.cl-row input { width: 130px; }
.cl-steps { margin: 10px 0; }
.cl-result, .pp-res, .fe-out { font-size: 1.02rem; margin-top: 6px; }
.fe-in, .pp-in { width: 240px; }
.fe-exact code { overflow-wrap: anywhere; white-space: normal; }
.fe-parts { margin: -2px 0 6px; }
.bt-row { display: grid; grid-template-columns: 130px auto 60px; gap: 4px 12px; align-items: center; border-bottom: 1.5px dashed color-mix(in srgb, var(--ink) 20%, transparent); padding: 2px 0; }
.bt-row > .small { grid-column: 1 / -1; margin-top: -6px; }
.bt-row .bits { margin: 4px 0; }
.bt-row .bit { width: 24px; height: 30px; font-size: .85rem; }
.bt-v { font-family: var(--mono); font-weight: 600; }
.bt-facts { margin-top: 8px; display: grid; gap: 4px; }
@media (max-width: 640px) { .bt-row { grid-template-columns: 1fr; } .bt-row .bit { width: 18px; height: 26px; font-size: .75rem; } }

/* flag builder */
.fb-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.fb-opt { display: block; cursor: pointer; font-size: .92rem; }
.fb-cmd { margin: 12px 0 6px; padding: 8px 12px; background: var(--code-bg); border: 2px solid var(--ink); border-radius: 8px; overflow-x: auto; }
.fb-cmd code { background: none; border: none; white-space: nowrap; }
.fb-v { padding: 2px 10px; margin: 4px 0; border-left: 4px solid; }
.fb-v.good { border-color: var(--green); } .fb-v.warn { border-color: var(--yellow); } .fb-v.bad { border-color: var(--red); color: var(--red); }

/* endl sim */
.es-lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 10px 0; }
.es-lane { border: 2px dashed color-mix(in srgb, var(--ink) 40%, transparent); border-radius: 12px; padding: 8px 12px; }
.es-buf { position: relative; height: 26px; border: 2px solid var(--ink); border-radius: 8px; margin: 6px 0; overflow: hidden; }
.es-buf span { position: absolute; inset: 0 auto 0 0; width: 0; background: repeating-linear-gradient(-45deg, var(--blue) 0 2px, var(--blue-f) 2px 7px); transition: width .1s; }
.es-buf em { position: relative; font-family: var(--hand); font-style: normal; font-size: .85rem; padding-left: 8px; line-height: 22px; }
.es-stats { font-family: var(--hand); }
.es-sys { font-size: 1.5rem; font-weight: 700; }
.es-pop { opacity: 0; color: var(--red); font-weight: 700; margin-left: 6px; }
.es-pop.on { animation: popfade .5s; }
@keyframes popfade { 0% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: scale(1); } }
.es-term { height: 110px; overflow: auto; font-size: .72rem; line-height: 1.25; background: var(--code-bg); border-radius: 8px; padding: 4px 8px; margin: 6px 0 0; }
.es-calc { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; font-family: var(--hand); }
.es-bar { display: grid; grid-template-columns: 56px 1fr; gap: 2px 8px; align-items: center; margin: 8px 0; }
.es-bar b { grid-column: 2; font-size: .92rem; }
.es-label { font-family: var(--mono); font-size: .85rem; }
.es-fill { display: block; height: 20px; border: 2px solid var(--ink); border-radius: 6px; min-width: 6px; }
.es-fill.bad { background: repeating-linear-gradient(-45deg, var(--red) 0 2px, var(--red-f) 2px 7px); }
.es-fill.good { background: var(--green-f); }

/* beginner runner: only run / reset / solution are shown */
.runner-bar.simple .r-modes, .runner-bar.simple .r-comp, .runner-bar.simple .r-flags, .runner-bar.simple .r-gb { display: none; }

/* ---------- lesson pages: slim header, floating contents button, focus mode ---------- */
.topbar.slim { position: static; padding: 4px 14px 4px 62px; gap: 10px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); }
.topbar.slim .brand { font-size: 1.1rem; }
.topbar.slim .crumbs { font-size: .9rem; }
.topbar.slim .btn { font-size: .85rem; padding: 1px 10px; border-width: 1.5px; }
.toc-fab { position: fixed; top: 6px; left: 12px; z-index: 21; padding: 1px 10px; font-size: 1rem; border-width: 1.5px; background: var(--paper); }
body.lesson-page .toc { top: 46px; max-height: calc(100vh - 62px); }
body.lesson-page { scroll-padding-top: 16px; }
html:has(body.lesson-page) { scroll-padding-top: 16px; }
button.focus-exit { display: none; position: fixed; top: 6px; right: 12px; z-index: 21; font-size: .8rem; padding: 0 10px; border-width: 1.5px; opacity: .45; }
.focus-exit:hover, .focus-exit:focus { opacity: 1; }
body.focus .topbar, body.focus .toc, body.focus .toc-fab { display: none; }
body.focus button.focus-exit { display: inline-flex; }
body.focus .lesson-layout { padding-top: 40px; }

/* keep short flags like -O2 on one line */
.nw { white-space: nowrap; }

/* ---------- interview review page ---------- */
.iq-controls { display: grid; gap: 8px; padding: 12px 16px; margin: 18px 0; }
.iq-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.iq-row > .hand { min-width: 64px; }
.iq-search { flex: 1; min-width: 160px; font: inherit; font-size: .95rem; padding: 4px 10px; color: var(--ink); background: var(--paper);
  border: 1.5px solid color-mix(in srgb, var(--ink) 45%, transparent); border-radius: 10px; }
.iq-card { padding: 20px 24px; margin-top: 10px; }
.iq-card .iq-q { margin: .5em 0 .6em; font-size: 1.55rem; }
.iq-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.iq-answer { border-top: 1.5px dashed color-mix(in srgb, var(--ink) 30%, transparent); padding-top: 8px; }
.iq-answer .short { font-size: 1.02rem; padding: 6px 12px; border-left: 4px solid var(--green); background: color-mix(in srgb, var(--green-f) 25%, transparent); border-radius: 0 8px 8px 0; }
.iq-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.iq-buttons kbd { font-family: var(--mono); font-size: .7rem; border: 1px solid color-mix(in srgb, var(--ink) 40%, transparent); border-radius: 4px; padding: 0 4px; opacity: .7; }
.iq-group h2 { font-size: 1.45rem; margin-bottom: .1em; }
.iq-qa summary .iq-meta { display: inline-flex; gap: 6px; margin-left: 6px; vertical-align: middle; }
.iq-qa summary .tag { font-size: .72rem; }

/* =========================================================
   calm reading (every page): fewer lines, no shadows,
   softer boxes, more white space. Same hand-drawn style.
   ========================================================= */
body { --line: color-mix(in srgb, var(--ink) 28%, transparent); }
main .card,
main .callout,
main .tldr,
main .widget,
main .stepper,
main .sorter,
main .predict,
main details.qa,
main .exercise { border-width: 1.5px; border-color: var(--line); box-shadow: none; transform: none; }
main .callout::before { border-width: 1.5px; border-color: var(--line); font-size: .85rem; transform: none; }
main .callout { margin: 34px 0 26px; }
main .tldr { background: color-mix(in srgb, var(--yellow-f) 55%, var(--paper)); }
main .callout.analogy,
main .callout.try,
main .callout.mistake,
main .callout.key,
main .callout.note,
main .callout.tip,
main .callout.hft,
main .callout.warn { background: var(--paper); }
main p { margin: .9em 0; }
main h2 { margin-top: 1.4em; }
/* the front of a lesson: just the title, one paragraph and the goals */
body.lesson-page .hero .meta .tag:nth-child(n+3) { display: none; }
main .two-col > .card:has(.legend) { display: none; }
main .two-col:has(.legend) { display: block; }


/* roadmap phases fold; only the current one is open */
details.phase > summary { cursor: pointer; list-style: none; }
details.phase > summary::-webkit-details-marker { display: none; }
details.phase > summary::before { content: "▸"; font-size: 1rem; color: var(--muted); align-self: center; }
details.phase[open] > summary::before { content: "▾"; }
details.phase:not([open]) { margin: 14px 0; }
.lesson-card, .topbar .btn, .phase-head .phase-n { border-color: var(--line); }
.lesson-card { box-shadow: none; }
.progress { display: none; }
/* interview pages: switch between the two, topic folders */
.iq-switch { display: flex; gap: 8px; margin: 6px 0 4px; }
.iq-switch a.chip { text-decoration: none; color: var(--ink); }
details.rq-topic { margin: 10px 0; }
details.rq-topic > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; }
details.rq-topic > summary::-webkit-details-marker { display: none; }
details.rq-topic > summary::before { content: "▸"; color: var(--muted); }
details.rq-topic[open] > summary::before { content: "▾"; }
details.rq-topic > summary h2 { margin: .4em 0; font-size: 1.4rem; }
.rq-firms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
