/* Design tokens: GitHub-style neutrals with an academic voice (serif for reading, sans for controls).
   Colour is used only where it carries meaning:
     blue   = links, where you are, selected tool, primary action
     green  = completed / saved
     amber  = chemistry-depth topics, storage warnings
     red    = errors and destructive actions
   Everything else is neutral gray. */
:root {
  --canvas: #ffffff; --canvas-subtle: #f1f3f6; --canvas-inset: #e4e8ed;
  --border: #b4bec9; --border-muted: #d2d9e1;
  --fg: #14171a; --fg-muted: #3f4852; --fg-subtle: #66707b;
  --accent: #41607f; --accent-subtle: #e6edf5; --accent-ink: #ffffff;
  --success: #4b7a5e; --success-subtle: #eaf2ec;
  --attention: #7a6a45; --attention-subtle: #f5f0e2; --attention-border: #cdbd8c;
  --danger: #cf222e;
  --board-bg: #ffffff; --board-dot: #d8dee4;
  --shadow: 0 1px 0 rgba(31, 35, 40, .04), 0 8px 24px rgba(66, 74, 83, .12);
  /* names the scripts and diagrams still read */
  --ink: var(--fg); --dim: var(--fg-muted); --surface: var(--canvas); --bg: var(--canvas);
  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --hdr: 56px; --side: 296px; --r: 4px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --canvas: #0d1117; --canvas-subtle: #151b23; --canvas-inset: #1c232c;
  --border: #3d444d; --border-muted: #2a313a;
  --fg: #e6edf3; --fg-muted: #9198a1; --fg-subtle: #6e7681;
  --accent: #8aa4c4; --accent-subtle: #1a2331; --accent-ink: #0d1117;
  --success: #72a887; --success-subtle: #17241d;
  --attention: #c4ad78; --attention-subtle: #241f14; --attention-border: #6e5f35;
  --danger: #f85149;
  --board-bg: #0d1117; --board-dot: #262d36;
  --shadow: 0 0 0 1px #3d444d, 0 12px 28px rgba(1, 4, 9, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0d1117; --canvas-subtle: #151b23; --canvas-inset: #1c232c;
    --border: #3d444d; --border-muted: #2a313a;
    --fg: #e6edf3; --fg-muted: #9198a1; --fg-subtle: #6e7681;
    --accent: #8aa4c4; --accent-subtle: #1a2331; --accent-ink: #0d1117;
    --success: #72a887; --success-subtle: #17241d;
    --attention: #c4ad78; --attention-subtle: #241f14; --attention-border: #6e5f35;
    --danger: #f85149;
    --board-bg: #0d1117; --board-dot: #262d36;
    --shadow: 0 0 0 1px #3d444d, 0 12px 28px rgba(1, 4, 9, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--hdr) + 12px); }
body { margin: 0; background: var(--canvas); color: var(--fg); font: 16px/1.6 var(--serif); -webkit-font-smoothing: antialiased; }
body.board-full { overflow: hidden; }
a { color: var(--accent); text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; left: -9999px; }
.logo { display: inline-block; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg version=%221.1%22 id=%22Layer_1%22 xmlns=%22http://www.w3.org/2000/svg%22 xmlns:xlink=%22http://www.w3.org/1999/xlink%22 x=%220px%22 y=%220px%22 viewBox=%220 0 276.55 276.46%22 style=%22enable-background:new 0 0 276.55 276.46%3B%22 xml:space=%22preserve%22%3E %3Cstyle type=%22text/css%22%3E .st0%7Bfill:%23000000%3B%7D %3C/style%3E %3Cg%3E %3Cpath class=%22st0%22 d=%22M158.55%2C1.48c-4.05-0.57-8.15-0.96-12.3-1.16l91.87%2C204.17h5.08c-19.46%2C30.76-52.06%2C52.36-89.91%2C56.93 l0.07-132.13l27.71-0.17v0.03l1.36%2C0.02l23.19%2C53.47c1.04%2C2.46%2C3.14%2C8.4%2C2.78%2C11.13c-0.39%2C2.85-2.34%2C4.95-5.17%2C5.45 c-2.58%2C0.46-6.37%2C0.73-8.62%2C0.87c-1.07%2C0.06-1.9%2C0.94-1.91%2C2.01l0%2C0.34c-0.01%2C1.13%2C0.9%2C2.06%2C2.03%2C2.06h34.16L136.88%2C0 C61.15%2C0.75%2C0%2C62.36%2C0%2C138.26c0%2C74.96%2C59.64%2C135.97%2C134.06%2C138.21V118.01H97.01c13.77-30%2C27.45-59.8%2C41.22-89.79 c13.1%2C29.99%2C26.11%2C59.79%2C39.21%2C89.79h-34.97v158.46c74.42-2.22%2C134.08-63.24%2C134.08-138.21C276.55%2C68.78%2C225.3%2C11.29%2C158.55%2C1.48z M123.2%2C129.11l0.04%2C132.3c-37.9-4.58-70.53-26.25-89.97-57.07h47.06c1.12%2C0%2C2.03-0.91%2C2.03-2.03v-0.1c0-1.07-0.83-1.96-1.9-2.03 c-2.18-0.15-5.77-0.43-8.16-0.85c-2.75-0.47-4.29-1.64-5.52-4.11c-1.19-2.38-0.24-6.2%2C0.33-7.99c1.3-4.11%2C2-5.52%2C3.46-9.22 c3.93-9.93%2C8.32-19.66%2C12.76-29.37c2.83-6.18%2C5.72-12.33%2C8.55-18.51c0.36-0.8%2C0.78-1.11%2C1.7-1.11L123.2%2C129.11z M84.09%2C118.14 c0%2C0-19.99%2C0.08-29.18-1.28c-4.96-0.73-10.99-2.04-13.81-2.67c-0.94-0.21-1.88%2C0.26-2.28%2C1.14L25.95%2C143.3 c-0.48%2C1.03-0.01%2C2.25%2C1.03%2C2.71l0.35%2C0.15c0.86%2C0.38%2C1.85%2C0.12%2C2.42-0.62c3.55-4.57%2C14.67-11.79%2C20.85-13.94 c6.81-2.37%2C22.37-3.03%2C28.81-2.73c-0.14%2C0.41-0.21%2C0.69-0.33%2C0.95c-4.54%2C9.83-9.08%2C19.67-13.64%2C29.49 c-4.29%2C9.23-8.6%2C18.45-12.93%2C27.66c-0.65%2C1.38-1.35%2C2.73-2.15%2C4.03c-2.67%2C4.27-5.49%2C6.83-10.55%2C8.02 c-1.54%2C0.36-4.37%2C0.73-5.95%2C0.86c-0.84%2C0.07-2.02%2C0.19-3.09%2C0.3c-10.53-18.23-16.55-39.38-16.55-61.95 c0-66.74%2C52.7-121.16%2C118.75-123.94C117.52%2C47.13%2C98.72%2C87.06%2C84.09%2C118.14z M245.16%2C190.64c-2.08-3.46-27.77-60.32-27.77-60.32 c3.66%2C0.58%2C6.85%2C1.35%2C8.31%2C1.98c7.99%2C3.47%2C16.42%2C9.18%2C19.53%2C13.46c0.56%2C0.77%2C1.58%2C1.04%2C2.45%2C0.65l0.32-0.14 c1.04-0.46%2C1.5-1.68%2C1.03-2.71l-12.85-27.95c-0.41-0.88-1.38-1.36-2.32-1.13c-2.48%2C0.6-7.44%2C1.72-12.2%2C2.42 c-4.22%2C0.62-7.21%2C0.84-10.01%2C0.93L165.28%2C17.15c55.53%2C12.33%2C97.06%2C61.86%2C97.06%2C121.11c0%2C20.31-4.88%2C39.48-13.54%2C56.4 C248.8%2C194.66%2C246.98%2C193.66%2C245.16%2C190.64z%22/%3E %3C/g%3E %3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg version=%221.1%22 id=%22Layer_1%22 xmlns=%22http://www.w3.org/2000/svg%22 xmlns:xlink=%22http://www.w3.org/1999/xlink%22 x=%220px%22 y=%220px%22 viewBox=%220 0 276.55 276.46%22 style=%22enable-background:new 0 0 276.55 276.46%3B%22 xml:space=%22preserve%22%3E %3Cstyle type=%22text/css%22%3E .st0%7Bfill:%23000000%3B%7D %3C/style%3E %3Cg%3E %3Cpath class=%22st0%22 d=%22M158.55%2C1.48c-4.05-0.57-8.15-0.96-12.3-1.16l91.87%2C204.17h5.08c-19.46%2C30.76-52.06%2C52.36-89.91%2C56.93 l0.07-132.13l27.71-0.17v0.03l1.36%2C0.02l23.19%2C53.47c1.04%2C2.46%2C3.14%2C8.4%2C2.78%2C11.13c-0.39%2C2.85-2.34%2C4.95-5.17%2C5.45 c-2.58%2C0.46-6.37%2C0.73-8.62%2C0.87c-1.07%2C0.06-1.9%2C0.94-1.91%2C2.01l0%2C0.34c-0.01%2C1.13%2C0.9%2C2.06%2C2.03%2C2.06h34.16L136.88%2C0 C61.15%2C0.75%2C0%2C62.36%2C0%2C138.26c0%2C74.96%2C59.64%2C135.97%2C134.06%2C138.21V118.01H97.01c13.77-30%2C27.45-59.8%2C41.22-89.79 c13.1%2C29.99%2C26.11%2C59.79%2C39.21%2C89.79h-34.97v158.46c74.42-2.22%2C134.08-63.24%2C134.08-138.21C276.55%2C68.78%2C225.3%2C11.29%2C158.55%2C1.48z M123.2%2C129.11l0.04%2C132.3c-37.9-4.58-70.53-26.25-89.97-57.07h47.06c1.12%2C0%2C2.03-0.91%2C2.03-2.03v-0.1c0-1.07-0.83-1.96-1.9-2.03 c-2.18-0.15-5.77-0.43-8.16-0.85c-2.75-0.47-4.29-1.64-5.52-4.11c-1.19-2.38-0.24-6.2%2C0.33-7.99c1.3-4.11%2C2-5.52%2C3.46-9.22 c3.93-9.93%2C8.32-19.66%2C12.76-29.37c2.83-6.18%2C5.72-12.33%2C8.55-18.51c0.36-0.8%2C0.78-1.11%2C1.7-1.11L123.2%2C129.11z M84.09%2C118.14 c0%2C0-19.99%2C0.08-29.18-1.28c-4.96-0.73-10.99-2.04-13.81-2.67c-0.94-0.21-1.88%2C0.26-2.28%2C1.14L25.95%2C143.3 c-0.48%2C1.03-0.01%2C2.25%2C1.03%2C2.71l0.35%2C0.15c0.86%2C0.38%2C1.85%2C0.12%2C2.42-0.62c3.55-4.57%2C14.67-11.79%2C20.85-13.94 c6.81-2.37%2C22.37-3.03%2C28.81-2.73c-0.14%2C0.41-0.21%2C0.69-0.33%2C0.95c-4.54%2C9.83-9.08%2C19.67-13.64%2C29.49 c-4.29%2C9.23-8.6%2C18.45-12.93%2C27.66c-0.65%2C1.38-1.35%2C2.73-2.15%2C4.03c-2.67%2C4.27-5.49%2C6.83-10.55%2C8.02 c-1.54%2C0.36-4.37%2C0.73-5.95%2C0.86c-0.84%2C0.07-2.02%2C0.19-3.09%2C0.3c-10.53-18.23-16.55-39.38-16.55-61.95 c0-66.74%2C52.7-121.16%2C118.75-123.94C117.52%2C47.13%2C98.72%2C87.06%2C84.09%2C118.14z M245.16%2C190.64c-2.08-3.46-27.77-60.32-27.77-60.32 c3.66%2C0.58%2C6.85%2C1.35%2C8.31%2C1.98c7.99%2C3.47%2C16.42%2C9.18%2C19.53%2C13.46c0.56%2C0.77%2C1.58%2C1.04%2C2.45%2C0.65l0.32-0.14 c1.04-0.46%2C1.5-1.68%2C1.03-2.71l-12.85-27.95c-0.41-0.88-1.38-1.36-2.32-1.13c-2.48%2C0.6-7.44%2C1.72-12.2%2C2.42 c-4.22%2C0.62-7.21%2C0.84-10.01%2C0.93L165.28%2C17.15c55.53%2C12.33%2C97.06%2C61.86%2C97.06%2C121.11c0%2C20.31-4.88%2C39.48-13.54%2C56.4 C248.8%2C194.66%2C246.98%2C193.66%2C245.16%2C190.64z%22/%3E %3C/g%3E %3C/svg%3E") center/contain no-repeat; }

/* header */
.hdr { position: sticky; top: 0; z-index: 30; height: var(--hdr); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--canvas-subtle); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.brand .logo { width: 28px; height: 28px; }
.brand span:not(.logo) { display: flex; align-items: baseline; gap: 6px; }
.brand b { font: 600 18px/1 var(--serif); letter-spacing: -.005em; }
.brand small { font: 400 18px/1 var(--serif); color: var(--fg-muted); }
.hdr .sp { flex: 1; }
.hdr .menu-btn { display: none; }
.search { position: relative; width: min(360px, 38vw); }
.search input { width: 100%; height: 32px; padding: 0 40px 0 32px; font: 400 14px var(--sans); border: 1px solid var(--border); border-radius: var(--r); background: var(--canvas); color: var(--fg); }
.search input::placeholder { color: var(--fg-subtle); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.search svg { position: absolute; left: 10px; top: 8px; color: var(--fg-subtle); }
.search kbd { position: absolute; right: 8px; top: 6px; font: 500 11px var(--sans); color: var(--fg-muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; line-height: 18px; background: var(--canvas-subtle); }
.results { position: absolute; top: 38px; left: 0; right: 0; background: var(--canvas); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; display: none; }
.results.open { display: block; }
.results a { display: block; padding: 8px 12px; text-decoration: none; color: var(--fg); border-bottom: 1px solid var(--border-muted); font: 400 14px/1.35 var(--sans); }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a.hl { background: var(--accent-subtle); }
.results a small { color: var(--fg-muted); display: block; font-size: 12px; }
.results .none { padding: 12px; color: var(--fg-muted); font: 14px var(--sans); }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--canvas-subtle); color: var(--fg); font: 500 14px var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--canvas-inset); }
.btn.pri { background: var(--accent-subtle); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.btn.pri:hover { background: color-mix(in srgb, var(--accent) 14%, var(--canvas)); }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.done-on { background: var(--success-subtle); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }

/* layout */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - var(--hdr)); }
.side { position: sticky; top: var(--hdr); height: calc(100vh - var(--hdr)); overflow: auto; background: var(--canvas-subtle); border-right: 1px solid var(--border); padding: 12px 8px 40px; font-family: var(--sans); }
.side h6 { margin: 12px 8px 6px; font: 600 12px var(--sans); color: var(--fg-muted); }
.side a.home { display: block; padding: 6px 8px; border-radius: 0; text-decoration: none; color: var(--fg); font-weight: 500; font-size: 14px; }
.side a.home:hover { background: var(--canvas-inset); }
.u { margin: 1px 0; }
.u > button { all: unset; box-sizing: border-box; display: flex; width: 100%; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 0; cursor: pointer; font: 600 14px/1.35 var(--sans); }
.u > button:hover { background: var(--canvas-inset); }
.u > button:focus-visible { outline: 2px solid var(--accent); }
.u .n { flex: none; width: 14px; color: var(--fg-muted); font: 500 13px var(--sans); text-align: right; }
.u .cnt { margin-left: auto; font: 500 12px var(--sans); color: var(--fg-muted); }
.u ol { list-style: none; margin: 1px 0 6px 15px; padding: 0 0 0 8px; border-left: 1px solid var(--border); display: none; }
.u.open ol { display: block; }
.u ol a { display: flex; gap: 8px; align-items: flex-start; padding: 4px 8px; border-radius: 0; text-decoration: none; color: var(--fg); font-size: 13.5px; line-height: 1.35; }
.u ol a:hover { background: var(--canvas-inset); }
.u ol a.cur { background: var(--accent-subtle); color: var(--fg); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.main { min-width: 0; padding: 28px clamp(16px, 3vw, 44px) 70px; }

/* home */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center; padding: 8px 0 28px; border-bottom: 1px solid var(--border-muted); margin-bottom: 8px; }
.hero h1 { font: 600 clamp(32px, 4.4vw, 44px)/1.1 var(--serif); letter-spacing: -.015em; margin: 0 0 10px; }
.hero p { margin: 0; max-width: 58ch; color: var(--fg-muted); font-size: 18px; }
.hero .logo { width: 88px; height: 88px; color: var(--fg-subtle); opacity: .55; }
.hero .cta { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.sect-h { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.sect-h h2 { font: 600 20px/1.3 var(--serif); margin: 0; width: 100%; padding-bottom: 8px; border-bottom: 1px solid var(--border-muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--canvas); border: 1px solid var(--border); border-radius: var(--r); text-decoration: none; color: var(--fg); }
.card:hover { background: var(--canvas-subtle); border-color: var(--fg-subtle); }
.card .num { font: 500 12px var(--sans); color: var(--fg-muted); }
.card h3 { margin: 0; font: 600 18px/1.3 var(--serif); color: var(--fg); }
.card:hover h3, .trow:hover h3 { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.card p { margin: 0; color: var(--fg-muted); font-size: 14.5px; line-height: 1.5; flex: 1; }
.card .meta { display: flex; justify-content: space-between; font: 500 12px var(--sans); color: var(--fg-muted); }
.bar { height: 4px; background: var(--canvas-inset); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--success); }
.outline { columns: 3 300px; column-gap: 32px; }
.outline section { break-inside: avoid; margin-bottom: 20px; }
.outline h3 { margin: 0 0 4px; font: 600 15px/1.4 var(--serif); }
.outline h3 a { text-decoration: none; color: var(--fg); }
.outline h3 a:hover { color: var(--accent); }
.outline h3 span { color: var(--fg-muted); font: 500 13px var(--sans); margin-right: 8px; }
.outline ul { list-style: none; margin: 0; padding: 0; }
.outline li a { display: block; padding: 2px 0 2px 12px; border-left: 2px solid var(--border-muted); text-decoration: none; font: 14.5px/1.45 var(--sans); color: var(--fg-muted); }
.outline li a:hover { border-color: var(--accent); color: var(--accent); }
.outline li.done a { border-color: var(--success); }

/* breadcrumbs & headings */
.crumbs { font: 13px var(--sans); color: var(--fg-muted); margin-bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--fg-muted); text-decoration: none; } .crumbs a:hover { color: var(--accent); text-decoration: underline; }
.eyebrow { font: 500 13px var(--sans); color: var(--fg-muted); margin: 0 0 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h1.ttl { font: 600 clamp(26px, 3vw, 32px)/1.2 var(--serif); margin: 0 0 8px; letter-spacing: -.01em; padding-bottom: 8px; border-bottom: 1px solid var(--border-muted); }
.lede { font-size: 18px; color: var(--fg-muted); margin: 0 0 16px; max-width: 64ch; }

/* unit page */
.topics { display: grid; gap: 0; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.trow { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; background: var(--canvas); border-bottom: 1px solid var(--border-muted); text-decoration: none; color: var(--fg); }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--canvas-subtle); }
.trow .i { font: 500 14px var(--sans); color: var(--fg-muted); text-align: right; }
.trow h3 { margin: 0; font: 600 16px/1.35 var(--serif); color: var(--fg); }
.trow p { margin: 2px 0 0; color: var(--fg-muted); font-size: 14.5px; line-height: 1.45; }
.tags { display: flex; gap: 6px; align-items: center; }
.tag { display: inline-flex; align-items: center; padding: 0 7px; line-height: 19px; border: 1px solid var(--border); border-radius: 3px; color: var(--fg-muted); font: 500 12px var(--sans); white-space: nowrap; }
.tag.ok { color: var(--success); background: var(--success-subtle); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.tag.chem { color: var(--accent); background: var(--accent-subtle); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }

/* topic page */
.topic { display: grid; grid-template-columns: minmax(340px, 5fr) minmax(0, 6fr); gap: 28px; align-items: start; }
.topic .left { min-width: 0; }
.topic .right { position: sticky; top: calc(var(--hdr) + 16px); height: calc(100vh - var(--hdr) - 44px); min-height: 460px; }
.blurb { font-size: 17px; line-height: 1.7; }
.blurb p { margin: 0 0 1em; } .blurb ul { padding-left: 1.2em; margin: 0 0 1em; } .blurb li { margin: .25em 0; }
.blurb strong { font-weight: 600; }
.blurb h3 { font: 600 21px/1.3 var(--serif); margin: 1.6em 0 .5em; padding-bottom: 4px; border-bottom: 1px solid var(--border-muted); }
.blurb h4 { font: 600 17px/1.35 var(--serif); margin: 1.3em 0 .35em; color: var(--fg); }
.blurb ol { padding-left: 1.3em; margin: 0 0 1em; }
.panel { background: var(--canvas); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; margin: 20px 0; }
.panel h4 { margin: 0 0 8px; font: 600 14px var(--sans); color: var(--fg); }
dl.terms { margin: 0; display: grid; gap: 6px; font-size: 15px; line-height: 1.5; }
dl.terms dt { font: 600 14.5px var(--sans); display: inline; } dl.terms dd { display: inline; margin: 0 0 0 4px; color: var(--fg-muted); }
dl.terms dt::after { content: ":"; }
figure { margin: 20px 0; background: var(--canvas); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
figure img { display: block; width: 100%; max-height: 380px; object-fit: contain; background: #fff; padding: 8px; }
figure figcaption { padding: 10px 14px 12px; font: 13.5px/1.5 var(--sans); color: var(--fg-muted); border-top: 1px solid var(--border-muted); background: var(--canvas-subtle); }
figure figcaption .att { display: block; margin-top: 4px; font-size: 12px; color: var(--fg-subtle); }
details.q { border-top: 1px solid var(--border-muted); padding: 8px 0; } details.q:first-of-type { border-top: 0; padding-top: 0; }
details.q summary { cursor: pointer; font: 500 15px/1.45 var(--sans); } details.q p { margin: 6px 0 0; color: var(--fg-muted); font-size: 15px; }
textarea.notes { width: 100%; min-height: 96px; resize: vertical; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--canvas); color: var(--fg); font: 15px/1.55 var(--serif); }
textarea.notes:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.pager .btn { max-width: 48%; height: auto; padding: 8px 14px; text-align: left; line-height: 1.3; }
.pager small { display: block; color: var(--fg-muted); font-weight: 500; font-size: 12px; }
.pager .btn.pri small { color: inherit; opacity: .85; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }

/* board */
.board { position: relative; display: flex; flex-direction: column; height: 100%; background: var(--board-bg); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; outline-offset: -2px; }
.board:focus-visible { outline: 2px solid var(--accent); }
.board.dropping { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.board.full { position: fixed; inset: 0; z-index: 100; border-radius: 0; border: 0; }
.bd-bar { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 6px 8px; background: var(--canvas-subtle); border-bottom: 1px solid var(--border); font-family: var(--sans); }
.bd-grp { display: flex; gap: 2px; align-items: center; padding-right: 8px; border-right: 1px solid var(--border); }
.bd-grp:last-of-type { border: 0; }
.bd-btn, .bd-w { all: unset; box-sizing: border-box; width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--r); cursor: pointer; color: var(--fg-muted); }
.bd-btn:hover, .bd-w:hover { background: var(--canvas-inset); color: var(--fg); }
.bd-btn.on, .bd-w.on { background: var(--accent-subtle); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.bd-btn:disabled { opacity: .35; cursor: default; background: none; color: var(--fg-muted); }
.bd-btn:focus-visible, .bd-sw:focus-visible, .bd-w:focus-visible { outline: 2px solid var(--accent); }
.bd-sw { all: unset; box-sizing: border-box; width: 20px; height: 20px; margin: 0 2px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .45); }
.bd-sw.on { box-shadow: 0 0 0 2px var(--canvas-subtle), 0 0 0 4px var(--accent); }
.bd-w i { display: block; width: 18px; background: currentColor; border-radius: 4px; }
.bd-zoom { margin-left: auto; font: 500 12px var(--sans); color: var(--fg-muted); min-width: 40px; text-align: right; }
.bd-stage { position: relative; flex: 1; min-height: 0; }
.bd-stage canvas { position: absolute; inset: 0; touch-action: none; display: block; }
.bd-hint { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; color: var(--fg-muted); font: 14px/1.7 var(--sans); gap: 4px; }
.bd-hint b { font: 600 16px var(--sans); color: var(--fg-muted); }
.bd-hint kbd { font: 500 11px var(--sans); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: var(--canvas); }
.bd-saved { position: absolute; right: 12px; bottom: 10px; font: 500 12px var(--sans); color: var(--success); opacity: 0; transition: opacity .3s; pointer-events: none; }
.bd-saved.show { opacity: 1; }
.bd-saved.bad { color: var(--danger); }

/* dialog / banner */
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); color: var(--fg); max-width: 540px; padding: 20px 24px; box-shadow: var(--shadow); font-family: var(--sans); }
dialog::backdrop { background: rgba(1, 4, 9, .45); }
dialog h3 { margin: 0 0 8px; font: 600 18px var(--serif); } dialog ol { padding-left: 1.2em; line-height: 1.6; font-size: 14.5px; } dialog code { font: 13px var(--mono); background: var(--canvas-inset); padding: 1px 5px; border-radius: 4px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 16px 0 0; }
dialog #dReset { margin-right: auto; color: var(--danger); }
.banner { background: var(--attention-subtle); color: var(--fg); border-bottom: 1px solid var(--attention-border); padding: 8px 16px; font: 500 14px var(--sans); }
.banner[hidden] { display: none; }

/* inline chemistry content */
.blurb table { width: 100%; border-collapse: collapse; margin: 1em 0 1.2em; font: 14px/1.45 var(--sans); border: 1px solid var(--border); }
.blurb th { text-align: left; background: var(--canvas-subtle); color: var(--fg); padding: 6px 12px; font-weight: 600; border-bottom: 1px solid var(--border); }
.blurb td { padding: 6px 12px; border-top: 1px solid var(--border-muted); vertical-align: top; }
.blurb tbody tr:nth-child(even) td { background: var(--canvas-subtle); }
.blurb svg { display: block; margin: 12px auto; }

.scrim { display: none; }
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .hdr .menu-btn { display: inline-flex; }
  .side { position: fixed; z-index: 40; top: var(--hdr); left: 0; width: min(88vw, 340px); transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .side { transform: none; } body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(1, 4, 9, .4); }
  .search { width: auto; flex: 1; } .brand small, .search kbd, .hdr .lbl { display: none; }
  .main { padding-top: 20px; }
  .hero { grid-template-columns: 1fr; } .hero .logo { display: none; }
}
@media (max-width: 820px) {
  .topic { grid-template-columns: 1fr; gap: 12px; }
  /* the board stays pinned under the header while the text scrolls beneath it */
  .topic .right { position: sticky; top: var(--hdr); z-index: 6; order: -1; height: 44vh; min-height: 260px; padding: 8px 0; background: var(--canvas); }
}
@media print { .hdr, .side, .right, .row-actions, .pager { display: none !important; } .shell, .topic { display: block; } }
