/* ==========================================================================
   Alchemy — design system
   ========================================================================== */

:root {
  --font-display: 'Instrument Serif', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --topbar-h: 64px;
  --maxw: 1480px;
  --gutter: clamp(16px, 3vw, 40px);
}

/* Dark (default) */
:root,
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #07060e;
  --bg-2: #0d0b19;
  --panel: rgba(24, 20, 44, .55);
  --panel-solid: #13112a;
  --panel-2: rgba(255, 255, 255, .04);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #efebf9;
  --text-2: #bdb6d6;
  --muted: #8c85a8;
  --gold: #f2c66d;
  --gold-2: #ffe3a3;
  --violet: #9b7bff;
  --accent: var(--gold);
  --tile-bg: rgba(255, 255, 255, .035);
  --tile-mix: 12%;
  --tile-text-mix: 100%;
  --shadow: 0 18px 60px -12px rgba(0, 0, 0, .6);
  --shadow-s: 0 6px 24px -8px rgba(0, 0, 0, .5);
  --glass-blur: 18px;
  --aurora-1: rgba(120, 70, 255, .22);
  --aurora-2: rgba(242, 160, 70, .12);
  --aurora-3: rgba(40, 200, 255, .10);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f2ea;
  --bg-2: #efe9dd;
  --panel: rgba(255, 253, 248, .72);
  --panel-solid: #fffdf8;
  --panel-2: rgba(60, 40, 10, .035);
  --line: rgba(50, 35, 10, .1);
  --line-2: rgba(50, 35, 10, .18);
  --text: #1d1830;
  --text-2: #463f5e;
  --muted: #787190;
  --gold: #a8740f;
  --gold-2: #7a5306;
  --violet: #6a4bdb;
  --tile-bg: rgba(255, 255, 255, .6);
  --tile-mix: 16%;
  --tile-text-mix: 62%;
  --shadow: 0 18px 50px -16px rgba(60, 40, 10, .25);
  --shadow-s: 0 6px 20px -10px rgba(60, 40, 10, .25);
  --aurora-1: rgba(140, 100, 255, .14);
  --aurora-2: rgba(242, 170, 60, .16);
  --aurora-3: rgba(60, 190, 230, .10);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 64px); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
button { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--font-mono); }
sup, sub { font-size: .68em; line-height: 0; }
small { font-size: .82em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
::selection { background: color-mix(in oklab, var(--gold) 40%, transparent); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.ico { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Ambient background ---------- */

#motes { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.aurora span {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  animation: drift 28s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { background: var(--aurora-1); top: -25vmax; left: -15vmax; }
.aurora span:nth-child(2) { background: var(--aurora-2); bottom: -30vmax; right: -20vmax; animation-duration: 34s; }
.aurora span:nth-child(3) { background: var(--aurora-3); top: 30%; left: 45%; width: 40vmax; height: 40vmax; animation-duration: 40s; }
@keyframes drift {
  to { transform: translate3d(6vmax, 4vmax, 0) scale(1.1); }
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-mark { width: 34px; height: 34px; filter: drop-shadow(0 0 10px color-mix(in oklab, var(--gold) 45%, transparent)); }
.brand-mark .ring { transform-origin: 32px 32px; animation: spin 40s linear infinite; }
.brand-mark .core { animation: pulse 3s ease-in-out infinite; transform-origin: 32px 34.5px; }
.brand:hover .brand-mark .ring { animation-duration: 6s; }
.brand-name {
  font: 400 26px/1 var(--font-display);
  letter-spacing: .01em;
  background: linear-gradient(120deg, var(--gold-2), var(--gold) 45%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.45); opacity: .7; } }

.nav { display: flex; gap: 4px; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--text); background: color-mix(in oklab, var(--gold) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--gold) 30%, transparent); }
.nav a.active .ico { color: var(--gold); }
.nav-count {
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  background: var(--gold);
  color: #1a1206;
  font-size: 11px;
  font-weight: 700;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-trigger {
  display: flex; align-items: center; gap: 10px;
  min-width: 240px;
  padding: 8px 10px 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.search-trigger:hover { border-color: var(--line-2); color: var(--text-2); }
.search-trigger span { flex: 1; text-align: left; font-size: 14px; }

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.5;
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: color .2s, border-color .2s, transform .2s var(--ease-spring), background .2s;
}
.icon-btn:hover { color: var(--gold); border-color: color-mix(in oklab, var(--gold) 40%, transparent); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }

/* ---------- Layout ---------- */

main { position: relative; z-index: 1; flex: 1; outline: none; }

.page, .table-page, .element-page {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
}

.footer {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px;
  padding: 22px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.footer a { color: var(--text-2); }
.footer kbd { margin: 0 1px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.display {
  margin: 0;
  font: 400 clamp(34px, 4.6vw, 60px)/1.02 var(--font-display);
  letter-spacing: -.01em;
}
.display em {
  font-style: italic;
  background: linear-gradient(100deg, var(--gold-2), var(--gold) 40%, #ff8fb1 75%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { max-width: 62ch; margin: 12px 0 0; color: var(--text-2); font-size: 16px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons, chips, cards ---------- */

.btn, .ghost-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .25s var(--ease-spring), border-color .2s, background .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); border-color: color-mix(in oklab, var(--c, var(--gold)) 50%, transparent); box-shadow: 0 8px 24px -10px color-mix(in oklab, var(--c, var(--gold)) 60%, transparent); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, color-mix(in oklab, var(--c, var(--gold)) 90%, white), color-mix(in oklab, var(--c, var(--gold)) 75%, black));
  color: #16110a;
  border-color: transparent;
  font-weight: 600;
}
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.ghost-btn { border-color: transparent; background: transparent; color: var(--text-2); padding: 8px 12px; }
.ghost-btn:hover { background: var(--panel-2); color: var(--text); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s var(--ease);
}
.chip > i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--gold)); box-shadow: 0 0 10px var(--c, var(--gold)); }
.chip small { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip .ico { color: var(--c, currentColor); }
.chip:hover { color: var(--text); border-color: color-mix(in oklab, var(--c, var(--gold)) 50%, transparent); }
.chip.on {
  color: var(--text);
  background: color-mix(in oklab, var(--c, var(--gold)) 18%, transparent);
  border-color: color-mix(in oklab, var(--c, var(--gold)) 70%, transparent);
}

.card {
  position: relative;
  padding: 22px;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-s);
}
.card-title {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.card-title .ico { color: var(--c, var(--gold)); }

.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.wide { margin-top: 18px; }

.kv { margin: 0; display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.kv dd small { color: var(--muted); font-weight: 400; display: block; }

.prose { margin: 0 0 10px; color: var(--text-2); line-height: 1.7; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 18px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--gold) 35%, transparent);
  background: color-mix(in oklab, var(--gold) 8%, transparent);
  color: var(--text-2);
  font-size: 14px;
}
.notice .ico { color: var(--gold); margin-top: 2px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 1px 2px 1px 0;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
}
.tag.ok { color: #3bd18a; border-color: color-mix(in oklab, #3bd18a 40%, transparent); background: color-mix(in oklab, #3bd18a 10%, transparent); }

.p-sym {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 34px;
  padding: 0 4px;
  border-radius: 9px;
  background: color-mix(in oklab, var(--c, var(--gold)) 16%, transparent);
  border: 1px solid color-mix(in oklab, var(--c, var(--gold)) 45%, transparent);
  color: color-mix(in oklab, var(--c, var(--gold)) var(--tile-text-mix), var(--text));
  font-weight: 700;
  font-size: 14px;
  flex: none;
}

.fatal { display: grid; place-items: center; gap: 8px; padding: 120px 20px; text-align: center; color: var(--text-2); }
.fatal h2 { font: 400 32px var(--font-display); margin: 8px 0 0; color: var(--text); }

.table-scroll { overflow-x: auto; }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--track-fill, var(--gold)) 0 var(--p, 50%), var(--line-2) var(--p, 50%));
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--thumb, var(--gold)));
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--thumb, var(--gold)) 30%, transparent), 0 0 20px var(--thumb, var(--gold));
  transition: transform .2s var(--ease-spring);
}
.range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--thumb, var(--gold)));
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--thumb, var(--gold)) 30%, transparent), 0 0 20px var(--thumb, var(--gold));
}

/* ==========================================================================
   Periodic table
   ========================================================================== */

.table-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.table-page { padding-top: 20px; }
.table-page .display { font-size: clamp(30px, 3.6vw, 50px); }
.mode-controls .legend .chip { padding: 5px 10px; font-size: 12.5px; }

.mode-switch {
  position: relative;
  display: flex;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(var(--glass-blur));
}
.mode-switch button {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: color .25s;
}
.mode-switch button:hover { color: var(--text); }
.mode-switch button[aria-selected='true'] { color: var(--text); }
.mode-switch button[aria-selected='true'] .ico { color: var(--gold); }
.mode-pill {
  position: absolute;
  top: 4px; bottom: 4px; left: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in oklab, var(--gold) 22%, transparent), color-mix(in oklab, var(--violet) 18%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--gold) 35%, transparent), 0 4px 18px -6px color-mix(in oklab, var(--gold) 50%, transparent);
  transition: transform .45s var(--ease-spring), width .45s var(--ease-spring);
}

.mode-controls { min-height: 46px; margin-bottom: 16px; animation: fade-up .45s var(--ease); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.legend.compact { gap: 6px; }
.legend-note { color: var(--muted); font-size: 13px; margin-left: 6px; }
.legend-note a { color: var(--gold); text-decoration: none; }

.thermo, .timeline, .heat-controls {
  display: grid;
  grid-template-columns: auto minmax(200px, 1fr) auto;
  align-items: center;
  gap: 14px 22px;
  padding: 14px 18px;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(var(--glass-blur));
}
.thermo .legend, .timeline .legend { grid-column: 1 / -1; }
.thermo-readout, .timeline-readout { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.thermo-readout b, .timeline-readout b { display: block; font: 400 30px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.thermo-readout small, .timeline-readout small { color: var(--muted); }
.thermo-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: color-mix(in oklab, #ff7a45 16%, transparent); color: #ff9a6a; }
.thermo-range {
  --track-fill: linear-gradient(90deg, #5aa9ff, #9fb3d1 20%, #f5c542 50%, #ff5d6c);
  background: linear-gradient(90deg, #3a7bd5 0%, #7fb4ff 12%, #f5c542 45%, #ff7a45 70%, #ff3d6c 100%);
  --thumb: #ffd27a;
}
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.preset {
  display: grid; gap: 0;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
  transition: all .2s;
}
.preset small { color: var(--muted); font-size: 10.5px; }
.preset:hover, .preset.on { border-color: color-mix(in oklab, var(--gold) 55%, transparent); color: var(--text); }
.preset.on { background: color-mix(in oklab, var(--gold) 14%, transparent); }

.timeline { grid-template-columns: auto auto minmax(200px, 1fr); }
.play-btn {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #1a1206;
  cursor: pointer;
  box-shadow: 0 0 0 6px color-mix(in oklab, var(--gold) 16%, transparent), 0 8px 24px -6px var(--gold);
  transition: transform .25s var(--ease-spring);
}
.play-btn:hover { transform: scale(1.08); }
.tl-range { --thumb: var(--gold); }

.heat-controls { grid-template-columns: auto minmax(220px, 420px) 1fr; }
.select {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--gold);
}
.select select {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 500 14px var(--font-ui);
  padding: 10px 4px;
  cursor: pointer;
  outline: none;
}
.select select option, .select select optgroup { background: var(--panel-solid); color: var(--text); }
.ramp { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ramp i { flex: 1; height: 10px; border-radius: 999px; box-shadow: 0 0 20px -4px rgba(244, 116, 74, .6); min-width: 120px; }

/* --- the grid --- */

.ptable-wrap {
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 6px 14px 0;
  margin: 0 -6px;
  scrollbar-width: thin;
}
.ptable {
  --gap: clamp(3px, .35vw, 6px);
  container-type: inline-size;
  position: relative;
  display: grid;
  grid-template-columns: 22px repeat(18, minmax(0, 1fr));
  grid-template-rows: 22px repeat(7, auto) 14px repeat(2, auto);
  gap: var(--gap);
  min-width: 940px;
  max-width: max(940px, calc((100svh - var(--topbar-h) - 210px) * 1.95));
  margin: 0 auto;
  --mx: -1000px;
  --my: -1000px;
}

.glabel, .plabel, .flabel {
  display: grid; place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: .7;
}
.flabel { justify-items: end; padding-right: 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 500; }

.tile {
  --c: #888;
  position: relative;
  aspect-ratio: 1 / 1.06;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: clamp(6px, .8cqi, 12px);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  isolation: isolate;
  border: 1px solid transparent;
  background:
    linear-gradient(160deg, color-mix(in oklab, var(--c) calc(var(--tile-mix) + 6%), var(--bg-2)), color-mix(in oklab, var(--c) calc(var(--tile-mix) - 4%), var(--bg))) padding-box,
    radial-gradient(260px circle at var(--mx) var(--my), color-mix(in oklab, var(--c) 95%, white), transparent 60%) border-box,
    linear-gradient(color-mix(in oklab, var(--c) 32%, transparent), color-mix(in oklab, var(--c) 18%, transparent)) border-box;
  background-attachment: scroll, fixed, scroll;
  transition: transform .35s var(--ease-spring), box-shadow .35s var(--ease), opacity .4s var(--ease), filter .4s var(--ease);
  will-change: transform;
}
:root[data-theme='light'] .tile {
  background:
    linear-gradient(160deg, color-mix(in oklab, var(--c) 20%, white), color-mix(in oklab, var(--c) 10%, white)) padding-box,
    radial-gradient(260px circle at var(--mx) var(--my), color-mix(in oklab, var(--c) 90%, black), transparent 60%) border-box,
    linear-gradient(color-mix(in oklab, var(--c) 45%, transparent), color-mix(in oklab, var(--c) 28%, transparent)) border-box;
  background-attachment: scroll, fixed, scroll;
}

.tile::after {
  /* inner shine */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, .12), transparent 45%);
  pointer-events: none;
  z-index: -1;
}

.t-num {
  position: absolute;
  top: 5%; left: 8%;
  font-size: clamp(7px, .75cqi, 11px);
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.t-rad { position: absolute; top: 5%; right: 7%; color: color-mix(in oklab, var(--c) 80%, var(--text)); opacity: .75; line-height: 0; }
.t-rad .ico { width: clamp(7px, .75cqi, 11px); height: auto; }
.t-sym {
  font-size: clamp(14px, 2.05cqi, 30px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  margin-top: 6%;
  color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text));
  text-shadow: 0 0 18px color-mix(in oklab, var(--c) 45%, transparent);
  transition: transform .35s var(--ease-spring);
}
:root[data-theme='light'] .t-sym { text-shadow: none; }
.t-name {
  max-width: 100%;
  margin-top: 5%;
  font-size: clamp(6px, .66cqi, 10.5px);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-val {
  font-size: clamp(6px, .6cqi, 9.5px);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile:hover, .tile:focus-visible {
  z-index: 5;
  transform: translateY(-3px) scale(1.14);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--c) 80%, transparent), 0 10px 30px -6px color-mix(in oklab, var(--c) 70%, transparent), 0 0 44px -4px color-mix(in oklab, var(--c) 55%, transparent);
  outline: none;
}
.tile:hover .t-sym { transform: scale(1.06); }
.tile:active { transform: scale(1.04); }

.tile.dim { opacity: .14; filter: grayscale(.9) blur(.3px); transform: scale(.94); }
.tile.dim:hover { opacity: .6; filter: none; }

.tile.placeholder { aspect-ratio: auto; cursor: pointer; border-style: dashed; }
.tile.placeholder .t-sym { font-size: clamp(9px, 1cqi, 14px); margin: 0; }
.tile.placeholder .t-name { margin-top: 4px; }
.ptable[data-series='lanthanide'] .tile[data-n]:not(.s-lanthanide),
.ptable[data-series='actinide'] .tile[data-n]:not(.s-actinide) { opacity: .25; filter: grayscale(.7); }
.ptable[data-series] .s-lanthanide, .ptable[data-series] .s-actinide { box-shadow: 0 0 22px -6px var(--c); }

/* Heatmap mode: solid fills */
.ptable[data-mode='trend'] .tile:not(.missing) {
  background: linear-gradient(160deg, color-mix(in oklab, var(--heat) 92%, white), var(--heat)) padding-box,
    radial-gradient(260px circle at var(--mx) var(--my), #fff, transparent 60%) border-box,
    linear-gradient(var(--heat), var(--heat)) border-box;
  background-attachment: scroll, fixed, scroll;
}
.ptable[data-mode='trend'] .tile:not(.missing) .t-sym { color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.ptable[data-mode='trend'] .tile:not(.missing) .t-num,
.ptable[data-mode='trend'] .tile:not(.missing) .t-name,
.ptable[data-mode='trend'] .tile:not(.missing) .t-val { color: rgba(255, 255, 255, .85); }
.ptable[data-mode='trend'] .tile[data-light='1'] .t-sym { color: #2a1230; text-shadow: none; }
.ptable[data-mode='trend'] .tile[data-light='1'] .t-num,
.ptable[data-mode='trend'] .tile[data-light='1'] .t-name,
.ptable[data-mode='trend'] .tile[data-light='1'] .t-val { color: rgba(42, 18, 48, .78); }
.ptable[data-mode='trend'] .tile.missing {
  opacity: .5;
  background: repeating-linear-gradient(135deg, var(--panel-2) 0 6px, transparent 6px 12px) padding-box, linear-gradient(var(--line), var(--line)) border-box;
}
.ptable[data-mode='trend'] .tile .t-val { font-size: clamp(6px, .66cqi, 10px); font-weight: 600; }

/* State mode: animated matter */
.tile[data-state='liquid']::before {
  content: '';
  position: absolute;
  left: -50%; right: -50%;
  bottom: -2px;
  height: 46%;
  background: color-mix(in oklab, var(--c) 35%, transparent);
  border-radius: 42%;
  animation: wave 5s linear infinite;
  z-index: -1;
}
.tile[data-state='liquid'] { overflow: hidden; }
.tile[data-state='gas'] { animation: float 3.6s ease-in-out infinite; animation-delay: calc(var(--i) * -170ms); }
.tile[data-state='gas'] .t-sym { filter: blur(.2px); }
.tile[data-state='gas']:hover { animation: none; }
.tile[data-state='unknown'] { opacity: .45; border-style: dashed; }
.tile[data-state='solid'] .t-sym { text-shadow: none; }
@keyframes wave { to { transform: translateX(25%) rotate(360deg); } }
@keyframes float {
  50% { transform: translateY(-4px); box-shadow: 0 10px 20px -12px color-mix(in oklab, var(--c) 70%, transparent); }
}

/* Discovery mode */
.tile.undiscovered { opacity: .12; filter: grayscale(1); transform: scale(.9); }
.tile:not(.undiscovered) { }
.ptable[data-mode='discovery'] .tile:not(.undiscovered) { animation: born .6s var(--ease-spring); }
@keyframes born { from { transform: scale(.7); } }

/* Intro cascade */
.ptable.intro .tile, .ptable.intro .glabel, .ptable.intro .plabel {
  animation: tile-in .7s var(--ease-spring) both;
  animation-delay: calc(var(--i, 0) * 34ms + 80ms);
}
.ptable.intro .hero-panel { animation: fade-up .9s var(--ease) .35s both; }
@keyframes tile-in {
  from { opacity: 0; transform: translateY(18px) scale(.6) rotateX(40deg); filter: blur(6px); }
}
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } }

.table-hint { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 14px 0 0; color: var(--muted); font-size: 13px; }

/* --- hero preview inside the table gap --- */

.hero-panel {
  --c: var(--gold);
  position: relative;
  align-self: stretch;
  margin: 2px 8px 10px;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in oklab, var(--c) 16%, transparent), transparent 60%),
    var(--panel);
  backdrop-filter: blur(var(--glass-blur));
  overflow: hidden;
  transition: border-color .4s, background .4s;
  container-type: inline-size;
}
.hero-panel.active { border-color: color-mix(in oklab, var(--c) 40%, transparent); }
.hero-idle { height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 3cqi 4cqi; animation: fade-up .5s var(--ease); }
.hero-idle h2 { margin: 0 0 6px; font: 400 clamp(20px, 3.6cqi, 34px)/1.05 var(--font-display); }
.hero-idle p { margin: 0; color: var(--text-2); max-width: 60ch; font-size: clamp(12px, 1.55cqi, 15px); }
.hero-stats { display: flex; gap: 5cqi; margin-top: 2.2cqi; }
.hero-stats b { display: block; font: 400 clamp(20px, 3.4cqi, 34px)/1 var(--font-display); color: var(--gold); }
.hero-stats small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

.hero-card {
  height: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 3cqi;
  padding: 2.4cqi 3cqi;
  animation: hero-swap .35s var(--ease);
}
@keyframes hero-swap { from { opacity: .3; transform: translateX(-6px); } }
.hero-specimen {
  position: relative;
  width: clamp(80px, 15cqi, 138px);
  aspect-ratio: 1;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, color-mix(in oklab, var(--c) 30%, var(--bg-2)), color-mix(in oklab, var(--c) 8%, var(--bg)));
  border: 1px solid color-mix(in oklab, var(--c) 60%, transparent);
  box-shadow: 0 0 40px -8px color-mix(in oklab, var(--c) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .15);
}
:root[data-theme='light'] .hero-specimen { background: linear-gradient(150deg, color-mix(in oklab, var(--c) 30%, white), color-mix(in oklab, var(--c) 12%, white)); }
.hs-num { position: absolute; top: 9%; left: 11%; font-size: clamp(10px, 1.5cqi, 14px); font-weight: 600; color: var(--text-2); }
.hs-sym { font: 400 clamp(40px, 7.2cqi, 72px)/1 var(--font-display); color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); text-shadow: 0 0 24px color-mix(in oklab, var(--c) 50%, transparent); }
.hs-mass { position: absolute; bottom: 8%; font-size: clamp(9px, 1.25cqi, 12px); color: var(--text-2); font-variant-numeric: tabular-nums; }
.hero-info h2 { margin: 0; font: 400 clamp(22px, 4.2cqi, 40px)/1 var(--font-display); }
.hero-cat { margin: 4px 0 0; color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); font-size: clamp(11px, 1.45cqi, 13.5px); font-weight: 500; }
.hero-config { margin: 4px 0 0; font-family: var(--font-mono); color: var(--text-2); font-size: clamp(10.5px, 1.35cqi, 13px); }
.hero-dl { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 2.2cqi; margin: 1.6cqi 0 0; justify-content: start; }
.hero-dl div { min-width: 0; }
.hero-dl dt { color: var(--muted); font-size: clamp(9px, 1.1cqi, 11px); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.hero-dl dd { margin: 0; font-size: clamp(11px, 1.45cqi, 14px); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-dl dd small { color: var(--muted); font-weight: 400; }
.hero-dl .hl dd { color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); text-transform: capitalize; }
.hero-bohr .bohr { width: clamp(90px, 17cqi, 160px); height: auto; }

/* ---------- Bohr model ---------- */

.bohr { overflow: visible; }
.bohr .orbit { fill: none; stroke: color-mix(in oklab, var(--bc) 30%, transparent); stroke-width: 1; stroke-dasharray: 2 4; }
.bohr .e { fill: var(--bc); filter: drop-shadow(0 0 3px var(--bc)); }
:root[data-theme='light'] .bohr .e { fill: color-mix(in oklab, var(--bc) 75%, black); filter: none; }
.bohr .spin { transform-box: view-box; transform-origin: 50% 50%; animation: spin var(--d) linear infinite; animation-direction: var(--dir); }
.bohr .nucleus { transform-box: view-box; transform-origin: 50% 50%; animation: jiggle 4s ease-in-out infinite; }
.bohr .nucleus-glow { animation: glow 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.bohr .shell-label { fill: var(--muted); font: 600 10px var(--font-ui); }
@keyframes jiggle { 50% { transform: rotate(8deg) scale(1.03); } }
@keyframes glow { 50% { opacity: .55; transform: scale(1.2); } }

/* ==========================================================================
   Element page
   ========================================================================== */

.el-topnav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.el-stepper { display: flex; gap: 8px; }
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  text-decoration: none;
  color: var(--text-2);
  font-size: 13px;
  transition: all .25s var(--ease);
}
.step b { color: color-mix(in oklab, var(--sc) var(--tile-text-mix), var(--text)); font-size: 15px; }
.step:hover { border-color: color-mix(in oklab, var(--sc) 55%, transparent); color: var(--text); transform: translateX(-2px); }
.step.next:hover { transform: translateX(2px); }

.el-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 36px;
  align-items: center;
  padding: 30px;
  border-radius: 28px;
  border: 1px solid color-mix(in oklab, var(--c) 30%, var(--line));
  background:
    radial-gradient(80% 120% at 0% 0%, color-mix(in oklab, var(--c) 22%, transparent), transparent 60%),
    radial-gradient(60% 100% at 100% 100%, color-mix(in oklab, var(--violet) 14%, transparent), transparent 60%),
    var(--panel);
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.el-specimen {
  position: relative;
  width: 210px;
  aspect-ratio: 1 / 1.12;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, color-mix(in oklab, var(--c) 34%, var(--bg-2)), color-mix(in oklab, var(--c) 8%, var(--bg)));
  border: 1px solid color-mix(in oklab, var(--c) 70%, transparent);
  box-shadow: 0 0 80px -10px color-mix(in oklab, var(--c) 65%, transparent), inset 0 1px 0 rgba(255, 255, 255, .2);
  animation: float-slow 6s ease-in-out infinite;
}
:root[data-theme='light'] .el-specimen { background: linear-gradient(155deg, color-mix(in oklab, var(--c) 32%, white), color-mix(in oklab, var(--c) 12%, white)); }
.el-specimen::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .22) 45%, transparent 60%);
  background-size: 250% 100%;
  animation: sheen 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen { 0%, 60% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
@keyframes float-slow { 50% { transform: translateY(-6px); } }
.sp-num { position: absolute; top: 14px; left: 18px; font-size: 18px; font-weight: 600; color: var(--text-2); }
.sp-sym { font: 400 104px/1 var(--font-display); margin-top: -14px; color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); text-shadow: 0 0 40px color-mix(in oklab, var(--c) 60%, transparent); }
.sp-name { position: absolute; bottom: 38px; font-size: 15px; font-weight: 500; }
.sp-mass { position: absolute; bottom: 18px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sp-shells { position: absolute; top: 16px; right: 16px; font-size: 10px; color: var(--muted); writing-mode: vertical-rl; letter-spacing: .06em; }

.el-title { min-width: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid color-mix(in oklab, var(--c) 50%, transparent);
  background: color-mix(in oklab, var(--c) 14%, transparent);
  color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text));
}
.badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.badge.plain { --c: var(--muted); color: var(--text-2); background: var(--panel-2); border-color: var(--line); }
.badge.warn { --c: #ffcc33; }
.el-name { margin: 12px 0 0; font: 400 clamp(52px, 7vw, 92px)/.95 var(--font-display); letter-spacing: -.02em; }
.el-sub { margin: 10px 0 0; color: var(--text-2); font-size: 15px; }
.el-summary { margin: 16px 0 0; max-width: 70ch; color: var(--text-2); line-height: 1.7; font-size: 15.5px; }
.el-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.el-bohr { margin: 0; display: grid; justify-items: center; gap: 8px; }
.el-bohr .bohr { width: min(300px, 26vw); height: auto; }
.el-bohr figcaption { font-size: 13px; color: var(--muted); }
.el-bohr figcaption b { color: var(--text); font-weight: 600; }

.section-nav {
  position: sticky;
  top: calc(var(--topbar-h) + 10px);
  z-index: 20;
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 22px auto 0;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  box-shadow: var(--shadow-s);
  scrollbar-width: none;
}
.section-nav a {
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all .25s;
}
.section-nav a:hover { color: var(--text); }
.section-nav a.active { color: var(--text); background: color-mix(in oklab, var(--c) 20%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c) 45%, transparent); }

.el-section { padding-top: 36px; }
.sec-title { display: flex; align-items: center; gap: 12px; margin: 0; font: 400 34px/1.1 var(--font-display); }
.sec-title .ico { color: var(--c); }

.card, .stat { transition: opacity .7s var(--ease), transform .7s var(--ease), border-color .3s; }
.element-page .card:not(.in), .element-page .stat:not(.in) { opacity: 0; transform: translateY(18px); }
.element-page .card:hover { border-color: color-mix(in oklab, var(--c) 30%, var(--line)); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
  padding: 16px 18px;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(var(--glass-blur));
}
.stat:nth-child(2) { transition-delay: 40ms; } .stat:nth-child(3) { transition-delay: 80ms; } .stat:nth-child(4) { transition-delay: 120ms; }
.stat:nth-child(5) { transition-delay: 160ms; } .stat:nth-child(6) { transition-delay: 200ms; } .stat:nth-child(7) { transition-delay: 240ms; } .stat:nth-child(8) { transition-delay: 280ms; }
.stat-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-top .ico { color: var(--c); }
.stat-val { margin-top: 8px; font: 400 30px/1.05 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-val small { font: 500 13px var(--font-ui); color: var(--muted); }
.stat-sub { color: var(--text-2); font-size: 12.5px; }
.stat.empty .stat-val { color: var(--muted); }
.rank-bar { height: 5px; border-radius: 999px; background: var(--line); margin-top: 12px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, color-mix(in oklab, var(--c) 50%, transparent), var(--c)); box-shadow: 0 0 12px var(--c); transition: width 1.2s var(--ease) .2s; }
.stat.in .rank-bar i { width: var(--w); }
.stat-rank { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.stat-rank b { color: var(--text-2); }

.minimap { display: grid; grid-template-columns: repeat(18, 1fr); grid-template-rows: repeat(10, auto); gap: 3px; }
.mm { aspect-ratio: 1; border-radius: 3px; background: var(--line); cursor: pointer; transition: transform .2s; }
.mm:hover { transform: scale(1.5); background: var(--mc); }
.mm.same { background: color-mix(in oklab, var(--mc) 55%, transparent); }
.mm.me { background: var(--mc); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--mc), 0 0 14px var(--mc); animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--mc), 0 0 22px var(--mc); } }

.config-big { margin: 0; font: 400 34px/1.2 var(--font-display); color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); }
.config-full { margin: 6px 0 12px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); word-spacing: 4px; line-height: 1.8; }
.mini-title { margin: 16px 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ox-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ox { min-width: 38px; padding: 5px 8px; text-align: center; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.ox.common { color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); border-color: color-mix(in oklab, var(--c) 60%, transparent); background: color-mix(in oklab, var(--c) 14%, transparent); box-shadow: 0 0 16px -4px var(--c); }

.orbitals { display: grid; gap: 10px; }
.orb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.orb-n { width: 32px; color: var(--muted); font-size: 11px; font-weight: 600; }
.orb-sub { display: inline-flex; align-items: center; gap: 6px; }
.orb-label { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); min-width: 30px; }
.orb-boxes { display: inline-flex; }
.orb-box {
  width: 22px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2);
  margin-left: -1px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.orb-box:first-child { border-radius: 5px 0 0 5px; }
.orb-box:last-child { border-radius: 0 5px 5px 0; }
.orb-box:only-child { border-radius: 5px; }
.orb-box.f { background: color-mix(in oklab, var(--c) 12%, transparent); border-color: color-mix(in oklab, var(--c) 45%, transparent); position: relative; z-index: 1; }
.orb-box i { font-style: normal; color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); }
.orb-box .dn { margin-left: -1px; opacity: .8; }

.ie-wrap { overflow-x: auto; }
.ie-chart { width: 100%; height: auto; min-width: 520px; display: block; }
.ie-chart .grid { stroke: var(--line); stroke-dasharray: 3 5; }
.ie-chart .ax { fill: var(--muted); font: 500 11px var(--font-ui); text-anchor: middle; }
.ie-chart text.ax[text-anchor='end'] { text-anchor: end; }
.ie-bar { fill: color-mix(in oklab, var(--c) 35%, transparent); transform-box: fill-box; transform-origin: bottom; transition: fill .2s; }
.ie-bar.valence { fill: var(--c); filter: drop-shadow(0 0 6px color-mix(in oklab, var(--c) 60%, transparent)); }
.ie-bar:hover { fill: var(--gold-2); }
.card.in .ie-bar { animation: grow .8s var(--ease) both; animation-delay: var(--d); }
@keyframes grow { from { transform: scaleY(0); } }
.ie-chart .jump { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 4 4; }
.ie-foot { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; font-size: 13.5px; color: var(--text-2); }
.ie-insight { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); }

.phase { padding: 30px 4px 6px; }
.phase-track { position: relative; height: 40px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.ph { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; overflow: hidden; }
.ph:first-child { border-radius: 12px 0 0 12px; }
.ph:last-of-type { border-radius: 0 12px 12px 0; }
.ph em { font-style: normal; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.ph.solid { background: linear-gradient(90deg, #3b5c8f, #7f9cc7); }
.ph.liquid { background: linear-gradient(90deg, #1f8fd6, #38bdf8); }
.ph.gas { background: linear-gradient(90deg, #c26bdc, #f0a3ff 70%, color-mix(in oklab, #f0a3ff 20%, transparent)); }
.ph-room { position: absolute; top: -8px; bottom: -8px; width: 0; }
.ph-room i { position: absolute; top: 0; bottom: 0; left: -1px; border-left: 2px dashed var(--text); opacity: .6; }
.ph-room em { position: absolute; bottom: -22px; left: 0; transform: translateX(-50%); font-style: normal; font-size: 11px; color: var(--text-2); white-space: nowrap; }
.ph-mark { position: absolute; top: -30px; transform: translateX(-50%); text-align: center; font-size: 12px; white-space: nowrap; }
.ph-mark::after { content: ''; position: absolute; left: 50%; top: 22px; height: 16px; border-left: 2px solid var(--gold); }
.ph-mark b { color: var(--text); }
.ph-mark small { display: none; }
.phase-axis { position: relative; height: 28px; margin-top: 26px; }
.phase-axis span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.phase-axis span:first-child { transform: none; }
.phase-axis span:last-child { transform: translateX(-100%); }

.radii { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.radii svg { flex: none; max-width: 100%; height: auto; }
.rad { fill: none; stroke-width: 1.5; }
.rad.r0 { stroke: color-mix(in oklab, var(--c) 35%, transparent); fill: color-mix(in oklab, var(--c) 5%, transparent); stroke-dasharray: 4 4; }
.rad.r1 { stroke: color-mix(in oklab, var(--c) 60%, transparent); fill: color-mix(in oklab, var(--c) 8%, transparent); }
.rad.r2 { stroke: color-mix(in oklab, var(--c) 80%, transparent); fill: color-mix(in oklab, var(--c) 12%, transparent); }
.rad.r3 { stroke: var(--c); fill: color-mix(in oklab, var(--c) 22%, transparent); }
.rad-core { fill: var(--c); }
.radii ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 160px; }
.radii li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.radii li b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.radii li i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--c); }
.radii li i.r0 { border-style: dashed; opacity: .5; } .radii li i.r1 { opacity: .7; } .radii li i.r2 { opacity: .85; } .radii li i.r3 { background: color-mix(in oklab, var(--c) 30%, transparent); }

.iso-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.pill-stat { padding: 12px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); min-width: 120px; }
.pill-stat b { display: block; font: 400 28px/1 var(--font-display); color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); }
.pill-stat small { color: var(--muted); }
.iso-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.iso-table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.iso-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.iso-table tr:hover td { background: var(--panel-2); }
.iso-table tr.stable .iso-sym { color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); }
.iso-sym { font-weight: 700; font-size: 15px; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.abund { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.abund span { flex: 1; height: 6px; border-radius: 999px; background: var(--line); position: relative; overflow: hidden; }
.abund span::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: inherit; background: var(--c); box-shadow: 0 0 10px var(--c); }
.abund b { font-weight: 600; font-variant-numeric: tabular-nums; width: 70px; text-align: right; }
.decay { max-width: 280px; }
[data-toggle-iso] { margin-top: 12px; }

.big-quote { font: italic 400 24px/1.45 var(--font-display); color: var(--text); }

.dtl { margin-top: 18px; }
.dtl-track { position: relative; height: 26px; border-bottom: 1px solid var(--line-2); }
.dtl-track i { position: absolute; bottom: 0; width: 2px; height: 10px; background: var(--line-2); transform: translateX(-1px); }
.dtl-track b { position: absolute; bottom: 0; width: 3px; height: 26px; background: var(--c); box-shadow: 0 0 12px var(--c); transform: translateX(-1px); border-radius: 2px; }
.dtl-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

.rank-chip { display: inline-grid; place-items: center; width: 17px; height: 17px; margin: 0 4px 0 8px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 10px; color: var(--muted); }

.specimen-photo { margin: 0; display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 20px; align-items: center; }
.specimen-photo img { width: 100%; border-radius: 16px; display: block; background: #000; }
.specimen-photo figcaption { color: var(--text-2); font-size: 14px; }
.specimen-photo figcaption small { display: block; margin-top: 10px; color: var(--muted); font-size: 11.5px; }

.endpoints { display: grid; gap: 8px; }
.endpoint { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.endpoint code { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endpoint small { margin-left: auto; color: var(--muted); white-space: nowrap; }
.method, .m { display: inline-block; padding: 2px 8px; border-radius: 6px; font: 700 11px var(--font-mono); background: color-mix(in oklab, #3bd18a 16%, transparent); color: #3bd18a; flex: none; }
.m.post { background: color-mix(in oklab, #f5a524 16%, transparent); color: #f5a524; }

.code {
  margin: 14px 0 10px;
  padding: 16px 18px;
  border-radius: 14px;
  background: color-mix(in oklab, var(--bg) 80%, black);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.65;
  overflow-x: auto;
  color: #e6e1f5;
}
:root[data-theme='light'] .code { background: #1d1830; color: #eee9fa; }
.c-mute { color: #857da3; }
.j-key { color: #f2c66d; }
.j-str { color: #8be3b7; }
.j-num { color: #8cc8ff; }
.j-lit { color: #ff8fb1; }

/* ==========================================================================
   Compare
   ========================================================================== */

.combo { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); color: var(--gold); }
.combo input { width: 200px; border: 0; background: transparent; color: var(--text); font: 500 14px var(--font-ui); padding: 10px 0; outline: none; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel-solid); box-shadow: var(--shadow); }
.combo-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; cursor: pointer; color: var(--text); font-size: 14px; }
.combo-list li small { margin-left: auto; color: var(--muted); }
.combo-list li.active, .combo-list li:hover { background: var(--panel-2); }

.cmp-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.cmp-card {
  position: relative;
  border-radius: var(--radius-l);
  border: 1px solid color-mix(in oklab, var(--c) 40%, var(--line));
  background: radial-gradient(100% 100% at 50% 0%, color-mix(in oklab, var(--c) 18%, transparent), transparent 70%), var(--panel);
  backdrop-filter: blur(var(--glass-blur));
  padding: 16px;
  animation: fade-up .5s var(--ease) both;
  transition: transform .3s var(--ease-spring), box-shadow .3s;
}
.cmp-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px -18px var(--c); }
.cmp-card.empty { display: grid; place-items: center; gap: 8px; min-height: 200px; border-style: dashed; color: var(--muted); cursor: pointer; background: transparent; --c: var(--line-2); }
.cmp-card.empty:hover { color: var(--gold); border-color: var(--gold); }
.cmp-x { position: absolute; top: 10px; right: 10px; z-index: 2; }
.cmp-link { display: grid; gap: 10px; text-decoration: none; }
.cmp-bohr { display: grid; place-items: center; }
.cmp-bohr .bohr { width: 120px; height: 120px; }
.cmp-id { display: flex; align-items: center; gap: 12px; }
.cmp-sym { font: 400 40px/1 var(--font-display); color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); text-shadow: 0 0 20px color-mix(in oklab, var(--c) 50%, transparent); }
.cmp-id b { display: block; font-size: 16px; }
.cmp-id small { color: var(--muted); }

.empty-state { display: grid; place-items: center; gap: 10px; padding: 50px 20px; color: var(--muted); text-align: center; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.cmp-group { margin-bottom: 18px; }
.cmp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.cmp-grid .cmp-group { margin: 0; }
.cmp-qual { display: grid; grid-template-columns: 180px repeat(var(--n), minmax(0, 1fr)); }
.cmp-qual > div { padding: 10px 8px; border-bottom: 1px dashed var(--line); font-size: 14px; min-width: 0; }
.cmp-qual .dot { display: inline-block; margin-right: 7px; vertical-align: middle; }
.cmp-qual .ico { margin-right: 4px; }
.q-head { font: 400 22px var(--font-display); color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); }
.cmp-id small .dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; vertical-align: 1px; }
.q-label { color: var(--muted); font-size: 13px !important; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.cmp-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.cmp-row:last-child { border: 0; }
.cmp-label b { display: block; font-size: 13.5px; font-weight: 600; }
.cmp-label small { color: var(--muted); }
.cmp-bars { display: grid; gap: 6px; }
.cmp-bar { display: grid; grid-template-columns: 30px 1fr 110px; align-items: center; gap: 10px; }
.cb-sym { font-weight: 700; font-size: 12.5px; color: color-mix(in oklab, var(--c) var(--tile-text-mix), var(--text)); }
.cb-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.cb-track i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, color-mix(in oklab, var(--c) 45%, transparent), var(--c)); animation: bar-in 1s var(--ease) both; }
.cmp-bar.lead .cb-track i { box-shadow: 0 0 14px var(--c); }
@keyframes bar-in { from { width: 0; } }
.cb-val { font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.cmp-bar.lead .cb-val { color: var(--gold); font-weight: 600; }
.radius-overlay { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.ro { fill: color-mix(in oklab, var(--c) 10%, transparent); stroke: var(--c); stroke-width: 2; filter: drop-shadow(0 0 6px color-mix(in oklab, var(--c) 50%, transparent)); animation: ring-in 1s var(--ease-spring) both; transform-box: fill-box; transform-origin: center; }
@keyframes ring-in { from { transform: scale(0); } }
.radius-overlay ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.radius-overlay li { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.radius-overlay li i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--c); }
.radius-overlay li b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Trends
   ========================================================================== */

.prop-picker { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-bottom: 18px; }
.pp-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pp-group > small { width: 100%; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.trend-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.chart-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.chart-head h3 { margin: 0; font: 400 28px var(--font-display); }
.chart-box { position: relative; overflow-x: auto; }
.trend-svg { width: 100%; height: auto; min-width: 640px; display: block; cursor: crosshair; }
.trend-svg .band { fill: transparent; }
.trend-svg .band.odd { fill: var(--panel-2); }
.trend-svg .band-label { fill: var(--muted); font: 600 10.5px var(--font-ui); text-anchor: middle; letter-spacing: .06em; text-transform: uppercase; }
.trend-svg .grid { stroke: var(--line); stroke-dasharray: 3 5; }
.trend-svg .ax { fill: var(--muted); font: 500 11px var(--font-ui); }
.trend-svg .ax-title { fill: var(--muted); font: 600 11px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.trend-line { fill: none; stroke: color-mix(in oklab, var(--gold) 55%, transparent); stroke-width: 1.6; stroke-linejoin: round; stroke-dasharray: 4000; animation: draw 2.2s var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: 4000; } to { stroke-dashoffset: 0; } }
.pt { fill: var(--c); stroke: var(--bg); stroke-width: 1.5; transition: r .2s, opacity .3s; animation: fade-in .6s var(--ease) both .4s; }
.pt.dim { opacity: .15; }
.pt.hl { r: 5.5; filter: drop-shadow(0 0 6px var(--c)); }
.pt.hot { r: 8; filter: drop-shadow(0 0 10px var(--c)); }
@keyframes fade-in { from { opacity: 0; } }
.cross { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in oklab, var(--c) 50%, var(--line));
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  min-width: 190px;
  transition: left .12s var(--ease), top .12s var(--ease);
}
.chart-tip b { display: block; font-size: 14px; }
.chart-tip small { display: block; color: var(--muted); font-size: 12px; }
.chart-tip em { display: block; font-style: normal; color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-card .legend { margin-top: 12px; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank-list a { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; text-decoration: none; overflow: hidden; }
.rank-list a:hover { background: var(--panel-2); }
.rank-list a i { position: absolute; left: 0; bottom: 0; height: 2px; width: var(--w); background: var(--c); opacity: .7; border-radius: 2px; }
.rk { width: 18px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: right; }
.rank-list .p-sym { min-width: 30px; height: 30px; font-size: 13px; }
.rn { font-size: 14px; }
.rv { margin-left: auto; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.rank-toggle { display: flex; gap: 6px; margin-top: 14px; }

/* ==========================================================================
   Tools
   ========================================================================== */

.lab { display: grid; gap: 18px; }
.formula-field { display: grid; gap: 6px; }
.ff-label { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.formula-field input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font: 500 26px var(--font-mono);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.formula-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in oklab, var(--gold) 18%, transparent); }
.ff-preview { font: 400 42px/1.2 var(--font-display); min-height: 50px; color: var(--gold-2); }
.ff-preview .hyd { margin: 0 .18em; font-family: var(--font-ui); font-weight: 300; }
:root[data-theme='light'] .ff-preview { color: var(--gold); }
.ff-msg { display: flex; align-items: center; gap: 6px; margin: 4px 0 14px; font-size: 13.5px; min-height: 20px; }
.ff-msg.ok { color: #3bd18a; }
.ff-msg.err { color: #ff6b7d; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.examples .chip b { color: var(--text); font-family: var(--font-mono); font-weight: 500; }
.lab-result { display: grid; gap: 18px; transition: opacity .3s; }
.lab-result.stale { opacity: .35; filter: grayscale(.6); }
.result-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; overflow: hidden; background: radial-gradient(80% 140% at 0% 0%, color-mix(in oklab, var(--gold) 16%, transparent), transparent 60%), var(--panel); }
.rh-main small { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.rh-value { display: flex; align-items: baseline; gap: 12px; }
.rh-value span { font: 400 clamp(48px, 7vw, 84px)/1 var(--font-display); background: linear-gradient(100deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.rh-value em { font-style: normal; color: var(--text-2); font-size: 20px; }
.rh-meta { color: var(--muted); margin-top: 6px; font-size: 14px; }
.rh-actions { display: flex; gap: 8px; margin-top: 14px; }
.donut { transform: rotate(-90deg); flex: none; }
.donut circle { fill: none; stroke: var(--c); stroke-width: 26; transition: stroke-width .2s; animation: donut-in 1s var(--ease) both; }
.donut circle:hover { stroke-width: 32; }
@keyframes donut-in { from { stroke-dasharray: 0 999; } }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; margin-bottom: 16px; gap: 2px; }
.stack span { width: var(--w); background: var(--c); box-shadow: 0 0 14px -2px var(--c); animation: bar-in 1s var(--ease) both; }
.comp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.comp-table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.comp-table td { padding: 10px; border-bottom: 1px solid var(--line); }
.comp-el { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.conv-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.conv-row label, .conv-out { display: flex; flex-direction: column; gap: 4px; }
.conv-row input { width: 180px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 500 18px var(--font-mono); outline: none; }
.conv-row input:focus { border-color: var(--gold); }
.conv-row span { color: var(--muted); font-size: 12px; }
.conv-eq { font: 400 28px var(--font-display); color: var(--gold) !important; }
.conv-out b { font: 400 30px var(--font-display); color: var(--gold-2); }
:root[data-theme='light'] .conv-out b { color: var(--gold); }

/* ==========================================================================
   Docs
   ========================================================================== */

.docs-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.docs-facts > div { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); align-items: center; }
.docs-facts .ico { grid-row: span 2; color: var(--gold); }
.docs-facts b { font-size: 13px; }
.docs-facts span, .docs-facts code { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.docs-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; }
.docs-nav { position: sticky; top: calc(var(--topbar-h) + 16px); padding: 14px; display: grid; gap: 2px; }
.docs-nav h4 { margin: 12px 8px 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.docs-nav h4:first-child { margin-top: 2px; }
.doc-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: 500 13px var(--font-mono); text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.doc-link:hover { background: var(--panel-2); color: var(--text); }
.doc-link.on { background: color-mix(in oklab, var(--gold) 14%, transparent); color: var(--text); }
.doc-link .m { font-size: 9.5px; padding: 1px 5px; }
.docs-main { display: grid; gap: 18px; min-width: 0; }
.docs-main > * { min-width: 0; }
.doc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.doc-head code { font-size: 17px; }
.doc-card p { color: var(--text-2); margin: 0 0 12px; }
.doc-card p code, .params code { padding: 1px 6px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; }
.params { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.params th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.params td { padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: top; }
.params td:first-child { white-space: nowrap; }
.console { padding: 14px; }
.console-bar { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); }
.console-bar input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: 500 13.5px var(--font-mono); outline: none; }
.console-body { width: 100%; min-height: 90px; margin-top: 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font: 13px var(--font-mono); resize: vertical; outline: none; }
.console-status { display: flex; align-items: center; gap: 14px; margin-top: 12px; font-size: 13px; color: var(--muted); min-height: 30px; }
.console-status .icon-btn { margin-left: auto; }
.st { padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 12px; }
.st.ok { background: color-mix(in oklab, #3bd18a 16%, transparent); color: #3bd18a; }
.st.err { background: color-mix(in oklab, #ff6b7d 16%, transparent); color: #ff6b7d; }
.code.json { max-height: 520px; overflow: auto; margin-bottom: 0; }
.code.json:empty { display: none; }
.tabs { display: flex; gap: 4px; align-items: center; }
.tabs button:not(.icon-btn) { padding: 6px 12px; border-radius: 9px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; }
.tabs button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.tabs .icon-btn { margin-left: auto; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--gold); animation: spin .8s linear infinite; }

/* ==========================================================================
   Palette, toast
   ========================================================================== */

.palette {
  width: min(640px, calc(100vw - 32px));
  margin: 12vh auto auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
}
.palette::backdrop { background: rgba(5, 4, 12, .55); backdrop-filter: blur(6px); }
.palette[open] .palette-box { animation: pop .3s var(--ease-spring); }
@keyframes pop { from { opacity: 0; transform: translateY(-10px) scale(.97); } }
.palette-box { border-radius: 20px; border: 1px solid var(--line-2); background: color-mix(in oklab, var(--panel-solid) 94%, transparent); backdrop-filter: blur(30px); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 0 1px color-mix(in oklab, var(--gold) 12%, transparent); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--gold); }
.palette-input input { flex: 1; border: 0; background: transparent; color: var(--text); font: 400 18px var(--font-ui); outline: none; }
.palette-list { list-style: none; margin: 0; padding: 8px; max-height: min(56vh, 460px); overflow-y: auto; }
.palette-head { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.palette-item.active { background: color-mix(in oklab, var(--c, var(--gold)) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c, var(--gold)) 30%, transparent); }
.p-main { display: grid; min-width: 0; }
.p-main b { font-weight: 500; }
.p-main small { color: var(--muted); }
.p-hint { margin-left: auto; font-size: 12px; color: var(--muted); }
.p-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--panel-2); color: var(--gold); flex: none; }
.palette-empty { padding: 24px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--panel-solid);
  border: 1px solid color-mix(in oklab, var(--gold) 40%, var(--line));
  box-shadow: var(--shadow);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .35s var(--ease-spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   View transitions
   ========================================================================== */

::view-transition-old(root) { animation: vt-out .28s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .42s var(--ease) both; }
::view-transition-group(element-hero) { animation-duration: .55s; animation-timing-function: var(--ease); }
::view-transition-image-pair(element-hero) { isolation: auto; }
::view-transition-old(element-hero), ::view-transition-new(element-hero) { animation-duration: .55s; mix-blend-mode: normal; height: 100%; object-fit: cover; }
@keyframes vt-out { to { opacity: 0; transform: scale(.985); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
.theme-swap::view-transition-old(root) { animation: none; }
.theme-swap::view-transition-new(root) { animation: theme-reveal .7s var(--ease) both; }
@keyframes theme-reveal { from { clip-path: circle(0 at calc(100% - 60px) 32px); } to { clip-path: circle(150vmax at calc(100% - 60px) 32px); } }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .search-trigger { min-width: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .el-hero { grid-template-columns: auto minmax(0, 1fr); }
  .el-bohr { grid-column: 1 / -1; }
  .el-bohr .bohr { width: 260px; }
  .trend-layout { grid-template-columns: 1fr; }
  .docs-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .nav a span { display: none; }
  .nav a { padding: 8px 11px; }
  .two-col, .cmp-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .docs-nav h4 { grid-column: 1 / -1; }
  .thermo, .timeline, .heat-controls { grid-template-columns: 1fr; }
  .thermo-range, .tl-range { grid-column: 1; }
  .specimen-photo { grid-template-columns: 1fr; }
  .footer-keys { display: none; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 58px; }
  .topbar { gap: 10px; }
  .brand-name { display: none; }
  .nav { gap: 0; }
  .nav a { padding: 8px 9px; }
  #randomBtn { display: none; }
  .icon-btn { width: 36px; height: 36px; }
  .mode-switch { width: 100%; overflow-x: auto; }
  .mode-switch button span { display: none; }
  .mode-switch button { flex: 1; justify-content: center; }
  .el-hero { grid-template-columns: 1fr; padding: 22px; gap: 20px; justify-items: start; }
  .el-specimen { width: 150px; }
  .sp-sym { font-size: 72px; }
  .sp-name { bottom: 30px; font-size: 13px; }
  .sp-mass { bottom: 12px; }
  .el-bohr { justify-self: center; }
  .el-topnav .step span { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-val { font-size: 24px; }
  .cmp-row { grid-template-columns: 1fr; gap: 8px; }
  .cmp-bar { grid-template-columns: 30px 1fr 86px; }
  .cmp-qual { grid-template-columns: 110px repeat(var(--n), minmax(0, 1fr)); font-size: 13px; }
  .docs-facts { grid-template-columns: 1fr; }
  .combo input { width: 140px; }
  .endpoint small { display: none; }
  .palette { margin-top: 8vh; }
  .palette-foot { display: none; }
  .kv > div { flex-direction: column; gap: 2px; }
  .kv dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .element-page .card:not(.in), .element-page .stat:not(.in) { opacity: 1; transform: none; }
}
