/* DefenseBench — War Room Console Theme */

:root {
  --bg: #0a0e17;
  --bg1: #111827;
  --bg2: #1e293b;
  --ink: #e2e8f0;
  --muted: #64748b;
  --panel: #0f172a;
  --panel-strong: #162032;
  --line: #1e293b;
  --line-bright: #334155;
  --secondary: #1e293b;
  --accent: #38bdf8;
  --accent-dim: rgba(56, 189, 248, 0.15);
  --accent-glow: rgba(56, 189, 248, 0.25);
  --accent-fg: #0a0e17;
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.15);
  --ok: #34d399;
  --ok-dim: rgba(52, 211, 153, 0.15);
  --bad: #f87171;
  --bad-dim: rgba(248, 113, 113, 0.15);
  --warn: #fbbf24;
  --blue: #60a5fa;
  --shadow: 0 25px 80px rgba(0,0,0,0.6);
  --radius: 6px;
  --max-w: 1320px;
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-mono: "Azeret Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
code, pre { font-family: var(--font-mono); }

/* ─── Scanline overlay ─── */
.scanline-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

/* ─── Header ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(20px) saturate(1.2);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
  height: 60px;
}
.topbar__left {
  display: flex;
  align-items: center;
  gap: 32px;
}
.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  color: var(--ink);
  transition: color 200ms;
}
.brand:hover { color: var(--accent); }
.brand__icon { color: var(--accent); flex-shrink: 0; filter: drop-shadow(0 0 6px var(--accent-glow)); }
.brand__title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.topnav { display: flex; align-items: center; gap: 24px; }
.topnav__dropdown { position: relative; }
.topnav__trigger {
  appearance: none;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 200ms, background 200ms;
}
.topnav__trigger:hover { color: var(--accent); background: var(--accent-dim); }
.topnav__trigger.active { color: var(--accent); }
.topnav__menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 200;
  animation: menuDrop 180ms ease-out;
}
.topnav__menu.open { display: block; }
@keyframes menuDrop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.topnav__menu-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  transition: background 150ms;
}
.topnav__menu-item:hover { background: var(--accent-dim); }
.topnav__menu-icon { color: var(--accent); flex-shrink: 0; }
.topnav__menu-label { display: block; font-size: 13px; font-weight: 600; }
.topnav__menu-desc { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted);
}

/* ─── Main ─── */
.main {
  padding: 0;
  min-height: 60vh;
}

/* ─── Footer ─── */
.footer {
  padding: 56px 0 40px;
  border-top: 1px solid var(--line);
  margin-top: 80px;
}
.footer__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.footer__brand { display: flex; align-items: center; gap: 8px; }
.footer__brand svg { color: var(--accent); }
.footer__brand span {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}
.footer__desc {
  max-width: 420px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}
.footer__copy {
  font-size: 10px;
  color: rgba(100, 116, 139, 0.5);
}

/* ═══════════════════════════════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════════════════════════════ */

.hero {
  position: relative;
  padding: 120px 28px 100px;
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, var(--accent-dim), transparent),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(251, 191, 36, 0.04), transparent),
    radial-gradient(ellipse 40% 60% at 80% 80%, rgba(96, 165, 250, 0.04), transparent);
  pointer-events: none;
}
.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.15;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 20%, transparent 70%);
  pointer-events: none;
}
.hero__content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  animation: heroFade 600ms ease-out both;
}
@keyframes heroFade {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.06);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 32px;
}
.hero__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { opacity: 0.6; box-shadow: 0 0 0 8px transparent; }
}
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 20px;
}
.hero__title-accent {
  background: linear-gradient(135deg, var(--accent), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero__subtitle {
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 40px;
}
.hero__actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Landing cards ─── */
.landing-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px 80px;
}
.landing-section__header {
  text-align: center;
  margin-bottom: 48px;
}
.landing-section__kicker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 12px;
}
.landing-section__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.benchmark-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.benchmark-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 300ms, transform 200ms, box-shadow 300ms;
  overflow: hidden;
}
.benchmark-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  opacity: 0;
  transition: opacity 300ms;
}
.benchmark-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(56, 189, 248, 0.08);
}
.benchmark-card:hover::before { opacity: 1; }
.benchmark-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 18px;
}
.benchmark-card__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.benchmark-card__desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 18px;
}
.benchmark-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
}

/* ═══════════════════════════════════════════════════════════════════
   BENCHMARK PAGE (BOTSV3)
   ═══════════════════════════════════════════════════════════════════ */

.bench-page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 36px 28px 60px;
}
.bench-header {
  margin-bottom: 36px;
  animation: heroFade 400ms ease-out both;
}
.bench-header__breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 14px;
}
.bench-header__breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  transition: color 150ms;
}
.bench-header__breadcrumb a:hover { color: var(--accent); }
.bench-header__breadcrumb-sep { color: var(--line-bright); }
.bench-header__title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.bench-header__desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 680px;
}

/* ─── Leaderboard ─── */
.leaderboard {
  margin-bottom: 36px;
  animation: rise 350ms ease-out both;
  animation-delay: 80ms;
}
.leaderboard__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.leaderboard__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.leaderboard__title-icon {
  color: var(--amber);
  filter: drop-shadow(0 0 4px var(--amber-dim));
}
.leaderboard__panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ─── Leaderboard table ─── */
.lb-table {
  width: 100%;
  border-collapse: collapse;
}
.lb-table th,
.lb-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 12px;
}
.lb-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--panel-strong);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  transition: color 150ms;
}
.lb-table th:hover { color: var(--accent); }
.lb-table th .sort-arrow { margin-left: 4px; font-size: 9px; opacity: 0.7; }
.lb-table tbody tr {
  cursor: pointer;
  transition: background 150ms;
}
.lb-table tbody tr:hover { background: var(--accent-dim); }
.lb-table tbody tr.lb-row--expanded { background: var(--panel-strong); }
.lb-table tbody tr:last-child td { border-bottom: none; }

/* Expand chevron */
.lb-expand-cell {
  width: 36px;
  text-align: center;
}
.lb-chevron {
  color: var(--muted);
  transition: transform 200ms ease, color 200ms;
  vertical-align: middle;
}
.lb-main-row:hover .lb-chevron { color: var(--accent); }
.lb-chevron--open {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Rank badge */
.lb-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11px;
}
.lb-rank--1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #0a0e17; }
.lb-rank--2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: #0a0e17; }
.lb-rank--3 { background: linear-gradient(135deg, #d97706, #b45309); color: #0a0e17; }
.lb-rank--default { background: var(--secondary); color: var(--muted); border: 1px solid var(--line); }

.lb-agent {
  font-weight: 600;
  color: var(--ink);
}
.lb-num { font-variant-numeric: tabular-nums; }
.lb-bar {
  display: inline-block;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 8px;
  transition: width 500ms ease-out;
}

/* ─── Expanded runs sub-table ─── */
.lb-runs-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--line);
  background: var(--bg1);
}
.lb-runs-content {
  padding: 12px 16px 16px 54px;
  animation: expandDown 200ms ease-out;
}
@keyframes expandDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 1000px; }
}
.lb-runs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.lb-runs-table th,
.lb-runs-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.lb-runs-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  cursor: default;
}
.lb-runs-table tbody tr:hover td { background: rgba(56, 189, 248, 0.05); }
.lb-runs-table tbody tr:last-child td { border-bottom: none; }

/* ─── Performance Chart ─── */
.perf-chart {
  margin-bottom: 36px;
  animation: rise 350ms ease-out both;
  animation-delay: 60ms;
}
.perf-chart__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.perf-chart__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.perf-chart__title-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 4px var(--accent-dim));
}
.perf-chart__panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px 16px;
  overflow: hidden;
}
.perf-svg {
  width: 100%;
  height: auto;
  display: block;
}
.perf-svg text {
  font-family: var(--font-mono);
}
.perf-svg .perf-axis-label {
  font-size: 10px;
  fill: var(--muted);
}
.perf-svg .perf-axis-title {
  font-size: 10px;
  fill: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.perf-svg .perf-model-label {
  font-size: 10.5px;
  fill: var(--ink);
}
.perf-svg .perf-family-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
}
.perf-svg .perf-legend-label {
  font-size: 10px;
  fill: var(--muted);
}
.perf-svg .perf-dot {
  transition: r 150ms, opacity 150ms;
  cursor: default;
}
.perf-svg .perf-dot:hover {
  r: 6;
  opacity: 1 !important;
}
.perf-svg .perf-mean {
  transition: r 150ms;
  cursor: default;
}
.perf-svg .perf-mean:hover {
  r: 9;
}
.perf-chart__legend {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.perf-chart__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.perf-chart__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.perf-chart__legend-line {
  width: 20px;
  height: 2px;
  border-radius: 1px;
  opacity: 0.5;
}

/* ─── Runs section ─── */
.runs-section {
  animation: rise 350ms ease-out both;
  animation-delay: 160ms;
}
.runs-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.runs-section__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

/* ─── Methodology ─── */
.methodology {
  margin-top: 48px;
  animation: rise 350ms ease-out both;
  animation-delay: 240ms;
}
.methodology__header {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.methodology__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.methodology__title-icon {
  color: var(--muted);
}
.methodology__panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.methodology__body {
  padding: 28px 28px 24px;
}
.methodology__body p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink);
  margin: 0 0 16px;
  max-width: 740px;
}
.methodology__body p:last-of-type {
  margin-bottom: 24px;
}
.methodology__body strong {
  color: #f1f5f9;
  font-weight: 600;
}
.methodology__prompt {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}
.methodology__prompt-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg1);
}
.methodology__prompt-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.methodology__prompt-body {
  margin: 0;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
}
.methodology__prompt-body::-webkit-scrollbar { width: 6px; }
.methodology__prompt-body::-webkit-scrollbar-track { background: transparent; }
.methodology__prompt-body::-webkit-scrollbar-thumb { background: var(--line-bright); border-radius: 6px; }

/* ═══════════════════════════════════════════════════════════════════
   SHARED COMPONENTS
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Buttons ─── */
.btn {
  appearance: none;
  border: 1px solid var(--line-bright);
  background: var(--secondary);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 200ms, background 200ms, transform 100ms;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { border-color: var(--accent); background: var(--accent-dim); }
.btn:active { transform: scale(0.98); }
.btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
}
.btn--primary:hover { background: #0ea5e9; border-color: #0ea5e9; }
.btn--xs { padding: 5px 10px; font-size: 11px; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { color: var(--accent); background: var(--accent-dim); border-color: transparent; }

/* ─── Panels ─── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
@keyframes rise {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.panel__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.panel__title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel__body { padding: 16px; }

/* ─── Filter bar ─── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.filter-input {
  min-width: 220px;
  flex: 1 1 280px;
  border: 1px solid var(--line);
  background: var(--bg1);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  transition: border-color 200ms;
}
.filter-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.filter-input::placeholder { color: var(--muted); }
.filter-select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg1);
  padding: 10px 34px 10px 14px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  color: var(--ink);
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.4) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.4) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
  transition: border-color 200ms;
}
.filter-select:hover { border-color: var(--accent); }
.filter-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ─── Tables ─── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-bright); border-radius: 6px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th, td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  background: var(--panel);
}
th:hover { color: var(--accent); }
th .sort-arrow { margin-left: 4px; font-size: 9px; }
tr:hover td { background: rgba(56, 189, 248, 0.04); }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--secondary);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.badge--ok { border-color: rgba(52, 211, 153, 0.3); color: var(--ok); background: var(--ok-dim); }
.badge--bad { border-color: rgba(248, 113, 113, 0.3); color: var(--bad); background: var(--bad-dim); }
.badge--warn { border-color: rgba(251, 191, 36, 0.3); color: var(--warn); background: var(--amber-dim); }
.badge--blue { border-color: rgba(96, 165, 250, 0.3); color: var(--blue); background: rgba(96, 165, 250, 0.1); }
.badge--muted { color: var(--muted); }

/* ─── Score coloring ─── */
.score-pos { color: var(--ok); }
.score-neg { color: var(--bad); }
.score-zero { color: var(--muted); }
.c-ok { color: var(--ok); }
.c-bad { color: var(--bad); }
.c-warn { color: var(--warn); }
.c-blue { color: var(--blue); }
.c-muted { color: var(--muted); }

/* ─── Page header ─── */
.page-header {
  margin-bottom: 24px;
}
.page-header__kicker {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.page-header__title {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════════════════════════
   ANALYSIS PAGE
   ═══════════════════════════════════════════════════════════════════ */

.analysis-page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 28px 60px;
}

.analysis-banner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  margin-bottom: 24px;
  animation: rise 300ms ease-out both;
}
.analysis-banner__agent {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
}
.analysis-banner__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.analysis-banner__stat-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.analysis-banner__stat-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.analysis-banner__back {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: color 200ms;
}
.analysis-banner__back:hover { color: var(--accent); }

/* ─── Tabs ─── */
.analysis-tabs {
  display: flex;
  gap: 2px;
  padding: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.analysis-tab {
  appearance: none;
  border: none;
  background: none;
  padding: 12px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 200ms, border-color 200ms;
}
.analysis-tab:hover { color: var(--ink); }
.analysis-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tabpane { display: none; }
.tabpane--active { display: block; }

/* ─── Terminal playback ─── */
.terminal-panel__actions { display: flex; gap: 8px; align-items: center; }
.terminal-player { width: 100%; }
.terminal-player .ap-player { width: 100%; box-shadow: none; }
.terminal-player .ap-player, .terminal-player .ap-terminal {
  border-radius: var(--radius);
}
.terminal-panel__note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* Terminal loader */
.terminal-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 20px;
}
.terminal-loader__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
.terminal-loader__text {
  font-size: 13px;
  color: var(--muted);
}
.terminal-loader__bar {
  width: 240px;
  max-width: 80%;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.terminal-loader__bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 200ms ease-out;
}
.terminal-loader__bar-fill--pulse {
  animation: loaderPulse 1.5s ease-in-out infinite;
}
@keyframes loaderPulse {
  0%, 100% { opacity: 0.5; width: 30%; }
  50% { opacity: 1; width: 70%; }
}
.terminal-loader__size {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-height: 1em;
}

/* ─── Query cell ─── */
.query-cell {
  font-size: 12px;
  line-height: 1.4;
  max-width: 600px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  color: var(--ink);
}
.query-cell--expanded {
  white-space: pre-wrap;
  word-break: break-all;
  max-width: none;
}

/* ─── Timeline tab ─── */
.reasoning-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.reasoning-filter-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: border-color 200ms, color 200ms, background 200ms;
}
.reasoning-filter-btn:hover { color: var(--ink); border-color: var(--accent); }
.reasoning-filter-btn.active { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.reasoning-search {
  min-width: 160px;
  flex: 1 1 180px;
  border: 1px solid var(--line);
  background: var(--bg1);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
}
.reasoning-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.reasoning-search::placeholder { color: var(--muted); }
.reasoning-question-select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg1);
  padding: 6px 28px 6px 10px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  color: var(--ink);
  max-width: 280px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.4) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.4) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.reasoning-question-select:hover { border-color: var(--accent); }
.reasoning-context-toggle {
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Jump rail */
.reasoning-jump-rail {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.reasoning-jump-rail::-webkit-scrollbar { height: 4px; }
.reasoning-jump-rail::-webkit-scrollbar-thumb { background: var(--line-bright); border-radius: 4px; }
.reasoning-chip {
  appearance: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 200ms, transform 100ms;
}
.reasoning-chip:hover { opacity: 0.85; transform: scale(1.05); }
.reasoning-chip--ok { background: var(--ok); color: #0a0e17; }
.reasoning-chip--bad { background: var(--bad); color: #fff; }
.reasoning-chip__qid { font-size: 11px; font-weight: 700; }
.reasoning-chip__offset { font-size: 9px; opacity: 0.7; }

/* Timeline container */
.reasoning-timeline {
  border-left: 2px solid var(--line);
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Event cards */
.reasoning-event {
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12px;
  position: relative;
}
.reasoning-event__header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.reasoning-event--submission {
  padding: 12px 16px;
  border-left-width: 3px;
}
.reasoning-event--submission-ok { border-left-color: var(--ok); }
.reasoning-event--submission-bad { border-left-color: var(--bad); }
.reasoning-event--hint { border-left: 3px solid var(--warn); }
.reasoning-event--query { background: var(--bg1); }
.reasoning-event--tool_call { background: var(--bg1); }
.reasoning-event--tool_result { background: var(--bg1); }
.reasoning-event--tool_result.paired {
  margin-left: 20px;
  border-left: 2px dotted var(--line);
}
.reasoning-event--commentary {
  background: transparent;
  border-color: transparent;
  padding: 4px 12px;
}
.reasoning-commentary-text {
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
}
.reasoning-event--agent_reasoning {
  border-left: 3px solid var(--blue);
}
.reasoning-agent-text {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  color: var(--ink);
}
.reasoning-event--highlight { animation: reasoning-pulse 1.5s ease-out; }
@keyframes reasoning-pulse {
  0% { background: var(--accent-dim); }
  100% { background: var(--panel); }
}
.reasoning-event--inferred-context {
  opacity: 0.5;
  border-left-style: dotted;
}
.reasoning-timestamp {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.reasoning-score {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.reasoning-question {
  margin-top: 6px;
  line-height: 1.4;
  color: var(--ink);
  white-space: normal;
}
.reasoning-answer {
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--bg1);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--ink);
  border: 1px solid var(--line);
}
.reasoning-terminal-link {
  font-size: 10px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  margin-left: auto;
  white-space: nowrap;
}
.reasoning-terminal-link:hover { text-decoration: underline; }
.reasoning-tool-name {
  display: inline-flex;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--blue);
}
.reasoning-expand {
  margin-top: 4px;
  max-height: 1.4em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  color: var(--ink);
  line-height: 1.4;
}
.reasoning-expand--open {
  max-height: none;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─── Missed Questions tab ─── */
.missed-summary {
  display: flex;
  gap: 24px;
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.missed-summary__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.missed-summary__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.missed-summary__value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.missed-row--incorrect td { border-left: 3px solid var(--bad); }
.missed-row--unanswered td { border-left: 3px solid var(--warn); }

/* ─── States ─── */
.empty {
  font-size: 13px;
  color: var(--muted);
  padding: 40px 16px;
  text-align: center;
}
.loading {
  font-size: 13px;
  color: var(--muted);
  padding: 48px 16px;
  text-align: center;
}
.loading::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .hero { padding: 80px 20px 60px; }
  .hero__title { font-size: 28px; }
  .bench-page { padding: 20px 16px 40px; }
  .analysis-page { padding: 16px 16px 40px; }
  .analysis-banner { gap: 12px; padding: 16px; }
  .analysis-banner__agent { font-size: 14px; }
  .analysis-banner__back { margin-left: 0; }
  .topbar__inner { padding: 0 16px; }
  .lb-runs-content { padding-left: 16px; }
  td, th { padding: 8px 6px; font-size: 11px; }
}
