:root {
  --navy: #0e1b33;
  --navy-deep: #0a1426;
  --gold: #b8941f;
  --gold-bright: #f5c518;
  --cheese: #f5a623;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #16181d;
  --subtle: #5b6472;
  --line: #e2e5ea;
  --tabbar-bg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1426;
    --card: #14213a;
    --ink: #eef1f6;
    --subtle: #9aa5b5;
    --line: #23324e;
    --tabbar-bg: #0e1b33;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.display {
  font-family: "Big Shoulders", -apple-system, sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; gap: 0.6rem;
  padding: calc(env(safe-area-inset-top) + 0.55rem) 1rem 0.55rem;
}
.topbar img { width: 28px; height: 28px; border-radius: 7px; }
.topbar .brand { font-size: 1.15rem; color: var(--gold-bright); margin-right: auto; }
#net-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
#net-dot.err { background: #e5484d; }

main {
  max-width: 640px; margin: 0 auto;
  padding: 1rem 1rem calc(env(safe-area-inset-bottom) + 5.5rem);
}
.view h1 { font-size: 1.7rem; color: var(--ink); margin: 0.4rem 0 1rem; }
.greet { color: var(--gold) !important; }

/* sign-in */
.signin-hero { text-align: center; padding: 1.6rem 0 1rem; }
.signin-hero img { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 10px 30px rgba(10,20,38,0.35); }
.signin-hero h1 { font-size: 2.2rem; margin-top: 0.8rem; }
.signin-hero .sub { color: var(--subtle); }
.signin-card {
  background: var(--card); border-radius: 16px; padding: 1.2rem;
  margin-top: 1rem; box-shadow: 0 2px 10px rgba(10,20,38,0.06);
  display: flex; flex-direction: column; gap: 0.7rem;
}
.signin-card label { font-weight: 700; }
input[type=email], input[type=text], input[type=search] {
  font-size: 1.05rem; padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink); width: 100%;
  outline: none;
}
input:focus { border-color: var(--gold); }
#code { text-align: center; letter-spacing: 0.6em; font-size: 1.5rem; font-variant-numeric: tabular-nums; }

.btn-gold {
  background: var(--gold); color: #fff; border: 0; border-radius: 999px;
  font-size: 1.05rem; font-weight: 700; padding: 0.75rem 1.2rem; cursor: pointer;
}
.btn-gold:active { background: #a3831c; }
.btn-gold[disabled] { opacity: 0.5; }
.btn-outline {
  background: transparent; color: var(--ink); border: 1.5px solid var(--line);
  border-radius: 999px; font-size: 1rem; font-weight: 600; padding: 0.65rem 1.2rem; cursor: pointer;
}
.btn-plain { background: none; border: 0; color: var(--gold); font-size: 0.95rem; font-weight: 600; cursor: pointer; }
.btn-plain.small { font-size: 0.85rem; }
.fine { font-size: 0.85rem; color: var(--subtle); }
.fine a { color: var(--gold); text-decoration: none; }
.msg { margin-top: 0.8rem; text-align: center; color: var(--subtle); }
.msg.err { color: #e5484d; }

/* team cards */
.club-group { margin-bottom: 1.1rem; }
.club-group .club-head { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.5rem; }
.club-head img { width: 30px; height: 30px; object-fit: contain; }
.club-head .display { font-size: 1.15rem; }

.team-card {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: 14px;
  padding: 0.8rem 0.9rem 0.8rem 1.1rem;
  margin-bottom: 0.55rem;
  box-shadow: 0 2px 8px rgba(10,20,38,0.06);
  display: flex; align-items: center; gap: 0.75rem;
  cursor: pointer;
}
.team-card .band { position: absolute; left: 0; top: 0; bottom: 0; width: 8px; display: flex; }
.team-card .band i { display: block; height: 100%; }
.team-card .wash { position: absolute; inset: 0; opacity: 0.10; pointer-events: none; }
.team-card img.crest { width: 38px; height: 38px; object-fit: contain; z-index: 1; }
.team-card .tinfo { flex: 1; z-index: 1; min-width: 0; }
.team-card .tname { font-size: 1.2rem; line-height: 1.1; }
.team-card .tsub { font-size: 0.82rem; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.follow-btn {
  z-index: 1; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 0.82rem; font-weight: 700; padding: 0.45rem 0.9rem;
  background: var(--gold); color: #fff; flex-shrink: 0;
}
.follow-btn.following { background: transparent; color: var(--gold); border: 1.5px solid var(--gold); }

.search-block { margin-top: 1.6rem; }
.search-block h2 { font-size: 1.25rem; margin-bottom: 0.6rem; }
.search-block input { margin-bottom: 0.4rem; }
#search-results { margin-top: 0.6rem; }

/* schedule */
.sched-day { font-size: 1.05rem; color: var(--subtle); margin: 1.1rem 0 0.45rem; }
.game-card {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: 13px;
  padding: 0.65rem 0.8rem 0.65rem 1rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 8px rgba(10,20,38,0.06);
  display: flex; align-items: center; gap: 0.7rem;
}
.game-card .band { position: absolute; left: 0; top: 0; bottom: 0; width: 8px; display: flex; }
.game-card .band i { display: block; height: 100%; }
.game-card img.crest { width: 30px; height: 30px; object-fit: contain; }
.game-card .ginfo { flex: 1; min-width: 0; }
.game-card .gmatch { font-size: 1.05rem; line-height: 1.15; }
.game-card .gmatch .vs { color: var(--subtle); font-size: 0.85rem; font-weight: 400; }
.game-card .gvenue { font-size: 0.78rem; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card .gvenue a { color: var(--subtle); text-decoration: none; }
.game-card .gright { text-align: right; flex-shrink: 0; }
.game-card .gtime { font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.game-card .gdate { font-size: 0.75rem; color: var(--subtle); }
.score-pill {
  display: inline-block; border-radius: 9px; padding: 0.2rem 0.55rem;
  font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums;
  background: var(--navy); color: #fff;
}
.score-pill.win { background: #0c843c; }
.score-pill.loss { background: #c8102e; }
.badge-cancel { color: #e5484d; font-weight: 700; font-size: 0.8rem; }

.empty-note {
  background: var(--card); border-radius: 14px; padding: 1.2rem;
  color: var(--subtle); box-shadow: 0 2px 8px rgba(10,20,38,0.06);
}

/* settings */
.settings-card {
  background: var(--card); border-radius: 16px; padding: 1.1rem 1.2rem;
  margin-bottom: 1rem; box-shadow: 0 2px 10px rgba(10,20,38,0.06);
  display: flex; flex-direction: column; gap: 0.8rem;
}
.settings-card .row { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; }
.settings-card .row span { color: var(--subtle); font-size: 0.9rem; }

/* tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--tabbar-bg);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around;
  padding: 0.35rem 0 calc(env(safe-area-inset-bottom) + 0.35rem);
}
.tab {
  background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--subtle); font-size: 0.68rem; font-weight: 600;
  padding: 0.2rem 1.2rem;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--gold); }

.spin { text-align: center; color: var(--subtle); padding: 1rem; }

/* ---------- phase 2 ---------- */

/* signed-out marketing pitch */
.pitch { list-style: none; margin: 1.1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.pitch li {
  background: var(--card); border-radius: 12px; padding: 0.7rem 0.85rem;
  font-size: 0.9rem; color: var(--subtle);
  box-shadow: 0 2px 8px rgba(10,20,38,0.06);
  border-left: 3px solid var(--gold);
}
.pitch li strong { color: var(--ink); }

/* resend cooldown */
.btn-plain[disabled] { color: var(--subtle); cursor: default; }

/* shared: form controls that match the inputs */
select, textarea {
  font-family: inherit; font-size: 1rem; padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink); width: 100%; outline: none;
}
select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 5.5rem; line-height: 1.4; }
.card-title { font-size: 1.15rem; }
.btn-gold.small { font-size: 0.9rem; padding: 0.5rem 1.1rem; flex-shrink: 0; }

/* team card: stacked actions once a team is followed */
.team-card .tactions { z-index: 1; display: flex; flex-direction: column; gap: 0.35rem; flex-shrink: 0; }
.players-btn {
  border-radius: 999px; border: 1.5px solid var(--line); cursor: pointer;
  background: var(--card); color: var(--subtle);
  font-size: 0.78rem; font-weight: 700; padding: 0.34rem 0.7rem; white-space: nowrap;
}
.players-btn:active { border-color: var(--gold); color: var(--gold); }

/* roster view */
.btn-back {
  background: none; border: 0; cursor: pointer; padding: 0.2rem 0 0.4rem;
  color: var(--gold); font-size: 1rem; font-weight: 700;
}
.roster-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.9rem; }
.roster-head .crest { width: 46px; height: 46px; object-fit: contain; flex-shrink: 0; }
.roster-head .roster-title { min-width: 0; }
.roster-head h1 { font-size: 1.7rem; margin: 0; line-height: 1.05; }
.roster-head .tsub { font-size: 0.85rem; color: var(--subtle); }

.privacy-note {
  background: var(--card); border-radius: 14px; padding: 0.9rem 1rem;
  font-size: 0.85rem; color: var(--subtle); line-height: 1.45;
  border-left: 3px solid var(--gold);
  box-shadow: 0 2px 8px rgba(10,20,38,0.06);
  margin-bottom: 1rem;
}
.privacy-note strong { color: var(--ink); display: block; margin-bottom: 0.2rem; }

.label-row {
  background: var(--card); border-radius: 13px;
  padding: 0.6rem 0.8rem; margin-bottom: 0.45rem;
  box-shadow: 0 2px 8px rgba(10,20,38,0.06);
  display: flex; align-items: center; gap: 0.7rem;
}
.label-row .jersey {
  flex-shrink: 0; min-width: 2.6rem; height: 2.6rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); color: var(--gold-bright);
  border-radius: 10px; font-family: "Big Shoulders", sans-serif;
  font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums;
  padding: 0 0.4rem;
}
.label-row .lname { flex: 1; min-width: 0; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-row input.lname {
  font-size: 1rem; padding: 0.4rem 0.55rem; border: 1.5px solid var(--gold);
  border-radius: 9px; background: var(--bg); color: var(--ink); width: auto;
}
.label-row .lact { background: none; border: 0; cursor: pointer; color: var(--gold); font-size: 0.85rem; font-weight: 700; flex-shrink: 0; }
.label-row .lact.danger { color: #e5484d; }

.label-add { margin-top: 1.2rem; }
.label-add-row { display: flex; gap: 0.5rem; align-items: center; margin: 0.5rem 0 0.5rem; }
.label-add-row #label-jersey {
  width: 4.2rem; flex-shrink: 0; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 700;
}
.label-add-row #label-name { flex: 1; min-width: 0; }
.msg.ok { color: #0c843c; }

/* schedule extras */
.sched-updated { margin: -0.6rem 0 0.8rem; }
.pending-note { margin-top: 0.9rem; font-size: 0.85rem; }
.pending-note strong { color: var(--ink); }

/* toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 4.6rem);
  z-index: 40; max-width: min(520px, calc(100vw - 2rem));
  background: var(--navy); color: #fff;
  padding: 0.7rem 1.1rem; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; text-align: center;
  box-shadow: 0 8px 24px rgba(10,20,38,0.35);
  animation: toast-in 180ms ease-out;
}
.toast.err { background: #c8102e; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---- superuser views (live board, standings) ------------------------------
   The board itself is styled by /live.css, scoped under `.live`, because the
   public page at /live.html draws the identical markup from the same module.
   Only the frame around it and the standings table live here. */
.su-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin: 0.4rem 0 1rem; }
.su-head h1 { font-size: 1.7rem; color: var(--ink); margin: 0; }
.su-badge {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--navy); background: var(--gold-bright);
  padding: 0.15rem 0.5rem; border-radius: 999px;
}
.su-view .live { --red: #c8102e; --navy: #0e1b33; --subtle: var(--subtle); }
.su-view .live .live-status { margin-bottom: 0.9rem; }

/* Provenance, operator board only: which object the row came from. */
.su-view .live .prov { font-variant-numeric: tabular-nums; opacity: 0.75; }
.su-view .live .is-scheduled .num { color: var(--subtle); opacity: 0.5; }

/* standings */
.std-controls { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin: 0.8rem 0 0.4rem; }
.std-week { font-size: 0.85rem; color: var(--subtle); display: inline-flex; align-items: center; gap: 0.35rem; }
.std-week select {
  font: inherit; font-size: 0.85rem; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.25rem 0.4rem;
}
.std-wrap .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.std-wrap .chip {
  font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  color: var(--ink); background: transparent;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 0.25rem 0.75rem;
}
.std-wrap .chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.std-wrap .find { flex: 1 1 12rem; }
.std-wrap .find input {
  width: 100%; font: inherit; font-size: 0.9rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.4rem 0.7rem;
}
.std-division { margin-top: 1.5rem; }
.std-division header { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.std-division h3 { font-size: 1.05rem; color: var(--ink); }
.std-division .fine { margin: 0; }

/* A 13-column table on a phone scrolls sideways inside its own box; the page
   itself never does. */
.std-scroll { overflow-x: auto; margin-top: 0.4rem; -webkit-overflow-scrolling: touch; }
table.std { border-collapse: collapse; width: 100%; min-width: 44rem; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
table.std th, table.std td { padding: 0.35rem 0.45rem; text-align: right; white-space: nowrap; }
table.std thead th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--subtle); border-bottom: 1.5px solid var(--line); }
table.std tbody tr { border-bottom: 1px solid var(--line); }
table.std .rk { width: 1.6rem; text-align: right; color: var(--subtle); }
table.std .tm { text-align: left; white-space: normal; min-width: 12rem; }
table.std .tm .nm { font-weight: 600; color: var(--ink); }
table.std .tm .strk { margin-left: 0.4rem; font-size: 0.75rem; color: var(--subtle); }
table.std .pts { font-weight: 700; color: var(--ink); }
table.std .unknown { color: var(--subtle); }
table.std .nx { text-align: left; white-space: nowrap; }
table.std .nx .when { font-weight: 600; }
table.std .nx .opp { display: block; font-size: 0.75rem; color: var(--subtle); }

/* Password sign-in: folded away, because the emailed code is the path almost
   everyone takes and the beta is invite-only. */
.signin-alt { margin-top: 0.9rem; }
.signin-alt summary { cursor: pointer; font-size: 0.9rem; color: var(--subtle); }
.signin-alt summary:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 2px; }
.signin-alt[open] summary { margin-bottom: 0.6rem; }
