: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; }
