/* ===========================================================
   Design tokens. Every theme sets the same variables; components
   only ever read tokens, so themes and accent overrides just work.
   =========================================================== */
/* The look: strong neutrals from the theme, one accent, a flat full-width top bar with menus (after Awwwards),
   keycaps and a command palette (after Linea Prompt), mono "/ LABEL" headings, outlined type chips and a
   pop-up console (after Stripe Dot Dev), on a faint blueprint grid. No glows: depth comes from borders and
   one soft shadow. */
:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --radius: 14px; --radius-sm: 8px;
  --pad: 20px; --gap: 14px;
  /* Type scale: Home's headline, page titles, section headings, card headings, small text, mono labels */
  --fs-display: clamp(2.3rem, 1.4rem + 3.2vw, 3.9rem);
  --fs-title: clamp(1.8rem, 1.4rem + 1.3vw, 2.5rem);
  --fs-section: clamp(1.25rem, 1.1rem + .5vw, 1.5rem);
  --fs-h3: 1.08rem; --fs-sm: .875rem; --fs-label: .72rem;
  /* Space between a page's sections; cards inside a section use --gap */
  --section-gap: clamp(32px, 3.6vw, 56px);
  /* Spacing scale for components (4px steps), and the reading width for explanatory text */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --measure: 72ch;
}
[data-density="compact"] { --pad: 14px; --gap: 10px; }

/* Paper (light): cool blueprint paper with an indigo accent */
[data-theme="light"] {
  --bg: #edf2f7; --surface: #fbfcfe; --surface-2: #f1f5f9; --text: #0f1724; --muted: #56647a;
  --line: rgba(15, 30, 60, .09); --line-strong: rgba(15, 30, 60, .17);
  --accent: #3c43c6; --accent-ink: #ffffff;
  --ok: #15803d; --warn: #b45309; --bad: #dc2626;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #f4f7fb; --panel-text: #1d2433;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 2px rgba(16, 30, 60, .04), 0 18px 40px -30px rgba(37, 50, 72, .55);
  color-scheme: light;
}
/* Ink (dark): deep navy with a teal accent */
[data-theme="dark"] {
  --bg: #011627; --surface: #041f36; --surface-2: #082943; --text: #d9e2ec; --muted: #7f9bb4;
  --line: rgba(160, 190, 220, .11); --line-strong: rgba(160, 190, 220, .22);
  --accent: #75d1c4; --accent-ink: #011627;
  --ok: #5ee0a0; --warn: #f2c94c; --bad: #ff7b8a;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #00111f; --panel-text: #d6e2ee;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 18px 40px -26px rgba(0, 0, 0, .75);
  color-scheme: dark;
}
/* Midnight (deep blue) */
[data-theme="midnight"] {
  --bg: #060a16; --surface: #0c1224; --surface-2: #131b33; --text: #e5eaf5; --muted: #8a95b2;
  --line: rgba(160, 180, 255, .09); --line-strong: rgba(160, 180, 255, .18);
  --accent: #4f8cff; --accent-ink: #060a16; /* dark text on the bright blue: 6.1:1 (white was 3.2:1) */
  --ok: #34d399; --warn: #fbbf24; --bad: #fb7185;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #080d1c; --panel-text: #d5ddf2;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Nord */
[data-theme="nord"] {
  --bg: #2e3440; --surface: #353c4a; --surface-2: #3b4252; --text: #eceff4; --muted: #a7b0c2;
  --line: rgba(236, 239, 244, .08); --line-strong: rgba(236, 239, 244, .16);
  --accent: #88c0d0; --accent-ink: #2e3440;
  --ok: #a3be8c; --warn: #ebcb8b; --bad: #bf616a;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #2b303b; --panel-text: #e5e9f0;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 8px 24px -14px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
/* Sand (warm light) */
[data-theme="sand"] {
  --bg: #f6f2ea; --surface: #fffdf8; --surface-2: #f1ebdf; --text: #2a251e; --muted: #776c5d;
  --line: rgba(70, 50, 20, .10); --line-strong: rgba(70, 50, 20, .20);
  --accent: #b44e19; --accent-ink: #ffffff;
  --ok: #4d7c0f; --warn: #b45309; --bad: #b91c1c;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #f6f2ea; --panel-text: #3b3329; /* light enough for muted and accent text to pass 4.5:1 */
  --shadow: 0 1px 2px rgba(60, 40, 10, .05), 0 10px 24px -14px rgba(60, 40, 10, .18);
  color-scheme: light;
}
/* Forest (dark green) */
[data-theme="forest"] {
  --bg: #0a120e; --surface: #101a15; --surface-2: #16221c; --text: #e2ece6; --muted: #8ea398;
  --line: rgba(190, 255, 220, .08); --line-strong: rgba(190, 255, 220, .16);
  --accent: #34d399; --accent-ink: #052e1c;
  --ok: #4ade80; --warn: #facc15; --bad: #f87171;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #0b1410; --panel-text: #d6e6dc;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 8px 24px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
/* Rosé (soft light) */
[data-theme="rose"] {
  --bg: #fcf6f7; --surface: #ffffff; --surface-2: #f8eef0; --text: #2b1d22; --muted: #80656e;
  --line: rgba(90, 20, 40, .08); --line-strong: rgba(90, 20, 40, .16);
  --accent: #d42660; --accent-ink: #ffffff;
  --ok: #15803d; --warn: #c2410c; --bad: #be123c;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #fbf3f5; --panel-text: #3a2830;
  --shadow: 0 1px 2px rgba(90, 20, 40, .04), 0 10px 24px -14px rgba(90, 20, 40, .14);
  color-scheme: light;
}
/* High contrast */
[data-theme="contrast"] {
  --bg: #000000; --surface: #0a0a0a; --surface-2: #161616; --text: #ffffff; --muted: #c8c8c8;
  --line: rgba(255, 255, 255, .28); --line-strong: rgba(255, 255, 255, .55);
  --accent: #ffd60a; --accent-ink: #000000;
  --ok: #5cff8a; --warn: #ffd60a; --bad: #ff6b6b;
  --code-bg: #000000; --code-text: #ffffff; --panel-bg: #000000; --panel-text: #ffffff;
  --shadow: none;
  color-scheme: dark;
}
/* ---- Palettes from popular editor themes and duotone pairings: one base colour family and one accent each.
   Success / warning / error come from the same palette; code blocks stay on Dark+ everywhere. ---- */
/* Tokyo Night: night blue + blue (folke/tokyonight) */
[data-theme="tokyo"] {
  --bg: #16161e; --surface: #1a1b26; --surface-2: #24283b; --text: #c0caf5; --muted: #8189b4;
  --line: rgba(122, 162, 247, .09); --line-strong: rgba(122, 162, 247, .18);
  --accent: #7aa2f7; --accent-ink: #16161e;
  --ok: #9ece6a; --warn: #e0af68; --bad: #f7768e;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #13131a; --panel-text: #a9b1d6;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Catppuccin Mocha: dark pastel + mauve (catppuccin.com/palette) */
[data-theme="mocha"] {
  --bg: #181825; --surface: #1e1e2e; --surface-2: #313244; --text: #cdd6f4; --muted: #9399b2;
  --line: rgba(205, 214, 244, .09); --line-strong: rgba(205, 214, 244, .18);
  --accent: #cba6f7; --accent-ink: #1e1e2e;
  --ok: #a6e3a1; --warn: #f9e2af; --bad: #f38ba8;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #11111b; --panel-text: #bac2de;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Rosé Pine: muted purple + rose */
[data-theme="rosepine"] {
  --bg: #191724; --surface: #1f1d2e; --surface-2: #26233a; --text: #e0def4; --muted: #908caa;
  --line: rgba(224, 222, 244, .09); --line-strong: rgba(224, 222, 244, .18);
  --accent: #ebbcba; --accent-ink: #191724;
  --ok: #9ccfd8; --warn: #f6c177; --bad: #eb6f92;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #16141f; --panel-text: #e0def4;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Dracula: dark grey-purple + purple */
[data-theme="dracula"] {
  --bg: #21222c; --surface: #282a36; --surface-2: #343746; --text: #f8f8f2; --muted: #959dcb;
  --line: rgba(248, 248, 242, .09); --line-strong: rgba(248, 248, 242, .18);
  --accent: #bd93f9; --accent-ink: #21222c;
  --ok: #50fa7b; --warn: #ffb86c; --bad: #ff5555;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #1e1f29; --panel-text: #f8f8f2;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Gruvbox (hard): retro brown + orange */
[data-theme="gruvbox"] {
  --bg: #1d2021; --surface: #282828; --surface-2: #32302f; --text: #ebdbb2; --muted: #a89984;
  --line: rgba(235, 219, 178, .09); --line-strong: rgba(235, 219, 178, .18);
  --accent: #fe8019; --accent-ink: #1d2021;
  --ok: #b8bb26; --warn: #fabd2f; --bad: #fb4934;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #1d2021; --panel-text: #d5c4a1;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Everforest: soft green-grey + sage */
[data-theme="everforest"] {
  --bg: #272e33; --surface: #2d353b; --surface-2: #343f44; --text: #d3c6aa; --muted: #9da9a0;
  --line: rgba(211, 198, 170, .09); --line-strong: rgba(211, 198, 170, .18);
  --accent: #a7c080; --accent-ink: #272e33;
  --ok: #83c092; --warn: #dbbc7f; --bad: #e67e80;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #232a2e; --panel-text: #d3c6aa;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Kanagawa: sumi ink + carp gold */
[data-theme="kanagawa"] {
  --bg: #16161d; --surface: #1f1f28; --surface-2: #2a2a37; --text: #dcd7ba; --muted: #a09d8f;
  --line: rgba(220, 215, 186, .09); --line-strong: rgba(220, 215, 186, .18);
  --accent: #e6c384; --accent-ink: #16161d;
  --ok: #98bb6c; --warn: #ffa066; --bad: #e46876;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #16161d; --panel-text: #c8c093;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Navy & Peach: a duotone pairing */
[data-theme="peach"] {
  --bg: #0b1730; --surface: #102043; --surface-2: #172a54; --text: #f3e9e2; --muted: #9aa6c4;
  --line: rgba(243, 233, 226, .09); --line-strong: rgba(243, 233, 226, .18);
  --accent: #ffb38a; --accent-ink: #0b1730;
  --ok: #7fdcb0; --warn: #ffd27a; --bad: #ff8a80;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #091327; --panel-text: #e9e1db;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Violet & Lime: a duotone pairing (ultraviolet + neon lime) */
[data-theme="lime"] {
  --bg: #14002f; --surface: #1e0045; --surface-2: #2a0a5c; --text: #f1ecff; --muted: #a99dcb;
  --line: rgba(241, 236, 255, .09); --line-strong: rgba(241, 236, 255, .18);
  --accent: #ccff00; --accent-ink: #14002f;
  --ok: #5cf2a0; --warn: #ffd166; --bad: #ff6b9a;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #11002a; --panel-text: #e6defc;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* Catppuccin Latte: light pastel + mauve (catppuccin.com/palette) */
[data-theme="latte"] {
  --bg: #e6e9ef; --surface: #eff1f5; --surface-2: #dce0e8; --text: #4c4f69; --muted: #5c5f77;
  --line: rgba(76, 79, 105, .10); --line-strong: rgba(76, 79, 105, .20);
  --accent: #8437e8; --accent-ink: #ffffff; /* Latte mauve, a touch deeper: 4.6:1 on the page as well as on cards */
  --ok: #40a02b; --warn: #df8e1d; --bad: #d20f39;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #eff1f5; --panel-text: #4c4f69;
  --shadow: 0 1px 2px rgba(76, 79, 105, .05), 0 10px 24px -14px rgba(76, 79, 105, .2);
  color-scheme: light;
}
/* Rosé Pine Dawn: warm cream + pine */
[data-theme="dawn"] {
  --bg: #f2e9e1; --surface: #fffaf3; --surface-2: #faf4ed; --text: #575279; --muted: #696580;
  --line: rgba(87, 82, 121, .10); --line-strong: rgba(87, 82, 121, .20);
  --accent: #286983; --accent-ink: #ffffff;
  --ok: #56949f; --warn: #ea9d34; --bad: #b4637a;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #fffaf3; --panel-text: #575279;
  --shadow: 0 1px 2px rgba(87, 82, 121, .05), 0 10px 24px -14px rgba(87, 82, 121, .2);
  color-scheme: light;
}
/* Solarized Light: cream + blue */
[data-theme="solarized"] {
  --bg: #eee8d5; --surface: #fdf6e3; --surface-2: #f5efdc; --text: #073642; --muted: #556b72;
  --line: rgba(7, 54, 66, .10); --line-strong: rgba(7, 54, 66, .20);
  --accent: #1d6aa6; --accent-ink: #ffffff; /* Solarized blue, deepened so buttons and links pass 4.5:1 on cream and on the page */
  --ok: #859900; --warn: #b58900; --bad: #dc322f;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #fdf6e3; --panel-text: #586e75;
  --shadow: 0 1px 2px rgba(7, 54, 66, .05), 0 10px 24px -14px rgba(7, 54, 66, .2);
  color-scheme: light;
}
/* Crimson & Cream: a duotone pairing */
[data-theme="crimson"] {
  --bg: #f3eadb; --surface: #fffaf0; --surface-2: #f6eee0; --text: #2b1418; --muted: #7d6260;
  --line: rgba(70, 20, 25, .10); --line-strong: rgba(70, 20, 25, .20);
  --accent: #b3122e; --accent-ink: #ffffff;
  --ok: #3f7d2c; --warn: #b45f06; --bad: #8f0d24;
  --code-bg: #1e1e1e; --code-text: #d4d4d4; --panel-bg: #fffaf0; --panel-text: #3a2025;
  --shadow: 0 1px 2px rgba(70, 20, 25, .05), 0 10px 24px -14px rgba(70, 20, 25, .2);
  color-scheme: light;
}
/* Derived tokens follow the accent automatically (including user overrides). */
:root, [data-theme] {
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 40%, transparent);
  --hover: color-mix(in srgb, var(--text) 5%, transparent);
  --grid: color-mix(in srgb, var(--text) 3.2%, transparent);
  --glass: color-mix(in srgb, var(--surface) 80%, transparent);
  --glass-edge: color-mix(in srgb, var(--text) 10%, transparent);
  --lift: 0 24px 60px -40px rgba(10, 20, 40, .75);
  --edge-hi: rgba(255, 255, 255, .05);
  /* Status colours for text (badges, results, the timer). Some palettes' green, amber and red are fill colours that
     fall below 4.5:1 as text, so text uses them pulled toward white on dark themes and toward black on light ones. */
  --ink-base: #ffffff; --ink-p: 80%;
  --ok-ink: color-mix(in srgb, var(--ok) var(--ink-p), var(--ink-base));
  --warn-ink: color-mix(in srgb, var(--warn) var(--ink-p), var(--ink-base));
  --bad-ink: color-mix(in srgb, var(--bad) var(--ink-p), var(--ink-base));
  /* Muted text on chips and inset surfaces (surface-2), a touch stronger than --muted */
  --muted-ink: color-mix(in srgb, var(--muted) 85%, var(--text));
}
[data-theme="light"], [data-theme="sand"], [data-theme="rose"], [data-theme="latte"], [data-theme="dawn"], [data-theme="solarized"], [data-theme="crimson"] { --edge-hi: rgba(255, 255, 255, .85); --ink-base: #000000; --ink-p: 60%; }
[data-theme="nord"] { --bad-ink: color-mix(in srgb, var(--bad) 55%, #ffffff); }
[data-theme="contrast"] { --grid: transparent; --glass: var(--surface); --glass-edge: var(--line-strong); }

/* ===========================================================
   Base
   =========================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font-family: var(--font); font-size: 1rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* A faint 32px blueprint grid on the theme's base colour */
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
::selection { background: var(--accent-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.25; text-wrap: balance; }
/* A page's title is its h1 (lessons and reference pages too); h2 shares the size where it's a section title */
h1, h2 { font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.04em; line-height: 1.08; margin: 4px 0 8px; }
h3 { font-size: var(--fs-h3); font-weight: 600; margin: 18px 0 8px; }
h1 .muted, h2 .muted { font-size: 1rem; font-weight: 500; letter-spacing: 0; }
p { margin: 8px 0; }
.muted { color: var(--muted); font-size: var(--fs-sm); }
/* Inline code keeps the full text colour even inside muted text (lessons tint it with the accent instead) */
code { font-family: var(--mono); font-size: .85em; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 6px; }
b, strong { font-weight: 600; }
ul, ol { padding-left: 1.3em; } li { margin: 4px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Headings and the page take focus after navigation and from the skip link (go, focusPage); they aren't controls */
[tabindex="-1"]:focus { outline: none; }
.skip-link { position: absolute; left: 12px; top: -64px; z-index: 60; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.skip-link:focus { top: 10px; text-decoration: none; }

/* ===========================================================
   Top bar & navigation
   =========================================================== */
/* The page uses the whole window: one fluid side gutter, from 16px on phones up to 56px on wide screens. */
:root { --gutter: clamp(16px, 3.2vw, 56px); --head-h: 60px; }
/* Header: a full-width bar with the brand, text links that open menus, and round buttons and pills on the right */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-inner { height: var(--head-h); display: flex; align-items: center; gap: clamp(12px, 2vw, 32px);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--text); font: inherit; text-align: left; flex-shrink: 0; }
.logo { width: 30px; height: 30px; display: block; }
/* Brand, then its descriptor set apart by a thin rule; the descriptor only shows when there's room */
.brand-name { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.brand-desc { display: none; padding-left: 10px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: .84rem; font-weight: 500; white-space: nowrap; line-height: 1.2; }
@media (min-width: 1280px) { .brand-desc { display: inline; } }
nav#nav { display: flex; align-items: center; gap: 2px; flex: 1; }
nav#nav > button, .dd > button { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font: 500 .9rem var(--font); letter-spacing: -0.01em; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
nav#nav > button:hover { background: var(--hover); }
nav#nav > button.active, .dd > button.active { color: var(--accent); font-weight: 600; }
nav#nav > button.active::after, .dd > button.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: calc((36px - var(--head-h)) / 2); height: 2px; border-radius: 2px; background: var(--accent); }
.chev { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2.2; opacity: .6; transition: transform .2s; flex-shrink: 0; }
/* Learn and Jobs: the label goes to the section, the chevron beside it opens the menu. Together they read as one
   item: one hover background, the current-section bar under the label only. */
.dd { position: relative; display: flex; align-items: center; border-radius: 8px; transition: background .15s; }
.dd > .dd-label { padding-right: 4px; }
.dd > .dd-label.active::after { right: 4px; }
.dd > .dd-toggle { width: 28px; padding: 0; justify-content: center; }
.dd > .dd-toggle .chev { width: 11px; height: 11px; opacity: .75; }
.dd.open { background: var(--hover); }
.dd.open .chev { transform: rotate(180deg); }
/* A mega menu: columns of links and an "up next" card. It opens from the chevron (or Down arrow), and on hover
   where there is a mouse; app.js sets .open, and .shut keeps it closed after a pick until the pointer leaves. */
.dd-panel { position: absolute; left: -8px; top: calc(100% + 10px); z-index: 30; display: none; width: max-content;
  padding: 18px 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 30px 70px -30px rgba(10, 20, 40, .55); animation: pal-in .16s ease-out; transform-origin: 20% 0; }
.dd-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.dd.open .dd-panel { display: block; }
@media (hover: hover) {
  .dd:hover { background: var(--hover); }
  .dd:hover .dd-panel { display: block; }
  .dd:hover .chev { transform: rotate(180deg); }
}
.dd-panel .mn-cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, auto); gap: 6px 28px; }
.dd.shut .dd-panel { display: none; }
.dd.shut .chev { transform: none; }
.mn-col { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mn-h { font: 500 var(--fs-label) var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 2px 10px 8px; }
.mn-i + .mn-h { margin-top: 12px; }
.mn-intro { max-width: 56ch; margin: 0 10px 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .86rem; line-height: 1.5; white-space: normal; }
.mn-i { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--text);
  font: 450 .88rem var(--font); text-align: left; cursor: pointer; white-space: nowrap; }
.mn-i:hover, .mn-i:focus-visible { background: var(--hover); }
.mn-i.on { color: var(--accent); background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); font-weight: 600; }
.mn-i small { font: .7rem var(--mono); color: var(--muted); }
.mn-next { width: 240px; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.mn-next b { font-size: .95rem; letter-spacing: -0.01em; line-height: 1.3; white-space: normal; }
.mn-next .muted { font-size: .8rem; }
.mn-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 10px 0; margin-top: 12px; border-top: 1px solid var(--line); font: .7rem var(--mono); color: var(--muted); }
[data-keys="off"] .mn-foot .k { display: none; }
/* Right side: round icon buttons, then an outline pill and a solid pill */
.top-r { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.top-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line-strong); }
nav#nav svg, .icon-btn svg, .pill-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; flex-shrink: 0; transition: border-color .15s, transform .15s; }
.icon-btn:hover { border-color: var(--line-strong); }
#theme-quick:hover { transform: rotate(-12deg); }
.pill-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 999px; font: 600 .86rem var(--font); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text); transition: background .15s, border-color .15s, transform .1s; }
.pill-btn:hover { border-color: var(--text); }
.pill-btn:active { transform: translateY(1px); }
.pill-btn.solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill-btn.solid:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill-btn svg { width: 16px; height: 16px; stroke-width: 2; }
.console-btn.on, .icon-btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.menu-btn { display: none; }
/* Narrow windows (and large text sizes): links move into a menu sheet under the header. app.js sets
   .tight below 980px or whenever the links don't fit (fitHeader). */
.menu-sheet { display: none; }
/* Console and Settings are in the sheet's Tools row, and one burger icon is enough. The primary action stays. */
.topbar.tight nav#nav, .topbar.tight .console-btn, .topbar.tight #settings-open, .topbar.tight .top-sep { display: none; }
.topbar.tight .menu-btn { display: grid; }
.topbar.tight #top-cta { padding: 0 14px; }
.topbar.tight.menu-open .menu-sheet { display: block; max-height: calc(100vh - var(--head-h)); overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line);
  padding: 6px max(var(--gutter), env(safe-area-inset-right, 0px)) 20px max(var(--gutter), env(safe-area-inset-left, 0px)); background: var(--surface); }
.menu-sheet .mn-sec { padding: 6px 0; border-bottom: 1px solid var(--line); }
.menu-sheet .mn-top { width: 100%; min-height: 48px; font: 600 1.05rem var(--font); padding: 10px; }
.menu-sheet .mn-top.on { box-shadow: inset 3px 0 0 var(--accent); }
.menu-sheet [data-sheet][aria-expanded="true"] .chev { transform: rotate(180deg); }
.menu-sheet .mn-sub { padding: 4px 0 10px; }
.menu-sheet .mn-intro { border-bottom: 0; padding-bottom: 0; }
.menu-sheet .mn-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 16px; }
.menu-sheet .mn-next { width: auto; }
.menu-sheet .mn-i { white-space: normal; }
.mn-tools { padding: 14px 0 0; }
.mn-tools .row { gap: 8px; padding: 0 2px; }
.mn-tools .pill-btn.on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
@media (max-width: 640px) {
  /* The next lesson comes first in the Learn section */
  .menu-sheet .mn-col:has(.mn-next) { order: -1; grid-column: 1 / -1; }
}
@media (max-width: 480px) { .brand-name { display: none; } }

/* ===========================================================
   Layout & surfaces
   =========================================================== */
main { padding: 26px max(var(--gutter), env(safe-area-inset-right, 0px)) 60px max(var(--gutter), env(safe-area-inset-left, 0px)); animation: fade-in .25s ease; }
/* Long reading text keeps a comfortable line length even on very wide screens */
.lesson-body > p, .lesson-body > ul, .lesson-body > ol, .lesson-body > h2 { max-width: 80ch; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--pad); margin-bottom: var(--gap); box-shadow: var(--shadow);
}
.card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: var(--gap); }
.grid .card { margin-bottom: 0; }
@media (max-width: 640px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat { font-size: 1.5rem; } }
.cols-2 { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2, .section-head h3 { margin: 0; }
/* Page header (pageHead in app.js): eyebrow, the page's h1, what the page is for, actions, and an optional aside */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4) var(--space-6); margin: 0 0 var(--space-5); }
.page-head-main { flex: 1 1 420px; min-width: 0; }
.page-head .eyebrow { margin: 0 0 var(--space-2); }
.page-head h1 { margin: 0 0 var(--space-2); }
.page-sub { margin: 0; max-width: var(--measure); color: var(--prose); font-size: 1rem; line-height: 1.6; }
.page-actions { margin-top: var(--space-4); gap: var(--space-2) var(--space-3); }
.page-head-aside { flex-shrink: 0; }
/* A heading inside a card, whatever its level (the level follows the page outline; the size stays a card's) */
.card-title { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; margin: 0 0 var(--space-2); }
/* Text for screen readers only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Stats */
.stat { font-size: 1.85rem; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; margin: 4px 0 2px; }
.stat small { font-size: .95rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.label { font: 500 var(--fs-label) var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }

.eyebrow { font: 500 var(--fs-label) var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--accent); }
/* Home: the purpose in one headline, one primary action, the course in numbers, then the four parts of the site */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: clamp(24px, 4vw, 72px); align-items: center;
  padding: clamp(12px, 3vw, 44px) 0 var(--section-gap); margin-bottom: var(--section-gap); border-bottom: 1px solid var(--line); }
.home-hero h1 { font-size: var(--fs-display); font-weight: 700; letter-spacing: -0.045em; line-height: 1.02; margin: 14px 0 18px; max-width: 17ch; }
.home-hero .lead { font-size: clamp(1.02rem, .95rem + .3vw, 1.18rem); line-height: 1.6; color: var(--prose); max-width: 62ch; margin: 0; }
.hh-cta { margin-top: 28px; gap: 10px 16px; }
.hh-more { margin: 14px 0 0; font-size: .92rem; }
.hh-facts { padding: 20px 22px 8px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.hh-facts dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 12px 0 0; }
.hh-facts dl > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: 12px 12px 14px 0; border-top: 1px solid var(--line); min-width: 0; }
.hh-facts dt { font-size: .84rem; color: var(--muted); }
.hh-facts dd { margin: 0 0 2px; font-size: 1.65rem; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.hh-facts dd small { font-size: .9rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
@media (max-width: 900px) { .home-hero { grid-template-columns: minmax(0, 1fr); } }
/* Page sections with their own heading (Home) */
.home-sec { margin: var(--section-gap) 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; margin-bottom: 16px; }
.sec-head h2 { font-size: var(--fs-section); letter-spacing: -0.025em; line-height: 1.2; margin: 0; }
.sec-head p { margin: 0; max-width: 72ch; }
.home-sec .cols-2 { align-items: start; }
/* Entry points: labelled by kind (chip) as well as by icon. The heading's button is stretched over the card, so
   the whole card is clickable while the button's name stays short. */
.entry-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .entry-grid { grid-template-columns: minmax(0, 1fr); } }
.entry { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--pad); color: var(--text); cursor: pointer;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.entry:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.entry:active { transform: none; }
.entry > p, .entry > h3 { margin: 0; }
.entry-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-bottom: 4px; }
.entry-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.entry-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.entry-t { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.3; }
.entry-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.entry-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.entry-link:focus-visible { outline: none; }
.entry-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.entry-d { color: var(--muted); font-size: .9rem; line-height: 1.55; }
.entry > .entry-m { margin-top: auto; padding-top: 6px; font: .74rem var(--mono); color: var(--muted); }
.entry-m kbd { height: 18px; min-width: 18px; font-size: .66rem; }
.entry-go { color: var(--accent); font-weight: 600; font-size: .9rem; }
.entry:hover .entry-go { text-decoration: underline; text-underline-offset: 3px; }
/* A section's lead text, under its heading */
.sec-lead { margin: calc(var(--space-2) * -1) 0 var(--space-4); max-width: var(--measure); color: var(--muted); font-size: .92rem; line-height: 1.6; }
.hh-py { margin: var(--space-2) 0 0; font-size: .84rem; }
/* Lesson rows: one button each (lessonLink, labLink and the module list in trackview.js). As a card of their own
   they get an accent edge; inside another card they sit flush. */
.lesson-links { list-style: none; margin: 0; padding: 0; }
.card.lesson-links { margin-bottom: var(--gap); padding: 6px; border-left: 3px solid var(--accent); }
.card.lesson-links.optional { border-left-color: var(--line-strong); }
.lesson-links li { margin: 0; }
.lesson-links li + li { border-top: 1px solid var(--line); }
.lesson-link { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 56px; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.lesson-link:hover { background: var(--hover); }
.ll-n { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font: 600 .76rem var(--mono); color: var(--muted-ink); }
.ll-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 500; line-height: 1.35; }
.ll-t small { font-size: var(--fs-sm); font-weight: 400; color: var(--muted); }
.ll-go { color: var(--muted); transition: transform .15s, color .15s; }
.lesson-link:hover .ll-go { color: var(--accent); transform: translateX(2px); }
.ll-build svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.lesson-link .chip, .lesson-link .badge { flex-shrink: 0; }
/* Learn overview: the modules with the weeks that teach them, the week's build, practice and reference links */
.module-link .ml-when { flex: 0 0 7.2rem; font: 500 .72rem var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted-ink); }
@media (max-width: 560px) { .module-link { flex-wrap: wrap; row-gap: 2px; } .module-link .ml-when { flex-basis: 100%; } }
.week-build { margin: var(--space-4) 0 var(--space-1); }
.page-sec { margin: var(--section-gap) 0; }
.page-sec + .page-sec, .page-head + .page-sec { margin-top: 0; }
.grid + .page-sec { margin-top: var(--space-6); }
.plan-note { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: var(--space-1) 0 0; }
.ref-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.ref-link { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s; }
.ref-link:hover { border-color: var(--accent-line); }
.ref-t { font-weight: 600; }
.ref-t::after { content: " \2192" / ""; color: var(--accent); }
/* The weeks of the plan, one line each */
.week-list { list-style: none; margin: 0; padding: 0; }
.week-list li { display: grid; grid-template-columns: 7.4rem minmax(0, 1fr) auto; align-items: baseline; column-gap: var(--space-3); margin: 0; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.week-list li:last-child { border-bottom: 0; }
.wk-n { font: 500 .72rem var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted-ink); }
.week-list li.on { font-weight: 600; }
.week-list li.on .wk-n { color: var(--accent); }
@media (max-width: 480px) { .week-list li { grid-template-columns: minmax(0, 1fr) auto; } .week-list .wk-n { grid-column: 1 / -1; } }
.ring { position: relative; width: 132px; height: 132px; flex-shrink: 0; z-index: 1; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-2); }
.ring .prog { stroke: var(--accent); transition: stroke-dashoffset .6s ease; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-size: 1.6rem; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: .72rem; color: var(--muted); }

/* Compact list (reviews etc.) */
.list { display: flex; flex-direction: column; }
.li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .t { font-weight: 500; }
.li a { color: var(--text); } .li a:hover { color: var(--accent); }
.empty { text-align: center; padding: 22px 10px; color: var(--muted); font-size: .9rem; }
.empty .big { font-size: 1.6rem; display: block; margin-bottom: 4px; }

/* ===========================================================
   Controls
   =========================================================== */
.btn, select, input, textarea {
  font: inherit; font-size: .875rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 12px;
  transition: border-color .15s, box-shadow .15s, background .15s, transform .05s;
}
input, select { height: 36px; max-width: 100%; }
#p-sel { width: min(340px, 100%); }
input[type="range"] { height: auto; padding: 0; border: 0; accent-color: var(--accent); background: none; }
input[type="file"] { display: none; }
select { padding-right: 30px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { width: 100%; font-family: var(--mono); font-size: .84rem; line-height: 1.55; background: var(--code-bg); color: var(--code-text); resize: vertical; tab-size: 4; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; cursor: pointer; font-weight: 500; background: var(--surface); white-space: nowrap; text-decoration: none !important; color: var(--text); }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: default; opacity: .55; transform: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn.primary:disabled { opacity: 1; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.small { height: 28px; padding: 0 10px; font-size: .8rem; border-radius: 8px; }
.btn.danger:hover { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input { flex: 1; min-width: 180px; }
.search { position: relative; flex: 1; min-width: 200px; display: flex; }
.search input { width: 100%; padding-left: 34px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }

/* Segmented control */
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--muted-ink); font: inherit; font-size: .82rem; font-weight: 500; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(0,0,0,.08); }

/* Badges */
/* Badges and pills are outlined mono chips; .chip is the bare type tag used in search rows */
.badge, .pill, .chip { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 7px; border-radius: 4px; font: 500 .66rem var(--mono); letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
  background: var(--surface-2); color: var(--muted-ink); border: 1px solid var(--line-strong); }
.chip { background: transparent; flex-shrink: 0; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before, .pill::before { display: none; }
.badge.E, .badge.done { color: var(--ok-ink); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.badge.M, .badge.due { color: var(--warn-ink); background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 24%, transparent); }
.badge.H { color: var(--bad-ink); background: color-mix(in srgb, var(--bad) 11%, transparent); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.badge.accent { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.E { color: var(--ok-ink); } .M { color: var(--warn-ink); } .H { color: var(--bad-ink); }
.s-solved { color: var(--ok-ink); font-weight: 600; } .s-review { color: var(--warn-ink); font-weight: 600; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; margin: 3px 4px 3px 0; border-radius: 7px; font-size: .78rem; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }

/* ===========================================================
   Tables
   =========================================================== */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
th { text-align: left; font: 500 .7rem var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
th:not(:empty)::before { content: "/ "; opacity: .6; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr, table tr { transition: background .12s; }
table tr:hover td { background: var(--hover); }
table tr:hover td:first-child { border-radius: 8px 0 0 8px; } table tr:hover td:last-child { border-radius: 0 8px 8px 0; }
td:first-child a { color: var(--text); font-weight: 500; } td:first-child a:hover { color: var(--accent); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 4px; }
.table-wrap { overflow-x: auto; margin: 0 calc(var(--pad) * -0.4); }
@media (max-width: 700px) { td.hide-sm, th.hide-sm { display: none; } td.actions { white-space: normal; } }

/* ===========================================================
   Code & output
   =========================================================== */
pre { background: var(--code-bg); color: var(--code-text); border: 1px solid var(--line); padding: 14px 16px; border-radius: 11px; overflow: auto; font: .84rem/1.6 var(--mono); margin: 10px 0; tab-size: 4; }
/* Syntax colours from Visual Studio Code's Dark+ theme (trackview.js hlPy) */
.tk-k { color: #569cd6; } .tk-k2 { color: #c586c0; } .tk-s { color: #ce9178; } .tk-n { color: #b5cea8; }
.tk-c { color: #6a9955; } .tk-f { color: #dcdcaa; } .tk-t { color: #4ec9b0; } .tk-v { color: #9cdcfe; }
[data-theme="contrast"] .tk-c { color: #8fd17a; }
/* Exercise editor: a transparent textarea over a coloured copy of its text, with matching metrics */
.code-ed { position: relative; }
.code-ed .code-hl { position: absolute; inset: 0; margin: 0; padding: 7px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  overflow: hidden; white-space: pre; font: .84rem/1.55 var(--mono); tab-size: 4; pointer-events: none; }
.code-ed textarea { position: relative; display: block; background: transparent; color: transparent; caret-color: var(--code-text); white-space: pre; overflow: auto; }
.code-ed textarea::selection { background: #264f78; color: transparent; }
/* A code element inside a block takes the block's colours, not the inline-code chip's */
pre code { background: none; border: 0; padding: 0; border-radius: 0; font-size: inherit; color: inherit; }
#code { min-height: 320px; }
#out { min-height: 70px; white-space: pre-wrap; }
.timer { font: 600 1.35rem var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; padding: 0 6px; }

/* ===========================================================
   Details / accordions
   =========================================================== */
details > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s; flex-shrink: 0; margin-right: 2px; }
details[open] > summary::before { transform: rotate(45deg); }
details[open] > summary { margin-bottom: 12px; }
.week.current { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }

/* ===========================================================
   Dialog
   =========================================================== */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(460px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(5, 8, 15, .5); backdrop-filter: blur(6px); }
dialog .card { box-shadow: 0 24px 60px -20px rgba(0,0,0,.45); }
dialog label { display: block; font-size: .85rem; font-weight: 500; }
dialog select, dialog textarea, dialog input[type="number"] { margin-top: 6px; width: 100%; }
dialog textarea { font-family: var(--font); background: var(--surface); color: var(--text); }

/* ===========================================================
   Videos
   =========================================================== */
.video { position: relative; padding-top: 56.25%; margin: 12px 0; border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 12px 0; }
/* Phones: two thumbnails a row instead of one tall column */
@media (max-width: 560px) { .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .vcard .vt { padding: 8px 9px; font-size: .78rem; } }
.vgrid .vcard.playing { grid-column: 1 / -1; }
.vcard { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--surface-2); transition: transform .18s, box-shadow .18s, border-color .18s; }
.vcard:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 14px 30px -18px rgba(0,0,0,.5); }
.vcard img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.vcard .play { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); background: color-mix(in srgb, var(--accent) 88%, black); color: var(--accent-ink); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; box-shadow: 0 8px 20px -6px rgba(0,0,0,.6); transition: transform .18s; }
.vcard:hover .play { transform: translate(-50%, -50%) scale(1.08); }
.vcard .vt { padding: 10px 12px; font-size: .82rem; line-height: 1.4; font-weight: 500; }
.vcard .vt .muted { font-size: .75rem; font-weight: 400; }
.vcard.playing { cursor: default; border: 0; background: none; transform: none; box-shadow: none; }
.vcard.playing .video { margin: 0; }

/* ===========================================================
   Refreshers sidebar
   =========================================================== */
.ref-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.ref-side { position: sticky; top: 124px; max-height: calc(100vh - 142px); overflow-y: auto; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); scrollbar-width: thin; }
.side-h { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; background: none; cursor: pointer; font: 500 .66rem var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.side-h:hover { color: var(--text); }
.side-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; background: none; cursor: pointer; font: inherit; font-size: .8rem; color: var(--muted); padding: 7px 10px; border-radius: 8px; }
.side-toggle:hover { background: var(--hover); color: var(--text); }
.side-i { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; color: var(--text); padding: 7px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: .86rem; position: relative; transition: background .12s; }
.side-i:hover { background: var(--hover); }
.side-i .muted { font-size: .72rem; font-variant-numeric: tabular-nums; }
.side-i.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.side-i.active::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--accent); }
.side-i.active .muted { color: var(--accent); }
.sh { display: none; }
.ref-layout.compact { grid-template-columns: 60px minmax(0, 1fr); }
.compact .ref-side { padding: 6px 5px; }
.compact .lbl, .compact .chev { display: none; }
.compact .sh { display: inline; font-size: .74rem; font-weight: 650; }
.compact .side-i, .compact .side-toggle { justify-content: center; padding: 8px 0; }
.compact .side-i.active::before { left: -5px; }
.compact .side-h { height: 1px; padding: 0; margin: 8px 8px; background: var(--line); pointer-events: none; width: auto; }
@media (max-width: 760px) {
  .ref-layout, .ref-layout.compact { grid-template-columns: minmax(0, 1fr); }
  .ref-side { position: static; max-height: 260px; }
  .compact .ref-side { display: flex; flex-wrap: wrap; gap: 4px; max-height: none; }
  .compact .side-i, .compact .side-toggle { width: auto; min-width: 42px; }
  .compact .side-h { width: 100%; margin: 2px 0; }
}

/* ===========================================================
   Settings: appearance
   =========================================================== */
.theme-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.theme-group { margin: 6px 0 8px; }
.theme-grid + .theme-group { margin-top: 18px; }
.theme-card { border: 1px solid var(--line); background: var(--surface); border-radius: 13px; padding: 7px; cursor: pointer; text-align: left; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
.theme-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-meta { display: flex; justify-content: space-between; align-items: center; padding: 8px 5px 3px; font-size: .85rem; font-weight: 600; }
.theme-meta .check { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: .7rem; }
.theme-desc { padding: 0 5px 3px; font-size: .74rem; color: var(--muted); }
.theme-prev { height: 86px; border-radius: 9px; overflow: hidden; display: flex; border: 1px solid var(--line); }
.tp { flex: 1; background: var(--bg); padding: 9px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.tp i { display: block; border-radius: 4px; }
.tp .tp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.tp .l1 { height: 6px; width: 60%; background: var(--text); opacity: .85; }
.tp .l2 { height: 5px; width: 85%; background: var(--muted); opacity: .5; }
.tp .row2 { display: flex; gap: 5px; margin-top: auto; }
.tp .acc { height: 9px; width: 34px; background: var(--accent); border-radius: 99px; }
.tp .ok { height: 9px; width: 18px; background: var(--ok); border-radius: 99px; opacity: .8; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.card > h3 + .setting, .card > .card-title + .setting { border-top: 0; padding-top: 4px; }
.theme-grid + .setting { margin-top: 16px; }
.setting .muted { margin-top: 2px; }
.setting > div:first-child { flex: 1 1 300px; min-width: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; transition: transform .12s; }
.swatch:hover { transform: scale(1.1); }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.swatch.auto { background: conic-gradient(#5b5bd6, #2f6fed, #0f9d8f, #16a34a, #ea580c, #e11d48, #8b5cf6, #5b5bd6); }

/* ===========================================================
   Tracks: Home hub, sub-navigation, track cards, quiz, labs, certs
   =========================================================== */
/* Section colours follow the theme's accent, so each theme stays a two-colour pairing */
.t-dsa, .t-cloud, .t-ai, .t-claude, .t-roles, .t-interview { --tc: var(--accent); }
.dom-row { margin: 10px 0 14px; font-size: .9rem; }
.dom-row .bar { margin-top: 6px; }
.bar.bad > i { background: var(--bad); }
.quiz-opt.picked { border-color: var(--accent); background: var(--accent-soft); }
.quiz-opt.picked .qk { background: var(--accent); color: var(--accent-ink); }
.ax-bar { position: sticky; top: 112px; z-index: 5; }
.ax-map { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.ax-map button { width: 30px; height: 28px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font: 600 .75rem var(--font); cursor: pointer; padding: 0; }
.ax-map button.ans { background: var(--accent-soft); color: var(--text); border-color: var(--accent-line); }
.ax-map button.flag { box-shadow: inset 0 -3px 0 var(--warn); }
.ax-map button.cur { outline: 2px solid var(--accent); outline-offset: 1px; color: var(--text); }
.timer.H { color: var(--bad-ink); }
.nav-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 4px; flex-shrink: 0; align-self: center; }
/* The section bar floats as a slim pill under the header */
.subnav-inner { background: var(--glass); border: 1px solid var(--glass-edge); backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px); box-shadow: inset 0 1px 0 var(--edge-hi), var(--lift); }
.subnav-inner { margin: 6px var(--gutter) 8px; padding: 0 10px; border-radius: 12px; display: flex; align-items: center; gap: 16px; overflow-x: auto; scrollbar-width: none; }
.subnav-inner::-webkit-scrollbar { display: none; }
.subnav-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .85rem; letter-spacing: -0.01em; white-space: nowrap; color: var(--tc); }
.subnav-title svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.subnav-tabs { display: flex; gap: 2px; }
.subnav-tabs button { border: 0; background: none; color: var(--muted); padding: 10px 10px; font: 500 .72rem var(--mono); letter-spacing: .02em; text-transform: uppercase; cursor: pointer; white-space: nowrap; border-radius: 0; box-shadow: inset 0 -2px 0 transparent; transition: color .15s, box-shadow .15s; }
.subnav-tabs button:hover { color: var(--text); }
.subnav-tabs button.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--tc); }
.track-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); margin-bottom: var(--gap); }
.track-grid .card { margin-bottom: 0; }
.track-card { display: flex; flex-direction: column; gap: 16px; border-top: 3px solid var(--tc); }
.tc-head { display: flex; gap: 12px; align-items: flex-start; }
.tc-head h3 { margin: 0 0 2px; }
.tc-head p { margin: 0; }
.tc-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--tc) 15%, transparent); color: var(--tc); flex-shrink: 0; }
.tc-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tc-body { display: flex; gap: 16px; align-items: center; }
.tc-meta { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; align-items: flex-start; }
.track-card > .row { margin-top: auto; }
.track-card .ring .prog { stroke: var(--tc); }
.quiz-opts { display: grid; gap: 8px; }
.quiz-opt { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; transition: border-color .15s, background .15s; }
.quiz-opt:hover:not(:disabled) { border-color: var(--accent-line); background: var(--accent-soft); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt .qk { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 650; font-size: .78rem; flex-shrink: 0; }
.quiz-opt.right { border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
/* The letter on a filled key takes the card colour, so it stays readable on light and dark status fills */
.quiz-opt.right .qk { background: var(--ok); color: var(--surface); }
.quiz-opt.wrong { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.quiz-opt.wrong .qk { background: var(--bad); color: var(--surface); }
.lab.focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.resume { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; gap: 12px; }
.cert { display: flex; flex-direction: column; }
.gloss { margin: 0; display: grid; grid-template-columns: minmax(150px, 220px) 1fr; }
.gloss dt { font-weight: 600; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.gloss dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
@media (max-width: 640px) { .gloss { grid-template-columns: 1fr; } .gloss dt { border-bottom: 0; padding-bottom: 2px; } .gloss dd { padding-top: 0; } }
.cert-code { font-family: var(--mono); font-size: .95rem; }
.tag-btn { cursor: pointer; font: inherit; font-size: .78rem; }
.tag-btn:hover { border-color: var(--accent-line); color: var(--accent); }

/* ===========================================================
   System design
   =========================================================== */
.sd-diagram { overflow-x: auto; padding: 8px 0 4px; color: var(--muted); }
.sd-diagram svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.sd-node rect { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.sd-node.first rect { fill: var(--accent-soft); stroke: var(--accent-line); }
.sd-node text { fill: var(--text); font: 500 12.5px var(--font); }
.flash { padding: 12px 0; border-top: 1px solid var(--line); }
.flash:first-of-type { border-top: 0; padding-top: 4px; }
.flash-a { color: var(--muted); margin: 8px 0 0; }
.calc-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.calc-grid label { display: flex; flex-direction: column; gap: 4px; }
.calc-grid input { width: 100%; font-variant-numeric: tabular-nums; }
#sdc-out .card { box-shadow: none; background: var(--surface-2); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-radius: 8px; cursor: pointer; font-size: .92rem; }
.check:hover { background: var(--hover); }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.check input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
textarea[data-sdnotes] { font-family: var(--font); background: var(--surface); color: var(--text); }

/* Misc */
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 14px; border-radius: 0 10px 10px 0; font-size: .9rem; }
/* On the accent-tinted callout, accent text can fall under 4.5:1; links there use the text colour and an accent underline */
.callout .badge { background: var(--surface); }
.callout a, .callout .inline-link, .callout .link-btn.inline-link { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
/* No programming ligatures in code: show <> and -> exactly as typed. Kept last so the
   font shorthand on pre/textarea above can't reset it. */
pre, code, textarea { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ===========================================================
   Roles: role switcher, skill levels, postings
   =========================================================== */
.role-switch { margin-bottom: var(--gap); overflow-x: auto; scrollbar-width: none; }
.role-switch .seg { flex-wrap: nowrap; }
.role-switch .seg button { white-space: nowrap; }
.tag.lv-confident { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.tag.lv-learning { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.posting h3 { margin: 0; }
.rl-tags .tag, .posting .tag { display: inline-block; height: auto; min-height: 24px; padding-top: 3px; padding-bottom: 3px; text-align: left; line-height: 1.35; }
.posting ul { margin-top: 6px; }
.skills-table td { vertical-align: top; }
.skills-table select { min-width: 110px; }
.show-sm { display: none; }
@media (max-width: 700px) { .show-sm { display: block; margin-top: 4px; } }

/* ===========================================================
   IBM Videos tab: playlist cards
   =========================================================== */
.pl-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-bottom: var(--gap); }
.pl-grid .card { margin-bottom: 0; }
.pl-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pl-card > .vcard { border: 0; border-radius: 0; position: relative; }
.pl-card .vcard .vt { display: none; }
.pl-card .vcard .play { top: 50%; }
.pl-card .vcard:hover { transform: none; box-shadow: none; }
.pl-count { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.75); color: #fff; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.pl-body { display: flex; flex-direction: column; flex: 1; padding: 12px 14px 14px; }
.pl-pairs { margin-top: 10px; }
.pl-pairs .label { display: block; margin-bottom: 2px; font-size: .68rem; }
.pl-done { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pl-title { border: 0; background: none; padding: 0; font: inherit; font-weight: 650; color: var(--text); text-align: left; cursor: pointer; }
.pl-title:hover { color: var(--accent); }
.side-h[data-ibmgrp] { text-align: left; gap: 8px; }
.side-h[data-ibmgrp] .chev { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-list summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
.pl-list summary::-webkit-details-marker { display: none; }
.pl-rows { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: min(52vh, 460px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; border: 1px solid var(--line); border-radius: 10px; }
.pl-rows .pl-row { border-radius: 0; }
.pl-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line); border-radius: 8px; }
.pl-row:last-child { border-bottom: 0; }
.pl-row:hover { background: var(--hover); }
.pl-row.playing { background: var(--accent-soft); }
.pl-row.watched .pl-row-t { color: var(--muted); }
.pl-n { width: 26px; text-align: right; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.pl-row.playing .pl-n { color: var(--accent); }
.pl-thumb { border: 0; padding: 0; background: none; cursor: pointer; flex-shrink: 0; line-height: 0; }
.pl-thumb img { width: 72px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.pl-row-t { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; font: inherit; font-size: .88rem; color: var(--text); cursor: pointer; }
.pl-row-t:hover { color: var(--accent); }
.pl-len { font-size: .78rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.pl-w { display: flex; padding: 4px; cursor: pointer; flex-shrink: 0; }
.pl-w input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
@media (max-width: 640px) { .pl-thumb { display: none; } }
.side-tools { display: flex; align-items: center; gap: 4px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.side-tools .side-toggle { width: auto; flex-shrink: 0; gap: 6px; padding: 6px 6px; }
.side-tools-r { display: flex; gap: 2px; margin-left: auto; }
.side-tool { border: 0; background: none; color: var(--muted); font: inherit; font-size: .74rem; padding: 6px 5px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.side-tool:hover { background: var(--hover); color: var(--text); }
.side-sec { font-size: .74rem; font-weight: 700; color: var(--text); padding: 12px 10px 0; }
.compact .side-tools { border-bottom: 0; justify-content: center; }
.compact .side-tools .side-toggle { width: 100%; }

/* ---------- global search ---------- */
/* Keycaps: a raised key with a hard bottom edge */
/* Full text colour (white on dark themes), so keys stand out from muted sentences around them */
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; font: 600 .7rem var(--mono); border-radius: 5px; color: var(--text);
  border: 1px solid var(--line-strong); background: linear-gradient(var(--surface), var(--surface-2)); box-shadow: 0 1.5px 0 var(--line-strong), inset 0 1px 0 var(--edge-hi); }

/* Command palette (Ctrl+K): a glass panel that drops in from the top bar */
dialog#search-dlg { max-width: min(660px, calc(100vw - 32px)); margin-top: 9vh; }
dialog#search-dlg::backdrop { background: color-mix(in srgb, var(--bg) 40%, transparent); backdrop-filter: blur(3px); }
.search-panel { position: relative; padding: 12px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--edge-hi), 0 40px 90px -40px rgba(5, 12, 30, .8); animation: pal-in .2s cubic-bezier(.2, .8, .2, 1); transform-origin: 50% 0; }
@keyframes pal-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } }
.search-panel .search input { font: 1rem var(--mono); height: 46px; padding-left: 38px; padding-right: 52px; border-radius: 12px; background: var(--surface); }
.search-panel .search svg { left: 13px; }
.search-panel .search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.pal-tabs { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.pal-tabs button { flex: 1; min-width: max-content; display: inline-flex; justify-content: center; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  font: 600 .8rem var(--font); color: var(--muted); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 0 var(--line); }
.pal-tabs button:hover { color: var(--text); border-color: var(--line-strong); }
.pal-tabs button.on { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.pal-tabs small { font: 500 .66rem var(--mono); opacity: .7; }
.gs-res { max-height: min(56vh, 480px); overflow-y: auto; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; padding: 1px; }
.gs-hit { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; cursor: pointer; background: var(--surface); border: 1px solid var(--line); }
.gs-hit::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); margin-top: 8px; flex-shrink: 0; }
.gs-hit > div { flex: 1; min-width: 0; }
.gs-hit .chip { margin-top: 1px; }
.gs-hit.on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.gs-hit.on::before { background: var(--accent-ink); }
.gs-hit.on .muted, .gs-hit.on .chip { color: color-mix(in srgb, var(--accent-ink) 78%, transparent); border-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.gs-t { font-weight: 600; letter-spacing: -0.01em; }
.gs-s { font: .72rem var(--mono); margin-top: 1px; }
.gs-x { font-size: .8rem; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gs-res mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.gs-hit.on mark { background: color-mix(in srgb, var(--accent-ink) 22%, transparent); }
.gs-group { font: 500 .66rem var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 6px 4px 0; }
.gs-group::before { content: "/ "; opacity: .6; }
.gs-empty { padding: 22px 10px; text-align: center; line-height: 1.7; }
.gs-foot { display: flex; align-items: center; gap: 14px; font: .7rem var(--mono); padding: 10px 4px 0; border-top: 1px solid var(--line); margin-top: 10px; flex-wrap: wrap; }
.gs-foot span { display: inline-flex; align-items: center; gap: 5px; }
.gs-foot .r { margin-left: auto; }

/* Console (the ` key): a pop-up terminal window for getting around and checking progress */
.console { position: fixed; z-index: 40; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px));
  width: min(720px, calc(100vw - 32px)); height: min(460px, calc(100vh - 140px)); display: flex; flex-direction: column;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--line-strong); background: var(--panel-bg); color: var(--panel-text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--surface-2) 70%, transparent), 0 40px 90px -30px rgba(0, 0, 0, .7); animation: con-in .18s ease-out; }
.console[hidden] { display: none; }
@keyframes con-in { from { opacity: 0; transform: translateY(14px); } }
.con-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 30px; padding: 0 6px 0 10px; background: var(--surface-2); border-bottom: 1px solid var(--line-strong); color: var(--muted); font: 500 .68rem var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.con-bar .dots { display: flex; gap: 5px; }
.con-bar .dots i { width: 9px; height: 9px; border-radius: 2px; border: 1px solid var(--line-strong); }
.con-bar button { justify-self: end; width: 24px; height: 24px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; border-radius: 4px; }
.con-bar button:hover { background: var(--hover); color: var(--text); }
.con-out { flex: 1; overflow-y: auto; padding: 12px 14px 4px; font: .8rem/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; }
.con-out .ascii { color: var(--accent); white-space: pre; overflow-x: auto; line-height: 1.15; }
.con-out .rule { border-top: 1px dashed var(--line-strong); margin: 6px 0; }
.con-out .cmd { color: var(--text); } .con-out .cmd b { color: var(--accent); }
.con-out .dim { color: var(--muted); } .con-out .ok { color: var(--ok-ink); } .con-out .err { color: var(--bad-ink); }
.con-out a, .con-out button.lnk { color: var(--accent); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.con-in { display: flex; align-items: center; gap: 8px; padding: 6px 14px 12px; font: .8rem var(--mono); }
.con-in b { color: var(--accent); }
.con-in input { flex: 1; height: auto; padding: 0; border: 0; background: none; color: var(--panel-text); font: inherit; caret-color: var(--accent); box-shadow: none; }
.con-in input:focus { box-shadow: none; }
@media (max-width: 640px) { .console { height: min(420px, calc(100vh - 120px)); } }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* ---------- forms: add a posting, stories ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; margin: 12px 0; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; font-weight: 500; margin-bottom: 10px; }
.fld > span { color: var(--muted); }
.fld input, .fld select, .fld textarea { width: 100%; font-weight: 400; }
/* Prose fields (notes, stories) look like the other inputs; only code editors use the dark code colours */
.fld textarea { font-family: var(--font); font-size: .9rem; resize: vertical; background: var(--surface); color: var(--text); }
.rl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 6px 14px; margin-top: 6px; }
.rl-pick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); font-size: .88rem; }
.rl-pick-row.on { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.rl-pick-row .seg button { padding: 4px 9px; font-size: .78rem; }
.sug { color: var(--accent); }
@media (max-width: 640px) { .rl-pick { grid-template-columns: 1fr; } .rl-pick-row { flex-wrap: wrap; } }

/* ---------- interview ---------- */
/* Setup: the three steps of a mock, then the form with the one primary action */
.iv-flow { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin: 0 0 var(--gap); padding: 0; counter-reset: ivflow; }
.iv-flow li { position: relative; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 14px 16px 14px 52px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); counter-increment: ivflow; }
.iv-flow li::before { content: counter(ivflow); position: absolute; left: 16px; top: 14px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 600 .78rem var(--mono); }
@media (max-width: 860px) { .iv-flow { grid-template-columns: minmax(0, 1fr); } }
.iv-start { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-top: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.iv-start .muted { flex: 1 1 260px; }
/* A mock in progress: the rounds and the round clock (its state in words as well as colour), the question, scoring */
.iv-head { margin-bottom: var(--space-4); }
.iv-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; position: sticky; top: 112px; z-index: 5; }
.iv-steps { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.iv-step { margin: 0; font-size: .8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted-ink); }
.iv-step.done { color: var(--ok-ink); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.iv-step.on { color: var(--text); font-weight: 600; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.iv-clock { display: flex; align-items: center; gap: var(--space-3); }
.iv-state { font: 500 var(--fs-label) var(--mono); letter-spacing: .03em; text-transform: uppercase; color: var(--muted-ink); }
.iv-state.over, .timer.over { color: var(--bad-ink); }
.iv-q { font-size: var(--fs-section); font-weight: 650; letter-spacing: -0.025em; line-height: 1.25; margin: 6px 0 10px; max-width: 62ch; }
.iv-reveal { margin: var(--space-3) 0 0; max-width: var(--measure); }
.iv-lesson { margin: var(--space-3) 0 0; }
.iv-score { flex-wrap: wrap; }
.iv-score b { font-weight: 700; }
.iv-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
@media (max-width: 640px) {
  /* Phones: round numbers and scores only, the four scores in one row, and Next before Abandon */
  .iv-step-name { display: none; }
  .iv-score { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .iv-score button { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 44px; padding: 6px 2px; font-size: .74rem; }
  .iv-score b { font-size: 1rem; }
  .iv-actions { flex-direction: column-reverse; align-items: stretch; }
  .iv-actions .row { justify-content: flex-end; }
}
.iv-story { border-top: 1px solid var(--line); padding: 8px 0; }
.iv-story summary { cursor: pointer; font-weight: 500; }
.iv-mock summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.iv-mock summary::-webkit-details-marker { display: none; }
dl.star { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 8px 0 0; }
dl.star dt { font-weight: 600; color: var(--muted); font-size: .85rem; }
dl.star dd { margin: 0; white-space: pre-wrap; }
@media (max-width: 640px) { dl.star { grid-template-columns: 1fr; } dl.star dd { margin-bottom: 6px; } .iv-bar { top: 100px; } }

/* Beginner track: the first-visit level choice, beginner lessons on Home, lesson position, inline lesson links,
   Python notes, "Going further", exercise examples, hints and model answers, and project step detail */
.level-pick { border-left: 3px solid var(--accent); }
.level-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.level-opt { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; text-align: left; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.level-opt:hover, .level-opt:focus-visible { border-color: var(--accent); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; }
.link-btn.inline-link, .inline-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.lesson-body h2 { margin: 18px 0 6px; }
.lesson-body ol li, .lesson-body ul li { margin-bottom: 4px; }
.lesson-pos { margin: -4px 0 10px; color: var(--muted); }
.py-note { border-left: 3px solid var(--line-strong); background: var(--surface-2); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: .9rem; }
.lesson-body > .why { margin: 0 0 14px; }
.going-further { margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.going-further > summary { cursor: pointer; font-weight: 600; }
.code-note { margin: 0 0 4px; font-size: .86rem; }
.ex-example .label { margin: 4px 0 2px; }
.ex-example pre { margin: 0 0 10px; white-space: pre-wrap; }
.ex-help { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.ex-help > summary { font-weight: 500; cursor: pointer; }
.ex-help[open] > summary { margin-bottom: 6px; }
pre[id^="trres-"], pre[id^="trrun-"] { white-space: pre-wrap; }
.callout.before ul { margin: 6px 0 0; padding-left: 20px; }
.callout.before li { margin-bottom: 4px; }
.lab-step { border-top: 1px solid var(--line); padding: 6px 0; }
.lab-step:first-of-type { border-top: 0; }
.lab-see { margin: 2px 0 4px 31px; font-size: .88rem; }
.lab-see .label { display: inline; margin-right: 6px; }
.lab-hint { margin: 4px 0 4px 31px; padding-top: 6px; }
.lab-hint > summary { font-size: .88rem; }
/* Long lesson titles on Previous / Next and long commands in project notes wrap instead of widening the page */
.ref-main > .row.between .btn, .tree-main > .row.between .btn { white-space: normal; text-align: left; height: auto; min-height: 36px; }

/* ===========================================================
   Folder tree (AI / LLM): the section as files and folders, styled like the console
   =========================================================== */
.tree-layout { --tree-gap: clamp(18px, 2vw, 32px); --tree-col: clamp(220px, var(--tree-w, clamp(280px, 22vw, 400px)), min(560px, 45vw));
  position: relative; display: grid; grid-template-columns: var(--tree-col) minmax(0, 1fr); gap: var(--tree-gap); align-items: start; }
/* Drag handle on the tree's right border (--tree-w, saved as S.treeW); double-click resets it. The knob sits on the
   border near the top of the tree, so it stays beside the tree even when the tree is short, and follows the sticky
   tree as the page scrolls; the tree's border lights up while you resize. */
.tree-grip { position: absolute; top: 0; bottom: 0; left: calc(var(--tree-col) - 4px); width: 12px; cursor: col-resize; touch-action: none; z-index: 2; }
.tree-grip i { position: sticky; top: calc(var(--head-h) + 14px + 44px); margin-top: 44px; display: block; margin-left: 1px; width: 6px; height: 44px;
  border-radius: 3px; background: var(--line-strong); border: 1px solid var(--panel-bg); transition: background .15s, height .15s; }
.tree-grip:hover i, .tree-grip:focus-visible i, .tree-grip.drag i { background: var(--accent); }
.tree-layout:has(.tree-grip:hover, .tree-grip:focus-visible, .tree-grip.drag) .tree { border-color: var(--accent); }
.tree-grip:focus-visible { outline: none; }
body.tree-dragging { cursor: col-resize; user-select: none; }
.tree { position: sticky; top: calc(var(--head-h) + 14px); max-height: calc(100vh - var(--head-h) - 30px); overflow-y: auto; scrollbar-width: thin; padding: 10px 8px 14px;
  --tree-line: color-mix(in srgb, var(--muted) 55%, transparent);
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel-bg); color: var(--panel-text); font: .88rem/1.4 var(--mono);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--surface-2) 70%, transparent), var(--shadow); }
.tree-main .ax-bar, .tree-main .iv-bar { top: calc(var(--head-h) + 10px); }
.tr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 6px 8px; margin-bottom: 6px; border-bottom: 1px dashed var(--line-strong);
  color: var(--muted); font-size: .74rem; letter-spacing: .03em; text-transform: uppercase; }
.tr-tools { display: flex; gap: 8px; }
.tr-tools button { min-height: 24px; border: 0; background: none; padding: 0 4px; color: var(--accent); font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.tr-tools button:hover { text-decoration: underline; text-underline-offset: 2px; }
.tr-root { display: flex; justify-content: space-between; align-items: center; padding: 3px 6px; color: var(--accent); font-weight: 600; }
.tree ul { list-style: none; margin: 0 0 0 9px; padding: 0; }
.tree li { position: relative; margin: 0; padding-left: 12px; }
/* Guide lines: a rail down each folder, a tick to each row, the rail stopping at the last row */
.tree li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid var(--tree-line); }
.tree li:last-child::before { bottom: auto; height: 1.1em; }
.tree li::after { content: ""; position: absolute; left: 0; top: 1.1em; width: 9px; border-top: 1px solid var(--tree-line); }
.tr-row { display: flex; align-items: center; gap: 6px; width: 100%; height: 2.2em; padding: 0 6px; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tr-row:hover { background: var(--hover); }
.tr-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-dir .tr-n { color: var(--text); font-weight: 500; }
.tr-chev { width: 10px; flex-shrink: 0; color: var(--muted); font-size: .8em; }
.tr-row svg, .tr-mobile svg { width: 1.15em; height: 1.15em; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.tr-m { flex-shrink: 0; color: var(--muted); font-size: .86em; font-variant-numeric: tabular-nums; }
.tr-m.ok { color: var(--ok-ink); } .tr-m.nx { color: var(--accent); font-weight: 600; }
.tr-row.on { background: var(--accent); color: var(--accent-ink); }
.tr-row.on .tr-m, .tr-row.on .tr-n { color: inherit; }
.tr-row.holds { box-shadow: inset 2px 0 0 var(--accent); }
.tr-mobile { display: none; }
@media (max-width: 980px) {
  .tree-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tree { position: static; max-height: none; }
  .tr-mobile { display: flex; align-items: center; gap: 6px; width: 100%; height: 34px; padding: 0 4px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
  .tree:not(.tr-shut) .tr-mobile { margin-bottom: 6px; }
  .tree.tr-shut { padding-bottom: 10px; }
  .tree.tr-shut .tr-head, .tree.tr-shut .tr-body { display: none; }
  .tr-row { height: 2.4em; }
  .tree li:last-child::before { height: 1.2em; } .tree li::after { top: 1.2em; }
  .tree-grip { display: none; }
}
.lab-step code, .callout code, .ex-help code { overflow-wrap: anywhere; }
.lesson-body table { display: block; max-width: 100%; overflow-x: auto; }

/* Claude & Anthropic: "last verified" stamps, the numbered course list, the certifications, notes */
.verified { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.course-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.course-list li { display: flex; gap: var(--space-3); margin: 0; padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.course-list li:last-child { border-bottom: 0; }
.course-n { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font: 600 .78rem var(--mono); }
.course-body { flex: 1; min-width: 0; }
.course-body p { margin: 4px 0 0; max-width: var(--measure); }
.course-list a { color: var(--text); font-size: 1.02rem; text-decoration: none; }
.course-list a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.course-lessons { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-top: var(--space-2); }
.course-lessons .label { margin-right: 6px; }
.cert-list { list-style: none; margin: var(--space-3) 0; padding: 0; }
.cert-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin: 0; padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.cert-list li:last-child { border-bottom: 0; }
.cert-list .t { font-weight: 500; }
.cert-list p { margin: 4px 0 0; max-width: var(--measure); }
@media (max-width: 560px) { .cert-list li { flex-direction: column; gap: var(--space-2); } }
.eligibility { margin-bottom: 0; }
/* OpenAI Academy: one panel per track (audience, what it covers, its courses in order), the best fit marked in words
   as well as with the accent edge, then the certification status */
.oa-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin: var(--space-3) 0 var(--space-4); }
.oa-track { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: none; }
.oa-track.pick { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.oa-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.oa-name { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.oa-track p { margin: 6px 0 0; }
.oa-pick { font-size: .86rem; color: var(--text); }
.oa-pick b { color: var(--accent); }
.oa-group { margin: var(--space-3) 0 2px; }
.oa-courses { margin: var(--space-2) 0 0; padding-left: 1.4em; }
.oa-courses li { margin: 6px 0; line-height: 1.4; }
.oa-courses li::marker { font: 600 .8em var(--mono); color: var(--muted-ink); }
.oa-courses .muted { display: block; font-size: .8rem; }
.oa-track .oa-count { margin-top: auto; padding-top: var(--space-2); font: .72rem var(--mono); }
.oa-certs { margin: 0 0 var(--space-3); }
.oa-certs p { margin: 6px 0 0; }
/* A row of jumps to the page's sections under its header */
.toc { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: calc(var(--space-2) * -1) 0 var(--space-5); }
.toc ul { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc-link { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: none; color: var(--text); font: 500 .84rem var(--font); cursor: pointer; }
.toc-link:hover { border-color: var(--accent-line); color: var(--accent); }
/* With the folder tree beside the page the jumps are in the tree; the row stays for phones, where the tree folds */
@media (min-width: 981px) { .tree-main > .toc { display: none; } }
.zero-note { margin: 0 0 10px; }

/* Home: one large first action; stats only after the first passed exercise */
.btn.btn-lg { min-height: 46px; padding: 10px 22px; font-size: 1.02rem; border-radius: 10px; }
.local-toggle { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.local-toggle input { margin-top: 4px; }

/* Exercise instruction above the code box */
.ex-instr { margin: 10px 0 6px; font-size: .9rem; }

/* Phones: long button labels wrap instead of pushing content past the card edge */
@media (max-width: 640px) {
  .btn { white-space: normal; height: auto; min-height: 36px; padding-top: 7px; padding-bottom: 7px; max-width: 100%; text-align: center; }
}

/* ===========================================================
   Lesson reading: docs-style hierarchy (after Stripe, Vercel and Tailwind docs)
   Headings carry a mono "##" in the accent, prose is calmer and narrower so bold,
   headings and code stand apart, inline code is an accent chip, and code blocks
   sit in an editor window with a language tab.
   =========================================================== */
:root { --prose: color-mix(in srgb, var(--text) 84%, var(--muted)); --code-ink: color-mix(in srgb, var(--accent) 82%, var(--text)); }
[data-theme="contrast"] { --prose: var(--text); --code-ink: var(--accent); }
.lesson-crumb { display: flex; align-items: center; gap: 8px; color: var(--accent); margin-bottom: 6px; }
.lesson-crumb::before { content: "//"; opacity: .55; }
.tree-main > h1, .tree-main > h2, main > h1, main > h2 { font-size: var(--fs-title); margin-bottom: 10px; }
.lesson-body { padding: clamp(20px, 2.4vw, 34px) clamp(18px, 3vw, 44px); }
.lesson-body > p, .lesson-body > ul, .lesson-body > ol, .lesson-body li, .lesson-body > details { color: var(--prose); font-size: 1.02rem; line-height: 1.75; }
.lesson-body > p, .lesson-body > ul, .lesson-body > ol, .lesson-body > h2, .lesson-body > details { max-width: 72ch; }
.lesson-body b, .lesson-body strong { color: var(--text); font-weight: 650; }
.lesson-body i, .lesson-body em { color: var(--text); }
.lesson-body > p { margin: 12px 0; }
/* Section headings: bigger, more space above than below, a mono ## marker */
.lesson-body h2 { font-size: 1.32rem; font-weight: 650; letter-spacing: -0.025em; color: var(--text); margin: 38px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.lesson-body h2::before { content: "##"; font: 500 .82em var(--mono); color: var(--accent); opacity: .75; letter-spacing: 0; }
.lesson-body > h2:first-child, .lesson-body > .why + h2 { margin-top: 22px; }
.lesson-body h4 { font: 600 .78rem var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 24px 0 6px; }
/* Lists: accent markers, mono numbers */
.lesson-body ul { list-style: none; padding-left: 1.4em; }
.lesson-body ul > li { position: relative; }
.lesson-body ul > li::before { content: ""; position: absolute; left: -1.05em; top: .78em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); opacity: .7; }
.lesson-body ol { padding-left: 1.9em; }
.lesson-body ol > li::marker { font: 600 .85em var(--mono); color: var(--accent); }
.lesson-body li { margin: 6px 0; padding-left: 2px; }
/* Inline code: a mono chip in the accent so it reads apart from words */
.lesson-body code, .ex-card code, .callout code, .ex-help code, .lab-step code { color: var(--code-ink); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 24%, transparent); font-size: .86em; padding: 1.5px 6px; font-weight: 500; }
/* "Why it matters" as a quiet note with a mono label */
.lesson-body > .why { background: none; border-left: 2px solid var(--accent); border-radius: 0; padding: 4px 0 4px 16px; font-size: .98rem; line-height: 1.7; color: var(--prose); max-width: 72ch; }
.lesson-body > .why b:first-child { display: block; font: 500 .7rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 2px; }
/* Code blocks in an editor window: a bar with three dots and a language tab */
.code-win { margin: 16px 0; border: 1px solid color-mix(in srgb, #ffffff 9%, var(--code-bg)); border-radius: 12px; overflow: hidden; background: var(--code-bg); box-shadow: 0 18px 40px -28px rgba(0, 0, 0, .6); max-width: 100%; }
.code-bar { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; background: color-mix(in srgb, #ffffff 4%, var(--code-bg)); border-bottom: 1px solid color-mix(in srgb, #ffffff 7%, var(--code-bg)); font: 500 .7rem var(--mono); color: #8b949e; }
.code-bar .dots { display: inline-flex; gap: 6px; }
.code-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: #3c3c3c; }
.code-bar .lang { padding: 2px 8px; border-radius: 5px; background: color-mix(in srgb, #ffffff 7%, var(--code-bg)); color: #c5c5c5; }
.code-copy { margin-left: auto; min-height: 24px; padding: 0 9px; border: 1px solid color-mix(in srgb, #ffffff 16%, var(--code-bg)); border-radius: 6px; background: none; color: #c5c5c5; font: 500 .7rem var(--mono); cursor: pointer; }
.code-copy:hover { color: #ffffff; border-color: color-mix(in srgb, #ffffff 34%, var(--code-bg)); }
.code-copy.copied { color: #89d185; border-color: color-mix(in srgb, #89d185 45%, var(--code-bg)); }
.code-win > pre { margin: 0; border: 0; border-radius: 0; padding: 16px 18px; font-size: .86rem; line-height: 1.7; }
.ex-example .code-win { margin: 0 0 10px; }
/* The exercise editor inside its window: the window carries the border and focus ring */
.code-win .code-ed textarea { border: 0; border-radius: 0; padding: 14px 18px; box-shadow: none; }
.code-win .code-ed .code-hl { border: 0; border-radius: 0; padding: 14px 18px; background: var(--code-bg); }
.code-win:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 18px 40px -28px rgba(0, 0, 0, .6); }

/* ===========================================================
   Breadcrumbs (above Learn and Jobs pages) and touch targets
   =========================================================== */
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; list-style: none; margin: 0 0 12px; padding: 0; font: 500 .78rem/1.5 var(--mono); color: var(--muted); }
.crumbs li { display: inline-flex; align-items: center; margin: 0; min-width: 0; }
.crumbs li + li::before { content: "/"; margin: 0 8px; opacity: .6; }
.crumbs [aria-current] { color: var(--text); }
.crumb-link { border: 0; background: none; padding: 2px 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.crumb-link:hover { text-decoration-color: currentColor; }
/* On touch screens, small controls grow to a comfortable size */
@media (pointer: coarse) {
  .btn.small { min-height: 36px; }
  .mn-i { min-height: 44px; }
  .tr-row { height: 2.7em; }
  .crumb-link { padding: 8px 0; }
  .toc-link { min-height: 40px; }
  .code-copy { min-height: 32px; padding: 0 12px; }
  .tr-tools button { min-height: 36px; }
}
