/* ============================================================
   EYEBALL EVAL — clean modern dashboard
   Type: Avenir (Avenir Next first), Nunito Sans web fallback
   ============================================================ */

/* One-line "drill in" hint above the home charts / episode table. */
.nav-hint {
  margin: -2px 0 16px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-2);
}
.policy-nav-hint {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.trial-nav-hint {
  font-size: 18.75px;
  font-weight: 600;
  color: var(--text);
}

* { box-sizing: border-box; }

:root {
  /* Neutrals — LIGHT */
  --bg:           #ffffff;
  --surface:      #ffffff;
  --surface-2:    #fafafa;
  --surface-3:    #f4f4f5;
  --border:       #e5e7eb;
  --border-2:     #d4d4d8;
  --border-strong:#a1a1aa;

  --text:         #18181b;
  --text-2:       #52525b;
  --text-3:       #a1a1aa;
  --text-on-dark: #ffffff;

  --header-bg:    rgba(255, 255, 255, 0.85);

  /* Accents */
  --accent:       #059669;
  --accent-2:     #047857;
  --accent-soft:  #ecfdf5;
  --accent-tint:  rgba(5, 150, 105, 0.08);
  --accent-tint-h:rgba(5, 150, 105, 0.16);
  --ok:           #059669;
  --warn:         #b45309;
  --warn-soft:    #fef3c7;
  --warn-border:  #fcd34d;
  --warn-code-bg: rgba(255, 255, 255, 0.7);

  /* Failure red (for jump strip) */
  --fail-bg:        #fee2e2;
  --fail-bg-hover:  #fecaca;
  --fail-border-hov:#fca5a5;
  --fail-text:      #b91c1c;
  --fail-current:   #dc2626;
  --fail-tint:      rgba(220, 38, 38, 0.06);
  --fail-tint-h:    rgba(220, 38, 38, 0.12);

  /* Success-hover for jump strip */
  --ok-jump-bg:     var(--accent-soft);
  --ok-jump-hover:  #d1fae5;
  --ok-jump-border: #a7f3d0;

  /* Bars */
  --bar-rest:     #27272a;
  --track:        #f1f5f9;

  /* Video / misc */
  --video-bg:     #000;

  /* Layout */
  --header-h:     64px;
  --radius:       8px;
  --radius-sm:    6px;

  /* Fonts */
  --font-sans:    'Avenir Next', Avenir, 'Nunito Sans', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Monaco, monospace;
}

[data-theme="dark"] {
  --bg:           #0a0a0b;
  --surface:      #131316;
  --surface-2:    #1a1a1d;
  --surface-3:    #232328;
  --border:       #2a2a30;
  --border-2:     #3a3a42;
  --border-strong:#52525b;

  --text:         #f4f4f5;
  --text-2:       #a1a1aa;
  --text-3:       #71717a;
  --text-on-dark: #ffffff;

  --header-bg:    rgba(10, 10, 11, 0.78);

  --accent:       #10b981;
  --accent-2:     #34d399;
  --accent-soft:  rgba(16, 185, 129, 0.14);
  --accent-tint:  rgba(16, 185, 129, 0.10);
  --accent-tint-h:rgba(16, 185, 129, 0.22);
  --ok:           #10b981;
  --warn:         #fbbf24;
  --warn-soft:    rgba(251, 191, 36, 0.10);
  --warn-border:  rgba(251, 191, 36, 0.45);
  --warn-code-bg: rgba(0, 0, 0, 0.25);

  --fail-bg:        rgba(220, 38, 38, 0.18);
  --fail-bg-hover:  rgba(220, 38, 38, 0.28);
  --fail-border-hov:rgba(248, 113, 113, 0.5);
  --fail-text:      #f87171;
  --fail-current:   #dc2626;
  --fail-tint:      rgba(248, 113, 113, 0.08);
  --fail-tint-h:    rgba(248, 113, 113, 0.16);

  --ok-jump-bg:     rgba(16, 185, 129, 0.14);
  --ok-jump-hover:  rgba(16, 185, 129, 0.22);
  --ok-jump-border: rgba(16, 185, 129, 0.45);

  --bar-rest:     #d4d4d8;
  --track:        #232328;

  --video-bg:     #000;
}

html { color-scheme: light dark; }
[data-theme="light"] html, html[data-theme="light"] { color-scheme: light; }
[data-theme="dark"]  html, html[data-theme="dark"]  { color-scheme: dark; }

html, body { background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: 'tnum' 1, 'lnum' 1, 'kern' 1, 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove old paper grain */
.paper-grain { display: none; }

/* ============================================================
   HEADER
   ============================================================ */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  height: var(--header-h);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.project-page-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.project-page-link:hover {
  background: var(--surface-3);
  color: var(--text);
}
.project-page-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
}
.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"]  .theme-toggle .icon-sun  { display: block; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.brand-sub {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: -0.005em;
}

#breadcrumb {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 4px;
}
#breadcrumb a {
  color: var(--text-2);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
#breadcrumb a:hover { color: var(--text); background: var(--surface-3); }
#breadcrumb .sep { color: var(--text-3); margin: 0 2px; user-select: none; }
#breadcrumb span:not(.sep) { color: var(--text); font-weight: 600; padding: 4px 8px; }

/* ============================================================
   MAIN
   ============================================================ */
main {
  position: relative;
  z-index: 1;
  padding: 40px 32px 80px;
  max-width: 1440px;
  margin: 0 auto;
}

.loading {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  padding: 40px 0;
}
.loading::after {
  content: '';
  display: inline-block;
  width: 4px; height: 4px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
  vertical-align: 2px;
}
@keyframes pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ============================================================
   HOME
   ============================================================ */
.home-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.home-intro .home-title {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
}
.home-intro .home-title .dot { color: var(--accent); }
.home-title-group {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.home-intro .home-sub {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-2);
  text-align: right;
  line-height: 1.55;
  font-weight: 400;
}

.home-intro-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.metric-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.metric-switch {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.metric-switch button {
  min-height: 30px;
  padding: 5px 11px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.metric-switch button:hover { color: var(--text); }
.metric-switch button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.metric-switch button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.metric-description {
  margin: 0;
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: 11.5px;
  line-height: 1.35;
}

.tp-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tp-mode-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.tp-select {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.tp-select:hover { background: var(--surface-2); border-color: var(--border-2); }

.page-link {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.page-link:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--accent);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* Throughput scatter container (ECharts mounts here) */
.tp-chart {
  width: 100%;
  height: 300px;
}
.tp-chart-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fail-text);
  text-align: center;
  padding: 12px;
}

/* Pairwise overall speedup matrix */
.pairwise-card {
  padding: 22px 26px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.pairwise-head { margin-bottom: 16px; }
.pairwise-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.pairwise-sub {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-3);
}
.pairwise-sub b { color: var(--accent-2); font-weight: 700; }
.pairwise-scroll { overflow-x: auto; }
.pairwise-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}
.pairwise-table th,
.pairwise-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.pairwise-table thead th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: capitalize;
  background: var(--surface-2);
}
.pairwise-table .pw-corner { background: var(--surface); border-right-color: var(--border); }
.pairwise-table tbody th.pw-row {
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: capitalize;
  background: var(--surface-2);
  white-space: nowrap;
}
.pw-pct {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.pw-n {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
}
.pw-diag { background: var(--surface-3); color: var(--text-3); }
.pw-na { color: var(--text-3); }

.pairwise-method {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.pw-method-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.pairwise-method ol {
  margin: 0 0 10px;
  padding-left: 20px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
}
.pairwise-method li { margin-bottom: 3px; }
.pairwise-method code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  background: var(--surface-3);
  border-radius: 4px;
  color: var(--text);
}
.pw-method-caveat {
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
}
.pw-method-caveat b { color: var(--text-2); }
.chart-card {
  padding: 24px 26px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chart-card:hover {
  border-color: var(--border-2);
}

.chart-card h3 {
  margin: 0 0 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
  text-transform: capitalize;
  color: var(--text);
}
.chart-card h3 .task-name::after { content: none; }
.chart-card h3 .trials {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
  flex-shrink: 0;
  white-space: nowrap;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-row {
  display: grid;
  grid-template-columns: 128px 1fr 100px;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
  position: relative;
}
.bar-row:hover { background: var(--surface-2); }
.bar-row.dim { opacity: 0.55; pointer-events: none; }
.bar-row.error-row { color: var(--warn); }

.bar-label {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.005em;
}

/* Best row uses accent. */
.bar-row.best .bar-label { color: var(--text); font-weight: 700; }

.bar-track {
  height: 8px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--bar-rest);
  border-radius: 999px;
  transition: width 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.bar-row.best .bar-fill { background: var(--accent); }
.bar-row.error-row .bar-fill { background: var(--warn); }
.bar-fill.missing { background: var(--border); width: 100% !important; }
.bar-fill.error   { background: var(--warn); width: 12% !important; opacity: 0.5; }

/* Value: pct (bold sans) + ratio (mono, small) */
.bar-value {
  text-align: right;
  white-space: nowrap;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  display: flex;
  align-items: baseline;
  gap: 4px;
  justify-content: flex-end;
}
.bar-value .pct {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}
.bar-value .pct-sym {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  line-height: 1;
  margin-left: -1px;
}
.bar-value .ratio {
  display: block;
  width: 100%;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  text-align: right;
}
.bar-row.best .bar-value .pct { color: var(--accent); }
.bar-row.best .bar-value .pct-sym { color: var(--accent-2); }
.bar-row.dim .bar-value {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-3);
  font-size: 14px;
}
.bar-row.error-row .bar-value {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--warn);
}

/* Stack pct + ratio vertically: wrap them so ratio drops to next line */
.bar-value {
  flex-wrap: wrap;
  align-content: center;
  row-gap: 0;
}

/* ============================================================
   EPISODES TABLE
   ============================================================ */
.episodes-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
}
.episodes-header h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}
.episodes-header h2 .x {
  font-weight: 400;
  color: var(--text-3);
  margin: 0 0.32em;
  font-size: 0.82em;
}
.episodes-header h2 .accent {
  color: var(--text);
  font-weight: 500;
}

.run-meta {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  gap: 10px 18px;
  justify-content: end;
}
.run-meta .meta-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.run-meta dt {
  font-family: var(--font-sans);
  font-size: 10.5px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.run-meta dd {
  margin: 0;
  min-width: 0;
  max-width: 100%;
}
.run-meta code {
  display: block;
  max-width: 360px;
  padding: 3px 8px;
  background: var(--surface-3);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.episodes-meta {
  text-align: left;
}

.episode-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.episode-table th, .episode-table td {
  padding: 11px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.episode-table tbody tr:last-child td { border-bottom: 1px solid var(--border); }
.episode-table th:first-child, .episode-table td:first-child { text-align: left; }
.episode-table th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-2);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: sticky;
  top: var(--header-h);
  z-index: 3;
  border-bottom: 1px solid var(--border-2);
  vertical-align: bottom;
  padding: 14px 16px 11px;
}
.episode-table th:first-child {
  border-top-left-radius: var(--radius);
}
.episode-table th:last-child {
  border-top-right-radius: var(--radius);
}
.stage-total {
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.episode-table tbody tr {
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.episode-table tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.episode-table tbody tr:hover { background: var(--surface-2); }
.episode-table tbody tr.success-row { background: var(--accent-tint); }
.episode-table tbody tr.success-row:hover { background: var(--accent-tint-h); }
.episode-table tbody tr.failure-row { background: var(--fail-tint); }
.episode-table tbody tr.failure-row:hover { background: var(--fail-tint-h); }

.episode-table .cell {
  font-size: 15px;
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1;
}
.episode-table .cell.ok { color: var(--accent); }
.episode-table .cell.fail { color: var(--fail-text); font-weight: 600; }

.episode-table a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.episode-table a:hover { color: var(--accent); }

/* Sticky summary footer */
.episode-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  border-top: 1px solid var(--border-2);
  padding: 12px 16px;
}
.episode-table tfoot tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
.episode-table tfoot tr:last-child td:last-child  { border-bottom-right-radius: var(--radius); }
.episode-table tfoot tr.summary-row td:first-child {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text);
}

/* ============================================================
   VIDEO PAGE
   ============================================================ */
.video-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
}
.video-nav::before, .video-nav::after { display: none; }

.video-nav h2 {
  margin: 0;
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.015em;
  line-height: 1;
  color: var(--text);
}
.video-nav h2 .accent { color: var(--accent); font-weight: 700; }

.video-nav a {
  color: var(--text-2);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
.video-nav a:hover { background: var(--surface-2); color: var(--text); }
.video-nav .left-nav { text-align: left; }
.video-nav .right-nav { text-align: right; }
.video-nav .dim {
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
}

.video-run-meta {
  grid-template-columns: minmax(130px, 1fr) minmax(90px, 0.7fr) minmax(140px, 1fr) minmax(280px, 2.2fr);
  justify-content: stretch;
  gap: 0;
  margin-bottom: 16px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.video-run-meta .meta-item {
  min-height: 66px;
  justify-content: center;
  padding: 12px 16px;
}
.video-run-meta .meta-item:not(:first-child) {
  border-left: 1px solid var(--border);
}
.video-run-meta code {
  max-width: 100%;
  padding: 0;
  background: transparent;
  border-radius: 0;
  color: var(--text);
  font-size: 12px;
}
.video-run-meta .meta-item:nth-child(4) code {
  color: var(--text-2);
  font-size: 11.5px;
}

.model-compare {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.model-compare-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.model-compare-head span {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
}
.model-compare-head code {
  padding: 2px 8px;
  background: var(--surface-3);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
}
.model-compare-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}
.model-option {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  grid-template-areas:
    "policy status"
    "name name";
  gap: 3px 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.model-option:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
}
.model-option.current {
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--text-3);
}
.model-option.current.ok {
  border-color: var(--ok-jump-border);
  box-shadow: inset 3px 0 0 var(--accent);
}
.model-option.current.fail {
  border-color: var(--fail-border-hov);
  box-shadow: inset 3px 0 0 var(--fail-current);
}
.model-option.current.missing {
  border-color: var(--border-2);
  box-shadow: inset 3px 0 0 var(--text-3);
}
.model-option.unavailable {
  cursor: default;
  opacity: 0.62;
}
.model-option.unavailable:hover {
  background: var(--surface-2);
  border-color: var(--border);
}
.model-policy {
  grid-area: policy;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-name {
  grid-area: name;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.model-status {
  grid-area: status;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  text-align: right;
  white-space: nowrap;
}
.model-option.ok .model-status { color: var(--accent-2); }
.model-option.fail .model-status { color: var(--fail-text); }
.model-option.missing .model-status { color: var(--text-3); }

.ep-stages {
  margin-bottom: 20px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ep-stages .meta-line {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  margin-right: 12px;
}
.badge {
  background: var(--surface-3);
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--text-2);
}
.badge.ok   { color: var(--accent-2); background: var(--accent-soft); border-color: transparent; }
.badge.fail { color: var(--text-3); background: var(--surface-3); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.video-slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.video-slot-label {
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.video-slot-label::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--fail-current);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--fail-bg);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.video-slot.playing .video-slot-label::after {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.video-slot video {
  width: 100%;
  display: block;
  background: var(--video-bg);
  max-height: 600px;
}
.video-slot.missing .video-missing-box {
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-3);
  padding: 24px;
  text-align: center;
  gap: 8px;
  background-image: none;
}
.video-slot.missing .video-missing-box > div:first-child {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-2);
  letter-spacing: -0.005em;
}
.video-slot.missing code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  background: transparent;
}
.video-slot.missing .video-slot-label::after { display: none; }

.video-disclaimer {
  margin: 16px 0 20px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.sync-note {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-3);
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: -8px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-note::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* Episode jump strip */
.episode-jump {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 2;
}
.episode-jump-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}
.episode-jump a {
  display: inline-block;
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 0 3px 4px 0;
  transition: all 0.12s ease;
  min-width: 38px;
  text-align: center;
}
.episode-jump a:hover { background: var(--surface-3); border-color: var(--border-2); color: var(--text); }
.episode-jump a.current {
  background: var(--text);
  color: var(--text-on-dark);
  border-color: var(--text);
}
.episode-jump a.ok {
  background: var(--ok-jump-bg);
  border-color: var(--ok-jump-bg);
  color: var(--accent-2);
}
.episode-jump a.ok:hover { background: var(--ok-jump-hover); border-color: var(--ok-jump-border); }
.episode-jump a.fail {
  background: var(--fail-bg);
  border-color: var(--fail-bg);
  color: var(--fail-text);
}
.episode-jump a.fail:hover { background: var(--fail-bg-hover); border-color: var(--fail-border-hov); }
.episode-jump a.current.ok {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.episode-jump a.current.fail {
  background: var(--fail-current);
  color: #ffffff;
  border-color: var(--fail-current);
}

/* ============================================================
   ERRORS
   ============================================================ */
.error-box {
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-left: 4px solid var(--warn);
  padding: 18px 22px;
  border-radius: var(--radius);
}
.error-box h2 {
  margin: 0 0 6px 0;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.015em;
  color: var(--warn);
}
.error-box p {
  margin: 4px 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-2);
}
.error-box code {
  background: var(--warn-code-bg);
  border: 1px solid var(--warn-border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
  .home-intro { flex-direction: column; align-items: flex-start; gap: 12px; }
  .home-intro-right { align-items: flex-start; }
  .home-intro .home-sub { text-align: left; }
  .episodes-header { grid-template-columns: 1fr; }
  .run-meta { grid-template-columns: 1fr; justify-content: stretch; }
  .video-run-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-run-meta .meta-item:not(:first-child) { border-left: 0; }
  .video-run-meta .meta-item:nth-child(even) { border-left: 1px solid var(--border); }
  .video-run-meta .meta-item:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .episodes-meta { text-align: left; }
  .run-meta code { max-width: 100%; }
  .model-compare-list { grid-template-columns: 1fr; }
  .model-option {
    grid-template-columns: 1fr;
    grid-template-areas: "policy" "name" "status";
  }
  .model-status { text-align: left; }
  main { padding: 28px 20px 64px; }
  header { padding: 0 20px; }
  .project-page-label { display: none; }
}

@media (max-width: 560px) {
  .video-run-meta { grid-template-columns: 1fr; }
  .video-run-meta .meta-item:nth-child(even) { border-left: 0; }
  .video-run-meta .meta-item:not(:first-child) { border-top: 1px solid var(--border); }
}

/* ============================================================
   CONDITIONAL SUCCESS FUNNEL (Sankey)
   ============================================================ */
.funnel-card {
  margin: 18px 0 26px;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.funnel-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.funnel-head h3 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.funnel-note {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-2);
}
.funnel-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  margin-top: 2px;
}

/* Sankey flows: green = success path / success outcome, red = failures. */
.funnel-flow { stroke: none; }
.funnel-flow.spine   { fill: var(--accent-tint-h); }
.funnel-flow.success { fill: var(--accent); opacity: 0.55; }
.funnel-flow.win     { fill: var(--accent); opacity: 0.42; }
.funnel-flow.fail    { fill: var(--fail-text); opacity: 0.38; }

/* Thin node bars at each column. */
.funnel-bar.start   { fill: var(--border-strong); }
.funnel-bar.spine   { fill: var(--accent); opacity: 0.85; }
.funnel-bar.success { fill: var(--accent); }
.funnel-bar.win     { fill: var(--accent); }
.funnel-bar.fail    { fill: var(--fail-text); }

/* Labels: spine stages sit above their column; branch/failure blocks beside. */
.funnel-name {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--text);
}
.funnel-name.success, .funnel-name.win { fill: var(--accent); }
.funnel-name.fail { fill: var(--fail-text); }
.funnel-name.start { fill: var(--text-3); font-weight: 500; }
.funnel-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--text-2);
}
.funnel-sub.success, .funnel-sub.win { fill: var(--accent); }
.funnel-sub.fail { fill: var(--fail-text); }
.funnel-sub.start { fill: var(--text-3); }
.funnel-result {
  margin-top: 10px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text);
}
.funnel-result .ok-pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}
.funnel-result .dim { color: var(--text-2); }

/* Success-rate chip in the episodes "policy × task" header. */
.hdr-rate {
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.62em;
  vertical-align: middle;
  letter-spacing: -0.01em;
}

/* ============================================================
   CORRELATION PAGE
   ============================================================ */
.page-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* McNemar significance marker in the agreement matrix. */
.pw-sig { color: var(--accent-2); font-size: 0.7em; font-weight: 800; }

/* Role legend (key for the column grouping). */
.corr-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
  padding: 12px 18px;
  margin-bottom: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-2);
}
.corr-legend-group { display: inline-flex; align-items: center; gap: 8px; }
.corr-legend-role {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.corr-legend-role.main { color: var(--accent-2); background: var(--accent-soft); }
.corr-legend-role.ablation { color: var(--text-2); background: var(--surface-3); }
.corr-legend-role.baseline { color: var(--warn); background: var(--warn-soft); }

/* Eyeball-edge cards (vs ablations / vs baselines). */
.corr-edge {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.edge-card {
  padding: 20px 24px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.edge-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.edge-head h3 {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}
.edge-note {
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
  text-align: right;
  max-width: 55%;
}
.edge-headline {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-2);
  padding: 10px 13px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.edge-headline b { color: var(--accent-2); font-weight: 800; }
.edge-headline .dim { color: var(--text-3); font-weight: 600; }
.edge-rows { display: flex; flex-direction: column; }
.edge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 14px;
  align-items: baseline;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.edge-policy {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edge-stat { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.edge-stat small { font-family: var(--font-sans); font-size: 10px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.edge-stat.win { color: var(--accent-2); }
.edge-stat.loss { color: var(--fail-text); }
.edge-stat.zero { color: var(--text-3); }
.edge-n { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

/* Per-task success matrix (policies = rows, episodes = columns). */
.corr-subhead {
  margin: 30px 0 4px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.corr-subnote {
  margin: 0 0 18px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-3);
}
.corr-card.wide { grid-column: 1 / -1; }
.corr-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.corr-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 4px 10px;
}
.corr-divider { grid-column: 1 / -1; height: 1px; background: var(--border); margin: 2px 0; }
.corr-rowlabel {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.corr-rowlabel.main { font-weight: 700; color: var(--text); }
.corr-cells { display: grid; gap: 1px; min-width: 0; }
.corr-cell {
  height: 17px;
  border-radius: 2px;
  display: block;
  min-width: 0;
  transition: outline 0.1s ease;
}
.corr-cell.ok { background: var(--accent); }
.corr-cell.fail { background: var(--fail-bg-hover); }
.corr-cell.na {
  background: repeating-linear-gradient(45deg, var(--surface-3) 0, var(--surface-3) 2px, var(--surface-2) 2px, var(--surface-2) 4px);
}
a.corr-cell:hover {
  outline: 2px solid var(--text);
  outline-offset: -1px;
  position: relative;
  z-index: 2;
}
.corr-rate {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  text-align: right;
}

/* Instant hover tooltip for the agreement matrix + success-matrix cells. */
.corr-tip {
  position: fixed;
  z-index: 200;
  display: none;
  pointer-events: none;
  max-width: 340px;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}
.corr-tip .t2-text { white-space: pre-line; }
.corr-tip .t2-title { font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.corr-tip .t2-title .dim { color: var(--text-3); font-weight: 400; }
.corr-tip .t2-grid { border-collapse: collapse; margin: 0 0 6px; }
.corr-tip .t2-grid th {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-3);
  padding: 2px 7px;
  text-align: center;
  white-space: nowrap;
}
.corr-tip .t2-grid th:first-child { text-align: right; }
.corr-tip .t2-grid td {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  padding: 4px 11px;
  border: 1px solid var(--border);
  min-width: 30px;
}
.corr-tip .t2-grid .t2-win { background: var(--accent-soft); color: var(--accent-2); }
.corr-tip .t2-grid .t2-lose { background: var(--fail-bg); color: var(--fail-text); }
.corr-tip .t2-grid .t2-split { color: var(--text-2); }
.corr-tip .t2-verdict { font-size: 10.5px; color: var(--text-2); }
.corr-tip .t2-verdict.dim { color: var(--text-3); }
.corr-tip .t2-verdict b { color: var(--accent-2); }

@media (max-width: 900px) {
  .corr-edge { grid-template-columns: 1fr; }
}

/* Episode-agreement panel (success-count spectrum + unanimous-episode lists). */
.agree-card {
  padding: 20px 24px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.agree-head { margin-bottom: 16px; }
.agree-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.agree-sub { font-family: var(--font-sans); font-size: 12.5px; color: var(--text-2); }
.agree-sub b { color: var(--text); font-weight: 700; }
.agree-sub .dim { color: var(--text-3); }
.agree-kappa { font-family: var(--font-mono); font-weight: 700; color: var(--accent-2); }
.agree-body {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.5fr);
  gap: 26px;
}
.agree-spectrum-title {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 12px;
  line-height: 1.45;
}
.agree-bar-row {
  display: grid;
  grid-template-columns: 66px 1fr 30px;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}
.agree-bar-k { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; text-align: right; }
.agree-bar-k.fail { color: var(--fail-text); font-weight: 600; }
.agree-bar-k.ok { color: var(--accent-2); font-weight: 600; }
.agree-bar-track { height: 14px; background: var(--track); border-radius: 4px; overflow: hidden; }
.agree-bar-fill { height: 100%; border-radius: 4px; background: var(--border-strong); transition: width 0.5s ease; }
.agree-bar-fill.fail { background: var(--fail-current); }
.agree-bar-fill.ok { background: var(--accent); }
.agree-bar-n { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); text-align: right; }
.agree-lists { display: flex; flex-direction: column; gap: 14px; }
.agree-list-head {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agree-list-head.ok { color: var(--accent-2); }
.agree-list-head.fail { color: var(--fail-text); }
.agree-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 8px;
}
.agree-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.agree-chip {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  padding: 3px 8px;
  font-family: var(--font-sans);
  font-size: 11px;
  text-decoration: none;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.agree-chip b { font-family: var(--font-mono); font-weight: 700; }
.agree-chip.ok { background: var(--ok-jump-bg); color: var(--accent-2); }
.agree-chip.ok:hover { background: var(--ok-jump-hover); border-color: var(--ok-jump-border); }
.agree-chip.fail { background: var(--fail-bg); color: var(--fail-text); }
.agree-chip.fail:hover { background: var(--fail-bg-hover); border-color: var(--fail-border-hov); }
.agree-empty { font-family: var(--font-sans); font-size: 11.5px; color: var(--text-3); }

@media (max-width: 900px) {
  .agree-body { grid-template-columns: 1fr; gap: 18px; }
}

.pw-cell[data-tip2x2] { cursor: pointer; }

/* ============================================================
   PAIR DETAIL PAGE
   ============================================================ */
.pair-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.pair-header h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.025em;
  color: var(--text);
}
.pair-header h2 .x { font-weight: 400; color: var(--text-3); margin: 0 0.3em; font-size: 0.8em; }
.pair-header h2 .accent { color: var(--accent); }
.pair-head-stats { font-family: var(--font-sans); font-size: 13px; color: var(--text-2); }
.pair-head-stats b { color: var(--text); font-weight: 700; }

.pair-pooled { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.pair-2x2 { border-collapse: collapse; }
.pair-2x2 th {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  padding: 4px 12px;
  white-space: nowrap;
}
.pair-2x2 th:first-child { text-align: right; }
.pair-2x2 td {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  padding: 10px 18px;
  border: 1px solid var(--border);
  min-width: 56px;
}
.pair-2x2 .pair2-win { background: var(--accent-soft); color: var(--accent-2); }
.pair-2x2 .pair2-lose { background: var(--fail-bg); color: var(--fail-text); }
.pair-2x2 .pair2-split { color: var(--text-2); }
.pair-pooled-note { font-family: var(--font-sans); font-size: 11.5px; color: var(--text-3); max-width: 220px; line-height: 1.45; }

.pair-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
  overflow: hidden;
}
.pair-table th, .pair-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pair-table tbody tr:last-child td { border-bottom: none; }
.pair-table thead th {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: capitalize;
  border-bottom: 1px solid var(--border-2);
}
.pair-table th:first-child, .pair-table td:first-child { text-align: left; }
.pair-table tbody tr:hover { background: var(--surface-2); }
.pair-table td.pair-task a { color: var(--text); text-decoration: none; font-weight: 600; text-transform: capitalize; }
.pair-table td.pair-task a:hover { color: var(--accent); }
.pair-table td.pair-agree { color: var(--text); font-weight: 700; }
.pair-table td.pair-phi { font-family: var(--font-mono); font-weight: 700; color: var(--text); }
.pair-table td.pair-sig { color: var(--accent-2); font-family: var(--font-mono); font-weight: 700; }
.pair-table td.pair-dim { color: var(--text-3); font-family: var(--font-mono); }

.pair-subhead { margin: 0 0 16px; font-family: var(--font-sans); font-weight: 700; font-size: 16px; color: var(--text); }
.pair-subhead .dim { font-weight: 400; font-size: 12px; color: var(--text-3); }

/* Divergence palette: gold (A wins) vs blue (B wins) — neutral "two sides"
   colors, not good/bad. both-pass stays green, both-fail red. */
:root {
  --gold: #a16207; --gold-bg: rgba(202,138,4,0.12); --gold-bg-h: rgba(202,138,4,0.20); --gold-border: rgba(202,138,4,0.45);
  --blue: #1d4ed8; --blue-bg: rgba(37,99,235,0.10); --blue-bg-h: rgba(37,99,235,0.18); --blue-border: rgba(37,99,235,0.40);
}
[data-theme="dark"] {
  --gold: #fbbf24; --gold-bg: rgba(251,191,36,0.14); --gold-bg-h: rgba(251,191,36,0.24); --gold-border: rgba(251,191,36,0.45);
  --blue: #60a5fa; --blue-bg: rgba(96,165,250,0.14); --blue-bg-h: rgba(96,165,250,0.24); --blue-border: rgba(96,165,250,0.45);
}

/* Per-task 2×2 episode matrix: each quadrant holds its episodes (click to watch). */
.ptm-wrap { display: flex; flex-direction: column; gap: 26px; }
.ptm-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.ptm-name { font-family: var(--font-sans); font-weight: 700; font-size: 15px; text-transform: capitalize; color: var(--text); }
.ptm-stat { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }
.ptm-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ptm-corner { background: var(--surface); }
.ptm-colh, .ptm-rowh {
  background: var(--surface-2);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  white-space: nowrap;
}
.ptm-cell { background: var(--surface); padding: 9px 11px; min-width: 0; }
.ptm-cell.win  { background: var(--accent-tint); }
.ptm-cell.lose { background: var(--fail-tint); }
.ptm-cell.gold { background: var(--gold-bg); }
.ptm-cell.blue { background: var(--blue-bg); }
.ptm-cell-head { font-family: var(--font-sans); font-size: 10.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.ptm-cnt { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--text-3); background: var(--surface); border-radius: 999px; padding: 1px 7px; }
.ptm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ptm-chip {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.ptm-chip:hover { border-color: var(--border-strong); color: var(--text); }
.ptm-empty { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
