*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f5;
  --bg-elevated: #f0f0f2;
  --border: #e2e2e8;
  --text: #1a1a1e;
  --text-muted: #5a5a63;
  --text-dim: #8a8a96;
  --accent: #0891b2;
  --accent-dim: rgba(8, 145, 178, 0.08);
  --purple: #7c3aed;
  --green: #16a34a;
  --kept: #34d399;
  --amber: #d97706;
  --red: #dc2626;
  --navy: #0f172a;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font-body);
  line-height: 1.6; overflow-x: hidden; width: 100%; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }

section { padding: 3.5rem 0; }
section + section { border-top: 1px solid var(--border); }
.section-label {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.75rem;
}
.section-title { font-family: var(--font-display); font-size: 2.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 1rem; }
.section-subtitle { font-size: 1.15rem; color: var(--text-muted); max-width: 760px; line-height: 1.7; }
.note { font-size: 0.85rem; color: var(--text-dim); margin-top: 1rem; max-width: 820px; }

/* ─── HERO ─── */
#hero { padding: 4.5rem 0 2.5rem; text-align: center; position: relative; }
#hero::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 800px; height: 600px; pointer-events: none;
  background: radial-gradient(ellipse, rgba(8,145,178,0.06) 0%, transparent 70%);
}
.hero-title {
  font-family: var(--font-display); font-size: 5rem; font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.05; margin-bottom: 0.6rem; position: relative;
}
.hero-title .highlight {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-tagline { font-family: var(--font-display); font-size: 1.85rem; font-weight: 400; color: var(--text-muted); margin-bottom: 1.5rem; }
.hero-authors { font-size: 1.05rem; color: var(--text-dim); margin-bottom: 2rem; line-height: 1.8; }
.hero-authors span { color: var(--text-muted); }
.hero-blurb { font-size: 1.25rem; color: var(--text-muted); max-width: 800px; margin: 0 auto 2rem; line-height: 1.8; }
.hero-blurb strong { color: var(--text); font-weight: 600; }
.btn-row { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.6rem; border-radius: 8px;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text); text-decoration: none;
}
.btn:hover { background: var(--bg-card-hover); border-color: var(--text-dim); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #06b6d4; border-color: #06b6d4; }
.btn-small { padding: 0.5rem 1.1rem; font-size: 0.95rem; }

/* ─── WHAT THE MODEL SEES (before/after slider) ─── */
#sees { padding-top: 1rem; border-top: none; }
.tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin-bottom: 1rem; }
.tabs.left { justify-content: flex-start; }
.tab {
  padding: 0.5rem 1.05rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card);
  font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.tab:hover { border-color: var(--text-dim); color: var(--text); }
.tab.active { background: var(--text); border-color: var(--text); color: #fff; }
.compare {
  position: relative; max-width: 1000px; margin: 0 auto; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(15,23,42,0.12); cursor: ew-resize;
  user-select: none; touch-action: none; background: #000;
}
.compare img { display: block; width: 100%; height: auto; pointer-events: none; }
.compare .cmp-top { position: absolute; inset: 0; }
.compare .cmp-top img { width: 100%; height: 100%; object-fit: cover; }
.cmp-handle { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; transform: translateX(-50%); box-shadow: 0 0 8px rgba(0,0,0,0.4); }
.cmp-handle::after {
  content: '⟷'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 42px; height: 42px; border-radius: 50%; background: #fff; color: var(--text);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.cmp-label {
  position: absolute; top: 14px; padding: 0.3rem 0.7rem; border-radius: 6px; font-family: var(--font-display);
  font-size: 0.85rem; font-weight: 600; background: rgba(15,23,42,0.75); color: #fff; pointer-events: none;
}
.cmp-label.left { left: 14px; }
.cmp-label.right { right: 14px; }
.cmp-count {
  position: absolute; bottom: 14px; right: 14px; padding: 0.45rem 0.85rem; border-radius: 8px; pointer-events: none;
  background: rgba(255,255,255,0.95); font-family: var(--font-display); font-weight: 600; font-size: 1rem; color: var(--text);
}
.cmp-count b { color: var(--accent); font-size: 1.25rem; }
.cmp-caption { text-align: center; color: var(--text-muted); font-size: 1rem; margin-top: 0.9rem; min-height: 1.6em; }

/* ─── STATS ─── */
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; padding: 0.5rem 0; }
.stat-card {
  text-align: center; padding: 1.5rem 1rem; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-card); transition: border-color 0.2s, transform 0.2s;
}
.stat-card { position: relative; }
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat-tooltip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) scale(0.95);
  background: var(--bg-card); border: 1px solid var(--accent); border-radius: 10px; padding: 0.85rem 1rem; width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 10; text-align: left;
}
.stat-tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 7px solid transparent; border-top-color: var(--accent); }
.stat-card:hover .stat-tooltip { opacity: 1; transform: translateX(-50%) scale(1); }
.stat-tooltip p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.55; margin: 0; }
.stat-tooltip strong { color: var(--text); font-weight: 600; }
.stat-number { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-label { font-size: 0.95rem; color: var(--text-muted); margin-top: 0.35rem; }

/* ─── TOKEN RACE ─── */
.race { margin-top: 2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 1.75rem; box-shadow: var(--shadow-card); }
.race-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.race-clock { font-family: var(--font-mono); font-size: 0.95rem; color: var(--text-muted); }
.race-result { margin-top: 1rem; display: flex; gap: 2rem; flex-wrap: wrap; font-size: 1rem; color: var(--text-muted); }
.race-result b { font-family: var(--font-display); font-size: 1.35rem; color: var(--text); }

/* ─── QUIZ ─── */
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 0.3rem; }

/* ─── RESULTS ─── */
.results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 1.25rem; }
.result-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow-card); }
.result-card h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; }
.result-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; min-height: 4.2em; }
.chart-container { position: relative; height: 280px; }

/* ─── METHOD ─── */
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2rem; }
.how-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow-card); }
.how-tag { display: inline-block; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.1em; color: var(--accent); background: var(--accent-dim); border-radius: 4px; padding: 0.2rem 0.55rem; margin-bottom: 0.9rem; }
.how-card h3 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 0.5rem; }
.how-card p { font-size: 0.95rem; color: var(--text-muted); }
.figure-card { margin-top: 1.5rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; box-shadow: var(--shadow-card); }
.figure-card img, .figure-card video { display: block; width: 100%; height: auto; }

/* ─── CITATION ─── */
.bibtex-wrap { position: relative; margin-top: 1.5rem; }
.bibtex { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); white-space: pre; overflow-x: auto; }
.copy-btn { position: absolute; top: 1rem; right: 1rem; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted); padding: 0.4rem 0.8rem; border-radius: 6px; font-family: var(--font-mono); font-size: 0.7rem; cursor: pointer; }
footer { padding: 3rem 0; text-align: center; font-size: 0.8rem; color: var(--text-dim); border-top: 1px solid var(--border); }

@media (max-width: 900px) {
  .hero-title { font-size: 3.2rem; }
  .hero-tagline { font-size: 1.35rem; }
  .stats-bar, .results-grid, .how-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── METHOD STEPS ─── */
.steps { margin-top: 2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-card); overflow: hidden; }
.step-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--border); }
.step-tab { padding: 0.95rem 1rem; border: none; background: #fafafa; cursor: pointer; font-family: var(--font-display); font-size: 1rem; font-weight: 600; color: var(--text-muted); text-align: left; border-right: 1px solid var(--border); transition: background 0.2s, color 0.2s; }
.step-tab:last-child { border-right: none; }
.step-tab span { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); margin-right: 0.5rem; }
.step-tab.active { background: #fff; color: var(--text); box-shadow: inset 0 -3px 0 var(--accent); }
.step-panel { display: none; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 2rem; padding: 1.75rem; }
.step-panel.active { display: grid; }
.step-vis canvas { width: 100%; height: auto; display: block; }
.step-text h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 0.6rem; }
.step-text p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0.8rem; }
.step-text .formula { font-family: 'Times New Roman', serif; font-size: 1.1rem; color: var(--text); background: var(--bg-elevated); border-radius: 8px; padding: 0.5rem 0.8rem; text-align: center; }
.step-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.6rem 0; }

@media (max-width: 900px) {
  .step-panel.active { grid-template-columns: 1fr; }
  .step-tabs { grid-template-columns: 1fr 1fr; }
}


/* ─── TOKEN BARS ─── */
.hbar-row { display: grid; grid-template-columns: 150px 1fr 150px; align-items: center; gap: 1.25rem; margin: 1rem 0; }
.hbar-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.hbar-name.vtr, .hbar-num.vtr { color: var(--accent); }
.hbar-track { height: 46px; background: var(--bg-elevated); border-radius: 8px; overflow: hidden; }
.hbar-fill { height: 100%; width: 0; border-radius: 8px; }
.hbar-fill.dense { background: #9ca3af; }
.hbar-fill.vtr { background: var(--accent); }
.hbar-num { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }


/* ─── SCORE BARS ─── */
.cmp2-bars { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem 1.5rem; box-shadow: var(--shadow-card); }
.cmp2-bars.solo { box-shadow: none; }
.cmp2-bars h3 { font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 0.8rem; }
.sbar { display: grid; grid-template-columns: 9.5em 1fr 2.6em; align-items: center; gap: 0.75rem; margin: 0.55rem 0; font-size: 0.92rem; }
.sbar span.vtr { color: var(--accent); font-weight: 600; }
.sbar b { font-family: var(--font-display); text-align: right; }
.sbar-track { height: 18px; background: var(--bg-elevated); border-radius: 5px; overflow: hidden; }
.sbar-track div { height: 100%; border-radius: 5px; }
.sbar-track .dense { background: #9ca3af; } .sbar-track .vtr { background: var(--accent); }
.sbar-track .h264 { background: var(--amber); } .sbar-track .pdiff { background: var(--purple); } .sbar-track .frozen { background: var(--red); }

/* ─── METHOD VISUALS ─── */
.jt2-row { display: grid; grid-template-columns: minmax(0, 1fr) 11em; gap: 1rem; align-items: center; margin-bottom: 0.9rem; }
.jt2-in { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.jt2-in img, .jt2-in i { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; border: 1.5px solid #cbd5e1; }
.jt2-in i { background: #1e293b; }
.jt2-in img.a { border: 2.5px solid #1f5fa8; }
.jt2-model { border: 2px solid; border-radius: 10px; padding: 0.55rem 0.8rem; text-align: center; }
.jt2-model b { display: block; font-family: var(--font-display); }
.jt2-model small { display: block; font-size: 0.78rem; color: var(--text-muted); }
.jt2-model.full { border-color: #1f5fa8; } .jt2-model.vtr { border-color: #e07a1f; background: #fff7ed; } .jt2-model.blind { border-color: #6b7a8c; }
.jt2-legend { font-size: 0.82rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; }
.jt2-legend .sq { width: 12px; height: 12px; border: 2.5px solid #1f5fa8; border-radius: 2px; }
.dg2 text { font-family: 'Inter', sans-serif; }
.dg2 .pt { font-size: 15px; font-weight: 700; }
.dg2 .lb { font-size: 15px; font-weight: 600; }
.dg2 .ax { font-size: 13px; fill: #6b7280; }
.chart-container.tall { height: 340px; }

@media (max-width: 900px) {
  .hbar-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .hbar-num { text-align: left; }
}
