/* Blueprint 101: design tokens and components. See docs/design.md for the system. */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e4e4e7;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #71717a;
  --brand: #e4fe71;          /* lime fill (buttons, marks) */
  --brand-ink: #0a0a0b;      /* text on brand fill */
  --brand-text: #4d7c0f;     /* brand used as text / icons on the page background */
  --brand-soft: #f4fcd2;
  --brand-line: #bef264;
  --accent-2: #6366f1;
  --accent-3: #a855f7;
  --link: #4d7c0f;
  --code-bg: #f4f4f5;
  --good: #16a34a;
  --bad: #dc2626;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --grid: #ececef;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .06);
  --glow: radial-gradient(60% 120% at 0% 0%, rgba(190, 242, 100, .35), transparent 60%), radial-gradient(50% 120% at 100% 0%, rgba(99, 102, 241, .14), transparent 60%);
  --diagram-filter: none;
  --radius: 12px;
  --radius-lg: 16px;
  --font: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --header-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #070708;
    --bg-elev: #0e0e10;
    --surface: #131316;
    --surface-2: #1b1b1f;
    --surface-3: #27272a;
    --border: #232327;
    --border-strong: #3f3f46;
    --text: #fafafa;
    --text-2: #a1a1aa;
    --text-3: #71717a;
    --brand: #eafe7c;
    --brand-ink: #0a0a0b;
    --brand-text: #eafe7c;
    --brand-soft: rgba(234, 254, 124, .09);
    --brand-line: rgba(234, 254, 124, .35);
    --accent-2: #818cf8;
    --accent-3: #c084fc;
    --link: #e4fe71;
    --code-bg: #18181b;
    --good: #4ade80;
    --bad: #f87171;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --grid: #232327;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 30px rgba(0, 0, 0, .35);
    --glow: radial-gradient(55% 120% at 0% 0%, rgba(234, 254, 124, .13), transparent 60%), radial-gradient(45% 120% at 100% 0%, rgba(129, 140, 248, .16), transparent 60%);
    --diagram-filter: invert(.9) hue-rotate(180deg) saturate(1.2);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070708;
  --bg-elev: #0e0e10;
  --surface: #131316;
  --surface-2: #1b1b1f;
  --surface-3: #27272a;
  --border: #232327;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --brand: #eafe7c;
  --brand-ink: #0a0a0b;
  --brand-text: #eafe7c;
  --brand-soft: rgba(234, 254, 124, .09);
  --brand-line: rgba(234, 254, 124, .35);
  --accent-2: #818cf8;
  --accent-3: #c084fc;
  --link: #e4fe71;
  --code-bg: #18181b;
  --good: #4ade80;
  --bad: #f87171;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --grid: #232327;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 30px rgba(0, 0, 0, .35);
  --glow: radial-gradient(55% 120% at 0% 0%, rgba(234, 254, 124, .13), transparent 60%), radial-gradient(45% 120% at 100% 0%, rgba(129, 140, 248, .16), transparent 60%);
  --diagram-filter: invert(.9) hue-rotate(180deg) saturate(1.2);
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 6px; }
kbd {
  font: 11px/1 var(--mono);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 3px 5px;
  background: var(--surface-2);
  color: var(--text-2);
}
button { font: inherit; color: inherit; cursor: pointer; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--surface); padding: 8px; }
.ic { display: inline-flex; width: 18px; height: 18px; flex: 0 0 auto; }
.ic svg { width: 100%; height: 100%; }
.muted { color: var(--text-2); }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 14px; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 16px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name span { color: var(--text-3); margin-left: 3px; font-weight: 500; }
.top-links { display: flex; gap: 2px; margin-left: 18px; }
.top-links a { color: var(--text-2); padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.top-links a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.top-links a.active { color: var(--text); background: var(--surface-2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 8px 7px 10px; color: var(--text-3); font-size: 14px; text-align: left;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-trigger .label { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  background: none; border: 1px solid transparent; border-radius: 10px; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.sidebar {
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto;
  border-right: 1px solid var(--border); padding: 16px 12px 48px; background: var(--bg);
  scrollbar-width: thin;
}
main { padding: 40px clamp(16px, 4vw, 56px) 96px; min-width: 0; outline: none; }
.page { max-width: 1120px; margin: 0 auto; }

.side-group { margin-bottom: 18px; }
.side-label { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 0 10px; margin: 0 0 6px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
}
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link.active { background: var(--surface-2); color: var(--text); }
.side-link.active .ic { color: var(--brand-text); }
.side-link .count { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.side-section > button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  background: none; border: 0; color: var(--text-2); font-size: 14px; font-weight: 500; text-align: left;
}
.side-section > button:hover { background: var(--surface-2); color: var(--text); }
.side-section > button .chev { margin-left: auto; transition: transform .15s; color: var(--text-3); width: 14px; height: 14px; }
.side-section.open > button .chev { transform: rotate(90deg); }
.side-section ul { list-style: none; margin: 2px 0 6px 19px; padding: 0 0 0 10px; border-left: 1px solid var(--border); display: none; }
.side-section.open ul { display: block; }
.side-section li a {
  display: flex; gap: 8px; align-items: flex-start; padding: 5px 8px; border-radius: 6px;
  color: var(--text-2); font-size: 13.5px; line-height: 1.4;
}
.side-section li a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.side-section li a.active { color: var(--text); background: var(--brand-soft); }
.status { flex: 0 0 auto; width: 14px; height: 14px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; }
.status.done { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.status.done svg { width: 10px; height: 10px; }
.side-progress { margin: 4px 4px 18px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.side-progress .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.side-progress b { color: var(--text); font-weight: 600; }

.bar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }

/* ---------------------------------------------------------------- page header */
.page-head { position: relative; margin-bottom: 36px; }
.page-head h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.15; letter-spacing: -.03em; font-weight: 600; margin: 0 0 10px; }
.page-head p { color: var(--text-2); font-size: 17px; max-width: 720px; margin: 0; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--text-3); font-size: 13px; margin-bottom: 14px; }
.crumbs a { color: var(--text-2); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 13px;
}
.pill b { color: var(--text); font-weight: 600; }
.pill.brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-text); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; font-size: 14px; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.btn.primary:hover { filter: brightness(.96); background: var(--brand); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.done { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-text); }
.btn .ic { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- sections + cards */
.block { margin-top: 56px; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.block-head h2 { font-size: 22px; letter-spacing: -.02em; font-weight: 600; margin: 0 0 4px; }
.block-head p { margin: 0; color: var(--text-2); font-size: 14.5px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px;
  color: var(--text); transition: border-color .15s, background .15s, transform .15s;
}
a.card:hover { text-decoration: none; border-color: var(--border-strong); background: var(--bg-elev); }
.card h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-3); font-size: 13px; padding-top: 6px; }
.icon-tile {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.icon-tile .ic { width: 20px; height: 20px; }
.icon-tile.brand { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); font-weight: 500; }
.chip.brand { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand-line); }
.chip.violet { background: color-mix(in srgb, var(--accent-3) 14%, transparent); color: var(--accent-3); border-color: color-mix(in srgb, var(--accent-3) 35%, transparent); }

/* hero */
.hero-card {
  position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; padding: 36px;
  background: var(--glow), var(--surface);
}
.hero-card h1 { font-size: clamp(32px, 4.4vw, 48px); line-height: 1.08; letter-spacing: -.035em; font-weight: 600; margin: 0 0 12px; }
.hero-card p { color: var(--text-2); font-size: 17px; max-width: 640px; margin: 0; }
.hero-card .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.grad { background: linear-gradient(90deg, var(--text) 0%, var(--brand-text) 55%, var(--accent-2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 30px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--border); }
.hero-stats div { background: var(--surface); padding: 14px 16px; }
.hero-stats b { display: block; font-size: 24px; letter-spacing: -.02em; font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-stats span { color: var(--text-2); font-size: 13px; }

/* resume cards */
.resume { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; }
.resume .pct { font-size: 34px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.resume .pct small { font-size: 16px; color: var(--text-3); margin-left: 1px; }
.resume h3 { margin-bottom: 2px; }
.resume .sub { color: var(--text-3); font-size: 13px; }

/* recommended timeline */
.timeline { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.step { display: grid; grid-template-columns: 44px 48px minmax(0, 1fr) 20px; gap: 16px; align-items: center; padding: 20px 22px; color: var(--text); border-top: 1px solid var(--border); }
.step:first-child { border-top: 0; }
.step:hover { background: var(--bg-elev); text-decoration: none; }
.step .num { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.step.done .num { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.step h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.step p { margin: 0; color: var(--text-2); font-size: 14px; }
.step .go { color: var(--text-3); }
.timeline-foot { padding: 14px 22px; color: var(--text-3); font-size: 13.5px; border-top: 1px solid var(--border); background: var(--bg-elev); }

/* study plans */
.plan-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.plan-meta span { display: block; color: var(--text-3); font-size: 12px; }
.plan-meta b { font-size: 14px; font-weight: 500; }

/* companies */
.company { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; }
.logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; flex: 0 0 auto; }
.company h3 { font-size: 14.5px; }
.company .sub { color: var(--text-3); font-size: 12.5px; }

/* focus areas */
.focus { flex-direction: row; gap: 14px; align-items: flex-start; }
.focus .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.focus .count { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- list rows (plans, sections, companies) */
.list { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.row-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 20px; color: var(--text); border-top: 1px solid var(--border); }
.row-item:first-child { border-top: 0; }
.row-item:hover { background: var(--bg-elev); text-decoration: none; }
.row-item h3 { margin: 0 0 3px; font-size: 15px; font-weight: 600; }
.row-item p { margin: 0; color: var(--text-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-item .meta { display: flex; gap: 6px; align-items: center; color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.row-item .status { width: 18px; height: 18px; margin: 0; }
.row-item .status.done svg { width: 12px; height: 12px; }
.list-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.list-head .progress { flex: 1; min-width: 200px; max-width: 360px; }
.list-head .progress .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }

/* ---------------------------------------------------------------- note page */
.note-wrap { display: grid; grid-template-columns: minmax(0, 760px) 220px; gap: 56px; max-width: 1040px; margin: 0 auto; }
.note-head h1 { font-size: clamp(28px, 3.4vw, 38px); line-height: 1.15; letter-spacing: -.03em; font-weight: 600; margin: 0 0 10px; }
.note-head .summary { color: var(--text-2); font-size: 17px; margin: 0 0 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.note-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 22px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }

.prose { font-size: 16px; line-height: 1.75; color: var(--text); }
.prose h1 { display: none; }
.prose h2 { font-size: 23px; letter-spacing: -.02em; font-weight: 600; margin: 48px 0 12px; scroll-margin-top: 84px; }
.prose h3 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 32px 0 10px; scroll-margin-top: 84px; }
.prose h4 { font-size: 16px; margin: 24px 0 8px; }
.prose p { margin: 14px 0; }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--text-3); }
.prose a { text-decoration: underline; text-decoration-color: var(--brand-line); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose blockquote { margin: 20px 0; padding: 12px 18px; border: 1px solid var(--brand-line); background: var(--brand-soft); border-radius: 12px; color: var(--text); }
.prose blockquote p { margin: 4px 0; }
.prose blockquote.tldr { background: var(--glow), var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px 12px; margin: 22px 0 8px; }
.prose blockquote.tldr .tldr-label { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--brand-text); }
.prose blockquote.tldr .tldr-label .ic { width: 16px; height: 16px; }
.prose blockquote.tldr ul { margin: 0; padding-left: 20px; }
.prose blockquote.tldr li { margin: 6px 0; font-size: 15.5px; }
.prose blockquote.tldr li::marker { color: var(--brand-text); }
.prose code { font: 0.86em var(--mono); background: var(--code-bg); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
.prose pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; margin: 18px 0; display: block; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; line-height: 1.55; }
.prose th { background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--text-2); }
.prose tr:last-child td { border-bottom: 0; }
.prose td + td, .prose th + th { border-left: 1px solid var(--border); }
.prose img { max-width: 100%; height: auto; }
.prose figure.diagram { margin: 26px 0; }
.prose figure.diagram .frame { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: #fff; }
.prose figure.diagram img { display: block; width: 100%; filter: var(--diagram-filter); cursor: zoom-in; }
.prose figure.diagram figcaption { font-size: 12.5px; color: var(--text-3); margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.prose figure.diagram figcaption span { margin-right: auto; }
.prose figure.diagram figcaption a { color: var(--text-2); text-decoration: none; }
.prose figure.diagram figcaption a:hover { color: var(--text); }
.prose details { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin: 10px 0; }
.prose details > summary { cursor: pointer; padding: 14px 16px; font-weight: 500; list-style: none; display: flex; gap: 12px; line-height: 1.5; }
.prose details > summary::before { content: "Q"; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px; background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.prose details > summary::-webkit-details-marker { display: none; }
.prose details[open] > summary { border-bottom: 1px solid var(--border); }
.prose details > :not(summary) { padding: 0 18px 0 50px; }
.prose .anchor { opacity: 0; margin-left: 8px; font-weight: 400; color: var(--text-3); text-decoration: none; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }

.toc { position: sticky; top: 92px; align-self: start; font-size: 13px; max-height: calc(100vh - 120px); overflow-y: auto; }
.toc h4 { font-size: 12px; font-weight: 500; color: var(--text-3); margin: 0 0 10px; }
.toc a { display: block; color: var(--text-2); padding: 4px 0 4px 12px; border-left: 1px solid var(--border); line-height: 1.4; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.on { color: var(--brand-text); border-left-color: var(--brand-text); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); color: var(--text); font-weight: 500; }
.pager a:hover { text-decoration: none; border-color: var(--border-strong); }
.pager small { display: block; color: var(--text-3); font-weight: 400; font-size: 12.5px; }
.pager .next { text-align: right; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .8); z-index: 60; display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; background: #fff; border-radius: 14px; filter: var(--diagram-filter); }

/* ---------------------------------------------------------------- search */
.search-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); z-index: 50; display: flex; justify-content: center; padding: 12vh 16px 16px; }
.search-modal[hidden] { display: none; }
.search-box { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; align-self: flex-start; }
.search-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.search-input input { flex: 1; border: 0; padding: 16px 0; font: 16px var(--font); background: transparent; color: var(--text); outline: none; }
.search-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.search-results a { display: block; padding: 10px 12px; color: var(--text); border-radius: 10px; }
.search-results a:hover, .search-results a.sel { background: var(--surface-2); text-decoration: none; }
.search-results small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.search-results mark { background: var(--brand-soft); color: var(--brand-text); border-radius: 3px; }
.search-hint { padding: 10px 16px; color: var(--text-3); font-size: 12px; display: flex; gap: 6px; align-items: center; border-top: 1px solid var(--border); }
.empty { padding: 18px; color: var(--text-3); font-size: 14px; }

/* ---------------------------------------------------------------- flashcards */
.fc-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 18px; }
select, input[type="number"], input[type="text"] {
  font: 14px var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px;
}
.flashcard {
  max-width: 780px; min-height: 300px; background: var(--glow), var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 28px 30px; cursor: pointer; position: relative;
}
.flashcard .label { font-size: 12.5px; color: var(--text-3); font-weight: 500; display: flex; gap: 8px; align-items: center; }
.flashcard .q { font-size: 22px; font-weight: 600; letter-spacing: -.015em; line-height: 1.4; margin: 14px 0 10px; }
.flashcard .src { color: var(--text-3); font-size: 13px; }
.flashcard .a { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 6px; }
.fc-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.boxes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.boxes span { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-2); background: var(--surface); }

/* ---------------------------------------------------------------- diagrams */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.gallery .thumb { background: #fff; }
.gallery img { width: 100%; height: 190px; object-fit: contain; filter: var(--diagram-filter); cursor: zoom-in; display: block; }
.gallery figcaption { padding: 12px 14px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border); color: var(--text-2); }
.gallery figcaption b { font-size: 13.5px; color: var(--text); font-weight: 600; font-family: var(--mono); }

/* ---------------------------------------------------------------- labs */
.lab { max-width: 1120px; margin: 0 auto; }
.lab-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.panel h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.out > * + * { margin-top: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.field label b { color: var(--text); font-family: var(--mono); font-weight: 500; font-size: 12.5px; }
input[type="range"] { width: 100%; accent-color: var(--brand-text); }
:root[data-theme="dark"] input[type="range"] { accent-color: #d9f45e; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--border); background: var(--surface-2); padding: 5px 10px; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.seg button:hover { color: var(--text); border-color: var(--border-strong); }
.seg button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi span { display: block; color: var(--text-2); font-size: 12.5px; }
.kpi b { font-size: 22px; letter-spacing: -.02em; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi small { display: block; color: var(--text-3); font-size: 12px; }
.explain { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; line-height: 1.7; }
.callout { border: 1px solid var(--brand-line); background: var(--brand-soft); padding: 12px 16px; border-radius: 12px; font-size: 14px; }
.callout.good { border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.callout.bad { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--text-2); font: 12px var(--font); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin: 6px 0 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12.5px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { border-bottom: 1px solid var(--border); padding: 8px; text-align: right; font-variant-numeric: tabular-nums; }
.data-table th { color: var(--text-3); font-weight: 500; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.lab-note { color: var(--text-2); font-size: 13.5px; }

/* ---------------------------------------------------------------- your progress (local profile) */
a.side-progress { display: block; color: var(--text); transition: border-color .15s, background .15s; }
a.side-progress:hover, a.side-progress.active { text-decoration: none; border-color: var(--brand-line); background: var(--bg-elev); }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.avatar.xl { width: 72px; height: 72px; font-size: 26px; }
.avatar.xl .ic { width: 32px; height: 32px; }
.me-btn .avatar { width: 26px; height: 26px; font-size: 11px; }
.welcome { margin-top: 16px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.welcome-main { display: flex; gap: 14px; align-items: flex-start; flex: 1 1 360px; min-width: 0; }
.welcome-main .icon-tile, .welcome-main .avatar { flex: 0 0 auto; }
.welcome h3 { margin-bottom: 4px; }
.welcome .cta { display: flex; gap: 10px; flex-wrap: wrap; }
.welcome .local-note { flex-basis: 100%; }
.name-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.welcome .name-form { margin-top: 0; }
.name-form input { flex: 1 1 200px; min-width: 0; max-width: 320px; padding: 8px 12px; }
input[type="text"]:focus, textarea:focus { outline: 2px solid var(--brand-line); outline-offset: 1px; border-color: var(--brand-line); }
.local-note { display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.local-note .ic { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 2px; }
.callout.local { display: flex; gap: 12px; align-items: flex-start; line-height: 1.6; color: var(--text-2); }
.callout.local b, .callout.bad b { color: var(--text); }
.callout.local > .ic, .callout.bad > .ic { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; color: var(--brand-text); }
.callout.bad { display: flex; gap: 12px; align-items: flex-start; }
.profile-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.profile-head h1 { margin-bottom: 4px; }

/* dialog */
.modal { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); display: flex; justify-content: center; align-items: flex-start; padding: 14vh 16px 16px; }
.modal-box { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.modal-box h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.02em; font-weight: 600; }
.modal-box p { margin: 0; color: var(--text-2); font-size: 14px; }
.modal-box input { padding: 10px 12px; font-size: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* personal notes on a note page */
.memo { margin-top: 40px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 16px; }
.memo-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.memo-head h4 { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.memo-head .ic { width: 15px; height: 15px; }
.memo-status { color: var(--text-3); font-size: 12px; }
textarea { width: 100%; resize: vertical; min-height: 96px; font: 14px/1.6 var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }

/* activity heatmap */
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; grid-template-rows: repeat(7, 13px); grid-auto-flow: column; grid-auto-columns: 13px; gap: 4px; width: max-content; }
.heat i, .heat-legend i { display: block; width: 13px; height: 13px; border-radius: 3px; background: var(--surface-3); }
.heat .l1, .heat-legend .l1 { background: color-mix(in srgb, var(--brand-text) 28%, var(--surface-3)); }
.heat .l2, .heat-legend .l2 { background: color-mix(in srgb, var(--brand-text) 52%, var(--surface-3)); }
.heat .l3, .heat-legend .l3 { background: color-mix(in srgb, var(--brand-text) 76%, var(--surface-3)); }
.heat .l4, .heat-legend .l4 { background: var(--brand-text); }
.heat-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: var(--text-3); font-size: 12.5px; }
.heat-legend .scale { display: inline-flex; align-items: center; gap: 4px; }
.heat-legend .scale i { width: 11px; height: 11px; }

.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row-item.compact { padding: 12px 16px; }
.row-item.compact h3 { font-size: 14px; }
.row-item.compact p { font-size: 12.5px; color: var(--text-3); }
.grid.block > section { min-width: 0; }
.sec-progress { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; }
.sec-progress a { display: grid; grid-template-columns: 18px minmax(0, 1fr) minmax(80px, 160px) 44px; gap: 10px; align-items: center; padding: 9px 4px; color: var(--text); border-bottom: 1px solid var(--border); font-size: 14px; }
.sec-progress a:hover { text-decoration: none; color: var(--brand-text); }
.sec-progress .ic { width: 16px; height: 16px; color: var(--text-3); }
.sec-progress span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-progress .bar { margin: 0; }
.sec-progress b { font-weight: 500; font-size: 12.5px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.data-actions { gap: 0; padding: 4px 20px; }
.data-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.data-row:first-child { border-top: 0; }
.data-row p { margin-top: 2px; }
.data-row .btn { flex: 0 0 auto; cursor: pointer; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .note-wrap { grid-template-columns: minmax(0, 1fr); max-width: 780px; }
  .toc { display: none; }
  .grid.c4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .top-links { display: none; }
  .menu-btn { display: inline-grid; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 40; top: var(--header-h); left: 0; width: 290px; background: var(--bg);
    transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0, 0, 0, .4); z-index: 35; }
  .scrim[hidden] { display: none; }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  main { padding: 24px 16px 72px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .hero-card { padding: 24px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-trigger { min-width: 0; }
  .search-trigger .label, .search-trigger kbd { display: none; }
  .step { grid-template-columns: 30px minmax(0, 1fr) 16px; padding: 16px; }
  .step .icon-tile { display: none; }
  .resume { grid-template-columns: auto 1fr; }
  .resume .btn { grid-column: 1 / -1; }
  .pager { grid-template-columns: 1fr; }
  .brand-name span { display: none; }
  .row-item { grid-template-columns: 20px minmax(0, 1fr); }
  .row-item .meta { grid-column: 2; }
  .sec-progress { grid-template-columns: 1fr; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-row { flex-direction: column; align-items: flex-start; }
  .welcome .name-form { flex-basis: 100%; }
  .name-form input { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
