:root {
  --bg: #ffffff;
  --soft: #f6f8fb;
  --card: #ffffff;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e3e8ef;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --hi: #7c3aed;
  --mid: #e0533d;
  --lo: #0e9f6e;
  --best: rgba(37, 99, 235, 0.16);
  --second: rgba(37, 99, 235, 0.07);
  --yes: #16a34a;
  --no: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --fig-bg: #ffffff;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0d1117;
  --soft: #141a22;
  --card: #161c25;
  --ink: #e8eef5;
  --text: #c3ccd6;
  --muted: #8b96a3;
  --line: #263040;
  --accent: #7aa8ff;
  --accent-soft: rgba(122, 168, 255, 0.12);
  --hi: #b79cff;
  --mid: #ff8d7a;
  --lo: #4fd1a0;
  --best: rgba(122, 168, 255, 0.24);
  --second: rgba(122, 168, 255, 0.10);
  --yes: #4ade80;
  --no: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --fig-bg: #f4f6f9;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
b, strong { color: var(--ink); font-weight: 600; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 20px; height: 56px; }
.nav-brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.3px;
  background: linear-gradient(90deg, #2563eb, #e0533d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav-brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); background: var(--soft); text-decoration: none; }
.theme-toggle {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle svg { width: 17px; height: 17px; }
.i-moon { fill: currentColor; }
.i-sun { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.i-sun circle { fill: currentColor; stroke: none; }
[data-theme="dark"] .i-moon, [data-theme="light"] .i-sun { display: none; }

/* hero */
.hero {
  text-align: center;
  padding: 64px 0 40px;
  background:
    radial-gradient(ellipse 55% 80% at 12% 0%, rgba(37, 99, 235, 0.13), transparent 70%),
    radial-gradient(ellipse 55% 80% at 88% 0%, rgba(224, 83, 61, 0.11), transparent 70%);
}
.eyebrow {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  margin-bottom: 20px;
}
h1 {
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.18;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: -.8px;
  max-width: 900px;
  margin: 0 auto 22px;
}
.brand {
  font-weight: 800;
  background: linear-gradient(90deg, #2563eb, #e0533d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 22px;
  font-size: 18px;
  color: var(--ink);
}
.affil {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
}
.affil img { width: 22px; height: 22px; border-radius: 50%; background: #fff; }

.buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.btn svg { width: 17px; height: 17px; fill: currentColor; }
.btn em { font-style: normal; font-weight: 500; font-size: 11.5px; opacity: .75; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; }
.btn.disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
a.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }

/* figures */
.fig { margin: 22px 0 6px; }
.fig img {
  width: 100%;
  display: block;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--fig-bg);
  box-shadow: var(--shadow);
}
.fig figcaption { font-size: 14.5px; color: var(--muted); margin-top: 12px; line-height: 1.6; }
.fig figcaption strong { color: var(--text); }
.teaser { margin-top: 10px; }

/* stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 38px 0 0;
}
.stats div {
  padding: 20px 16px 18px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}
.stats b {
  display: block;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.8px;
  line-height: 1.2;
  margin-bottom: 4px;
  background: linear-gradient(90deg, var(--accent), var(--mid));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stats span { font-size: 13.5px; color: var(--muted); line-height: 1.45; display: block; }

/* sections */
section { margin-top: 64px; }
h2 {
  font-size: 28px;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: -.5px;
  margin-bottom: 16px;
}
h3 { font-size: 17px; color: var(--ink); font-weight: 650; line-height: 1.35; }
h3.sub { font-size: 19px; margin: 40px 0 12px; }
h4 { font-size: 14.5px; color: var(--ink); font-weight: 650; margin-bottom: 14px; }
section > p + p { margin-top: 12px; }
.lead { font-size: 17px; line-height: 1.8; }
.caption { font-size: 13.5px; color: var(--muted); margin-top: 10px; line-height: 1.55; }
.note {
  margin-top: 22px;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  font-size: 15px;
}

/* cards */
.cards { display: grid; gap: 14px; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards article {
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}
.cards p { font-size: 14.5px; margin-top: 6px; }
.cards.compact { margin-bottom: 18px; }
.num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

/* levels */
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 28px; }
.levels article {
  --c: var(--accent);
  position: relative;
  padding: 22px 20px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.levels article::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); }
.levels .lv-hi { --c: var(--hi); }
.levels .lv-mid { --c: var(--mid); }
.levels .lv-lo { --c: var(--lo); }
.levels p { font-size: 14.5px; margin-top: 8px; }
.levels ul { margin-top: 10px; padding-left: 0; list-style: none; }
.levels li { position: relative; padding-left: 16px; font-size: 13.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.levels li::before { content: ""; position: absolute; left: 2px; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.lv { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--c); margin-bottom: 4px; }

/* split */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: center; margin-top: 36px; }
.split.top { align-items: start; margin-top: 18px; }
.split .fig { margin: 0; }
.split-text h3 { font-size: 19px; margin-bottom: 10px; }
.split-text p + p { margin-top: 10px; }
.math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", Georgia, serif; font-style: italic; color: var(--ink); white-space: nowrap; }
.eq { text-align: center; font-size: 19px; padding: 10px; margin: 12px 0; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.findings { list-style: none; }
.findings li { position: relative; padding-left: 22px; margin-top: 10px; font-size: 15.5px; }
.findings li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* stages */
.stages { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: s; }
.stages li {
  position: relative;
  padding: 16px;
  border-radius: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.55;
}
.stages li span {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.stages li:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  transform: translateY(-50%) rotate(45deg);
  opacity: .5;
}

/* tables */
.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  margin-top: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: center; white-space: nowrap; }
th { font-size: 12.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; background: var(--soft); border-bottom: 1px solid var(--line); }
td:first-child, th:first-child { text-align: left; padding-left: 18px; }
tbody tr + tr td { border-top: 1px solid var(--line); }
tbody tr.sep td { border-top: 2px solid var(--line); }
tr.ours td { font-weight: 700; color: var(--ink); background: linear-gradient(90deg, var(--accent-soft), transparent); }
td.b1 { background: var(--best) !important; }
td.b2 { background: var(--second) !important; }
td.l { text-align: left; padding-left: 12px; }
td.grp { vertical-align: middle; font-weight: 650; color: var(--ink); border-right: 1px solid var(--line); background: var(--soft); }.checks td.y { color: var(--yes); font-weight: 700; font-size: 16px; }
.checks td.n { color: var(--no); font-weight: 700; font-size: 16px; }
.checks td.u { color: var(--muted); }

/* bars */
.ablations { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.abl {
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(150px, 46%) 1fr 54px; align-items: center; gap: 10px; font-size: 13.5px; }
.bar span { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar i { display: block; height: 12px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line); position: relative; overflow: hidden; }
.bar i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--v) * 1%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--muted) 55%, transparent);
}
.bar b { font-weight: 600; font-size: 13.5px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.bar.ours span, .bar.ours b { color: var(--ink); font-weight: 700; }
.bar.ours i::after { background: linear-gradient(90deg, var(--accent), var(--mid)); }
#generalization .bar i::after { background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 50%, var(--mid))); }

/* video placeholder */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  padding: 34px 20px;
  border-radius: 14px;
  border: 1.5px dashed var(--line);
  color: var(--muted);
  background: var(--soft);
}
.placeholder svg { width: 22px; height: 22px; fill: currentColor; opacity: .7; }

/* bibtex */
.bib-head { display: flex; align-items: center; justify-content: space-between; }
.bib-head h2 { margin-bottom: 0; }
.copy {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.copy:hover { border-color: var(--accent); color: var(--accent); }
pre {
  margin-top: 14px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  overflow-x: auto;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
}

.foot { margin-top: 72px; padding: 24px 24px 44px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .levels, .cards.three { grid-template-columns: 1fr; }
  .stages { grid-template-columns: 1fr 1fr; }
  .stages li::after { display: none; }
  .split, .ablations { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-inner { justify-content: space-between; }
  .hero { padding-top: 44px; }
  .authors { font-size: 16.5px; gap: 2px 16px; }
  .stats b { font-size: 26px; }
  .stages { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 128px 1fr 46px; font-size: 12.5px; }
  section { margin-top: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
