:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #6b7280;
  --accent: #4a78e0;
  --accent-soft: #f3f7ff;
  --rule: #e5e7eb;
  --rule-strong: #d1d5db;
  --head-bg: #f3f4f6;
  --sub-bg: #f9fafb;
  --code-bg: #f6f8fa;
  --remark-border: #93c5fd;
  --remark-bg: #eff6ff;
  --btn-bg: #1f1f1f;
  --btn-fg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1c1d;
    --fg: #e8e8e8;
    --muted: #9ca3af;
    --accent: #8fb0f5;
    --accent-soft: rgba(74, 120, 224, 0.15);
    --rule: #30363d;
    --rule-strong: #3d444d;
    --head-bg: #21262d;
    --sub-bg: #161b22;
    --code-bg: #161b22;
    --remark-border: #1e3a8a;
    --remark-bg: rgba(59, 130, 246, 0.1);
    --btn-bg: #e6e6e6;
    --btn-fg: #111111;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1c1d;
  --fg: #e8e8e8;
  --muted: #9ca3af;
  --accent: #8fb0f5;
  --accent-soft: rgba(74, 120, 224, 0.15);
  --rule: #30363d;
  --rule-strong: #3d444d;
  --head-bg: #21262d;
  --sub-bg: #161b22;
  --code-bg: #161b22;
  --remark-border: #1e3a8a;
  --remark-bg: rgba(59, 130, 246, 0.1);
  --btn-bg: #e6e6e6;
  --btn-fg: #111111;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}
a { color: var(--accent); }

#progress {
  position: fixed; top: 0; left: 0; z-index: 10;
  width: 100%; height: 3px; border: 0; background: transparent;
  appearance: none; -webkit-appearance: none;
}
#progress::-webkit-progress-bar { background: transparent; }
#progress::-webkit-progress-value { background: var(--accent); }
#progress::-moz-progress-bar { background: var(--accent); }

.article { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.d-title { padding: 72px 0 24px; }
.d-title h1 { font-size: 2.6rem; font-weight: 700; line-height: 1.2; margin: 0 0 16px; letter-spacing: -0.01em; }
.d-title p { font-size: 1.25rem; line-height: 1.5; color: var(--muted); margin: 0; }
.d-byline {
  display: grid; grid-template-columns: 3fr 1fr; gap: 24px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 16px 0; margin: 8px 0 28px; font-size: 0.95rem;
}
.d-byline h3 {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 0 0 6px;
}
.d-byline .authors span { display: inline-block; margin-right: 14px; white-space: nowrap; }
.d-byline .author-note { margin-top: 6px; font-size: 0.8rem; color: var(--muted); }

.paper-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 0 0 32px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bg);
  font-weight: 600; font-size: 0.85rem; letter-spacing: 0.01em; text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.link-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.link-btn svg { width: 15px; height: 15px; fill: currentColor; }

h2 {
  font-size: 1.65rem; font-weight: 600; line-height: 1.3;
  margin: 48px 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.15rem; font-weight: 600; margin: 30px 0 10px; }
p { margin: 0 0 16px; }

.insights { margin: 8px 0 12px; }
.insights-title {
  color: var(--accent); font-size: 1.45rem; font-weight: 700;
  padding-bottom: 10px; margin-bottom: 4px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.insight {
  display: grid; grid-template-columns: 64px 1fr; gap: 22px; align-items: start;
  padding: 16px 0; border-bottom: 1px solid var(--rule);
}
.insight:last-child { border-bottom: 0; }
.insight .num { font-size: 3rem; font-weight: 700; color: var(--accent); line-height: 1; text-align: center; }
.insight .body { line-height: 1.6; }
.insight .body strong { color: var(--accent); }

figure { margin: 24px 0 30px; }
figure img { display: block; width: 100%; height: auto; margin: 0 auto; background: #fff; border-radius: 6px; }
figure video { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
figcaption { color: var(--muted); font-size: 0.92rem; line-height: 1.55; margin-top: 10px; }
figcaption b { color: var(--fg); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: end; }
.pair figure { margin-bottom: 8px; }
.sub { text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: 6px; }

.remark-box {
  border: 1px solid var(--remark-border); background: var(--remark-bg);
  border-radius: 6px; padding: 12px 16px; margin: 20px 0;
}
.remark-box p { margin: 0 0 6px; }
.remark-box p:last-child { margin: 0; }

.highlight { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 8px 0 22px; }
.stat { border: 1px solid var(--rule); border-radius: 8px; padding: 14px; text-align: center; }
.stat .num { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: 0.88rem; line-height: 1.45; }

.results-table { margin: 20px 0 8px; overflow-x: auto; }
.results-table table {
  border-collapse: collapse; width: 100%; min-width: max-content;
  font-size: 0.84rem; font-variant-numeric: tabular-nums;
}
.results-table th, .results-table td { padding: 6px 9px; text-align: center; border-bottom: 1px solid var(--rule); }
.results-table th:first-child, .results-table td:first-child { text-align: left; }
.results-table thead th { background: var(--head-bg); font-weight: 600; border-bottom: 2px solid var(--rule-strong); }
.results-table thead tr.subhead th { background: var(--sub-bg); font-weight: 400; color: var(--muted); font-size: 0.76rem; }
.results-table td.group { text-align: left; color: var(--muted); font-size: 0.78rem; font-style: italic; }
.results-table td.best { background: var(--head-bg); font-weight: 600; }
.results-table tr.ours td { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
.results-table tr.ours td.notbest { color: var(--muted); font-weight: 400; }
.results-table.narrow-table table { width: auto; min-width: 0; margin: 0 auto; }
.table-note { color: var(--muted); font-size: 0.9rem; line-height: 1.55; margin: 8px 0 26px; }

pre {
  background: var(--code-bg); border-radius: 8px; padding: 16px;
  overflow-x: auto; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem; line-height: 1.55;
}
footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 32px 16px 44px; margin-top: 48px; border-top: 1px solid var(--rule); }
footer a { color: inherit; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .d-title { padding-top: 48px; }
  .d-title h1 { font-size: 1.85rem; }
  .d-title p { font-size: 1.08rem; }
  .d-byline { grid-template-columns: 1fr; gap: 12px; }
  .pair, .highlight { grid-template-columns: 1fr; }
  .insight { grid-template-columns: 44px 1fr; gap: 14px; }
  .insight .num { font-size: 2.2rem; }
}
