/* Pick'em League
   Built around the league shield: brushed steel on near-black.
   Rule of the palette — metal is the brand, color is data. Odds carry the
   sportsbook convention (dog/Over green, favorite/Under red) in a softer tone;
   graded results use louder tones so a settled pick outranks a live number.
   Mobile-first, tuned for iPhone Safari: safe-area insets, 44px tap targets. */

:root {
  /* ground */
  --void:    #11171E;   /* page — sampled from the logo's own backdrop, so the
                           shield sits on it with no visible seam */
  --slate:   #182029;   /* card */
  --steel:   #2A3441;   /* borders, rails, inactive */
  --steel-2: #37424F;   /* pressed / hover */

  /* ink */
  --chalk:   #C7CEDA;   /* primary text — field-chalk white, slightly cool */
  --bright:  #EEF2F7;   /* emphasis */
  --gridiron:#6B7A8D;   /* secondary text — lifted for legibility at 10px caps */

  /* graded results — the loudest color on the page */
  --cover: #3DDC97;
  --miss:  #FF5252;
  --push:  #F5B301;

  /* live odds — same hues, stepped back so results still win the eye */
  --odds-up:   #52C68C;   /* underdog (+) and Over */
  --odds-down: #E4706F;   /* favorite (−) and Under */

  --font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
  --font-num: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  --tap: 44px;
  --chamfer: 9px;
}

/* Angular geometry lifted from the shield's cut corners. No rounded pills. */
.cut {
  clip-path: polygon(
    var(--chamfer) 0, 100% 0, 100% calc(100% - var(--chamfer)),
    calc(100% - var(--chamfer)) 100%, 0 100%, 0 var(--chamfer)
  );
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--void);
  color: var(--chalk);
  font: 16px/1.45 var(--font-ui);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: var(--chalk); }

/* ------------------------------------------------------------------ header */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--void);
  border-bottom: 1px solid var(--steel);
  padding: calc(9px + env(safe-area-inset-top)) 14px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lockup { display: flex; align-items: center; gap: 9px; min-width: 0; }
.lockup img { width: 30px; height: 30px; flex: none; }

.wordmark {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  /* Chrome appears here and on a selected pick. Nowhere else. */
  background: linear-gradient(170deg, #F2F5F8 0%, #9BA6B4 52%, #D8DEE6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.meta { text-align: right; font-size: 11px; line-height: 1.35; }
.meta .wk {
  font-family: var(--font-num);
  font-size: 13px;
  color: var(--bright);
  letter-spacing: 0.04em;
}
.meta a, .meta .who { color: var(--gridiron); text-decoration: none; }

main { padding: 14px; max-width: 720px; margin: 0 auto; }

/* ------------------------------------------------------- pick counters */

/* Slanted segments read as yard markers — and show remaining picks at a glance,
   which is the one number a player actually needs before kickoff. */
.counters {
  display: flex;
  gap: 10px;
  position: sticky;
  top: 54px;
  z-index: 5;
  background: var(--void);
  padding: 10px 0 12px;
}

.ctr {
  flex: 1;
  background: var(--slate);
  border: 1px solid var(--steel);
  padding: 9px 11px;
}

.ctr-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}

.ctr-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gridiron);
}

.ctr-count { font-family: var(--font-num); font-size: 13px; color: var(--bright); }
.ctr-count.done { color: var(--cover); }

.seg { display: flex; gap: 3px; }
.seg i {
  flex: 1;
  height: 4px;
  background: var(--steel);
  transform: skewX(-22deg);
  transition: background 0.14s;
}
.seg i.on { background: var(--chalk); }
.seg.done i.on { background: var(--cover); }

/* ------------------------------------------------------------- game card */

.game {
  background: var(--slate);
  border: 1px solid var(--steel);
  margin-bottom: 9px;
}

.game.locked { opacity: 0.42; }

.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--steel);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--gridiron);
}

.game-head .kick { font-family: var(--font-num); letter-spacing: 0.02em; }

.matchup {
  padding: 11px 12px 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--bright);
}
.matchup .at { color: var(--gridiron); font-weight: 500; }

/* A bet has two sides. The lacing spine from the shield sits between them. */
.bet {
  display: grid;
  grid-template-columns: 1fr 16px 1fr;
  align-items: stretch;
  gap: 0;
  padding: 6px 12px;
}
.bet:last-child { padding-bottom: 12px; }

.spine { position: relative; }
.spine::before {
  content: '';
  position: absolute;
  left: 50%; top: 10px; bottom: 10px;
  width: 1px;
  background: var(--steel-2);
  transform: translateX(-50%);
}
/* the laces */
.spine::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 11px; height: 1px;
  background: var(--steel-2);
  transform: translate(-50%, -50%);
  box-shadow: 0 -16px var(--steel-2), 0 -8px var(--steel-2),
              0 8px var(--steel-2), 0 16px var(--steel-2);
}

/* Chamfered outline.
   clip-path cuts the border off along the diagonal, which leaves the corner
   unoutlined — barely visible on a dim border, glaring once a pick is selected
   and the edge goes chrome. So the edge is painted as the element's own
   background and the fill is inset 1px on top of it. */
button.opt {
  position: relative;
  min-height: var(--tap);
  width: 100%;
  border: 0;
  background: var(--steel);
  color: var(--chalk);
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: background 0.12s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

button.opt::before {
  content: '';
  position: absolute;
  inset: 1px;
  background: var(--slate);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  transition: background 0.12s;
}

button.opt > * { position: relative; z-index: 1; }

.opt-team {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gridiron);
  line-height: 1.25;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.opt-num {
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--chalk);
  font-variant-numeric: tabular-nums;
}

button.opt:active { transform: scale(0.975); }
button.opt:active::before { background: var(--steel-2); }

/* Selected: brushed-steel edge, unbroken around the chamfer. */
button.opt.selected { background: linear-gradient(160deg, #D8DEE6, #8E9AA9); }
button.opt.selected::before {
  background: linear-gradient(165deg, #202A36, #182029);
}
button.opt.selected .opt-team { color: var(--chalk); }

/* Odds keep their own color when selected — the chrome edge marks the pick. */
.opt-num.up   { color: var(--odds-up); }
.opt-num.down { color: var(--odds-down); }

button.opt:disabled { opacity: 0.4; cursor: not-allowed; }
button.opt:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; }

/* ---------------------------------------------------------------- surfaces */

.card {
  background: var(--slate);
  border: 1px solid var(--steel);
  padding: 14px;
  margin-bottom: 10px;
}

h2.sec {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gridiron);
}

label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gridiron);
  margin-bottom: 5px;
}

input, select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--steel);
  background: var(--void);
  color: var(--chalk);
  font-size: 16px; /* 16px keeps iOS Safari from zooming on focus */
  font-family: var(--font-ui);
  margin-bottom: 12px;
}
input:focus, select:focus { outline: none; border-color: var(--gridiron); }

.btn {
  min-height: var(--tap);
  width: 100%;
  border: 0;
  background: var(--chalk);
  color: var(--void);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.08s;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}
.btn:active { transform: scale(0.99); }
/* Solid fill rather than an outline: a chamfered element whose border differs
   from its background loses the border along the diagonal. */
.btn.secondary { background: var(--steel-2); border-color: var(--steel-2); color: var(--chalk); }
.btn:disabled { opacity: 0.45; }
.btn:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid var(--steel);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--gridiron);
  white-space: nowrap;
}

td {
  padding: 9px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(42, 52, 65, 0.6);
  white-space: nowrap;
}

/* Every number on the site is tabular mono — scoreboard, not prose. */
td.num, th.num { text-align: right; }
td.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

tr.me td { background: rgba(199, 206, 218, 0.05); color: var(--bright); }
td.rank { font-family: var(--font-num); color: var(--gridiron); }

.r-W { color: var(--cover); font-weight: 700; }
.r-L { color: var(--miss); font-weight: 700; }
.r-T { color: var(--push); font-weight: 700; }

/* --------------------------------------------------------------------- nav */

nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--slate);
  border-top: 1px solid var(--steel);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}

nav button {
  flex: 1;
  min-height: 58px;
  background: none;
  border: none;
  border-top: 2px solid transparent;
  color: var(--gridiron);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  -webkit-tap-highlight-color: transparent;
}

nav button .ico { font-size: 17px; line-height: 1; filter: grayscale(1); opacity: 0.5; }
nav button.active { color: var(--bright); border-top-color: var(--chalk); }
nav button.active .ico { opacity: 1; }

/* ------------------------------------------------------------------- misc */

.muted { color: var(--gridiron); font-size: 13px; }
.err { color: var(--miss); font-size: 13px; margin: 8px 0; min-height: 1em; }
.ok { color: var(--cover); font-size: 13px; margin: 8px 0; }
.hidden { display: none !important; }
.center { text-align: center; }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--gridiron);
  font-size: 14px;
  border: 1px dashed var(--steel);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--bright);
  color: var(--void);
  padding: 9px 18px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  z-index: 50;
  max-width: 90vw;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

/* Sign-in gets the shield at full size — it's the one moment there's room. */
.gate { padding: 40px 20px 24px; text-align: center; }
.gate img { width: 108px; height: 108px; }
.gate .wordmark { display: block; font-size: 21px; margin-top: 14px; }
.gate .tag {
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--gridiron);
  letter-spacing: 0.09em;
  margin-top: 7px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ submit */

#submit-row { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
#submit-row:empty { display: none; }

/* Confirmation receipt. Picks stay editable after this — only kickoff closes a
   game — so it reports state rather than gating anything. */
.receipt {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--slate);
  border: 1px solid var(--steel);
  border-left: 2px solid var(--cover);
  padding: 10px 12px;
}

.receipt-main {
  flex: 1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--chalk);
}

.receipt-when {
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--gridiron);
}

.receipt-btn {
  border: 1px solid var(--steel-2);
  background: transparent;
  color: var(--gridiron);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 10px;
  min-height: 32px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.receipt-btn:active { background: var(--steel); }

.submit-btn:disabled { background: var(--steel-2); color: var(--gridiron); }

/* ------------------------------------------------------------------- modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 15, 0.78);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fade 0.14s ease-out;
}

.modal {
  background: var(--slate);
  border: 1px solid var(--steel-2);
  padding: 18px;
  width: 100%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  animation: rise 0.16s ease-out;
}

.modal h3 {
  margin: 0 0 13px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--bright);
}

.modal-list { list-style: none; margin: 0 0 13px; padding: 0; }
.modal-list li {
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--chalk);
  padding: 7px 0;
  border-bottom: 1px solid rgba(42, 52, 65, 0.7);
}
.modal-list li:last-child { border-bottom: 0; }

.modal-note { font-size: 12px; color: var(--gridiron); margin: 0 0 15px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* -------------------------------------------------------------- my picks */

/* A list, not a table: pick text gets the full width so a row stays two lines
   on a phone instead of wrapping into a six-line block. */
.slate-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(42, 52, 65, 0.7);
}
.slate-row:last-child { border-bottom: 0; }
.slate-row:first-child { padding-top: 0; }

.slate-main { flex: 1; min-width: 0; }

.slate-pick {
  font-family: var(--font-num);
  font-size: 13px;
  color: var(--chalk);
  line-height: 1.35;
}

.slate-meta {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gridiron);
  margin-top: 4px;
}

.slate-result {
  flex: none;
  width: 30px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}
.slate-result.pending { color: var(--steel-2); }

/* --------------------------------------------------------------- claim page */

/* The username is shown, not editable — it identifies the account the invite
   belongs to, and exists so password managers save the correct pair. */
input[readonly] {
  color: var(--bright);
  font-family: var(--font-num);
  background: var(--void);
  border-color: var(--steel-2);
  border-left: 2px solid var(--cover);
  cursor: default;
}
input[readonly]:focus { outline: none; border-color: var(--steel-2); border-left-color: var(--cover); }

/* ------------------------------------------------------ admin: fix + board */

.fix-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(42, 52, 65, 0.7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fix-row:last-child { border-bottom: 0; }
.fix-row:active { background: var(--steel); }

.fix-main { flex: 1; min-width: 0; }
.fix-teams { font-size: 14px; color: var(--chalk); line-height: 1.35; }
.fix-meta {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gridiron);
  margin-top: 3px;
}

.mono-score {
  font-family: var(--font-num);
  font-size: 15px;
  color: var(--bright);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tag-manual, .tag-final {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  margin-left: 5px;
  border: 1px solid var(--steel-2);
}
.tag-manual { color: var(--push); border-color: var(--push); }
.tag-final { color: var(--cover); border-color: var(--cover); }

.bd-player { border-bottom: 1px solid var(--steel); padding: 13px 0; }
.bd-player:last-child { border-bottom: 0; }

.bd-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bd-name { font-size: 15px; font-weight: 700; color: var(--bright); }
.bd-rec { font-family: var(--font-num); font-size: 14px; color: var(--chalk); }

.bd-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cover);
  margin: 3px 0 8px;
}

.bd-pick { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.bd-text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--chalk);
  line-height: 1.4;
}

.bd-res {
  flex: none;
  width: 34px;
  min-height: 30px;
  border: 1px solid var(--steel-2);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bd-res.pending { color: var(--gridiron); }
.bd-res:active { background: var(--steel); }

/* ------------------------------------------------------- standings toggle */

.sec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.toggle { display: flex; border: 1px solid var(--steel-2); flex: none; }

.toggle button {
  background: transparent;
  border: 0;
  color: var(--gridiron);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 11px;
  min-height: 32px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.toggle button + button { border-left: 1px solid var(--steel-2); }
.toggle button.on { background: var(--chalk); color: var(--void); }
.toggle button:focus-visible { outline: 2px solid var(--chalk); outline-offset: -2px; }

/* ------------------------------------------------------ admin: mini buttons */

/* Deliberately NOT .opt — that class paints a fill layer over its own
   background to keep the chamfer outlined, and only lifts element children
   above it. A button whose label is a bare text node gets covered. */
.mini-btn {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--steel-2);
  background: transparent;
  color: var(--chalk);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.mini-btn:active { background: var(--steel); }
.mini-btn:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; }
.mini-btn:disabled { opacity: 0.5; }

.mini-btn.is-admin {
  color: var(--cover);
  border-color: var(--cover);
}

/* Destructive actions read as destructive. */
.mini-btn.danger { color: var(--miss); border-color: var(--miss); }
.mini-btn + .mini-btn { margin-left: 5px; }

/* board: remove-pick control and the searchable line picker */
.bd-del {
  flex: none;
  width: 26px; min-height: 30px;
  border: 1px solid var(--steel-2);
  background: transparent;
  color: var(--gridiron);
  font-size: 15px; line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bd-del:active { background: var(--steel); color: var(--miss); }
.bd-add { margin-top: 9px; }

.lp-list { max-height: 46vh; overflow-y: auto; margin-bottom: 14px; }

.lp-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 4px;
  background: transparent; border: 0;
  border-bottom: 1px solid rgba(42, 52, 65, 0.7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lp-row:active { background: var(--steel); }
.lp-text { font-family: var(--font-num); font-size: 12px; color: var(--chalk); line-height: 1.4; }
.lp-meta {
  flex: none; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gridiron);
}
