/* ========================================
   Watts Football Pool — Mobile-First CSS
   ======================================== */

:root {
  --primary: #1a472a;      /* Dark green (field) */
  --primary-light: #2d6a3e;
  --accent: #f5a623;       /* Gold/yellow */
  --accent-glow: #ffcc00;
  --bg: #0d1117;           /* Dark background */
  --bg-card: #161b22;
  --bg-surface: #21262d;
  --text: #f0f6fc;
  --text-muted: #8b949e;
  --text-dim: #484f58;
  --success: #3fb950;
  --danger: #f85149;
  --border: #30363d;
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  /* Prevent iOS Dynamic Type from scaling text on ALL elements */
  -webkit-text-size-adjust: 100% !important;
  -moz-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ---- Screens ---- */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ---- Auth Screen ---- */
#auth-screen {
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--bg) 0%, #0a1f12 50%, var(--bg) 100%);
}

.auth-container {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.logo {
  font-size: 64px;
  margin-bottom: 8px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.auth-container h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 16px; /* Prevents zoom on iOS */
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.auth-form input:focus {
  border-color: var(--accent);
}

.auth-form input::placeholder {
  color: var(--text-dim);
}

.auth-toggle {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-toggle a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.error {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 14px;
}

.notice {
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
  color: var(--accent);
  font-size: 14px;
}

/* ---- Buttons ---- */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--text);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.btn-icon:active {
  background: var(--bg-surface);
}

/* ---- Header ---- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo { font-size: 24px; }

.header-title {
  font-size: 18px;
  font-weight: 800;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ---- Tab Bar ---- */
.tab-bar {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 49px;
  z-index: 99;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s, border-color 0.2s;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-icon { font-size: 18px; }
.tab-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- Tab Content ---- */
.tab-content {
  display: none;
  flex: 1;
  padding: 16px;
  padding-bottom: 100px;
}

.tab-content.active { display: block; overflow-x: hidden; }

/* ---- Week Header ---- */
.week-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.week-header h2 {
  font-size: 20px;
  font-weight: 700;
  min-width: 100px;
  text-align: center;
}

/* ---- Deadline Banner ---- */
.deadline-banner {
  background: linear-gradient(90deg, rgba(245, 166, 35, 0.15), rgba(245, 166, 35, 0.05));
  border: 1px solid rgba(245, 166, 35, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--accent);
  text-align: center;
  font-weight: 600;
}

/* ---- Matchup Cards ---- */
.matchups-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.matchup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.matchup-card.has-pick {
  border-color: var(--primary-light);
}

.matchup-number {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 14px 0;
  font-weight: 600;
}

.matchup-teams {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.team-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  margin: 4px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.team-btn:first-child {
  border-right: none;
}

.team-btn:active {
  background: var(--bg-surface);
}

.team-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-bottom: 4px;
  pointer-events: none;
}

.team-btn-name {
  display: block;
  line-height: 1.2;
}

.team-record {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 2px;
}

.team-btn.selected {
  background: rgba(26, 71, 42, 0.9);
  color: var(--accent-glow);
  border-radius: var(--radius-sm);
}

.team-btn.selected .team-record {
  color: rgba(255, 204, 0, 0.6);
}

.team-btn.disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.team-btn.disabled:active {
  background: none;
  transform: none;
}

.matchup-card.locked {
  opacity: 0.85;
}

.lock-badge {
  font-size: 10px;
  margin-left: 4px;
}

.team-btn .at-symbol { display: none; }

.matchup-at {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  flex-shrink: 0;
}

.matchup-kickoff {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 14px 8px;
  text-align: center;
}

/* ---- Scored Games (Picks Tab) ---- */
.matchup-card.scored {
  opacity: 1;
}

.matchup-card.scored.pick-correct {
  border-color: rgba(63, 185, 80, 0.3);
  background: linear-gradient(135deg, var(--bg-card), rgba(63, 185, 80, 0.05));
}

.matchup-card.scored.pick-wrong {
  border-color: rgba(248, 81, 73, 0.2);
  background: linear-gradient(135deg, var(--bg-card), rgba(248, 81, 73, 0.03));
}

.matchup-card.scored.no-pick {
  border-color: var(--border);
  opacity: 0.7;
}

.scored-badge {
  font-size: 10px;
  background: var(--bg-surface);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.scored-team {
  cursor: default !important;
  text-align: center;
  align-items: center;
}

.scored-team:active {
  background: none !important;
  transform: none !important;
}

.team-winner {
  color: var(--success) !important;
}

.team-loser {
  color: var(--text-dim) !important;
}

.team-tied {
  color: var(--accent) !important;
}

.team-score-inline {
  display: block;
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
}

.team-winner .team-score-inline {
  color: var(--success);
}

.team-loser .team-score-inline {
  color: var(--text-dim);
}

.scored-team.user-picked {
  position: relative;
}

.scored-team.user-picked::after {
  content: "YOUR PICK";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(245, 166, 35, 0.2);
  color: var(--accent);
}

.matchup-result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px 10px;
  font-size: 12px;
}

.pick-result {
  font-weight: 700;
}

.pick-result.pick-correct {
  color: var(--success);
}

.pick-result.pick-wrong {
  color: var(--danger);
}

.pick-result.no-pick {
  color: var(--text-dim);
}

/* ---- Submit Bar ---- */
.submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 200;
}

.pick-count {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.btn-submit {
  padding: 12px 32px;
  font-size: 15px;
}

/* ---- Standings ---- */
.standings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.standings-section {
  margin-bottom: 24px;
}

.standings-section:last-child {
  margin-bottom: 0;
}

.standings-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.standing-row {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  gap: 12px;
}

.standing-rank {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-dim);
  min-width: 32px;
  text-align: center;
}

.standing-rank.gold { color: #ffd700; }
.standing-rank.silver { color: #c0c0c0; }
.standing-rank.bronze { color: #cd7f32; }

.standing-name {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
}

.standing-points {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}

.standing-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: -4px;
}

/* ---- Results ---- */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

/* Week Scoreboard */
.week-scoreboard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
}

.week-scoreboard h3 {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.week-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.week-score-row:last-child { border-bottom: none; }

.week-score-row.week-winner {
  color: var(--accent-glow);
}

.week-score-name {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.week-score-value {
  font-weight: 800;
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.week-winner .week-score-value {
  color: var(--accent-glow);
}

/* Game Result Cards */
.results-games {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  overflow: hidden;
}

.result-matchup {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.result-team {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.result-team-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.result-team .team-name {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-team .team-score {
  font-size: 18px;
  font-weight: 800;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.result-team.winner {
  color: var(--success);
}

.result-team.loser {
  color: var(--text-dim);
}

.result-at {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 0 2px;
  flex-shrink: 0;
}

.result-teams-line {
  font-size: 14px;
}

.result-score-line {
  font-size: 13px;
  margin-top: 4px;
}

.result-picks-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.result-member-pick {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  white-space: nowrap;
}

.result-member-pick.correct {
  background: rgba(63, 185, 80, 0.2);
  color: var(--success);
}

.result-member-pick.wrong {
  background: rgba(248, 81, 73, 0.15);
  color: var(--danger);
}

.result-member-pick.tie {
  background: rgba(139, 148, 158, 0.2);
  color: var(--text-muted);
}

.result-team.tied {
  color: var(--accent);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 24px;
  font-size: 15px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  z-index: 500;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

/* ---- Utilities ---- */
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (min-width: 480px) {
  .auth-container { padding: 0 24px; }
  .tab-content { padding: 24px; max-width: 600px; margin: 0 auto; }
}

/* ========================================
   Live Scoreboard Tab
   ======================================== */

/* Tab badge: only rendered when a game is actually in progress. */
.live-dot {
  position: absolute;
  top: 6px;
  right: 50%;
  margin-right: -22px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.7);
  animation: livePulse 1.8s infinite;
}

.tab { position: relative; }
.live-dot.hidden { display: none; }

@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.7); }
  70%  { box-shadow: 0 0 0 7px rgba(248, 81, 73, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 81, 73, 0); }
}

.live-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.live-header h2 { font-size: 18px; font-weight: 700; }

.live-updated {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.live-list { display: flex; flex-direction: column; gap: 10px; }

.live-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

/* In-progress games get lifted out of the list visually. */
.live-card.is-live {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.06), transparent 60%), var(--bg-card);
}

.live-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.live-badge {
  color: var(--danger);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.final-badge {
  color: var(--text-dim);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.live-tv { font-size: 11px; color: var(--text-dim); }

.live-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
}

.live-team-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.live-logo { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }

.live-abbr { font-size: 15px; font-weight: 700; letter-spacing: 0.3px; }

.live-record { font-size: 11px; color: var(--text-dim); }

/* Football emoji marks possession — the field the tab was built for. */
.poss-dot { font-size: 12px; line-height: 1; }

.live-score {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Losing side of a finished game recedes so the winner reads instantly. */
.live-team:not(.winner) .live-score { color: var(--text-muted); }
.live-card.is-live .live-team .live-score { color: var(--text); }
.live-team.winner .live-abbr { color: var(--accent); }

.live-situation {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.live-situation.redzone { color: var(--danger); }

.rz-tag {
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: 4px;
}

.live-lastplay {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}

