:root {
  --green: #6fb92c;        /* logo green */
  --green-dark: #4e8c1c;   /* darker green for text on light */
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e0e4e8;
  --text: #1c2733;
  --muted: #667080;
  --navy: #03112C;         /* logo background navy */
  --navy-dark: #020b1c;
  --accent: #03112C;       /* primary dark = navy */
  --danger: #c62828;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); }

header.site {
  background: var(--navy);
  color: #fff;
  padding: 0.5rem 1rem;
  border-bottom: 3px solid var(--green);
  position: relative;      /* so the logo can overhang below it */
}
header.site .inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
header.site .brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-right: auto;
  /* Reserve only a modest width in the flow; the logo itself is larger and
     overhangs below the band without pushing the nav around. */
  align-self: stretch;
}
header.site .brand .logo {
  height: 120px;
  width: auto;
  display: block;
  margin: -0.5rem 0 -0.5rem;   /* sits within the band; no big overhang into the banner */
  border-radius: 12px;
  position: relative;
  z-index: 3;
}
header.site nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 1rem;
  opacity: 0.9;
}
header.site nav a:hover { opacity: 1; color: var(--green); }
header.site nav a.active { color: var(--green); font-weight: 700; }
header.site form.logout { display: inline; margin-left: 1rem; }
header.site form.logout button {
  background: transparent; border: 1px solid rgba(255,255,255,0.5);
  color: #fff; border-radius: 6px; padding: 0.25rem 0.6rem; cursor: pointer;
}
header.site form.logout button:hover { border-color: var(--green); color: var(--green); }

main {
  max-width: 900px;
  margin: 3.25rem auto 1.5rem;   /* extra top space so the overhanging logo clears the first card */
  padding: 0 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

h1 { font-size: 1.6rem; margin-top: 0; }
h2 { font-size: 1.25rem; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.pots { display: flex; gap: 1rem; flex-wrap: wrap; }
.pot {
  flex: 1 1 180px;
  background: linear-gradient(135deg, var(--navy), #1a2f5e);
  color: #fff;
  border-radius: 10px;
  padding: 1rem;
}
.pot .label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; }
.pot .value { font-size: 1.8rem; font-weight: 700; }
.pot.jackpot { background: linear-gradient(135deg, var(--green-dark), var(--green)); }

.badge {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.badge.open { background: #e6f4ea; color: var(--green-dark); }
.badge.locked { background: #fdecea; color: var(--danger); }
.badge.settled { background: #e6ebf5; color: var(--navy); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }

.game-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.game-row:last-child { border-bottom: none; }
.teams { font-weight: 600; }
.kickoff { color: var(--muted); font-size: 0.85rem; }

.picks { display: flex; gap: 0.4rem; }
.picks label {
  border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0.7rem;
  cursor: pointer; user-select: none; font-weight: 600; min-width: 2.5rem; text-align: center;
}
.picks input { position: absolute; opacity: 0; width: 0; height: 0; }
.picks input:checked + span { }
.picks label:has(input:checked) { background: var(--accent); color: #fff; border-color: var(--accent); }
.picks label.disabled { opacity: 0.6; cursor: not-allowed; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 0.6rem 1.1rem; font-size: 1rem; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--navy-dark); }
.btn.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"] {
  width: 100%; padding: 0.55rem 0.6rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1rem; background: #fff;
}
label.field { display: block; margin-bottom: 0.9rem; }
label.field span { display: block; font-weight: 600; margin-bottom: 0.25rem; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert.error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6cb; }
.alert.success { background: #e6f4ea; color: var(--green-dark); border: 1px solid #c3e6cb; }
.alert ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }

.result-pick { font-weight: 700; }
.result-H { color: var(--green-dark); }
.result-A { color: var(--navy); }
.result-D { color: var(--muted); }

.row-flex { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

.center { text-align: center; }
.auth-wrap { max-width: 420px; margin: 3rem auto; }

/* ===================== Predictions grid ===================== */
.grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; }
table.grid th, table.grid td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #1c2733;
}
table.grid td.rowhead { font-size: 0.95rem; }
table.grid thead th {
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
table.grid th.rowhead, table.grid td.rowhead {
  text-align: left;
  white-space: nowrap;
  font-weight: 600;
}
/* Sticky first column so match names stay visible when scrolling right
   (matters with lots of players). */
table.grid .sticky {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
  border-right: 2px solid var(--border);
}
table.grid thead th.sticky {
  background: var(--accent);
  z-index: 3;
}
/* Prediction cells: correct = bold red text, incorrect = faded grey. No fills. */
table.grid td.pick { font-size: 1rem; }
table.grid td.correct { color: #d40000; font-weight: 800; }
table.grid td.miss { color: #b7bec7; font-weight: 500; }

/* Result row: the actual outcomes, on a light band */
table.grid td.result { background: #f3eef6; font-weight: 800; color: var(--accent); }
table.grid .result-row td, table.grid .result-row th { background: #f3eef6; }
table.grid .result-row th.sticky { background: var(--accent); }

/* Narrow ✓ column and green Prize column */
table.grid th.total-col, table.grid td.total { width: 2.2rem; font-weight: 800; }
table.grid th.prize-col { color: var(--green-dark); }
table.grid th.prize-col, table.grid td.prize {
  width: 3.4rem; background: #eef6ee; font-weight: 800; color: var(--green-dark); white-space: nowrap;
}

/* Winner rows: soft green tint, player name in bold with the star */
table.grid tbody tr.winner-row td { background: #eef8e6; }
table.grid tbody tr.winner-row td.sticky { background: #e2f2d4; }
table.grid tbody tr.winner-row td.prize { background: #e2f2d4; }
table.grid tbody tr.winner-row td.rowhead { font-weight: 800; }
table.grid .wtag { color: var(--green-dark); }

table.grid tbody tr:hover td:not(.sticky) { background: #f4faf0; }
table.grid tbody tr.winner-row:hover td { background: #e7f4dc; }
.grid-nav a { margin-right: 0.5rem; }
.grid-nav a.current { font-weight: 700; text-decoration: underline; }

/* Match column headers: "ARS v CHE" stacked compactly and readable */
table.grid thead th .tla { display: block; line-height: 1.15; font-size: 0.78rem; font-weight: 700; }
table.grid thead th .vs { display: block; font-size: 0.62rem; opacity: 0.75; font-weight: 400; }

/* Status lozenges on the results header */
.lozenge {
  display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.lozenge.red { background: #d40000; color: #fff; }
.lozenge.amber { background: #ffb300; color: #3a2a00; }
.lozenge.green { background: var(--green); color: #fff; }

/* Prominent payout banner */
.payout-banner {
  margin: 0.6rem 0 0.9rem;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy), #1a2f5e);
  color: #fff;
  font-size: 1.05rem;
}
.payout-banner strong { font-size: 1.15rem; }

/* ===================== Buy credits ===================== */
.buy-options { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.buy-option { position: relative; flex: 1 1 130px; cursor: pointer; }
.buy-option input { position: absolute; opacity: 0; }
.buy-option .bo-body {
  display: block; border: 2px solid var(--border); border-radius: 10px; padding: 0.75rem;
  text-align: center; background: #fff;
}
.buy-option:has(input:checked) .bo-body { border-color: var(--green); background: #f4faf0; }
.bo-credits { display: block; font-weight: 700; }
.bo-total { display: block; font-size: 1.5rem; font-weight: 800; color: var(--navy); margin: 0.2rem 0; }
.bo-note { display: block; font-size: 0.75rem; color: var(--muted); }

/* ===================== Testing banner ===================== */
.testing-banner {
  background: #ffb300;
  color: #3a2a00;
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  border-bottom: 2px solid #c98a00;
}
.testing-banner strong { text-transform: uppercase; letter-spacing: 0.02em; }

/* ===================== How to play ===================== */
ol.how-to { margin: 0.25rem 0 0.75rem; padding-left: 1.3rem; }
ol.how-to li { margin: 0.4rem 0; line-height: 1.5; }
