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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-app);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-body);
  line-height: var(--t-body-lh);
  font-kerning: normal;
  min-height: 100%;
}

html { height: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

#main a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
#main a:hover { text-decoration-color: var(--accent); }
#main a.chip,
#main .team-chips a,
#main .fav-chip,
#main .pulse-match,
#main .sbead-link,
#main .suggest-card,
#main .home-jump a,
#main .otd-row,
#main .stat-card a,
#main .performer h3 a {
  text-decoration: none;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.topbar {
  min-height: 3.5rem;
  background: var(--bg-surface);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  padding: var(--space-3) var(--space-5);
  position: sticky;
  top: 0;
  z-index: 20;
}

.wordmark {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--t-h3);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.wordmark:hover { color: var(--ink); }

.util {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

.util a {
  color: var(--ink);
  font-size: var(--t-caption);
  padding: var(--space-2) 0;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}
.util a:hover { color: var(--accent); }
.util a.active {
  color: var(--accent);
  font-weight: 700;
  border-bottom-color: var(--accent);
}

.data-date { color: var(--ink-3); font-size: var(--t-caption); }

.theme-toggle,
.search-toggle {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-height: 2.75rem;
  font-size: var(--t-caption);
  cursor: pointer;
  font-family: var(--font-ui);
  min-height: 32px;
}
.theme-toggle:hover,
.search-toggle:hover {
  border-color: var(--line-strong);
  background: var(--bg-surface);
}
.search-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.search-scrim {
  position: fixed;
  inset: 3.5rem 0 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 25;
}

#query-shell.docked {
  padding: 0;
  max-width: none;
}

#query-shell.docked #query-wrap {
  display: none;
}

body.search-open #query-shell.docked #query-wrap {
  display: block;
  position: fixed;
  top: 3.5rem;
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 16px 24px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
}

body.search-open #query-shell.docked #query-wrap .query-box {
  max-width: 1120px;
  margin: 0 auto;
  min-height: 48px;
}

.browse {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin: 0 0 var(--space-5);
  font-size: var(--t-body);
}

.browse-here { color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
  margin: 16px 0;
}

.stats-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4) var(--space-6);
  margin: var(--space-4) 0;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.stats-toolbar .filters { margin: 0; }

.stats-filters input[type="number"] {
  min-width: 5rem;
  width: 5rem;
}

.view-options {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}

.view-label {
  color: var(--ink-3);
  font-size: var(--t-caption);
  margin-right: var(--space-1);
}

.view-toggle,
.copy-view {
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-surface);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--t-caption);
  cursor: pointer;
}

.view-toggle:hover,
.copy-view:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.view-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-tint);
}

.heat-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  color: var(--ink-3);
  font-size: var(--t-caption);
}

.heat-legend i {
  display: block;
  width: 5rem;
  height: 0.375rem;
  background: linear-gradient(90deg, var(--bg-surface), color-mix(in oklab, var(--accent) 42%, var(--bg-surface)));
  border: 1px solid var(--line);
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--t-caption);
  color: var(--ink-2);
}

.filters label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
}

.h2h {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.h2h h3.section { margin-top: 0; }
.h2h-panel { min-width: 0; }
.h2h-panel .table-block,
.h2h-panel .table-wrap { width: 100%; min-width: 0; }
.h2h-panel table.data { table-layout: fixed; }
.h2h-panel table.data th,
.h2h-panel table.data td {
  padding-left: 6px;
  padding-right: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.h2h-panel table.data th {
  font-size: 10px;
  letter-spacing: 0.03em;
}
.h2h-panel table.data th.name,
.h2h-panel table.data td:first-child {
  width: 27%;
  min-width: 0;
}
.h2h-panel table.data th:nth-child(2) { width: 12%; }
.h2h-panel table.data th:nth-child(3) { width: 14%; }
.h2h-panel table.data th:nth-child(4) { width: 29%; }
.h2h-panel table.data th:nth-child(5) { width: 10%; }
.h2h-panel table.data th:nth-child(6) { width: 8%; }

.studio-links { font-size: var(--t-caption); color: var(--ink-3); margin: 0 0 20px; }
.studio-links a { color: var(--accent); }

.duel {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 0.6fr) 1fr;
  gap: 20px;
  margin: 24px 0;
  align-items: start;
}

.duel-card {
  background: var(--bg-surface);
  border-radius: var(--radius-panel);
  padding: var(--space-4) var(--space-5);
}

.duel-card h2 { margin: 0 0 8px; font-family: var(--font-display); font-size: var(--t-h2); }
.duel-mid { text-align: center; padding-top: 12px; }
.duel-tests { grid-template-columns: 1fr 72px 1fr; }
.team-avg-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
}
.team-avg-line .fig {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  font-variant-numeric: tabular-nums;
}
.team-avg-line .fig.pos { color: var(--green-pos); }
.team-avg-line .fig.neg { color: var(--red); }
.duel-mid .team-avg-line { justify-content: center; margin: 0; }
.duel-card .xi-line {
  margin: 4px 0;
  font-size: var(--t-table);
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink-2);
}
.duel-card .xi-line.exp { color: var(--ink-3); }
.xi-pipe {
  display: inline-block;
  margin: 0 0.55em;
  color: var(--ink-3);
  opacity: 0.7;
}
.xi-support {
  margin: 2px 0 0;
  font-size: var(--t-caption);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums lining-nums;
}
.xi-verdict { margin: 12px 0 8px; }
.team-sheet .team-row {
  grid-template-columns: 28px minmax(72px, 1.2fr) 22px 40px 32px 40px 28px 24px 40px;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.team-sheet .team-row.head {
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 8px;
}
.team-sheet .team-row.head span:nth-child(n+3) { text-align: right; }
.team-sheet .num { text-align: right; }
.team-sheet .team-row.tot {
  border-top: 1px solid var(--line-strong);
  border-bottom: none;
  margin-top: 4px;
  padding-top: 8px;
  color: var(--ink);
}

.matchup-stage { display: grid; gap: 20px; margin: 28px 0 40px; }

.matchup {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-panel);
  padding: 0 0 var(--space-2);
}
.matchup-head {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  align-items: end;
  gap: 12px;
  padding: 28px 32px 0;
}
.matchup-head-right { text-align: right; }
.matchup-role {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.matchup-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.1rem + 2vw, 2.5rem);
  line-height: 1.05;
  font-weight: 600;
  margin: 0;
}
.matchup-name a { color: inherit; text-decoration: none; }
.matchup-name a:hover { color: var(--accent); }
.matchup-vs {
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  justify-self: center;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.matchup-kicker {
  padding: 10px 32px 0;
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
}
.matchup-line {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 18px 24px 8px;
  border-top: 1px solid var(--line);
}
.matchup-stat {
  padding: 18px 8px 10px;
  text-align: center;
  border-right: 1px solid var(--line);
}
.matchup-stat:last-child { border-right: 0; }
.matchup-stat .n {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 52px);
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.matchup-stat .k {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.matchup-stat.lead .n { font-weight: 700; }
.matchup-stat.lead .k { color: var(--ink-2); }
.matchup-foot {
  text-align: center;
  font-size: var(--t-caption);
  color: var(--ink-2);
  padding: 4px 32px 20px;
  margin: 0;
}
.matchup-empty { padding-bottom: 28px; }
.team-row {
  display: grid;
  grid-template-columns: 28px 1fr minmax(90px, auto) 48px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-table);
}
.team-row .rk { color: var(--ink-3); }
.team-row .fig.neg { color: var(--red); }
.team-row.lane-head {
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom-color: var(--line-strong);
}
.team-row.lane-head span:last-child { text-align: right; }
.team-row.tot {
  border-top: 1px solid var(--line-strong);
  border-bottom: none;
  margin-top: 4px;
  padding-top: 8px;
}
.twin-row {
  display: grid;
  grid-template-columns: 11rem 1fr 3.25rem 3.25rem;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
  font-size: var(--t-caption);
}
.twin-bars { display: grid; gap: 4px; }
.twin-track { height: 8px; background: var(--bg-inset); border-radius: 4px; overflow: hidden; }
.twin-fill { height: 100%; background: var(--accent); }
.twin-fill.b { background: var(--series-b); }
.twin-axis { position: relative; overflow: visible; }
.twin-zero {
  position: absolute;
  inset: -2px auto -2px 50%;
  width: 1px;
  background: var(--line-strong);
}
.twin-axis .twin-fill {
  position: absolute;
  width: var(--mag);
  top: 0;
  bottom: 0;
}
.twin-axis .twin-fill.pos { left: 50%; border-radius: 0 4px 4px 0; }
.twin-axis .twin-fill.neg { right: 50%; border-radius: 4px 0 0 4px; }
.series-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--accent);
}
.series-swatch.b { background: var(--series-b); }
.twin-card .caption { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.twin-neighbours th:first-child, .twin-neighbours td:first-child { text-align: left; }
.twin-note {
  margin: 0 0 var(--space-2);
  font-size: var(--t-body);
  color: var(--ink);
}
.twin-note .kicker {
  font-size: var(--t-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: var(--space-2);
}
.badge.tier-A { background: var(--accent-tint); color: var(--accent); }
.badge.tier-B { color: var(--ink-2); }
.twin-filters input[type="number"] {
  min-width: 5.5rem;
  width: 5.5rem;
}
.team-edge {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: var(--t-h2);
}

.filters select, .filters input[type="text"], .filters input[type="number"] {
  background: var(--bg-surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-family: var(--font-ui);
  min-width: 140px;
}

.filters label { position: relative; }
.field-ac {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-panel);
  box-shadow: 0 12px 28px color-mix(in oklab, var(--bg-app) 75%, transparent);
}
.field-ac button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  color: var(--ink);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.field-ac button:hover { background: var(--bg-inset); }
.field-ac small { display: block; color: var(--ink-3); font-size: 10px; }
.filters select:hover, .filters input:hover {
  border-color: var(--line-strong);
}
.filters select:focus, .filters input:focus {
  border-color: var(--accent);
}

.shell {
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) var(--space-8);
}
#main.shell { flex: 1 0 auto; min-width: 0; }

/* On the home screen the search block and the feed are one reading column, so
   the doubled shell padding between them reads as a dead zone. */
#query-shell:has(.query-wrap.hero) { padding-bottom: var(--space-4); }
#query-shell:has(.query-wrap.hero) + #main.shell { padding-top: var(--space-4); }

.shell.wide { max-width: 80rem; }

.query-wrap { position: relative; }

.query-wrap.hero {
  margin-top: var(--space-6);
  animation: settle 0.55s var(--ease-out) both;
}

@keyframes settle {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: none; }
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--t-display);
  line-height: var(--t-display-lh);
  font-weight: 600;
  margin: 0 0 8px;
}

.lede {
  color: var(--ink-2);
  font-size: var(--t-caption);
  line-height: var(--t-caption-lh);
  margin: 0 0 32px;
}
#home-hero .lede {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  line-height: var(--t-h2-lh);
  font-weight: 600;
  color: var(--ink);
  max-width: 22ch;
  margin: var(--space-2) 0 0;
}

.query-box {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-panel);
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 160ms var(--ease-out);
}
.query-box:focus-within {
  box-shadow: var(--focus);
}

.query-wrap.slim .query-box { min-height: 2.75rem; }

.query-highlight,
.query-input {
  font-family: var(--font-mono);
  font-size: var(--t-query);
  line-height: var(--t-query-lh);
  width: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  white-space: pre;
  overflow-x: auto;
}

.query-highlight {
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--ink);
}

.query-input {
  position: relative;
  color: transparent;
  caret-color: var(--ink);
  outline: none;
  z-index: 1;
}

.query-input::placeholder { color: var(--ink-3); }

.token-pill {
  display: inline-block;
  background: var(--accent-tint);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 4px;
}

.token-pill .k { color: var(--ink-2); font-weight: 700; }
.token-pill .v { color: var(--ink); }
.token-bad { border-bottom: 1px dotted var(--red); }
.token-entity {
  color: var(--accent);
  box-shadow: inset 0 -1px 0 var(--accent);
}
.token-score {
  color: var(--ink);
  font-weight: 700;
}

.ghost {
  margin: var(--space-2) 0 0 var(--space-4);
  font-size: var(--t-caption);
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.try-label {
  font-size: var(--t-caption);
  color: var(--ink-2);
  margin: 20px 0 8px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-inset);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--ink);
  cursor: pointer;
  transition: background 160ms var(--ease-out);
}

.chip:hover { background: var(--accent-tint); }

.fmt-row, .date-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  margin-top: var(--space-5);
}

.fmt-label {
  font-size: var(--t-caption);
  color: var(--ink-3);
  margin-right: 4px;
}

.tab {
  background: none;
  border: 0;
  padding: var(--space-2) 0;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  color: var(--ink-2);
  font-size: var(--t-body);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: var(--font-ui);
}

.tab:hover { color: var(--ink); }

.tab.active {
  color: var(--ink);
  font-weight: 700;
  border-bottom-color: var(--accent);
}

.date-row label {
  font-size: var(--t-caption);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-row input {
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: var(--font-ui);
}

.ac {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  z-index: 30;
  max-height: 320px;
  overflow: auto;
  display: none;
}

.ac.open { display: block; }

.ac h4 {
  margin: 0;
  padding: 8px 12px 4px;
  font-size: var(--t-caption);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 700;
}

.ac button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

.ac button.active, .ac button:hover { background: var(--accent-tint); }
.ac .hint { color: var(--ink-3); font-family: var(--font-ui); margin-left: 8px; }

.scope {
  font-size: var(--t-caption);
  color: var(--ink-2);
  margin: 24px 0 8px;
}

.scope .ignored { color: var(--red); }

.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  overflow-x: auto;
}
.table-wrap.compact { max-width: 720px; }

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--t-table);
  line-height: var(--t-table-lh);
  font-variant-numeric: tabular-nums lining-nums;
}

table.data th {
  background: var(--bg-inset);
  color: var(--ink-2);
  font-size: var(--t-caption);
  line-height: var(--t-caption-lh);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  text-align: left;
  padding: 8px 12px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}

table.data th.grp {
  text-align: center;
  border-bottom: 0;
  padding-bottom: 2px;
}

table.data th.grp + th.grp {
  border-left: 1px solid var(--line-strong);
}

table.data th.sub {
  text-align: right;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding-top: 0;
  color: var(--ink-3);
}

table.data th.group-start,
table.data td.group-start {
  border-left: 1px solid var(--line-strong);
}

table.data th.num, table.data td.num { text-align: right; }
table.data th:first-child, table.data td:first-child { padding-left: 16px; }

table.data th.name,
table.data td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 148px;
}

table.data th.name { z-index: 5; background: var(--bg-inset); }
table.data td:first-child { background: var(--bg-surface); }

table.data td {
  padding: 6px 12px;
  height: 32px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: var(--bg-surface);
}

table.data tbody tr:hover td { background: var(--bg-app); }
table.data tbody tr:hover td:first-child { background: var(--bg-app); }
table.data tr.match-group-start td {
  border-top: 2px solid var(--line-strong);
  border-bottom-color: transparent;
}
table.data tr.match-group-mid td,
table.data tr.match-group-end td {
  border-bottom-color: transparent;
  background: color-mix(in oklab, var(--accent) 2.5%, var(--bg-surface));
}
table.data tr.match-group-end td { border-bottom: 2px solid var(--line-strong); }
table.data tr.match-group-start td:first-child,
table.data tr.match-group-mid td:first-child,
table.data tr.match-group-end td:first-child {
  box-shadow: inset 2px 0 0 color-mix(in oklab, var(--accent) 45%, var(--line));
}
table.data .innings-cont {
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
table.data tr.milestone td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
table.data .fig { font-family: var(--font-mono); }
table.data tr.milestone .fig { font-weight: 700; }
table.data .muted { color: var(--ink-3); }
table.data a {
  color: var(--accent);
  font-weight: 700;
}
table.data a:hover { color: var(--accent-strong); }
table.data a.player-link { color: var(--accent); }
table.data a.player-link:hover { color: var(--accent-strong); }
table.data .pos { color: var(--green-pos); }
table.data .neg { color: var(--red); }
table.data td.supporting { color: var(--ink-3); }
table.data td.delta-primary {
  position: relative;
  min-width: 72px;
  background: color-mix(in oklab, var(--accent) 5%, var(--bg-surface));
  font-weight: 700;
}
table.data td.delta-primary .delta { position: relative; z-index: 1; }
table.data .delta-scale {
  position: absolute;
  inset: 4px 4px 4px auto;
  width: var(--delta-size);
  max-width: calc(100% - 8px);
  background: color-mix(in oklab, currentColor 10%, transparent);
  pointer-events: none;
}
table.data tr.low-sample td { opacity: 0.5; }

.performance-scale {
  margin: var(--space-2) 0 var(--space-4);
  max-width: 72rem;
  color: var(--ink-2);
  font-size: var(--t-caption);
  line-height: var(--t-caption-lh);
}
.performance-scale strong {
  color: var(--ink);
  font-weight: 700;
}

.comp-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.25rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--bg-inset);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.comp-t20i {
  color: var(--accent-strong);
  border-color: color-mix(in oklab, var(--accent) 45%, var(--line));
  background: color-mix(in oklab, var(--accent) 12%, var(--bg-surface));
}
.comp-ipl,
.comp-wpl {
  color: var(--series-b);
  border-color: color-mix(in oklab, var(--series-b) 45%, var(--line));
  background: color-mix(in oklab, var(--series-b) 10%, var(--bg-surface));
}

.result-status {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  font-weight: 700;
}
.result-won { color: var(--green-pos); }
.result-lost { color: var(--red); }
.result-draw,
.result-tie,
.result-no { color: var(--ink-2); }

.table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: var(--t-caption);
  color: var(--ink-2);
  border-top: 1px solid var(--line);
  background: var(--bg-surface);
}

.btn, .btn-text {
  background: none;
  border: 0;
  color: var(--accent);
  font-size: var(--t-caption);
  cursor: pointer;
  font-family: var(--font-ui);
}
.btn-text:hover { color: var(--accent-strong); }

.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  min-height: 2.75rem;
  font-size: var(--t-body);
}

.btn.primary:hover { background: var(--accent-strong); }
.btn.primary:disabled { opacity: 0.5; cursor: default; }

.badge {
  display: inline-block;
  font-size: var(--t-caption);
  line-height: 16px;
  background: var(--bg-inset);
  color: var(--ink-2);
  border-radius: 4px;
  padding: 1px 6px;
}

h2.section {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  line-height: var(--t-h2-lh);
  font-weight: 600;
  margin: 32px 0 12px;
}

h3.section {
  font-size: var(--t-h3);
  line-height: var(--t-h3-lh);
  font-weight: 700;
  margin: var(--space-5) 0 var(--space-2);
}

.caption, .footnote {
  font-size: var(--t-caption);
  line-height: var(--t-caption-lh);
  color: var(--ink-2);
}

.footnote em, .disclaimer {
  font-style: italic;
  color: var(--ink-2);
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 16px 0 8px;
  border: 1px solid var(--line);
}

.metric-card {
  flex: 1 1 9rem;
  min-width: 0;
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}

.metric-card:last-child { border-right: 0; }

.metric-card .name {
  font-size: var(--t-caption);
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
}

.metric-card .val {
  font-family: var(--font-mono);
  font-size: 26px;
  line-height: 32px;
  font-variant-numeric: tabular-nums lining-nums;
  margin: 4px 0;
}

.metric-card .val.neg { color: var(--red); }
.metric-card .sc { font-size: var(--t-caption); color: var(--ink-2); }

.info {
  display: inline-flex;
  width: 14px;
  height: 14px;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--ink-2);
  cursor: help;
  position: relative;
}

.info .pop, .hint .pop {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, calc(100vw - 32px));
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  z-index: 20;
  font-size: var(--t-caption);
  line-height: var(--t-caption-lh);
  color: var(--ink);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
  white-space: normal;
  box-shadow: var(--shadow-pop);
}

.info:hover .pop, .info:focus .pop,
.hint:hover .pop, .hint:focus .pop { display: block; }

.hint {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted color-mix(in srgb, var(--ink-2) 55%, transparent);
}

.compare-grid {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
  overflow: visible;
}

.compare-grid th, .compare-grid td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-table);
}

.compare-grid th {
  font-family: var(--font-ui);
  font-size: var(--t-caption);
  font-weight: 700;
  text-align: right;
}
.compare-grid th:first-child {
  width: 40%;
  text-align: left;
}

.compare-grid td.stat { color: var(--ink-2); text-align: left; font-weight: 700; overflow: visible; }
.compare-grid .hint .pop { z-index: 30; width: min(280px, 68vw); font-weight: 400; }
.compare-grid tbody tr:nth-last-child(-n+3) .hint .pop {
  top: auto;
  bottom: calc(100% + 8px);
}
.compare-grid td.num { text-align: right; }
.compare-grid td.num.win { color: var(--green-pos); }
.compare-grid td.num.minor { color: var(--ink-3); opacity: 0.58; }
.compare-grid .margin {
  display: inline-block;
  margin-left: 6px;
  color: inherit;
  font-size: 10px;
  font-weight: 400;
}
.compare-grid .sc { font-size: var(--t-caption); color: var(--ink-2); margin-top: 2px; }
.compare-grid td.num.win .sc { color: var(--ink-3); }
.compare-grid td.delta { text-align: center; font-family: var(--font-mono); }
.shared-vs td { font-size: var(--t-caption); }
.shared-vs th { font-size: var(--t-caption); }
.compare-grid .pos { color: var(--green-pos); }
.compare-grid .neg { color: var(--red); }
.compare-grid tr.key-row td.num { font-size: 1.12em; }
.compare-grid tr.key-row td.stat { color: var(--ink); font-weight: 700; }
.compare-grid tr.quiet-row td { color: var(--ink-3); }
.section-qualifier { color: var(--ink-3); font-family: var(--font-ui); font-size: var(--t-caption); font-weight: 400; }
.comparison-legend {
  margin: var(--space-6) 0 var(--space-3);
  color: var(--ink-2);
  font-size: var(--t-caption);
}
.comparison-legend .pos { color: var(--green-pos); font-weight: 700; }
.comparison-legend .neg { color: var(--red); font-weight: 700; }
.mix-warning {
  padding: 2px 7px;
  border: 1px solid color-mix(in oklab, var(--gold) 45%, var(--line));
  border-radius: 999px;
  color: var(--gold);
  background: color-mix(in oklab, var(--gold) 8%, var(--bg-surface));
  font-family: var(--font-ui);
  font-size: var(--t-caption);
}

.metrics-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  margin-top: 16px;
}

.rail {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  padding: 16px;
}

.rail fieldset {
  border: 0;
  margin: 0 0 20px;
  padding: 0;
}

.rail legend {
  font-size: var(--t-caption);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.rail label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: var(--t-body);
}

.slider {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.slider input[type="range"] {
  accent-color: var(--accent);
  height: 4px;
}

.slider .w {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
}

.log {
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  padding: 12px;
  height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  margin-top: 16px;
}

.sql-layout { display: flex; gap: 24px; margin-top: 16px; }
.sql-views { width: 200px; }
.sql-views button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}

.sql-editor {
  width: 100%;
  height: 28vh;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 12px;
  resize: vertical;
}

.drawer {
  width: 100%;
  background: var(--bg-inset);
  border: 0;
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  font-size: var(--t-body);
  color: var(--ink);
  margin-top: 16px;
}

.skel {
  height: 32px;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line);
  animation: fade 0.3s ease-out;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .query-wrap.hero { animation: none; }
}

.empty, .error {
  margin: 32px 0;
  color: var(--ink);
}
.empty p { margin: 0 0 12px; }
.empty .caption { margin-bottom: 16px; }

.error code, .cmd {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-inset);
  padding: 2px 6px;
}

.provenance {
  max-width: 70rem;
  margin: auto auto var(--space-6);
  padding: var(--space-7) var(--space-5) 0;
  font-size: var(--t-caption);
  line-height: var(--t-caption-lh);
  color: var(--ink-3);
}

.docs-body {
  max-width: 720px;
}

.docs-body h1, .docs-body h2 {
  font-family: var(--font-display);
}

.docs-body table { font-variant-numeric: tabular-nums; font-size: 13px; }
.docs-body pre, .docs-body code { font-family: var(--font-mono); font-size: 13px; }

.fow { color: var(--ink-2); font-size: var(--t-caption); margin: 8px 0 16px; }
.meta-line { color: var(--ink-2); font-size: var(--t-caption); margin: 4px 0 12px; }
.query-affordance { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-left: 8px; opacity: 0; }
h2.section:hover .query-affordance, h3.section:hover .query-affordance { opacity: 1; }

.icon-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: var(--radius-sm);
  min-width: 2.75rem;
  min-height: 2.75rem;
  font-family: var(--font-ui);
  font-size: var(--t-body);
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.shortcuts-btn {
  width: auto;
  padding: 0 var(--space-3);
}

.fav-star {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: var(--t-caption);
  cursor: pointer;
  font-family: var(--font-ui);
  margin-left: 8px;
  vertical-align: middle;
}
.fav-star.on { color: var(--accent); border-color: var(--accent); }

.page-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.page-head .page-title { margin-right: auto; }

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 8px 0 20px;
  font-size: var(--t-caption);
}
.jump button {
  appearance: none;
  background: none;
  border: 0;
  color: var(--accent);
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.jump button:hover { text-decoration-color: var(--accent); color: var(--accent-strong); }

.player-jump {
  position: sticky;
  top: var(--topbar-h, 3.5rem);
  z-index: 14;
  margin: 0 calc(var(--space-3) * -1) var(--space-4);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-app);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
}
.player-jump button {
  min-height: 2rem;
  text-decoration: none;
  color: var(--ink-2);
}
.player-jump button.active {
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.shift-jump { margin-top: var(--space-3); }
.shift-legend {
  margin: var(--space-3) 0 var(--space-5);
  padding: 10px 12px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-2);
  font-size: var(--t-caption);
}
.shift-legend .pos { color: var(--green-pos); font-weight: 700; }
.shift-legend .neg { color: var(--red); font-weight: 700; }

.profile-section {
  scroll-margin-top: calc(var(--topbar-h, 3.5rem) + 3.5rem);
  margin-bottom: var(--space-6);
}
.profile-scope {
  margin-left: calc(var(--space-4) * -1);
  margin-right: calc(var(--space-4) * -1);
  padding: var(--space-4);
  background: color-mix(in oklab, var(--bg-surface) 58%, var(--bg-app));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.profile-scope > h2.section:first-child,
.profile-scope > .fmt-row:first-child {
  margin-top: 0;
}
.scoped-tabs {
  margin: var(--space-2) 0 var(--space-4);
}

.fielding-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  margin-top: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--t-caption);
}
.fielding-strip strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 500;
}

.team-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.team-chips a {
  background: var(--bg-inset);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: var(--t-caption);
}
.team-chips a:hover { background: var(--accent-tint); color: var(--ink); }
.team-chips .n { color: var(--ink-3); margin-left: 4px; }

.form-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  background: var(--bg-surface);
  border-radius: var(--radius-panel);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-2) 0 var(--space-5);
}
.ovr-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}
.ovr-badge {
  flex: 0 0 auto;
  min-width: 6.5rem;
  padding: 12px 14px 10px;
  border-radius: var(--radius-panel);
  background: var(--bg-surface);
  box-shadow: 0 0 0 1px var(--line);
  text-align: center;
}
.ovr-badge.ovr-gold { box-shadow: 0 0 0 1px var(--gold); }
.ovr-badge.ovr-hot { box-shadow: 0 0 0 1px var(--accent); }
.ovr-kicker {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ovr-badge.ovr-gold .ovr-kicker { color: var(--gold); }
.ovr-n {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.8rem);
  line-height: 1;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.ovr-badge.ovr-gold .ovr-n { color: var(--gold); }
.ovr-badge.ovr-hot .ovr-n { color: var(--accent); }
.ovr-split {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: var(--t-caption);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.ovr-rank { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.ovr-panel { margin: 8px 0 28px; }
.ovr-panel .section { margin-top: 0; }
.ovr-fmts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 8px 0 0;
  font-size: var(--t-caption);
  color: var(--ink-2);
}
.ovr-fmts strong { color: var(--ink); margin-right: 4px; }
.ovr-chart { margin: 8px 0 0; position: relative; }
.ovr-chart svg { width: 100%; height: auto; display: block; }
.ovr-grid { stroke: var(--line); stroke-width: 1; }
.ovr-nine { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
.ovr-career { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 5 4; opacity: 0.4; }
.ovr-axis { fill: var(--ink-3); font-size: 10px; font-family: var(--font-ui); }
.ovr-line { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ovr-line.ovr { stroke: var(--accent); }
.ovr-line.test { stroke: var(--red); stroke-width: 1.35; opacity: 0.9; }
.ovr-line.odi { stroke: var(--gold); stroke-width: 1.35; opacity: 0.9; }
.ovr-line.t20i { stroke: var(--green-pos); stroke-width: 1.35; opacity: 0.9; }
.ovr-line.t20 { stroke: var(--series-b); stroke-width: 1.35; opacity: 0.9; }
.ovr-dot { fill: var(--bg-surface); stroke: var(--accent); stroke-width: 1.4; }
.ovr-dot.nine { fill: var(--gold); stroke: var(--gold); }
.ovr-cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; visibility: hidden; pointer-events: none; }
.ovr-hover-dot { fill: var(--accent); stroke: var(--bg-surface); stroke-width: 1.5; visibility: hidden; pointer-events: none; }
.ovr-hit { cursor: crosshair; }
.ovr-tip {
  position: absolute;
  min-width: 8.5rem;
  max-width: 12rem;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-pop);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  z-index: 2;
}
.ovr-tip strong { display: block; margin-bottom: 4px; font-weight: 700; }
.ovr-tip span { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); }
.ovr-tip em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 700; }
.ovr-cap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin: 8px 0 0;
  font-size: var(--t-caption);
  color: var(--ink-2);
}
.ovr-key { display: inline-flex; align-items: center; gap: 6px; }
.ovr-key i {
  width: 12px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
}
.ovr-key.test i { background: var(--red); }
.ovr-key.odi i { background: var(--gold); }
.ovr-key.t20i i { background: var(--green-pos); }
.ovr-key.t20 i { background: var(--series-b); }
.ovr-club {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 24px;
}
.ovr-club a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-panel);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 0 0 1px var(--line);
}
.ovr-club a:hover { box-shadow: 0 0 0 1px var(--gold); }
.ovr-club .n {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  color: var(--gold);
  min-width: 2ch;
}
.ovr-club .who { font-weight: 700; }
.ovr-club .side { display: block; font-size: 11px; color: var(--ink-3); }
.form-kicker {
  font-size: var(--t-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--space-1);
}
.form-line { font-family: var(--font-display); font-size: var(--t-h3); }
.spark { color: var(--accent); flex: 0 0 auto; }
.spark circle {
  fill: var(--bg-surface);
  stroke: currentColor;
  stroke-width: 1.25;
}

.pct-bar {
  height: 3px;
  background: var(--bg-inset);
  margin-top: 8px;
}
.pct-bar span { display: block; height: 100%; background: var(--accent); }

.pulse {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
  width: 100%;
  gap: var(--space-5) var(--space-6);
  margin: var(--space-5) 0 var(--space-2);
}
.pulse h3 {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  font-weight: 600;
  margin: 0 0 var(--space-3);
}
.pulse a { color: var(--ink); font-size: var(--t-caption); line-height: 1.35; }
.pulse a:hover { color: var(--accent); }
.pulse .kicker { color: var(--ink-3); font-size: var(--t-caption); }
.pulse-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  width: 100%;
}
.pulse-row > div { min-width: 0; overflow-wrap: anywhere; }
.pulse-row a { display: inline; padding: 0; border: 0; }
.pulse-player { font-weight: 700; display: block; margin-bottom: 2px; }
.pulse-match { display: block; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.pulse-match:hover { color: var(--accent-strong); }
/* The whole row is the link, so the team names carry the affordance. */
.pulse-match strong { font-weight: 700; color: var(--accent); }
.pulse-match:hover strong { color: var(--accent-strong); }

.fav-rail { margin: 20px 0 0; }
.fav-rail h3 {
  font-size: var(--t-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
}
.fav-rail a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-inset);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: var(--t-caption);
  margin: 0 6px 6px 0;
}
.fav-rail a:hover { background: var(--accent-tint); }

.wowy-visual { margin: 16px 0 20px; max-width: 560px; }
.wowy-lane { margin: 0 0 10px; }
.wowy-lab { font-size: var(--t-caption); color: var(--ink-2); margin-bottom: 4px; }
.wowy-track { height: 8px; background: var(--bg-inset); border-radius: 4px; overflow: hidden; }
.wowy-fill { display: block; height: 100%; background: var(--accent); }
.wowy-fill.without { background: var(--ink-3); }

.scatter { width: 100%; height: auto; margin: 8px 0 4px; }
.sc-dot { fill: var(--accent); fill-opacity: 0.7; }
.sc-dot:hover { fill-opacity: 1; }
.sc-axis { font-size: 10px; fill: var(--ink-3); font-family: var(--font-ui); }
.sc-grid { stroke: var(--line); stroke-width: 1; }
.sc-median { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 4; }

.fow-beads {
  position: relative;
  height: 38px;
  background: linear-gradient(to right, var(--line-strong), var(--line-strong)) 0 50% / 100% 1px no-repeat;
}
.bead {
  position: absolute;
  top: 1px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 10px;
  display: grid;
  place-items: center;
  background: var(--bg-surface);
}
.bead.lane-1 { top: 19px; }
.fow-chart { margin: 10px 10px 4px; }
.fow-axis {
  position: relative;
  height: 18px;
  border-top: 1px solid var(--line);
}
.fow-axis span {
  position: absolute;
  top: 3px;
  translate: -50% 0;
  color: var(--ink-3);
  font: 10px var(--font-mono);
}
.fow-axis span::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 1px;
  height: 4px;
  background: var(--line-strong);
}

.inn-meta { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 8px; }
.inn-meta span { color: var(--ink-2); font-size: var(--t-caption); }

/* Auto table layout hands leftover width to the first column, which parks the
   rank number miles from the name it belongs to. */
table.data th.col-rank,
table.data td.col-rank { width: 3.5rem; }

table.data th[data-key] { cursor: pointer; }
table.data th[data-key]:hover { color: var(--ink); }
table.data th.sorted { color: var(--accent); }
table.data td.heat { background: color-mix(in oklab, var(--accent) var(--heat, 0%), var(--bg-surface)); }
table.data td.secondary-stat {
  color: var(--ink-3);
}
table.data td.secondary-stat .fig {
  opacity: 0.62;
}
table.data tr.result-won td { box-shadow: inset 2px 0 0 var(--green-pos); }
table.data tr.result-lost td { box-shadow: inset 2px 0 0 color-mix(in oklab, var(--red) 55%, var(--line)); }
table.data tr.is-hover td { background: var(--bg-app); }
table.data .copy-line {
  opacity: 0;
  background: none;
  border: 0;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 11px;
}
table.data tr:hover .copy-line { opacity: 1; }

.table-filter {
  margin: 0 0 8px;
  width: 240px;
  background: var(--bg-surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-family: var(--font-ui);
}

.density-compact table.data td { height: 26px; padding-top: 4px; padding-bottom: 4px; }
.density-compact table.data th { padding-top: 6px; padding-bottom: 6px; }

body.table-focus .topbar,
body.table-focus .provenance,
body.table-focus #query-shell { display: none; }
body.table-focus #main.shell { max-width: none; padding: 16px 20px 40px; }

.compare-tray {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
}
.compare-tray[hidden] { display: none; }
.tray-lab { font-size: var(--t-caption); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.tray-chip {
  background: var(--bg-inset);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: var(--t-caption);
}
.tray-chip button { background: none; border: 0; color: var(--ink-3); cursor: pointer; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: var(--bg-app);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--t-caption);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 40;
}
.sheet, .palette {
  position: fixed;
  z-index: 45;
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
}
.sheet {
  top: 72px;
  right: 24px;
  width: 360px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 20px 22px 28px;
}
.sheet h2 { font-family: var(--font-display); font-size: var(--t-h2); margin: 0 0 12px; }
.sheet h3 { font-size: var(--t-h3); margin: 18px 0 6px; }
.sheet p { color: var(--ink-2); margin: 0; font-size: var(--t-caption); line-height: var(--t-caption-lh); }
.keys { width: 100%; border-collapse: collapse; font-size: var(--t-caption); }
.keys td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.keys td:first-child { width: 72px; }
kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-inset);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
}
.palette {
  top: 18vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 48px));
  padding: 12px;
}
.palette input {
  width: 100%;
  background: var(--bg-inset);
  border: 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
}
.palette button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 12px;
  color: var(--ink);
  font-family: var(--font-ui);
  cursor: pointer;
}
.palette button:hover,
.palette button.on { background: var(--accent-tint); }
.palette #palette-list { max-height: 48vh; overflow: auto; }
body:has(.compare-tray:not([hidden])) .toast { bottom: 80px; }

.not-out { font-weight: 700; }

.port {
  display: block;
  object-fit: cover;
  object-position: top center;
  background: var(--bg-inset);
  border-radius: 2px;
  flex: 0 0 auto;
}
.port-lg {
  width: 132px;
  height: 176px;
  box-shadow: 0 0 0 1px var(--line);
}
.port-sm { width: 48px; height: 64px; }
.port-xs { width: 28px; height: 36px; }

.player-hero {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin: 0 0 20px;
}
.player-hero > div:nth-child(2) { flex: 1; min-width: 0; }
.player-hero .page-head { margin-bottom: 4px; }

.ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin: 14px 0 0;
}
.ribbon div { min-width: 52px; }
.ribbon dt {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ribbon dd {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  margin: 2px 0 0;
}

.almanac { margin: 8px 0 28px; }
.almanac h3 {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
}
.almanac-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 32px;
  margin-top: 16px;
}
.almanac-grid .span-2 { grid-column: 1 / -1; }
.almanac-span { color: var(--ink-2); font-size: var(--t-caption); line-height: 1.5; }
.almanac-span a { color: var(--accent); }
.sbead-link { text-decoration: none; color: inherit; cursor: pointer; }
.sbead-link:hover .sbead { background: var(--accent-tint); }
.sbead-link:hover .sbead.ton { background: transparent; }
.almanac-row { margin: 12px 0; }
.xi-line { margin: 0 0 6px; font-size: var(--t-caption); color: var(--ink-2); }
.xi-line strong { color: var(--ink); font-weight: 700; }

.ledger {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: var(--t-caption);
}
.ledger th {
  font-weight: 700;
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 8px 6px 0;
  border-bottom: 1px solid var(--line);
}
.ledger td {
  padding: 5px 8px 5px 0;
  border-bottom: 1px solid var(--line);
}
.ledger .l { text-align: left; }
.ledger .n {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}
.ledger td.l { color: var(--ink); }

.year-run {
  display: grid;
  grid-template-columns: minmax(3.5rem, auto) minmax(4rem, 1fr);
  align-items: center;
  gap: var(--space-2);
}
.year-run > span {
  font-family: var(--font-mono);
  text-align: right;
}
.year-run i {
  display: block;
  width: 6rem;
  height: 0.375rem;
  background: var(--bg-inset);
}
.year-run b {
  display: block;
  height: 100%;
  background: var(--accent);
}

.not-out-count {
  display: flex;
  justify-content: space-between;
  max-width: 13.5rem;
  margin: var(--space-2) 0 0;
  padding-top: var(--space-2);
  border-top: 1px dashed var(--line-strong);
  color: var(--ink-2);
  font-size: var(--t-caption);
}
.not-out-count strong {
  color: var(--ink);
  font-family: var(--font-mono);
}

.conv {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 36px;
  align-items: flex-end;
  margin: 16px 0 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.conv-k {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.conv-n {
  font-family: var(--font-display);
  font-size: var(--t-h3);
}
.conv-bar-wrap { flex: 1 1 200px; max-width: 280px; min-width: 160px; }
.conv-track {
  height: 6px;
  background: var(--bg-inset);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0 4px;
}
.conv-track span { display: block; height: 100%; background: var(--accent); }

.mix-row {
  display: grid;
  grid-template-columns: 92px 1fr 40px;
  gap: 8px;
  align-items: center;
  margin: 0 0 5px;
  font-size: var(--t-caption);
}
.mix-lab { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mix-track { height: 6px; background: var(--bg-inset); border-radius: 3px; overflow: hidden; }
.mix-track span { display: block; height: 100%; background: var(--accent); }
.almanac-row, .almanac-grid > div { overflow-x: auto; }
.mix-n { text-align: right; font-variant-numeric: tabular-nums; min-width: 2.2em; }

.score-beads { display: flex; flex-wrap: wrap; gap: 6px; }
.sbead {
  display: inline-block;
  min-width: 36px;
  padding: 4px 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-inset);
  border-radius: 2px;
}
.sbead.ton { border: 1px solid var(--gold); color: var(--gold); background: transparent; }
.sbead.fifty { color: var(--ink); }
.sbead.duck {
  color: var(--red);
  box-shadow: inset 0 -2px 0 color-mix(in oklab, var(--red) 70%, transparent);
}

.yr-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 88px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.yr {
  flex: 1 0 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
  min-width: 18px;
}
.yr i {
  display: block;
  width: 100%;
  max-width: 18px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}
.yr em {
  font-style: normal;
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.who { display: inline-flex; align-items: center; gap: 8px; }
.who .port { display: inline-block; }
.dnb .who { margin-right: 4px; }
.who-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-cause {
  font-size: var(--t-caption);
  line-height: 1.3;
  color: var(--ink-3);
  padding-left: 32px;
  font-variant-numeric: tabular-nums;
}
table.data td:has(.row-cause) { height: auto; padding-top: 8px; padding-bottom: 8px; }

.match-scores {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  margin: 2px 0 8px;
}

.fav-chip { display: inline-flex; align-items: center; gap: 6px; }

.xi-sheets { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 12px 0 28px; }
.playing-xi {
  margin: 12px 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.playing-xi summary {
  padding: 9px 0;
  color: var(--accent);
  font-size: var(--t-caption);
  cursor: pointer;
}
.xi-sheet h3 { font-family: var(--font-display); font-size: var(--t-h3); margin: 0 0 8px; }
.xi-sheet ol { list-style: none; margin: 0; padding: 0; }
.xi-sheet li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: var(--t-caption); }
.dnb { font-size: var(--t-caption); color: var(--ink-2); margin: 4px 0 16px; }
.dnb a { color: var(--accent); }
.row-tag {
  padding: 1px 5px;
  border: 1px solid color-mix(in oklab, var(--gold) 55%, var(--line));
  color: var(--gold);
  border-radius: 999px;
  font: 9px var(--font-ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.scorecard-totals {
  margin: -1px 0 14px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg-surface);
}
.scorecard-totals > div {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 80px minmax(180px, auto);
  gap: 12px;
  align-items: baseline;
  min-height: 32px;
  padding: 6px 12px 6px 16px;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-table);
}
.scorecard-totals > div:last-child { border-bottom: 0; }
.scorecard-totals strong { text-align: right; font-family: var(--font-mono); }
.scorecard-totals small { color: var(--ink-3); }

.wowy-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 12px; }
.wowy-head .scope { margin: 0; }

.matchup-name { display: flex; align-items: center; gap: 10px; }
.duel-card h2 { display: flex; align-items: center; gap: 10px; }

.palette button, .ac button {
  display: flex;
  align-items: center;
  gap: 10px;
}

a.ext { color: var(--accent); }

/* --- Collapsible nav --------------------------------------------------- */

.nav-toggle {
  display: none;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-height: 2.75rem;
  font: var(--t-caption) var(--font-ui);
  cursor: pointer;
}
.nav-toggle[aria-expanded="true"] { background: var(--accent-tint); border-color: var(--accent); }

/* --- Table tools + sticky headers -------------------------------------- */

.table-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.25rem;
}
.table-tools.bare { min-height: 0; }
.filter-hits {
  margin-bottom: 8px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
}

/* 100-row pages are the norm here, so long tables scroll inside their own box:
   the column headers and the pager both stay put while the rows move. */
.table-wrap.sticky-head { max-height: min(78vh, 900px); overflow-y: auto; }
.table-wrap.sticky-head thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line-strong);
}
.table-wrap.sticky-head thead tr:nth-child(2) th { top: var(--t-caption-lh); }
.table-wrap.sticky-head .table-foot {
  position: sticky;
  bottom: 0;
  z-index: 3;
  border-top: 1px solid var(--line-strong);
}

a.cell-clip {
  display: inline-block;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* --- Home: pulse header, jump rail, on this day ------------------------ */

.pulse-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
}
.pulse-head .fmt-row { margin-top: 0; }

.home-jump {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-5) 0 0;
}
.home-jump a {
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--ink);
  font-size: var(--t-caption);
}
.home-jump a:hover { border-color: var(--accent); color: var(--accent); }

.otd { margin-top: var(--space-7); }
.otd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5) var(--space-6);
}
.otd h3 {
  font-family: var(--font-display);
  font-size: var(--t-h3);
  font-weight: 600;
  margin: 0 0 var(--space-3);
}
.otd-row {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--t-caption);
  line-height: 1.35;
}
.otd-row:hover { color: var(--accent); }
.otd-year {
  flex: none;
  width: 3.2em;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.otd-body { min-width: 0; overflow-wrap: anywhere; }
.otd-body .caption { display: block; color: var(--ink-3); }

/* --- Manhattan (runs per over) ----------------------------------------- */

.manhattan { margin: 0 0 var(--space-5); }
.mh-cap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-3);
  color: var(--ink-2);
  font-size: var(--t-caption);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mh-key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.mh-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}
.mh-swatch.wkt { background: var(--red); border-radius: 50%; margin-left: var(--space-3); }

.mh-plot {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 96px;
  padding-top: 10px;
  border-bottom: 1px solid var(--line-strong);
}
.mh-bar {
  position: relative;
  flex: 1 1 0;
  min-width: 3px;
  height: 100%;
  display: flex;
  align-items: flex-end;
}
.mh-bar i {
  display: block;
  width: 100%;
  background: color-mix(in oklab, var(--accent) 70%, var(--bg-inset));
  border-radius: 1px 1px 0 0;
}
.mh-bar:hover i { background: var(--accent); }
.mh-bar.has-wkt i { background: var(--red); }
.mh-bar.empty i { background: var(--bg-inset); }
.mh-wkt {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--red);
  color: var(--on-accent);
  font: 700 8px/6px var(--font-mono);
  font-style: normal;
  text-align: center;
  padding: 0 1px;
}
.mh-axis {
  position: relative;
  height: 1.25rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
}
.mh-axis span { position: absolute; top: 3px; transform: translateX(-50%); }

/* --- Progression (cumulative runs) ------------------------------------- */

.progression { margin: 0 0 var(--space-5); }
.progression svg { width: 100%; height: auto; }
.pg-grid { stroke: var(--line); stroke-width: 1; }
.pg-axis { fill: var(--ink-3); font: 10px var(--font-mono); }
.pg-target { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 4 4; }
.pg-line { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pg-wkt { fill: var(--red); }
.pg-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: 0;
}
.pg-key i { width: 14px; height: 3px; border-radius: 2px; }
.pg-0 { stroke: var(--accent); }
.pg-0 i { background: var(--accent); }
.pg-1 { stroke: var(--series-b); }
.pg-1 i { background: var(--series-b); }
.pg-2 { stroke: var(--gold); }
.pg-2 i { background: var(--gold); }
.pg-3 { stroke: var(--red); }
.pg-3 i { background: var(--red); }

/* --- Card clusters: performers, stats, formats ------------------------- */

.performers,
.stat-cards,
.format-cards {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-5) 0;
}
.performers { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat-cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.format-cards { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.performer,
.stat-card,
.format-card {
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-panel);
  padding: var(--space-4);
}

.performer h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--t-h3);
  font-weight: 600;
}
.performer h3 a { color: var(--ink); }
.performer h3 a:hover { color: var(--accent); }
.performer-kicker,
.sc-kicker {
  color: var(--ink-3);
  font-size: var(--t-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.performer-line {
  font-family: var(--font-mono);
  font-size: var(--t-h2);
  line-height: var(--t-h2-lh);
}
.performer .caption { margin: var(--space-1) 0 0; color: var(--ink-3); }

.sc-figure {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--t-h2);
  line-height: var(--t-h2-lh);
  font-variant-numeric: tabular-nums lining-nums;
}
.stat-card .caption { margin: var(--space-1) 0 0; color: var(--ink-3); }
.sc-link { display: inline-block; margin-top: var(--space-2); font-size: var(--t-caption); }

.fc-comp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.fc-comp .caption { color: var(--ink-3); }
.fc-line { font-size: var(--t-body); }
.fc-line strong { font-family: var(--font-mono); font-size: var(--t-h3); }
.format-card .caption { margin: var(--space-1) 0 0; color: var(--ink-3); }

/* --- Record / preset tab strips ---------------------------------------- */

.record-tabs + .record-tabs { margin-top: var(--space-2); }
.record-tabs .chip { font-family: var(--font-ui); }
.record-tabs .chip.on {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.record-tabs .chip.on:hover { background: var(--accent-strong); }

/* --- Compare suggestions ---------------------------------------------- */

.suggest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-6);
  max-width: 60rem;
}
.suggest-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-panel);
  padding: var(--space-4);
  color: var(--ink);
  text-decoration: none;
}
.suggest-card:hover { border-color: var(--accent); }
.suggest-names {
  display: block;
  font-family: var(--font-display);
  font-size: var(--t-h3);
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.suggest-card .caption { color: var(--ink-3); }

.match-result {
  margin: var(--space-2) 0 var(--space-5);
  color: var(--ink-2);
  font-size: var(--t-body);
}

@media print {
  .topbar, .provenance, #query-shell, .jump, .studio-links, .fav-star,
  .compare-tray, .toast, .search-toggle, .theme-toggle, #print-player { display: none !important; }
  body { background: #fff; color: #1c2740; }
  #main.shell { max-width: none; padding: 0; }
  .port-lg { width: 90px; height: 120px; }
}

@media (max-width: 1120px) {
  .h2h { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .almanac-grid, .xi-sheets, .player-hero, .h2h, .duel {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }
  .almanac-grid .span-2 { grid-column: auto; }
  .conv { grid-template-columns: 1fr 1fr; }
  .mix-row { grid-template-columns: 72px 1fr 2.4em; }
  .port-lg { width: 96px; height: 128px; }
  .form-block { flex-direction: column; align-items: flex-start; }
  .stats-toolbar { align-items: stretch; flex-direction: column; }
  .view-options { justify-content: flex-start; }
}

@media (max-width: 1040px) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .util { display: none; }
  body.nav-open .util {
    display: flex;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: var(--space-2);
    border-top: 1px solid var(--line);
  }
  .util a { width: 100%; border-bottom: 1px solid var(--line); }
  .util a.active { border-bottom-color: var(--accent); }
  .util .data-date { padding: var(--space-3) 0; }
  .util .theme-toggle,
  .util .shortcuts-btn,
  .util .search-toggle { margin: var(--space-2) 0; }
}

/* ── Value model ───────────────────────────────────────────────────────── */

.value-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: var(--space-4);
  margin: var(--space-4) 0;
}

.value-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--bg-surface);
  padding: var(--space-4);
}

.value-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.value-panel h3 {
  font-size: var(--t-h3);
  line-height: var(--t-h3-lh);
  margin: 0;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
}

.value-cell .name {
  font-size: var(--t-caption);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 4px;
}

.value-cell .val {
  font-family: var(--font-mono);
  font-size: 22px;
  line-height: 28px;
  font-variant-numeric: tabular-nums lining-nums;
}

.value-cell .val.neg { color: var(--red); }

.skill-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0 var(--space-5);
  margin: var(--space-3) 0 var(--space-4);
}

.skill-row {
  display: grid;
  grid-template-columns: 1fr auto auto 14px;
  align-items: center;
  gap: var(--space-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.skill-lab { color: var(--ink); }

.skill-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
}

.skill-val.pos { color: var(--green-pos); }
.skill-val.neg { color: var(--red); }
.skill-unit { font-size: var(--t-caption); color: var(--ink-3); }

.slice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: var(--space-4) var(--space-5);
  margin: var(--space-3) 0 var(--space-5);
}

.slice-head {
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: var(--space-4) 0 0;
}

.slice-title {
  font-size: var(--t-caption);
  color: var(--ink-2);
  margin: 0 0 var(--space-2);
}

.slice-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr 3.6rem 3.4rem;
  align-items: center;
  gap: var(--space-2);
  padding: 3px 0;
}

.slice-lab {
  font-size: var(--t-caption);
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slice-track {
  position: relative;
  height: 10px;
  background: var(--bg-inset);
  border-radius: 2px;
}

.slice-mid {
  position: absolute;
  left: 50%;
  top: -1px;
  bottom: -1px;
  width: 1px;
  background: var(--line-strong);
}

.slice-fill {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 1px;
}

.slice-fill.pos { background: var(--green-pos); }
.slice-fill.neg { background: var(--red); }

.slice-val,
.slice-exp {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
}

.slice-val.pos { color: var(--green-pos); }
.slice-val.neg { color: var(--red); }
.slice-exp { color: var(--ink-3); }

/* ── Resource heatmaps ─────────────────────────────────────────────────── */

.heat-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr));
  gap: var(--space-5);
  margin: var(--space-4) 0;
}

.heatmap { margin: 0; }

.heatmap figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-2);
}

.heat-scroll { overflow-x: auto; }

table.heat {
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  font-variant-numeric: tabular-nums lining-nums;
}

table.heat th {
  color: var(--ink-3);
  font-weight: 500;
  padding: 2px 6px;
  text-align: right;
}

table.heat th.l { text-align: right; padding-right: var(--space-3); }

table.heat td {
  padding: 2px 6px;
  text-align: right;
  min-width: 2.4rem;
  color: var(--ink);
  /* One flat tint per cell. A gradient would read as a bar inside the cell and
     invite comparison along the wrong axis. */
  background: color-mix(in oklch, var(--accent) var(--fill, 0%), var(--bg-inset));
  border: 1px solid var(--bg-app);
}

table.heat td.thin { opacity: 0.55; }

table.heat td.empty-cell {
  background: none;
  border-color: transparent;
}

.heat-axis { margin-top: var(--space-2); }

.callout {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
}

.callout h3 {
  font-size: var(--t-h3);
  line-height: var(--t-h3-lh);
  margin: 0 0 var(--space-2);
}

.callout p { margin: 0 0 var(--space-2); color: var(--ink-2); }
.callout p:last-child { margin-bottom: 0; }

.check-note {
  align-self: end;
  font-size: var(--t-caption);
  color: var(--ink-3);
  padding-bottom: 6px;
}

@media (max-width: 720px) {
  .shell, .provenance { padding-left: var(--space-4); padding-right: var(--space-4); }
  .topbar { padding: var(--space-2) var(--space-4); }
  .query-wrap.hero { margin-top: var(--space-4); }
  .ribbon { gap: var(--space-3) var(--space-4); }
  .table-wrap { margin-left: calc(var(--space-4) * -1); margin-right: calc(var(--space-4) * -1); }
  table.data th:first-child, table.data td:first-child { position: static; }
  .table-wrap.sticky-head { max-height: none; overflow-y: visible; }
  .table-wrap.sticky-head thead th { position: static; }
  .table-filter { width: 100%; }
  .performers, .stat-cards, .format-cards, .otd-grid, .suggest-grid { grid-template-columns: 1fr; }
  .mh-plot { height: 76px; }
  .metrics-layout { grid-template-columns: 1fr; gap: var(--space-5); }
  .metric-card .val { font-size: 22px; line-height: 28px; }
  .value-panels, .heat-pair, .slice-grid, .skill-list { grid-template-columns: 1fr; }
  .slice-row { grid-template-columns: 7rem 1fr 3.2rem 3rem; }
  .scorecard-totals > div {
    grid-template-columns: 1fr auto;
    row-gap: 2px;
  }
  .scorecard-totals > div small { grid-column: 1 / -1; text-align: right; }
}
