:root {
  --bg: #2d2d2d;
  --text: #FDB515;
  --navy: #001a57;
  --blue: #002676;
  --card: #1a1a1a;
  --border: #444;
  --error: #ff4d4d;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 1080px;
  margin: 0 auto;
}

.page-content { padding: 0px; }

h1 { margin-bottom: 16px; color: var(--text); }
h2 { color: var(--text); }


a { color: inherit; }

.muted { opacity: 0.7; font-weight: 500; }
.error { color: var(--error); }

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text);
  opacity: 0.8;
  margin-bottom: 6px;
}

.selector-wrapper label {
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  opacity: 0.6;
  margin-bottom: 8px;
}

select,
input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: #1a1a1a;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.form-page select,
.form-page input[type="number"] {
  margin-bottom: 16px;
}

.selector-wrapper { margin-bottom: 28px; }
.selector-wrapper select {
  padding: 12px 40px 12px 16px;
  border-radius: 10px;
  background-position: right 14px center;
  transition: border-color 0.2s;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23FDB515' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--text);
}

select:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Navbar (shared) ─────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--navy);
  border-bottom: 3px solid var(--text);
  padding: 0 16px;
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 100;
  margin-bottom: 20px;
}

.navbar a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 14px 20px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

 .navbar a:hover { background: rgba(253, 181, 21, 0.12); }
 .navbar a.active { background: var(--text); color: var(--navy); }
.navbar a svg { width: 15px; height: 15px; flex-shrink: 0; }

@media (max-width: 480px) {
  .navbar a {
    padding: 12px 8px;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
    overflow: hidden; text-overflow: ellipsis;
  }
  .navbar a svg {
    display: none;
  }
}

/* ── Week selectors (home) ───────────────────────────────────────────────── */
#week-selectors {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}

.week-select-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Leaderboard table (home) ────────────────────────────────────────────── */
.home-page table {
  width: 75%;
  min-height: 400px;
  margin-inline: auto;
  border-collapse: collapse;
  border-radius: 14px;
  overflow: hidden;
  transform: scale(0.8);
  transform-origin: top center;
  margin-bottom: -20%;
}

@media (max-width: 600px) {
  .home-page table {
    width: 100%;
    transform: none;
    margin-bottom: 16px;
  }
}

.home-page thead th {
  text-align: left;
  max-height: 14px;
  padding: 14px;
  background: #111;
  color: #fff;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.home-page tbody tr { transition: filter 0.15s ease; }
.home-page tbody tr:hover { filter: brightness(1.08); }

.home-page tbody tr.champ-row td {
  box-shadow: inset 0 3px 0 #FFD700, inset 0 -3px 0 #FFD700;
}
.home-page tbody tr.champ-row td:first-child {
  box-shadow: inset 3px 0 0 #FFD700, inset 0 3px 0 #FFD700, inset 0 -3px 0 #FFD700;
}
.home-page tbody tr.champ-row td:last-child {
  box-shadow: inset -3px 0 0 #FFD700, inset 0 3px 0 #FFD700, inset 0 -3px 0 #FFD700;
}
.champ-crown {
  display: inline-block;
  margin-left: 6px;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.4));
}

.home-page tbody td {
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 600;
}

.team-link { color: inherit; text-decoration: none; }
.team-link:hover { text-decoration: underline; opacity: 0.85; }

.team-full { display: inline; }
.team-abbr { display: none; }

table.use-abbr .team-full { display: none; }
table.use-abbr .team-abbr { display: inline; }

.home-page tbody td:nth-child(2) {
  max-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank { width: 80px; text-align: right; opacity: 0.85; }
.record-col { width: 52px; text-align: center; font-size: 1rem; font-weight: 700; opacity: 0.9; }
.record-loading { opacity: 0.4; font-size: 0.85rem; font-weight: 500; }
.rank-change-col { width: 64px; text-align: center; font-size: 0.9rem; font-weight: 700; white-space: nowrap; }
.rank-up { color: #4caf50; }
.rank-down { color: #f44336; }
.rank-same, .rank-new { color: inherit; }

#games-list {
  display: flex;
  flex-flow: row wrap;
  gap: 12px;
}

/* ── Game cards (home) ───────────────────────────────────────────────────── */
.game-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 30%;
  max-width: 140px;
  flex: 1;
}

.game-teams {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.game-team {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: filter 0.15s ease;
}

.game-team:hover { filter: brightness(1.08); }

.game-score {
  font-size: 32px;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.game-team.winner { box-shadow: 0 0 0 4px var(--text); }

/* ── Force Win badge (game cards) ───────────────────────────────────────── */
.force-win-badge {
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.85;
}

/* ── Force Win field (enter-game form) ──────────────────────────────────── */
.force-win-group {
  margin-top: 4px;
  margin-bottom: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.force-win-hint {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.5;
  margin-left: 4px;
}

/* ── Force Win notice (confirmation modal) ──────────────────────────────── */
.confirm-force-win {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(253, 181, 21, 0.1);
  border: 1px solid rgba(253, 181, 21, 0.3);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: 0.3px;
}

/* ── Form page (enter-game) ─────────────────────────────────────────────── */
.week-badge {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
  opacity: 0.5;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.field-group { margin-bottom: 4px; }

.team-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
  align-items: end;
}

.divider {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 3px;
  opacity: 0.35;
  margin: 2px 0 14px;
}

button[type="submit"] {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  background: var(--blue);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s ease;
}

button[type="submit"]:hover { opacity: 0.85; }

/* ── Modal (enter-game) ─────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--card);
  border: 2px solid var(--text);
  border-radius: 16px;
  padding: 28px 24px 22px;
  width: 100%;
  max-width: 380px;
  margin: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  animation: pop-in 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text);
  opacity: 0.5;
  margin: 0 0 18px;
}

.confirm-week {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.45;
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.confirm-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
}

.confirm-team-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}

.confirm-score {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

.confirm-vs {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 3px;
  opacity: 0.3;
  padding: 5px 0;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.btn-cancel {
  padding: 12px;
  border-radius: 8px;
  border: 2px solid #444;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s;
}

.btn-cancel:hover { border-color: var(--text); }

.btn-confirm {
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: var(--blue);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-confirm:hover { opacity: 0.85; }
.btn-confirm:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Home button (shared) ───────────────────────────────────────────────── */
.home-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--blue);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  z-index: 1000;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .home-btn { left: 20px; right: auto; }
  .team-row { grid-template-columns: 1fr; }
}

/* ── Team history page ──────────────────────────────────────────────────── */
#team-card {
  display: none;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 2px solid #333;
}

#team-card.visible { display: flex; }

#team-card-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
}

#team-card-name {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.5px;
}

#stats-bar {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

#stats-bar.visible { display: grid; }

.stat-card {
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  background: var(--card);
  border: 2px solid #333;
  transition: border-color 0.2s;
}

.stat-card .stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.5;
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.stat-card.highlight { border-color: var(--text); }

#games-section { display: none; }
#games-section.visible { display: block; }

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.5;
  margin-bottom: 12px;
}

.game-entry {
  display: flex;
  margin-inline: auto;
  align-items: center;
  width: 75%;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--card);
  border: 4px solid transparent;
  transition: border-color 0.15s, filter 0.15s;
}

.game-entry:hover { filter: brightness(1.1); }
.game-entry.win  { border-color: var(--text); }
.game-entry.loss { border-color: #6b2e2e; }

.result-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.result-badge.win  { background: #1e4d20; color: #4caf50; }
.result-badge.loss { background: #4d1e1e; color: #f44336; }

.game-teams { flex: 1; min-width: 0; }

.game-opponent {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-meta {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.45;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.game-logo.loss { filter: grayscale(100%); -webkit-filter: grayscale(100%); }

.game-score-display {
  font-size: 1.25rem;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 1px;
}

.game-score-display .team-score { color: var(--text); }
.game-score-display .sep        { opacity: 0.3; margin: 0 4px; }

.state-msg {
  text-align: center;
  padding: 40px 20px;
  opacity: 0.4;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@media (max-width: 600px) {
  #stats-bar.visible { grid-template-columns: repeat(2, 1fr); }
  .game-score-display { font-size: 1rem; }
}

/* ── Hall of Fame page ─────────────────────────────────────────────────---- */
.hof-page .page-header {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.hof-table-wrapper {
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #3a3a3a;
}

.hof-page table {
  width: 100%;
  border-collapse: collapse;
}

.hof-page thead th {
  background: #111;
  color: var(--text);
  padding: 14px 18px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.hof-page thead th.col-name { width: 25%; }
.hof-page thead th.col-team { width: 5%; text-align: center; }
.hof-page thead th.col-accolades { width: 70%; }

.hof-page tbody tr {
  border-bottom: 1px solid #3a3a3a;
  transition: filter 0.15s ease;
}

.hof-page tbody tr:last-child { border-bottom: none; }
.hof-page tbody tr:hover { filter: brightness(1.08); }

.hof-page tbody td {
  padding: 4px;
  vertical-align: middle;
}

.td-name { font-size: 1rem; font-weight: 800; }
.hof-page td.td-team { text-align: center; }
.td-team { white-space: nowrap; }

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.team-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}

.td-accolades {
  font-size: 0.85rem;
  font-weight: bold;
  line-height: 1.5;
  opacity: 0.85;
  display: flex;
  align-items: center;
  align-self: center;
  vertical-align: middle;
}

.state-row td {
  text-align: center;
  padding: 48px;
  opacity: 0.4;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@media (max-width: 600px) {
  .hof-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hof-page table {
    min-width: 500px;
  }

  /* Remove the column-hiding rules */
  .hof-page thead th.col-name,
  .hof-page thead th.col-team,
  .hof-page td.td-name,
  .hof-page td.td-team {
    display: table-cell;
  }

  .td-accolades::before {
    display: none;
  }
}