/* ---------- shared page bits ---------- */
.page-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.page-head .page-title { margin-bottom: 0; }

.color-chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: baseline;
}
.color-chip-lg { width: 18px; height: 18px; border-radius: 5px; }

.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  color: var(--text-faint);
  font-size: 1.4rem;
}

/* ---------- charts ---------- */
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; height: auto; min-width: 560px; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { fill: var(--text-faint); font-size: 11px; }
.chart .series-line {
  fill: none;
  stroke: var(--tc, var(--accent));
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
/* Marks carry a surface-colored ring so overlapping series stay readable. */
.chart .series-dot {
  fill: var(--tc, var(--accent));
  stroke: var(--card);
  stroke-width: 2;
}
.chart .legend-dot { fill: var(--tc, var(--accent)); }
.chart .end-label { fill: var(--text-dim); font-size: 12.5px; font-weight: 600; }

.sparkline { flex: none; }
.sparkline polyline {
  fill: none;
  stroke: var(--tc, var(--text-dim));
  stroke-width: 1.5;
}
.sparkline circle { fill: var(--tc, var(--text-dim)); }
.spark-neutral { --tc: var(--text-dim); }

/* ---------- standings ---------- */
.standings-table .rank-cell { font-weight: 700; }
.move-up { color: var(--good); font-size: 0.75rem; margin-left: 4px; }
.move-down { color: var(--bad); font-size: 0.75rem; margin-left: 4px; }

.grid-table th, .grid-table td { text-align: right; }
.grid-table th:first-child, .grid-table td:first-child { text-align: left; }
.sticky-col {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 2;
}
.cell-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.cell-btn:hover { background: var(--bg-raised); color: var(--accent-soft); }

.breakdown-panel { margin-top: var(--space-4); scroll-margin-top: 70px; }
.breakdown-card h4 {
  margin-top: var(--space-4);
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}
.breakdown-table td { white-space: normal; }
.total-row td { border-top: 1px solid var(--line); color: var(--text-dim); }
.breakdown-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

/* ---------- team page ---------- */
.team-hero {
  border-left: 6px solid var(--tc, var(--accent));
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  background: var(--card);
  border-radius: var(--radius);
}
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--space-4);
}
.slot-card {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.slot-card.slot-open { border-color: var(--warn); }
.slot-photo {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
}
.slot-info { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

.holding-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.holding-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  color: var(--text);
}
.holding-chip img, .holding-chip .photo-placeholder {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
}

/* replacement picker */
.picker-card { border-color: var(--accent); }
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0;
}
.pick-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-raised);
  border: 2px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--space-3);
  cursor: pointer;
  text-align: center;
}
.pick-option img, .pick-option .photo-placeholder {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
}
.pick-option input { position: absolute; opacity: 0; }
.pick-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--card-hover);
  box-shadow: var(--focus-ring);
}

/* ---------- castaways ---------- */
.castaway-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.castaway-card {
  display: flex;
  gap: var(--space-4);
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--space-3);
  color: var(--text);
  align-items: center;
}
.castaway-card:hover { background: var(--card-hover); text-decoration: none; }
/* Voted-out castaways recede but stay readable. */
.castaway-card.is-out { opacity: 0.72; }
.castaway-card.is-out .castaway-photo { filter: grayscale(0.7); }
.castaway-photo {
  width: 104px;
  height: 104px;
  border-radius: 12px;
  object-fit: cover;
  object-position: top center;
  flex: none;
  background: var(--bg-raised);
}
.castaway-info { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
/* Name above status, always — keeps every card in the grid aligned. */
.castaway-name { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.castaway-figures { display: flex; gap: var(--space-4); }
.figure { display: flex; flex-direction: column; line-height: 1.1; }
.figure-value { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.figure-label {
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.held-by { display: flex; gap: 4px; align-items: center; font-size: 0.8rem; min-height: 14px; }

.castaway-hero { display: flex; gap: var(--space-5); align-items: flex-start; flex-wrap: wrap; }
.castaway-hero-photo {
  width: 180px;
  height: 180px;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: top center;
  background: var(--bg-raised);
}
.held-entry { margin-right: var(--space-3); white-space: nowrap; }

/* ---------- activity & notifications ---------- */
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { padding: var(--space-2) 0; border-bottom: 1px solid var(--line-soft); }
.activity-list li:last-child { border-bottom: none; }
.activity-full li { display: flex; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; }

.notification-list { display: grid; gap: var(--space-2); }
.notification {
  display: block;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
}
.notification:hover { background: var(--card-hover); text-decoration: none; }
.notification.unread { border-left: 4px solid var(--accent); }
.notification-title { font-weight: 600; }
.notification-meta { font-size: 0.8rem; margin-top: 2px; }

.nav-bell { position: relative; font-size: 1.1rem; text-decoration: none; }
.nav-bell:hover { text-decoration: none; }
.badge-count {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.badge-count-empty { display: none; }

/* ---------- seasons ---------- */
.season-list { display: grid; gap: var(--space-4); }
.season-card { color: var(--text); }
.season-card:hover { text-decoration: none; background: var(--card-hover); }

/* ---------- predictions ---------- */
.question-block {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line-soft);
}
.question-block:last-child { border-bottom: none; }
.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}
.option-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-raised);
  border: 2px solid var(--line-soft);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.option-pill input { width: auto; }
.option-pill:has(input:checked) {
  border-color: var(--accent);
  background: var(--card-hover);
}

/* ---------- avatars & profile ---------- */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.avatar-preset { line-height: 1; }
.avatar-grid, .color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.avatar-option input, .color-option input { position: absolute; opacity: 0; }
.avatar-option, .color-option { cursor: pointer; border-radius: 50%; padding: 3px; }
.avatar-option:has(input:checked), .color-option:has(input:checked) {
  box-shadow: var(--focus-ring);
}
.color-option:has(input:disabled) { opacity: 0.25; cursor: not-allowed; }
.color-swatch {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}
.nav-user { display: inline-flex; align-items: center; gap: 6px; }
.nav-user:hover { text-decoration: none; color: var(--text); }

/* ---------- console & analysis ---------- */
.action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.analysis-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.analysis-body h2 { margin-top: var(--space-5); color: var(--accent-soft); }
.analysis-body h2:first-of-type { margin-top: 0; }
.analysis-body ul { padding-left: var(--space-5); }
.analysis-body li { margin-bottom: var(--space-2); }

/* ---------- draft room ---------- */
.on-clock-card { border-color: var(--accent); }
.on-clock-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.on-clock-name { font-size: 1.4rem; font-weight: 800; margin: var(--space-2) 0; }
.soft-timer {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-bright);
  font-variant-numeric: tabular-nums;
}
.last-pick-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  animation: pick-splash 0.6s ease-out;
}
.last-pick-flame { font-size: 1.4rem; }
@keyframes pick-splash {
  0% { transform: scale(0.96); box-shadow: 0 0 0 rgba(255, 122, 26, 0.7); }
  50% { transform: scale(1.01); box-shadow: 0 0 24px rgba(255, 122, 26, 0.35); }
  100% { transform: scale(1); }
}
.draft-board td, .draft-board th { text-align: center; }
.draft-board th:first-child, .draft-board td:first-child { text-align: left; }
.board-current {
  background: var(--warn-bg);
  border-radius: 6px;
  animation: board-pulse 1.6s ease-in-out infinite;
}
@keyframes board-pulse {
  0%, 100% { background: var(--warn-bg); }
  50% { background: var(--card-hover); }
}
.draft-complete { border-color: var(--good); }

/* ---------- TV mode ---------- */
.tv-mode .page { max-width: none; padding: var(--space-5) var(--space-6); }
.tv-header {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.tv-flame { animation: flicker 2.4s infinite; display: inline-block; }
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); opacity: 1; }
  25% { transform: scale(1.08) rotate(2deg); opacity: 0.92; }
  50% { transform: scale(0.97) rotate(-1deg); opacity: 1; }
  75% { transform: scale(1.05) rotate(1deg); opacity: 0.95; }
}
.tv-badge { font-size: 1rem; }
.tv-onclock {
  border: 3px solid var(--tc, var(--accent));
  border-radius: var(--radius);
  background: var(--card);
  padding: var(--space-6);
  text-align: center;
  margin-bottom: var(--space-5);
}
.tv-onclock-label {
  color: var(--text-dim);
  letter-spacing: 0.15em;
  font-weight: 700;
  margin-bottom: var(--space-3);
}
.tv-onclock-name { font-size: 3.2rem; font-weight: 900; line-height: 1.1; }
.tv-timer {
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--accent-bright);
  margin-top: var(--space-3);
  font-variant-numeric: tabular-nums;
}
.tv-lastpick {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: var(--space-5);
  animation: pick-splash 0.8s ease-out;
}
.tv-board { font-size: 1.1rem; }
.tv-complete { border-color: var(--good); }
.tv-teams {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}
.tv-team {
  border: 2px solid var(--tc, var(--line));
  border-radius: var(--radius);
  background: var(--card);
  padding: var(--space-4);
}
.tv-team-name { font-weight: 800; font-size: 1.2rem; margin-bottom: var(--space-2); }
.tv-team ul { margin: 0; padding-left: var(--space-4); }

/* ---------- countdown ---------- */
[data-countdown-to] { font-variant-numeric: tabular-nums; }
.countdown-done::after { content: " 📺"; }

/* ---------- theme picker ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-3);
}
.theme-option {
  /* Each swatch previews its own theme by scoping that theme's tokens. */
  display: grid;
  gap: 4px;
  padding: var(--space-3);
  border: 2px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}
.theme-option input { position: absolute; opacity: 0; }
.theme-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.theme-swatch {
  display: grid;
  gap: 4px;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: var(--space-1);
}
.theme-swatch-bar { height: 6px; border-radius: 3px; }
.theme-swatch-accent { background: var(--accent); width: 70%; }
.theme-swatch-text { background: var(--text); width: 100%; opacity: 0.75; }
.theme-swatch-dim { background: var(--text-dim); width: 45%; }
.theme-name { font-weight: 700; color: var(--text); }
.theme-desc { font-size: 0.78rem; line-height: 1.35; }

/* Standings stay readable on a phone: drop secondary columns so the total
   (the number everyone actually wants) is never pushed off-screen. */
.num-col { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
  .col-optional { display: none; }
  .standings-table .badge { font-size: 0.65rem; padding: 1px 7px; }
}
