/* ==========================================================================
   Kit — shared look + interactive components for the CSS lecture.
   Used by slides.html, every playground and every exercise page.
   Components size themselves in `em`, so they scale with whatever
   font-size their container has (big on slides, normal on pages).
   ========================================================================== */

:root {
  --paper: #f4efe6;
  --paper-2: #ebe3d3;
  --paper-3: #ddd2bd;
  --white: #fffdf8;
  --ink: #17140f;
  --ink-2: #3d372f;
  --muted: #6f665a;
  --line: #d3c8b3;

  --tomato: #ff5a36;
  --blue: #2f49ff;
  --yellow: #ffd23f;
  --green: #12a26f;
  --pink: #ff7ac2;
  --violet: #7b4dff;

  --code-bg: #1b1916;
  --code-bg-2: #12110f;
  --code-ink: #efe8da;
  --code-muted: #8d8474;

  /* syntax colours: selector = yellow, property = blue, value = orange */
  --hl-sel: #ffd23f;
  --hl-prop: #82ccff;
  --hl-val: #ffa383;
  --hl-num: #bff08f;
  --hl-str: #9fe6c8;
  --hl-at: #ff8fd0;
  --hl-punct: #a79e8f;
  --hl-com: #7d7466;
  --hl-imp: #ff6b6b;
  --hl-tag: #ff9d7e;
  --hl-attr: #ffd23f;

  /* specificity columns */
  --spec-a: #ff5a36;
  --spec-b: #f5a300;
  --spec-c: #2f8cff;

  --font-sans: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* code must show exactly what you type: no ligatures */
code, pre, kbd, textarea, .spec-input, .sel-input, .duel-sel, .sel-code, .code-view, .answer-row input { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }

/* ---------- syntax tokens ---------- */
.t-sel { color: var(--hl-sel); }
.t-prop { color: var(--hl-prop); }
.t-val, .t-fn { color: var(--hl-val); }
.t-num, .t-hex { color: var(--hl-num); }
.t-str { color: var(--hl-str); }
.t-at { color: var(--hl-at); }
.t-p { color: var(--hl-punct); }
.t-c { color: var(--hl-com); font-style: italic; }
.t-imp { color: var(--hl-imp); font-weight: 700; }
.t-var { color: var(--hl-at); }
.t-tag { color: var(--hl-tag); }
.t-attr { color: var(--hl-attr); }
.t-aval { color: var(--hl-str); }

pre.code, .code-block {
  margin: 0;
  padding: 0.9em 1.1em;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 0.45em;
  font: 400 0.8em/1.5 var(--font-mono);
  white-space: pre;
  overflow: auto;
  tab-size: 2;
}
pre.code mark, .code-block mark, .live-code pre mark {
  background: rgba(255, 210, 63, 0.22);
  color: inherit;
  border-radius: 0.2em;
  box-shadow: 0 0 0 0.12em rgba(255, 210, 63, 0.55);
}

/* ==========================================================================
   Live editor
   ========================================================================== */
.live {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.6em;
  min-height: 12em;
  height: 100%;
  font-size: 0.8em;
}
.live[data-layout="stack"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.1fr) minmax(0, 1fr) auto; }
.live[data-layout="wide-code"] { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.live[data-layout="wide-preview"] { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }

.live-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--code-bg);
  border-radius: 0.5em;
  overflow: hidden;
  border: 0.12em solid var(--ink);
}
.live-bar {
  display: flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.35em 0.5em;
  background: var(--code-bg-2);
  font: 600 0.7em/1 var(--font-mono);
  color: var(--code-muted);
  flex: none;
}
.live-bar .dot { width: 0.8em; height: 0.8em; border-radius: 50%; background: #3a362f; }
.live-bar .dot:nth-child(1) { background: #ff5f57; }
.live-bar .dot:nth-child(2) { background: #febc2e; }
.live-bar .dot:nth-child(3) { background: #28c840; margin-right: 0.6em; }
.live-tab {
  font: inherit;
  color: var(--code-muted);
  background: transparent;
  border: 0;
  padding: 0.35em 0.7em;
  border-radius: 0.35em;
  cursor: pointer;
}
.live-tab[aria-selected="true"] { background: var(--code-bg); color: var(--code-ink); }
.live-bar .spacer { flex: 1; }
.live-btn {
  font: inherit;
  color: var(--code-ink);
  background: #2c2924;
  border: 0;
  padding: 0.35em 0.7em;
  border-radius: 0.35em;
  cursor: pointer;
}
.live-btn:hover { background: #3a362f; }

.live-locked {
  flex: none;
  max-height: 45%;
  overflow: auto;
  border-bottom: 0.1em dashed #3a362f;
  background: #221f1b;
}
.live-locked-label {
  display: block;
  padding: 0.5em 1.2em 0;
  font: 600 0.62em/1 var(--font-mono);
  color: var(--hl-imp);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.live-locked pre.code { background: transparent; font-size: 0.95em; padding-top: 0.4em; opacity: 0.9; }

.live-code { position: relative; flex: 1; min-height: 0; }
.live-code > pre,
.live-code > textarea {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0.8em 1.1em 2em;
  font: 400 0.95em/1.5 var(--font-mono);
  letter-spacing: 0;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
  border: 0;
  box-sizing: border-box;
}
.live-code > pre { pointer-events: none; color: var(--code-ink); }
.live-code > textarea {
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: transparent;
  caret-color: #fff;
  resize: none;
  outline: none;
  z-index: 1;
}
.live-code > textarea::selection { background: rgba(130, 204, 255, 0.35); }
.live-code > textarea:focus-visible { box-shadow: inset 0 0 0 0.15em rgba(255, 210, 63, 0.6); }
.live-code > pre.html-view { pointer-events: auto; z-index: 2; background: var(--code-bg); white-space: pre-wrap; overflow-wrap: anywhere; }

.live-preview {
  position: relative;
  min-height: 0;
  background: #fff;
  border: 0.12em solid var(--ink);
  border-radius: 0.5em;
  overflow: hidden;
}
.live-preview iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  display: block;
  transform-origin: 0 0;
  background: #fff;
}
.live-preview-label {
  position: absolute;
  right: 0.5em;
  bottom: 0.5em;
  z-index: 2;
  font: 600 0.55em/1 var(--font-mono);
  padding: 0.35em 0.6em;
  border-radius: 0.3em;
  background: rgba(23, 20, 15, 0.75);
  color: #fff;
  pointer-events: none;
}

/* ---------- layout overlays (drawn over the preview, never inside it) ---------- */
.live-target { visibility: hidden; pointer-events: none; }
.live-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.ov { position: absolute; box-sizing: border-box; }
.ov > span { position: absolute; white-space: nowrap; font: 700 0.62em/1 var(--font-mono); }
.ov-target { border: max(2.5px, 0.14em) dashed #ff5a36; background: rgb(255 90 54 / 0.16); border-radius: 0.3em; }
.ov-measure { outline: 0.08em dashed rgb(47 73 255 / 0.8); }
.ov-measure > span { right: 0; bottom: 0; background: rgb(47 73 255 / 0.85); color: #fff; padding: 0.2em 0.35em; border-radius: 0.2em 0 0 0; }
.ov-grid-area { outline: 0.1em solid rgb(123 77 255 / 0.9); }
.ov-gl { border-left: 0.08em dashed rgb(123 77 255 / 0.95); }
.ov-gl.h { border-left: 0; border-top: 0.08em dashed rgb(123 77 255 / 0.95); }
.ov-gap { background: repeating-linear-gradient(45deg, rgb(123 77 255 / 0.28) 0 3px, transparent 3px 7px); }
.ov-num > span { background: var(--violet); color: #fff; padding: 0.2em 0.35em; border-radius: 0.2em; }
.ov-num.top > span { transform: translate(-50%, -115%); }
.ov-num.left > span { transform: translate(-115%, -50%); }
.ov-areaname { display: grid; place-items: end; padding: 0.3em; }
.ov-areaname > span { position: static; opacity: 0.8; background: rgb(23 20 15 / 0.82); color: var(--yellow); padding: 0.3em 0.5em; border-radius: 0.25em; font-size: 0.7em; }
.ov-axis { border-top: 0.14em solid var(--tomato); }
.ov-axis::after { content: ""; position: absolute; right: -0.1em; top: -0.42em; border: 0.35em solid transparent; border-left: 0.55em solid var(--tomato); border-right: 0; }
.ov-axis.rev::after { right: auto; left: -0.1em; transform: scaleX(-1); }
.ov-axis > span { right: 1.4em; top: 0.3em; opacity: 0.9; background: var(--tomato); color: #fff; padding: 0.2em 0.4em; border-radius: 0.2em; }
.ov-axis.cross { border-top-style: dashed; border-top-color: var(--blue); }
.ov-axis.cross::after { border-left-color: var(--blue); }
.ov-axis.cross > span { background: var(--blue); }
.ov-axis.v { border-top: 0; border-left: 0.14em solid var(--tomato); }
.ov-axis.v::after { right: auto; top: auto; bottom: -0.1em; left: -0.42em; border: 0.35em solid transparent; border-top: 0.55em solid var(--tomato); border-bottom: 0; }
.ov-axis.v.rev::after { bottom: auto; top: -0.1em; transform: scaleY(-1); }
.ov-axis.v > span { left: 0.3em; right: auto; top: auto; bottom: 1.4em; }
.ov-axis.out > span { top: auto; bottom: 0.35em; right: 0; }
.ov-axis.v.out > span { left: auto; right: 0.45em; bottom: 0; writing-mode: vertical-rl; transform: rotate(180deg); padding: 0.4em 0.15em; }
.ov-axis.cross.v { border-left-style: dashed; border-left-color: var(--blue); }
.ov-axis.cross.v::after { border-top-color: var(--blue); }
.live-width { position: absolute; left: 0.5em; right: 0.5em; bottom: 0.5em; z-index: 3; display: grid; grid-template-columns: auto minmax(0, 1fr) 4.2em; align-items: center; gap: 0.6em; padding: 0.4em 0.7em; border-radius: 0.4em; background: rgb(23 20 15 / 0.85); color: #fff; font: 700 0.6em/1 var(--font-mono); }
.live-width input { width: 100%; accent-color: var(--yellow); }
.live-width output { text-align: right; color: var(--yellow); }
.live-preview:has(.live-width) .live-preview-label { bottom: 3.2em; }
.live-btn[aria-pressed="true"] { background: var(--tomato); color: #fff; }

.live-checks {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 0.6em;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 500 0.72em/1.2 var(--font-sans);
}
.live-checks li {
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.4em 0.75em;
  border-radius: 99em;
  background: var(--paper-2);
  color: var(--ink);
  border: 0.1em solid var(--line);
}
.live-checks li::before {
  content: "";
  width: 0.9em;
  height: 0.9em;
  border-radius: 50%;
  border: 0.14em solid currentColor;
  flex: none;
}
.live-checks li.pass { background: #d8f5e6; border-color: var(--green); color: #0b5c3f; }
.live-checks li.pass::before { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 0.12em #fff; }
.live-checks li.fail-constraint { background: #ffe0d8; border-color: var(--tomato); color: #8a2410; }
.live-checks li.solved-msg { background: var(--ink); color: var(--yellow); border-color: var(--ink); font-weight: 700; }
.live-checks li.solved-msg::before { display: none; }

/* ==========================================================================
   Specificity calculator
   ========================================================================== */
.spec-calc { font-size: 1em; }
.spec-input,
.sel-input {
  width: 100%;
  box-sizing: border-box;
  font: 600 1em/1.2 var(--font-mono);
  padding: 0.55em 0.75em;
  border: 0.12em solid var(--ink);
  border-radius: 0.4em;
  background: var(--white);
  color: var(--ink);
  outline: none;
}
.spec-input:focus, .sel-input:focus { box-shadow: 0.2em 0.2em 0 var(--ink); }
.spec-rows { display: grid; gap: 0.6em; margin-top: 0.7em; }
.spec-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1em;
  padding: 0.6em 0.8em;
  border-radius: 0.5em;
  background: var(--white);
  border: 0.1em solid var(--line);
}
.spec-row.winner { border-color: var(--ink); box-shadow: 0.2em 0.2em 0 var(--ink); }
.spec-tokens { font: 600 0.85em/1.9 var(--font-mono); overflow-wrap: anywhere; }
.spec-tok { padding: 0.1em 0.2em; border-radius: 0.25em; }
.spec-tok.a { background: color-mix(in srgb, var(--spec-a) 22%, transparent); color: #b3290b; box-shadow: inset 0 -0.15em 0 var(--spec-a); }
.spec-tok.b { background: color-mix(in srgb, var(--spec-b) 22%, transparent); color: #8a5a00; box-shadow: inset 0 -0.15em 0 var(--spec-b); }
.spec-tok.c { background: color-mix(in srgb, var(--spec-c) 18%, transparent); color: #1057b5; box-shadow: inset 0 -0.15em 0 var(--spec-c); }
.spec-tok.z { color: var(--muted); }
.spec-tok.comb { color: var(--muted); }
.spec-score { display: flex; gap: 0.3em; }
.spec-score span {
  display: grid;
  place-items: center;
  min-width: 1.9em;
  padding: 0.2em 0.3em 0.1em;
  border-radius: 0.3em;
  font: 800 1.3em/1 var(--font-mono);
  color: #fff;
}
.spec-score span small { display: block; font: 700 0.3em/1.4 var(--font-sans); letter-spacing: 0.08em; opacity: 0.9; }
.spec-score .a { background: var(--spec-a); }
.spec-score .b { background: var(--spec-b); }
.spec-score .c { background: var(--spec-c); }
.spec-score span.zero { opacity: 0.35; }
.spec-error { color: #b3290b; font: 600 0.75em/1.3 var(--font-sans); padding: 0.4em 0.2em; }

/* component lists must not pick up page/slide list styling */
.nth-grid li, .live-checks li { margin: 0; }
.slide .nth-grid li, .slide .live-checks li { padding-left: 0; }
.nth-grid li::before { display: none !important; }
.slide .live-checks li { padding: 0.4em 0.75em; }
.slide .live-checks li::before { position: static; top: auto; left: auto; }

/* ---------- specificity duel ---------- */
.spec-duel { display: grid; gap: 0.35em; }
.duel-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(0, 1.25fr); align-items: center; gap: 0.6em; }
.duel-sel { font: 700 0.9em/1.2 var(--font-mono); padding: 0.35em 0.6em; border-radius: 0.35em; background: var(--white); border: 0.1em solid var(--line); text-align: center; transition: background 0.2s, border-color 0.2s; }
.duel-vs { font: 800 0.6em var(--font-mono); color: var(--muted); }
.duel-res { display: flex; align-items: center; justify-content: space-between; gap: 0.5em; font-size: 0.68em; }
.duel-res b { font: 800 1.05em/1.1 var(--font-sans); text-align: center; flex: 1; }
.duel-res b.tie { color: var(--violet); }
.duel-row:has(.duel-res.shown) .duel-sel.win { background: var(--yellow); border-color: var(--ink); box-shadow: 0.12em 0.12em 0 var(--ink); }
.duel-res .spec-score span { min-width: 1.6em; font-size: 1.15em; }

/* ==========================================================================
   Selector tester
   ========================================================================== */
.sel-tester { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 0.55em; height: 100%; min-height: 0; font-size: 0.85em; }
.sel-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6em; align-items: center; }
.sel-count {
  font: 800 0.9em/1 var(--font-mono);
  padding: 0.62em 0.8em;
  border-radius: 0.4em;
  background: var(--ink);
  color: var(--yellow);
  white-space: nowrap;
}
.sel-count.bad { background: var(--tomato); color: #fff; }
.sel-presets { display: flex; flex-wrap: wrap; gap: 0.35em; }
.chip-btn {
  font: 600 0.7em/1 var(--font-mono);
  padding: 0.5em 0.75em;
  border-radius: 99em;
  border: 0.1em solid var(--ink);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}
.chip-btn:hover, .chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }
.sel-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.6em; min-height: 0; }
.sel-code {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 0.5em;
  padding: 0.6em 0;
  overflow: auto;
  font: 400 0.72em/1.45 var(--font-mono);
  border: 0.12em solid var(--ink);
}
.sel-line { display: block; padding: 0 1em; white-space: pre; border-left: 0.3em solid transparent; }
.sel-line.hit { background: rgba(255, 90, 54, 0.22); border-left-color: var(--tomato); }
.sel-line.inside { background: rgba(255, 90, 54, 0.07); }
.sel-preview {
  border: 0.12em solid var(--ink);
  border-radius: 0.5em;
  background: #fff;
  overflow: auto;
  min-height: 0;
}

/* ==========================================================================
   nth-child playground
   ========================================================================== */
.nth-play { font-size: 0.9em; }
.nth-form { display: flex; align-items: center; gap: 0.2em; font: 700 1.1em/1 var(--font-mono); flex-wrap: wrap; }
.nth-form input {
  width: 7em;
  font: inherit;
  padding: 0.3em 0.4em;
  border: 0.12em solid var(--ink);
  border-radius: 0.3em;
  background: var(--white);
  color: var(--tomato);
  text-align: center;
}
.nth-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.35em; margin: 0.7em 0; padding: 0; list-style: none; }
.nth-grid li {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 0.35em;
  background: var(--paper-2);
  border: 0.1em solid var(--line);
  font: 700 0.9em/1 var(--font-mono);
  color: var(--muted);
  transition: transform 0.2s, background 0.2s;
}
.nth-grid li.hit { background: var(--tomato); border-color: var(--ink); color: #fff; transform: translateY(-0.15em); box-shadow: 0 0.15em 0 var(--ink); }
.nth-note { font: 500 0.75em/1.3 var(--font-sans); color: var(--muted); min-height: 1.3em; }

/* ==========================================================================
   Colour lab
   ========================================================================== */
.color-lab { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1em; font-size: 0.8em; align-items: start; }
.cl-sliders { display: grid; gap: 0.7em; }
.cl-slider { display: grid; grid-template-columns: 1.4em minmax(0, 1fr) 3.4em; align-items: center; gap: 0.6em; font: 700 1em/1 var(--font-mono); }
.cl-slider input[type="range"] { width: 100%; height: 1.4em; appearance: none; border-radius: 99em; border: 0.1em solid var(--ink); }
.cl-slider input[type="range"]::-webkit-slider-thumb { appearance: none; width: 1.5em; height: 1.5em; border-radius: 50%; background: #fff; border: 0.18em solid var(--ink); box-shadow: 0 0.1em 0 var(--ink); }
.cl-slider input[type="range"]::-moz-range-thumb { width: 1.3em; height: 1.3em; border-radius: 50%; background: #fff; border: 0.18em solid var(--ink); }
.cl-slider output { text-align: right; }
.cl-codes { display: grid; gap: 0.3em; margin-top: 0.4em; font: 600 0.85em/1.3 var(--font-mono); }
.cl-codes div { display: flex; justify-content: space-between; gap: 1em; padding: 0.35em 0.6em; background: var(--white); border-radius: 0.3em; border: 0.1em solid var(--line); }
.cl-codes span:first-child { color: var(--muted); }
.cl-swatch { border-radius: 0.6em; border: 0.12em solid var(--ink); padding: 1em; display: grid; gap: 0.5em; }
.cl-sample { display: flex; justify-content: space-between; align-items: center; font: 800 1.3em/1.1 var(--font-sans); padding: 0.35em 0.5em; border-radius: 0.35em; }
.cl-sample small { font: 700 0.5em/1.2 var(--font-mono); padding: 0.25em 0.5em; border-radius: 0.25em; background: rgba(255, 255, 255, 0.9); color: var(--ink); }
.cl-sample small.fail { background: var(--ink); color: #ff9c85; }
.cl-palette { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0.25em; margin-top: 0.6em; }
.cl-palette div { aspect-ratio: 1 / 1.3; border-radius: 0.3em; border: 0.1em solid rgba(0, 0, 0, 0.15); display: grid; place-items: end center; font: 700 0.55em/1 var(--font-mono); padding-bottom: 0.4em; }

/* ---------- contrast pair ---------- */
.contrast-pair { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 1em; align-items: stretch; font-size: 0.9em; }
.cp-controls { display: grid; gap: 0.6em; align-content: start; }
.cp-controls label { display: grid; grid-template-columns: 5em 3em minmax(0, 1fr); align-items: center; gap: 0.5em; font: 700 0.85em/1 var(--font-mono); }
.cp-controls input[type="color"] { width: 3em; height: 2em; border: 0.12em solid var(--ink); border-radius: 0.3em; padding: 0; background: none; }
.cp-controls input[type="text"] { font: 600 0.95em var(--font-mono); padding: 0.4em 0.5em; border: 0.1em solid var(--ink); border-radius: 0.3em; min-width: 0; }
.cp-sample { border: 0.12em solid var(--ink); border-radius: 0.6em; padding: 1em 1.2em; display: grid; gap: 0.4em; }
.cp-sample b { font: 800 1.6em/1.1 var(--font-sans); }
.cp-sample span { font-size: 0.95em; }
.cp-score { font: 800 1.1em/1 var(--font-mono); display: flex; gap: 0.5em; flex-wrap: wrap; margin-top: 0.3em; }
.cp-score i { font-style: normal; font-size: 0.7em; padding: 0.35em 0.6em; border-radius: 0.3em; background: var(--green); color: #fff; }
.cp-score i.fail { background: var(--tomato); }

/* ==========================================================================
   Box model lab
   ========================================================================== */
.box-lab { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1em; font-size: 0.8em; height: 100%; min-height: 0; }
.bl-controls { display: grid; gap: 0.55em; align-content: start; }
.bl-row { display: grid; grid-template-columns: 5.4em minmax(0, 1fr) 3.4em; align-items: center; gap: 0.5em; font: 700 0.9em/1 var(--font-mono); }
.bl-row input[type="range"] { width: 100%; accent-color: var(--ink); }
.bl-row output { text-align: right; }
.bl-row .sw { width: 0.8em; height: 0.8em; display: inline-block; border-radius: 0.15em; margin-right: 0.35em; vertical-align: -0.05em; border: 0.08em solid var(--ink); }
.bl-toggle { display: flex; gap: 0; border: 0.12em solid var(--ink); border-radius: 0.4em; overflow: hidden; width: max-content; margin-top: 0.3em; }
.bl-toggle button { font: 700 0.8em/1 var(--font-mono); border: 0; padding: 0.6em 0.9em; background: var(--white); color: var(--ink); cursor: pointer; }
.bl-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }
.bl-math { font: 600 0.85em/1.5 var(--font-mono); background: var(--white); border: 0.1em solid var(--line); border-radius: 0.4em; padding: 0.6em 0.8em; margin-top: 0.3em; }
.bl-math b { color: var(--tomato); font-size: 1.25em; }
.bl-stage {
  position: relative;
  border: 0.12em solid var(--ink);
  border-radius: 0.5em;
  background:
    linear-gradient(90deg, rgba(0,0,0,.05) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(rgba(0,0,0,.05) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--white);
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 1em;
}
.bl-ruler { font: 700 0.7em/1 var(--font-mono); color: var(--tomato); text-align: center; margin-bottom: 0.3em; }
.bl-margin {
  background: repeating-linear-gradient(45deg, rgba(249, 204, 157, 0.9) 0 6px, rgba(249, 204, 157, 0.45) 6px 12px);
  outline: 1px dashed #c27c2c;
}
.bl-box {
  border-style: solid;
  border-color: #fddd9b;
  border-color: #2b2b2b;
  background: linear-gradient(#8cb6c0, #8cb6c0) content-box, #c3d08b;
  background: linear-gradient(#9fc4e7, #9fc4e7) content-box, #c3deb7;
  color: #0b2a44;
  font: 700 14px/1.3 var(--font-mono);
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
}
.bl-legend { display: flex; gap: 0.8em; flex-wrap: wrap; font: 600 0.7em/1 var(--font-mono); margin-top: 0.4em; }

/* ==========================================================================
   Units lab
   ========================================================================== */
.units-lab { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 0.7em; height: 100%; min-height: 0; font-size: 0.8em; }
.ul-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1em; }
.ul-control { display: grid; gap: 0.3em; font: 700 0.8em/1.2 var(--font-mono); }
.ul-control span { display: flex; justify-content: space-between; }
.ul-control input { width: 100%; accent-color: var(--ink); }
.ul-stage {
  position: relative;
  min-height: 0;
  border-radius: 0.5em;
  background: var(--paper-3);
  border: 0.12em solid var(--ink);
  overflow: hidden;
}
.ul-stage iframe { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; box-shadow: 0.3em 0 0 var(--ink); }

/* ==========================================================================
   Labs — shared controls
   ========================================================================== */
.lab-controls { display: flex; flex-direction: column; gap: 0.55em; min-width: 0; }
.lab-group { display: grid; gap: 0.3em; }
.lab-group[hidden] { display: none; }
.lab-label { font: 700 0.62em/1 var(--font-mono); letter-spacing: 0.06em; color: var(--muted); }
.lab-group.strong .lab-label { color: var(--ink); font-size: 0.7em; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 0.25em; }
.lab-chips .chip-btn { font-size: 0.62em; padding: 0.45em 0.65em; }
.lab-range { grid-template-columns: minmax(0, 1fr) 3.5em; grid-template-rows: auto auto; }
.lab-range .lab-label { grid-column: 1 / -1; }
.lab-range input { width: 100%; accent-color: var(--ink); }
.lab-range output { font: 700 0.65em var(--font-mono); text-align: right; }

/* ---------- flex lab ---------- */
.flex-lab { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: 1em; height: 100%; min-height: 0; font-size: 0.9em; }
.fl-right { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0.6em; min-height: 0; }
.fl-stage { position: relative; min-height: 0; padding: 1.9em 0.6em 1.9em 1.6em; border: 0.12em solid var(--ink); border-radius: 0.5em;
  background: repeating-linear-gradient(90deg, #d69a5b 0 2.2em, #c98c4f 2.2em 2.3em); }
.fl-box { height: 100%; min-height: 0; display: flex; box-sizing: border-box; background: rgb(23 20 15 / 0.18); outline: 0.1em dashed rgb(23 20 15 / 0.6); border-radius: 0.3em; overflow: hidden; transition: width 0.2s; }
.fl-item { font: 700 0.6em/1.1 var(--font-sans); color: var(--ink); background: var(--white); border: 0.15em solid var(--ink); border-radius: 0.5em; padding-inline: 0.8em; display: flex; flex-direction: column; align-items: center; gap: 0.2em; cursor: pointer; min-width: 0; box-shadow: 0 0.2em 0 rgb(0 0 0 / 0.25); }
.fl-item b { font-size: 1.8em; line-height: 1; }
.fl-item span { white-space: nowrap; }
.fl-item .fl-size { font: 700 0.8em/1 var(--font-mono); color: var(--blue); }
.fl-item.sel { background: var(--yellow); box-shadow: 0 0 0 0.2em var(--tomato); }
.fl-axes { position: absolute; inset: 0; pointer-events: none; font-size: 0.85em; }
.fl-axes .ov-axis > span { left: 0; right: auto; top: -1.75em; }
.fl-axes .ov-axis.v > span { left: -0.6em; top: auto; bottom: -1.9em; }
.fl-code { font-size: 0.55em !important; max-height: 9em; }
.fl-itembox { display: grid; gap: 0.45em; padding: 0.5em 0.6em; border: 0.1em dashed var(--line); border-radius: 0.4em; }
.fl-hint { margin: 0 !important; font: 600 0.6em/1.3 var(--font-sans); color: var(--muted); }

/* ---------- position lab ---------- */
.pos-lab { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); gap: 1em; height: 100%; min-height: 0; font-size: 0.9em; }
.pl-stage { position: relative; min-height: 0; border: 0.12em solid var(--ink); border-radius: 0.5em; overflow: hidden; background: #12151d; }
.pl-stage iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; }
.pl-code { font-size: 0.6em !important; }
.pl-say { font: 500 0.66em/1.4 var(--font-sans); background: var(--white); border: 0.1em solid var(--ink); border-radius: 0.4em; padding: 0.6em 0.8em; }
.pl-say code { font-size: 0.95em; }

/* ==========================================================================
   Timer
   ========================================================================== */
.timer {
  font: 800 1em/1 var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5em 0.9em;
  border-radius: 99em;
  border: 0.12em solid currentColor;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.timer::before { content: "▶"; font-size: 0.7em; }
.timer.running::before { content: "❚❚"; letter-spacing: -0.1em; }
.timer.done { background: var(--tomato); color: #fff; border-color: var(--tomato); animation: timer-pulse 1s ease-in-out infinite; }
.timer.done::before { content: "⏰"; }
@keyframes timer-pulse { 50% { transform: scale(1.06); } }

/* ==========================================================================
   Brief generator
   ========================================================================== */
.brief { display: grid; gap: 0.8em; }
.brief-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7em; }
.brief-card {
  background: var(--white);
  color: var(--ink);
  border: 0.12em solid var(--ink);
  border-radius: 0.6em;
  padding: 0.8em 0.9em 1em;
  box-shadow: 0.25em 0.25em 0 var(--ink);
  min-height: 5.5em;
  transition: transform 0.3s;
}
.brief-card:nth-child(1) { transform: rotate(-1.5deg); }
.brief-card:nth-child(3) { transform: rotate(1.2deg); }
.brief-card small { display: block; font: 700 0.55em/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5em; }
.brief-card strong { display: block; font: 800 1.05em/1.1 var(--font-sans); }
.brief-card p { margin: 0.4em 0 0; font: 400 0.65em/1.35 var(--font-sans); color: var(--ink-2); }
.brief-card .swatches { display: flex; gap: 0.2em; margin-top: 0.5em; }
.brief-card .swatches i { flex: 1; height: 1.1em; border-radius: 0.2em; border: 0.08em solid rgba(0,0,0,.2); }
.brief.shuffling .brief-card { transform: translateY(-0.2em) rotate(0); }
.brief-draw {
  justify-self: start;
  font: 800 0.8em/1 var(--font-sans);
  padding: 0.7em 1.2em;
  border-radius: 99em;
  border: 0.12em solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0.15em 0.15em 0 var(--ink);
}
.brief-draw:active { transform: translate(0.1em, 0.1em); box-shadow: none; }

/* ==========================================================================
   Standalone pages (playgrounds, exercises, hub)
   ========================================================================== */
.page {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-sans);
}
.page-wrap { max-width: 78rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 4rem; }
.page-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: 1rem; border-bottom: 2px solid var(--ink); margin-bottom: 2rem; font: 600 0.85rem/1 var(--font-mono); }
.page-top a { color: var(--ink); }
.page h1 { font: 800 clamp(2.2rem, 1.5rem + 3vw, 3.6rem)/1 var(--font-sans); letter-spacing: -0.03em; margin: 0 0 0.6rem; }
.page h1 em, .page h2 em { font-family: var(--font-serif); font-weight: 400; font-style: italic; letter-spacing: 0; }
.page h2 { font: 750 1.6rem/1.1 var(--font-sans); letter-spacing: -0.02em; margin: 2.5rem 0 0.8rem; }
.page .intro { font-size: 1.25rem; max-width: 60ch; color: var(--ink-2); margin: 0 0 1.5rem; }
.page code { font: 500 0.88em var(--font-mono); background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 0.25em; }
.page pre.code code { background: none; padding: 0; }
.page .panel { height: 30rem; }
.page .panel.tall { height: 38rem; }
.page ol.tasks { padding-left: 1.3em; max-width: 70ch; }
.page ol.tasks li { margin: 0.35em 0; }
.page .tip { background: var(--white); border: 2px solid var(--ink); border-radius: 0.6rem; padding: 0.9rem 1.1rem; box-shadow: 4px 4px 0 var(--ink); max-width: 70ch; }
.eyebrow-tag { display: inline-block; font: 700 0.75rem/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; padding: 0.45em 0.7em; border-radius: 0.3em; background: var(--ink); color: var(--yellow); margin-bottom: 1rem; }
@media (max-width: 760px) {
  .live, .live[data-layout] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(14rem, 1fr) minmax(14rem, 1fr) auto; }
  .page .panel, .page .panel.tall { height: auto; }
  .sel-body, .color-lab, .box-lab, .flex-lab, .pos-lab { grid-template-columns: minmax(0, 1fr); }
  .fl-stage, .pl-stage { min-height: 22rem; }
  .ul-controls { grid-template-columns: minmax(0, 1fr); }
  .brief-cards { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Lecture 4 additions
   ========================================================================== */
/* JS syntax tokens: keyword pink, globals yellow, calls orange, props blue */
.t-kw { color: var(--hl-at); }
.t-glob { color: var(--hl-sel); }
.t-id { color: var(--code-ink); }

/* ---------- width presets + scrollburglar detector on live editors ---------- */
.live-width.has-presets { grid-template-columns: auto minmax(0, 1fr) 4.2em auto; }
.live-presets { display: flex; gap: 0.3em; }
.live-preset { font: 700 1em/1 var(--font-mono); color: #fff; background: #3a362f; border: 0; border-radius: 0.3em; padding: 0.35em 0.5em; cursor: pointer; white-space: nowrap; }
.live-preset[aria-pressed="true"] { background: var(--yellow); color: var(--ink); }
.live-burglar { position: absolute; left: 0.5em; bottom: 3.6em; z-index: 4; font: 800 0.62em/1 var(--font-mono); background: #d62d0f; color: #fff; padding: 0.5em 0.7em; border-radius: 0.35em; box-shadow: 0 0 0 0.2em rgb(214 45 15 / 0.3); pointer-events: none; }
.live-burglar[hidden] { display: none; }
.ov-burglar { outline: max(2px, 0.12em) dashed #ff2d0f; background: rgb(255 45 15 / 0.12); }
.ov-burglar > span { left: 0; top: 0; background: #ff2d0f; color: #fff; padding: 0.2em 0.35em; border-radius: 0 0 0.2em 0; }
.live-park { position: absolute; left: -12000px; top: 0; width: 10px; height: 10px; overflow: hidden; visibility: hidden; pointer-events: none; }
.live-park iframe { position: absolute; top: 0; left: 0; height: 800px; border: 0; }
.live, .live-js, .dom-lab { position: relative; }

/* ---------- live JS editor ---------- */
.live-js {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.6em;
  min-height: 14em;
  height: 100%;
  font-size: 0.8em;
}
.live-js[data-layout="wide-code"] { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.js-right { display: grid; grid-template-rows: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0.6em; min-height: 0; }
.live-js[data-console="small"] .js-right { grid-template-rows: minmax(0, 2fr) minmax(0, 1fr); }
.live-btn.run { background: var(--green); color: #fff; font-weight: 800; }
.js-console { display: flex; flex-direction: column; min-height: 0; background: var(--code-bg-2); border: 0.12em solid var(--ink); border-radius: 0.5em; overflow: hidden; color: var(--code-ink); }
.js-console-bar { display: flex; align-items: center; gap: 0.5em; padding: 0.35em 0.7em; background: #262320; font: 700 0.62em/1 var(--font-mono); color: var(--code-muted); letter-spacing: 0.06em; text-transform: uppercase; flex: none; }
.js-console-bar .spacer { flex: 1; }
.js-console-bar small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.js-console-list { list-style: none; margin: 0; padding: 0.3em 0; overflow: auto; flex: 1; min-height: 0; font: 400 0.72em/1.45 var(--font-mono); }
.js-console-list li { padding: 0.2em 0.8em; border-bottom: 1px solid #2a2622; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.js-console-list li::before { display: none; }
.js-console-list li small { display: block; font: 500 0.95em/1.4 var(--font-sans); color: #ffd9a8; margin-top: 0.2em; }
.js-console-list .c-warn { background: #3a2f12; color: #ffd76a; }
.js-console-list .c-error { background: #3d1712; color: #ff9d8a; }
.js-console-list .c-input { color: #82ccff; }
.js-console-list .c-result { color: var(--code-muted); }
.slide .js-console-list li { padding-left: 0.8em; }

/* ---------- DOM lab ---------- */
.dom-lab { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: minmax(0, 1fr) auto auto; gap: 0.6em; height: 100%; min-height: 16em; font-size: 0.8em; }
.dl-page { grid-row: 1; }
.dl-side { display: grid; grid-template-rows: minmax(0, 1.2fr) minmax(0, 1fr); gap: 0.6em; min-height: 0; }
.dl-treewrap { display: flex; flex-direction: column; min-height: 0; background: var(--code-bg); border: 0.12em solid var(--ink); border-radius: 0.5em; overflow: hidden; }
.dl-tree { margin: 0; padding: 0.5em 0; overflow: auto; flex: 1; min-height: 0; font: 400 0.72em/1.5 var(--font-mono); color: var(--code-ink); }
.dl-line { display: block; padding: 0 0.8em; white-space: pre; cursor: default; }
.dl-line[data-kit]:hover { background: rgb(130 204 255 / 0.16); cursor: pointer; }
.dl-line.sel { background: rgb(255 210 63 / 0.18); box-shadow: inset 0.25em 0 0 var(--yellow); }
.dl-line.flash { animation: dl-flash 1.2s ease-out; }
@keyframes dl-flash { from { background: rgb(255 90 54 / 0.65); } to { background: transparent; } }
.dl-text { color: #e8e0cf; }
.dl-hover { position: absolute; z-index: 3; pointer-events: none; background: rgb(111 168 220 / 0.35); outline: 2px solid #6fa8dc; }
.dl-hover[hidden] { display: none; }
.dl-prompt { display: flex; align-items: center; gap: 0.5em; padding: 0.35em 0.7em; border-top: 1px solid #3a362f; font: 700 0.75em/1 var(--font-mono); color: #82ccff; flex: none; }
.dl-input { flex: 1; min-width: 0; font: 400 1em/1.4 var(--font-mono); background: transparent; color: var(--code-ink); border: 0; outline: none; padding: 0.3em 0; caret-color: var(--yellow); }
.dl-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.3em; }
.dl-presets .chip-btn { font-size: 0.62em; text-transform: none; }
.dl-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.dl-foot .live-btn { font: 600 0.62em/1 var(--font-mono); }

/* ---------- event lab ---------- */
.event-lab { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 1em; height: 100%; min-height: 0; font-size: 0.9em; }
.ev-code { font-size: 0.58em !important; max-height: 16em; }
.ev-right { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 0.6em; min-height: 0; }
.ev-stage { font: 600 0.62em/1.2 var(--font-mono); }
.ev-stage ul, .ev-stage li { list-style: none; margin: 0; }
.ev-box { position: relative; border: 0.18em dashed var(--muted); border-radius: 0.6em; padding: 1.8em 0.9em 0.9em; background: var(--white); transition: background 0.2s, border-color 0.2s, box-shadow 0.2s; }
.ev-box > b { position: absolute; left: 0.7em; top: 0.5em; font-weight: 700; color: var(--muted); }
.ev-box .ev-box { margin-top: 0.3em; }
.ev-stage li.ev-box { display: flex; align-items: center; justify-content: space-between; gap: 0.6em; padding: 1.8em 0.9em 0.7em; margin-top: 0.6em; background: var(--paper); }
.ev-stage li.ev-box::before { display: none; }
.ev-stage li.ev-box span { font: 700 1.2em/1 var(--font-sans); }
.ev-btn { font: 800 1em/1 var(--font-sans); background: var(--white); color: var(--ink); border: 0.18em solid var(--ink); border-radius: 99em; padding: 0.55em 0.9em; cursor: pointer; }
.ev-stage .listening { border-style: solid; border-color: var(--ink); }
.ev-stage .listening > b::after { content: " 👂"; }
.ev-btn.listening::after { content: " 👂"; }
.ev-stage .is-target { box-shadow: 0 0 0 0.25em var(--tomato); }
.ev-stage .heard { background: #fff2b8; border-color: var(--green); box-shadow: 0 0 0 0.25em var(--green); }
.ev-stage .ev-btn.heard { background: var(--yellow); }
.ev-stage .stopped { box-shadow: 0 0 0 0.25em var(--tomato), 0 -0.6em 0 0 rgb(255 90 54 / 0.35); }
.ev-log { list-style: none; margin: 0; padding: 0.5em; overflow: auto; min-height: 0; background: var(--code-bg); color: var(--code-ink); border: 0.12em solid var(--ink); border-radius: 0.5em; font: 400 0.6em/1.45 var(--font-mono); }
.ev-log li { padding: 0.25em 0.5em; margin: 0; border-radius: 0.25em; }
.ev-log li::before { display: none; }
.ev-log b { color: var(--yellow); }
.ev-log code { color: #82ccff; background: none; font-size: 1em; padding: 0; }
.ev-log .ev-l-pass { color: var(--code-muted); }
.ev-log .ev-l-stop { background: #3d1712; color: #ff9d8a; }
.ev-log .ev-l-target { color: #ffb4a3; }

/* ---------- event monitor ---------- */
.event-monitor { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1em; height: 100%; min-height: 0; font-size: 0.9em; }
.em-left { display: grid; align-content: start; gap: 0.8em; }
.em-form { display: grid; gap: 0.6em; padding: 1em; background: var(--white); border: 0.12em solid var(--ink); border-radius: 0.6em; font: 600 0.72em/1.3 var(--font-sans); }
.em-form label { display: grid; gap: 0.25em; }
.em-form .em-check { display: flex; align-items: center; gap: 0.4em; }
.em-form input:not([type=checkbox]), .em-form select { font: inherit; font-weight: 400; padding: 0.4em 0.5em; border: 0.1em solid var(--ink); border-radius: 0.3em; background: #fff; }
.em-form button { justify-self: start; font: 800 1em/1 var(--font-sans); background: var(--yellow); border: 0.12em solid var(--ink); border-radius: 99em; padding: 0.55em 1em; cursor: pointer; }
.em-right { display: flex; flex-direction: column; min-height: 0; background: var(--code-bg-2); border: 0.12em solid var(--ink); border-radius: 0.5em; overflow: hidden; }
.em-log { list-style: none; margin: 0; padding: 0.3em 0; overflow: auto; flex: 1; min-height: 0; font: 400 0.62em/1.4 var(--font-mono); color: var(--code-ink); }
.em-log li { display: grid; grid-template-columns: 2.2em 5.5em minmax(0, auto) minmax(0, 1fr); gap: 0.6em; padding: 0.2em 0.8em; margin: 0; border-bottom: 1px solid #2a2622; }
.em-log li::before { display: none; }
.em-log span { color: var(--code-muted); text-align: right; }
.em-log code { background: none; color: #82ccff; padding: 0; font-size: 1em; }
.em-log i { font-style: normal; color: var(--hl-str); overflow-wrap: anywhere; }
.em-log .em-focus b, .em-log .em-blur b { color: #c9a7ff; }
.em-log .em-keydown b { color: var(--code-muted); }
.em-log .em-input b { color: var(--yellow); }
.em-log .em-change b { color: #ffa383; }
.em-log .em-click b { color: #82ccff; }
.em-log .em-submit b { color: #7ee2a8; }

/* ---------- fluid calculator ---------- */
.fluid-calc { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1.2em; height: 100%; min-height: 0; font-size: 0.9em; }
.fc-controls { display: flex; flex-direction: column; gap: 0.7em; min-width: 0; }
.fc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6em; }
.fc-num { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.2em 0.4em; align-items: center; font: 700 0.62em/1.2 var(--font-mono); color: var(--muted); }
.fc-num span { grid-column: 1 / -1; }
.fc-num input { font: 700 1.5em/1 var(--font-mono); width: 100%; padding: 0.35em 0.45em; border: 0.1em solid var(--ink); border-radius: 0.3em; background: var(--white); color: var(--ink); }
.fc-codewrap { position: relative; }
.fc-code { font-size: 0.62em !important; white-space: pre-wrap !important; }
.fc-codewrap .live-btn { position: absolute; right: 0.5em; top: 0.5em; font: 600 0.55em/1 var(--font-mono); }
.fc-zoom { font: 500 0.66em/1.35 var(--font-sans); padding: 0.6em 0.8em; border-radius: 0.4em; border: 0.1em solid var(--ink); }
.fc-zoom.ok { background: #d8f5e6; }
.fc-zoom.meh { background: #fff2b8; }
.fc-zoom.bad { background: #ffe0d8; }
.fc-right { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 0.6em; min-height: 0; min-width: 0; }
.fc-graph { width: 100%; height: auto; background: var(--white); border: 0.12em solid var(--ink); border-radius: 0.5em; font: 600 13px var(--font-mono); }
.fc-graph text { fill: var(--muted); }
.fc-graph .fc-axis { fill: var(--ink); font-weight: 700; }
.fc-grid { stroke: var(--line); stroke-width: 1; }
.fc-band { fill: rgb(47 73 255 / 0.08); }
.fc-line { fill: none; stroke: var(--tomato); stroke-width: 4; stroke-linejoin: round; }
.fc-now { stroke: var(--blue); stroke-width: 2; stroke-dasharray: 5 4; }
.fc-dot { fill: var(--blue); stroke: #fff; stroke-width: 3; }
.fc-range { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.6em; align-items: center; font: 700 0.62em/1 var(--font-mono); }
.fc-range input { width: 100%; accent-color: var(--blue); }
.fc-range output { color: var(--blue); }
.fc-sample { overflow: hidden; min-height: 0; font-family: var(--font-serif); line-height: 0.95; padding: 0.3em 0.4em; background: #12151d; color: #f3ecdf; border: 0.12em solid var(--ink); border-radius: 0.5em; }

@media (max-width: 760px) {
  .live-js, .dom-lab, .event-lab, .event-monitor, .fluid-calc { grid-template-columns: minmax(0, 1fr); height: auto; }
  .js-right, .dl-side { grid-template-rows: 18rem 14rem; }
  .dl-page { min-height: 18rem; }
  .fc-row { grid-template-columns: 1fr; }
}

/* the `font` shorthand above resets ligature settings: switch them off again,
   so => and === look exactly like what you type */
.live-code > pre, .live-code > textarea, pre.code, .js-console-list, .dl-tree, .dl-input, .ev-log, .em-log, .fc-num input, .slide code, .page code {
  font-variant-ligatures: none;
  font-feature-settings: "calt" 0, "liga" 0;
}
.fc-rule { display: block; margin-top: 0.3em; color: var(--muted); }

/* inside slides, the deck styles every li as a bulleted item: undo that for component lists */
.slide .js-console-list li, .slide .ev-log li { padding: 0.2em 0.8em; margin: 0; }
.slide .em-log li { padding: 0.2em 0.8em; margin: 0; }
.slide .ev-stage li.ev-box { padding: 1.8em 0.9em 0.7em; margin: 0.6em 0 0; }
.slide .js-console-list li::before, .slide .ev-log li::before, .slide .em-log li::before, .slide .ev-stage li::before { display: none; }
.slide .ev-stage ul { margin: 0.3em 0 0; }
.slide .js-console-bar small { font-size: inherit; }

/* ==========================================================================
   The WIRE look for Part 2 pages (JavaScript): <body class="page wire">
   Same circuit-board style as the second half of the slides.
   ========================================================================== */
.page.wire {
  --w-bg: #060b17; --w-bg2: #0b1426; --w-line: #1f3052; --w-ink: #e3ecff; --w-muted: #8599c2;
  --w-act: #3ee6ff;
  background:
    linear-gradient(rgb(62 110 200 / 0.08) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgb(62 110 200 / 0.08) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--w-bg);
  color: var(--w-ink);
  font-family: "Space Grotesk", var(--font-sans);
}
.page.wire.listen { --w-act: #ff4fd8; }
.page.wire.change { --w-act: #b6ff3b; }
.page.wire .page-top { border-color: var(--w-line); font-family: "IBM Plex Mono", var(--font-mono); color: var(--w-muted); }
.page.wire .page-top a, .page.wire a { color: var(--w-act); }
.page.wire h1, .page.wire h2 { font-family: "Space Grotesk", var(--font-sans); font-weight: 700; letter-spacing: -0.04em; color: #fff; }
.page.wire h1 em, .page.wire h2 em { font-family: "IBM Plex Mono", var(--font-mono); font-style: normal; font-weight: 500; color: var(--w-act); }
.page.wire .intro { color: #cfdcf7; }
.page.wire code { background: rgb(62 230 255 / 0.09); color: #cfeeff; border: 1px solid rgb(62 230 255 / 0.18); font-family: "IBM Plex Mono", var(--font-mono); }
.page.wire pre.code code { border: 0; }
.page.wire kbd { background: var(--w-bg2); color: var(--w-ink); border-color: var(--w-line); }
.page.wire .eyebrow-tag { background: transparent; color: var(--w-act); border: 1.5px solid var(--w-act); font-family: "IBM Plex Mono", var(--font-mono); }
.page.wire .tip, .page.wire details { background: var(--w-bg2); color: var(--w-ink); border: 1.5px solid var(--w-line); box-shadow: none; border-left: 4px solid var(--w-act); }
.page.wire .case { border-color: var(--w-line); }
.page.wire .case header b { background: var(--w-act); color: #03101b; font-family: "IBM Plex Mono", var(--font-mono); }
.page.wire .case header b.bonus { background: transparent; color: var(--w-ink); border-color: var(--w-line); }
.page.wire .complaint { color: #cfdcf7; }
.page.wire .complaint::before { color: var(--w-muted); }
.page.wire .loop span { background: var(--w-bg2); border-color: var(--w-act); color: var(--w-ink); }
.page.wire .live-checks li { background: var(--w-bg2); color: var(--w-ink); border-color: var(--w-line); }
.page.wire .live-checks li.pass { background: rgb(182 255 59 / 0.14); border-color: #b6ff3b; color: #b6ff3b; }
.page.wire .live-checks li.solved-msg { background: var(--w-act); color: #03101b; border-color: var(--w-act); }
.page.wire .live-preview, .page.wire .live-pane, .page.wire .js-console, .page.wire .dl-treewrap, .page.wire .em-right, .page.wire .ev-log { border-color: var(--w-line); }
.page.wire .chip-btn { background: transparent; color: var(--w-ink); border-color: var(--w-line); }
.page.wire .chip-btn:hover, .page.wire .chip-btn[aria-pressed="true"] { background: var(--w-act); color: #03101b; border-color: var(--w-act); }
.page.wire .lab-label { color: var(--w-muted); }
.page.wire .ev-box { background: var(--w-bg2); border-color: #3a4f7a; color: var(--w-ink); }
.page.wire .ev-stage li.ev-box { background: #111d36; }
.page.wire .ev-btn { background: transparent; color: var(--w-ink); border-color: var(--w-ink); }
.page.wire .ev-stage .heard { background: rgb(182 255 59 / 0.14); border-color: #b6ff3b; box-shadow: 0 0 0 0.2em #b6ff3b; }
.page.wire .em-form { background: var(--w-bg2); border-color: var(--w-line); color: var(--w-ink); }
.page.wire .em-form input:not([type=checkbox]), .page.wire .em-form select { background: #040812; color: var(--w-ink); border-color: var(--w-line); }
.page.wire ol.tasks li::marker { color: var(--w-act); }

/* ---------- task draw (market jam) ---------- */
.task-draw { display: grid; gap: 0.6em; }
.td-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35em; counter-reset: none; }
.td-list li { display: grid; grid-template-columns: 5.5em 1fr; gap: 0.6em; align-items: baseline; margin: 0; padding: 0.35em 0.6em; border-radius: 0.3em; background: rgb(255 255 255 / 0.05); }
.td-list li::before { display: none; }
.slide .td-list li { padding-left: 0.6em; }
.td-list b { font-family: var(--font-mono); font-size: 0.8em; color: var(--yellow); }
.td-btn { justify-self: start; font: 800 0.8em/1 var(--font-sans); background: var(--yellow); color: var(--ink); border: 0; border-radius: 99em; padding: 0.6em 1.1em; cursor: pointer; }

/* ==========================================================================
   Array lab — a chain of array methods, one row per stage
   ========================================================================== */
.array-lab { --al-bg: #060b17; --al-bg2: #0b1426; --al-line: #1f3052; --al-ink: #e3ecff; --al-muted: #8599c2; --al-act: var(--w-act, #3ee6ff);
  display: flex; flex-direction: column; gap: 0.6em; color: var(--al-ink); font-family: "IBM Plex Mono", var(--font-mono); }
.al-bar { display: flex; align-items: center; gap: 0.5em; background: var(--al-bg); border: 1.5px solid var(--al-line); border-left: 4px solid var(--al-act); border-radius: 6px; padding: 0.35em 0.5em 0.35em 0.8em; }
.al-prompt { color: var(--al-act); font-weight: 700; }
.al-input { flex: 1; min-width: 0; font: 500 1em/1.4 "IBM Plex Mono", var(--font-mono); color: #fff; background: transparent; border: 0; outline: 0; padding: 0.3em 0; font-variant-ligatures: none; }
.al-out { display: flex; flex-direction: column; gap: 0.45em; min-height: 2em; overflow: auto; }
.al-row { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr) auto; gap: 0.4em 0.8em; align-items: center; padding: 0.5em 0.7em; background: var(--al-bg2); border: 1.5px solid var(--al-line); border-radius: 6px; position: relative; }
.al-row + .al-row::before { content: "↓"; position: absolute; left: 1.2em; top: -0.95em; color: var(--al-muted); font-size: 0.8em; }
.al-row.last { border-color: var(--al-act); box-shadow: 0 0 0 1px var(--al-act) inset; }
.al-row.err { border-color: #ff6b4a; }
.al-row.warn { border-color: #ffb547; border-style: dashed; }
.al-row.warn .al-step { color: #ffb547; }
.al-step { font-size: 0.82em; color: var(--al-act); white-space: pre-wrap; word-break: break-word; background: none !important; border: 0 !important; padding: 0 !important; }
.al-items { display: flex; flex-wrap: wrap; gap: 0.35em; min-width: 0; }
.al-meta { font-size: 0.68em; color: var(--al-muted); white-space: nowrap; }
.al-hint { grid-column: 1 / -1; font-size: 0.72em; color: #ffd27a; }
.al-card { position: relative; display: inline-flex; align-items: baseline; gap: 0.35em; padding: 0.3em 0.6em; border: 1.5px solid var(--al-line); border-radius: 6px; background: #111d36; font-family: "Space Grotesk", var(--font-sans); font-size: 0.86em; white-space: nowrap; }
.al-card i { font-style: normal; }
.al-card b { font-weight: 600; color: #fff; }
.al-card small { color: #b6ff3b; font-family: "IBM Plex Mono", var(--font-mono); font-size: 0.85em; }
.al-card.sold { opacity: 0.7; }
.al-card em { font: 700 0.62em/1 "IBM Plex Mono", var(--font-mono); text-transform: uppercase; color: #ff6b4a; border: 1.5px solid #ff6b4a; border-radius: 4px; padding: 0.15em 0.3em; font-style: normal; align-self: center; }
.al-val { padding: 0.25em 0.55em; border-radius: 6px; border: 1.5px solid var(--al-line); background: #111d36; font-size: 0.86em; white-space: pre; }
.al-string { color: #9fe6c8; } .al-number, .al-boolean { color: #b6ff3b; } .al-undefined, .al-null { color: #ff6b4a; border-style: dashed; }
.al-empty { color: var(--al-muted); font-size: 0.86em; }
.al-errmsg { color: #ff8a70; font-size: 0.86em; }
.al-presets .chip-btn { font-family: "IBM Plex Mono", var(--font-mono); text-transform: none; letter-spacing: 0; }
.slide .array-lab { font-size: 26px; }
.slide.wire .array-lab .chip-btn { background: transparent; color: var(--w-ink); border-color: var(--w-line); }
.page.wire.remember { --w-act: #ffb547; }
.page.wire.modules { --w-act: #a98bff; }
.page.wire.debug { --w-act: #ff6b5a; }
.live-js[data-console="big"] .js-right { grid-template-rows: minmax(0, 0.8fr) minmax(0, 1.5fr); }
.live-js[data-console="only"] .live-preview { display: none; }
.live-js[data-console="only"] .js-right { grid-template-rows: minmax(0, 1fr); }
.live-js[data-layout="wider-code"] { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }

/* ---------- checks above the editor, larger: the definition of done comes first ---------- */
.live-js:has(> .live-checks) { grid-template-rows: auto minmax(0, 1fr); }
.live-js > .live-checks { grid-row: 1; font-size: 1em; gap: 0.5em 0.6em; align-items: center; }
.live-js > .live-checks::before { content: "Done when"; font: 600 0.72em/1 "IBM Plex Mono", var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-right: 0.2em; }
.page.wire .live-js > .live-checks::before { color: var(--w-muted); }
.live-js > .live-checks li { padding: 0.5em 0.9em; }
.live-js:has(> .live-checks) > .live-pane, .live-js:has(> .live-checks) > .js-right { grid-row: 2; }
@media (max-width: 760px) {
  .live-js, .live-js[data-layout] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; height: auto !important; }
  .live-js > .live-pane { grid-row: 2; min-height: 24rem; }
  .live-js > .js-right { grid-row: 3; }
}

/* ==========================================================================
   Lecture 8 · the network: Network tab in the JS editors, request lab, race lab
   ========================================================================== */
.js-tab { font: inherit; text-transform: inherit; letter-spacing: inherit; color: var(--code-muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.15em 0.2em; cursor: pointer; }
.js-tab[aria-pressed="true"] { color: var(--code-ink); border-bottom-color: #3ee6ff; }
.js-tab b { display: inline-block; min-width: 1.4em; padding: 0.1em 0.35em; margin-left: 0.2em; border-radius: 99px; background: #2f2b27; color: var(--code-ink); text-align: center; font-weight: 700; }
.net-list li { padding: 0 !important; }
.net-list .n-line { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto 4.2em; gap: 0.6em; width: 100%; padding: 0.25em 0.8em; cursor: pointer; }
.net-list .n-line:hover, .net-list .n-line:focus-visible { background: #1f1c19; }
.net-list .n-m { font-weight: 700; color: #82ccff; }
.net-list .n-u { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-list .n-st { font-weight: 700; text-align: right; }
.net-list .n-ms { color: var(--code-muted); text-align: right; }
.net-row.n-2xx .n-st { color: #8ff0a4; }
.net-row.n-3xx .n-st { color: #82ccff; }
.net-row.n-4xx .n-st { color: #ffd76a; }
.net-row.n-5xx .n-st, .net-row.n-failed .n-st { color: #ff8a70; }
.net-row.n-failed .n-u, .net-row.n-5xx .n-u { color: #ff9d8a; }
.net-row.n-canceled .n-u, .net-row.n-canceled .n-st { color: var(--code-muted); text-decoration: line-through; }
.net-row.n-pending .n-st { color: var(--code-muted); font-weight: 500; }
.n-detail { padding: 0.3em 0.8em 0.6em 1.6em; background: #1a1714; border-top: 1px solid #2a2622; }
.n-detail b { display: block; font: 700 0.85em/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--code-muted); margin-top: 0.4em; }
.n-detail pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--code-ink); font: inherit; max-height: 14em; overflow: auto; }
.n-detail p { margin: 0.4em 0 0; color: #ffd9a8; font-family: var(--font-sans); }

/* request lab */
.request-lab { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); gap: 0.55em; min-height: 0; font-size: 1em; }
.request-lab select, .request-lab input, .request-lab textarea { font: 500 0.8em/1.4 var(--font-mono); color: var(--code-ink); background: var(--code-bg-2); border: 0.12em solid #3a3631; border-radius: 0.4em; padding: 0.45em 0.6em; min-width: 0; }
.request-lab textarea { resize: none; width: 100%; box-sizing: border-box; }
.rl-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.5em; align-items: stretch; }
.rl-line select { font-weight: 700; color: #82ccff; }
.rl-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 0.6em; }
.rl-in label { display: grid; gap: 0.3em; color: var(--muted); }
.rl-in label span { font: 600 0.62em/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.rl-presets { display: flex; flex-wrap: wrap; gap: 0.35em; }
.rl-chip { font: 600 0.64em/1 var(--font-mono); color: var(--ink); background: var(--white); border: 0.12em solid var(--ink); border-radius: 99px; padding: 0.45em 0.75em; cursor: pointer; }
.rl-chip:hover, .rl-chip:focus-visible { background: var(--yellow); }
.rl-out { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); gap: 0.6em; min-height: 12em; }
.rl-box { display: flex; flex-direction: column; min-height: 0; background: var(--code-bg-2); border: 0.12em solid var(--ink); border-radius: 0.5em; overflow: hidden; }
.rl-bar { display: flex; align-items: center; gap: 0.6em; padding: 0.35em 0.7em; background: #262320; font: 700 0.62em/1 var(--font-mono); color: var(--code-muted); letter-spacing: 0.06em; text-transform: uppercase; flex: none; }
.rl-raw, .rl-code { flex: 1; min-height: 0; margin: 0; padding: 0.6em 0.8em; overflow: auto; font: 400 0.68em/1.5 var(--font-mono); color: var(--code-ink); white-space: pre-wrap; overflow-wrap: anywhere; background: none; border: 0; }
.rl-status { margin-left: auto; text-transform: none; letter-spacing: 0; }
.rl-status.s2 { color: #8ff0a4; } .rl-status.s3 { color: #82ccff; } .rl-status.s4 { color: #ffd76a; } .rl-status.s5 { color: #ff8a70; }
.page.wire .rl-chip { background: var(--w-bg2); color: var(--w-ink); border-color: var(--w-line); }
.page.wire .rl-chip:hover, .page.wire .rl-chip:focus-visible { border-color: var(--w-act); color: var(--w-act); background: var(--w-bg2); }
.page.wire .rl-box, .page.wire .request-lab select, .page.wire .request-lab input, .page.wire .request-lab textarea { border-color: var(--w-line); }
.page.wire .rl-in label { color: var(--w-muted); }
.slide .rl-chip { background: #0b1426; color: #e3ecff; border-color: #1f3052; }
.slide .rl-chip:hover { border-color: var(--act, #3ee6ff); color: var(--act, #3ee6ff); background: #0b1426; }
.slide .rl-box, .slide .request-lab select, .slide .request-lab input, .slide .request-lab textarea { border-color: #1f3052; }
.slide .rl-in label { color: #8599c2; }

/* race lab */
.race-lab { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0.6em; min-height: 0; }
.rc-top { display: flex; flex-wrap: wrap; gap: 0.5em; align-items: center; }
.rc-modes { display: flex; flex-wrap: wrap; gap: 0.35em; align-items: center; margin-right: auto; }
.rc-mode { font: 600 0.7em/1 var(--font-mono); color: inherit; background: transparent; border: 0.12em solid currentColor; border-radius: 99px; padding: 0.5em 0.85em; cursor: pointer; opacity: 0.7; }
.rc-mode[aria-pressed="true"] { opacity: 1; background: #3ee6ff; color: #03101b; border-color: #3ee6ff; }
.rc-deb { font: 500 0.7em/1 var(--font-mono); display: flex; gap: 0.35em; align-items: center; margin-left: 0.4em; }
.rc-main { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.6fr); gap: 0.9em; min-height: 0; }
.rc-ui { display: flex; flex-direction: column; gap: 0.4em; min-height: 0; }
.rc-input { font: 500 0.9em/1.3 var(--font-mono); padding: 0.4em 0.7em; border-radius: 0.4em; border: 0.12em solid #1f3052; background: #0b1426; color: #e3ecff; }
.rc-verdict { margin: 0; font: 600 0.66em/1.35 var(--font-mono); padding: 0.45em 0.6em; border-radius: 0.4em; background: #0b1426; color: #8599c2; }
.rc-verdict.ok { color: #b6ff3b; background: rgb(182 255 59 / 0.1); }
.rc-verdict.bad { color: #ff8a70; background: rgb(255 107 90 / 0.14); }
.rc-verdict.wait { color: #ffd76a; }
.rc-results { list-style: none; margin: 0; padding: 0; overflow: auto; font-size: 0.7em; }
.rc-results li { padding: 0.25em 0.5em; border-bottom: 1px solid #1f3052; margin: 0; }
.rc-results li::before { display: none; }
.rc-results .rc-empty { color: #8599c2; font-style: italic; }
.rc-time { position: relative; display: flex; flex-direction: column; min-height: 0; border-left: 1.5px solid #1f3052; padding-left: 0.6em; }
.rc-lanes { display: flex; flex-direction: column; gap: 0.3em; overflow: auto; flex: 1; }
.rc-lane { position: relative; height: 1.5em; flex: none; }
.rc-q { position: absolute; left: 0; top: 0; font: 600 0.62em/2.4 var(--font-mono); color: #8599c2; width: 4.5em; }
.rc-bar { position: absolute; top: 0.15em; height: 1.2em; margin-left: 3em; max-width: calc(100% - 3em); border-radius: 0.25em; background: #2a3b63; font: 700 0.55em/2.2 var(--font-mono); font-style: normal; color: #03101b; white-space: nowrap; overflow: hidden; padding: 0 0.5em; box-sizing: border-box; }
.rc-lane.pending .rc-bar { background: repeating-linear-gradient(90deg, #2a3b63 0 8px, #3a4f80 8px 16px); }
.rc-lane.rendered .rc-bar { background: #b6ff3b; }
.rc-lane.replaced .rc-bar { background: #ff6b5a; }
.rc-lane.dropped .rc-bar, .rc-lane.aborted .rc-bar { background: #34405c; color: #a9b6d6; }
.rc-axis { position: relative; height: 1.2em; border-top: 1.5px solid #1f3052; margin-left: 3em; font: 500 0.5em/2 var(--font-mono); color: #8599c2; }
.rc-axis span { position: absolute; transform: translateX(-10%); }
.rc-code { margin: 0; font-size: 0.72em !important; padding: 0.6em 1em !important; }
.page .race-lab { color: var(--w-ink, var(--ink)); }
.rl-in textarea { min-height: 5.5em; }
.request-lab pre.rl-code { white-space: pre-wrap !important; overflow-wrap: anywhere; font-size: 0.68em !important; }
.rc-lane { height: 1.7em; }
.rc-bar { display: flex; align-items: center; height: 1.4em; line-height: 1; font-size: 0.55em; }
.rc-bar { top: 0.15em; height: 2.4em; }

/* event loop lab */
.loop-lab { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0.6em; min-height: 0; color: #e3ecff; }
.ll-top { display: flex; flex-wrap: wrap; gap: 0.45em; align-items: center; }
.ll-top .spacer { flex: 1; }
.ll-tabs { display: flex; flex-wrap: wrap; gap: 0.35em; }
.ll-tab { font: 600 0.62em/1 var(--font-mono); color: inherit; background: transparent; border: 0.12em solid #1f3052; border-radius: 99px; padding: 0.5em 0.85em; cursor: pointer; }
.ll-tab[aria-pressed="true"] { background: #b6ff3b; color: #03101b; border-color: #b6ff3b; }
.ll-count { font: 600 0.62em/1 var(--font-mono); color: #8599c2; margin-right: 0.3em; }
.loop-lab .live-btn { font-size: 0.62em; }
.loop-lab .live-btn:disabled { opacity: 0.35; cursor: default; }
.ll-main { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0.8em; min-height: 0; }
.ll-code { margin: 0; padding: 0.6em 0; background: var(--code-bg-2); border: 0.12em solid #1f3052; border-radius: 0.5em; font: 400 0.6em/1.7 var(--font-mono); font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; overflow: auto; color: var(--code-ink); }
.ll-line { white-space: pre; padding-right: 0.8em; }
.ll-ln { display: inline-block; width: 2.6em; padding-right: 0.9em; text-align: right; color: #4d5b7a; user-select: none; }
.ll-line.on { background: rgb(182 255 59 / 0.14); box-shadow: inset 0.25em 0 0 #b6ff3b; }
.ll-state { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)) minmax(0, 0.9fr); grid-template-areas: "stack apis" "stack micro" "stack tasks" "out out"; gap: 0.45em; min-height: 0; }
.ll-box { border: 0.12em solid var(--c, #1f3052); border-radius: 0.5em; padding: 0.4em 0.55em; background: color-mix(in srgb, var(--c, #1f3052) 8%, #060b17); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.ll-box b { font: 600 0.5em/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--c, #8599c2); margin-bottom: 0.35em; }
.ll-stack { --c: #3ee6ff; grid-area: stack; }
.ll-stack .ll-items { flex: 1; justify-content: flex-end; }
.ll-apis { --c: #ffb547; grid-area: apis; }
.ll-micro { --c: #ff4fd8; grid-area: micro; }
.ll-tasks { --c: #a98bff; grid-area: tasks; }
.ll-out { --c: #b6ff3b; grid-area: out; }
.ll-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25em; }
.ll-items li { font: 500 0.55em/1.3 var(--font-mono); font-variant-ligatures: none; padding: 0.3em 0.5em; border-radius: 0.3em; background: color-mix(in srgb, var(--c) 16%, transparent); margin: 0; }
.slide .ll-items li { padding-left: 0.5em; }
.ll-items li::before { display: none !important; }
.ll-items li.new { outline: 0.12em solid var(--c); }
.ll-out .ll-items { flex-direction: row; flex-wrap: wrap; }
.ll-note { margin: 0; font: 500 0.66em/1.4 var(--font-sans, system-ui); color: #cfdcf7; min-height: 2.9em; padding: 0.5em 0.8em; border-left: 0.2em solid #b6ff3b; background: #0b1426; border-radius: 0.3em; }
