/* ============================================================
   MaCBench Leaderboard — "Lab instrument readout"
   Warm charcoal surface · acidic-lime signal · Bricolage + Geist Mono
   ============================================================ */

:root {
  /* Surfaces — warm charcoal, never pure black */
  --bg: #14161a;
  --bg-2: #181b20;
  --panel: #1c2026;
  --panel-2: #21262d;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  /* Text */
  --t1: rgba(244, 247, 250, 0.95);
  --t2: rgba(244, 247, 250, 0.58);
  --t3: rgba(244, 247, 250, 0.36);

  /* Signal — phosphorescent lime, used sparingly */
  --signal: #c8f135;
  --signal-dim: #9bbf24;
  --signal-glow: rgba(200, 241, 53, 0.18);

  /* Secondary accents */
  --cyan: #5ad1e6;
  --amber: #ffb347;

  /* Score scale (low → high) */
  --score-lo: #3a4148;
  --score-hi: var(--signal);

  --display: "Bricolage Grotesque", Georgia, serif;
  --body: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --maxw: 1180px;
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--t1);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: var(--t1); text-decoration: none; }
a:hover { color: var(--signal); }

/* ---------- Atmospheric background ---------- */
.bg-grid, .bg-glow, .bg-noise { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bg-grid {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 35%, transparent 78%);
  opacity: 0.5;
}
.bg-glow {
  background:
    radial-gradient(620px 420px at 82% -8%, var(--signal-glow), transparent 70%),
    radial-gradient(560px 380px at 8% 4%, rgba(90, 209, 230, 0.10), transparent 72%);
}
.bg-noise {
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 28px 80px;
}

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  color: var(--signal);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(200,241,53,0.10), transparent);
  box-shadow: 0 0 24px -8px var(--signal-glow), inset 0 1px 0 rgba(255,255,255,0.04);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; }
.kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--t3);
}
.brand-text h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
  margin: 3px 0 0;
  letter-spacing: -0.02em;
}
.masthead-links { display: flex; gap: 4px; flex-wrap: wrap; }
.masthead-links a {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--t2);
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.masthead-links a:hover {
  color: var(--t1);
  border-color: var(--line-strong);
  background: var(--panel);
}
.masthead-links a.cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--bg);
  background: var(--signal);
  border-color: var(--signal);
  font-weight: 600;
  margin-left: 4px;
}
.masthead-links a.cta:hover {
  background: var(--signal-dim);
  border-color: var(--signal-dim);
  color: var(--bg);
  box-shadow: 0 0 20px -6px var(--signal-glow);
}
.masthead-links a.cta svg { width: 15px; height: 15px; }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 40px; max-width: 880px; }
.hero-lede {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--t1);
}
.hero-lede em {
  font-style: italic;
  color: var(--signal);
  font-weight: 600;
}

/* ---------- Stat strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 40px;
}
.stat {
  background: var(--panel);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.25s var(--ease);
}
.stat:hover { background: var(--panel-2); }
.stat-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--t3);
  display: flex;
  align-items: center;
  gap: 7px;
}
.stat-label svg { width: 14px; height: 14px; color: var(--t2); }
.stat-value {
  font-family: var(--display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-signal .stat-value { color: var(--signal); }

/* ---------- Controls ---------- */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.control { display: flex; align-items: center; }
.search-control {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
}
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--t3); pointer-events: none;
}
#search {
  width: 100%;
  font-family: var(--body);
  font-size: 14px;
  color: var(--t1);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 14px 11px 40px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
#search::placeholder { color: var(--t3); }
#search:focus {
  outline: none;
  border-color: var(--signal-dim);
  box-shadow: 0 0 0 3px var(--signal-glow);
}

.version-control { gap: 9px; }
.version-control label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
}
.select-wrap { position: relative; display: flex; align-items: center; }
.select-wrap svg {
  position: absolute; right: 11px; width: 15px; height: 15px;
  color: var(--t2); pointer-events: none;
}
#version {
  appearance: none;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--t1);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 34px 10px 14px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
}
#version:hover { border-color: var(--line-strong); }
#version:focus { outline: none; border-color: var(--signal-dim); box-shadow: 0 0 0 3px var(--signal-glow); }

.filters { gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--t2);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.chip svg { width: 15px; height: 15px; }
.chip:hover { color: var(--t1); border-color: var(--line-strong); }
.chip[aria-pressed="true"] {
  color: var(--bg);
  background: var(--signal);
  border-color: var(--signal);
  font-weight: 500;
}
.chip-ghost[aria-expanded="true"] {
  color: var(--signal);
  border-color: var(--signal-dim);
  background: rgba(200, 241, 53, 0.07);
}

/* ---------- Column panel ---------- */
.columns-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
  animation: panel-in 0.28s var(--ease);
}
@keyframes panel-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.columns-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.columns-panel-head > span {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--t3);
}
.columns-panel-actions { display: flex; gap: 6px; }
.columns-panel-actions button {
  font-family: var(--mono); font-size: 11.5px; color: var(--t2);
  background: transparent; border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 11px; cursor: pointer;
  transition: all 0.18s var(--ease);
}
.columns-panel-actions button:hover { color: var(--signal); border-color: var(--signal-dim); }
.columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px 10px;
}
.col-check {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12px; color: var(--t2);
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.col-check:hover { background: var(--panel-2); color: var(--t1); }
.col-check input { appearance: none; width: 15px; height: 15px; margin: 0; flex-shrink: 0;
  border: 1.5px solid var(--line-strong); border-radius: 4px; cursor: pointer; position: relative;
  transition: all 0.15s var(--ease); }
.col-check input:checked { background: var(--signal); border-color: var(--signal); }
.col-check input:checked::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.col-check input:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---------- Board / table ---------- */
.board-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  overflow: hidden;
}
.board-scroll { overflow-x: auto; }
.board {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.board thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--t2);
  text-align: right;
  padding: 14px 14px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.15s var(--ease);
}
.board thead th:hover { color: var(--signal); }
.board thead th.col-rank { text-align: center; width: 52px; cursor: default; }
.board thead th.col-rank:hover { color: var(--t2); }
.board thead th.col-model { text-align: left; position: sticky; left: 0; z-index: 3; }
.board thead th.col-flags { text-align: center; }
.sort-ind { color: var(--signal); margin-left: 5px; font-size: 10px; }

.board tbody td {
  padding: 14px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--t2);
  white-space: nowrap;
}
.board tbody tr { transition: background 0.12s var(--ease); }
.board tbody tr:hover { background: rgba(200, 241, 53, 0.035); }
.board tbody tr:last-child td { border-bottom: none; }

.col-rank { text-align: center !important; color: var(--t3) !important; width: 52px; }
td.col-rank .medal { color: var(--signal); font-weight: 600; }

.col-model {
  text-align: left !important;
  position: sticky; left: 0; z-index: 1;
  background: var(--bg-2);
  font-family: var(--body) !important;
  font-size: 14px !important;
  color: var(--t1) !important;
  font-weight: 500;
  max-width: 300px;
}
.col-model .model-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}
.board tbody td.col-model {
  display: flex;
  align-items: center;
  gap: 7px;
}
.board tbody tr:hover .col-model { background: #1d2228; }

/* Verified badge */
.verified-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--signal);
  line-height: 0;
}
.verified-badge svg { width: 16px; height: 16px; }

.col-overall { color: var(--t1) !important; font-weight: 600; font-size: 14px !important; }

.col-released { color: var(--t2) !important; white-space: nowrap; }
.board thead th.col-released { text-align: right; }

/* score cell heat tint applied inline via JS (background) */
.score-cell { position: relative; }

.col-flags { text-align: center !important; }
.flag-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; margin: 0 2px;
  border: 1px solid var(--line-strong); color: var(--t3);
}
.flag-dot svg { width: 13px; height: 13px; }
.flag-dot.on { color: var(--signal); border-color: var(--signal-dim); background: rgba(200,241,53,0.08); }

/* mini score bar under overall */
.overall-wrap { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.overall-bar { width: 56px; height: 3px; border-radius: 2px; background: var(--score-lo); overflow: hidden; }
.overall-bar > span { display: block; height: 100%; background: var(--signal); border-radius: 2px; }

/* ---------- Board states (loading / empty / error) ---------- */
.board-state {
  padding: 56px 20px; text-align: center;
  font-family: var(--mono); font-size: 13px; color: var(--t2);
}
.board-state.error { color: var(--amber); }
.board-note {
  margin: 0 auto 20px; max-width: 52ch;
  color: var(--signal); font-size: 12.5px; line-height: 1.5;
}
.board-error-detail { margin-top: 6px; color: var(--t3); font-size: 12px; }
.board-error-hint { margin-top: 10px; color: var(--t2); font-size: 12.5px; }
.board-retry {
  margin-top: 18px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 500;
  color: var(--bg); background: var(--signal); border: 1px solid var(--signal);
  border-radius: 9px; padding: 9px 18px; cursor: pointer;
  transition: background 0.18s var(--ease);
}
.board-retry:hover { background: var(--signal-dim); }
.skeleton-row { display: flex; gap: 14px; padding: 14px; }
.skeleton-row > div { height: 16px; border-radius: 5px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Footer columns ---------- */
.footer-cols {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 26px;
  margin-top: 48px;
}
.about h2, .cite h2 {
  font-family: var(--display); font-weight: 700; font-size: 19px;
  margin: 0 0 12px; letter-spacing: -0.01em;
}
.about p { color: var(--t2); margin: 0 0 12px; max-width: 56ch; }
.about a { color: var(--signal); text-decoration: underline; text-decoration-color: var(--signal-dim); text-underline-offset: 3px; }
.about .muted { font-size: 13px; color: var(--t3); }
.about .muted a { color: var(--t2); }

.cite-head { display: flex; align-items: center; justify-content: space-between; }
#copy-cite {
  font-family: var(--mono); font-size: 11.5px; color: var(--t2);
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 13px; cursor: pointer; transition: all 0.18s var(--ease);
}
#copy-cite:hover { color: var(--signal); border-color: var(--signal-dim); }
#copy-cite.copied { color: var(--bg); background: var(--signal); border-color: var(--signal); }
#citation {
  font-family: var(--mono); font-size: 11px; line-height: 1.55;
  color: var(--t2); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; overflow-x: auto; margin: 0;
}

.colophon {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11.5px; color: var(--t3);
}
.colophon a { color: var(--t2); }
.colophon a:hover { color: var(--signal); }

/* ---------- Entrance animation ---------- */
.masthead, .hero, .stats, .controls, .board-wrap, .footer-cols {
  animation: rise 0.6s var(--ease) both;
}
.hero { animation-delay: 0.05s; }
.stats { animation-delay: 0.12s; }
.controls { animation-delay: 0.18s; }
.board-wrap { animation-delay: 0.24s; }
.footer-cols { animation-delay: 0.3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Focus ---------- */
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .footer-cols { grid-template-columns: 1fr; }
  .shell { padding: 24px 18px 64px; }
  .hero { padding: 38px 0 30px; }
}
@media (max-width: 560px) {
  .masthead { flex-direction: column; align-items: flex-start; gap: 16px; }
  .search-control { flex-basis: 100%; }
  .stat-value { font-size: 26px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   View toggle + Trends
   ============================================================ */
.view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.view-tab {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--body); font-size: 13.5px; font-weight: 500;
  color: var(--t2); background: transparent; border: none;
  padding: 9px 16px; border-radius: 9px; cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.view-tab svg { width: 16px; height: 16px; }
.view-tab:hover { color: var(--t1); }
.view-tab.is-active { color: var(--bg); background: var(--signal); font-weight: 600; }

/* Trends controls */
.trends-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 22px;
  margin-bottom: 16px;
}
.trends-ctl-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trends-ctl-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--t3);
}
.seg {
  font-family: var(--mono); font-size: 12.5px; color: var(--t2);
  background: var(--panel); border: 1px solid var(--line);
  padding: 8px 13px; cursor: pointer;
  transition: all 0.16s var(--ease);
}
.seg:first-of-type { border-radius: 9px 0 0 9px; }
.seg:last-of-type { border-radius: 0 9px 9px 0; margin-left: -1px; }
.seg:hover { color: var(--t1); }
.seg.is-active { color: var(--bg); background: var(--signal); border-color: var(--signal); font-weight: 500; }
.trends-ctl-group .chip.is-on { color: var(--bg); background: var(--signal); border-color: var(--signal); }

/* Chart */
.chart-wrap {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 20px 18px;
}
.chart-legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; color: var(--t2);
  margin-bottom: 10px;
}
.chart-legend .lg { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend .swatch { width: 11px; height: 11px; border-radius: 50%; }
.chart-legend .swatch.line { width: 16px; height: 0; border-top: 2px solid var(--signal); border-radius: 0; }
#chart-host { width: 100%; overflow: visible; }
#chart-host svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-caption {
  margin-top: 12px; font-family: var(--mono); font-size: 11.5px;
  color: var(--t3); line-height: 1.5; max-width: 70ch;
}

/* Chart primitives */
.ax-line { stroke: var(--line-strong); stroke-width: 1; }
.ax-grid { stroke: var(--line); stroke-width: 1; }
.ax-tick-label { fill: var(--t3); font-family: var(--mono); font-size: 10px; }
.ax-title { fill: var(--t2); font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.frontier-line { fill: none; stroke: var(--signal); stroke-width: 2; }
.frontier-area { fill: var(--signal-glow); opacity: 0.5; }
.dot { cursor: pointer; transition: r 0.12s var(--ease); }
.dot.closed { fill: var(--cyan); }
.dot.open { fill: var(--signal); }
.dot:hover { r: 7; }
.dot-frontier { stroke: #fff; stroke-width: 1.5; }

/* Tooltip */
.chart-tip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 11px 13px; max-width: 260px;
  box-shadow: 0 8px 28px -8px rgba(0,0,0,0.6);
  font-family: var(--mono); font-size: 12px; color: var(--t1);
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s;
}
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip .tip-name { font-family: var(--body); font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.chart-tip .tip-score { color: var(--signal); font-weight: 600; }
.chart-tip .tip-row { color: var(--t2); margin-top: 2px; }
.chart-tip .tip-badge { color: var(--signal); }

@media (max-width: 640px) {
  .trends-controls { gap: 14px; }
  .view-tab { padding: 8px 12px; font-size: 12.5px; }
}

/* ---------- Trends: Overall | By task mode toggle ---------- */
.trends-mode { display: inline-flex; margin-bottom: 18px; }
.trends-mode .seg:first-of-type { border-radius: 9px 0 0 9px; }
.trends-mode .seg:last-of-type { border-radius: 0 9px 9px 0; margin-left: -1px; }

.trends-hint {
  font-family: var(--mono); font-size: 12px; color: var(--t3);
  margin: 0 0 14px;
}

/* ---------- Task small multiples ---------- */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.task-card {
  text-align: left;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 12px 6px; cursor: pointer;
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease), background 0.16s var(--ease);
  font-family: var(--body);
}
.task-card:hover {
  border-color: var(--signal-dim); transform: translateY(-2px);
  background: var(--panel);
}
.task-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.task-card-name {
  font-size: 12.5px; font-weight: 500; color: var(--t1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-card-best {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--signal); font-variant-numeric: tabular-nums;
}
.task-spark { width: 100%; height: 56px; }
.task-spark svg { width: 100%; height: 56px; display: block; }
.spark-line { fill: none; stroke: var(--signal); stroke-width: 1.5; }
.spark-dot.closed { fill: var(--cyan); }
.spark-dot.open { fill: var(--signal); }

/* By-family trajectories */
.fam-line { fill: none; stroke-width: 2; opacity: 0.9; }
.fam-dot { cursor: pointer; }
.fam-reg { fill: #ff5d6c; font-size: 11px; pointer-events: none; }
.fam-reg-key { color: #ff5d6c; font-size: 11px; margin-right: 4px; }
.task-card-reg { color: #ff5d6c; font-size: 13px; }

#task-back { margin-bottom: 14px; }

/* ---------- Trends: fit line + confidence band ---------- */
.trends-mode-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.trends-mode { margin-bottom: 0; }
#fit-toggle.is-on { color: var(--bg); background: var(--cyan); border-color: var(--cyan); }
.fit-line { fill: none; stroke: var(--cyan); stroke-width: 2; stroke-dasharray: 6 4; }
.fit-band { fill: var(--cyan); opacity: 0.12; stroke: none; }
.chart-legend .swatch.fit { width: 16px; height: 0; border-top: 2px dashed var(--cyan); border-radius: 0; }

/* ---------- Fit methodology note ---------- */
.fit-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 2px solid var(--cyan);
  background: rgba(90, 209, 230, 0.06);
  border-radius: 0 8px 8px 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--t2);
  max-width: 78ch;
}
.fit-note strong { color: var(--t1); font-weight: 600; }

/* ============================================================
   Analysis view
   ============================================================ */
.analysis-intro {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 22px;
}
.analysis-intro .trends-hint { margin: 0; max-width: 64ch; }
.analysis-intro .trends-hint a { color: var(--signal); text-decoration: underline; text-underline-offset: 3px; }
#mapping-toggle.is-on { color: var(--bg); background: var(--signal); border-color: var(--signal); }

.analysis-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.analysis-panel {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 20px 18px;
  min-width: 0;
}
.analysis-panel:first-child, .analysis-panel:nth-child(2) {}
.panel-head h3 {
  font-family: var(--display); font-weight: 700; font-size: 18px;
  margin: 0 0 6px; letter-spacing: -0.01em; color: var(--t1);
}
.panel-head p { font-family: var(--mono); font-size: 11.5px; line-height: 1.55; color: var(--t3); margin: 0 0 14px; max-width: 60ch; }
.panel-body .chart-wrap { background: transparent; border: none; padding: 0; }
.analysis-panel .fit-note { font-size: 11px; }

/* diagonal in perception/reasoning */
.diag-line { stroke: var(--t3); stroke-width: 1; stroke-dasharray: 5 4; }

/* pillar bars */
.pillar-bars { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.pillar-bar { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; }
.pillar-bar-label { font-family: var(--mono); font-size: 11.5px; color: var(--t2); display: flex; align-items: center; gap: 7px; }
.dot-swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pillar-bar-track { grid-column: 2; height: 8px; background: var(--panel); border-radius: 4px; overflow: hidden; }
.pillar-bar-track > span { display: block; height: 100%; border-radius: 4px; }
.pillar-bar-val { grid-column: 2; font-family: var(--mono); font-size: 10.5px; color: var(--t3); margin-top: -4px; }

/* heatmap */
.heatmap-scroll { overflow-x: auto; }
.heatmap { border-collapse: collapse; font-variant-numeric: tabular-nums; width: 100%; }
.heatmap th, .heatmap td { border: 1px solid var(--bg-2); }
.heatmap thead th { position: sticky; top: 0; background: var(--panel); z-index: 2; padding: 6px 4px; }
.heatmap th.hm-cat { height: 96px; vertical-align: bottom; padding-bottom: 8px; }
.heatmap th.hm-cat span {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--t2);
  white-space: nowrap; letter-spacing: 0.02em;
}
.heatmap th.hm-model, .heatmap td.hm-model {
  position: sticky; left: 0; z-index: 1; background: var(--bg-2);
  text-align: left; font-family: var(--body); font-size: 12px; color: var(--t1);
  padding: 6px 10px 6px 4px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.heatmap thead th.hm-model { z-index: 3; }
.hm-cell { width: 34px; height: 30px; text-align: center; font-family: var(--mono); font-size: 11px; }
.hm-na { color: var(--t3); background: var(--panel); }

/* ---------- Task mapping inline panel ---------- */
.mapping-panel {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 22px;
  animation: panel-in 0.24s var(--ease);
}
.mapping-panel-sub { font-family: var(--mono); font-size: 11.5px; color: var(--t3); line-height: 1.55; margin: 0 0 14px; max-width: 76ch; }
.mapping-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.mapping-tbl thead th {
  text-align: left;
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--t3); padding: 8px 10px; border-bottom: 1px solid var(--line-strong);
}
.mapping-tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--t2); }
.mapping-tbl td.mono { font-family: var(--mono); color: var(--t1); }
.pill-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
.mode-tag {
  font-family: var(--mono); font-size: 10px; padding: 2px 8px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.mode-tag.perception { background: rgba(90,209,230,0.14); color: var(--cyan); }
.mode-tag.reasoning { background: rgba(200,241,53,0.14); color: var(--signal); }

@media (max-width: 860px) {
  .analysis-panels { grid-template-columns: 1fr; }
}
