:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --hero-1: #0b1220;
  --hero-2: #13213d;
  --good: #16a34a;
  --bad: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --m-caption: #3b82f6;
  --m-detection: #8b5cf6;
  --m-sound_event: #f59e0b;
  --m-transcript_segment: #14b8a6;
  --m-speech_tag: #e11d48;
  --e-same_event: #94a3b8;
  --e-supports: #16a34a;
  --e-contradicts: #dc2626;
  --e-derived_from: #64748b;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020;
    --bg-soft: #0f172a;
    --card: #111a2e;
    --ink: #e5e9f2;
    --ink-2: #c3cad8;
    --muted: #8b96ab;
    --line: #23304a;
    --accent: #7aa7ff;
    --accent-soft: #1b2a4a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --e-same_event: #64748b;
    --e-derived_from: #94a3b8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 Inter, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
code, pre { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* hero */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(59, 130, 246, .35), transparent 60%),
    radial-gradient(800px 300px at 0% 110%, rgba(20, 184, 166, .25), transparent 60%),
    linear-gradient(160deg, var(--hero-1), var(--hero-2));
  color: #f1f5f9;
  padding: 72px 0 56px;
  text-align: center;
}
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 600; color: #93c5fd; margin: 0 0 14px; }
.hero h1 { font-size: clamp(28px, 4.6vw, 48px); line-height: 1.12; margin: 0 auto; max-width: 900px; font-weight: 800; letter-spacing: -.02em; }
.subtitle { font-size: clamp(17px, 2.2vw, 22px); color: #cbd5e1; margin: 12px 0 26px; }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 26px; font-size: 18px; font-weight: 600; margin: 0; }
.affil { color: #94a3b8; margin: 6px 0 30px; }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18);
  color: #f8fafc; text-decoration: none; font-weight: 600; font-size: 15px;
  transition: background .15s, transform .15s;
}
.btn:hover { background: rgba(255, 255, 255, .16); transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; }
.btn small { font-weight: 400; color: #94a3b8; }
.btn.disabled { opacity: .6; cursor: default; }
.btn.disabled:hover { transform: none; background: rgba(255, 255, 255, .08); }

/* sections */
main section { padding: 48px 0 8px; }
h2 { font-size: 26px; letter-spacing: -.01em; margin: 0 0 14px; }
h3 { font-size: 18px; margin: 32px 0 12px; }
.lead { color: var(--ink-2); max-width: 820px; }
.note { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 24px; }
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat b { display: block; font-size: 24px; white-space: nowrap; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 14px; }

.figure { margin: 0; background: #f8fafc; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.figure img { display: block; width: 100%; height: auto; }

/* graph */
.graph-card, .chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.graph-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.legend button {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13px; color: var(--ink-2);
  background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.legend button.off { opacity: .4; text-decoration: line-through; }
.legend svg { width: 24px; height: 8px; }
.graph-body { display: grid; grid-template-columns: 1fr 290px; min-height: 420px; }
#graph-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.node-panel { border-left: 1px solid var(--line); padding: 18px; font-size: 14px; }
.node-panel .hint { color: var(--muted); }
.node-panel .tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.node-panel .tag i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.node-panel .time { font-family: "JetBrains Mono", monospace; color: var(--muted); font-size: 12px; }
.node-panel blockquote { margin: 10px 0; padding: 10px 12px; background: var(--bg-soft); border-radius: 10px; color: var(--ink); }
.node-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.node-panel dt { color: var(--muted); }
.node-panel dd { margin: 0; }
.node-panel .links { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.node-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.node-legend span { display: inline-flex; align-items: center; gap: 6px; }
.node-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

.g-edge { fill: none; transition: opacity .2s; }
.g-node { cursor: pointer; transition: opacity .2s; }
.g-node circle { stroke: var(--card); stroke-width: 2.5; transition: r .2s; }
.g-node text { font-size: 12px; font-weight: 700; fill: #fff; pointer-events: none; text-anchor: middle; dominant-baseline: central; }
.g-node.cited circle { stroke: var(--ink); stroke-width: 3; }
.g-dim { opacity: .12; }
.g-lane { fill: var(--muted); font-size: 12px; font-weight: 600; }
.g-axis { stroke: var(--line); }
.g-tick { fill: var(--muted); font-size: 11px; }
.g-span { opacity: .22; }

.answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.answer {
  text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
  display: flex; flex-direction: column;
}
.answer:hover { transform: translateY(-1px); }
.answer.on { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.answer .name { font-weight: 700; }
.answer .desc { color: var(--muted); font-size: 12.5px; line-height: 1.4; min-height: 4.2em; }
.answer .verdict { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; }
.answer .verdict b { font-size: 20px; }
.answer .yes { color: var(--good); }
.answer .no { color: var(--bad); }
.answer .bar { height: 6px; background: var(--bg-soft); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.answer .bar i { display: block; height: 100%; border-radius: 3px; }
.answer .cites { font-size: 12px; color: var(--muted); margin-top: 8px; }
.answer .verdict { margin-top: auto; }

/* results */
.chart-card { padding: 10px 6px; }
#f1-chart { width: 100%; height: auto; display: block; }
.c-label { fill: var(--ink); font-size: 14px; font-weight: 600; }
.c-sub { fill: var(--muted); font-size: 12px; }
.c-val { fill: var(--ink); font-size: 13px; font-family: "JetBrains Mono", monospace; }
.c-grid { stroke: var(--line); }
.c-tick { fill: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 15px; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td { font-family: "JetBrains Mono", monospace; font-size: 14px; }
td:first-child { font-family: inherit; font-weight: 600; }
td .d { font-size: 12px; margin-left: 6px; }
td .d.up { color: var(--good); }
td .d.down { color: var(--bad); }

.findings { padding-left: 22px; max-width: 860px; }
.findings li { margin: 0 0 12px; padding-left: 4px; }
.findings li::marker { color: var(--accent); font-weight: 700; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.card {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { margin: 0 0 8px; }
.card p { color: var(--ink-2); margin: 0 0 12px; font-size: 15px; }
.card .more { color: var(--accent); font-size: 14px; font-weight: 600; word-break: break-all; }

.bib { position: relative; }
.bib pre { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 18px; overflow-x: auto; font-size: 13.5px; margin: 0; }
.copy { position: absolute; top: 10px; right: 10px; font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }

footer { margin-top: 56px; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
footer p { margin: 4px 0; }

@media (max-width: 780px) {
  .hero { padding: 48px 0 40px; }
  .graph-body { grid-template-columns: 1fr; min-height: 0; }
  .node-panel { border-left: 0; border-top: 1px solid var(--line); min-height: 150px; }
  .wrap { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
