:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --card: #f8fafc;
  --card-solid: #ffffff;
  --border: #e5e7eb;
  --ours: #2563eb;
  --hero-from: #f8fafc;
  --hero-to: #ffffff;
  --venue-bg: #eff6ff;
  --venue-border: #dbeafe;
  --btn-bg: #111827;
  --btn-bg-hover: #000000;
  --btn-fg: #ffffff;
  --lead-fg: #374151;
  --footer-bg: #f8fafc;
  --maxw: 1040px;
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --fg: #e6e8eb;
  --muted: #9aa3af;
  --accent: #6ea8ff;
  --accent-dark: #93b8ff;
  --card: #161b22;
  --card-solid: #1b212b;
  --border: #2a313c;
  --ours: #6ea8ff;
  --hero-from: #161b22;
  --hero-to: #0e1116;
  --venue-bg: #16243d;
  --venue-border: #24416e;
  --btn-bg: #e6e8eb;
  --btn-bg-hover: #ffffff;
  --btn-fg: #0e1116;
  --lead-fg: #c4c9d1;
  --footer-bg: #0b0e12;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Hero ---------- */
header.hero {
  text-align: center;
  padding: 64px 20px 28px;
  background: linear-gradient(180deg, var(--hero-from) 0%, var(--hero-to) 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.venue {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--venue-bg);
  border: 1px solid var(--venue-border);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
h1.title {
  font-size: 2.35rem;
  line-height: 1.18;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
h1.title .sub { color: var(--muted); font-weight: 600; font-size: 1.4rem; display: block; margin-top: 4px; }

.authors { margin: 18px 0 4px; font-size: 1.08rem; }
.authors a { color: var(--fg); text-decoration: none; border-bottom: 1px solid transparent; }
.authors a:hover { border-bottom-color: var(--accent); }
.authors sup { color: var(--accent); font-weight: 600; }
.affil { color: var(--muted); font-size: 0.98rem; margin-top: 6px; }
.note { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* ---------- Buttons ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 26px 0 6px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--btn-bg); color: var(--btn-fg);
  padding: 10px 20px; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
  transition: transform .12s ease, background .12s ease, color .12s ease;
}
.btn:hover { transform: translateY(-2px); background: var(--btn-bg-hover); }
.btn.disabled { background: #9ca3af; cursor: not-allowed; pointer-events: none; }
.btn .ico { font-size: 1.05rem; line-height: 1; }

/* ---------- Sections ---------- */
section { padding: 48px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }
h2.section-title {
  font-size: 1.7rem; font-weight: 800; text-align: center;
  margin: 0 0 26px; letter-spacing: -0.01em;
}
.lead { max-width: 800px; margin: 0 auto; text-align: justify; color: var(--lead-fg); }
.lead p { margin: 0 0 14px; }

/* ---------- Figure / teaser ---------- */
figure { margin: 0; }
figcaption { color: var(--muted); font-size: 0.9rem; text-align: center; margin-top: 12px; max-width: 820px; margin-left: auto; margin-right: auto; }

.compare-grid { display: grid; gap: 10px; }
.compare-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; text-align: center;
}
.compare-card img { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; }
.compare-card .lab {
  font-size: 0.82rem; font-weight: 600; color: var(--muted);
  padding: 7px 4px; background: var(--card-solid);
}
.compare-card.ours { border-color: var(--ours); box-shadow: 0 0 0 1px var(--ours); }
.compare-card.ours .lab { color: var(--ours); }

/* result rows: N columns */
.row5 { grid-template-columns: repeat(5, 1fr); }
.row4 { grid-template-columns: repeat(4, 1fr); }
.results-block + .results-block { margin-top: 18px; }

/* ---------- Pills / highlights ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 26px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 24px; text-align: center; min-width: 150px;
}
.stat .num { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat .cap { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }

/* ---------- BibTeX ---------- */
pre.bibtex {
  background: #0f172a; color: #e2e8f0; border-radius: 10px;
  padding: 20px; overflow-x: auto; font-size: 0.86rem; line-height: 1.5;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

footer {
  text-align: center; color: var(--muted); font-size: 0.85rem;
  padding: 34px 20px; background: var(--footer-bg);
}
footer a { color: var(--accent); text-decoration: none; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: absolute; top: 18px; right: 18px;
  width: 42px; height: 42px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); cursor: pointer;
  font-size: 1.15rem; line-height: 1;
  transition: background .2s ease, border-color .2s ease, transform .12s ease;
}
.theme-toggle:hover { transform: scale(1.08); border-color: var(--accent); }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: inline; }
:root[data-theme="dark"] .theme-toggle .sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  h1.title { font-size: 1.7rem; }
  .row5, .row4 { grid-template-columns: repeat(2, 1fr); }
  .compare-card .lab { font-size: 0.74rem; }
}
