:root {
  --royal: #003594;
  --royal-dark: #00287A;
  --royal-deep: #001B52;
  --gold: #FFD100;
  --white: #FFFFFF;
  --muted: #B9C6E4;
  --line: rgba(255, 255, 255, 0.14);
  --win: #3DDC84;
  --loss: #FF6B6B;
  --live: #FF4D4D;
  --head: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--royal);
  background-image: linear-gradient(180deg, var(--royal) 0%, #002a7a 100%);
  background-attachment: fixed;
  color: var(--white);
  font-family: var(--body);
  font-size: 16px;
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--gold); }
button, input, select { font: inherit; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--royal-deep);
  border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-gb {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  background: var(--gold); color: var(--royal); font-weight: 900; font-family: var(--head); font-size: 17px;
}
.brand-name { font-family: var(--head); font-weight: 700; letter-spacing: 2px; font-size: 19px; }
.brand-name b { color: var(--gold); }
.topbar-right { font-size: 13px; color: var(--muted); text-align: right; }

/* Tabs: bottom bar on phones, top row on computers */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: var(--royal-deep); border-top: 2px solid var(--gold);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; text-align: center; padding: 14px 4px; color: var(--muted); text-decoration: none;
  font-family: var(--head); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; font-size: 12px; white-space: nowrap;
}
.tabs a.active { color: var(--gold); box-shadow: inset 0 3px 0 var(--gold); }
@media (min-width: 760px) {
  body { padding-bottom: 32px; }
  .tabs { position: sticky; top: 57px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); justify-content: center; }
  .tabs a { flex: 0 0 auto; padding: 14px 22px; font-size: 14px; }
  .tabs a.active { box-shadow: inset 0 -3px 0 var(--gold); }
}

main { max-width: 760px; margin: 0 auto; padding: 16px; }
.loading, .empty { text-align: center; color: var(--muted); padding: 48px 16px; }
h1, h2, h3 { font-family: var(--head); text-transform: uppercase; letter-spacing: 1px; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
.gold { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Scoreboard header for a week */
.board-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 4px 0 14px;
}
.board-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; background: rgba(255, 255, 255, 0.12); color: var(--white);
}
.pill.gold { background: var(--gold); color: var(--royal-deep); }
.pill.live { background: var(--live); color: #fff; }
.pill.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; margin-right: 6px; animation: blink 1.2s infinite; vertical-align: 1px; }
@keyframes blink { 50% { opacity: 0.2; } }

/* Cards */
.card {
  background: var(--royal-dark); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.panel { background: var(--royal-dark); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }

/* Game card */
.game-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.teams { display: grid; gap: 8px; }
.team-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 10px; border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06); color: var(--white); cursor: pointer;
}
.team-btn:disabled { cursor: default; }
.team-btn.picked { border-color: var(--gold); background: rgba(255, 209, 0, 0.14); }
.team-btn .tname { flex: 1; font-weight: 600; }
.team-btn .score { font-family: var(--head); font-size: 22px; font-weight: 700; min-width: 32px; text-align: right; }
.team-btn.won .score { color: var(--gold); }
.team-btn .check { color: var(--gold); font-weight: 900; }
.badge {
  display: inline-grid; place-items: center; min-width: 46px; height: 30px; padding: 0 6px; border-radius: 6px;
  font-family: var(--head); font-weight: 800; font-size: 14px; letter-spacing: 1px; border: 2px solid;
}
.game-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.points-select {
  appearance: none; -webkit-appearance: none; background: var(--gold); color: var(--royal-deep);
  border: 0; border-radius: 8px; padding: 9px 34px 9px 12px; font-weight: 800; font-size: 16px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--royal-deep) 50%), linear-gradient(135deg, var(--royal-deep) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.points-select.empty { background-color: rgba(255, 255, 255, 0.9); }
.pts { font-family: var(--head); font-weight: 800; font-size: 18px; }
.result-win { color: var(--win); font-weight: 700; }
.result-loss { color: var(--loss); font-weight: 700; }

/* Forms */
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number] {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95); color: #0b1530; font-size: 16px;
}
.btn {
  display: inline-block; width: 100%; padding: 14px 18px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--gold); color: var(--royal-deep); font-family: var(--head); font-weight: 800;
  font-size: 18px; text-transform: uppercase; letter-spacing: 1px; margin-top: 16px;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary { background: transparent; color: var(--white); border: 2px solid var(--line); }
.btn.danger { background: var(--loss); color: #fff; }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; margin: 0; }
.msg { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.msg.error { background: rgba(255, 107, 107, 0.18); color: #ffd1d1; }
.msg.ok { background: rgba(61, 220, 132, 0.16); color: #c9f7dc; }
.switch { text-align: center; margin-top: 14px; color: var(--muted); font-size: 14px; }
.switch button { background: none; border: 0; color: var(--gold); cursor: pointer; font-weight: 700; text-decoration: underline; }

/* Login */
.hero { text-align: center; padding: 22px 0 22px; }
.hero .big { font-family: var(--head); font-size: 44px; font-weight: 900; letter-spacing: 3px; line-height: 1; }
.hero .big b { color: var(--gold); }
.hero p { color: var(--muted); margin: 10px 0 0; }
.login-wrap { max-width: 420px; margin: 0 auto; }

/* Sticky submit bar on the picks page */
.submit-bar {
  position: sticky; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 10;
  background: var(--royal-deep); border: 1px solid var(--gold); border-radius: 14px; padding: 12px 14px; margin-top: 8px;
}
@media (min-width: 760px) { .submit-bar { bottom: 12px; } }
.submit-bar .btn { margin-top: 10px; }
.progress { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }

/* Standings table */
.seg { display: flex; background: var(--royal-deep); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 9px; cursor: pointer;
  font-family: var(--head); font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
}
.seg button.on { background: var(--gold); color: var(--royal-deep); }
.week-select {
  background: var(--royal-deep); color: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-weight: 700;
}
.lb { width: 100%; border-collapse: collapse; }
.lb th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; padding: 8px 10px; font-weight: 600; }
.lb td { padding: 12px 10px; border-top: 1px solid var(--line); }
.lb .rank { font-family: var(--head); font-weight: 800; font-size: 18px; width: 42px; color: var(--muted); }
.lb tr.first .rank { color: var(--gold); }
.lb tr.me td { background: rgba(255, 209, 0, 0.08); }
.lb .num { text-align: right; font-family: var(--head); font-weight: 800; font-size: 20px; }
.lb .sm { text-align: right; color: var(--muted); font-size: 13px; }
.lb .nm { font-weight: 600; }
.lb .nm button { background: none; border: 0; color: var(--white); font-weight: 700; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.lb tr.cut td { border-top: 2px dashed var(--gold); }
.tag { font-size: 11px; color: var(--royal-deep); background: var(--gold); border-radius: 4px; padding: 1px 5px; margin-left: 6px; font-weight: 800; }

/* My picks list */
.pick-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.pick-row:first-child { border-top: 0; }
.pick-row .pts-box {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--gold); color: var(--royal-deep); font-family: var(--head); font-weight: 900; font-size: 18px;
}
.pick-row .info { flex: 1; min-width: 0; }
.pick-row .info .vs { font-size: 13px; color: var(--muted); }

/* Commissioner */
.player { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.player:first-child { border-top: 0; }
.player .who { min-width: 0; }
.player .who div { overflow: hidden; text-overflow: ellipsis; }
.player .actions { display: flex; gap: 8px; flex: none; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 10, 40, 0.7); display: grid; place-items: end center; }
.modal[hidden] { display: none; }
.modal-card {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  background: var(--royal-dark); border-top: 3px solid var(--gold); border-radius: 18px 18px 0 0; padding: 20px 16px 28px;
}
@media (min-width: 760px) { .modal { place-items: center; } .modal-card { border-radius: 18px; border: 2px solid var(--gold); } }
.modal-close { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--white); font-size: 30px; cursor: pointer; }

.updated { text-align: center; color: var(--muted); font-size: 12px; margin-top: 10px; }
