/* ============================================================
   BOYZ IN MOTION — Components CSS
   Reusable UI components, per DESIGN.md.
   (Hall of Fame and trophy cabinet styles live in islands.css.)
   ============================================================ */

/* Shared: the uppercase mono label used above titles and under stats */
.hero-eyebrow,
.hero-stat-label,
.stat-card-label,
.trophy-label,
.mini-stat-lbl,
.award-title,
.callout-label,
.year-selector-wrap label,
.draft-filter-manager label,
.h2h-stat-lbl,
.flip-back-title,
.pr-control-label,
.drival-rivalry-sub,
.drival-model-label,
.rivalry-label,
.manager-join-year,
.bs-mid,
.bs-champ-badge,
.bs-bench-divider {
  font-family: var(--font-data) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  line-height: 1.3;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--text-muted);
}

/* ─── Home hero ──────────────────────────────────────────────── */
.hero {
  padding: var(--sp-80) 0 var(--sp-48);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sp-48);
  align-items: end;
}

.hero-eyebrow {
  margin-bottom: var(--sp-20);
  animation: fadeInUp 300ms ease-out both;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  animation: fadeInUp 300ms ease-out 40ms both;
}

.hero-subtitle {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: var(--sp-20);
  animation: fadeInUp 300ms ease-out 80ms both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-8);
  margin-top: var(--sp-32);
  animation: fadeInUp 300ms ease-out 120ms both;
}

/* Three figures set as one box score */
.hero-stats {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(132px, auto);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: fadeInUp 300ms ease-out 160ms both;
}

.hero-stat {
  padding: var(--sp-20) var(--sp-24);
  border-left: 1px solid var(--border);
}
.hero-stat:first-child { border-left: none; }

.hero-stat-value {
  font-family: var(--font-data);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.hero-stat-label { margin-top: var(--sp-8); }

@media (max-width: 960px) {
  .hero { padding: var(--sp-64) 0 var(--sp-40); }
  .hero-inner { grid-template-columns: 1fr; gap: var(--sp-40); align-items: start; }
  .hero-stats { grid-auto-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero { padding: var(--sp-48) 0 var(--sp-32); }
  .hero-title { font-size: 44px; }
  .hero-stat { padding: var(--sp-16); }
  .hero-stat-value { font-size: 24px; }
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-mid); }

.card-sm { padding: var(--sp-16); }
.card-lg { padding: var(--sp-32); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-16);
  padding-bottom: var(--sp-12);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* ─── Stat card ──────────────────────────────────────────────── */
.stat-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-20);
  min-width: 0;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-mid); }

.stat-card-value {
  font-family: var(--font-data);
  font-size: 28px !important;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  margin-bottom: var(--sp-8);
}

.stat-card-sub {
  font-size: 12px !important;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  margin-top: var(--sp-4);
}

/* Four or more stat cards read as one box score: one outer border, hairlines between cells */
.stat-group,
.manager-career-stats,
.score-highlights {
  display: grid;
  gap: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stat-group > .stat-card,
.manager-career-stats > .stat-card,
.score-highlights > .stat-card {
  /* transparent so a cell never paints over its neighbour's hairline */
  background: transparent;
  border: none;
  border-radius: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0 -1px -1px 0;
  animation: none;
}

/* ─── Rank badge ─────────────────────────────────────────────── */
.rank-badge,
.finish-badge,
.stat-rank,
.pr-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 var(--sp-8);
  border-radius: var(--radius-pill) !important;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.rank-1, .pr-rank-1 {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.rank-2, .rank-3, .pr-rank-2, .pr-rank-3 {
  background: var(--bg-surface);
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.rank-other, .rank-last {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-muted);
}

.rank-cell { width: 56px; }

.finish-badge { width: auto !important; padding: 0 var(--sp-8) !important; }

/* Rank badge sits top-right of its stat card */
.stat-rank {
  position: absolute;
  top: var(--sp-16);
  right: var(--sp-16);
}

/* ─── Trophy card (Records page) ─────────────────────────────── */
.trophy-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: var(--sp-8);
  animation: fadeInUp 300ms ease-out both;
  transition: border-color var(--transition);
}

.trophy-card:hover { border-color: var(--border-mid) !important; }

.trophy-icon { font-size: 24px; line-height: 1; }
.trophy-img  { width: 72px; height: 72px; object-fit: contain; }

.trophy-label { margin-bottom: var(--sp-8); }

.trophy-holder {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary) !important;
  margin-top: var(--sp-4);
}

.trophy-holder span {
  font-family: var(--font-data);
  font-size: 12px !important;
  font-weight: 400;
  letter-spacing: 0;
}

.trophy-value {
  font-family: var(--font-data);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.trophy-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Tooltip ────────────────────────────────────────────────── */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-family: var(--font-body);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  cursor: default;
  position: relative;
  vertical-align: middle;
  margin-left: var(--sp-4);
  user-select: none;
}

.info-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-inverse);
  color: #fff;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
  padding: var(--sp-8) var(--sp-12);
  border-radius: var(--radius);
  white-space: normal;
  width: 180px;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 10;
  box-shadow: var(--shadow-float);
}

.info-tip:hover::after,
.info-tip:focus::after { opacity: 1; }

/* ─── Avatar ─────────────────────────────────────────────────── */
.avatar {
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  background: var(--bg-surface-2) !important;
  /* 2px white ring with a 1px hairline outside it */
  border: 2px solid var(--bg-surface);
  outline: 1px solid var(--border);
  outline-offset: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  z-index: 2;
}

.avatar-fallback {
  position: relative;
  z-index: 1;
  color: var(--text-primary);
  font-size: var(--avatar-font-size, 14px);
  pointer-events: none;
  letter-spacing: 0;
}

.avatar-xs { width: 24px;  height: 24px;  --avatar-font-size: 9px; border-width: 1px; }
.avatar-sm { width: 40px;  height: 40px;  --avatar-font-size: 13px; }
.avatar-md { width: 40px;  height: 40px;  --avatar-font-size: 13px; }
.avatar-lg { width: 72px;  height: 72px;  --avatar-font-size: 22px; }
.avatar-xl { width: 120px; height: 120px; --avatar-font-size: 36px; }

a:hover > .avatar { outline-color: var(--border-mid); }

/* ─── Tables ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead { background: var(--bg-surface-2); }

.data-table th {
  height: 40px;
  padding: 0 var(--sp-16);
  text-align: left;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: default;
}

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text-primary); }
.data-table th .sort-arrow { margin-left: 4px; }
.data-table th.sort-asc .sort-arrow::after  { content: ' ↑'; }
.data-table th.sort-desc .sort-arrow::after { content: ' ↓'; }

.data-table td {
  height: 44px;
  padding: var(--sp-8) var(--sp-16);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}

.data-table td strong { color: var(--text-primary); }

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.highlight-row { background: var(--accent-wash); }

/* Numbers: mono, tabular, right-aligned */
.data-table .num,
.points-cell,
.record-cell,
.pr-num {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.points-cell { font-size: 14px; }

.record-cell {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary) !important;
}

/* Manager cell */
.manager-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
}

.manager-cell a { color: var(--text-primary); font-weight: 500; }
.manager-cell .team-name { font-size: 12px; color: var(--text-muted); line-height: 1.35; }

/* Single-line rows carry the small avatar so they hold the 44px row */
.data-table .avatar-sm { width: 24px; height: 24px; --avatar-font-size: 9px; border-width: 1px; }
.standings-table .avatar-sm { width: 40px; height: 40px; --avatar-font-size: 13px; border-width: 2px; }
.standings-table td { height: 60px; }

/* Streak: status dot + mono text, no fill */
.streak {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  font-family: var(--font-data);
  font-size: 14px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.streak::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--loss);
  flex-shrink: 0;
}

.streak-win { color: var(--text-primary); font-weight: 500; }
.streak-win::before  { background: var(--win); }
.streak-loss::before { background: var(--loss); }

/* ─── Year selector ──────────────────────────────────────────── */
.year-selector-wrap,
.draft-filter-manager {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  min-width: 0;
}

.year-select {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  height: 36px;
  padding: 0 var(--sp-32) 0 var(--sp-12);
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2378716c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.year-select:hover { border-color: var(--text-faint); }
.year-select:focus { outline: 2px solid var(--text-primary); outline-offset: 2px; }

/* ─── Pill group (tabs, season switcher, toggles) ────────────── */
.pill-group,
.pr-toggle,
.tabs {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  max-width: 100%;
}
.pill-group::-webkit-scrollbar,
.pr-toggle::-webkit-scrollbar,
.tabs::-webkit-scrollbar { display: none; }

.pill-tab,
.pr-toggle-btn,
.tab-btn {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 var(--sp-12);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.pill-tab { font-family: var(--font-data); font-size: 12px; font-variant-numeric: tabular-nums; }

.pill-tab:hover,
.pr-toggle-btn:hover,
.tab-btn:hover { border-color: var(--border-mid); background: var(--bg-surface); }

.pill-tab.is-active,
.pr-toggle-btn.is-active,
.tab-btn.active {
  background: var(--bg-inverse);
  border-color: var(--bg-inverse);
  color: #fff;
}

.tabs { margin-bottom: var(--sp-24); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  padding: var(--sp-8) var(--sp-16);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  cursor: pointer;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-outline,
.btn-ghost,
.btn-trophy-case,
.flip-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  color: var(--text-primary);
}
.btn-outline:hover,
.btn-ghost:hover,
.btn-trophy-case:hover,
.flip-btn:hover {
  background: var(--bg-surface-2);
  border-color: var(--text-faint);
  color: var(--text-primary);
}

.btn-sm { padding: var(--sp-4) var(--sp-12); font-size: 12px !important; }
.btn-lg { padding: var(--sp-12) var(--sp-20); font-size: 16px; }

/* Text link with trailing chevron */
.link-chevron {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  color: var(--text-primary);
  font-weight: 500;
}
.link-chevron::after { content: '›'; font-size: 16px; line-height: 1; }

/* ─── Pill / tag ──────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-8);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  white-space: nowrap;
}

.pill-accent,
.pill-win,
.pill-loss,
.pill-neutral { background: transparent; color: var(--text-secondary); border-color: var(--border); }

/* A manager with rings: ink outline. Without: quiet. */
.pill-gold { background: transparent; color: var(--text-primary); border-color: var(--text-primary); }
.pill-neutral { color: var(--text-muted); }

/* ─── Position chip ───────────────────────────────────────────── */
.pos-chip,
.pr-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 2px var(--sp-8);
  border-radius: var(--radius-pill);
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--pos-bench);
}

.pos-QB,  .pr-pos-qb { background: var(--pos-qb); }
.pos-RB,  .pr-pos-rb { background: var(--pos-rb); }
.pos-WR,  .pr-pos-wr { background: var(--pos-wr); }
.pos-TE,  .pr-pos-te { background: var(--pos-te); }
.pos-K               { background: var(--pos-k); }
.pos-DEF, .pos-DST   { background: var(--pos-def); }
.pos-FLEX            { background: var(--pos-flex); }
.pos-BE              { background: var(--pos-bench); }

/* ─── Controls row ────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  gap: var(--sp-16);
  margin-bottom: var(--sp-24);
  flex-wrap: wrap;
}

.controls-left  { display: flex; align-items: center; gap: var(--sp-12); flex: 1; }
.controls-right { display: flex; align-items: center; gap: var(--sp-12); margin-left: auto; }

/* ─── Last updated ────────────────────────────────────────────── */
.last-updated {
  font-family: var(--font-data);
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  white-space: nowrap;
}

.last-updated::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--win);
}

/* ─── Manager card ────────────────────────────────────────────── */
.manager-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad) var(--card-pad) 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "avatar name"
    "avatar tagline"
    "stats  stats";
  column-gap: var(--sp-16);
  align-content: start;
  text-align: left;
  transition: border-color var(--transition);
  cursor: pointer;
  color: inherit;
}

.manager-card:hover {
  border-color: var(--border-mid);
  text-decoration: none;
  color: inherit;
}

.manager-card > .avatar { grid-area: avatar; align-self: start; }

.manager-card .manager-name {
  grid-area: name;
  align-self: end;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.manager-card .manager-tagline {
  grid-area: tagline;
  align-self: start;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  margin-top: var(--sp-4);
}

.manager-card .manager-mini-stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: var(--sp-20) calc(var(--card-pad) * -1) 0;
  border-top: 1px solid var(--border);
}

.manager-card .manager-mini-stats > div {
  padding: var(--sp-12) var(--sp-16);
  border-left: 1px solid var(--border);
}
.manager-card .manager-mini-stats > div:first-child { border-left: none; padding-left: var(--card-pad); }

.manager-card .mini-stat-val {
  font-family: var(--font-data);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ─── Award card ──────────────────────────────────────────────── */
.award-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-16) var(--sp-20);
  display: flex;
  align-items: center;
  gap: var(--sp-16);
  transition: border-color var(--transition);
}

.award-card:hover { border-color: var(--border-mid); }

.award-emoji { font-size: 20px; line-height: 1; flex-shrink: 0; width: 24px; text-align: center; }

.award-info { flex: 1; min-width: 0; }

.award-winner {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.award-detail {
  font-family: var(--font-data);
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* The one featured card on the page: the most recent champion */
.award-card.award-featured {
  background: var(--bg-feature);
  border-color: var(--bg-feature);
  border-radius: var(--radius-xl);
  padding: var(--sp-32);
  grid-column: 1 / -1;
}
.award-card.award-featured:hover { border-color: var(--bg-feature); }
.award-card.award-featured .award-emoji { font-size: 28px; width: 32px; }
.award-card.award-featured .award-title { color: var(--text-secondary); }
.award-card.award-featured .award-winner {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.award-card.award-featured .avatar-sm { width: 72px; height: 72px; --avatar-font-size: 22px; border-color: var(--bg-feature); outline-color: rgba(12, 10, 9, 0.12); }

/* ─── H2H matrix cell ─────────────────────────────────────────── */
.matrix-cell {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  text-align: center;
  height: 40px;
  min-width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: default;
}

.matrix-self { background: var(--bg-surface-2); color: var(--text-faint); }

/* ─── Back link ───────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: var(--sp-32);
}
.back-link:hover { color: var(--text-primary); }
.back-link::before { content: '←'; font-family: var(--font-data); }

/* ─── Season history ──────────────────────────────────────────── */
.season-result {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}

/* ─── Callout card (best / worst season) ─────────────────────── */
.callout-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
}

.callout-label { margin-bottom: var(--sp-12); }

.callout-value {
  font-family: var(--font-data);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.callout-card.callout-loss .callout-value { color: var(--text-muted); font-weight: 400; }

.callout-sub {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  margin-top: var(--sp-8);
}

/* ─── Constitution ────────────────────────────────────────────── */
.constitution-content {
  max-width: 680px;
  margin: 0 auto;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-primary);
}

.constitution-content h2,
.constitution-content h3,
.constitution-content h4 {
  font-family: var(--font-heading);
  font-weight: 600;
}

.constitution-content h2 {
  font-size: 24px;
  margin-top: var(--sp-48);
  margin-bottom: var(--sp-16);
  padding-top: var(--sp-24);
  border-top: 1px solid var(--border);
}

.constitution-content h3 { font-size: 20px; margin-top: var(--sp-32); margin-bottom: var(--sp-12); }
.constitution-content h4 { font-size: 16px; margin-top: var(--sp-24); margin-bottom: var(--sp-8); }

.constitution-content p {
  color: var(--text-primary);
  margin-bottom: var(--sp-16);
}

.constitution-content a { text-decoration: underline; text-underline-offset: 3px; }

.constitution-content ul {
  list-style: disc;
  padding-left: var(--sp-24);
  margin-bottom: var(--sp-16);
}

.constitution-content ul li { margin-bottom: var(--sp-8); }

.constitution-content hr {
  border: none !important;
  border-top: 1px solid var(--border) !important;
  margin: var(--sp-32) 0 !important;
}

.constitution-content table {
  margin-bottom: var(--sp-24);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  font-family: var(--font-body);
  font-size: 14px;
}

.constitution-content th {
  background: var(--bg-surface-2);
  padding: var(--sp-12) var(--sp-16);
  text-align: left;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.constitution-content td {
  padding: var(--sp-12) var(--sp-16);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
}

.constitution-content strong { font-weight: 600; }
.constitution-content code {
  background: var(--bg-surface-3);
  padding: 1px 6px;
  border-radius: var(--radius);
  font-size: 0.85em;
  font-family: var(--font-data);
}

/* ─── Draft board ─────────────────────────────────────────────── */
.draft-board-wrap {
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.draft-board {
  border-collapse: collapse;
  width: 100%;
  min-width: 1040px;
  table-layout: fixed;
}

.draft-board th {
  background: var(--bg-surface-2);
  padding: var(--sp-12) var(--sp-8);
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
}

.draft-board th span { font-size: 11px !important; }
.draft-board th:first-child { width: 64px; }

.draft-board td {
  padding: var(--sp-8);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  vertical-align: top;
  background: var(--bg-surface);
  overflow: hidden;
  transition: opacity var(--transition), background var(--transition);
}

.draft-board tbody tr:last-child td { border-bottom: none; }

.draft-pick-number {
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--sp-4);
}

.draft-board .pos-chip { min-width: 0; padding: 1px 6px; font-size: 11px; }

.draft-player-name {
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  overflow-wrap: anywhere;
  margin-top: var(--sp-4);
}

.draft-manager-name { font-size: 12px; color: var(--text-muted); }

.draft-round-header {
  background: var(--bg-surface-2) !important;
  font-family: var(--font-data);
  font-size: 11px !important;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  vertical-align: middle !important;
  text-align: center;
}

/* ─── Chart container ─────────────────────────────────────────── */
.chart-container {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
}

/* ─── Designated rivalry cards ────────────────────────────────── */
.drival-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-16);
}

@media (max-width: 960px) { .drival-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .drival-grid { grid-template-columns: 1fr; } }

.drival-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition);
}

/* Flip card: front = matchup, back = why the rivalry is named that */
.drival-flip {
  perspective: 1400px;
  cursor: pointer;
  border-radius: var(--radius-lg);
  /* room for the origin story and game log on the back */
  min-height: 264px;
}

.drival-flip:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.drival-flip-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
  height: 100%;
  position: relative;
}

.drival-flip.is-flipped .drival-flip-inner { transform: rotateY(180deg); }

.drival-face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
}

.drival-face > .drival-card {
  flex: 1;
  /* Also needed on the child: under preserve-3d the inner card can otherwise
     bleed through the hidden face in Safari and some Chromium builds. */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* The back is taken out of flow so the front sets the height; overflow on the back scrolls. */
.drival-face-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}

.drival-face-back > .drival-card {
  height: 100%;
  min-height: 0;
}

/* Only the face that is showing takes pointer input. */
.drival-face-back { pointer-events: none; }
.drival-flip.is-flipped .drival-face-back { pointer-events: auto; }
.drival-flip.is-flipped .drival-face-front { pointer-events: none; }

.drival-flip:hover .drival-card,
.drival-card:hover { border-color: var(--border-mid); }

.drival-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-12);
  padding: var(--sp-20) var(--card-pad) 0;
}

.drival-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.drival-week-badge {
  flex-shrink: 0;
  font-family: var(--font-data);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px var(--sp-8);
}

.drival-badge-muted { color: var(--text-muted); }

.drival-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-12);
  padding: var(--sp-24) var(--card-pad);
  flex: 1;
}

.drival-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-8);
  min-width: 0;
}

.drival-mgr-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
}

.drival-center { text-align: center; }

.drival-rivalry-record {
  font-family: var(--font-data);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.drival-rivalry-sub { margin-top: var(--sp-8); white-space: nowrap; }

.drival-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-12);
  padding: var(--sp-12) var(--card-pad);
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border);
  font-size: 12px;
  min-height: 44px;
}

.drival-trophy-placeholder,
.drival-trophy {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  white-space: nowrap;
  min-width: 0;
  color: var(--text-muted);
}

.drival-trophy { cursor: help; }
.drival-trophy-emoji { font-size: 14px; line-height: 1; }

.drival-trophy-name {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.drival-flip-hint {
  margin-left: auto;
  font-size: 14px;
  line-height: 1;
  color: var(--text-faint);
  transition: color var(--transition);
  flex-shrink: 0;
}

.drival-flip:hover .drival-flip-hint { color: var(--text-primary); }

/* Back face */
.drival-back-body {
  padding: var(--sp-16) var(--card-pad);
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}

.drival-back-body::-webkit-scrollbar { width: 6px; }
.drival-back-body::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }

.drival-model {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.drival-model-label { display: block; margin-bottom: var(--sp-4); }

.drival-origin {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.drival-trophy-note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-8);
  padding-top: var(--sp-12);
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.drival-trophy-note strong { font-weight: 600; color: var(--text-primary); }

.drival-back-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.drival-blurb {
  padding: 0 var(--card-pad) var(--sp-16);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

/* Game log on the back of a rivalry card */
.drival-log { margin: 0 calc(var(--card-pad) * -1); width: auto; border-top: 1px solid var(--border); }
.drival-log table { font-size: 12px; }
.drival-log th { height: 32px; padding: 0 var(--sp-12); }
.drival-log td { height: 36px; padding: var(--sp-4) var(--sp-12); font-size: 12px; }
.drival-log th:first-child, .drival-log td:first-child { padding-left: var(--card-pad); }
.drival-log th:last-child,  .drival-log td:last-child  { padding-right: var(--card-pad); }

@media (prefers-reduced-motion: reduce) {
  .drival-flip-inner { transition: none; }
}

/* ─── Rivalry spotlight ────────────────────────────────────────── */
.rivalry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  display: flex;
  align-items: center;
  gap: var(--sp-16);
  transition: border-color var(--transition);
}

.rivalry-card:hover { border-color: var(--border-mid); }

.rivalry-vs {
  font-family: var(--font-data);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.rivalry-score {
  font-family: var(--font-data);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ─── Reputation tag ──────────────────────────────────────────── */
.reputation-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-pill);
  padding: var(--sp-4) var(--sp-12);
  font-size: 14px;
  color: var(--text-secondary);
}

/* ─── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-48) var(--sp-16);
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-state .empty-icon { font-size: 24px; margin-bottom: var(--sp-12); }
.empty-state p { color: var(--text-muted); }

/* ─── Modals (head-to-head log, box score) ────────────────────── */
.h2h-modal-overlay,
.champ-banner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 9, 0.45);
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-24);
  opacity: 0;
  transition: opacity var(--transition);
}

.h2h-modal-overlay.tc-visible,
.champ-banner-overlay.champ-banner-visible { opacity: 1; }

.h2h-modal {
  width: min(560px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  max-height: 82vh;
}

.h2h-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-16);
  padding: var(--sp-16) var(--sp-20);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.h2h-modal-title {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.h2h-modal-title .avatar-sm { width: 24px; height: 24px; --avatar-font-size: 9px; border-width: 1px; }

.h2h-modal-mgr { color: inherit; }

.h2h-modal-stats {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.h2h-stat {
  flex: 1;
  padding: var(--sp-16) var(--sp-20);
  border-right: 1px solid var(--border);
}
.h2h-stat:last-child { border-right: none; }

.h2h-stat-val {
  font-family: var(--font-data);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.h2h-stat-lbl { margin-top: var(--sp-4); }

.h2h-modal-body { overflow-y: auto; flex: 1; }
.h2h-modal-body .data-table thead { position: sticky; top: 0; z-index: 2; }

/* Tags inside the game log stay quiet */
.h2h-modal .pill {
  background: transparent !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border);
  font-size: 11px !important;
  padding: 0 6px !important;
}

/* ─── Champion banner (off-season pop-up) ─────────────────────── */
.champ-banner-overlay { overflow: hidden; z-index: 1000; }

.champ-confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.champ-confetti-piece {
  position: absolute;
  top: -20px;
  opacity: 0;
  animation: confetti-fall linear infinite;
}

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg);   opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(var(--rot, 360deg)); opacity: 0; }
}

/* The reigning champion is the page's featured card */
.champ-banner-card {
  background: var(--bg-feature);
  border-radius: var(--radius-xl);
  padding: var(--sp-32);
  max-width: 400px;
  width: 100%;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-8);
  box-shadow: var(--shadow-float);
}

.champ-banner-close {
  position: absolute;
  top: var(--sp-12);
  right: var(--sp-12);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(12, 10, 9, 0.16);
  color: var(--text-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), color var(--transition);
}
.champ-banner-close:hover { border-color: var(--text-primary); color: var(--text-primary); }

.champ-banner-trophy { font-size: 40px; line-height: 1; }

.champ-banner-eyebrow {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-top: var(--sp-8);
}

.champ-banner-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.champ-banner-avatar-wrap { position: relative; margin: var(--sp-12) 0 var(--sp-4); }
.champ-banner-avatar-ring { display: none; }
.champ-banner-card .avatar { border-color: var(--bg-feature); outline-color: rgba(12, 10, 9, 0.16); }

.champ-banner-name {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.champ-banner-team { font-size: 14px; color: var(--text-secondary); }
.champ-banner-sub  { font-size: 14px; color: var(--text-secondary); }

.champ-banner-actions {
  display: flex;
  gap: var(--sp-8);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--sp-16);
}

.champ-banner-btn,
.champ-banner-btn-alt {
  padding: var(--sp-8) var(--sp-16);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  transition: background var(--transition), border-color var(--transition);
}

.champ-banner-btn { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.champ-banner-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.champ-banner-btn-alt { background: var(--bg-surface); border: 1px solid var(--border-mid); color: var(--text-primary); }
.champ-banner-btn-alt:hover { border-color: var(--text-faint); }
