:root {
  --bg: #f4f6fa;
  --panel-bg: #ffffff;
  --text: #171a23;
  --muted: #6b7180;
  --border: #e4e8f0;
  --border-strong: #999;

  --accent: #1E56E0;
  --accent-dark: #143FA6;
  --accent-2: #22B8D8;
  --accent-grad: linear-gradient(135deg, #143FA6 0%, #1E56E0 55%, #22B8D8 130%);
  --nav-bg: #ffffff;
  --nav-fg: #171a23;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20,30,60,0.06), 0 1px 1px rgba(20,30,60,0.04);
  --shadow-md: 0 10px 26px rgba(20,30,60,0.12), 0 2px 6px rgba(20,30,60,0.07);

  --avatar-palette: #1E56E0, #22B8D8, #6A4C93, #2E8B57, #C1447E, #E8652B, #445E93, #B92F1C;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Nav ---------- */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  color: var(--nav-fg);
  padding: 12px 24px;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
}
.topnav .brand {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--nav-fg);
}
.topnav .brand::before {
  content: '';
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: inline-block;
  box-shadow: 0 0 10px rgba(30,86,224,0.5);
}
.topnav .beta-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(30,86,224,0.1);
  color: var(--accent-dark);
  border: 1px solid rgba(30,86,224,0.25);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 4px;
  text-transform: uppercase;
}
.topnav .nav-links { display: flex; gap: 2px; flex-wrap: wrap; }
.topnav a {
  color: #565b6b;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease;
}
.topnav a:hover { background: #f0f3fa; color: var(--text); }
.topnav a.active {
  background: var(--accent);
  color: #fff;
}

main {
  padding: 22px 20px 40px;
  max-width: 1440px;
  margin: 0 auto;
}

h1 {
  font-size: 26px;
  margin: 6px 0 2px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.page-tagline {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 18px;
  max-width: 780px;
}
h2 {
  font-size: 14px;
  margin: 20px 0 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #2a3142;
  display: flex;
  align-items: center;
  gap: 7px;
}
h3 { font-weight: 700; }

/* ---------- Stat strip ---------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}
.stat-strip .stat {
  background: var(--panel-bg);
  padding: 14px 16px;
  text-align: center;
}
.stat-strip .stat .num {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-dark);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.stat-strip .stat .lbl {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  margin-top: 3px;
}

/* ---------- Panels / cards ---------- */

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 12px; }
.controls label {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 500;
}

select, input[type=text], input[type=file] {
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f7f9fc;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,86,224,0.14);
}
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

button {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(30,86,224,0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(30,86,224,0.4); }
button:active { transform: translateY(0); }
button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
button.secondary:hover { border-color: var(--accent); color: var(--accent-dark); box-shadow: none; }

/* ---------- Season chip switcher ---------- */

.chart-workspace { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 18px; }
.season-sidebar { border-right: 1px solid var(--border); padding-right: 14px; }
.season-sidebar h2 { margin: 2px 0 10px; }
.chart-content { min-width: 0; display: flex; flex-direction: column; }
.chart-season-title { flex: 0 0 auto; margin: 2px 0 10px; font-size: 15px; font-weight: 800; }
.season-tabs { display: grid; gap: 6px; }
.season-tabs button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  padding: 7px 10px;
  border-radius: 6px;
  text-align: left;
}
.season-tabs button:hover { border-color: var(--accent); color: var(--accent-dark); transform: none; }
.season-tabs button.active {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(30,86,224,0.35);
}
.public-charts-page { height: 100vh; overflow: hidden; }
.public-charts-page main { display: flex; flex-direction: column; height: calc(100vh - 51px); padding-bottom: 20px; }
.public-charts-page .public-chart-panel { display: flex; flex: 1; min-height: 0; margin-bottom: 0; }
.public-charts-page .chart-workspace { flex: 1; min-height: 0; }
.public-charts-page .season-sidebar { display: flex; flex-direction: column; min-height: 0; }
.public-charts-page .season-tabs { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.public-charts-page .chart-content { min-height: 0; }
.public-charts-page .table-scroll { height: 100%; overflow-x: auto; overflow-y: hidden; }

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
  main { padding: 14px 12px 28px; }
  h1 { font-size: 20px; }
  .page-tagline { font-size: 12.5px; }
  .topnav { padding: 10px 14px; }
  .topnav .brand { font-size: 12px; }
  .topnav a { padding: 6px 10px; font-size: 11px; }
  .panel { padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .controls { gap: 10px; }
  table.plain { display: table; width: auto !important; min-width: max-content; max-width: none; margin-left: auto !important; margin-right: auto !important; white-space: nowrap; }
  table.plain th, table.plain td { padding: 8px 10px; }
}
@media (max-width: 700px) {
  .chart-workspace { grid-template-columns: 1fr; gap: 12px; }
  .season-sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 12px; }
  .season-tabs { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
  .public-charts-page { height: auto; overflow: auto; }
  .public-charts-page main { display: block; height: auto; }
  .public-charts-page .public-chart-panel { display: block; }
  .public-charts-page .season-tabs { grid-auto-rows: 32px; max-height: 108px; overflow-y: auto; }
  .public-charts-page .season-tabs button { min-height: 32px; }
  .public-charts-page .table-scroll { height: auto; overflow-x: auto; overflow-y: visible; }
}
@media (max-height: 520px) and (orientation: landscape) {
  html:has(.public-charts-page), body.public-charts-page { height: 100%; overflow: hidden !important; }
  body.public-charts-page { position: fixed !important; inset: 0; width: 100%; overscroll-behavior: none; }
  .public-charts-page .topnav,
  .public-charts-page h1,
  .public-charts-page .chart-season-title,
  .public-charts-page .season-sidebar { display: none; }
  .public-charts-page main { display: block; height: 100svh; max-width: none; padding: 0; overflow: hidden; }
  .public-charts-page .public-chart-panel { display: flex; height: 100svh; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; }
  .public-charts-page .chart-workspace { display: block; flex: 1; min-height: 0; height: 100%; }
  .public-charts-page .chart-content { width: 100vw; height: 100%; min-height: 0; overflow: hidden; }
  .public-charts-page .table-scroll { width: 100vw; height: 100%; overflow-x: scroll !important; overflow-y: scroll !important; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x pan-y; }
  .public-charts-page .sortable-reference-chart { min-width: max-content; }
}

/* ---------- The spreadsheet-faithful DR chart ---------- */

table.chart {
  border-collapse: collapse;
  table-layout: fixed;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  background: #fff;
  border: 1px solid #777;
}
table.chart th, table.chart td {
  border: 1px solid #000;
  height: 20px;
  width: 20px;
  min-width: 20px;
  padding: 1px 2px;
  text-align: center;
  white-space: nowrap;
}
table.chart thead th {
  background: #303030;
  color: #fff;
  font-weight: 700;
}
table.chart thead tr:nth-child(2) th {
  background: #e5e5e5;
  color: #111;
}
table.chart td.name-col, table.chart th.name-col {
  text-align: left;
  width: 88px;
  min-width: 88px;
  font-weight: 600;
}
table.chart td.name-col { background: #e5e5e5; color: #111; }
table.chart td.placement-col, table.chart th.placement-col {
  width: 22px;
  min-width: 22px;
}

td.divider, th.divider {
  background: #000 !important;
  border-left: 2px solid #000;
  border-right: 2px solid #000;
  width: 6px;
  min-width: 6px;
  padding: 0;
}

td.dead { background: #000 !important; }
td.ghost { background: #000 !important; color: #fff; font-weight: 700; }
td.empty { background: #fafafa; color: #ccc; }

tr.average-row { font-weight: 700; background: #e5e5e5; }
tr.average-row td { border-top: 2px solid #000; }

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  max-width: 100%;
  border: none;
}
.sortable-reference-chart { width: max-content; }
.reference-strip {
  display: block;
  background-repeat: no-repeat;
}
.reference-header { cursor: pointer; }
.sortable-reference-chart[hidden] { display: none; }

/* ---------- Legend line (footnote style) ---------- */

.legend-line {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.legend-line .pill { margin-right: 6px; }

/* ---------- Modern data tables (Leaderboard / Rankings / Time Machine) ---------- */

table.plain {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
table.plain th, table.plain td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.plain tbody tr:last-child td { border-bottom: none; }
table.plain tbody tr { transition: background 0.1s ease; }
table.plain tbody tr:hover { background: #eef3fd; }
table.plain thead th {
  background: #f7f9fc;
  cursor: pointer;
  user-select: none;
  font-weight: 800;
  color: #2a3142;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.drs-s { font-size: 0.68em; }
table.plain th.sort-asc::after { content: ' \25B2'; color: var(--accent); }
table.plain th.sort-desc::after { content: ' \25BC'; color: var(--accent); }

/* rank chip + avatar, used inline in table cells and cards */
.rank-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef1f7;
  color: #4a4f5e;
  font-weight: 800;
  font-size: 12px;
}
.rank-chip.top1 { background: var(--accent-grad); color: #fff; }
.rank-chip.top2 { background: #cfd3da; color: #2b2d3d; }
.rank-chip.top3 { background: #dcb27a; color: #3a2a13; }

.name-cell { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex: 0 0 auto;
}
.headshot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
}
.season-winner {
  display: inline !important;
  padding: 1px 4px;
  border-radius: 3px;
  background: #f4d36a;
  color: #352300;
  font-weight: 700;
  line-height: inherit;
  vertical-align: -0.08em;
}
.missing-headshots { display: grid; gap: 6px; max-width: 640px; }
.missing-headshot-row { align-items: center; border-bottom: 1px solid var(--border); display: flex; gap: 14px; justify-content: space-between; padding: 8px 0; }
.missing-headshot-row span { font-weight: 700; }
.missing-headshot-row input { flex: 1; min-width: 160px; }
.missing-headshot-row button { flex: 0 0 auto; padding: 7px 10px; }
.season-images { display: grid; gap: 6px; max-width: 640px; }
.season-image-row { align-items: center; border-bottom: 1px solid var(--border); cursor: grab; display: grid; gap: 14px; grid-template-columns: 80px 1fr auto; padding: 8px 0; }
.season-image-row > span:first-child { font-weight: 700; }
.season-image-row.dragging { opacity: 0.45; }
.admin-cast-manager { display: grid; grid-template-columns: 120px minmax(0, 420px); gap: 18px; }
.admin-season-list { border-right: 1px solid var(--border); display: grid; gap: 6px; padding-right: 14px; }
.admin-season-list button { background: #fff; box-shadow: none; color: var(--text); text-align: left; }
.admin-season-list button.active { background: var(--accent); color: #fff; }
.admin-cast-list { display: grid; gap: 6px; max-height: 530px; overflow-y: auto; }
.admin-cast-row, .admin-link-row { align-items: center; display: flex; gap: 8px; }
.admin-cast-row input { flex: 1; min-width: 0; }
.admin-cast-row button, .admin-link-row button { flex: 0 0 auto; padding: 7px 10px; }
.admin-link-list { display: grid; gap: 6px; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.admin-link-row { border-bottom: 1px solid var(--border); justify-content: space-between; padding: 5px 0; }
.trophy { margin-left: 4px; }

.hscroll-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; }
.hscroll-row .card {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  min-width: 165px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.hscroll-row .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.hall-colors-panel { max-width: none; }
.hall-colors-grid { display: grid; grid-template-columns: repeat(5, minmax(116px, 1fr)); gap: 10px; max-width: 840px; margin-left: auto; margin-right: auto; }
.color-tile {
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  color: #111;
  overflow: hidden;
}
.color-tile .color-title {
  border-bottom: 1px solid rgba(0,0,0,0.14);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.2px;
  line-height: 1.1;
  padding: 10px;
  text-align: center;
  text-transform: uppercase;
}
.color-tile .color-body { display: grid; gap: 8px; justify-items: center; padding: 14px 12px 16px; }
.color-winners { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: start; }
.color-honoree { display: grid; gap: 8px; justify-items: center; text-align: center; }
.color-portrait {
  width: 72px; height: 72px;
  border: 3px solid rgba(255,255,255,0.72);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(0,0,0,0.2);
  object-fit: cover;
}
.color-honoree-name { font-size: 15px; font-weight: 800; line-height: 1.18; }
.color-tile .color-season { font-size: 12px; font-weight: 800; letter-spacing: 0.2px; text-align: center; }
.color-blue { background: #0080ff; }
.color-green { background: #00ff00; }
.color-yellow { background: #ffff00; }
.color-orange { background: #ff8000; }
.color-red { background: #ff0000; }
@media (max-width: 760px) {
  .hall-colors-panel { overflow-x: auto; }
  .hall-colors-grid { min-width: 820px; }
}

.muted { color: var(--muted); font-size: 12px; }
.pill {
  display: inline-block;
  background: #e6edfc;
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  margin-right: 6px;
  font-weight: 700;
}

.context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 5px;
  z-index: 100;
  min-width: 200px;
}
.context-menu .item { padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; }
.context-menu .item:hover { background: #eef3fd; color: var(--accent-dark); }
.context-menu .header { font-size: 11px; color: var(--muted); padding: 6px 12px; text-transform: uppercase; letter-spacing: 0.4px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(23,19,15,0.5);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 22px; max-width: 440px; width: 90%;
  max-height: 80vh; overflow: auto;
  box-shadow: var(--shadow-md);
}
.modal h3 { margin-top: 0; }
.modal .item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.modal .item:hover { background: #eef3fd; border-color: var(--accent); }

.appearance-picker { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
.appearance-list { display: grid; gap: 6px; max-height: 48vh; overflow-y: auto; }
.appearance-row { display: flex; gap: 6px; align-items: center; }
.appearance-row input { min-width: 0; width: 100%; }
.link-appearance-button { padding: 7px 10px; flex: 0 0 auto; }
.name-save-status { min-height: 18px; margin: 8px 0 0; }

#timeline-bars { position: relative; }
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: transform var(--race-duration, 0ms) cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.bar-row .bar-label {
  width: 120px; font-size: 12px; text-align: right; flex: 0 0 auto; font-weight: 700;
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
}
.bar-row .bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-avatar {
  width: 22px; height: 22px; min-width: 22px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}
.bar-row .bar-track {
  flex: 1;
  background: #efece5;
  border-radius: 6px;
  height: 20px;
  position: relative;
  overflow: hidden;
}
.bar-row .bar-fill {
  border-radius: 6px;
  height: 100%;
  transition: width var(--race-duration, 0ms) cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-row .bar-segment {
  bottom: 0;
  position: absolute;
  top: 0;
  transition: width var(--race-duration, 0ms) cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-row .bar-segment.zero-segment { width: 3px !important; z-index: 2; }
.bar-row .bar-value {
  font-size: 11px;
  line-height: 20px;
  font-weight: 800;
  color: #111;
  position: absolute;
  transform: none;
  white-space: nowrap;
  z-index: 3;
}
.bar-row .bar-value.outside { transform: none; }

@keyframes lookback-row-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.lookback-row {
  animation: lookback-row-enter 260ms ease-out both;
  animation-delay: var(--lookback-delay, 0ms);
}
.lookback-panel { max-width: none; }
.lookback-panel .controls { justify-content: flex-start; }
.lookback-panel #tm-summary { margin-left: auto; margin-right: auto; max-width: 460px; text-align: center; }
.lookback-panel #tm-table { font-size: 12px; margin-left: auto; margin-right: auto; max-width: 460px; width: 100%; }
.lookback-panel #tm-table th, .lookback-panel #tm-table td { padding: 7px 10px; }
.lookback-panel #tm-table th:nth-child(1), .lookback-panel #tm-table td:nth-child(1),
.lookback-panel #tm-table th:nth-child(3), .lookback-panel #tm-table td:nth-child(3) { text-align: center; }
.plain#lb-table th:nth-child(1), .plain#lb-table td:nth-child(1),
.plain#lb-table th:nth-child(3), .plain#lb-table td:nth-child(3),
.plain#lb-table th:nth-child(4), .plain#lb-table td:nth-child(4) { text-align: center; }
.plain#lb-table thead th:nth-child(2),
.plain#top-per-season-table thead th:nth-child(2),
.lookback-panel #tm-table thead th:nth-child(2) { text-align: center; }
.plain#lb-table th:nth-child(2), .plain#lb-table td:nth-child(2),
.plain#top-per-season-table td.rank-houseguest { width: 180px; }
.plain#top-per-season-table td.rank-season,
.plain#top-per-season-table td.rank-placement,
.plain#top-per-season-table td.rank-dr,
.plain#top-per-season-table th:nth-child(1),
.plain#top-per-season-table th:nth-child(3),
.plain#top-per-season-table th:nth-child(4) { text-align: center; }
.plain#season-rank-table th:nth-child(1), .plain#season-rank-table td:nth-child(1),
.plain#season-rank-table th:nth-child(2), .plain#season-rank-table td:nth-child(2),
.plain#season-rank-table th:nth-child(3), .plain#season-rank-table td:nth-child(3) { text-align: center; }
.plain#lb-table thead th, .plain#top-per-season-table thead th,
.plain#season-rank-table thead th, .lookback-panel #tm-table thead th { cursor: default; }
.plain#lb-table { margin-left: auto; margin-right: auto; max-width: 680px; }
.plain#top-per-season-table { margin-left: auto; margin-right: auto; max-width: 620px; }
.plain#season-rank-table { margin-left: auto; margin-right: auto; max-width: 460px; }
.plain#lb-table th, .plain#lb-table td,
.plain#top-per-season-table th, .plain#top-per-season-table td,
.plain#season-rank-table th, .plain#season-rank-table td { padding: 7px 10px; }
@media (max-width: 600px) {
  .plain#lb-table,
  .plain#top-per-season-table {
    width: 100% !important;
    min-width: 0;
    max-width: none;
    table-layout: fixed;
    margin-left: 0 !important;
    margin-right: 0 !important;
    white-space: normal;
  }
  .plain#lb-table th,
  .plain#lb-table td,
  .plain#top-per-season-table th,
  .plain#top-per-season-table td {
    padding: 7px 5px;
    font-size: 11px;
    overflow-wrap: anywhere;
  }
  .plain#lb-table thead th,
  .plain#top-per-season-table thead th { font-size: 9px; }
  .plain#lb-table .name-cell,
  .plain#top-per-season-table .name-cell { gap: 5px; min-width: 0; flex-wrap: nowrap; }
  .plain#lb-table .name-cell > :last-child,
  .plain#top-per-season-table .name-cell > :last-child { min-width: 0; overflow-wrap: anywhere; }
  .plain#lb-table .avatar,
  .plain#top-per-season-table .avatar { width: 22px; height: 22px; min-width: 22px; }
  .plain#lb-table .rank-chip { min-width: 20px; height: 20px; padding: 0 5px; font-size: 11px; }
  .plain#lb-table th:nth-child(1),
  .plain#lb-table td:nth-child(1) { width: 36px; }
  .plain#lb-table th:nth-child(2),
  .plain#lb-table td:nth-child(2) { width: 34%; }
  .plain#lb-table th:nth-child(3),
  .plain#lb-table td:nth-child(3) { width: 34%; }
  .plain#lb-table th:nth-child(4),
  .plain#lb-table td:nth-child(4) { width: 52px; }
  .plain#top-per-season-table th:nth-child(1),
  .plain#top-per-season-table td.rank-season { width: 52px; }
  .plain#top-per-season-table th:nth-child(2),
  .plain#top-per-season-table td.rank-houseguest { width: 42%; }
  .plain#top-per-season-table th:nth-child(3),
  .plain#top-per-season-table td.rank-placement { width: 58px; }
  .plain#top-per-season-table th:nth-child(4),
  .plain#top-per-season-table td.rank-dr { width: 52px; }
}
.lookback-row.evicted td {
  background: #d9dde2 !important;
  color: #6b7280;
}
.lookback-row.evicted .rank-chip {
  background: #bec4cb;
  color: #59616b;
}
.lookback-row.evicted:hover td { background: #d9dde2 !important; }

/* ---------- Footer ---------- */

.site-footer {
  max-width: 1440px;
  margin: 10px auto 0;
  padding: 18px 20px 30px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.site-footer .version-badge {
  display: inline-block;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--accent-dark);
  background: #e6edfc;
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 6px;
}
