/* ==========================================================================
   NeuroDifference — design system
   Mobile first. Desktop upgrades at 900px (sidebar) and 1200px (two columns).
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0b0d10;
  --bg-1: #0f1216;
  --bg-2: #14181e;
  --bg-3: #1a1f27;
  --line: #232a34;
  --line-soft: #1b212a;

  --text: #e6e8eb;
  --text-2: #a9b2bf;
  --text-3: #78828f;

  --accent: #8b7bff;
  --accent-2: #6f5cff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(139, 123, 255, 0.14);
  --accent-line: rgba(139, 123, 255, 0.35);

  --good: #3fb950;
  --ok: #6fb3ff;
  --warn: #d29922;
  --bad: #f0883e;
  --critical: #f85149;

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 20px;
  --radius-xl: 26px;

  --pad: 16px;
  --gap: 12px;
  --tap: 44px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, 0.75);
  --shadow-3: 0 24px 64px -20px rgba(0, 0, 0, 0.85);

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --nav-h: 62px;
  --top-h: 56px;
  --sidebar-w: 258px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-accent="amber"] { --accent: #f2b23e; --accent-2: #e09b1c; --accent-ink: #1a1206; --accent-soft: rgba(242, 178, 62, 0.14); --accent-line: rgba(242, 178, 62, 0.35); }
[data-accent="teal"] { --accent: #2fd6c4; --accent-2: #17bda9; --accent-ink: #04231f; --accent-soft: rgba(47, 214, 196, 0.14); --accent-line: rgba(47, 214, 196, 0.35); }
[data-accent="rose"] { --accent: #ff6b8a; --accent-2: #f04a6e; --accent-ink: #2a0710; --accent-soft: rgba(255, 107, 138, 0.14); --accent-line: rgba(255, 107, 138, 0.35); }
[data-accent="green"] { --accent: #4ade80; --accent-2: #2fbf66; --accent-ink: #04220f; --accent-soft: rgba(74, 222, 128, 0.14); --accent-line: rgba(74, 222, 128, 0.35); }
[data-accent="blue"] { --accent: #60a5fa; --accent-2: #3b82f6; --accent-ink: #05142c; --accent-soft: rgba(96, 165, 250, 0.14); --accent-line: rgba(96, 165, 250, 0.35); }

[data-density="compact"] { --pad: 12px; --gap: 9px; --radius: 11px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1000px 520px at 82% -8%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 68%),
    radial-gradient(760px 420px at 8% 4%, rgba(63, 185, 80, 0.06), transparent 70%),
    var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
svg.ic { flex: none; display: inline-block; vertical-align: -0.15em; }

/* Scroll lock while a drawer, sheet or search overlay is open. */
html.layer-open, html.layer-open body { overflow: hidden; }
html.layer-open { overscroll-behavior: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--accent-soft); }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
p { margin: 0; }

hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ------------------------------------------------------------------ */
/* Scrollbars                                                          */
/* ------------------------------------------------------------------ */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #262e39; border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #333d4a; }

/* ------------------------------------------------------------------ */
/* Shell                                                               */
/* ------------------------------------------------------------------ */

#root { min-height: 100dvh; }

.app {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
}

.sidebar { display: none; }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--pad);
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(11, 13, 16, 0.86);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line-soft);
}

[data-scrolled="true"] .topbar { border-bottom-color: var(--line); }

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 6px 18px -8px var(--accent);
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-text b { font-size: 14px; font-weight: 700; }
.brand-text span { font-size: 10px; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }

.topbar-title {
  display: none;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); border-color: var(--line); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn.accent { color: var(--accent); }

.view {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px var(--pad) calc(var(--nav-h) + 26px + env(safe-area-inset-bottom, 0px));
  animation: viewIn 0.26s var(--ease);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ */
/* Bottom nav (mobile)                                                 */
/* ------------------------------------------------------------------ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--bg-1);
  background: color-mix(in srgb, var(--bg-1) 92%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 550;
  text-decoration: none;
  position: relative;
  transition: color 0.16s;
  padding-top: 4px;
}
.nav-item svg { transition: transform 0.18s var(--ease); }
.nav-item:hover { color: var(--text-2); text-decoration: none; }
.nav-item.active { color: var(--accent); }
.nav-item.active svg { transform: translateY(-1px) scale(1.06); }
.nav-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 26px;
  height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

/* ------------------------------------------------------------------ */
/* Typography bits                                                     */
/* ------------------------------------------------------------------ */

.page-head { margin: 2px 0 18px; }
.page-head h1 { font-size: 24px; letter-spacing: -0.03em; }
.page-head p { color: var(--text-2); font-size: 13.5px; margin-top: 5px; max-width: 62ch; }

.eyebrow {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: -0.02em; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.tiny { font-size: 11.5px; }
.small { font-size: 13px; }
.lead { font-size: 15.5px; color: var(--text-2); line-height: 1.6; }

.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.crit { color: var(--critical); }
.accent { color: var(--accent); }

/* ------------------------------------------------------------------ */
/* Cards & panels                                                      */
/* ------------------------------------------------------------------ */

.card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  position: relative;
}

.card.tight { padding: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card.hoverable { transition: border-color 0.16s, transform 0.16s var(--ease), background 0.16s; }
.card.hoverable:hover { border-color: #2f3947; transform: translateY(-2px); }
.card.hoverable:active { transform: translateY(0); }
.card.glow { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-soft), 0 18px 40px -24px var(--accent); }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.card-head h3 { font-size: 15px; }
.card-head .spacer { margin-left: auto; }

.block { margin: 0 0 26px; }
.block-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.block-head h2 { font-size: 16.5px; letter-spacing: -0.02em; }
.block-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.block-head > :last-child:not(:first-child) { margin-left: auto; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: minmax(0, 1fr); }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }

/* --- Layout hardening ---------------------------------------------- */
/* Grid/flex children default to min-width:auto, so one long token (a URL,  */
/* a mono number, a nowrap chip) can widen the whole column, push text past */
/* the card's right wall and slide buttons on top of copy. Every container  */
/* child below is allowed to shrink, and text is allowed to break.          */
.row > *, .grid > *, .stack > *, .col > *, .split > *, .split-wide > * { min-width: 0; }
.card *, .callout *, .sheet *, .overlay-panel * { min-width: 0; }
h1, h2, h3, h4, p, li, dd, dt, blockquote, strong, em, a, span, td, th { overflow-wrap: break-word; }
.grow { flex: 1 1 auto; min-width: 0; }
.flex-none { flex: none; }
.btn, .chip, .icon-btn { max-width: 100%; }
.btn > span, .chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row.between > :first-child { min-width: 0; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-3 { display: flex; flex-direction: column; gap: 3px; }

@media (min-width: 560px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: #222a34; border-color: #333d4a; text-decoration: none; }
.btn:active { transform: scale(0.975); }
.btn.primary {
  background: linear-gradient(160deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 8px 22px -12px var(--accent);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--bg-2); }
.btn.soft { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn.soft:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.btn.danger { background: rgba(248, 81, 73, 0.12); border-color: rgba(248, 81, 73, 0.35); color: #ff8b84; }
.btn.danger:hover { background: rgba(248, 81, 73, 0.2); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; gap: 5px; }
.btn.xs { min-height: 27px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn-group { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.btn-group button {
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.btn-group button:hover { color: var(--text-2); }
.btn-group button.on { background: var(--bg-3); color: var(--text); box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ */
/* Chips, badges, pills                                                */
/* ------------------------------------------------------------------ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
  text-decoration: none;
}
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.chip-good { color: #6ee787; background: rgba(63, 185, 80, 0.1); border-color: rgba(63, 185, 80, 0.3); }
.chip-ok { color: #8fc7ff; background: rgba(111, 179, 255, 0.1); border-color: rgba(111, 179, 255, 0.28); }
.chip-warn { color: #e3b341; background: rgba(210, 153, 34, 0.1); border-color: rgba(210, 153, 34, 0.3); }
.chip-bad { color: #ffab6b; background: rgba(240, 136, 62, 0.1); border-color: rgba(240, 136, 62, 0.3); }
.chip-crit { color: #ff8b84; background: rgba(248, 81, 73, 0.1); border-color: rgba(248, 81, 73, 0.32); }
.chip-accent { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.chip-btn { cursor: pointer; transition: background 0.14s, border-color 0.14s, color 0.14s; }
.chip-btn:hover { border-color: #3a4552; color: var(--text); }
.chip-btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.pill-count {
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 99px;
  display: inline-grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text-2);
}

.tag { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }

/* ------------------------------------------------------------------ */
/* Inputs                                                              */
/* ------------------------------------------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 550; }

.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; font-family: inherit; }
.input::placeholder, .textarea::placeholder { color: #5c6674; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378828f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

.search-input { position: relative; }
.search-input .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input .input { padding-left: 38px; }
.search-input .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 30px; height: 30px; border-radius: 8px; display: none; place-items: center; }
.search-input .clear.show { display: grid; }

.switch { position: relative; width: 42px; height: 25px; border-radius: 99px; background: var(--bg-3); border: 1px solid var(--line); transition: background 0.18s, border-color 0.18s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--text-3); transition: transform 0.18s var(--ease), background 0.18s; }
.switch.on { background: var(--accent-soft); border-color: var(--accent-line); }
.switch.on::after { transform: translateX(17px); background: var(--accent); }

.range { -webkit-appearance: none; width: 100%; height: 22px; background: transparent; }
.range::-webkit-slider-runnable-track { height: 5px; border-radius: 99px; background: var(--bg-3); border: 1px solid var(--line); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7.5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }

/* ------------------------------------------------------------------ */
/* Lists                                                               */
/* ------------------------------------------------------------------ */

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px var(--pad);
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: inherit;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.14s;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: rgba(255, 255, 255, 0.025); text-decoration: none; }
.list-row .grow { min-width: 0; flex: 1; }
.list-row .title { font-size: 14px; font-weight: 580; display: flex; align-items: center; gap: 6px; }
.list-row .sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }

.kv { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); font-size: 12px; }
.kv dd { margin: 0; color: var(--text); overflow-wrap: break-word; }

.stat-value { font-size: 21px; font-weight: 700; letter-spacing: -0.03em; font-family: var(--mono); }
.stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

.meter { height: 6px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.3s var(--ease); }
.meter.good > i { background: linear-gradient(90deg, #2ea043, var(--good)); }
.meter.warn > i { background: linear-gradient(90deg, #a97a12, var(--warn)); }

/* ------------------------------------------------------------------ */
/* Empty state, disclaimer, toast                                      */
/* ------------------------------------------------------------------ */

.empty { text-align: center; padding: 34px 18px; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.empty-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line); color: var(--text-3); margin-bottom: 3px; }
.empty h3 { font-size: 15px; }
.empty p { font-size: 13px; color: var(--text-3); max-width: 34ch; }
.empty .btn { margin-top: 9px; }

.disclaimer {
  display: flex;
  gap: 11px;
  padding: 13px 14px;
  border-radius: var(--radius);
  background: rgba(210, 153, 34, 0.07);
  border: 1px solid rgba(210, 153, 34, 0.22);
  color: #d9c69a;
  font-size: 12.5px;
  line-height: 1.55;
}
.disclaimer svg { color: var(--warn); flex: none; margin-top: 1px; }
.disclaimer strong { color: #f0d9a8; display: block; margin-bottom: 2px; font-size: 12.5px; }
.disclaimer-mini { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #1d242e;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity 0.2s, transform 0.2s var(--ease);
  pointer-events: auto;
  max-width: 100%;
}
.toast.in { opacity: 1; transform: none; }
.toast-success svg { color: var(--good); }
.toast-danger svg { color: var(--critical); }
.toast-warn svg { color: var(--warn); }
.toast-info svg { color: var(--ok); }

/* ------------------------------------------------------------------ */
/* Markdown                                                            */
/* ------------------------------------------------------------------ */

.md { font-size: 14.5px; line-height: 1.68; color: #d7dbe1; }
.md > *:first-child { margin-top: 0; }
.md p { margin: 0 0 13px; }
.md .md-h { margin: 22px 0 9px; color: var(--text); letter-spacing: -0.02em; }
.md .md-h1 { font-size: 20px; }
.md .md-h2 { font-size: 17px; }
.md .md-h3 { font-size: 15px; }
.md .md-h4 { font-size: 13.5px; color: var(--text-2); }
.md .md-list { margin: 0 0 13px; padding-left: 20px; }
.md .md-list li { margin-bottom: 5px; }
.md .md-list li::marker { color: var(--accent); }
.md .md-quote {
  margin: 0 0 13px;
  padding: 10px 14px;
  border-left: 2.5px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  color: #dcd4ff;
  font-size: 13.5px;
}
.md .md-code { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; margin: 0 0 13px; }
.md code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-3); padding: 1.5px 5px; border-radius: 5px; border: 1px solid var(--line-soft); }
.md .md-code code { background: none; border: 0; padding: 0; }
.md .md-hr { margin: 20px 0; }
.md strong { color: #fff; font-weight: 650; }
.md table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 12.5px; display: block; overflow-x: auto; }
.md th, .md td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.md th { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ------------------------------------------------------------------ */
/* Compound cards                                                      */
/* ------------------------------------------------------------------ */

.compound-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: border-color 0.16s, transform 0.16s var(--ease);
  overflow: hidden;
}
.compound-card:hover { border-color: #313b48; transform: translateY(-2px); text-decoration: none; }
.compound-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2.5px;
  background: var(--dot, var(--accent));
  opacity: 0.75;
}
.compound-card .cc-name { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; padding-right: 4px; }
.compound-card .cc-cls { font-size: 11.5px; color: var(--text-3); }
.compound-card .cc-sum { font-size: 12.5px; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.compound-card .cc-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 1px; }

/* Detail header */
.detail-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.detail-title { font-size: 26px; letter-spacing: -0.035em; line-height: 1.12; }
.detail-alias { font-size: 12.5px; color: var(--text-3); }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tabs button:hover { color: var(--text-2); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

.effect-cols { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) { .effect-cols { grid-template-columns: 1fr 1fr; } }

.effect-box { border-radius: 11px; border: 1px solid var(--line); padding: 11px 12px; background: var(--bg-1); }
.effect-box h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 7px; display: flex; align-items: center; gap: 5px; }
.effect-box.good h4 { color: var(--good); }
.effect-box.bad h4 { color: var(--bad); }
.effect-box ul { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.effect-box li { margin-bottom: 3px; }

/* ------------------------------------------------------------------ */
/* Brain map                                                           */
/* ------------------------------------------------------------------ */

.brain-wrap {
  position: relative;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background:
    radial-gradient(closest-side at 50% 40%, rgba(139, 123, 255, 0.08), transparent 75%),
    var(--bg-1);
  padding: 6px;
  overflow: hidden;
}

.brain-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }

.brain-svg .outline { fill: rgba(255, 255, 255, 0.022); stroke: #303a47; stroke-width: 1.4; }
.brain-svg .sulcus { fill: none; stroke: #2a333f; stroke-width: 1.1; stroke-linecap: round; }
.brain-svg .hot { cursor: pointer; outline: none; }
.brain-svg .hot:focus-visible circle.core { fill-opacity: 0.34; stroke-width: 2.4; }
.brain-svg .hot:focus-visible text { fill: #fff; }
.brain-svg .hot circle.hit { fill: transparent; }
.brain-svg .hot circle.core { fill: var(--dot, var(--accent)); fill-opacity: 0.16; stroke: var(--dot, var(--accent)); stroke-width: 1.3; transition: fill-opacity 0.2s; }
.brain-svg .hot:hover circle.core { fill-opacity: 0.32; }
.brain-svg .hot.sel circle.core { fill-opacity: 0.42; stroke-width: 2; }
.brain-svg .hot text { fill: #8d97a5; font-size: 6.4px; font-weight: 600; letter-spacing: 0.02em; pointer-events: none; }
.brain-svg .hot.sel text { fill: #fff; }
.brain-svg .pulse { animation: brainPulse 2.6s ease-in-out infinite; transform-origin: center; }
@keyframes brainPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.85; } }

.region-panel { margin-top: 12px; }

/* ------------------------------------------------------------------ */
/* Charts                                                              */
/* ------------------------------------------------------------------ */

.chart-box { position: relative; width: 100%; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: #1e242d; stroke-width: 1; }
.chart-axis { fill: #6d7784; font-size: 8px; font-family: var(--mono); }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(139, 123, 255, 0.35)); }
.chart-line.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: chartDraw 1.1s var(--ease) forwards; }
.chart-line.draw[stroke-dasharray="3 3"] { stroke-dasharray: 3 3; stroke-dashoffset: 0; animation: none; opacity: 0.75; }
@keyframes chartDraw { to { stroke-dashoffset: 0; } }
.chart-area { opacity: 0.16; }
.chart-dot { stroke: var(--bg); stroke-width: 1.5; }

.legend { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; font-size: 11.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 3px; border-radius: 2px; display: inline-block; }

/* ------------------------------------------------------------------ */
/* Quiz + flashcards                                                   */
/* ------------------------------------------------------------------ */

.quiz { display: flex; flex-direction: column; gap: 12px; }
.quiz-q { font-size: 15px; font-weight: 600; line-height: 1.45; }
.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s, background 0.15s;
}
.opt:hover { border-color: #3a4552; background: var(--bg-2); }
.opt .key { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; font-family: var(--mono); background: var(--bg-3); color: var(--text-3); flex: none; }
.opt.correct { border-color: rgba(63, 185, 80, 0.5); background: rgba(63, 185, 80, 0.09); }
.opt.correct .key { background: rgba(63, 185, 80, 0.2); color: #6ee787; }
.opt.wrong { border-color: rgba(248, 81, 73, 0.5); background: rgba(248, 81, 73, 0.08); }
.opt.wrong .key { background: rgba(248, 81, 73, 0.2); color: #ff8b84; }
.opt[disabled] { cursor: default; }
.opt.dimmed { opacity: 0.55; }

.explain { border-left: 2.5px solid var(--accent); background: var(--accent-soft); padding: 10px 13px; border-radius: 0 10px 10px 0; font-size: 13px; line-height: 1.55; color: #dcd4ff; }

.flashcard {
  perspective: 1200px;
  height: 210px;
  cursor: pointer;
  user-select: none;
}
.flashcard .fc-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s var(--ease);
  transform-style: preserve-3d;
}
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.flashcard .fc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 22px;
  text-align: center;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.flashcard .fc-back { transform: rotateY(180deg); background: linear-gradient(160deg, #1d1a33, var(--bg-1)); border-color: var(--accent-line); }
.flashcard .fc-q { font-size: 16px; font-weight: 640; line-height: 1.4; }
.flashcard .fc-a { font-size: 13.5px; color: #d8d3f5; line-height: 1.55; }
.flashcard .fc-hint { position: absolute; bottom: 10px; left: 0; right: 0; font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }

/* ------------------------------------------------------------------ */
/* Search overlay / command palette                                    */
/* ------------------------------------------------------------------ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  background: rgba(6, 8, 11, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.16s ease;
}
@keyframes fadeIn { from { opacity: 0; } }

.overlay-panel {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-l) var(--radius-l);
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  max-height: 82dvh;
  overflow: hidden;
  animation: slideDown 0.2s var(--ease);
}
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } }

.overlay-search { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.overlay-search input { flex: 1; background: none; border: 0; outline: none; font-size: 15.5px; color: var(--text); min-width: 0; }
.overlay-search input::placeholder { color: #5c6674; }
.overlay-results { overflow-y: auto; padding: 6px; }

.sr-item { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 10px; width: 100%; text-align: left; color: inherit; text-decoration: none; }
.sr-item:hover, .sr-item.active { background: var(--bg-3); text-decoration: none; }
.sr-item .grow { min-width: 0; flex: 1; }
.sr-item .t { font-size: 13.5px; font-weight: 580; }
.sr-item .s { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); padding: 9px 11px 4px; font-weight: 650; }
.sr-empty { padding: 26px 14px; text-align: center; color: var(--text-3); font-size: 13px; }

/* Drawer (mobile menu) */
.drawer-host { position: fixed; inset: 0; z-index: 130; display: flex; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(4, 6, 9, 0.7); backdrop-filter: blur(3px); }
.drawer {
  position: relative;
  width: min(300px, 84vw);
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  padding: calc(14px + env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  animation: drawerIn 0.22s var(--ease);
}
@keyframes drawerIn { from { transform: translateX(-100%); } }
.drawer h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 14px 8px 5px; }
.drawer .d-item { display: flex; align-items: center; gap: 11px; padding: 10px 10px; border-radius: 10px; font-size: 14px; color: var(--text-2); text-decoration: none; }
.drawer .d-item:hover { background: var(--bg-2); color: var(--text); text-decoration: none; }
.drawer .d-item.active { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------------ */
/* Sheet (bottom modal, mobile friendly)                               */
/* ------------------------------------------------------------------ */

.sheet-host { position: fixed; inset: 0; z-index: 140; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .sheet-host { align-items: center; } }
.sheet-scrim { position: absolute; inset: 0; background: rgba(4, 6, 9, 0.72); backdrop-filter: blur(4px); animation: fadeIn 0.16s; }
.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  padding: 18px var(--pad) calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-3);
  animation: sheetUp 0.24s var(--ease);
}
@media (min-width: 640px) { .sheet { border-radius: var(--radius-l); padding-bottom: 18px; } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet-head h3 { font-size: 16px; }

/* ------------------------------------------------------------------ */
/* Desktop                                                            */
/* ------------------------------------------------------------------ */

@media (min-width: 900px) {
  .app { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: calc(100dvh - env(safe-area-inset-top, 0px));
    padding: calc(18px + env(safe-area-inset-top, 0px)) 12px 14px;
    border-right: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(15, 18, 22, 0.9), rgba(11, 13, 16, 0.6));
    gap: 3px;
    overflow-y: auto;
  }

  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; text-decoration: none; color: var(--text); }
  .sidebar .brand:hover { text-decoration: none; }
  .sidebar .brand b { font-size: 15px; }
  .sidebar .brand span { font-size: 10px; color: var(--text-3); letter-spacing: 0.05em; text-transform: uppercase; }

  .side-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: #5b6472; font-weight: 650; padding: 14px 10px 5px; }

  .side-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 550;
    color: var(--text-2);
    text-decoration: none;
    transition: background 0.14s, color 0.14s;
    position: relative;
  }
  .side-item:hover { background: var(--bg-2); color: var(--text); text-decoration: none; }
  .side-item.active { background: var(--accent-soft); color: var(--accent); }
  .side-item.active::before { content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent); }
  .side-item .pill-count { margin-left: auto; }

  .side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }
  .side-xp { padding: 10px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
  .side-xp .lv { display: flex; align-items: baseline; gap: 6px; margin-bottom: 7px; }
  .side-xp .lv b { font-family: var(--mono); font-size: 15px; }
  .side-xp .lv span { font-size: 11px; color: var(--text-3); }

  .topbar { padding: 0 24px; padding-top: env(safe-area-inset-top, 0px); }
  .topbar .brand { display: none; }
  .topbar-title { display: block; }
  .menu-btn { display: none !important; }

  .bottom-nav { display: none; }
  .toast-host { bottom: 24px; left: auto; right: 24px; transform: none; align-items: flex-end; }
  .view { padding: 24px 24px 44px; }
  .page-head h1 { font-size: 28px; }
  .detail-title { font-size: 31px; }
}

/* Two-column shells. Defined here so the phone layout still gets a gap   */
/* between the stacked halves; the desktop rules below only change widths. */
.split,
.split-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* Calculators read better with the controls first on a phone. */
@media (max-width: 999px) {
  .split-mobile-first > :last-child { order: -1; }
}

@media (min-width: 1000px) {
  .split { grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
  .split-wide { grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
}

@media (min-width: 1180px) {
  .view { padding: 28px 32px 52px; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
  .split-wide { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
  .sticky-side { position: sticky; top: calc(var(--top-h) + 20px + env(safe-area-inset-top, 0px)); }
}

@media (max-width: 380px) {
  :root { --pad: 13px; }
  .page-head h1 { font-size: 21px; }
  .detail-title { font-size: 22px; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ */
/* Utilities                                                          */
/* ------------------------------------------------------------------ */

.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.divider { height: 1px; background: var(--line-soft); margin: 12px 0; }
.dot-sep { color: var(--text-3); opacity: 0.6; }
.pressable:active { transform: scale(0.985); }

.hl { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 2px; }

@media (max-width: 899px) {
  .only-desktop { display: none !important; }
}

.dot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn, #f0a95c);
  box-shadow: 0 0 0 2px var(--bg-elev, #12151a);
  display: none;
}

/* Bottom nav: sit the due-dot right above the icon, not on the cell edge. */
.nav-item .dot-badge { top: 8px; right: calc(50% - 18px); }

/* ------------------------------------------------------------------ */
/* Text scale (Settings → Text size). zoom keeps every px-based size    */
/* proportional, and the min-heights compensate for the shrunken        */
/* layout viewport so there is no phantom scroll area.                  */
/* ------------------------------------------------------------------ */

:root { --scale: 1; }
#root { zoom: var(--scale); }
#root,
#root .app,
#root .main { min-height: calc(100dvh / var(--scale)); }
@media (min-width: 900px) {
  #root .sidebar { height: calc((100dvh - env(safe-area-inset-top, 0px)) / var(--scale)); }
}

[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after {
  animation-duration: 0.001s !important;
  transition-duration: 0.001s !important;
}

/* ------------------------------------------------------------------ */
/* Taper planner                                                       */
/* ------------------------------------------------------------------ */

.taper-plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.taper-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.taper-row:first-child { border-top: 0; padding-top: 2px; }

.taper-n {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.taper-body { min-width: 0; }

.taper-stop { border-top-style: dashed; }
.taper-stop .taper-n { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* ------------------------------------------------------------------ */
/* Compare matrix                                                      */
/* ------------------------------------------------------------------ */

.cmp {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  overflow: hidden;
}

.cmp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 11px 13px;
  border-top: 1px solid var(--line-soft);
  align-items: start;
}
.cmp-row:first-child { border-top: 0; }

.cmp-head { background: var(--bg-2); }

.cmp-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 600;
}

.cmp-cell { min-width: 0; font-size: 13px; line-height: 1.5; }

/* On a phone each cell carries its own compound name. */
.cmp-who {
  display: inline;
  font-size: 11.5px;
  color: var(--text-3);
  margin-right: 5px;
}
.cmp-who::after { content: ":"; }
.cmp-head .cmp-cell { font-size: 13.5px; }
.cmp-head .cmp-who { display: none; }

.cmp-wide { background: var(--bg-1); }
.cmp-wide .cmp-cell .cmp-who { display: block; margin: 0 0 2px; }

.cmp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmp-list li { position: relative; padding-left: 11px; }
.cmp-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-3);
}
.cmp-list.good li::before { background: var(--ok); }
.cmp-list.bad li::before { background: var(--bad); }

@media (min-width: 720px) {
  .cmp-row {
    grid-template-columns: 118px repeat(var(--cmp-n, 2), minmax(0, 1fr));
    gap: 14px;
    padding: 12px 16px;
  }
  .cmp-who { display: none; }
  .cmp-wide { grid-template-columns: 118px minmax(0, 1fr); }
  .cmp-wide .cmp-cell { display: grid; grid-template-columns: repeat(var(--cmp-n, 2), minmax(0, 1fr)); gap: 14px; }
  .cmp-wide .cmp-cell .cmp-who {
    display: block;
    margin: 0 0 3px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .cmp-wide .cmp-cell .cmp-who::after { content: ""; }
}

@media print {
  .sidebar, .bottom-nav, .topbar, .toast-host { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ================================================================== */
/* v2.2 VISUAL LAYER — ambient light, glow, motion, new components      */
/* ================================================================== */

#root { position: relative; z-index: 1; }

/* Soft moving aurora behind everything. Pure decoration, never hit-tested. */
body::before {
  content: "";
  position: fixed;
  inset: -34vh -24vw auto -24vw;
  height: 96vh;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(32% 38% at 16% 12%, rgba(139, 123, 255, 0.24), transparent 72%),
    radial-gradient(26% 30% at 84% 5%, rgba(91, 140, 255, 0.2), transparent 72%),
    radial-gradient(30% 30% at 52% 0%, rgba(63, 185, 80, 0.11), transparent 72%);
  filter: blur(16px) saturate(1.08);
  animation: auroraDrift 26s ease-in-out infinite alternate;
}
@keyframes auroraDrift {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); opacity: 0.85; }
  50% { transform: translate3d(2%, 2%, 0) scale(1.07); opacity: 1; }
  100% { transform: translate3d(-1%, 1%, 0) scale(1.03); opacity: 0.9; }
}

/* Grid of faint dots, the "lab paper" texture. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(120% 80% at 50% 0%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 10%, transparent 72%);
}

/* --- Type + accents ------------------------------------------------ */
.gtext {
  background: linear-gradient(96deg, #fff 0%, var(--accent) 42%, #7ee7d6 78%, #fff 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gtextSlide 12s ease-in-out infinite alternate;
}
@keyframes gtextSlide { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

.glow-text { text-shadow: 0 0 18px var(--accent-soft), 0 0 42px rgba(139, 123, 255, 0.22); }

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ok);
}
.live-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: livePulse 2.1s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(111, 179, 255, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(111, 179, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 179, 255, 0); }
}

/* --- Cards: depth + hover spotlight -------------------------------- */
.card { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 14px 34px -30px #000; }
.card.hoverable { overflow: hidden; }
.card.hoverable::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 90% at 12% -10%, rgba(255, 255, 255, 0.07), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}
.card.hoverable:hover::before { opacity: 1; }
.card.hoverable:hover { box-shadow: 0 22px 44px -32px #000, 0 0 0 1px var(--accent-line); }

.card.spot { position: relative; overflow: hidden; }
.card.spot::after {
  content: "";
  position: absolute;
  inset: -40% -10% auto;
  height: 70%;
  background: radial-gradient(50% 60% at 50% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

/* --- Hero orb (home) ----------------------------------------------- */
.hero-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(139, 123, 255, 0.16), transparent 60%),
    linear-gradient(170deg, var(--bg-2), var(--bg-1));
  border-color: var(--accent-line);
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -120% -30%;
  height: 220px;
  background: radial-gradient(50% 50% at 50% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

/* --- Text never touches the container wall ------------------------- */
.hero-card > * { position: relative; z-index: 1; }
.hero-card h2,
.hero-card p,
.hero-card .metric,
.hero-card .mono { overflow-wrap: anywhere; }
.card h1,
.card h2,
.card h3,
.card p,
.card li,
.list-row .title,
.list-row .sub,
.detail-title,
.detail-alias,
.paper-title,
.paper-abs { overflow-wrap: break-word; }
.detail-title { hyphens: auto; }
.metric-label,
.eyebrow { overflow-wrap: anywhere; }
.orb {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  flex: none;
  background:
    radial-gradient(circle at 32% 28%, #fff 0%, rgba(255, 255, 255, 0.5) 12%, transparent 40%),
    conic-gradient(from 0deg, var(--accent), #5b8cff, #3edbd3, var(--accent));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14) inset, 0 10px 30px -10px var(--accent), 0 0 44px -12px #5b8cff;
  animation: orbSpin 14s linear infinite;
}
.orb::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(139, 123, 255, 0.32);
  animation: orbHalo 3.4s ease-out infinite;
}
.orb.sm { width: 38px; height: 38px; }
@keyframes orbSpin { to { filter: hue-rotate(24deg); } }
@keyframes orbHalo {
  0% { transform: scale(0.86); opacity: 0.85; }
  70% { transform: scale(1.22); opacity: 0; }
  100% { opacity: 0; }
}

/* --- Meters: animated fill + traveling shine ----------------------- */
.meter { position: relative; overflow: hidden; }
.meter > i {
  position: relative;
  background: linear-gradient(90deg, var(--accent), #7ee7d6);
  box-shadow: 0 0 14px -2px var(--accent);
  animation: meterFill 0.9s var(--ease) both;
}
.meter > i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: meterShine 2.8s ease-in-out infinite;
}
@keyframes meterFill { from { width: 0 !important; } }
@keyframes meterShine { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(320%); } }

/* --- Stat tiles ---------------------------------------------------- */
.stat-value {
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #b9c2d0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-value.good, .stat-value.accent {
  background: linear-gradient(180deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
}

/* --- Entry choreography -------------------------------------------- */
.rise { animation: riseIn 0.42s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }

.fade-in { animation: fadeIn 0.4s ease both; }

/* --- Subscribe plate ----------------------------------------------- */
.sub-plate {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: var(--radius-l);
  border: 1px solid rgba(126, 231, 214, 0.28);
  background:
    radial-gradient(90% 160% at 100% 0%, rgba(126, 231, 214, 0.18), transparent 62%),
    linear-gradient(150deg, rgba(139, 123, 255, 0.16), rgba(11, 13, 16, 0.4));
  box-shadow: 0 18px 40px -30px #000, 0 0 0 1px rgba(126, 231, 214, 0.06) inset;
}
.sub-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.09) 46%, transparent 62%);
  transform: translateX(-120%);
  animation: plateSheen 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes plateSheen { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.sub-plate .sp-ico {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  color: #0b0d10;
  background: linear-gradient(150deg, #7ee7d6, #8b7bff);
  box-shadow: 0 8px 20px -10px #7ee7d6;
}
.sub-plate .sp-copy { flex: 1 1 220px; min-width: 0; }
.sub-plate .sp-copy b { display: block; font-size: 13.5px; letter-spacing: -0.01em; }
.sub-plate .sp-copy span { display: block; font-size: 12px; color: var(--text-2); line-height: 1.5; margin-top: 2px; }
.sub-plate .sp-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sub-plate .btn.tg {
  background: linear-gradient(150deg, #2aabee, #229ed9);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px -14px #2aabee;
}
.sub-plate .btn.tg:hover { filter: brightness(1.08); }
.sub-plate .sp-close { flex: none; }
.sub-plate.compact { padding: 11px 12px; border-radius: var(--radius); }
.sub-plate.compact .sp-ico { width: 30px; height: 30px; border-radius: 9px; }
.sub-plate.compact .sp-copy b { font-size: 12.5px; }
.sub-plate.compact .sp-copy span { font-size: 11.5px; }

/* --- PubMed / research --------------------------------------------- */
.pm-search {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.pm-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.pm-search input {
  flex: 1 1 auto;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 14px;
}
.pm-search input::placeholder { color: #5c6674; }

.paper {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
}
.paper::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2.5px;
  background: var(--pc, var(--accent));
  opacity: 0.75;
}
.paper:hover { border-color: #2f3947; }
.paper-title { font-size: 13.5px; font-weight: 630; line-height: 1.42; letter-spacing: -0.01em; }
.paper-title a { color: inherit; text-decoration: none; }
.paper-title a:hover { color: var(--accent); text-decoration: none; }
.paper-meta { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.paper-meta cite { font-style: normal; color: var(--text-2); }
.paper-abs { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.paper-abs.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.paper-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.paper-type { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 650; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--text-2); }
.paper-type.rct { color: #6ee787; border-color: rgba(63, 185, 80, 0.35); background: rgba(63, 185, 80, 0.1); }
.paper-type.review { color: #8b7bff; border-color: rgba(139, 123, 255, 0.35); background: rgba(139, 123, 255, 0.1); }
.paper-type.meta { color: #7ee7d6; border-color: rgba(126, 231, 214, 0.35); background: rgba(126, 231, 214, 0.1); }

.skeleton { position: relative; overflow: hidden; background: var(--bg-2); border-radius: 8px; }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  animation: skeletonSweep 1.3s linear infinite;
}
@keyframes skeletonSweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* --- Mechanism flow diagram ---------------------------------------- */
.mech { display: flex; flex-direction: column; gap: 0; }
.mech-node {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.mech-node .mn-ico {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.mech-node .mn-t { font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.mech-node .mn-s { font-size: 11.5px; color: var(--text-3); line-height: 1.45; margin-top: 1px; }
.mech-link { width: 2px; height: 14px; margin-left: 24px; background: linear-gradient(180deg, var(--accent-line), transparent); }
.mech-link.anim {
  background-image: linear-gradient(180deg, var(--accent) 45%, transparent 45%);
  background-size: 2px 8px;
  animation: mechFlow 1.1s linear infinite;
}
@keyframes mechFlow { to { background-position-y: 8px; } }

/* --- Bar visualisation --------------------------------------------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(64px, 34%) minmax(0, 1fr) auto; gap: 9px; align-items: center; font-size: 12px; }
.bar-track { height: 7px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.bar-track > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--bc, var(--accent)), color-mix(in srgb, var(--bc, var(--accent)) 45%, #fff));
  box-shadow: 0 0 12px -3px var(--bc, var(--accent));
  animation: barGrow 0.7s var(--ease) both;
}
@keyframes barGrow { from { width: 0 !important; } }

/* --- Ticker (ambient facts) ---------------------------------------- */
.ticker {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  padding: 6px 0;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker-track { display: flex; gap: 26px; width: max-content; animation: tickerMove 46s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.ticker-item b { color: var(--accent); font-weight: 650; }
@keyframes tickerMove { to { transform: translateX(-50%); } }

/* --- Brain map upgrades -------------------------------------------- */
.brain-wrap { background: radial-gradient(closest-side at 46% 42%, rgba(139, 123, 255, 0.12), transparent 78%), var(--bg-1); }
.brain-svg .cortex { fill: url(#cortexFill); stroke: #38424f; stroke-width: 1.3; }
.brain-svg .brainstem { fill: url(#stemFill); stroke: #38424f; stroke-width: 1.1; }
.brain-svg .cerebellum { fill: url(#cbFill); stroke: #38424f; stroke-width: 1.1; }
.brain-svg .folia { fill: none; stroke: #333d4a; stroke-width: 0.9; stroke-linecap: round; opacity: 0.9; }
.brain-svg .hot circle.core { mix-blend-mode: screen; }
.brain-svg .gyrus { fill: none; stroke: #333d4a; stroke-width: 1.05; stroke-linecap: round; opacity: 0.95; }
.brain-svg .gyrus.bright { stroke: #46515f; }
.brain-svg .deep { fill: none; stroke: #2b3542; stroke-width: 1; stroke-dasharray: 2 2.4; opacity: 0.75; }
.brain-svg .tract { fill: none; stroke: var(--accent); stroke-width: 0.9; opacity: 0.28; stroke-dasharray: 3 4; animation: tractFlow 3.4s linear infinite; }
@keyframes tractFlow { to { stroke-dashoffset: -28; } }
.brain-svg .hot circle.core { filter: url(#dotGlow); }
.brain-svg .hot circle.ring {
  fill: none;
  stroke: var(--dot, var(--accent));
  stroke-width: 1;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.brain-svg .hot.sel circle.ring { animation: ringOut 2.4s ease-out infinite; }
@keyframes ringOut {
  0% { transform: scale(0.6); opacity: 0.7; }
  80% { transform: scale(2.1); opacity: 0; }
  100% { opacity: 0; }
}
.brain-svg .hot text { paint-order: stroke; stroke: rgba(8, 10, 13, 0.85); stroke-width: 2.2px; }
.brain-svg .leader { stroke: #47525f; stroke-width: 0.6; opacity: 0.7; }
.brain-svg .sweep { animation: sweepMove 7s ease-in-out infinite; }
@keyframes sweepMove { 0%, 100% { opacity: 0; transform: translateY(-6px); } 45% { opacity: 0.55; } 60% { opacity: 0.15; transform: translateY(6px); } }

/* --- Chips + buttons micro-interactions ---------------------------- */
.chip { transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.12s; }
.chip.chip-btn:hover { transform: translateY(-1px); }
.chip.chip-btn.on { box-shadow: 0 0 0 1px var(--accent-line), 0 8px 18px -14px var(--accent); }
.chip-accent { box-shadow: 0 0 16px -8px var(--accent); }
.btn.primary { position: relative; overflow: hidden; }
.btn.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.4) 48%, transparent 66%);
  transform: translateX(-130%);
  transition: transform 0.55s var(--ease);
}
.btn.primary:hover::after { transform: translateX(130%); }

/* --- Motion prefs -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none !important; }
  .orb, .orb::before, .gtext, .live-dot::before, .meter > i::after, .sub-plate::after,
  .ticker-track, .brain-svg .tract, .skeleton::after, .rise { animation: none !important; }
}
[data-motion="off"] .orb, [data-motion="off"] .orb::before, [data-motion="off"] .gtext,
[data-motion="off"] .ticker-track, [data-motion="off"] body::before { animation: none !important; }

/* ==================================================================
   v2.3 — Atlas · organ map · convergence map · peptide calculator
   ================================================================== */

/* --- Shared small pieces ------------------------------------------- */
ul.clean { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
ul.clean > li { position: relative; padding-left: 15px; font-size: 13px; line-height: 1.55; color: var(--text-2); overflow-wrap: anywhere; }
ul.clean > li::before { content: ""; position: absolute; left: 2px; top: .58em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .5; }
ul.clean.tiny > li { font-size: 12px; }
.stat-label { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }

/* --- Biochemical atlas -------------------------------------------- */
.atlas-grid { align-items: start; }
.path-card { display: flex; flex-direction: column; gap: 7px; min-width: 0; transition: transform .18s var(--ease), border-color .18s; }
.path-card:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.pc-title { font-size: 15px; font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.pc-sum { font-size: 12.5px; line-height: 1.55; color: var(--text-2); margin: 0; overflow-wrap: anywhere; }
.pc-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); min-width: 0; }
.pc-enzyme { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10.5px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target-list { display: flex; flex-direction: column; gap: 2px; }
.target-row { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 9px; align-items: start; padding: 8px 6px; border-radius: 10px; text-decoration: none; color: inherit; transition: background .15s; }
.target-row:hover { background: rgba(255, 255, 255, .035); }
.tr-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(255, 255, 255, .05); color: var(--accent); border: 1px solid var(--line-soft); flex: none; }
.tr-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-name { font-size: 12.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.tr-meta { font-size: 11px; color: var(--text-3); overflow-wrap: anywhere; }
.step-card { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .018); }
.step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-family: var(--mono); font-size: 11px; color: var(--accent); border: 1px solid var(--accent-line); }
.step-label { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.step-enzyme { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); overflow-wrap: anywhere; }
.step-detail { font-size: 12px; line-height: 1.5; color: var(--text-2); margin-top: 3px; overflow-wrap: anywhere; }
.step-cof { display: inline-flex; margin-top: 5px; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .05); color: var(--text-3); }
.ghost-link { display: flex; flex-direction: column; gap: 1px; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--line-soft); text-decoration: none; color: inherit; transition: border-color .15s, background .15s; min-width: 0; }
.ghost-link:hover { border-color: var(--accent-line); background: rgba(255, 255, 255, .03); }
.gl-t { font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.gl-s { font-size: 11px; color: var(--text-3); overflow-wrap: anywhere; }

/* --- Organ map ----------------------------------------------------- */
.organ-layout { align-items: start; }
.organ-map-wrap { display: flex; justify-content: center; padding: 2px 0 6px; }
.body-svg { width: 100%; max-width: 250px; height: auto; display: block; overflow: visible; }
.body-svg .body-shape ellipse,
.body-svg .body-shape rect,
.body-svg .body-shape path { fill: rgba(255, 255, 255, .028); stroke: rgba(255, 255, 255, .085); stroke-width: 1; }
.body-svg .body-limb path { fill: none; stroke: rgba(255, 255, 255, .055); stroke-width: 15; stroke-linecap: round; }
.organ-node { cursor: pointer; outline: none; }
.organ-node .organ-hit { fill: transparent; }
.organ-node .organ-dot { fill: var(--g, var(--accent)); fill-opacity: .32; stroke: var(--g, var(--accent)); stroke-width: 1.1; transition: fill-opacity .2s, filter .2s; }
.organ-node:hover .organ-dot { fill-opacity: .62; }
.organ-node.sel .organ-dot { fill-opacity: .8; stroke-width: 1.6; filter: drop-shadow(0 0 6px var(--g, var(--accent))); }
.organ-node.dim { opacity: .26; }
.organ-node.dim:hover { opacity: .5; }
.organ-node:focus-visible .organ-dot { stroke: #fff; stroke-width: 2; }
.organ-ring { fill: none; stroke: var(--g, var(--accent)); stroke-width: .9; opacity: .5; transform-box: fill-box; transform-origin: center; animation: organRing 3s ease-out infinite; }
@keyframes organRing { 0% { transform: scale(.85); opacity: .5; } 70% { transform: scale(1.16); opacity: 0; } 100% { opacity: 0; } }
.organ-label { font-size: 7.5px; fill: var(--text-2); font-weight: 600; paint-order: stroke; stroke: rgba(8, 10, 13, .92); stroke-width: 2.2px; pointer-events: none; }
.organ-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.organ-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--text-2); font-size: 12px; max-width: 100%; }
.organ-chip:hover { border-color: var(--accent-line); color: var(--text); }
.organ-chip.on { background: rgba(255, 255, 255, .06); color: var(--text); border-color: var(--accent-line); }
.oc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--g, var(--accent)); flex: none; }
.oc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.organ-detail { display: flex; flex-direction: column; gap: 11px; }
.od-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.od-title { font-size: 19px; margin: 2px 0 0; overflow-wrap: anywhere; }
.od-sum { font-size: 13px; line-height: 1.6; color: var(--text-2); margin: 0; overflow-wrap: anywhere; }
.od-note { font-size: 11.5px; line-height: 1.55; color: var(--text-3); margin: 0; padding-top: 8px; border-top: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.dis-row { padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, .022); border-left: 2px solid rgba(242, 178, 62, .38); min-width: 0; }
.dis-name { font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.dis-note { font-size: 11.5px; line-height: 1.5; color: var(--text-3); overflow-wrap: anywhere; }

/* --- Convergence network map -------------------------------------- */
.netmap { position: relative; display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.nm-threads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; overflow: visible; }
.nm-thread { fill: none; stroke-width: 1; opacity: .1; stroke-dasharray: 3 5; transition: opacity .18s, stroke-width .18s; }
.nm-thread.dim { opacity: .045; }
.nm-thread.hl { opacity: .95; stroke-width: 1.6; stroke-dasharray: none; animation: nmPulse 2.4s ease-in-out infinite; }
@keyframes nmPulse { 0%, 100% { opacity: .95; } 50% { opacity: .5; } }
.nm-canvas { position: sticky; top: calc(var(--top-h, 56px) + 10px); display: flex; flex-direction: column; gap: 10px; min-width: 0; z-index: 4; }
.nm-canvas-card { position: relative; }
.nm-brain { width: 100%; height: auto; display: block; }
.nm-brain-shape path { fill: rgba(255, 255, 255, .03); stroke: rgba(255, 255, 255, .1); stroke-width: 1.2; }
.nm-brain-shape .nm-cb { fill: rgba(255, 255, 255, .045); }
.nm-region { cursor: pointer; outline: none; }
.nm-region .nm-region-hit { fill: transparent; }
.nm-region .nm-region-dot { fill: rgba(255, 255, 255, .5); stroke: rgba(8, 10, 13, .85); stroke-width: 1; transition: fill .18s; }
.nm-region:hover .nm-region-dot, .nm-region.on .nm-region-dot { fill: var(--accent); }
.nm-region.empty .nm-region-dot { fill: rgba(255, 255, 255, .2); }
.nm-region-t { font-size: 9px; fill: var(--text-2); font-weight: 600; paint-order: stroke; stroke: rgba(8, 10, 13, .92); stroke-width: 2.4px; pointer-events: none; }
.nm-region.on .nm-region-t { fill: var(--text); }
.nm-region-n { font-size: 8px; fill: var(--accent); font-family: var(--mono); pointer-events: none; }
.nm-organ-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.nm-body { width: 100%; max-width: 200px; height: auto; display: block; margin: 0 auto; }
.nm-body-shape ellipse, .nm-body-shape rect, .nm-body-shape path { fill: rgba(255, 255, 255, .03); stroke: rgba(255, 255, 255, .085); stroke-width: 1; }
.nm-body-limb path { fill: none; stroke: rgba(255, 255, 255, .055); stroke-width: 15; stroke-linecap: round; }
.nm-organ .nm-organ-hit { fill: transparent; }
.nm-organ .nm-organ-dot { fill: rgba(111, 179, 255, .35); stroke: #6fb3ff; stroke-width: 1; transition: fill .18s; }
.nm-organ:hover .nm-organ-dot { fill: rgba(111, 179, 255, .75); }
.nm-organ-t { font-size: 7px; fill: var(--text-3); paint-order: stroke; stroke: rgba(8, 10, 13, .9); stroke-width: 2px; pointer-events: none; }
.nm-list-wrap { min-width: 0; }
.nm-list-card { position: relative; z-index: 4; }
.nm-search { display: flex; align-items: center; gap: 7px; flex: 1 1 200px; min-width: 0; color: var(--text-3); }
.nm-search .input { width: 100%; }
.nm-groups { display: flex; flex-direction: column; gap: 13px; margin-top: 12px; }
.nm-group { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nm-group-head { display: flex; align-items: center; gap: 7px; padding: 4px 2px 6px; }
.nm-group-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.nm-group-name { font-size: 12px; font-weight: 650; color: var(--text); overflow-wrap: anywhere; }
.nm-group-count { font-size: 10.5px; font-family: var(--mono); color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; flex: none; }
.nm-row { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 9px; text-decoration: none; color: inherit; transition: background .14s; }
.nm-row:hover, .nm-row.hl { background: rgba(255, 255, 255, .05); }
.nm-thread-anchor { width: 5px; height: 5px; border-radius: 50%; background: var(--line); justify-self: center; }
.nm-row.hl .nm-thread-anchor { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.nm-row-body { display: flex; flex-direction: column; min-width: 0; }
.nm-row-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-row-meta { font-size: 10.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-badges { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; max-width: 152px; }
.nm-badge { font-size: 9.5px; font-family: var(--mono); padding: 1px 5px; border-radius: 999px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .04); color: var(--bc, var(--text-3)); white-space: nowrap; }
.nm-badge.none { color: var(--text-3); opacity: .65; }

/* --- Peptide calculator ------------------------------------------- */
.calc-layout { align-items: start; }
.calc-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 132px); gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: radial-gradient(120% 120% at 8% 0%, rgba(242, 178, 62, .13), transparent 62%), rgba(255, 255, 255, .02); border: 1px solid var(--line-soft); }
.calc-hero-l { min-width: 0; }
.calc-units { display: flex; align-items: baseline; gap: 5px; font-family: var(--mono); font-size: 32px; font-weight: 600; color: var(--text); line-height: 1.05; overflow-wrap: anywhere; }
.cu-suffix { font-size: 12px; color: var(--text-3); font-family: var(--sans); }
.calc-syringe { min-width: 0; }
.cs-bar { position: relative; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; border: 1px solid var(--line-soft); }
.cs-bar > i { position: absolute; inset: 0 auto 0 0; width: 4%; background: linear-gradient(90deg, rgba(242, 178, 62, .45), var(--accent)); border-radius: 999px; transition: width .3s var(--ease); box-shadow: 0 0 12px -2px var(--accent); }
.cs-bar > i.over { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.cs-ticks { display: flex; justify-content: space-between; font-size: 9px; font-family: var(--mono); color: var(--text-3); margin-top: 3px; }
.calc-rows { display: flex; flex-direction: column; margin-top: 12px; }
.calc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-2); }
.calc-row:last-child { border-bottom: 0; }
.calc-row b { font-family: var(--mono); font-weight: 600; color: var(--text); text-align: right; overflow-wrap: anywhere; }

/* --- Responsive ---------------------------------------------------- */
@media (max-width: 1000px) {
  .netmap { grid-template-columns: minmax(0, 1fr); }
  .nm-threads { display: none; }
  .nm-canvas { position: static; }
  .nm-badges { max-width: 118px; }
}
@media (max-width: 620px) {
  .calc-hero { grid-template-columns: minmax(0, 1fr); }
  .calc-units { font-size: 28px; }
  .nm-row { grid-template-columns: 10px minmax(0, 1fr); }
  .nm-badges { grid-column: 2; justify-content: flex-start; max-width: 100%; }
  .organ-list { gap: 4px; }
  .body-svg { max-width: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  .organ-ring, .nm-thread.hl { animation: none !important; }
  .cs-bar > i, .path-card, .nm-thread, .organ-node .organ-dot { transition: none !important; }
}
[data-motion="off"] .organ-ring, [data-motion="off"] .nm-thread.hl { animation: none !important; }
