:root {
  --navy: #11223a;
  --blue: #1f6feb;
  --accent: #0aa1dd;
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #d7deea;
  --good: #1a8f4c;
  --muted: #6b7790;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--navy);
}
header {
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
header h1 { font-size: 20px; margin: 0; letter-spacing: 0.5px; }
header a { color: #cfe0ff; text-decoration: none; font-size: 14px; }
nav.tabs { display: flex; gap: 8px; padding: 12px 20px 0; flex-wrap: wrap; }
nav.tabs button {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}
nav.tabs button.active { background: var(--blue); color: #fff; border-color: var(--blue); }
main { padding: 16px 20px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* League table */
/* The card scrolls horizontally so the table is usable on narrow phones instead of
   crushing the columns / cutting off "Total points". */
#view-league { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.league { width: 100%; border-collapse: collapse; max-width: 720px; }
table.league th, table.league td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.league th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.4px; }
table.league td.num, table.league th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.league tr:first-child td { font-weight: 700; }
.rank { color: var(--muted); width: 32px; }
.total { font-weight: 800; color: var(--blue); }

/* Bracket */
.bracket-controls { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
select, input[type=number], input[type=text], input[type=password] {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}
.bracket {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.round { display: flex; flex-direction: column; }
.round h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); text-align: center; margin: 0 0 8px; }
.round-games { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 10px; }
.game {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}
.game .label { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.team { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.team .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team.win .name { font-weight: 700; }
.team .score { font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }
.game .pts { margin-top: 6px; font-size: 11px; color: var(--good); font-weight: 700; }
.game .pts.zero { color: var(--muted); font-weight: 500; }
.game .pts.tbc { color: var(--muted); font-weight: 600; font-style: italic; }
.game.tp { border-style: dashed; }

/* Admin */
/* Generous bottom padding so the Predictions player dropdown (last on the page)
   has room to open without being clipped at the bottom of the viewport. */
.admin-grid { display: grid; gap: 16px; max-width: 900px; padding-bottom: 240px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
button.primary { background: var(--blue); color: #fff; border: none; padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; }
button.danger { background: #c0392b; color: #fff; border: none; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
button.ghost { background: var(--card); border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.player-pill { display: inline-flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }
.admin-game { display: grid; grid-template-columns: 90px 1fr auto 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.admin-game .slotid { font-size: 12px; color: var(--muted); }
.adv-row { font-size: 12px; }
@media (max-width: 600px) {
  .admin-game { grid-template-columns: 1fr 1fr; }
}
