/* ============================================================================
   PokéTyper — Apple-inspired light design system
   Quiet chrome, generous whitespace, a single Action-Blue accent. Colour enters
   only from the Pokémon (the "product photograph"). SF Pro system typography.
   One signature soft shadow under sprites; no glows, no decorative gradients.
   ========================================================================== */

:root {
  /* canvas / neutrals (Apple) */
  --canvas:    #ffffff;
  --bg:        #f5f5f7;   /* parchment app background */
  --surface:   #ffffff;   /* cards / panels */
  --surface-2: #fafafc;   /* subtle fills */
  --hairline:  #e3e3e8;
  --hairline-strong: #d2d2d7;
  --ink:    #1d1d1f;
  --ink-2:  #515154;
  --ink-3:  #86868b;

  --accent:  #e35f0d;     /* Poké Ball red — the one interactive colour */
  --accent-press: #c32a08;
  --accent-soft: #fdeceb;

  /* dynamic per-Pokémon type colour (for content accents only) */
  --type: #0071e3;

  /* sprite shadow — a tight soft contact shadow that hugs any sprite size
     (drop-shadow() takes only offx offy blur colour — no spread value) */
  --ds-sprite: drop-shadow(0 6px 5px rgba(0,0,0,0.28));
  --shadow-card:   0 10px 30px -14px rgba(0,0,0,0.18);
  --shadow-pop:    0 30px 70px -24px rgba(0,0,0,0.30);

  --font: -apple-system, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --r-xs: 8px; --r-sm: 12px; --r: 16px; --r-lg: 20px; --r-xl: 28px; --r-pill: 999px;
  --t-fast: 180ms; --t: 320ms; --t-slow: 620ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);     /* gentle expo-out, Apple-like */
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --z-nav: 100; --z-sticky: 200; --z-overlay: 800; --z-modal: 900; --z-toast: 1000;
  --maxw: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.47;
  font-size: 17px;
  letter-spacing: -0.01em;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3 { font-weight: 600; line-height: 1.07; letter-spacing: -0.022em; text-wrap: balance; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.nowrap { white-space: nowrap; }
img { -webkit-user-drag: none; user-select: none; }

/* crisp animated pixel sprites */
.sprite-anim { image-rendering: -webkit-optimize-contrast; image-rendering: pixelated; }

/* ── Top bar (frosted, Apple sub-nav) ──────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.topbar__inner { max-width: var(--maxw); margin: 0 auto; padding: 10px clamp(16px, 4vw, 28px);
  display: flex; align-items: center; gap: 12px; min-height: 54px; }
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand__mark { width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(180deg, #ff5247 0 calc(50% - 1.5px), #1d1d1f calc(50% - 1.5px) calc(50% + 1.5px), #fff calc(50% + 1.5px) 100%);
  border: 1.5px solid #1d1d1f; position: relative; }
.brand__mark i { position: absolute; inset: 0; margin: auto; width: 7px; height: 7px; border-radius: 50%; background: #fff; border: 1.5px solid #1d1d1f; }
.brand__name { font-weight: 600; font-size: 1.18rem; letter-spacing: -0.03em; color: var(--accent); filter: url(#pixelate); }
.brand__name span { color: var(--ink); }

.scan { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 9px;
  background: color-mix(in srgb, var(--ink) 5%, transparent); border: 1px solid transparent; border-radius: var(--r-pill);
  padding: 8px 15px; transition: background var(--t), box-shadow var(--t); }
.scan:focus-within { background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1px var(--accent); }
.scan__icon { width: 16px; height: 16px; fill: var(--ink-3); flex-shrink: 0; }
.scan input { flex: 1; background: none; border: 0; outline: 0; font-size: 0.95rem; }
.scan input::placeholder { color: var(--ink-3); }
.scan__kbd { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); background: var(--surface); border: 1px solid var(--hairline); border-radius: 6px; padding: 1px 7px; }

.brand-ball { flex-shrink: 0; display: grid; place-items: center; line-height: 0; }
.brand-ball img { width: 40px; height: 40px; image-rendering: -webkit-optimize-contrast; image-rendering: pixelated;
  transition: transform var(--t) var(--ease); }
.brand-ball:hover img { transform: rotate(18deg) scale(1.08); }

.topnav { display: flex; gap: 2px; flex-shrink: 0; margin-left: auto; }   /* tabs to the far right */
.topnav__btn { border: 0; background: none; cursor: pointer; color: var(--ink-2);
  padding: 7px 14px; border-radius: var(--r-pill); font-size: 0.92rem; font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast); white-space: nowrap; }
.topnav__btn:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.topnav__btn.is-active { color: var(--accent); font-weight: 600; }

/* ── Pokémon "team" — each mon absolutely positioned & fully independent ── */
.team { position: relative; width: 100%; }
.team__mon { position: absolute; left: 50%; bottom: 0;   /* width / margin-left(x) / bottom(y) / z set in JS */
  object-fit: contain; image-rendering: -webkit-optimize-contrast; image-rendering: pixelated;
  filter: var(--ds-sprite); transform-origin: bottom center; }
.team__mon--fly { animation: float 4.2s var(--ease-soft) infinite; }   /* only flyers bob */
@media (prefers-reduced-motion: reduce) { .team__mon--fly { animation: none !important; } }
#hero-team { height: 340px; }
#upload-team { height: 160px; }
#game-team { height: 124px; }

/* ── Stage / views ─────────────────────────────────────────────────────── */
.stage { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 4vw, 28px) 120px; }
.view { display: none; }
.view.is-active { display: block; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; align-items: center; gap: 24px;
  padding: clamp(36px, 7vw, 84px) 0 clamp(28px, 4vw, 48px); }
.hero__copy { position: relative; }
.hero__bulba { position: absolute; left: 350px; transform: scaleX(-1); z-index: 5;   /* width/top set in JS */
  image-rendering: -webkit-optimize-contrast; image-rendering: pixelated; filter: var(--ds-sprite); }
.hero__title { font-size: clamp(2.4rem, 6vw, 4.5rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; }
/* the sprite is 40% transparent padding (ball is 18/30px), so crop it: the box is
   the VISIBLE ball size, and the inner img is zoomed + shifted to fill it. */
.title-ball { display: inline-block; width: 0.53em; height: 0.53em; overflow: hidden; vertical-align: -0.03em; margin: 0 0.02em; }
.title-ball img { display: block; width: 166.7%; height: 166.7%; transform: translate(-20%, -20%);
  image-rendering: -webkit-optimize-contrast; image-rendering: pixelated; }
.hero__title em { color: var(--accent); font-style: normal; }
.hero__sub { color: var(--ink-2); max-width: 50ch; margin-top: 20px; font-size: clamp(1.05rem, 1.5vw, 1.3rem); font-weight: 400; line-height: 1.4; }
.hero__stat { margin-top: 22px; display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.92rem; color: var(--ink-2); }
.hero__stat b { color: var(--ink); font-weight: 600; }
.hero__stat .dot { width: 7px; height: 7px; border-radius: 50%; background: #34c759; }
.hero__stat-sub { color: var(--ink-3); font-size: 0.86em; }

/* ── train / val / test split — surfaced wherever a verdict appears ─────────── */
/* colour semantics shared with the Science tab: train = neutral, val = amber,
   test = accent red. Only Gen 8 & 9 are genuine held-out predictions. */
.gen-hint { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px;
  font-size: 0.76rem; color: var(--ink-3); }
.gen-hint b { color: var(--ink-2); font-weight: 600; }
.gen-hint span { display: inline-flex; align-items: center; }
.gen-hint__dot { width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.gen-hint--val .gen-hint__dot { background: #c98a1e; }
.gen-hint--test .gen-hint__dot { background: var(--accent); }
.seg__btn { position: relative; }
.seg__dot { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; }
.seg__dot--val { background: #c98a1e; } .seg__dot--test { background: var(--accent); }
.hero__art { display: grid; place-items: center; min-height: 240px; }
#hero-team { transform: translateY(-27px); }   /* nudge the group up */
.hero__sprite { width: clamp(180px, 26vw, 300px); height: auto; filter: var(--ds-sprite);
  animation: float 4.5s var(--ease-soft) infinite; }
@keyframes float { 0%,100% { transform: translateY(-3%); } 50% { transform: translateY(3%); } }

/* ── Filters ───────────────────────────────────────────────────────────── */
.filters { position: sticky; top: 55px; z-index: var(--z-nav);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 14px 0 12px; margin-bottom: 6px; border-bottom: 1px solid var(--hairline); }
.filters__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters__types { margin-bottom: 11px; }
.spacer { flex: 1; }

.tfilter { --tc: var(--ink-3);
  border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--ink-2);
  border-radius: var(--r-pill); padding: 6px 13px 6px 10px; font-size: 0.82rem; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; text-transform: capitalize;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast), background var(--t-fast), color var(--t-fast); }
.tfilter .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--tc); }
.tfilter:hover { border-color: var(--ink-3); }
.tfilter.is-on { background: color-mix(in srgb, var(--tc) 16%, white); border-color: color-mix(in srgb, var(--tc) 55%, white);
  color: color-mix(in srgb, var(--tc) 62%, #111); font-weight: 600; }

.seg { display: inline-flex; background: color-mix(in srgb, var(--ink) 5%, transparent); border-radius: var(--r-pill); padding: 3px; }
.seg__btn { border: 0; background: none; cursor: pointer; color: var(--ink-2); padding: 5px 11px; border-radius: var(--r-pill);
  font-family: var(--mono); font-size: 0.76rem; font-weight: 600; transition: all var(--t-fast); }
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

.check { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 0.85rem; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.select select { background: var(--surface); border: 1px solid var(--hairline-strong); color: var(--ink-2);
  border-radius: var(--r-pill); padding: 6px 14px; font-size: 0.82rem; cursor: pointer; font-weight: 500; }
.select select:hover { border-color: var(--ink-3); }

.resultbar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  color: var(--ink-3); font-size: 0.84rem; padding: 16px 2px 16px; }
#result-count b { color: var(--ink); font-weight: 600; }

/* ── Gallery ───────────────────────────────────────────────────────────── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: clamp(14px, 1.6vw, 20px); }
.gallery__sentinel { height: 1px; }

.card { --tc: var(--ink-3);
  position: relative; border: 1px solid var(--hairline); border-radius: var(--r-lg);
  background: var(--surface); padding: 16px 16px 18px; cursor: pointer; overflow: hidden;
  transition: transform var(--t) var(--ease), box-shadow var(--t), border-color var(--t-fast);
  /* skip rendering off-screen cards (and their animated GIFs) while scrolling */
  content-visibility: auto; contain-intrinsic-size: auto 263px; }
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-card); border-color: var(--hairline-strong); }
.card__top { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); }
.card__verdict { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; font-size: 0.6rem; font-weight: 700; }
.card__verdict[data-v="exact"]   { background: #e3f7ea; color: #1a8c45; }
.card__verdict[data-v="partial"] { background: #fff3df; color: #b76e00; }
.card__verdict[data-v="miss"]    { background: #fdeceb; color: #c4382f; }
/* trained-on Pokémon: the model already saw the answer, so the verdict is recall,
   not a guess — de-emphasise it so it never reads as a real prediction. */
.card__verdict[data-split="train"] { opacity: 0.4; }
.card__flags { display: inline-flex; align-items: center; gap: 5px; }
.card__split { font-family: var(--mono); font-size: 0.54rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 5px; border-radius: 5px; line-height: 1; }
.card__split--val  { background: #fbf0da; color: #9a6a14; }
.card__split--test { background: var(--accent-soft); color: var(--accent-press); }
.card__imgwrap { aspect-ratio: 1; display: grid; place-items: center; margin: 6px 0 10px; }
.card__sprite { max-width: 84%; max-height: 84%; object-fit: contain; transition: transform var(--t) var(--ease); }
.card:hover .card__sprite { transform: scale(1.08); }
.card__name { font-weight: 600; font-size: 1.02rem; letter-spacing: -0.02em; text-transform: capitalize;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__types { display: flex; gap: 5px; margin-top: 8px; flex-wrap: nowrap; justify-content: center; }
/* compact card chips (no dot) so even two long type names fit on one line w/o clipping */
.card__types .chip { font-size: 0.68rem; padding: 3px 8px; white-space: nowrap; }
.card__types .chip .swatch { display: none; }

/* type chip — readable on light */
.chip { --tc: var(--ink-3);
  display: inline-flex; align-items: center; gap: 5px; text-transform: capitalize;
  background: color-mix(in srgb, var(--tc) 15%, white);
  color: color-mix(in srgb, var(--tc) 66%, #141414);
  border: 1px solid color-mix(in srgb, var(--tc) 28%, white);
  border-radius: var(--r-pill); padding: 3px 10px; font-size: 0.74rem; font-weight: 600; }
.chip .swatch { width: 7px; height: 7px; border-radius: 50%; background: var(--tc); }
.chip--lg { font-size: 0.85rem; padding: 5px 13px; }

/* ── Detail overlay ────────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: clamp(12px, 3vw, 44px); }
.overlay[hidden] { display: none; }
.overlay__scrim { position: absolute; inset: 0; background: rgba(20,20,22,0.32); backdrop-filter: blur(6px); }
.detail { position: relative; width: min(960px, 100%); max-height: 90dvh; overflow: hidden;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); }
@media (max-height: 700px), (max-width: 760px) { .detail { overflow-y: auto; } }
.detail__close { position: absolute; top: 16px; right: 16px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink-2); cursor: pointer;
  font-size: 1rem; display: grid; place-items: center; transition: all var(--t-fast); }
.detail__close:hover { background: color-mix(in srgb, var(--ink) 11%, transparent); color: var(--ink); }
.detail__grid { display: grid; grid-template-columns: 0.92fr 1.08fr; gap: clamp(18px, 2.4vw, 34px); padding: clamp(20px, 2.6vw, 32px); }
@media (max-width: 760px) { .detail__grid { grid-template-columns: 1fr; } }

.detail__hero { display: flex; flex-direction: column; }
.detail__dex { font-family: var(--mono); color: var(--ink-3); font-size: 0.82rem; }
.detail__name { font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 600; letter-spacing: -0.035em; text-transform: capitalize; line-height: 1.03; margin-top: 1px; filter: url(#pixelate); }
.detail__genus { color: var(--ink-2); font-size: 0.9rem; margin-top: 2px; }
.detail__stage { position: relative; flex: 1; min-height: 300px; display: grid; place-items: center; margin: 6px 0 4px; }
.stage-loading { position: absolute; inset: 0; display: grid; place-items: center; gap: 10px; grid-auto-flow: row;
  background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(2px); z-index: 3;
  color: var(--ink-3); font-size: 0.82rem; }
.detail__sprite { position: relative; max-width: 200%; max-height: 1000px; object-fit: contain; filter: var(--ds-sprite); animation: float 4.5s var(--ease-soft) infinite; }
.detail__sprite.sprite-anim { max-height: 800px; }   /* pixel gifs: keep ~2x crisp */
.detail__sprite.is-cam { animation: none; image-rendering: auto; }
.detail__truth { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.detail__truth .label { font-size: 0.72rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.camrow { display: flex; gap: 8px; margin-top: 12px; }
.camrow .btn { flex: 1; padding: 8px 14px; font-size: 0.85rem; }
.detail__meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--ink-3); margin-top: 10px; }
.detail__meta b { color: var(--ink); font-weight: 600; }

.detail__read { display: flex; flex-direction: column; gap: 15px; }

/* split tag on the dex line + explainer banner above the prediction */
.split-inline { font-weight: 700; }
.split-inline--train { color: var(--ink-3); }
.split-inline--val { color: #9a6a14; }
.split-inline--test { color: var(--accent-press); }
.splitbanner { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px;
  padding: 10px 13px; border-radius: var(--r-sm); border-left: 3px solid var(--ink-3);
  background: color-mix(in srgb, var(--ink) 4%, transparent); }
.splitbanner__tag { font-weight: 600; font-size: 0.82rem; }
.splitbanner__note { font-size: 0.78rem; color: var(--ink-2); line-height: 1.42; }
.splitbanner--train { border-left-color: #3a3a3c; }
.splitbanner--val { border-left-color: #c98a1e; background: color-mix(in srgb, #c98a1e 9%, transparent); }
.splitbanner--val .splitbanner__tag { color: #9a6a14; }
.splitbanner--test { border-left-color: var(--accent); background: var(--accent-soft); }
.splitbanner--test .splitbanner__tag { color: var(--accent-press); }
.block__title { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 9px; }

.verdict { display: inline-flex; align-items: center; gap: 8px; border-radius: var(--r-pill); padding: 6px 14px; font-weight: 600; font-size: 0.88rem; margin-bottom: 14px; }
.verdict[data-v="exact"]   { background: #e3f7ea; color: #1a8c45; }
.verdict[data-v="partial"] { background: #fff3df; color: #b76e00; }
.verdict[data-v="miss"]    { background: #fdeceb; color: #c4382f; }

/* probability bars */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 92px 1fr 42px; align-items: center; gap: 10px; }
.bar__label { font-size: 0.82rem; font-weight: 500; text-transform: capitalize; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.bar__label .swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--tc); flex-shrink: 0; }
.bar__track { height: 8px; background: #ececf0; overflow: hidden; }
.bar__fill { height: 100%; width: 0; background: var(--tc); }
.bar__val { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); text-align: right; }
.bar.is-pred .bar__label, .bar.is-pred .bar__val { color: var(--ink); font-weight: 600; }

/* modality meter — single accent (Apple) */
.mods { display: flex; flex-direction: column; gap: 8px; }
.mod { display: grid; grid-template-columns: 124px 1fr 42px; align-items: center; gap: 10px; }
.mod__name { font-size: 0.82rem; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.mod__ico { width: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.micon { width: 14px; height: 14px; display: block; }
.mod__track { height: 8px; background: #ececf0; overflow: hidden; }
.mod__fill { height: 100%; width: 0; background: var(--accent); }
.mod__val { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-2); text-align: right; }
.mods__cap { color: var(--ink-3); font-size: 0.8rem; margin-top: 9px; line-height: 1.45; }
.mods__cap b { color: var(--ink); font-weight: 600; text-transform: capitalize; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px 20px; }
.stat { display: grid; grid-template-columns: 34px 1fr 30px; align-items: center; gap: 8px; }
.stat__k { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-3); text-transform: uppercase; }
.stat__track { height: 6px; background: #ececf0; overflow: hidden; }
.stat__fill { height: 100%; width: 0; background: var(--ink-3); }
.stat__v { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-2); text-align: right; }
.detail__flavor { color: var(--ink-2); font-size: 0.9rem; line-height: 1.55; max-width: 62ch;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn { border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--ink); cursor: pointer;
  border-radius: var(--r-pill); padding: 9px 18px; font-weight: 500; font-size: 0.9rem;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast); }
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn--primary:hover { background: var(--accent-press); border-color: transparent; }
.btn--ghost { background: color-mix(in srgb, var(--ink) 5%, transparent); border-color: transparent; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.is-on { background: var(--accent); color: #fff; border-color: transparent; }

/* ── Upload / Game ─────────────────────────────────────────────────────── */
.upload, .game { max-width: 720px; margin: 0 auto; padding-top: clamp(36px, 7vw, 76px); }
.upload { margin-top: -45px; }   /* pull the Fakemon page content up */
.upload__head h2, .game__head h2 { font-size: clamp(2rem, 4.4vw, 2.9rem); font-weight: 600; letter-spacing: -0.03em; }
.upload__head p, .game__head p { color: var(--ink-2); margin-top: 10px; max-width: 54ch; font-size: 1.08rem; }
.dropzone { margin-top: 26px; border: 1.5px dashed var(--hairline-strong); border-radius: var(--r-xl); padding: clamp(34px, 7vw, 68px);
  text-align: center; cursor: pointer; transition: all var(--t) var(--ease); background: var(--surface); }
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone__icon { font-size: 2.2rem; color: var(--accent); }
.dropzone__title { font-weight: 600; margin-top: 12px; }
.dropzone__hint { color: var(--ink-3); font-size: 0.88rem; margin-top: 4px; }
.ta { width: 100%; margin-top: 14px; background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: var(--r); padding: 12px 15px; resize: vertical; font-size: 0.92rem; outline: 0; }
.ta:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.upload__result { margin-top: 28px; }

/* Guess-Off — fits one screen, no scroll; you vs the model */
.view--game.is-active { display: grid; }
.view--game { min-height: calc(100dvh - 56px); place-items: center; margin-bottom: -120px; } /* cancel .stage bottom padding */
@media (max-height: 640px) { .view--game { min-height: auto; padding: 24px 0 40px; margin-bottom: -120px; } }
.game { max-width: 880px; width: 100%; margin: 0 auto; padding: 0 16px; text-align: center; }
.game__head h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
.game__head p { font-size: 0.98rem; margin-top: 6px; max-width: 52ch; margin-inline: auto; }
.game__score { margin-top: 12px; display: inline-flex; gap: 16px; font-size: 0.95rem; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-pill); padding: 8px 20px; }
.game__score b { color: var(--ink); font-weight: 700; }
.game__score .you b { color: var(--accent); }
.game__score .mod b { color: #6e6e73; }
.game__stage { margin-top: 18px; }

.gpanel { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-xl); padding: 24px clamp(20px,3vw,32px); box-shadow: var(--shadow-card); }
@media (max-width: 680px) { .gpanel { grid-template-columns: 1fr; text-align: center; } }
/* uniform pixel zoom: img width is naturalWidth × constant (set in JS), so every
   creature's pixels are the same size — never rescaled to fill a box */
.gpanel__sprite { display: grid; place-items: center; min-height: 200px; }
.gpanel__sprite img { image-rendering: -webkit-optimize-contrast; image-rendering: pixelated; filter: var(--ds-sprite); }
.gpick__label { font-size: 0.84rem; color: var(--ink-2); font-weight: 500; margin-bottom: 12px; }
.gpick__label b { color: var(--ink); font-weight: 700; }
.gpick__label .count { font-family: var(--mono); color: var(--ink-3); margin-left: 4px; }
.gpick__grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
@media (max-width: 540px) { .gpick__grid { grid-template-columns: repeat(3, 1fr); } }
.gpick { --tc: var(--ink-3); cursor: pointer; border: 1.5px solid var(--hairline-strong); background: var(--surface);
  border-radius: var(--r-sm); padding: 10px 6px; font-size: 0.78rem; font-weight: 600; text-transform: capitalize; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: transform var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast); }
.gpick .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--tc); transition: background var(--t-fast); }
.gpick:hover { border-color: var(--tc); transform: translateY(-2px); }
.gpick.is-on { background: var(--tc); border-color: var(--tc); color: #fff; transform: translateY(-2px);
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--tc) 75%, transparent); }
.gpick.is-on .swatch { background: #fff; }
.gpick:disabled { opacity: 0.45; cursor: default; transform: none; }

/* reveal scoreboard */
.greveal { display: grid; gap: 10px; }
.grow { display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: 12px; padding: 8px 0; }
.grow + .grow { border-top: 1px solid var(--hairline); }
.grow__who { font-weight: 600; font-size: 0.86rem; color: var(--ink-2); }
.grow__chips { display: flex; gap: 6px; flex-wrap: wrap; }
.grow__mark { font-size: 1.1rem; }
.gverdict { font-weight: 700; font-size: 1.05rem; margin-top: 4px; }
.game__controls { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ── Toast / loading / empty ───────────────────────────────────────────── */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; border-radius: var(--r-pill); padding: 11px 22px; font-size: 0.86rem; font-weight: 500;
  z-index: var(--z-toast); opacity: 0; transition: all var(--t) var(--ease); box-shadow: var(--shadow-pop); }
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--hairline); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inline { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 0.88rem; }
.empty { text-align: center; padding: 90px 20px; color: var(--ink-3); }
.empty__mark { font-size: 2.6rem; opacity: 0.5; }
.empty p { margin: 12px 0 18px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .topbar__inner { flex-wrap: wrap; }
  .scan { order: 3; max-width: none; flex-basis: 100%; }
  .hero { grid-template-columns: 1fr; text-align: left; }
  .hero__art { display: none; }
  .filters { top: 102px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .detail__sprite, .hero__sprite { animation: none !important; }
}

/* ════════════════════════════════════════════════════════════════════════════
   THE SCIENCE — interactive model/training/eval showcase. Reuses every token
   from the design system; one accent, hairlines, mono numerals, type colour as
   the only "product" colour. Reads like a quiet research write-up.
   ════════════════════════════════════════════════════════════════════════════ */
.view--science { padding-bottom: 40px; }
.sci { max-width: 940px; margin: 0 auto; }
.sci__loading { display: grid; place-items: center; min-height: 60vh; }

/* hero */
.sci-hero { padding: clamp(32px, 6vw, 72px) 0 clamp(20px, 3vw, 34px); }
.sci-hero__tag { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent); font-weight: 600; }
.sci-hero__title { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 600; letter-spacing: -0.04em; margin-top: 10px; }
.sci-hero__sub { color: var(--ink-2); max-width: 64ch; margin-top: 16px; font-size: clamp(1.02rem, 1.5vw, 1.2rem); line-height: 1.5; }
.sci-hero__sub b { color: var(--ink); font-weight: 600; }
.sci-hero__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 30px; }
.sci-stat { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-card); }
.sci-stat__v { font-family: var(--mono); font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.sci-stat__k { font-size: 0.84rem; color: var(--ink-2); font-weight: 600; margin-top: 3px; }
.sci-stat__sub { font-size: 0.72rem; color: var(--ink-3); margin-top: 1px; }

/* sticky in-tab section nav */
.sci-nav { position: sticky; top: 55px; z-index: var(--z-nav); display: flex; gap: 2px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 10px 0; margin: 8px 0 8px; border-bottom: 1px solid var(--hairline); }
.sci-nav a { color: var(--ink-2); font-size: 0.82rem; font-weight: 500; padding: 5px 11px; border-radius: var(--r-pill);
  transition: color var(--t-fast), background var(--t-fast); white-space: nowrap; }
.sci-nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.sci-nav a.is-on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* sections */
.sci-sec { padding: clamp(30px, 5vw, 52px) 0; border-bottom: 1px solid var(--hairline); scroll-margin-top: 110px; }
.sci-sec:last-of-type { border-bottom: 0; }
.sci-sec__title { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; letter-spacing: -0.03em; margin-bottom: 16px; }
.sci-lead { color: var(--ink-2); font-size: 1.04rem; line-height: 1.6; max-width: 72ch; }
.sci-lead b { color: var(--ink); font-weight: 600; }
.sci-lead em { font-style: italic; color: var(--ink); }
.sci-note { color: var(--ink-3); font-size: 0.9rem; line-height: 1.55; margin-top: 18px; max-width: 72ch;
  border-left: 2px solid var(--hairline-strong); padding-left: 14px; }
.sci-note b { color: var(--ink-2); }
.sci-note--lim { border-left-color: var(--accent); }
.sci-token { font-family: var(--mono); font-size: 0.85em; background: var(--accent-soft); color: var(--accent-press);
  padding: 1px 6px; border-radius: 5px; font-weight: 600; }

/* cards / tiles / metrics */
.sci-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: clamp(16px, 2vw, 22px); margin-top: 20px; box-shadow: var(--shadow-card); }
.sci-card__head { margin-bottom: 8px; }
.sci-card__head h3 { font-size: 1.04rem; font-weight: 600; letter-spacing: -0.02em; }
.sci-card__head p { color: var(--ink-2); font-size: 0.9rem; line-height: 1.5; margin-top: 5px; max-width: 70ch; }
.sci-card__head p b { color: var(--ink); font-weight: 600; }
.sci-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; align-items: start; }
.sci-2col .sci-card { margin-top: 0; }
@media (max-width: 760px) { .sci-2col { grid-template-columns: 1fr; } }

.sci-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 22px; }
.sci-tile { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r); padding: 16px; text-align: center; }
.sci-tile__v { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.sci-tile__k { font-size: 0.84rem; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.sci-tile__s { font-size: 0.72rem; color: var(--ink-3); margin-top: 3px; line-height: 1.4; }
.sci-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.sci-metric { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-card); }
.sci-metric__v { font-family: var(--mono); font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.sci-metric__k { font-size: 0.88rem; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.sci-metric__s { font-size: 0.74rem; color: var(--ink-3); margin-top: 4px; line-height: 1.4; }
@media (max-width: 680px) { .sci-tiles, .sci-metrics, .sci-hero__stats { grid-template-columns: repeat(2, 1fr); } }

/* overview "show" panel */
.sci-show { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: center; margin-top: 22px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-card); }
@media (max-width: 620px) { .sci-show { grid-template-columns: 1fr; text-align: center; } }
.sci-show__mon { display: grid; place-items: center; min-height: 170px; }
.sci-show__mon img { image-rendering: -webkit-optimize-contrast; image-rendering: pixelated; filter: var(--ds-sprite); }
.sci-show__name { font-size: 1.3rem; font-weight: 600; text-transform: capitalize; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sci-show__truth { display: inline-flex; gap: 5px; }
.sci-show__body p { color: var(--ink-2); font-size: 0.94rem; line-height: 1.55; margin: 8px 0; }
.sci-show__body b { color: var(--ink); }

/* architecture diagram */
.arch { display: grid; grid-template-columns: 1.3fr 56px 1fr; gap: 0; align-items: stretch; margin-top: 24px; }
@media (max-width: 720px) { .arch { grid-template-columns: 1fr; } .arch__flow { display: none; } }
.arch__mods { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.arch__mod { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--hairline);
  border-left: 3px solid var(--tc); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow-card); }
.arch__mod-ico { width: 22px; height: 22px; color: var(--tc); flex-shrink: 0; margin-top: 2px; }
.arch__mod-ico .micon { width: 18px; height: 18px; }
.arch__mod-name { font-weight: 600; font-size: 0.95rem; }
.arch__mod-sig { font-size: 0.78rem; color: var(--ink-2); margin-top: 1px; line-height: 1.35; }
.arch__mod-enc { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); margin-top: 5px; }
.arch__flow svg { width: 100%; height: 100%; }
.arch__flow path { fill: none; stroke: var(--hairline-strong); stroke-width: 1.4; }
.arch__fuse { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; text-align: center; }
.arch__token { background: var(--accent); color: #fff; font-family: var(--mono); font-weight: 600; font-size: 0.82rem;
  padding: 9px 16px; border-radius: var(--r-pill); box-shadow: 0 8px 20px -8px var(--accent); }
.arch__fuse-desc { font-size: 0.78rem; color: var(--ink-2); line-height: 1.35; }
.arch__arrow { color: var(--ink-3); font-size: 1rem; line-height: 0.7; }
.arch__head, .arch__out { font-size: 0.8rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 7px 14px; line-height: 1.35; }
.arch__result { font-size: 0.85rem; font-weight: 600; color: var(--ink); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, white); border-radius: var(--r-sm); padding: 9px 16px; line-height: 1.35; }
.arch__result span { font-weight: 500; color: var(--accent-press); font-size: 0.78rem; }

/* generic chart host */
.chart { width: 100%; margin-top: 6px; position: relative; overflow-x: clip; }
.chart--lg { min-height: 320px; }
.plot { width: 100%; height: auto; display: block; overflow: visible; }
.plot__grid { stroke: var(--hairline); stroke-width: 1; }
.plot__refline { stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: 0.7; }
.plot__bartrack { fill: #ececf0; }
.plot__tick { font-family: var(--mono); font-size: 10px; fill: var(--ink-3); text-anchor: middle; }
.plot__tick--r { text-anchor: end; }
.plot__tick--l { text-anchor: start; }
.plot__tick--bold { fill: var(--ink); font-weight: 700; }
.plot__axis { font-size: 10px; fill: var(--ink-3); text-anchor: middle; text-transform: uppercase; letter-spacing: 0.08em; }
.plot__val { font-family: var(--mono); font-size: 10px; fill: var(--ink-2); text-anchor: start; font-weight: 600; }
.plot__crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.plot__dot { stroke: #fff; stroke-width: 1.5; }
.plot__tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: var(--r-sm);
  padding: 9px 12px; font-size: 0.76rem; box-shadow: var(--shadow-pop); min-width: 132px; transition: opacity 0.12s; }
.plot__tip-h { font-family: var(--mono); font-size: 0.68rem; opacity: 0.7; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.plot__tip-r { display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.plot__tip-r .sw { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.plot__tip-r b { margin-left: auto; font-family: var(--mono); }
.plot__legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; justify-content: center; }
.plot__leg { border: 1px solid var(--hairline-strong); background: var(--surface); border-radius: var(--r-pill);
  padding: 5px 12px; font-size: 0.78rem; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: all var(--t-fast); }
.plot__leg .sw { width: 11px; height: 11px; border-radius: 3px; }
.plot__leg:hover { border-color: var(--ink-3); }
.plot__leg.is-off { opacity: 0.4; }
.plot__leg.is-off .sw { background: var(--ink-3) !important; }

/* the split */
.split-bar { display: flex; gap: 4px; margin-top: 24px; height: 76px; border-radius: var(--r); overflow: hidden; }
.split-bar__seg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #fff; min-width: 70px; }
.split-bar__seg span { font-size: 0.78rem; font-weight: 600; opacity: 0.95; }
.split-bar__seg b { font-family: var(--mono); font-size: 1.2rem; }
.split-bar__seg--train { background: #3a3a3c; }
.split-bar__seg--val { background: #c98a1e; }
.split-bar__seg--test { background: var(--accent); }
.split-gens { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin-top: 10px; }
@media (max-width: 620px) { .split-gens { grid-template-columns: repeat(3, 1fr); } }
.split-gen { border: 1px solid var(--hairline); border-top: 3px solid var(--ink-3); border-radius: var(--r-sm);
  padding: 8px 4px; text-align: center; background: var(--surface); }
.split-gen--train { border-top-color: #3a3a3c; }
.split-gen--val { border-top-color: #c98a1e; }
.split-gen--test { border-top-color: var(--accent); background: var(--accent-soft); }
.split-gen__g { font-weight: 600; font-size: 0.82rem; }
.split-gen__r { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); margin-top: 2px; }
.split-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; font-size: 0.84rem; color: var(--ink-2); }
.split-legend .dot, .abl-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.dot--train { background: #3a3a3c; } .dot--val { background: #c98a1e; } .dot--test { background: var(--accent); }

/* image figures */
.sci-imgrow { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
@media (max-width: 760px) { .sci-imgrow { grid-template-columns: 1fr; } }
.sci-fig { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-card); margin: 0; }
.sci-fig--pad img { padding: 6px; }
.sci-fig img { width: 100%; border-radius: var(--r-sm); display: block; }
.sci-fig figcaption { font-size: 0.8rem; color: var(--ink-3); line-height: 1.45; margin-top: 10px; }
.sci-fig figcaption em { color: var(--ink-2); font-style: italic; }

/* ablation legend */
.abl-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; font-size: 0.82rem; color: var(--ink-2); }

/* HPO callout */
.sci-callout { display: grid; grid-template-columns: 40px 1fr; gap: 16px; margin-top: 22px;
  background: linear-gradient(180deg, var(--accent-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 22%, white);
  border-radius: var(--r-lg); padding: 22px; }
.sci-callout__mark { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.sci-callout h3 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; }
.sci-callout h3 em { color: var(--accent-press); font-style: italic; }
.sci-callout p { color: var(--ink-2); font-size: 0.94rem; line-height: 1.55; margin-top: 8px; max-width: 72ch; }
.sci-callout p b { color: var(--ink); font-weight: 600; }
.hpo-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
@media (max-width: 620px) { .hpo-compare { grid-template-columns: 1fr; } }
.hpo-cmp { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r); padding: 14px 16px; }
.hpo-cmp__label { font-size: 0.78rem; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.hpo-cmp__row { display: grid; grid-template-columns: 52px 1fr 64px; align-items: center; gap: 8px; margin-top: 6px; }
.hpo-cmp__who { font-size: 0.74rem; color: var(--ink-3); }
.hpo-cmp__track { height: 8px; background: #ececf0; border-radius: 4px; overflow: hidden; }
.hpo-cmp__fill { height: 100%; border-radius: 4px; }
.hpo-cmp__row b { font-family: var(--mono); font-size: 0.78rem; text-align: right; }

/* takeaways */
.sci-take { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 680px) { .sci-take { grid-template-columns: 1fr; } }
.sci-take__card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  border-top: 3px solid var(--accent); padding: 18px 20px; box-shadow: var(--shadow-card); }
.sci-take__card h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.02em; }
.sci-take__card p { color: var(--ink-2); font-size: 0.9rem; line-height: 1.55; margin-top: 7px; }
.sci-take__card b { color: var(--ink); font-weight: 600; }

/* the math */
.sci-math { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
@media (max-width: 760px) { .sci-math { grid-template-columns: 1fr; } }
.mathblock { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-card); min-width: 0; }
.mathblock__h { font-weight: 600; font-size: 0.96rem; letter-spacing: -0.01em; }
.mathblock__eq { margin: 14px 0; padding: 14px 10px; background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); overflow-x: auto; overflow-y: hidden; text-align: center; min-height: 30px; max-width: 100%; }
.mathblock__eq code { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); white-space: pre-wrap; }
.mathblock__eq .katex { font-size: 1.05em; color: var(--ink); }
.mathblock__b { color: var(--ink-2); font-size: 0.88rem; line-height: 1.55; }
.mathblock__b b { color: var(--ink); font-weight: 600; } .mathblock__b em { font-style: italic; color: var(--ink); }

/* footer */
.sci-foot { padding: 30px 0 10px; color: var(--ink-3); font-size: 0.84rem; line-height: 1.6; }
.sci-foot code { font-family: var(--mono); font-size: 0.82em; background: var(--surface-2); border: 1px solid var(--hairline);
  padding: 1px 5px; border-radius: 5px; color: var(--ink-2); }
.sci-foot__seed { font-family: var(--mono); font-size: 0.74rem; margin-top: 8px; opacity: 0.8; }

@media (max-width: 760px) { .sci-nav { top: 102px; } }
