/* ==========================================================
   PROJECTIONS BOARD — shared by every league's projections page
   (NFL weekly, NBA/MLB/NHL/WNBA daily).

   Follows DESIGN_SYSTEM.md, on the page-local black + green palette
   below: true black page, neutral near-black surfaces, brand green as
   the only accent.

   Desktop: sortable data table with grouped stat headers and frozen
   rank + player columns. Mobile: rows become cards with a stats toggle.
   Behaviour lives in Public/scripts/projections-board.js.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=optional');

/* ===== DESIGN TOKENS ===== */
:root {
  --font-display: 'Sora', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;

  --glow-primary: rgba(30, 251, 151, 0.4);
  --glow-subtle: rgba(30, 251, 151, 0.15);
  --tint-primary: rgba(30, 251, 151, 0.12);
  --tint-row-hover: rgba(30, 251, 151, 0.05);

  /* Page palette — the shared black + green surface tokens from colors.css */
  --proj-bg: var(--surface-page);
  --proj-surface: var(--surface-card);
  --proj-elevated: var(--surface-raised);
  --proj-hover: var(--surface-hover);
  --proj-raised: var(--surface-strong);
  --proj-border: var(--surface-border);
  --proj-border-strong: var(--surface-border-strong);
  --proj-text: var(--surface-text);
  --proj-text-secondary: var(--surface-text-secondary);
  --proj-text-tertiary: var(--surface-text-tertiary);
  --proj-text-faint: var(--surface-text-faint);
  --proj-muted: var(--surface-text-muted);

  --proj-max-width: 1400px;
  --proj-col-rank: 56px;
  --proj-col-player: 280px;
}

[hidden] { display: none !important; }

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rowSlide {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.8); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ===== PAGE ===== */
main:has(.projections-page) {
  background: var(--proj-bg);
}

.projections-page {
  min-height: 100vh;
  background: var(--proj-bg);
  padding-bottom: 96px;
  font-family: var(--font-display);
  color: var(--proj-text);
}

/* ===== HEADER ===== */
.proj-header {
  position: relative;
  /* Clips the decorative glow below, which is wider than a phone viewport and
     would otherwise put the whole page into horizontal scroll. */
  overflow: hidden;
  max-width: var(--proj-max-width);
  margin: 0 auto;
  padding: 56px 24px 28px;
  animation: fadeUp 0.5s ease-out;
}

.proj-header::before {
  content: '';
  position: absolute;
  top: -200px;
  left: -140px;
  width: 760px;
  height: 440px;
  background: radial-gradient(ellipse at center, rgba(30, 251, 151, 0.09) 0%, transparent 58%);
  pointer-events: none;
}

.proj-header-inner {
  position: relative;
}

.proj-eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.proj-eyebrow-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: rgba(30, 251, 151, 0.1);
  border: 1px solid rgba(30, 251, 151, 0.25);
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  line-height: 1;
}

.proj-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--glow-primary);
  animation: livePulse 1.8s ease-in-out infinite;
}

.proj-eyebrow-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.proj-updated {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--proj-text-tertiary);
}

.proj-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--color-white);
  margin: 0 0 14px;
}

.proj-subtitle {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--proj-text-secondary);
  margin: 0;
  max-width: 640px;
}

/* ===== TOOLBAR ===== */
.proj-toolbar {
  position: sticky;
  top: var(--site-header-height);
  z-index: 100;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--proj-border);
  border-bottom: 1px solid var(--proj-border);
  animation: fadeUp 0.5s ease-out 0.1s both;
}

.proj-toolbar-inner {
  max-width: var(--proj-max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.proj-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.proj-toolbar-controls {
  flex: 1 1 520px;
  justify-content: flex-end;
}

/* Position segmented control */
.position-tabs {
  display: inline-flex;
  background: var(--proj-elevated);
  border: 1px solid var(--proj-border);
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
}

.pos-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--proj-text-tertiary);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.pos-tab:hover {
  color: var(--proj-text);
  background: var(--proj-raised);
}

.pos-tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.pos-tab.active {
  background: var(--color-primary);
  color: var(--color-black);
  box-shadow: 0 2px 12px var(--glow-primary);
}

/* Search */
.proj-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 260px;
  min-width: 180px;
  height: 42px;
  background: var(--proj-elevated);
  border: 1px solid var(--proj-border);
  border-radius: 10px;
  color: var(--proj-text-tertiary);
  transition: border-color 0.2s ease;
}

.proj-search:focus-within {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.proj-search-icon {
  position: absolute;
  left: 13px;
  pointer-events: none;
}

.proj-search-input {
  width: 100%;
  height: 100%;
  padding: 0 36px 0 38px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--proj-text);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
}

.proj-search-input::placeholder {
  color: var(--proj-text-faint);
  font-weight: 400;
}

.proj-search-input::-webkit-search-cancel-button,
.proj-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.proj-search-clear {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: none;
  background: var(--proj-raised);
  color: var(--proj-text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.proj-search-clear:hover {
  background: var(--proj-muted);
  color: var(--proj-text);
}

/* Labeled selects */
.proj-select-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.proj-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 42px;
  background: var(--proj-elevated);
  border: 1px solid var(--proj-border);
  border-radius: 10px;
  padding-left: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.proj-select:hover,
.proj-select:focus-within {
  border-color: var(--color-primary);
}

.proj-select-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--proj-text-tertiary);
  padding-right: 10px;
  border-right: 1px solid var(--proj-border);
  line-height: 1;
  pointer-events: none;
}

.proj-select-input {
  appearance: none;
  -webkit-appearance: none;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 36px 0 10px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--proj-text);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%231EFB97' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.proj-select-input option {
  background: var(--proj-surface);
  color: var(--proj-text);
}

/* Mobile-only sort controls */
.proj-select-sort,
.proj-sort-dir {
  display: none;
}

.proj-sort-dir {
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: var(--proj-elevated);
  border: 1px solid var(--proj-border);
  border-radius: 10px;
  color: var(--proj-text-secondary);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.proj-sort-dir:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.proj-sort-dir[data-direction="asc"] svg {
  transform: scaleY(-1);
}

/* ===== BOARD ===== */
.proj-board {
  max-width: var(--proj-max-width);
  margin: 0 auto;
  padding: 20px 24px 0;
  animation: fadeUp 0.5s ease-out 0.15s both;
}

.proj-board-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px 12px;
}

.proj-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--proj-text-tertiary);
}

/* Mobile-only stats toggle (hidden on desktop, where columns are always visible) */
.proj-details-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 6px 10px;
  background: transparent;
  border: none;
  color: var(--proj-text-secondary);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.proj-switch {
  position: relative;
  width: 36px;
  height: 22px;
  border-radius: 999px;
  background: var(--proj-raised);
  border: 1px solid var(--proj-border-strong);
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.proj-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--proj-text-tertiary);
  transition: transform 0.2s ease, background 0.2s ease;
}

.proj-details-toggle[aria-pressed="true"] .proj-switch {
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 10px var(--glow-subtle);
}

.proj-details-toggle[aria-pressed="true"] .proj-switch-thumb {
  background: var(--color-black);
  transform: translateX(14px);
}

.proj-details-toggle[aria-pressed="true"] {
  color: var(--proj-text);
}

.proj-details-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ===== TABLE CONTAINER ===== */
.proj-table-scroll {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--proj-border);
  background: var(--proj-surface);
  overscroll-behavior-x: contain;
}

.proj-table-scroll::-webkit-scrollbar { height: 8px; }
.proj-table-scroll::-webkit-scrollbar-track { background: var(--proj-surface); }
.proj-table-scroll::-webkit-scrollbar-thumb {
  background: var(--proj-raised);
  border-radius: 4px;
}
.proj-table-scroll::-webkit-scrollbar-thumb:hover { background: var(--proj-muted); }

/* ===== DATA TABLE ===== */
.proj-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  table-layout: auto;
}

.proj-table thead {
  background: var(--proj-elevated);
}

.proj-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--proj-text-tertiary);
  white-space: nowrap;
  vertical-align: bottom;
  padding: 0;
  position: relative;
  user-select: none;
}

/* Group header row */
.proj-thead-groups th.col-group {
  padding: 10px 8px 0;
  text-align: center;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--proj-text-faint);
  vertical-align: top;
}

.proj-thead-groups th.col-group span {
  display: block;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(30, 251, 151, 0.35);
  min-height: 1em;
}

.proj-thead-groups th.col-group-empty span {
  border-bottom-color: transparent;
}

/* Stat header row + fixed columns */
.proj-table thead th .th-sort,
.proj-table thead th > span {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 10px 12px 12px;
  font: inherit;
  letter-spacing: 0.06em;
  font-size: 0.66rem;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease;
}

.proj-table thead th > span {
  cursor: default;
}

.proj-table thead th[rowspan] .th-sort,
.proj-table thead th[rowspan] > span {
  padding-top: 18px;
}

.proj-table thead th .th-sort:hover {
  color: var(--color-primary);
  background: var(--proj-hover);
}

.proj-table thead th .th-sort:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.proj-table thead th .sort-icon {
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.proj-table thead th .th-sort:hover .sort-icon { opacity: 0.5; }

.proj-table thead th.sorted .th-sort {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.proj-table thead th.sorted .sort-icon { opacity: 1; }
.proj-table thead th.sorted.asc .sort-icon { transform: rotate(180deg); }

.proj-table thead tr:last-child th {
  border-bottom: 1px solid var(--proj-border);
}

/* Column sizing + alignment */
.proj-table .col-rank {
  width: var(--proj-col-rank);
  min-width: var(--proj-col-rank);
}
.proj-table .col-rank > span { justify-content: center; padding-left: 0; padding-right: 0; }

.proj-table .col-player {
  width: var(--proj-col-player);
  min-width: var(--proj-col-player);
}

.proj-table .col-pts {
  width: 104px;
  min-width: 104px;
}
.proj-table .col-pts .th-sort { justify-content: flex-end; }

.proj-table .col-stat {
  width: 74px;
  min-width: 66px;
}
.proj-table .col-stat .th-sort { justify-content: flex-end; }

@media (min-width: 1100px) {
  .proj-table .col-player {
    width: 100%;
  }
}

/* Body rows */
.proj-table tbody tr {
  animation: rowSlide 0.3s ease-out both;
  transition: background 0.15s ease;
}

.proj-table tbody tr:nth-child(1)  { animation-delay: 0.02s; }
.proj-table tbody tr:nth-child(2)  { animation-delay: 0.04s; }
.proj-table tbody tr:nth-child(3)  { animation-delay: 0.06s; }
.proj-table tbody tr:nth-child(4)  { animation-delay: 0.08s; }
.proj-table tbody tr:nth-child(5)  { animation-delay: 0.10s; }
.proj-table tbody tr:nth-child(n+6) { animation-delay: 0.12s; }

.proj-table tbody tr:hover {
  background: var(--tint-row-hover);
}

.proj-table tbody td {
  padding: 10px 12px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--proj-text-secondary);
  border-bottom: 1px solid var(--proj-border);
  vertical-align: middle;
  height: 62px;
}

.proj-table tbody tr:last-child td {
  border-bottom: none;
}

/* Rank */
.proj-table .cell-rank {
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--proj-text-tertiary);
}

/* Player */
.proj-table .cell-player .player-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player-avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--proj-elevated);
  border: 1px solid var(--proj-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-avatar::before {
  content: attr(data-initials);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--proj-text-tertiary);
}

.player-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--proj-elevated);
}

.player-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.player-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--proj-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
  transition: color 0.15s ease;
}

.player-name:hover,
.proj-table tbody tr:hover .player-name {
  color: var(--color-primary);
}

.player-name:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.player-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--proj-text-tertiary);
  white-space: nowrap;
}

.player-pos {
  color: var(--proj-text-secondary);
  font-weight: 600;
}

.player-team::before,
.player-matchup::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--proj-muted);
  vertical-align: middle;
  margin-right: 6px;
}

.badge-injury {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1.2;
}

.badge-injury.badge-warn {
  color: var(--color-warning-dark);
  background: rgba(245, 158, 11, 0.16);
}

.badge-injury.badge-out {
  color: var(--color-error-dark);
  background: rgba(239, 68, 68, 0.16);
}

/* Projected points */
.proj-table .cell-pts {
  text-align: right;
}

.pts-value {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  color: var(--proj-text);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.cell-pts.is-sorted .pts-value {
  color: var(--color-primary);
}

.pts-meter {
  display: block;
  width: 100%;
  max-width: 72px;
  height: 3px;
  margin: 6px 0 0 auto;
  border-radius: 999px;
  background: var(--proj-raised);
  overflow: hidden;
}

.pts-meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--glow-subtle);
  transition: width 0.35s ease;
}

/* Stat cells */
.proj-table .cell-stat {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--proj-text-secondary);
  font-variant-numeric: tabular-nums;
}

.proj-table .cell-stat.is-zero {
  color: var(--proj-muted);
}

.proj-table .cell-stat.is-sorted {
  color: var(--proj-text);
  background: rgba(255, 255, 255, 0.025);
}

/* Frozen columns (desktop) */
.proj-table thead th:first-child,
.proj-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--proj-surface);
}

.proj-table thead th:nth-child(2),
.proj-table tbody td:nth-child(2) {
  position: sticky;
  left: var(--proj-col-rank);
  z-index: 2;
  background: var(--proj-surface);
}

.proj-table thead th:first-child,
.proj-table thead th:nth-child(2) {
  background: var(--proj-elevated);
  z-index: 3;
}

.proj-table thead th:nth-child(2)::after,
.proj-table tbody td:nth-child(2)::after {
  content: '';
  position: absolute;
  top: 0;
  right: -12px;
  bottom: 0;
  width: 12px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.35), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.proj-table-scroll.is-scrolled thead th:nth-child(2)::after,
.proj-table-scroll.is-scrolled tbody td:nth-child(2)::after {
  opacity: 1;
}

.proj-table tbody tr:hover td:first-child,
.proj-table tbody tr:hover td:nth-child(2) {
  /* Frozen cells need an opaque fill: layer the hover tint over the card surface */
  background: linear-gradient(var(--tint-row-hover), var(--tint-row-hover)) var(--proj-surface);
}

/* Skeleton loading */
.sk {
  display: inline-block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--proj-elevated) 25%, var(--proj-hover) 50%, var(--proj-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.row-skeleton td { border-bottom-color: var(--proj-border); }
.sk-rank   { width: 18px; height: 12px; }
.sk-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.sk-name   { width: 140px; height: 12px; }
.sk-sub    { width: 90px; height: 9px; }
.sk-pts    { width: 44px; height: 14px; }
.sk-stat   { width: 32px; height: 11px; }
.row-skeleton .cell-pts, .row-skeleton .cell-stat { text-align: right; }

/* Empty state */
.proj-table .row-empty td {
  padding: 0;
  border-bottom: none;
  height: auto;
}

.proj-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 72px 24px;
  gap: 6px;
}

.proj-empty-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--proj-text);
  margin: 0;
}

.proj-empty-body {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--proj-text-tertiary);
  margin: 0;
}

.proj-empty-reset {
  margin-top: 16px;
  padding: 10px 18px;
  background: var(--proj-elevated);
  color: var(--proj-text);
  border: 1px solid var(--proj-border-strong);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.proj-empty-reset:hover {
  border-color: var(--color-primary);
  background: var(--proj-hover);
}

/* ===== EXPLAINER ===== */
.proj-explainer {
  max-width: var(--proj-max-width);
  margin: 72px auto 0;
  padding: 0 24px;
  animation: fadeUp 0.5s ease-out 0.2s both;
}

.explainer-head {
  max-width: 760px;
  margin-bottom: 32px;
}

.explainer-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.proj-explainer h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--proj-text);
  margin: 0 0 14px;
}

.explainer-intro {
  font-family: var(--font-display);
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--proj-text-secondary);
  margin: 0;
}

.explainer-intro strong {
  color: var(--proj-text);
  font-weight: 600;
}

.explainer-steps {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.explainer-step {
  position: relative;
  background: var(--proj-surface);
  border: 1px solid var(--proj-border);
  border-radius: 16px;
  padding: 22px 22px 20px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.explainer-step:hover {
  border-color: var(--color-primary);
  background: var(--proj-elevated);
  transform: translateY(-2px);
}

.explainer-step-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--color-primary);
  margin-bottom: 14px;
}

.explainer-step h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--proj-text);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.explainer-step p {
  font-family: var(--font-display);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--proj-text-secondary);
  margin: 0;
}

.explainer-sections {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.explainer-section {
  background: var(--proj-surface);
  border: 1px solid var(--proj-border);
  border-radius: 16px;
  padding: 24px;
}

.explainer-section h3 {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.explainer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.explainer-section li {
  font-family: var(--font-display);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--proj-text-secondary);
  margin: 10px 0;
  padding-left: 18px;
  position: relative;
}

.explainer-section li::before {
  content: '\2192';
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-size: 0.8rem;
}

.explainer-section li strong {
  color: var(--proj-text);
  font-weight: 600;
}

/* ===== RESPONSIVE: TABLET ===== */
@media (max-width: 1100px) {
  .explainer-steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .explainer-sections {
    grid-template-columns: 1fr;
  }
}

/* ===== RESPONSIVE: MOBILE ===== */
@media (max-width: 768px) {
  .projections-page {
    padding-bottom: 64px;
  }

  .proj-header {
    padding: 32px 16px 20px;
  }

  .proj-eyebrow {
    margin-bottom: 14px;
  }

  .proj-title {
    font-size: 2rem;
  }

  .proj-subtitle {
    font-size: 0.92rem;
  }

  /* Toolbar: two horizontally scrolling rows */
  .proj-toolbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--proj-bg);
  }

  .proj-toolbar-inner {
    padding: 10px 0;
    gap: 10px;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .proj-toolbar-row {
    overflow-x: auto;
    padding: 0 16px;
    gap: 8px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .proj-toolbar-row::-webkit-scrollbar { display: none; }

  .proj-toolbar-controls {
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
  }

  .proj-toolbar-controls {
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .position-tabs {
    flex-shrink: 0;
  }

  .pos-tab {
    padding: 9px 14px;
  }

  .proj-search {
    flex: 0 0 200px;
    min-width: 200px;
    height: 40px;
  }

  .proj-select-group {
    gap: 8px;
    flex-shrink: 0;
  }

  .proj-select {
    height: 40px;
    flex-shrink: 0;
  }

  .proj-select-sort {
    display: inline-flex;
  }

  .proj-sort-dir {
    display: inline-flex;
    width: 40px;
    height: 40px;
  }

  /* Board */
  .proj-board {
    padding: 14px 16px 0;
  }

  .proj-board-meta {
    padding: 0 2px 8px;
  }

  .proj-details-toggle {
    display: inline-flex;
  }

  /* Stats strip collapsed until the user turns it on */
  .proj-table:not(.show-details) tbody tr::after,
  .proj-table:not(.show-details) tbody .cell-stat {
    display: none;
  }

  .proj-table-scroll {
    overflow: visible;
    border: none;
    border-radius: 0;
    background: transparent;
  }

  .proj-table {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .proj-table thead {
    display: none;
  }

  .proj-table tbody {
    display: grid;
    gap: 10px;
  }

  /* Each row becomes a card: rank + player + points on top,
     stats as a strip of tiles beneath. */
  .proj-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 6px;
    background: var(--proj-surface);
    border: 1px solid var(--proj-border);
    border-radius: 16px;
    padding: 12px 14px 12px 12px;
    transition: border-color 0.2s ease;
  }

  .proj-table tbody tr:hover {
    background: var(--proj-surface);
    border-color: var(--proj-border-strong);
  }

  .proj-table tbody tr::after {
    content: '';
    order: 1;
    flex-basis: 100%;
    height: 1px;
    background: var(--proj-border);
    margin: 10px 0 8px;
  }

  .proj-table tbody td {
    display: block;
    padding: 0;
    height: auto;
    border-bottom: none;
    position: static;
  }

  .proj-table tbody td:first-child,
  .proj-table tbody td:nth-child(2) {
    position: static;
    background: transparent;
  }

  .proj-table tbody td:nth-child(2)::after {
    display: none;
  }

  .proj-table-scroll.is-scrolled tbody td:nth-child(2)::after {
    display: none;
  }

  .proj-table tbody tr:hover td:first-child,
  .proj-table tbody tr:hover td:nth-child(2) {
    background: transparent;
  }

  .proj-table .cell-rank {
    order: 0;
    width: 26px;
    flex-shrink: 0;
    text-align: left;
    font-size: 0.74rem;
  }

  .proj-table .cell-player {
    order: 0;
    flex: 1 1 0;
    min-width: 0;
  }

  .proj-table .cell-player .player-inner {
    gap: 10px;
  }

  .player-avatar {
    width: 42px;
    height: 42px;
  }

  .player-name {
    font-size: 0.95rem;
  }

  .player-sub {
    font-size: 0.64rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .proj-table .cell-pts {
    order: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-left: 10px;
  }

  .proj-table .cell-pts::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--proj-text-faint);
    margin-bottom: 2px;
  }

  .pts-value {
    font-size: 1.25rem;
  }

  .pts-meter {
    width: 56px;
    margin-top: 5px;
  }

  .proj-table .cell-stat {
    order: 2;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    text-align: center;
    font-size: 0.78rem;
    padding: 4px 0;
    border-radius: 8px;
  }

  /* Tile label: group line (may be blank) above the stat line, value last */
  .proj-table .cell-stat::before,
  .proj-table .cell-stat::after {
    font-family: var(--font-mono);
    font-size: 0.52rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.2;
  }

  .proj-table .cell-stat::before {
    content: attr(data-group);
    order: 0;
    min-height: 1.2em;
    color: var(--proj-muted);
  }

  .proj-table .cell-stat::after {
    content: attr(data-label);
    order: 1;
    color: var(--proj-text-faint);
    margin-bottom: 2px;
  }

  .proj-table .cell-stat .cell-stat-value {
    order: 2;
  }

  .proj-table .cell-stat.is-sorted {
    background: var(--tint-primary);
    color: var(--color-primary);
  }

  .proj-table .cell-stat.is-sorted::before,
  .proj-table .cell-stat.is-sorted::after {
    color: var(--color-primary);
  }

  .proj-table .cell-stat.is-sorted::before {
    opacity: 0.7;
  }

  /* Skeleton cards */
  .row-skeleton .cell-stat { align-items: center; }
  .sk-name { width: 120px; }

  /* Empty state as a card */
  .proj-table .row-empty {
    display: block;
    padding: 0;
  }

  .proj-table .row-empty::after { display: none; }
  .proj-table .row-empty td { display: block; }
  .proj-empty { padding: 48px 20px; }

  /* Explainer */
  .proj-explainer {
    margin-top: 48px;
    padding: 0 16px;
  }

  .proj-explainer h2 {
    font-size: 1.3rem;
  }

  .explainer-intro {
    font-size: 0.92rem;
  }

  .explainer-steps {
    gap: 12px;
  }

  .explainer-step,
  .explainer-section {
    padding: 20px;
  }
}

@media (max-width: 600px) {
  .explainer-steps {
    grid-template-columns: 1fr;
  }
}

/* Very narrow phones: stat tiles wrap into two rows of four */
@media (max-width: 360px) {
  .proj-table .cell-stat {
    flex: 1 1 22%;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .proj-header,
  .proj-toolbar,
  .proj-board,
  .proj-explainer,
  .proj-table tbody tr {
    animation: none;
  }

  .proj-live-dot,
  .sk {
    animation: none;
  }
}
