:root {
  --brand-red: #ED1C24;
  --brand-red-dark: #B3141B;
  --charcoal: #2E2E2E;
  --gray: #58595B;
  --gold: #FFC72C;
  --bg: #F7F7F8;
  --card-bg: #FFFFFF;
  --border: #E4E4E4;
  --muted: #8A8A8A;
  --success: #1E7A3D;
  --error: #C4151C;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--charcoal);
}

.site-header {
  background: #FFFFFF;
  color: var(--charcoal);
  padding: 14px 24px;
  border-bottom: 4px solid var(--brand-red);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.logo { display: block; }
.header-title { flex: 1; min-width: 200px; }
.header-title h1 { margin: 0; font-size: 1.4rem; color: var(--charcoal); }
.site-nav { display: flex; gap: 12px; }
.site-nav a {
  color: var(--charcoal);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  white-space: nowrap;
}
.site-nav a.active, .site-nav a:hover { background: var(--brand-red); color: #fff; border-color: var(--brand-red); }

.site-main { max-width: 1100px; margin: 0 auto; padding: 24px; }

h2 { color: var(--charcoal); margin-bottom: 4px; }
.section-sub { color: var(--muted); margin-top: 0; margin-bottom: 18px; font-size: 0.92rem; }

.teams-section { margin-bottom: 40px; }
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.team-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  position: relative;
  transition: box-shadow 0.15s, transform 0.15s;
}
.team-card.is-picked { box-shadow: 0 0 0 2px var(--gold); }
.badge-row {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 18px;
}
.pick-badge {
  font-size: 0.65rem;
  background: var(--brand-red);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
}
.flag {
  width: 52px;
  height: 39px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin-top: 14px;
}
.jersey-icon { width: 64px; height: 64px; margin-top: 4px; }
.team-name { font-weight: 600; font-size: 0.82rem; margin-top: 6px; line-height: 1.2; color: var(--charcoal); }
.team-star { font-size: 0.72rem; color: var(--gray); margin-top: 2px; line-height: 1.2; }
.team-group { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

.predict-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}
.position-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.position-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; color: var(--charcoal); }
.position-select, .field input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--charcoal);
}
.position-select.duplicate-error, .field input.invalid { border-color: var(--error); }

.contestant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  border-top: 1px dashed var(--border);
  padding-top: 18px;
}
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; color: var(--charcoal); }

.submit-btn {
  display: inline-block;
  background: var(--brand-red);
  color: #fff;
  border: none;
  padding: 12px 26px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.submit-btn:hover { background: var(--brand-red-dark); }
.submit-btn:disabled { background: #C9C9C9; cursor: not-allowed; }

.secondary-link { margin-left: 14px; color: var(--gray); font-size: 0.9rem; }

.flash-list { margin-bottom: 18px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 0.9rem; }
.flash-error { background: #FBE9E7; color: var(--error); border: 1px solid #F3B4AE; }
.flash-success { background: #E7F5EC; color: var(--success); border: 1px solid #B7DFC4; }

.table-wrap { overflow-x: auto; background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border); }
.predictions-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.predictions-table th, .predictions-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.predictions-table thead th { background: var(--brand-red); color: #fff; position: sticky; top: 0; }
.predictions-table tbody tr:nth-child(even) { background: #FAFAFA; }
.predictions-table tbody tr.winner-row { background: #FFF7E0 !important; box-shadow: inset 3px 0 0 var(--gold); }
.winner-badge {
  display: inline-block;
  margin-left: 6px;
  background: var(--gold);
  color: var(--charcoal);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.empty-state { color: var(--muted); }

.thanks-section { text-align: center; padding: 40px 0; }
.thanks-section h2 { color: var(--brand-red); }

.site-footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 20px; }
.footer-site-link { color: var(--muted); font-weight: 700; text-decoration: none; }
.footer-site-link:hover { color: var(--brand-red); text-decoration: underline; }
.footer-socials {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.social-icon:hover {
  color: var(--brand-red);
  border-color: var(--brand-red);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .site-nav { width: 100%; }
}

/* --- Hero caption --- */
.hero-caption {
  text-align: center;
  background: linear-gradient(90deg, var(--brand-red), var(--brand-red-dark));
  color: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 28px;
}
.hero-caption h2 {
  color: var(--gold);
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.5px;
}

.winner-prize-banner { text-align: center; margin-bottom: 24px; }
.winner-prize-banner img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

/* --- Wizard steps --- */
.wizard-step { margin-bottom: 40px; }

.team-tile {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
}
.team-tile:hover { border-color: var(--gold); transform: translateY(-2px); }
.team-tile.selected { border-color: var(--brand-red); box-shadow: 0 0 0 2px var(--brand-red); background: #FDECEC; }
.team-tile .tile-check {
  display: none;
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-red);
  color: #fff;
  font-size: 0.75rem;
  line-height: 20px;
}
.team-tile.selected .tile-check { display: block; }
.team-tile .flag { margin-top: 4px; }
.team-tile .team-name { color: var(--charcoal); }
.team-tile .team-group { color: var(--muted); }

.step1-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}
#selection-counter { font-weight: 600; color: var(--brand-red); }

.assign-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.assign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #FAFAFA;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  flex-wrap: wrap;
}
.assign-team-info { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--charcoal); }
.flag-sm { width: 32px; height: 24px; object-fit: cover; border-radius: 3px; border: 1px solid var(--border); }
.assign-position-select { max-width: 220px; }

.step2-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.secondary-btn {
  background: #fff;
  color: var(--brand-red);
  border: 1px solid var(--brand-red);
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.secondary-btn:hover { background: #FDECEC; }

/* --- Prize section (two-color design: brand red + charcoal) --- */
.prize-section { margin-bottom: 36px; }
.prize-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.prize-card {
  border-radius: 12px;
  padding: 28px 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.15s, box-shadow 0.15s;
}
.prize-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
.prize-medal { font-size: 2.6rem; line-height: 1; margin-bottom: 10px; }
.prize-label {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}
.prize-amount { line-height: 1; }
.prize-amount .amt-symbol { font-size: 1.3rem; font-weight: 700; vertical-align: top; margin-right: 2px; }
.prize-amount .amt-value { font-size: 2.1rem; font-weight: 800; }

/* Color 1: solid brand red card for the top prize */
.prize-card-solid {
  background: var(--brand-red);
  border: 1px solid var(--brand-red-dark);
}
.prize-card-solid .prize-label { color: #FFE7E8; }
.prize-card-solid .prize-amount .amt-symbol { color: #FFE7E8; }
.prize-card-solid .prize-amount .amt-value { color: #ffffff; }

/* Color 2: white/charcoal card for the other prizes */
.prize-card-outline {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: 6px solid var(--charcoal);
}
.prize-card-outline .prize-label { color: var(--charcoal); }
.prize-card-outline .prize-amount .amt-symbol { color: var(--charcoal); }
.prize-card-outline .prize-amount .amt-value { color: var(--brand-red); }

.deadline-banner {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.deadline-row { display: flex; align-items: center; gap: 14px; }
.deadline-icon { font-size: 1.8rem; }
.deadline-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.deadline-value { font-size: 1.1rem; font-weight: 700; color: var(--charcoal); }
.deadline-countdown {
  background: #FDECEC;
  color: var(--brand-red-dark);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

/* --- Single winner-only prize card --- */
.prize-grid-single {
  display: flex;
  justify-content: center;
}
.prize-grid-single .prize-card {
  width: 100%;
  max-width: 320px;
  padding: 36px 24px;
}
.prize-grid-single .prize-medal { font-size: 3.2rem; }
.prize-grid-single .prize-amount .amt-value { font-size: 2.6rem; }
.prize-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 14px 0 20px;
}

/* --- Points legend + scoring --- */
.points-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.points-legend-title { font-weight: 700; color: var(--charcoal); font-size: 0.85rem; margin-right: 2px; }
.points-chip {
  background: #FDECEC;
  color: var(--brand-red-dark);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 14px;
  white-space: nowrap;
}
.score-correct { background: #E7F5EC !important; color: var(--success); font-weight: 600; }
.score-total { font-weight: 800; color: var(--brand-red); text-align: center; }
.points-note {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 6px 0 18px;
}

/* --- Non-cash prize amount (e.g. "2 Coolers") --- */
.prize-amount { font-size: 2rem; font-weight: 800; line-height: 1.25; }
.prize-card-solid .prize-amount { color: #ffffff; }
.prize-card-outline .prize-amount { color: var(--brand-red); }
.prize-grid-single .prize-amount { font-size: 2.1rem; }

/* --- Rules button --- */
.rules-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--charcoal);
  background: #fff;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.rules-btn:hover { background: var(--brand-red); color: #fff; border-color: var(--brand-red); }
.rules-btn-icon { font-size: 1rem; }

/* --- Rules modal --- */
body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--card-bg);
  color: var(--charcoal);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalPop 0.18s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card-bg);
  border-radius: 16px 16px 0 0;
}
.modal-header h3 { margin: 0; font-size: 1.15rem; color: var(--brand-red); }
.modal-close {
  background: none;
  border: none;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}
.modal-close:hover { color: var(--brand-red); }

.modal-body { padding: 20px 22px; }

.rule-item {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}
.rule-item:last-child { margin-bottom: 0; }
.rule-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-red);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rule-content h4 { margin: 0 0 6px; font-size: 1rem; color: var(--charcoal); }
.rule-content p { margin: 0 0 8px; font-size: 0.9rem; color: var(--gray); line-height: 1.55; }
.rule-content p:last-child { margin-bottom: 0; }

.rule-points {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rule-points li {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--charcoal);
  background: #FDECEC;
  padding: 7px 12px;
  border-radius: 8px;
}

.modal-footer {
  padding: 14px 22px 20px;
  text-align: right;
  border-top: 1px solid var(--border);
}
.modal-footer .submit-btn { padding: 10px 24px; font-size: 0.92rem; }

@media (max-width: 480px) {
  .modal-box { max-height: 90vh; border-radius: 12px; }
  .modal-header { padding: 14px 16px; border-radius: 12px 12px 0 0; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px 16px; }
  .rule-item { gap: 10px; margin-bottom: 18px; }
}

/* --- Dark theme support (follows the visitor's OS/browser preference) --- */
@media (prefers-color-scheme: dark) {
  .modal-overlay { background: rgba(0, 0, 0, 0.72); }
  .modal-box { background: #1E1F22; color: #EDEDED; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
  .modal-header { background: #1E1F22; border-bottom-color: #33343A; }
  .modal-header h3 { color: #FF6B6B; }
  .modal-close { color: #9A9A9A; }
  .modal-close:hover { color: #FF6B6B; }
  .rule-content h4 { color: #F2F2F2; }
  .rule-content p { color: #B8B9BD; }
  .rule-points li { background: #3A2323; color: #F2F2F2; }
  .modal-footer { border-top-color: #33343A; }
  .rules-btn { background: #1E1F22; color: #EDEDED; border-color: #33343A; }
  .rules-btn:hover { background: var(--brand-red); color: #fff; border-color: var(--brand-red); }
}
