/* ══════════════════════════════════════════
   WSJ-Inspired Editorial Design
   Font Pairing: Playfair Display (headlines) +
   Libre Franklin (UI/labels) + Source Serif 4 (body)
   ══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #faf8f5;
  --bg2: #ffffff;
  --bg3: #f2eeea;
  --surface: #ffffff;
  --border: #e0dbd4;
  --border-dark: #c9c2b8;
  --text: #1a1a1a;
  --text2: #6b6560;
  --text3: #9a938b;
  --accent: #c62828;
  --accent2: #ad2020;
  --green: #2e7d32;
  --green-light: #e8f5e9;
  --red: #c62828;
  --red-light: #ffebee;
  --blue: #1565c0;
  --blue-light: #e3f2fd;
  --gold: #c49000;
  --silver: #888;
  --bronze: #a0652e;
  --radius: 4px;
  --radius-sm: 3px;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --display: 'Playfair Display', Georgia, serif;
  --sans: 'Libre Franklin', -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.header {
  background: var(--bg2);
  border-bottom: 3px solid var(--text);
  padding: 20px 32px 16px;
}
.header-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.logo-area { display: flex; align-items: flex-end; gap: 14px; }
.logo-icon { font-size: 32px; line-height: 1; margin-bottom: 2px; }
.header h1 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--text);
}
.subtitle {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text2);
  margin-top: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: 500;
}
.header-right { display: flex; align-items: center; gap: 16px; }
.live-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--red);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 10px; font-weight: 700; color: var(--red);
  letter-spacing: 1px;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.last-updated { font-size: 11px; color: var(--text3); font-family: var(--sans); }

/* ── Nav Tabs ── */
.nav-tabs {
  max-width: 1280px; margin: 0 auto;
  display: flex; gap: 0;
  padding: 0 32px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 12px 20px; border: none; background: none;
  color: var(--text2); font-size: 13px; font-weight: 600;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: var(--sans);
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Main Content ── */
.main-content { max-width: 1400px; margin: 0 auto; padding: 28px 32px; }
#tab-bracket.active { max-width: none; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════════════════════════════════
   LEADERBOARD
   ══════════════════════════════════════════ */
.leaderboard-header { margin-bottom: 24px; }
.search-bar { margin-bottom: 16px; }
.search-bar input {
  width: 100%; max-width: 360px;
  padding: 9px 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); font-size: 14px; font-family: var(--sans);
  outline: none; transition: border-color 0.2s;
}
.search-bar input:focus { border-color: var(--text); }
.search-bar input::placeholder { color: var(--text3); }

.leaderboard-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-value {
  font-family: var(--display);
  font-size: 28px; font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.stat-label {
  font-family: var(--sans);
  font-size: 11px; color: var(--text3); margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600;
}
.stat-card-you { cursor: pointer; transition: all 0.15s; }
.stat-card-you:hover { border-color: var(--accent); box-shadow: var(--shadow); }

/* Name Picker Overlay */
.name-picker-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.name-picker {
  background: #fff; border-radius: 12px; padding: 24px; width: 360px;
  max-height: 500px; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.name-picker-title {
  font-family: var(--display); font-size: 20px; font-weight: 800;
  margin-bottom: 12px;
}
.name-picker-search {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; margin-bottom: 12px;
  font-family: var(--sans);
}
.name-picker-search:focus { outline: none; border-color: var(--accent); }
.name-picker-list {
  overflow-y: auto; max-height: 340px;
}
.name-picker-item {
  padding: 8px 12px; cursor: pointer; border-radius: 4px;
  font-family: var(--sans); font-size: 14px; transition: background 0.1s;
}
.name-picker-item:hover { background: var(--bg3); }
.name-picker-item.active { background: #e8f5e9; font-weight: 700; color: #2e7d32; }

.leaderboard-table-wrap {
  overflow-x: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.leaderboard-table {
  width: 100%; border-collapse: collapse;
}
.leaderboard-table thead th {
  background: var(--bg2);
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text3);
  text-align: left; font-weight: 700;
  border-bottom: 2px solid var(--text);
  position: sticky; top: 0; z-index: 1;
}
.sortable-col { cursor: pointer; user-select: none; }
.sortable-col:hover { color: var(--accent); }
.leaderboard-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.leaderboard-table tbody tr:hover { background: var(--bg3); }
.leaderboard-table td {
  padding: 10px 14px; font-size: 13px;
  font-family: var(--sans);
}

.rank-col { width: 48px; text-align: center; }
.name-col { min-width: 160px; }
.champ-col { min-width: 100px; }
.score-col { width: 48px; text-align: center; }
.total-col { width: 66px; text-align: center; font-weight: 700; }
.remaining-col { width: 66px; text-align: center; font-weight: 600; color: var(--text3); font-size: 12px; }
.bar-col { width: 100px; }

.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-family: var(--sans);
  font-weight: 800; font-size: 11px;
  background: var(--bg3); color: var(--text2);
}
.rank-1 { background: var(--gold); color: #fff; }
.rank-2 { background: var(--silver); color: #fff; }
.rank-3 { background: var(--bronze); color: #fff; }

.player-name { font-weight: 600; color: var(--text); }
.player-name.is-you { color: var(--accent); }
.is-you-row { background: var(--red-light) !important; }
.champ-tag {
  display: inline-block; padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 11px; font-weight: 600;
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border);
}
.champ-alive { background: var(--green-light); color: var(--green); border-color: #c8e6c9; }
.champ-eliminated { background: var(--red-light); color: var(--red); text-decoration: line-through; border-color: #ffcdd2; }

.score-cell { color: var(--text3); font-variant-numeric: tabular-nums; }
.score-cell.has-points { color: var(--text); font-weight: 700; }

.progress-bar {
  height: 4px; border-radius: 2px;
  background: var(--bg3); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 2px;
  background: var(--accent);
  transition: width 0.3s;
}

/* ══════════════════════════════════════════
   BRACKET VIEW
   ══════════════════════════════════════════ */
.bracket-controls {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap;
}
.bracket-select {
  padding: 8px 12px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 13px; font-family: var(--sans);
  cursor: pointer; min-width: 250px;
}
.bracket-region-tabs { display: flex; gap: 0; }
.region-tab {
  padding: 7px 18px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text2);
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all 0.15s;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.region-tab:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.region-tab:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.region-tab + .region-tab { border-left: none; }
.region-tab:hover { background: var(--bg3); color: var(--text); }
.region-tab.active { background: var(--text); border-color: var(--text); color: #fff; }

.bracket-round-tabs { display: flex; gap: 0; }
.round-tab {
  padding: 6px 14px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text2);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
  font-family: var(--sans);
}
.round-tab:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.round-tab:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.round-tab + .round-tab { border-left: none; }
.round-tab:hover { background: var(--bg3); color: var(--text); }
.round-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.bracket-controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

.bracket-view { overflow-x: auto; padding-bottom: 20px; }

.bracket-round { display: flex; gap: 0; width: 100%; }
.bracket-column {
  display: flex; flex-direction: column;
  justify-content: space-around;
  flex: 1; min-width: 175px; padding: 0 6px;
}
.bracket-game {
  display: flex; flex-direction: column;
  margin: 4px 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.bracket-game:hover { border-color: var(--text); box-shadow: var(--shadow); }
.bracket-team {
  display: flex; align-items: center;
  padding: 6px 10px; gap: 8px;
  font-size: 12px;
  font-family: var(--sans);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.bracket-team:last-child { border-bottom: none; }
.bracket-team.winner { background: var(--green-light); }
.bracket-team.loser { opacity: 0.35; }
.bracket-seed {
  font-size: 10px; font-weight: 800; color: var(--text3);
  min-width: 18px; text-align: center;
}
.bracket-team-name {
  font-weight: 600; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bracket-score-val { font-weight: 800; color: var(--accent); font-size: 13px; }

/* ══════════════════════════════════════════
   MATCHUPS TAB
   ══════════════════════════════════════════ */
.matchups-controls { margin-bottom: 20px; }
.matchups-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.matchup-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.matchup-card-header {
  display: flex; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 10px; color: var(--text3);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
}
.matchup-teams { padding: 0; }
.matchup-team-row {
  display: flex; align-items: center; padding: 10px 16px;
  border-bottom: 1px solid var(--border); gap: 10px;
}
.matchup-team-row:last-child { border-bottom: none; }
.matchup-team-row.matchup-winner {
  background: linear-gradient(90deg, rgba(34,139,34,0.08) 0%, rgba(34,139,34,0.02) 100%);
  border-left: 3px solid #228b22;
}
.matchup-team-row.matchup-winner .matchup-team-name { font-weight: 800; color: #1a6e1a; }
.matchup-final-badge {
  display: inline-block; font-family: var(--sans); font-size: 9px; font-weight: 800;
  color: #228b22; background: rgba(34,139,34,0.1); border-radius: 3px;
  padding: 2px 6px; margin-right: 8px; letter-spacing: 0.5px;
}
.matchup-seed-badge {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans);
  font-size: 9px; font-weight: 800;
  background: var(--bg3); color: var(--text2);
}
.matchup-team-name { font-weight: 600; flex: 1; font-size: 14px; font-family: var(--serif); }
.matchup-bar-wrap { flex: 1; max-width: 140px; }
.matchup-bar {
  height: 16px; border-radius: 2px; background: var(--bg3);
  overflow: hidden; position: relative;
}
.matchup-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.5s;
}
.matchup-bar-fill.top { background: var(--blue); }
.matchup-bar-fill.bottom { background: var(--accent); }
.matchup-pct {
  font-family: var(--sans);
  font-size: 13px; font-weight: 800; min-width: 42px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.matchup-voters {
  padding: 0 16px 0;
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s;
}
.matchup-card.expanded .matchup-voters { max-height: 300px; overflow-y: auto; padding-bottom: 12px; }
.matchup-voter-list { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.matchup-voter {
  font-family: var(--sans);
  font-size: 11px; padding: 2px 7px;
  background: var(--bg3); border-radius: 2px; color: var(--text2);
}
.matchup-toggle {
  display: block; width: 100%; padding: 8px;
  background: none; border: none; border-top: 1px solid var(--border);
  color: var(--text3); font-size: 11px; cursor: pointer;
  font-family: var(--sans); font-weight: 600;
  letter-spacing: 0.3px;
}
.matchup-toggle:hover { color: var(--text); background: var(--bg3); }

/* ══════════════════════════════════════════
   CHAMPION PICKS CHART
   ══════════════════════════════════════════ */
.champion-chart { max-width: 100%; }
.champion-chart h3 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
}
.champ-bar-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 6px;
  padding: 4px 0;
}
.champ-bar-label {
  min-width: 110px;
  font-family: var(--serif);
  font-size: 14px; font-weight: 600; text-align: right;
  color: var(--text);
}
.champ-bar-wrap {
  flex: 1; height: 24px; background: var(--bg3);
  border-radius: 2px; overflow: hidden; position: relative;
}
.champ-bar-fill {
  height: 100%; border-radius: 2px;
  background: var(--accent);
  display: flex; align-items: center; padding-left: 8px;
  font-family: var(--sans);
  font-size: 11px; font-weight: 700; color: #fff;
  transition: width 0.5s;
}
.champ-bar-count {
  min-width: 65px;
  font-family: var(--sans);
  font-size: 12px; color: var(--text2); text-align: right;
  font-variant-numeric: tabular-nums;
}

.chart-section {
  margin-bottom: 32px;
}
.chart-section h3 {
  font-family: var(--display); font-size: 18px; font-weight: 800;
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 2px solid var(--text);
}
.charts-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
  margin-bottom: 32px;
}
.upset-list {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.upset-row {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius);
  border-top: 3px solid var(--accent);
}
.upset-team {
  font-family: var(--serif); font-size: 14px;
  display: flex; align-items: center; gap: 6px;
}
.upset-seed { color: var(--text3); font-weight: 400; font-size: 11px; }
.upset-round { font-family: var(--sans); font-size: 12px; color: var(--text2); }
.upset-who { font-family: var(--sans); font-size: 11px; color: var(--text3); }

/* ══════════════════════════════════════════
   LIVE SCORES
   ══════════════════════════════════════════ */
.live-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
}
.live-header h2 {
  font-family: var(--display);
  font-size: 22px; font-weight: 800;
}
.btn-refresh {
  padding: 7px 18px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-weight: 700; font-size: 12px;
  cursor: pointer; font-family: var(--sans);
  text-transform: uppercase; letter-spacing: 0.5px;
  transition: all 0.15s;
}
.btn-refresh:hover { background: var(--text); color: #fff; }

.live-games {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.no-games {
  grid-column: 1 / -1; text-align: center;
  padding: 60px 20px; color: var(--text3);
  font-family: var(--serif); font-size: 15px;
  font-style: italic;
}
.live-game-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.live-game-status {
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  background: var(--bg3); color: var(--text3);
  display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.live-game-status.in-progress {
  color: var(--red); background: var(--red-light);
  border-bottom-color: #ffcdd2;
}
.live-game-status.final { color: var(--green); background: var(--green-light); }
.live-game-team {
  display: flex; align-items: center; padding: 10px 14px; gap: 10px;
  border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.live-pick-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  opacity: 0.1; pointer-events: none;
  transition: width 0.3s;
}
.live-pick-pct {
  font-family: var(--sans); font-size: 11px;
  font-weight: 700; color: var(--text3);
  min-width: 32px; text-align: right;
}
.live-game-team:last-child { border-bottom: none; }
.live-game-team.winning .live-team-name { font-weight: 800; }
.live-seed {
  font-family: var(--sans);
  font-size: 10px; color: var(--text3); min-width: 18px;
  text-align: center; font-weight: 800;
}
.live-team-name {
  flex: 1; font-size: 14px;
  font-family: var(--serif); font-weight: 600;
}
.live-team-score {
  font-family: var(--sans);
  font-size: 18px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.live-pool-pct {
  padding: 6px 14px;
  font-family: var(--sans);
  font-size: 11px; color: var(--text3);
  display: flex; justify-content: space-between;
  background: var(--bg3);
}

/* ══════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(3px);
}
.modal-content {
  position: relative; z-index: 1;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 92vw; max-width: 820px; max-height: 85vh;
  overflow-y: auto; padding: 28px 32px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
}
.modal-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; color: var(--text3);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-player-name {
  font-family: var(--display);
  font-size: 26px; font-weight: 900; margin-bottom: 4px;
  line-height: 1.1;
}
.modal-player-champ {
  font-family: var(--sans);
  font-size: 13px; color: var(--text2); margin-bottom: 20px;
}
.modal-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 24px;
}
.modal-stat {
  background: var(--bg3); border-radius: var(--radius);
  padding: 14px; text-align: center;
}
.modal-stat-val {
  font-family: var(--display);
  font-size: 24px; font-weight: 800; color: var(--text);
}
.modal-stat-label {
  font-family: var(--sans);
  font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.8px;
  font-weight: 700; margin-top: 2px;
}
.modal-picks-section { margin-top: 16px; }
.modal-picks-section h3 {
  font-family: var(--display);
  font-size: 18px; margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.modal-picks-round { margin-bottom: 14px; }
.modal-round-title {
  font-family: var(--sans);
  font-size: 10px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 6px; padding-bottom: 4px;
}
.modal-pick-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.modal-pick-tag {
  padding: 3px 10px; border-radius: 2px;
  font-family: var(--sans);
  font-size: 12px; font-weight: 600;
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border);
}
.modal-pick-tag.correct { background: var(--green-light); color: var(--green); border-color: #c8e6c9; }
.modal-pick-tag.wrong { background: var(--red-light); color: var(--red); opacity: 0.5; border-color: #ffcdd2; }

.modal-player-header { margin-bottom: 16px; }
.modal-bracket-round { margin-bottom: 16px; }
.modal-bracket-grid {
  display: grid; gap: 6px;
}
.modal-bracket-pick {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 2px;
  background: var(--bg3); border: 1px solid var(--border);
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-bracket-pick img { flex-shrink: 0; }

.modal-champion-footer {
  margin-top: 20px; padding: 16px 20px;
  background: linear-gradient(135deg, #fff8e1, #fff3cd);
  border: 2px solid #ffc107; border-radius: 8px;
  display: flex; align-items: center; gap: 12px;
  text-align: center; justify-content: center;
}
.modal-champion-trophy { font-size: 28px; }
.modal-champion-label {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text2);
}
.modal-champion-team {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 16px; color: var(--text);
}

/* ══════════════════════════════════════════
   FULL BRACKET
   ══════════════════════════════════════════ */
.full-bracket {
  display: grid;
  grid-template-columns: 1fr 180px 1fr;
  align-items: stretch;
  min-height: 600px;
}
.full-bracket-half {
  display: flex; flex-direction: column; gap: 24px;
  min-width: 0;
}
.full-bracket-region {
  width: 100%;
}
.full-bracket-half.right .region-label {
  text-align: right;
}
.full-bracket-center {
  width: 180px; min-width: 180px;
  display: flex; flex-direction: column;
  justify-content: space-around; align-items: center;
  padding: 20px 0;
}
.region-label {
  font-family: var(--display);
  font-size: 16px; font-weight: 800;
  padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 2px solid var(--text);
  text-transform: uppercase; letter-spacing: 1px;
}
.region-games {
  display: flex; flex-direction: column; gap: 6px;
}
.bracket-game img { flex-shrink: 0; }

.bracket-game-status {
  padding: 3px 8px;
  font-family: var(--sans);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text3); background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.game-status-live {
  color: var(--red); background: var(--red-light);
}
.game-status-final {
  color: var(--green); background: var(--green-light);
}
.game-status-pre {
  color: var(--text3);
}
.bracket-team.winning {
  background: var(--green-light);
}
.bracket-team.winning .bracket-team-name { font-weight: 800; }

.ff-matchup {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.ff-slot {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 16px;
  font-family: var(--sans); font-size: 12px; color: var(--text3);
  font-weight: 600; width: 140px; text-align: center;
}
.ff-vs {
  font-family: var(--serif); font-style: italic;
  color: var(--text3); font-size: 13px;
}
.ff-champ {
  text-align: center; padding: 16px 0;
}
.ff-trophy { font-size: 36px; }
.ff-champ-label {
  font-family: var(--display);
  font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text3); margin-top: 4px;
}

/* ══════════════════════════════════════════
   538-STYLE DOT POPOUT
   ══════════════════════════════════════════ */
.dot-popout {
  position: fixed; z-index: 2000;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px; width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  font-family: var(--sans);
}
.popout-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 8px;
}
.popout-team-side {
  display: flex; align-items: center; gap: 10px;
}
.popout-team-side.right { text-align: right; }
.popout-team-name {
  font-family: var(--serif);
  font-size: 15px; font-weight: 700;
}
.popout-team-pct {
  font-size: 12px; color: var(--text2); font-weight: 600;
}
.popout-vs {
  font-family: var(--serif); font-style: italic;
  color: var(--text3); font-size: 14px;
}
.popout-bar {
  display: flex; height: 8px; border-radius: 4px;
  overflow: hidden; margin-bottom: 14px;
}
.popout-bar-fill { height: 100%; transition: width 0.4s; }
.popout-dots {
  display: flex; flex-wrap: wrap; gap: 4px;
  justify-content: center;
  margin-bottom: 12px; padding: 8px 0;
}
.popout-dot {
  width: 10px; height: 10px; border-radius: 50%;
  cursor: pointer; transition: transform 0.15s;
  opacity: 0.85;
}
.popout-dot:hover { transform: scale(1.6); opacity: 1; }
.popout-legend {
  display: flex; justify-content: center; gap: 20px;
  font-size: 11px; font-weight: 600; color: var(--text2);
  margin-bottom: 12px;
}
.popout-legend-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.popout-names {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; max-height: 200px; overflow-y: auto;
  border-top: 1px solid var(--border); padding-top: 10px;
}
.popout-name-header {
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.popout-name-row { font-size: 11px; color: var(--text2); padding: 1px 0; }

/* ══════════════════════════════════════════
   LAST PLACE QUIP
   ══════════════════════════════════════════ */
.last-place-quip {
  font-family: var(--serif);
  font-size: 11px; font-style: italic;
  color: var(--text3); margin-top: 2px;
}
.is-last-row { background: #fef9f0 !important; }
.is-last-row:hover { background: #fdf3e0 !important; }

/* ══════════════════════════════════════════
   RISK TOLERANCE TAB
   ══════════════════════════════════════════ */
.risk-header-section { margin-bottom: 24px; }
.risk-header-section h3 {
  font-family: var(--display);
  font-size: 22px; font-weight: 800;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
  margin-bottom: 8px;
}
.risk-subtitle {
  font-family: var(--serif);
  font-size: 14px; color: var(--text2);
  margin-bottom: 12px; line-height: 1.6;
}
.risk-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.risk-legend-item {
  font-family: var(--sans);
  font-size: 12px; font-weight: 600; color: var(--text2);
}
.risk-chart {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.risk-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--sans); font-size: 13px;
  transition: background 0.1s;
}
.risk-row:hover { background: var(--bg3); }
.risk-row:last-child { border-bottom: none; }
.risk-you { background: var(--red-light) !important; }
.risk-rank {
  min-width: 28px; text-align: center;
  font-weight: 800; color: var(--text3); font-size: 11px;
}
.risk-name-col {
  width: 320px; min-width: 320px; max-width: 320px;
  display: flex; flex-direction: column;
}
.risk-name {
  font-weight: 600; white-space: nowrap;
}
.risk-quip {
  font-family: var(--serif); font-size: 11px;
  font-style: italic; color: var(--text3);
  line-height: 1.3;
}
.risk-tier-badge { font-size: 16px; min-width: 24px; text-align: center; }
.risk-bar-wrap {
  flex: 1; height: 12px; background: var(--bg3);
  border-radius: 2px; overflow: hidden; max-width: 300px;
}
.risk-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.5s;
}
.risk-score {
  min-width: 36px; text-align: right;
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.risk-champ {
  min-width: 120px; font-size: 12px; color: var(--text2);
  display: flex; align-items: center; gap: 4px;
}

/* ══════════════════════════════════════════
   PERFECT BRACKET TRACKER
   ══════════════════════════════════════════ */
.perfect-stats { margin-bottom: 24px; }
.perfect-stat-big {
  text-align: center; padding: 32px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.perfect-number {
  font-family: var(--display);
  font-size: 72px; font-weight: 900; color: var(--green);
  line-height: 1;
}
.perfect-label {
  font-family: var(--sans); font-size: 14px;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text); margin-top: 8px;
}
.perfect-sub {
  font-family: var(--serif); font-size: 14px;
  color: var(--text3); font-style: italic; margin-top: 4px;
}
.perfect-stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.perfect-mini-stat {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.perfect-mini-val {
  font-family: var(--display);
  font-size: 28px; font-weight: 800; display: block;
}
.perfect-mini-label {
  font-family: var(--sans); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text3); font-weight: 700;
}
.perfect-section { margin-bottom: 20px; }
.perfect-section-title {
  font-family: var(--sans); font-size: 13px;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.perfect-dots-wrap {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.perfect-person {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 2px;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
}
.perfect-person.still { background: var(--green-light); color: var(--green); border-color: #c8e6c9; }
.perfect-person.busted { background: var(--red-light); color: var(--red); border-color: #ffcdd2; opacity: 0.7; }
.perfect-dot-icon { font-size: 11px; font-weight: 800; }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
/* ══════════════════════════════════════════
   ROUND VIEW (R32, S16, E8, FF)
   ══════════════════════════════════════════ */
.round-view-header h3 {
  font-family: var(--display); font-size: 20px; font-weight: 800;
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 2px solid var(--text);
}
.round-view-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.round-view-region { }
.round-view-region .region-label {
  font-size: 14px; margin-bottom: 10px; padding-bottom: 4px;
}
.round-matchups {
  display: flex; flex-direction: column; gap: 8px;
}
.round-matchups .bracket-game {
  font-size: 13px;
}
.round-matchups .bracket-team {
  padding: 8px 12px;
}
.final-four-grid {
  display: flex; align-items: center; justify-content: center;
  gap: 40px; padding: 40px 0;
}
.ff-game { min-width: 240px; }
.ff-game-label {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text3); margin-bottom: 8px;
}
.ff-game .bracket-game { font-size: 14px; }
.ff-game .bracket-team { padding: 12px 16px; }
.ff-champion-center {
  text-align: center; padding: 20px;
}

/* ══════════════════════════════════════════
   TAGLINE
   ══════════════════════════════════════════ */
.tagline {
  font-family: var(--serif); font-style: italic;
  font-size: 12px; color: var(--text3);
  margin-top: 2px; letter-spacing: 0.2px;
}

/* ══════════════════════════════════════════
   PERSON BRACKET VIEW
   ══════════════════════════════════════════ */
.person-bracket-header {
  margin-bottom: 16px;
}
.person-bracket-header h2 {
  font-family: var(--display); font-size: 22px; font-weight: 800;
}
.person-bracket-meta {
  display: flex; gap: 20px; margin-top: 6px;
  font-family: var(--sans); font-size: 13px; color: var(--text2);
}
.person-bracket-meta img { vertical-align: middle; }
.person-bracket-champ strong,
.person-bracket-rank strong,
.person-bracket-score strong { color: var(--text); }
.person-bracket-layout {
  display: flex; gap: 0; align-items: flex-start;
}
.person-bracket-left,
.person-bracket-right {
  flex: 1; display: flex; flex-direction: column; gap: 20px;
}
.person-bracket-center {
  width: 200px; min-width: 200px;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 20px 0;
}
.person-region-bracket { }
.person-region-bracket .bracket-round {
  display: flex; gap: 0; align-items: stretch; width: 100%;
}
.person-region-bracket .bracket-column {
  display: flex; flex-direction: column;
  justify-content: space-around;
  flex: 1; min-width: 160px; padding: 0 6px;
}
.person-final-four {
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
}
.ff-champ-team {
  font-family: var(--display); font-size: 18px; font-weight: 800;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  margin-top: 4px;
}

/* Person pick highlighting */
.bracket-team.person-pick {
  background: #e8f5e9; border-left: 3px solid var(--green);
}
.bracket-team.person-pick .bracket-team-name {
  font-weight: 800; color: var(--green);
}
.bracket-team.pick-correct {
  background: #c8e6c9;
}
.bracket-team.pick-correct .bracket-team-name {
  color: #1b5e20;
}
.bracket-team.pick-wrong {
  background: #ffebee; border-left-color: var(--red);
}
.bracket-team.pick-wrong .bracket-team-name {
  text-decoration: line-through; color: var(--red); opacity: 0.6;
}
.ff-slot.person-pick {
  background: #e8f5e9; border-color: var(--green);
  color: var(--green); font-weight: 700;
}
.ff-slot.person-pick img { vertical-align: middle; }
.region-winner-game {
  border: 2px solid var(--green);
}

/* ══════════════════════════════════════════
   MOBILE BREAKPOINTS
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── Header ── */
  .header { padding: 12px 14px 10px; }
  .header-content { flex-direction: column; align-items: flex-start; gap: 8px; }
  .header h1 { font-size: 20px; }
  .subtitle { font-size: 11px; }
  .tagline { font-size: 10px; }
  .logo-icon { font-size: 24px; }
  .header-right { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: flex-end; }
  .last-updated { font-size: 10px; }

  /* ── Nav ── */
  .nav-tabs { padding: 0 8px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab { padding: 10px 12px; font-size: 10px; white-space: nowrap; }

  /* ── Main content ── */
  .main-content { padding: 16px 12px; }

  /* ── Leaderboard ── */
  .leaderboard-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10px; }
  .search-bar input { font-size: 14px; padding: 10px 14px; }

  /* ── Leaderboard table: hide per-round scores, show key columns ── */
  .score-col { display: none; }
  .bar-col { display: none; }
  .remaining-col { width: 50px; font-size: 11px; }
  .rank-col { width: 36px; }
  .name-col { min-width: 110px; }
  .champ-col { min-width: 80px; }
  .champ-tag { font-size: 11px; }
  .total-col { width: 50px; font-size: 13px; }
  .leaderboard-table td { padding: 10px 6px; font-size: 12px; }
  .leaderboard-table thead th { padding: 8px 6px; font-size: 10px; }
  .player-name { font-size: 13px; }
  .last-place-quip { font-size: 10px; }
  .rank-badge { width: 26px; height: 26px; font-size: 11px; }

  /* ── Bracket ── */
  .bracket-controls { flex-direction: column; align-items: flex-start; gap: 8px; }
  .bracket-select { font-size: 13px; width: 100%; }
  .bracket-region-tabs { flex-wrap: wrap; gap: 0; }
  .region-tab { padding: 6px 12px; font-size: 11px; }
  .bracket-round-tabs { flex-direction: column; gap: 0; }
  .round-tab { padding: 8px 12px; font-size: 11px; width: 100%; text-align: left; border-radius: 0; border-bottom: 1px solid var(--border); }

  /* Full bracket: stack vertically on mobile */
  .bracket-view { overflow-x: hidden; }
  .full-bracket { grid-template-columns: 1fr; gap: 20px; max-width: 100%; overflow: hidden; }
  .full-bracket-center { width: 100%; min-width: unset; flex-direction: row; gap: 16px; padding: 12px 0; }
  .full-bracket-half.right .region-label { text-align: left; }
  .region-label { font-size: 14px; }
  .bracket-game { margin: 3px 0; }
  .bracket-team { padding: 6px 8px; font-size: 12px; }
  .bracket-team-name { font-size: 12px; }
  .bracket-seed { font-size: 10px; min-width: 16px; }
  .bracket-game-status { font-size: 8px; padding: 2px 6px; }
  .bracket-game img { width: 18px; height: 18px; }

  /* Region view: stack columns */
  .bracket-round { flex-direction: column; gap: 16px; }
  .bracket-column { min-width: unset; width: 100%; padding: 0; }
  .person-region-bracket .bracket-round { flex-direction: column; gap: 16px; }
  .person-region-bracket .bracket-column { min-width: unset; width: 100%; }

  /* ── Matchups ── */
  .matchups-grid { grid-template-columns: 1fr; gap: 8px; }
  .matchup-card { font-size: 13px; }
  .matchup-team-name { font-size: 13px; }
  .matchup-pct { font-size: 12px; min-width: 36px; }
  .matchup-voter { font-size: 11px; padding: 2px 6px; }

  /* ── Champion Picks ── */
  .charts-grid { grid-template-columns: 1fr; gap: 20px; }
  .upset-list { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .champ-bar-label { min-width: 80px; font-size: 12px; }
  .champ-bar-count { min-width: 50px; font-size: 11px; }
  .chart-section h3 { font-size: 16px; }
  .upset-row { padding: 10px; }
  .upset-team { font-size: 13px; }
  .upset-round { font-size: 11px; }
  .upset-who { font-size: 11px; }

  /* ── Risk Tolerance ── */
  .risk-row { padding: 6px 10px; gap: 6px; font-size: 12px; }
  .risk-name-col { width: 160px; min-width: 160px; max-width: 160px; }
  .risk-name { font-size: 12px; }
  .risk-quip { font-size: 10px; }
  .risk-rank { min-width: 22px; font-size: 10px; }
  .risk-tier-badge { font-size: 10px; padding: 2px 6px; }
  .risk-bar-wrap { min-width: 40px; max-width: 80px; }
  .risk-score { min-width: 30px; font-size: 11px; }
  .risk-champ { display: none; }

  /* ── Live Scores ── */
  .live-games { grid-template-columns: 1fr; }

  /* ── Modal ── */
  .modal-content { width: 95vw; max-width: 95vw; max-height: 90vh; padding: 16px; }
  .modal-player-name { font-size: 20px; }
  .modal-stats { gap: 8px; }
  .modal-stat { padding: 10px; }
  .modal-stat-val { font-size: 22px; }
  .modal-bracket-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .modal-bracket-pick { font-size: 11px; padding: 4px 6px; }
  .modal-champion-footer { padding: 12px 14px; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .modal-champion-team { font-size: 14px; }

  /* ── Name Picker ── */
  .name-picker { width: 90vw; max-height: 80vh; }

  /* ── Person bracket header ── */
  .person-bracket-header { flex-direction: column; gap: 8px; padding: 12px; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 18px; }
  .leaderboard-stats { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .stat-card { padding: 10px 12px; }
  .stat-value { font-size: 18px; }
  .upset-list { grid-template-columns: 1fr; }
  .risk-name-col { width: 120px; min-width: 120px; max-width: 120px; }
  .modal-bracket-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .champ-bar-label { min-width: 60px; font-size: 11px; }
  .remaining-col { display: none; }
}
