:root {
  --bg: #ffffff;
  --ink: #142030;
  --muted: #5a6779;
  --line: #e0dcf3;
  --tint-25: #f8f7fd;
  --tint-50: #f1effb;
  --tint-100: #e6e2f8;
  --tint-200: #c9c0ee;
  --accent-500: #5b4bc4;
  --accent-700: #3d2f9a;
  --link: #4433b0;
  --link-hover: #2b1f7a;
  --green-500: #2b9c70;
  --amber-500: #b5761f;
  --ours-bg: #efecfb;
  --shadow: 0 24px 70px rgba(61, 47, 154, 0.12);
  --radius: 10px;
  --maxw: 1120px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }

sup { font-size: 0.72em; line-height: 0; vertical-align: super; }

img { display: block; max-width: 100%; height: auto; }

.container { width: min(var(--maxw), calc(100% - 36px)); margin: 0 auto; }

/* ---------- Hero ---------- */
.hero { padding: 62px 0 20px; }

.hero-inner { width: min(1060px, calc(100% - 36px)); margin: 0 auto; text-align: center; }

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--accent-700);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 6px;
  background: var(--accent-700);
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

h1, h2, h3, p { overflow-wrap: anywhere; }

h1 {
  max-width: 1000px;
  margin: 0 auto;
  font-size: clamp(1.9rem, 4vw, 3.1rem);
  line-height: 1.14;
  font-weight: 800;
  text-wrap: balance;
}

h1 span { color: var(--accent-700); }

.subtitle {
  max-width: 820px;
  margin: 18px auto 0;
  color: #334155;
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.55;
  text-wrap: balance;
}

.venue-line { margin: 18px auto 0; }

.venue-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid var(--tint-200);
  border-radius: 999px;
  background: var(--tint-50);
  color: var(--accent-700);
  font-size: 0.86rem;
  font-weight: 800;
}

.venue-badge::before {
  width: 7px; height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green-500);
  content: "";
}

.venue-badge:hover { border-color: var(--accent-500); text-decoration: none; }

.authors { max-width: 940px; margin: 24px auto 0; color: #243047; line-height: 1.75; }
.authors p { margin: 0; }

.author-list { font-size: 1.03rem; font-weight: 500; }
.author-line { display: block; }

.author-list a {
  text-decoration: underline;
  text-decoration-color: rgba(68, 51, 176, 0.35);
  text-underline-offset: 3px;
}
.author-list a:hover { background: var(--tint-50); border-radius: 4px; text-decoration-color: currentColor; }
.author-list sup { color: var(--muted); font-weight: 400; }

.affiliations, .notes { color: var(--muted); font-size: 0.86rem; line-height: 1.72; }
.affiliations { margin-top: 12px !important; }
.notes { margin-top: 4px !important; }

.button-row { margin-top: 24px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid var(--tint-200);
  border-radius: 999px;
  background: var(--tint-50);
  color: var(--accent-700);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(91, 75, 196, 0.09);
  transition: background 160ms ease-out, border-color 160ms ease-out, transform 160ms ease-out;
}

.button:hover {
  border-color: var(--accent-500);
  background: var(--tint-100);
  color: var(--accent-700);
  text-decoration: none;
  transform: translateY(-1px);
}

.button-disabled { cursor: not-allowed; color: #6d7b8f; background: #f2f5f7; border-color: #dde5ea; box-shadow: none; }
.button-disabled:hover { transform: none; color: #6d7b8f; background: #f2f5f7; border-color: #dde5ea; }

.button-icon, .button-icon svg { width: 15px; height: 15px; display: inline-flex; flex: 0 0 auto; }
.button-icon svg { fill: currentColor; }

/* ---------- Figures ---------- */
.teaser-section { padding: 18px 0 42px; }

.teaser, .wide-figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.teaser img, .wide-figure img { width: 100%; background: #fff; padding: 14px 14px 0; }
.teaser a, .wide-figure a { display: block; cursor: zoom-in; }

figcaption { padding: 16px 22px 20px; color: var(--muted); font-size: 0.96rem; line-height: 1.55; }
figcaption strong { color: var(--ink); }

.spaced { margin-top: 24px; }

.figure-grid { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 24px; }
.figure-grid.two { grid-template-columns: 1.35fr 1fr; align-items: start; }

/* ---------- Sections ---------- */
.section { padding: 76px 0; }

.section-soft {
  background: linear-gradient(180deg, var(--tint-25), #ffffff);
  border-top: 1px solid rgba(224, 220, 243, 0.75);
  border-bottom: 1px solid rgba(224, 220, 243, 0.75);
}

.text-grid, .split-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.35fr);
  gap: 54px;
  align-items: start;
}

h2 {
  margin: 0;
  font-family: "Noto Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  line-height: 1.14;
  font-weight: 700;
  text-wrap: balance;
}

h3 { margin: 0 0 10px; font-size: 1.12rem; line-height: 1.28; }

.subhead {
  margin: 52px 0 18px;
  font-size: 1.3rem;
  color: var(--accent-700);
}

.prose p { margin: 0 0 18px; color: #334155; font-size: 1.04rem; }

.section-heading { max-width: 780px; margin-bottom: 32px; }

.section-note { max-width: 760px; margin: 14px 0 0; color: var(--muted); font-size: 1.02rem; line-height: 1.6; }
.section-note.narrow { margin: -6px 0 0; }

.claim-grid, .metric-grid, .method-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.method-flow-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.claim-card, .method-flow article, .metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 22px;
  box-shadow: 0 18px 44px rgba(61, 47, 154, 0.07);
}

.claim-index { display: inline-flex; margin-bottom: 16px; color: var(--accent-700); font-weight: 900; }

.claim-card p, .method-flow p { margin: 0; color: var(--muted); font-size: 0.96rem; }

.method-flow article { border-top: 3px solid var(--accent-500); }
.method-flow article h3 { color: var(--accent-700); }

.method-flow:not(.method-flow-4) article:nth-child(2) { border-top-color: var(--amber-500); }
.method-flow:not(.method-flow-4) article:nth-child(2) h3 { color: var(--amber-500); }
.method-flow:not(.method-flow-4) article:nth-child(3) { border-top-color: var(--green-500); }
.method-flow:not(.method-flow-4) article:nth-child(3) h3 { color: var(--green-500); }

.equation-panel {
  margin-top: 22px;
  border: 1px solid var(--tint-200);
  border-radius: var(--radius);
  background: var(--tint-50);
  padding: 18px 20px;
}

.equation-label {
  margin: 0 0 8px;
  color: var(--accent-700);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.equation {
  margin: 0;
  color: #1e2e44;
  font-size: 1.05rem;
  overflow-x: auto;
  overflow-y: hidden;
}

.equation .katex-display { margin: 0.6em 0; }

.equation-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
  align-items: center;
}

.equation-note { margin: 10px 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Results ---------- */
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }

.metric-card strong {
  display: block;
  color: var(--accent-700);
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-card > span { display: block; margin-top: 10px; color: var(--muted); font-weight: 600; font-size: 0.93rem; line-height: 1.4; }

.table-card {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 18px 20px 14px;
  box-shadow: 0 18px 44px rgba(61, 47, 154, 0.06);
  min-width: 0;
}

.table-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.table-title { margin: 0 0 10px; font-weight: 800; font-size: 0.98rem; }
.table-head .table-title { margin: 0; }

.seg { display: inline-flex; border: 1px solid var(--tint-200); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0;
  padding: 5px 14px;
  background: #fff;
  color: var(--accent-700);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.seg button[aria-selected="true"] { background: var(--accent-700); color: #fff; }

.table-scroll { overflow-x: auto; margin-top: 10px; }

table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.results th, table.results td { padding: 7px 10px; text-align: right; border-bottom: 1px solid #edf2f4; }
table.results th:first-child, table.results td:first-child { text-align: left; }
table.results thead th { color: var(--muted); font-weight: 700; font-size: 0.82rem; border-bottom: 1.5px solid var(--line); }
table.results tr.ours td { background: var(--ours-bg); color: var(--accent-700); font-weight: 800; }
table.results tr.group td {
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
}
table.results td.best { font-weight: 800; }

.table-note { margin: 10px 0 0; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }

.table-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

/* ---------- Citation ---------- */
.bibtex-card {
  position: relative;
  border-radius: var(--radius);
  background: #17142b;
  color: #efedfb;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.bibtex-card pre { margin: 0; padding: 60px 22px 22px; overflow-x: auto; font-size: 0.86rem; line-height: 1.55; }
.bibtex-card code { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace; }

.copy-button {
  position: absolute;
  top: 14px; right: 14px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.copy-button:hover { background: rgba(255, 255, 255, 0.18); }

.ack { margin: 22px 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.footer p { margin: 0; max-width: 900px; }
.footer a { color: var(--accent-700); font-weight: 700; white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .method-flow-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-pair, .figure-grid.two, .equation-row { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .hero { padding-top: 44px; }
  .text-grid, .split-panel, .claim-grid, .method-flow, .method-flow-4 { grid-template-columns: 1fr; gap: 18px; }
  .text-grid, .split-panel { gap: 24px; }
  .section { padding: 56px 0; }
  .author-line { display: inline; }
  .footer-inner { flex-direction: column; }
}

@media (max-width: 520px) {
  .container, .hero-inner { width: calc(100% - 32px); }
  .metric-grid { grid-template-columns: 1fr; }
  figcaption { padding: 12px 14px 16px; font-size: 0.92rem; }
  .teaser img, .wide-figure img { padding: 8px 8px 0; }
  .claim-card, .method-flow article, .metric-card, .table-card { padding: 16px; }
  .button-row { gap: 8px 6px; }
  .button { min-height: 38px; padding: 0 12px; font-size: 0.82rem; }
  .equation { font-size: 0.92rem; }
}

/* ---------- MissPath-FM additions ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.tabs button {
  border: 1px solid var(--tint-200); border-radius: 999px; padding: 5px 14px;
  background: #fff; color: var(--accent-700); font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--accent-700); border-color: var(--accent-700); color: #fff; }
table.results td.second { text-decoration: underline; text-underline-offset: 3px; }
table.results tr.ours td.second { font-weight: 800; }
.code-card { margin-top: 22px; border-radius: var(--radius); background: #17142b; color: #efedfb; overflow: hidden; box-shadow: var(--shadow); }
.code-card p { margin: 0; padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: #c9c0ee; }
.code-card pre { margin: 0; padding: 16px 20px; overflow-x: auto; font-size: 0.84rem; line-height: 1.6; }
.code-card code { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace; }
.code-card .c { color: #8f88b8; }
.callout {
  margin-top: 22px; border-left: 4px solid var(--accent-500); border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--tint-50); padding: 14px 18px; color: #2b2747;
}
.callout strong { color: var(--accent-700); }
.split-figure { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: center; margin-top: 22px; }
@media (max-width: 960px) { .split-figure { grid-template-columns: 1fr; } }
table.results td.ours-c { background: var(--ours-bg); color: var(--accent-700); font-weight: 700; }
table.results td.ours-c.best { font-weight: 800; }
table.results th.ours-h { color: var(--accent-700); }
table.results th.grp { text-align: center; color: var(--ink); border-bottom: 1px solid var(--line); }
.claim-grid.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 22px; }
@media (max-width: 760px) { .claim-grid.two-up { grid-template-columns: 1fr; } }
table.results.lead2 th:nth-child(2), table.results.lead2 td:nth-child(2) { text-align: left; }
