/* =========================================================
   Kho Kiến Thức — Design tokens (Swiss / Minimal)
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap');

:root {
  --bg: #F8FAFC;
  --fg: #1E293B;
  --card: #FFFFFF;
  --muted: #EAEFF3;
  --muted-fg: #475569;
  --border: #E2E8F0;
  --primary: #475569;
  --accent: #2563EB;
  --on-accent: #FFFFFF;
  --grid-dot: #CBD5E1;

  /* Màu nhánh sơ đồ */
  --b0: #2563EB; --b1: #0D9488; --b2: #7C3AED; --b3: #D97706;
  --b4: #E11D48; --b5: #16A34A; --b6: #0891B2; --b7: #9333EA;

  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
}

[data-theme="dark"] {
  --bg: #0B1120;
  --fg: #E2E8F0;
  --card: #111827;
  --muted: #1E293B;
  --muted-fg: #94A3B8;
  --border: #253041;
  --primary: #94A3B8;
  --accent: #60A5FA;
  --on-accent: #0B1120;
  --grid-dot: #1E293B;
  --b0: #60A5FA; --b1: #2DD4BF; --b2: #A78BFA; --b3: #FBBF24;
  --b4: #FB7185; --b5: #4ADE80; --b6: #22D3EE; --b7: #C084FC;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 4px 12px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  /* Chống sao chép (lớp CSS) */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea { -webkit-user-select: text; user-select: text; font: inherit; }
img, svg { -webkit-user-drag: none; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.btn-icon {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--fg);
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn-icon:hover { background: var(--muted); }
.btn-icon[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--fg);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none;
  transition: background-color .2s, border-color .2s, transform .15s;
}
.btn:hover { background: var(--muted); }
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: 1200px; margin: 0 auto; padding: var(--space-3) var(--space-5);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.brand { display: flex; align-items: center; gap: var(--space-3); font-weight: 700; font-size: 18px; color: var(--fg); text-decoration: none; }
.brand__mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--fg); color: var(--bg); }

/* ---------- Home ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-5); }
.hero { padding: var(--space-8) 0 var(--space-6); max-width: 760px; }
.hero__eyebrow { font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--space-3); }
.hero h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.15; margin: 0 0 var(--space-4); letter-spacing: -.02em; }
.hero p { font-size: 18px; color: var(--muted-fg); margin: 0 0 var(--space-6); }

.search { position: relative; }
.search .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted-fg); }
.search input {
  width: 100%; min-height: 56px; padding: 0 var(--space-4) 0 48px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--fg); font-size: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: var(--space-6) 0 var(--space-4); }
.section-title h2 { font-size: 20px; margin: 0; }
.section-title span { color: var(--muted-fg); font-size: 14px; }
.section-title__sub { margin: 4px 0 0; color: var(--muted-fg); font-size: 14px; }
.topic-grid--compact { padding-bottom: var(--space-4); }
.home-section { border-top: 1px solid var(--border); margin-top: var(--space-4); }

/* Thẻ bộ câu hỏi phỏng vấn */
.qa-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); padding-bottom: var(--space-8); }
.qa-card {
  position: relative; display: flex; gap: var(--space-4); padding: var(--space-4); color: inherit; text-decoration: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 7%, var(--card)) 0%, var(--card) 55%);
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.qa-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
a.qa-card:hover { border-color: var(--c); box-shadow: var(--shadow); transform: translateY(-2px); }
a.qa-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qa-card__mark {
  position: relative; flex: none; width: 76px; height: 76px; border-radius: 18px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
}
.qa-card__q { font-size: 44px; font-weight: 800; line-height: 1; color: var(--c); font-family: Georgia, 'Times New Roman', serif; }
.qa-card__icon {
  position: absolute; right: -8px; bottom: -8px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--card); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 35%, var(--border)); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08));
}
.qa-card__icon .icon { width: 17px; height: 17px; }
.qa-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.qa-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.qa-card__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c); }
.qa-card__count { font-size: 13px; color: var(--muted-fg); font-weight: 500; }
.qa-card__title { margin: 0; font-size: 22px; line-height: 1.25; }
.qa-card__desc { margin: 0; color: var(--muted-fg); font-size: 14.5px; }
.qa-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.qa-tag { font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: 99px; background: var(--muted, color-mix(in srgb, var(--fg) 6%, transparent)); color: var(--fg); border: 1px solid var(--border); }
.qa-card__foot { margin-top: auto; padding-top: var(--space-2); display: flex; align-items: center; }
.qa-card__status { font-size: 13px; color: var(--muted-fg); font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.qa-card__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .6; animation: qaPulse 1.8s ease-in-out infinite; }
@keyframes qaPulse { 50% { opacity: .15; } }
.qa-card__go { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--c); }
.qa-card__go .icon { width: 16px; height: 16px; transition: transform .2s; }
a.qa-card:hover .qa-card__go .icon { transform: translateX(3px); }
.qa-card.is-soon { cursor: default; border-style: dashed; }
.qa-card.is-soon .qa-card__mark, .qa-card.is-soon .qa-tag { opacity: .8; }
@media (max-width: 479px) { .qa-card__mark { width: 60px; height: 60px; } .qa-card__q { font-size: 34px; } .qa-card__title { font-size: 19px; } }
@media (prefers-reduced-motion: reduce) { .qa-card__status::before { animation: none; } a.qa-card:hover { transform: none; } }

.topic-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); padding-bottom: var(--space-8); }
.topic-card {
  --c: var(--accent);
  position: relative; display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--card); color: var(--fg); text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .25s, transform .25s var(--ease-out);
  opacity: 0; animation: revealIn .45s var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 70ms);
}
.topic-card:hover { border-color: var(--c); box-shadow: var(--shadow); transform: translateY(-2px); }
.topic-card__icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.topic-card__icon .icon { width: 24px; height: 24px; }
.topic-card h3 { margin: 0; font-size: 19px; }
.topic-card p { margin: 0; color: var(--muted-fg); font-size: 15px; flex: 1; }
.topic-card__meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted-fg); font-weight: 500; }
.progress { height: 6px; border-radius: 99px; background: var(--muted); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--c, var(--accent)); border-radius: inherit; transition: width .4s var(--ease-out); }

.results { display: grid; gap: var(--space-2); padding-bottom: var(--space-8); }
.result {
  display: block; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  color: var(--fg); text-decoration: none; transition: border-color .2s, background-color .2s;
}
.result:hover { border-color: var(--accent); }
.result__path { font-size: 13px; color: var(--muted-fg); }
.result__title { font-weight: 600; }
.result__snip { font-size: 14px; color: var(--muted-fg); margin-top: 2px; }
.result mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; }
.empty { color: var(--muted-fg); padding: var(--space-5) 0; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted-fg); font-size: 14px; padding: var(--space-5) 0; }

/* ---------- Topic page ---------- */
body.topic-page { height: 100vh; height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.toolbar {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border); background: var(--card); z-index: 10;
}
.toolbar__title { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-3); }
.toolbar__title h1 { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar__title .chip-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); flex: none; }
.toolbar__group { display: flex; gap: var(--space-2); }
.toolbar .divider { width: 1px; height: 28px; background: var(--border); margin: 0 var(--space-1); }

.stage { position: relative; overflow: hidden; }
.viewport {
  position: absolute; inset: 0; cursor: grab; touch-action: none;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 22px 22px;
}
.viewport.is-dragging { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.edges path { fill: none; stroke-width: 2; stroke-linecap: round; }

.mm-node {
  --b: var(--primary);
  position: absolute; left: 0; top: 0;
  display: flex; align-items: stretch; min-height: 44px; width: max-content; max-width: 250px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-left: 4px solid var(--b);
  border-radius: 10px; box-shadow: var(--shadow-sm);
  will-change: transform, opacity;
  transition: box-shadow .2s, border-color .2s, background-color .2s;
}
.mm-node:hover { box-shadow: var(--shadow); }
.mm-node__main {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; align-items: center; gap: var(--space-2);
  padding: 10px 14px; font-weight: 600; font-size: 15px; line-height: 1.35;
}
.mm-node__main:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.mm-node[data-depth="2"] .mm-node__main,
.mm-node[data-depth="3"] .mm-node__main,
.mm-node[data-depth="4"] .mm-node__main { font-size: 14px; font-weight: 500; }
.mm-node[data-depth="0"] { background: var(--fg); color: var(--bg); border: 1px solid var(--fg); max-width: 280px; }
.mm-node[data-depth="0"] .mm-node__main { font-size: 18px; font-weight: 700; padding: 14px 18px; }
.mm-node__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; border: 2px solid var(--b); }
.mm-node.is-visited .mm-node__dot { background: var(--b); }
.mm-node[data-depth="0"] .mm-node__dot { display: none; }
.mm-node__toggle {
  all: unset; box-sizing: border-box; cursor: pointer;
  min-width: 40px; padding: 0 8px; display: grid; place-items: center;
  border-left: 1px solid var(--border); border-radius: 0 9px 9px 0;
  font-size: 12px; font-weight: 700; color: var(--muted-fg); background: var(--muted);
  transition: background-color .2s, color .2s;
}
.mm-node__toggle:hover { color: var(--b); }
.mm-node__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mm-node[data-depth="0"] .mm-node__toggle { background: transparent; color: inherit; border-left-color: color-mix(in srgb, var(--bg) 25%, transparent); }
.mm-node.is-selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--b) 40%, transparent), var(--shadow); }
.mm-node[data-depth="0"].is-selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow); }

.canvas-controls { position: absolute; left: var(--space-4); bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); z-index: 5; }
.canvas-hint {
  position: absolute; left: 50%; top: var(--space-4); transform: translateX(-50%);
  padding: 6px 14px; border-radius: 99px; font-size: 13px; color: var(--muted-fg);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  white-space: nowrap; transition: opacity .4s; z-index: 4;
}
.canvas-hint.is-hidden { opacity: 0; pointer-events: none; }

/* ---------- Panel ---------- */
.panel {
  position: absolute; top: var(--space-3); right: var(--space-3); bottom: var(--space-3);
  width: 400px; z-index: 6;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: transform .32s var(--ease-out), opacity .25s;
}
.panel.is-closed { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
.panel__head { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-4) var(--space-4) 0 var(--space-5); }
.crumbs { flex: 1; display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; font-size: 13px; color: var(--muted-fg); padding-top: 12px; }
.crumbs button { all: unset; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.crumbs button:hover { color: var(--accent); text-decoration: underline; }
.crumbs .icon { width: 14px; height: 14px; }
.panel__body { flex: 1; overflow-y: auto; padding: var(--space-3) var(--space-5) var(--space-5); overscroll-behavior: contain; }
.panel__body h2 { font-size: 22px; line-height: 1.3; margin: var(--space-2) 0 var(--space-4); letter-spacing: -.01em; }
.panel__body h3 { font-size: 16px; margin: var(--space-5) 0 var(--space-2); }
.panel__body p { margin: 0 0 var(--space-3); }
.panel__body ul { margin: 0 0 var(--space-3); padding-left: 20px; }
.panel__body li { margin-bottom: 6px; }
.panel__body li::marker { color: var(--b, var(--accent)); }
.panel__body strong { font-weight: 700; }
.panel__body code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--muted); padding: 1px 6px; border-radius: 4px; }
.callout { border-left: 3px solid var(--b, var(--accent)); background: var(--muted); padding: var(--space-3) var(--space-4); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 var(--space-3); font-size: 15px; }
.kids { margin-top: var(--space-5); }
.kids__label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-fg); margin-bottom: var(--space-2); }
.kid {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: var(--space-3); min-height: 44px;
  padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .2s, background-color .2s;
}
.kid:hover { border-color: var(--b, var(--accent)); background: var(--muted); }
.kid:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kid span { flex: 1; font-weight: 500; font-size: 15px; }
.kid .icon { width: 16px; height: 16px; color: var(--muted-fg); }
.kid.is-visited span::after { content: " ✓"; color: var(--b, var(--accent)); }

.panel__foot { border-top: 1px solid var(--border); padding: var(--space-3) var(--space-4); display: grid; gap: var(--space-3); }
.panel__progress { display: flex; align-items: center; gap: var(--space-3); font-size: 13px; color: var(--muted-fg); }
.panel__progress .progress { flex: 1; }
.panel__nav { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2); }
.panel__nav .btn--primary { justify-content: space-between; min-width: 0; }
.panel__nav .btn--primary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.panel-open-fab { position: absolute; right: var(--space-4); bottom: var(--space-4); z-index: 5; box-shadow: var(--shadow); }

.reveal { opacity: 0; animation: revealIn .45s var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 110ms); }
@keyframes revealIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 99px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease-out); z-index: 100;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted-fg); }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 58%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .panel.is-closed { transform: translateY(calc(100% + 24px)); }
  .canvas-controls { bottom: auto; top: var(--space-4); }
  .canvas-hint { display: none; }
}
@media (max-width: 640px) {
  .toolbar { padding: var(--space-2); gap: 4px; }
  .toolbar .hide-sm { display: none; }
  .toolbar__title .chip-icon { display: none; }
  .hero { padding-top: var(--space-6); }
  .container, .site-header__inner { padding-left: var(--space-4); padding-right: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .reveal, .topic-card { opacity: 1; }
}

/* ---------- Chống in ---------- */
@media print {
  body > * { display: none !important; }
  body::before { content: "Nội dung này không hỗ trợ in ấn."; display: block; padding: 40px; font-size: 18px; }
}

/* =========================================================
   Nội dung dùng chung: bảng, mã, nhãn bổ sung, nhãn nguồn
   ========================================================= */
:root { --added: #B45309; --added-bg: #FEF3C7; }
[data-theme="dark"] { --added: #FBBF24; --added-bg: rgba(251, 191, 36, .14); }

.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost .icon { width: 18px; height: 18px; }
.link-btn { all: unset; cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--accent); }
kbd { font-family: inherit; font-size: .85em; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--card); }

.table-wrap { overflow-x: auto; margin: 0 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .92em; line-height: 1.4; }
.table-wrap th, .table-wrap td { text-align: left; padding: .45em .7em; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-wrap th { background: var(--muted); font-weight: 700; color: var(--fg); }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td:first-child { font-weight: 600; }
.table-wrap tr.is-added td { background: var(--added-bg); }

pre.code {
  position: relative; margin: 0 0 var(--space-3); padding: .8em 1em; overflow-x: auto;
  background: #0F172A; color: #E2E8F0; border-radius: var(--radius-sm);
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .82em; line-height: 1.55; white-space: pre;
}
[data-theme="dark"] pre.code { background: #020617; border: 1px solid var(--border); }
pre.code .added-tag { position: absolute; top: 6px; right: 8px; }

.added-tag {
  display: inline-block; margin-left: .5em; padding: 0 .5em; vertical-align: .1em;
  font-size: .68em; font-weight: 700; line-height: 1.6; letter-spacing: .02em; white-space: nowrap;
  color: var(--added); background: var(--added-bg); border: 1px solid color-mix(in srgb, var(--added) 35%, transparent); border-radius: 99px;
}
li.is-added::marker { color: var(--added); }
.callout.is-added { border-left-color: var(--added); }

.meta-line { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-2); }
.meta-chip { font-size: 12px; font-weight: 600; color: var(--muted-fg); background: var(--muted); border-radius: 99px; padding: 2px 10px; }
.meta-chip--added { color: var(--added); background: var(--added-bg); }
.panel__body .table-wrap { font-size: 14px; }

/* =========================================================
   Trình chiếu: mỗi trang = một chủ đề lớn, bấm để hiện từng ô
   ========================================================= */
body.slides-page { height: 100vh; height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; --topic: var(--accent); }
.deck { position: relative; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.page {
  --b: var(--topic);
  max-width: 1040px; margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-7);
  font-size: 16.5px; line-height: 1.6;
}
.page.enter-next { animation: enterNext .38s var(--ease-out); }
.page.enter-prev { animation: enterPrev .38s var(--ease-out); }
@keyframes enterNext { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes enterPrev { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

.page__head { position: relative; padding: var(--space-5) var(--space-6); margin-bottom: var(--space-5);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.page__head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--b); }
.page__eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--b); margin-bottom: 6px; }
.page__num { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; background: var(--b); color: #fff; font-size: 13px; letter-spacing: 0; }
.page__title { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.2; margin: 0 0 var(--space-3); letter-spacing: -.015em; }
.page__head .meta-line { margin: 0 0 var(--space-3); }
.page__lead { color: var(--muted-fg); }
.page__lead > :last-child { margin-bottom: 0; }
.page__lead strong { color: var(--fg); }

.boxes { display: grid; gap: var(--space-4); }
.box {
  position: relative; padding: var(--space-4) var(--space-5) var(--space-4);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  scroll-margin: 16px 0 96px;
}
.box.is-hidden { display: none; }
.box.is-new { animation: boxIn .5s var(--ease-out); }
.box.is-current { border-color: color-mix(in srgb, var(--b) 55%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--b) 14%, transparent), var(--shadow); }
@keyframes boxIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.box__head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.box__num { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-size: 14px; font-weight: 700;
  background: color-mix(in srgb, var(--b) 14%, transparent); color: var(--b); }
.box__title { flex: 1; font-size: 19px; line-height: 1.3; margin: 0; }
.box__body > :last-child { margin-bottom: 0; }

/* Nội dung trong trang trình chiếu */
.page p { margin: 0 0 .65em; }
.page h3 { font-size: 1.02em; margin: 1em 0 .4em; color: var(--b); }
.page ul { margin: 0 0 .75em; padding-left: 1.3em; }
.page ul.cols-2 { columns: 2; column-gap: 2.5em; }
.page li { margin-bottom: .35em; break-inside: avoid; }
.page li::marker { color: var(--b); }
.page .callout { padding: .6em 1em; margin-bottom: .75em; border-left-color: var(--b); }
.page .table-wrap { margin-bottom: .75em; }
.page .table-wrap table { font-size: .92em; }
.page pre.code { font-size: .82em; margin-bottom: .75em; }
.page code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--muted); padding: .05em .35em; border-radius: .25em; }

.next-hint {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; margin-top: var(--space-4); padding: var(--space-3);
  border: 2px dashed var(--border); border-radius: var(--radius-lg); color: var(--muted-fg); font-weight: 600; font-size: 15px;
  transition: border-color .2s, color .2s, background-color .2s;
}
.next-hint:hover { border-color: var(--b); color: var(--b); background: color-mix(in srgb, var(--b) 6%, transparent); }
.next-hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.next-hint .icon { width: 18px; height: 18px; transform: rotate(90deg); }
.next-hint--page .icon { transform: none; }

/* Trang bìa */
.cover { padding-top: var(--space-6); padding-bottom: var(--space-4); }
.cover__eyebrow { font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--topic); margin-bottom: var(--space-2); }
.cover__title { font-size: clamp(30px, 4.6vw, 48px); line-height: 1.15; margin: 0 0 var(--space-4); letter-spacing: -.02em; }
.cover__lead { max-width: 52em; font-size: 17px; color: var(--muted-fg); margin-bottom: var(--space-6); }
.cover__lead strong { color: var(--fg); }
.cover__group { margin-bottom: var(--space-5); }
.cover__group-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-fg); margin: 0 0 var(--space-3); }
.cover__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-3); }
.chapter-card {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); min-height: 64px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: border-color .2s, transform .2s var(--ease-out), box-shadow .2s;
}
.chapter-card:hover { border-color: var(--c); transform: translateY(-2px); box-shadow: var(--shadow); }
.chapter-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chapter-card__num { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-weight: 700; font-size: 14px;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.chapter-card__t { font-weight: 600; line-height: 1.35; font-size: 15px; }
.chapter-card__s { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--muted-fg); }
.chapter-card.is-visited .chapter-card__s::after { content: " · đã xem"; color: var(--c); }

.deck-hint { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 5; margin: 0; padding: 6px 14px; border-radius: 99px;
  font-size: 13px; color: var(--muted-fg); background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); transition: opacity .4s; pointer-events: none; white-space: nowrap; }
.deck-hint.is-hidden { opacity: 0; }
.loading-text { color: var(--muted-fg); padding: var(--space-6); text-align: center; }

.deck-bar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-5) var(--space-3); border-top: 1px solid var(--border); background: var(--card); }
.deck-bar__mid { flex: 1; min-width: 0; display: grid; gap: 6px; }
.deck-bar__info { display: flex; align-items: center; gap: var(--space-3); font-size: 13px; color: var(--muted-fg); font-weight: 500; min-height: 24px; }
.deck-bar__info b { color: var(--fg); font-weight: 600; }
.deck-bar .progress > i { background: var(--topic); transition: width .3s var(--ease-out); }
.deck-bar #btn-next { max-width: 42%; min-width: 120px; }
.deck-bar #btn-next span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { display: inline-flex; gap: 4px; align-items: center; }
.steps i { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background-color .2s; }
.steps i.on { background: var(--topic); }

.outline {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); z-index: 40;
  display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transition: transform .3s var(--ease-out);
}
.outline.is-closed { transform: translateX(105%); }
.outline__head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.outline__list { overflow-y: auto; padding: var(--space-2) var(--space-2) var(--space-6); overscroll-behavior: contain; }
.outline__group { margin: var(--space-4) 10px var(--space-1); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--topic); }
.outline__item {
  all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 8px; font-size: 14px; line-height: 1.35; color: var(--fg); font-weight: 500;
}
.outline__item span:first-child { flex: none; min-width: 22px; font-weight: 700; color: var(--muted-fg); }
.outline__item:hover { background: var(--muted); }
.outline__item:focus-visible { outline: 2px solid var(--accent); }
.outline__item.is-visited::after { content: "✓"; margin-left: auto; color: var(--topic); }
.outline__item.is-current { background: color-mix(in srgb, var(--topic) 14%, transparent); }
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 35; }

@media (max-width: 719px) {
  .page { padding: var(--space-4) var(--space-3) var(--space-6); font-size: 16px; }
  .page__head { padding: var(--space-4); }
  .box { padding: var(--space-3) var(--space-4); }
  .page ul.cols-2 { columns: 1; }
  .deck-hint { display: none; }
  .deck-bar { padding: var(--space-2); }
  .deck-bar #btn-next { max-width: 55%; }
  #btn-all { display: none; }
}
body.slides-page > *, body.topic-page > * { min-width: 0; }
.toolbar__title { overflow: hidden; }
@media (max-width: 479px) {
  .deck-bar .steps { display: none; }
  .deck-bar #btn-next { min-width: 0; }
  .deck-bar__info { white-space: nowrap; overflow: hidden; }
}

/* =========================================================
   Sơ đồ chuỗi bước & lưới icon (dùng chung)
   ========================================================= */
.f0 { --fc: var(--b0); } .f1 { --fc: var(--b1); } .f2 { --fc: var(--b2); }
.f3 { --fc: var(--b3); } .f4 { --fc: var(--b4, #DB2777); } .f5 { --fc: var(--b5, #0891B2); }
.flow { container-type: inline-size; margin: .2em 0 .9em; }
.flow__track { display: flex; align-items: stretch; gap: .45em; }
.flow__node {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .25em;
  padding: .65em .7em; border-radius: .7em;
  background: color-mix(in srgb, var(--fc) 11%, var(--card));
  border: 1px solid color-mix(in srgb, var(--fc) 38%, transparent);
}
.flow__icon { display: grid; place-items: center; width: 2em; height: 2em; border-radius: 50%; background: color-mix(in srgb, var(--fc) 20%, transparent); color: var(--fc); }
.flow__icon .icon { width: 1.15em; height: 1.15em; }
.flow__label { font-weight: 650; font-size: .93em; line-height: 1.3; color: var(--fg); }
.flow__cap { font-size: .8em; line-height: 1.35; color: var(--muted-fg); }
.flow__arrow { flex: none; align-self: center; display: grid; place-items: center; color: var(--muted-fg); }
.flow__arrow .icon { width: 1.1em; height: 1.1em; stroke-width: 2.5; }
.flow--v .flow__track { flex-direction: column; max-width: 34em; }
.flow--v .flow__node { flex-direction: row; justify-content: flex-start; text-align: left; column-gap: .9em; padding: .55em .9em; }
.flow--v .flow__label { flex: none; width: 13em; max-width: 50%; }
.flow--v .flow__cap { flex: 1; font-size: .86em; }
.flow--v .flow__arrow { height: 1.1em; }
.flow--v .flow__arrow .icon { transform: rotate(90deg); }
.flow--both .flow__arrow .icon { transform: none; }
.split .flow--v .flow__node, .flow--both .flow__node { flex-wrap: wrap; }
.split .flow--v .flow__label, .flow--both .flow__label { width: auto; max-width: none; }
.split .flow--v .flow__cap, .flow--both .flow__cap { flex-basis: 100%; }
.flow__back { display: flex; align-items: center; justify-content: center; gap: .5em; margin-top: .45em; padding-top: .4em;
  border-top: 2px dashed color-mix(in srgb, var(--b, var(--accent)) 35%, transparent); font-size: .8em; font-weight: 600; color: var(--b, var(--accent)); }
.flow__back .icon { width: 1.1em; height: 1.1em; }
.flow.is-added { position: relative; }
.flow > .added-tag, .icon-grid > .added-tag { position: absolute; top: -.7em; right: .4em; }
@container (max-width: 560px) {
  .flow--h .flow__track { flex-direction: column; }
  .flow--h .flow__node { flex-direction: row; justify-content: flex-start; text-align: left; flex-wrap: wrap; column-gap: .6em; }
  .flow--h .flow__cap { flex-basis: 100%; }
  .flow--h .flow__arrow .icon { transform: rotate(90deg); }
}
.icon-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr)); gap: .55em; margin: .2em 0 .9em; }
.icon-tile { display: flex; flex-direction: column; align-items: flex-start; gap: .35em; padding: .7em .8em; border-radius: .7em;
  background: color-mix(in srgb, var(--fc) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--fc) 28%, transparent); }
.icon-tile__icon { display: grid; place-items: center; width: 2.1em; height: 2.1em; border-radius: .55em; background: color-mix(in srgb, var(--fc) 18%, transparent); color: var(--fc); }
.icon-tile__icon .icon { width: 1.2em; height: 1.2em; }
.icon-tile__label { font-weight: 650; font-size: .92em; line-height: 1.3; }
.icon-tile__cap { font-size: .8em; line-height: 1.4; color: var(--muted-fg); }
.panel__body .flow, .panel__body .icon-grid { font-size: 15px; }

/* Thẻ chủ đề: liên kết phủ toàn thẻ + nút chế độ xem */
.topic-card__link { color: inherit; text-decoration: none; }
.topic-card.is-soon { border-style: dashed; cursor: default; }
.topic-card.is-soon:hover { border-color: var(--border); box-shadow: none; transform: none; }
.topic-card.is-soon .topic-card__icon { filter: grayscale(.6); opacity: .75; }
.topic-card.is-soon h3, .topic-card.is-soon p { opacity: .75; }
.topic-card__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.soon-badge { font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 4px 10px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.topic-card__soon { font-size: 13px; color: var(--muted-fg); font-weight: 500; padding-top: var(--space-2); border-top: 1px dashed var(--border); }
.topic-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.topic-card__link:focus-visible { outline: none; }
.topic-card:has(.topic-card__link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.topic-card__actions { position: relative; z-index: 1; display: flex; gap: var(--space-2); }
.topic-card__actions .btn { flex: 1; min-height: 40px; font-size: 14px; }
.topic-card__actions .icon { width: 18px; height: 18px; }
.table-wrap { overflow-y: hidden; }
.table-wrap tr.frag, .table-wrap thead.frag { transform: none; }

[hidden] { display: none !important; }

/* ---- Danh sách đặc biệt, biểu đồ, Venn, bố cục cột ---- */
ul.checklist, ul.iconlist, ol.numlist { list-style: none; padding-left: 0; }
.checklist li, .iconlist li, .numlist li { display: flex; align-items: flex-start; gap: .6em; }
.checklist li::marker, .iconlist li::marker { content: none; }
.li-icon { flex: none; display: grid; place-items: center; width: 1.6em; height: 1.6em; margin-top: -.05em; color: var(--b, var(--accent)); }
.li-icon .icon { width: 1.25em; height: 1.25em; }
.checklist .li-icon { color: var(--b5); }
.checklist .li-icon.is-off { color: var(--muted-fg); }
.iconlist .li-icon { border-radius: .45em; background: color-mix(in srgb, var(--b, var(--accent)) 12%, transparent); }
.iconlist .li-icon .icon { width: 1.05em; height: 1.05em; }
.li-text { flex: 1; min-width: 0; }
.numlist__n { flex: none; display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; font-size: .82em; font-weight: 700;
  color: var(--fc); background: color-mix(in srgb, var(--fc) 14%, transparent); border: 1.5px solid color-mix(in srgb, var(--fc) 45%, transparent); }
ol.numlist.cols-2, ul.checklist.cols-2, ul.iconlist.cols-2 { columns: 2; column-gap: 2em; }
.page li { break-inside: avoid; }
.callout--icon { display: flex; align-items: center; gap: .8em; }
.callout__icon { flex: none; display: grid; place-items: center; width: 2.3em; height: 2.3em; border-radius: 50%; background: color-mix(in srgb, var(--b, var(--accent)) 15%, transparent); color: var(--b, var(--accent)); }
.callout__icon .icon { width: 1.3em; height: 1.3em; }

.chart { margin: .2em 0 .9em; display: grid; gap: .45em; }
.chart__title { font-size: .85em; font-weight: 700; color: var(--muted-fg); margin-bottom: .1em; }
.chart__row { display: grid; grid-template-columns: minmax(6em, 32%) 1fr auto; align-items: center; gap: .7em; font-size: .92em; }
.chart__label { line-height: 1.3; }
.chart__track { height: .85em; border-radius: 99px; background: var(--muted); overflow: hidden; }
.chart__fill { display: block; height: 100%; border-radius: inherit; background: var(--fc); transform-origin: left; animation: growX .8s var(--ease-out) both; }
.chart__val { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--fg); min-width: 3em; text-align: right; }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.venn { display: flex; flex-wrap: wrap; align-items: center; gap: .6em 1.4em; margin: .2em 0 .9em; }
.venn svg { width: min(100%, 300px); height: auto; flex: none; }
.venn__c { fill: color-mix(in srgb, var(--fc) 16%, transparent); stroke: color-mix(in srgb, var(--fc) 70%, transparent); stroke-width: 1.5; }
.venn__t { font: 600 13px/1 inherit; font-family: inherit; fill: var(--fg); }
.venn__center { font-family: inherit; font-size: 12.5px; font-weight: 800; fill: var(--fg); }
.venn__legend { flex: 1 1 14em; list-style: none; padding: 0; margin: 0; display: grid; gap: .5em; }
.venn__legend li { padding-left: .8em; border-left: 3px solid var(--fc); display: grid; line-height: 1.4; }
.venn__legend span { color: var(--muted-fg); font-size: .92em; }

.split { display: grid; gap: 1.2em; align-items: start; }
.split--2 { grid-template-columns: 1fr 1fr; }
.split--3 { grid-template-columns: repeat(3, 1fr); }
.split__col > :last-child { margin-bottom: 0; }
@media (max-width: 719px) { .split--2, .split--3 { grid-template-columns: 1fr; } ol.numlist.cols-2 { columns: 1; } }

.box__num--icon .icon { width: 18px; height: 18px; }
.box__idx { flex: none; font-size: 13px; font-weight: 700; color: var(--muted-fg); }
@media (prefers-reduced-motion: reduce) { .chart__fill, .box.is-new, .page.enter-next, .page.enter-prev { animation: none; } }

.stackbar { margin: .2em 0 .9em; }
.stackbar__bar { display: flex; height: 2.2em; border-radius: .6em; overflow: hidden; border: 1px solid var(--border); }
.stackbar__seg { display: grid; place-items: center; font-weight: 700; font-size: .9em; color: var(--fg); background: color-mix(in srgb, var(--fc) 26%, var(--card)); border-right: 1px solid var(--card); min-width: 2.6em; }
.stackbar__seg:last-child { border-right: 0; }
.stackbar__legend { display: flex; margin-top: .45em; }
.stackbar__item { display: grid; align-content: start; gap: .1em; padding: 0 .4em; font-size: .85em; line-height: 1.35; min-width: 6em; border-left: 3px solid var(--fc); }
.stackbar__item span { color: var(--muted-fg); }
.plots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7em; margin: .2em 0 .9em; }
.plot { margin: 0; padding: .5em; border: 1px solid var(--border); border-radius: .7em; background: var(--card); }
.plot svg { width: 100%; height: auto; display: block; }
.plot__axis { stroke: var(--muted-fg); stroke-width: 1; opacity: .6; }
.plot__line { fill: none; stroke: var(--b, var(--accent)); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.plot__line--alt { stroke: var(--b4); }
.plot__line--dash { stroke-dasharray: 5 4; stroke-width: 2; }
.plot__dot { fill: var(--b4); }
.plot__dot--start { fill: var(--b3); }
.plot__ring { fill: none; stroke: var(--b1); stroke-width: 1; opacity: .55; }
.plot figcaption { display: grid; gap: .1em; text-align: center; font-size: .82em; line-height: 1.35; margin-top: .3em; }
.plot figcaption span { color: var(--muted-fg); font-size: .92em; }
.nn { margin: .2em 0 .9em; max-width: 420px; }
.nn svg { width: 100%; height: auto; display: block; }
.nn__edges line { stroke: var(--muted-fg); stroke-width: .8; opacity: .45; }
.nn__node { fill: color-mix(in srgb, var(--fc) 30%, var(--card)); stroke: var(--fc); stroke-width: 1.5; }
.nn__labels { display: grid; text-align: center; font-size: .82em; font-weight: 600; color: var(--muted-fg); margin-top: .2em; }

.tokens { display: flex; flex-wrap: wrap; gap: .5em; margin: .2em 0 .9em; }
.token { display: inline-grid; justify-items: center; gap: .2em; padding: .35em .8em; border-radius: .55em; border: 1.5px solid color-mix(in srgb, var(--fc) 55%, transparent); background: color-mix(in srgb, var(--fc) 10%, var(--card)); }
.token__t { font-weight: 700; }
.token__id { font-size: .78em; color: var(--muted-fg); font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; }
.vec { display: flex; flex-wrap: wrap; align-items: center; gap: .6em; margin: .2em 0 .9em; }
.vec__name { font-weight: 700; }
.vec__vals { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: .5em; overflow: hidden; }
.vec__cell { padding: .3em .6em; font-family: ui-monospace, Consolas, monospace; font-size: .85em; background: color-mix(in srgb, var(--b0) var(--a, 0%), var(--card)); border-right: 1px solid var(--border); }
.vec__cell.is-neg { background: color-mix(in srgb, var(--b4) var(--a, 0%), var(--card)); }
.vec__cell:last-child { border-right: 0; }
.heat { margin: .2em 0 .9em; max-width: 360px; }
.heat__grid { display: grid; gap: 3px; }
.heat__h { font-size: .8em; font-weight: 700; text-align: center; color: var(--muted-fg); align-self: end; }
.heat__h--row { text-align: right; padding-right: .4em; align-self: center; }
.heat__c { display: grid; place-items: center; aspect-ratio: 1.6; border-radius: .35em; font-size: .78em; font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--b, var(--accent)) var(--a), var(--muted)); }
.heat__c.is-hot { color: #fff; font-weight: 700; }
.plot__cluster { fill: color-mix(in srgb, var(--fc) 10%, transparent); stroke: var(--fc); stroke-dasharray: 3 2; stroke-width: 1; }
.plot__pt { fill: var(--fc); }
.plot__label { font-size: 7.5px; font-weight: 700; fill: var(--fg); font-family: inherit; }
.plot__tiny { font-size: 6px; fill: var(--muted-fg); font-family: inherit; }
.plot--wide { grid-column: span 2; }
.iconlist .li-icon:has(svg path[d^="m15 9-6"]) { color: var(--b4); background: color-mix(in srgb, var(--b4) 12%, transparent); }
