/* ---------------------------------------------------------------------------
   Golden Football Pool - mobile-first scoreboard styling.
   Palette is Golden's brand system: Ink/Linen ground, Navy structure,
   Gold used only as an accent (one primary action at a time).
--------------------------------------------------------------------------- */

:root {
  --gold: #ffc844;
  --navy: #1b2a6b;
  --navy-soft: #2a3b85;
  --ink: #111111;
  --ink-raised: #1c1c1c;
  --paper: #ffffff;
  --linen: #f7f4ee;
  --stone: #dcd6c9;
  --butter: #fff0c7;
  --graphite: #4a4e55;
  --verified: #1f7a5c;
  --attention: #9a4a12;
  --urgent: #b3261e;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.06), 0 6px 18px rgba(17, 17, 17, 0.06);
  --tap: 48px;

  --font-head: 'Figtree', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--linen);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 800; margin: 0; letter-spacing: -0.01em; }

.eyebrow {
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

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

.stickyhead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ink);
}

.topbar {
  background: var(--ink);
  color: var(--paper);
  padding: 14px 16px 12px;
}

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

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.roof { flex: none; }

.brand-text { min-width: 0; }

.brand h1 {
  font-size: 17px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .week-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
}

.whoami {
  font-size: 12px;
  color: var(--stone);
  text-align: right;
  line-height: 1.3;
  flex: none;
}
.whoami strong { color: var(--paper); display: block; font-size: 13px; }
.whoami button {
  background: none;
  border: none;
  color: var(--stone);
  text-decoration: underline;
  font-size: 11px;
  padding: 8px 0 2px;
  min-height: 30px;
  cursor: pointer;
  font-family: var(--font-body);
}

/* -------------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  background: var(--ink);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tabs button {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 0 14px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--stone);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected='true'] { color: var(--paper); border-bottom-color: var(--gold); }

/* ------------------------------------------------------------------ layout */

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

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 0 10px;
}
.section-head:first-child { margin-top: 4px; }
.section-head h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; }
.section-head .hint { font-size: 12px; color: var(--graphite); }

.linestamp {
  font-size: 11.5px;
  color: var(--graphite);
  text-align: center;
  padding: 10px 4px 0;
  line-height: 1.4;
}

.notice {
  background: var(--butter);
  border: 1px solid var(--stone);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 12px;
}
.notice.error { background: #fdecea; border-color: #f2c2bd; color: #7d1811; }
.notice.ok { background: #e8f4ef; border-color: #b7ded0; color: #12523c; }

.empty {
  background: var(--paper);
  border: 1px dashed var(--stone);
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  color: var(--graphite);
  font-size: 14px;
}

/* ------------------------------------------------------------- game cards */

.game {
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--linen);
  border-bottom: 1px solid var(--stone);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite);
}
.game-top .lock { color: var(--attention); }
.game-top .final { color: var(--navy); }

.matchup { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; }

.side {
  border: none;
  background: var(--paper);
  padding: 14px 10px;
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  transition: background 0.12s ease;
}
.side:disabled { cursor: default; }
.side .team { font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 1.15; }
.side .spread { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--navy); }
.side .score { font-family: var(--font-mono); font-size: 20px; font-weight: 600; }

.side[aria-pressed='true'] { background: var(--navy); color: var(--paper); }
.side[aria-pressed='true'] .spread { color: var(--gold); }
.side[aria-pressed='true'] .team { color: var(--paper); }

.side.win { box-shadow: inset 0 0 0 2px var(--verified); }
.side.loss { opacity: 0.62; }
.side.push { box-shadow: inset 0 0 0 2px var(--graphite); }

.vs {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--graphite);
  background: var(--paper);
  border-left: 1px solid var(--stone);
  border-right: 1px solid var(--stone);
}

.game-foot {
  border-top: 1px solid var(--stone);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--graphite);
  background: var(--linen);
}
.game-foot .pickrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11.5px;
}
.chip.win { border-color: var(--verified); color: var(--verified); }
.chip.loss { border-color: var(--stone); color: var(--graphite); }
.chip.push { border-color: var(--navy); color: var(--navy); }

.pctbar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--stone);
  margin-top: 6px;
}
.pctbar span { display: block; height: 100%; }
.pctbar .away { background: var(--graphite); }
.pctbar .home { background: var(--navy); }

/* ---------------------------------------------------------------- survivor */

.survivor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.team-card {
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  color: var(--ink);
}
.team-card .name { font-family: var(--font-head); font-weight: 700; font-size: 14px; line-height: 1.15; }
.team-card .meta { font-size: 11.5px; color: var(--graphite); }
.team-card[aria-pressed='true'] { background: var(--navy); color: var(--paper); border-color: var(--navy); }
.team-card[aria-pressed='true'] .meta { color: var(--stone); }
.team-card.used, .team-card.locked { background: var(--linen); color: var(--graphite); cursor: not-allowed; opacity: 0.75; }
.team-card .tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.team-card.used .tag { color: var(--attention); }
.team-card.locked .tag { color: var(--graphite); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--graphite); margin-bottom: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .av { background: var(--paper); border: 1px solid var(--stone); }
.legend .us { background: var(--linen); border: 1px solid var(--attention); }
.legend .el { background: var(--stone); border: 1px solid var(--graphite); }

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

.card {
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.card > h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 11px 14px;
  background: var(--navy);
  color: var(--paper);
  font-family: var(--font-mono);
  font-weight: 600;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--stone); }
th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite);
  font-weight: 600;
  background: var(--linen);
}
tbody tr:last-child td { border-bottom: none; }
td.num, th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-left: 6px;
  padding-right: 8px;
}
td.pts { font-weight: 700; font-size: 15px; }
.rank { font-family: var(--font-mono); color: var(--graphite); width: 22px; padding-right: 0; }

/* A table is the one thing allowed to scroll sideways rather than squash. */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tablewrap table { min-width: 100%; }
tr.me { background: var(--butter); }

.qual {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.qual.yes { color: var(--verified); }
.qual.no { color: var(--graphite); }

.cardnote {
  margin: 0;
  padding: 9px 12px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--graphite);
  background: var(--linen);
  border-top: 1px solid var(--stone);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid;
}
.status-pill.alive { color: var(--verified); border-color: var(--verified); }
.status-pill.out { color: var(--urgent); border-color: var(--urgent); }

/* --------------------------------------------------------------- controls */

.btn {
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid var(--navy);
  background: var(--navy);
  color: var(--paper);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  padding: 0 18px;
  cursor: pointer;
  width: 100%;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.ghost { background: var(--paper); color: var(--navy); }
.btn.small { min-height: 38px; font-size: 13px; width: auto; padding: 0 12px; }
.btn.danger { background: var(--paper); color: var(--urgent); border-color: var(--urgent); }

.submitbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--stone);
  z-index: 25;
}
.submitbar .meta { font-size: 12px; color: var(--graphite); text-align: center; margin-bottom: 7px; }
.submitbar .inner { max-width: 720px; margin: 0 auto; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 40;
  box-shadow: var(--shadow);
  max-width: 92vw;
  text-align: center;
}
.toast.error { background: var(--urgent); }
.toast.hidden { display: none; }

select, input[type='text'], input[type='number'], input[type='password'], input[type='date'], input[type='datetime-local'] {
  font-family: var(--font-body);
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--stone);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  min-height: 44px;
  width: 100%;
}

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--graphite);
  margin-bottom: 5px;
  font-weight: 600;
}

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 140px; }

/* ------------------------------------------------------------------ login */

.login {
  max-width: 380px;
  margin: 40px auto;
  background: var(--paper);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
}
.login h2 { font-size: 18px; margin-bottom: 4px; }
.login p { font-size: 13.5px; color: var(--graphite); margin: 0 0 16px; }

.footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--graphite);
  padding: 18px 10px 0;
}
.footer-note a { color: var(--navy); }

.hidden { display: none !important; }

/* --------------------------------------------------------------- admin only */

.admin main { max-width: 900px; }
.admin .card { margin-bottom: 14px; }
.admin table { font-size: 13px; }
.admin td, .admin th { padding: 7px 9px; }
.admin input[type='number'] { min-height: 38px; padding: 6px 8px; }
.admin .spread-input { width: 78px; }
.admin .score-input { width: 62px; }
.step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--stone); }
.step:last-child { border-bottom: none; }
.step .n {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step .body { flex: 1; }
.step .body p { margin: 2px 0 8px; font-size: 13px; color: var(--graphite); }
.log { font-family: var(--font-mono); font-size: 11px; max-height: 320px; overflow: auto; }
.log div { padding: 6px 12px; border-bottom: 1px solid var(--linen); }

/* Fit all four tabs on the narrowest phones. */
@media (max-width: 359px) {
  .tabs button { padding: 0 8px; letter-spacing: 0.04em; font-size: 10px; }
  .brand h1 { font-size: 15px; }
}

@media (min-width: 560px) {
  .brand h1 { font-size: 20px; }
  main { padding: 20px 18px 130px; }
}
