/* Gameday — mobile-first */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #1d4ed8;
  --live: #dc2626;
  --win: #15803d;
  --loss: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 8px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.6rem; margin: .2em 0 .3em; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: .2em 0 .5em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: #0f172a; color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 1.05rem; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); font-size: .8rem; letter-spacing: .02em;
}
.topnav { display: flex; align-items: center; gap: 14px; }
.topnav a { color: #cbd5e1; font-size: .95rem; }
.avatar-link img, .avatar-fallback {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  background: #334155; color: #fff; font-weight: 600; object-fit: cover; vertical-align: middle;
}
.badge { background: var(--live); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-left: 2px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.foot { text-align: center; color: var(--muted); font-size: .75rem; padding: 24px 0 32px; }

/* Cards */
.card {
  display: block; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; color: inherit;
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
.grid .card { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero { text-align: center; padding: 20px 8px 12px; }
.hero h1 { font-size: 2rem; }
.hero p { color: var(--muted); max-width: 420px; margin: 0 auto; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 4px 8px; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 12px; }

/* Team cards */
.team-card { border-left: 5px solid var(--accent); }
.team-card h2 { margin: 0; }
.team-card-top { display: flex; gap: 12px; align-items: center; }
.sport-icon { font-size: 1.8rem; line-height: 1; }
.sport-icon.big { font-size: 2.4rem; }
.next-game { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .9rem; }
.next-game.is-live { color: var(--live); font-weight: 600; }

.team-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.team-head h1 { margin: 0; }
.team-head-main { flex: 1; min-width: 180px; }
.season-pick select { width: auto; }

.share-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px;
}
.share-box > div { min-width: 0; }

/* Tabs */
.tabs { display: flex; gap: 4px; background: #e2e8f0; border-radius: 12px; padding: 4px; margin: 4px 0 14px; overflow-x: auto; }
.tabs a { flex: 1; text-align: center; padding: 8px 10px; border-radius: 9px; color: #334155; font-weight: 500; white-space: nowrap; font-size: .95rem; }
.tabs a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* Games */
.game-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.game-date { display: flex; flex-direction: column; align-items: center; width: 44px; line-height: 1.1; }
.gd-dow, .gd-mon { font-size: .7rem; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.gd-day { font-size: 1.35rem; font-weight: 700; }
.game-main { flex: 1; min-width: 0; }
.game-opp { font-weight: 600; }
.game-side { text-align: right; }
.result { font-weight: 700; font-variant-numeric: tabular-nums; }
.result-w { color: var(--win); } .result-l { color: var(--loss); } .result-t { color: var(--muted); }
.status-canceled .game-main, .status-postponed .game-main { opacity: .6; }
.status-live { border-left: 4px solid var(--live); }
.live-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--live); font-weight: 700; font-size: .8rem; letter-spacing: .06em; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--live); display: inline-block; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220,38,38,.6); } 70% { box-shadow: 0 0 0 8px rgba(220,38,38,0); } 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); } }

.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; gap: 8px; border-top: 5px solid var(--accent); }
.sb-name { font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; }
.sb-score { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* Roster */
.roster { padding: 4px 16px; }
.roster-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.roster-row:last-child { border-bottom: 0; }
.jersey {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; padding: 0 4px;
}
.roster-name { flex: 1; }
.roster-edit { width: 100%; }
.roster-edit > summary { color: var(--accent); }
.roster-row .roster-edit { order: 3; }
.roster-row > .roster-edit:not([open]) { width: auto; }

/* Rows with actions */
.row-card { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-main { flex: 1; min-width: 200px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.is-archived { opacity: .55; }
.season-row { border-top: 1px solid var(--line); padding: 12px 0; }
.season-row summary .small { display: block; }

/* Tags */
.tag { display: inline-block; font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: #e2e8f0; color: #334155; vertical-align: middle; text-transform: capitalize; }
.tag-approved { background: #dcfce7; color: #166534; }
.tag-pending { background: #fef3c7; color: #92400e; }
.tag-denied { background: #fee2e2; color: #991b1b; }

/* Forms */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: .88rem; font-weight: 500; color: #334155; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type=color] { width: 100%; height: 44px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.row2, .row3 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
.inline-form { grid-template-columns: 1fr; margin-top: 12px; }
@media (min-width: 560px) { .inline-form { grid-template-columns: 1fr auto auto; align-items: end; } }
form.inline { display: inline; }
.linklike { background: none; border: 0; color: var(--accent); font: inherit; padding: 0; cursor: pointer; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 11px 18px;
  font: inherit; font-weight: 600; cursor: pointer; text-align: center; min-height: 44px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: .85rem; min-height: 34px; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid #cbd5e1; }
.btn-danger { background: #fff; color: var(--loss); border: 1px solid #fecaca; }
.btn-block { width: 100%; }
.btn-google { background: #fff; color: #1f2937; border: 1px solid #cbd5e1; width: 100%; margin: 10px 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Flash */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: .95rem; }
.flash-ok { background: #dcfce7; color: #14532d; }
.flash-err { background: #fee2e2; color: #7f1d1d; }
.flash-info { background: #e0f2fe; color: #0c4a6e; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gate { margin-top: 24px; }
