:root {
  --bg: #0a120e;
  --surface: #111c16;
  --surface-2: #17251d;
  --surface-3: #1e3026;
  --line: #233a2d;
  --text: #edf6ef;
  --muted: #8aa395;
  --accent: #c8f53c;
  --accent-ink: #0a120e;
  --accent-soft: rgba(200, 245, 60, .12);
  --gold: #ffc53d;
  --gold-soft: rgba(255, 197, 61, .14);
  --danger: #ff6b5b;
  --danger-soft: rgba(255, 107, 91, .14);
  --amber: #ffa94d;
  --green: #4ade80;
  --radius: 18px;
  --radius-sm: 12px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 68px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* App feel: no double-tap zoom (pinch is blocked in the viewport meta and app.js). */
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(200, 245, 60, .08), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: .01em;
  margin: 0 0 .5rem;
}
h1 { font-size: 2rem; text-transform: uppercase; }
h2 { font-size: 1.35rem; text-transform: uppercase; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.center { text-align: center; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; stroke: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: .55rem; color: var(--text); font-family: var(--display); font-weight: 800; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.logo-mark .ic { width: 20px; height: 20px; }
#userbox { display: flex; align-items: center; gap: .6rem; }

main { max-width: 720px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
body.has-nav main { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 2.5rem); }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { margin: 0; }
.callout { border-color: rgba(200, 245, 60, .35); background: linear-gradient(135deg, rgba(200, 245, 60, .10), transparent 60%), var(--surface); }
.callout.gold { border-color: rgba(255, 197, 61, .4); background: linear-gradient(135deg, rgba(255, 197, 61, .12), transparent 60%), var(--surface); }
.section-title { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; color: var(--muted); margin: 1.5rem 0 .6rem; }

/* ---------- buttons & forms ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: 600 .92rem var(--body);
  padding: .65rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:active, button:active { transform: scale(.97); }
.btn:hover, button:hover { border-color: var(--surface-3); background: var(--surface-3); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover, button.primary:hover { filter: brightness(1.06); }
.btn.ghost, button.ghost { background: transparent; }
.btn.danger, button.danger { background: transparent; color: var(--danger); border-color: rgba(255, 107, 91, .4); }
.btn.small, button.small { padding: .38rem .75rem; font-size: .82rem; }
.btn.block, button.block { width: 100%; padding: .85rem; font-size: 1rem; }
.btn.wa { background: #25d366; border-color: #25d366; color: #062b14; font-weight: 700; }
button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }

label { display: block; font-weight: 600; font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: max(16px, 1em); /* iOS zooms into inputs under 16px */
  padding: .72rem .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s;
}
input::placeholder { color: #5b7266; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.field { margin-bottom: .9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
details > summary { cursor: pointer; list-style: none; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; margin-left: auto; font-size: 1.3rem; color: var(--muted); }
details[open] > summary::after { content: "–"; }
details[open] > summary { margin-bottom: 1rem; }

/* ---------- avatars & crests ---------- */
.avatar {
  --h: 140;
  flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 .95rem var(--display); letter-spacing: .03em;
  color: #fff;
  background: linear-gradient(145deg, hsl(var(--h) 55% 46%), hsl(var(--h) 60% 28%));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12);
}
.avatar.sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar.xl { width: 84px; height: 84px; font-size: 1.9rem; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .15), 0 10px 30px rgba(0, 0, 0, .35); }
.crest { --h: 140; position: relative; flex: none; width: 64px; height: 74px; display: grid; place-items: center; }
.crest svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.crest path { fill: hsl(var(--h) 55% 32%); stroke: var(--accent); stroke-width: 2.5; }
.crest b { position: relative; font: 800 1.35rem var(--display); color: #fff; margin-top: -4px; }

.pos { display: inline-block; font: 700 .68rem var(--body); letter-spacing: .04em; padding: .1rem .4rem; border-radius: 6px; background: var(--surface-3); color: var(--muted); vertical-align: middle; }
.pos-POR { background: rgba(255, 197, 61, .16); color: var(--gold); }
.pos-DEF { background: rgba(96, 165, 250, .16); color: #7cb4ff; }
.pos-MED { background: rgba(74, 222, 128, .16); color: var(--green); }
.pos-DEL { background: rgba(255, 107, 91, .16); color: #ff8a7d; }

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font: 600 .74rem var(--body);
  padding: .25rem .6rem; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.pill.lime { background: var(--accent-soft); color: var(--accent); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill .dot.live { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- hero (landing) ---------- */
.hero { position: relative; text-align: center; padding: 1.5rem 0 .5rem; }
.hero .kicker { display: inline-flex; margin-bottom: 1rem; }
.hero h1 { font-size: clamp(2.6rem, 11vw, 4.2rem); line-height: .92; margin-bottom: 1rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 1.05rem; color: var(--muted); max-width: 30rem; margin: 0 auto 1.5rem; }
.hero .row { justify-content: center; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; }
.feature { display: flex; gap: .85rem; align-items: flex-start; }
.feature .num {
  flex: none; width: 2.3rem; height: 2.3rem; border-radius: 12px;
  display: grid; place-items: center;
  font: 800 1.25rem var(--display);
  background: var(--accent); color: var(--accent-ink);
}
.feature h3 { margin-bottom: .2rem; }
.feature p { margin: 0; font-size: .9rem; color: var(--muted); }

/* ---------- team header ---------- */
.team-hero {
  position: relative; overflow: hidden;
  display: flex; gap: 1rem; align-items: center;
  padding: 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 36px, transparent 36px 72px),
    linear-gradient(135deg, hsl(var(--h) 45% 20%), var(--surface) 75%);
  border: 1px solid var(--line);
}
.team-hero h1 { font-size: 1.9rem; margin-bottom: .35rem; }
.team-hero .meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .75rem; }
.team-hero .info { min-width: 0; flex: 1; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  /* the iPhone home-indicator area is added below the bar, not taken out of it */
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 0 8px env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; max-width: 140px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .7rem; font-weight: 600;
}
.tabbar a .ic { width: 22px; height: 22px; }
.tabbar a.on { color: var(--accent); }
.tabbar a.on .ic { filter: drop-shadow(0 0 8px rgba(200, 245, 60, .5)); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: .8rem; padding: .75rem 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list > li:last-child { padding-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .name { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .sub { font-size: .8rem; color: var(--muted); }
a.rowlink { color: inherit; display: flex; align-items: center; gap: .8rem; flex: 1; min-width: 0; }
.chev { color: var(--muted); }

/* ---------- matches ---------- */
.match {
  display: flex; align-items: center; gap: .9rem;
  padding: .9rem; margin-bottom: .6rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; transition: border-color .15s, transform .1s;
}
.match:hover { border-color: var(--surface-3); }
.match:active { transform: scale(.99); }
.datebox {
  flex: none; width: 52px; padding: .35rem 0; border-radius: 12px;
  background: var(--surface-2); text-align: center; line-height: 1;
}
.datebox b { display: block; font: 800 1.55rem var(--display); }
.datebox span { font-size: .68rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.match .grow { flex: 1; min-width: 0; }
.match .vs { font: 700 1.2rem var(--display); text-transform: uppercase; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match .sub { font-size: .8rem; color: var(--muted); }
.match .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.pts { font: 800 1.35rem var(--display); color: var(--accent); line-height: 1; }
.pts small { font-size: .75rem; color: var(--muted); font-weight: 600; margin-left: 2px; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; margin-bottom: .5rem; color: var(--surface-3); }

/* ---------- match page ---------- */
.backlink { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-weight: 600; margin-bottom: .75rem; }
.scoreboard {
  text-align: center; padding: 1.4rem 1rem;
  border-radius: var(--radius); margin-bottom: 1rem;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.scoreboard .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; }
.scoreboard .side { font: 700 1.15rem var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
.scoreboard .score { font: 800 3rem var(--display); line-height: 1; letter-spacing: .04em; }
.scoreboard .score.tbd { font-size: 1.4rem; color: var(--muted); }
.scoreboard .when { margin-top: .75rem; color: var(--muted); font-size: .85rem; }

/* pitch */
.pitch {
  position: relative;
  padding: 18px 6px;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(180deg, #1c6b36 0 44px, #19612f 44px 88px);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14), inset 0 -40px 60px rgba(0, 0, 0, .25);
  overflow: hidden;
  margin-bottom: 1rem;
}
.pitch::before { /* centre circle */
  content: ""; position: absolute; left: 50%; top: 50%; width: 110px; height: 110px;
  transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .14);
}
.pitch::after { /* halfway line */
  content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid rgba(255, 255, 255, .14);
}
.pitch .box { position: absolute; left: 50%; bottom: 0; width: 46%; height: 52px; transform: translateX(-50%); border: 2px solid rgba(255, 255, 255, .14); border-bottom: 0; }
.pitch .box.top { top: 0; bottom: auto; border-top: 0; border-bottom: 2px solid rgba(255, 255, 255, .14); }
.pitch .line { position: relative; z-index: 1; display: flex; justify-content: space-evenly; padding: 10px 0; }
.token { position: relative; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 0; color: #fff; cursor: pointer; }
.token:hover { background: none; }
.token .avatar { width: 50px; height: 50px; font-size: 1.1rem; box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), 0 6px 14px rgba(0, 0, 0, .4); }
.token .tname { max-width: 76px; font-size: .72rem; font-weight: 700; padding: .1rem .4rem; border-radius: 6px; background: rgba(0, 0, 0, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.token .tprice { font-size: .66rem; font-weight: 700; color: var(--accent); margin-top: -2px; }
.token .armband { position: absolute; top: -4px; right: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); color: #3a2a00; font: 800 .72rem var(--display); display: grid; place-items: center; box-shadow: 0 0 0 2px #19612f; }
.token.empty .slot { width: 50px; height: 50px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .45); display: grid; place-items: center; color: rgba(255, 255, 255, .6); font-size: 1.4rem; }
.pitch-hint { position: relative; z-index: 1; text-align: center; font-size: .75rem; color: rgba(255, 255, 255, .7); margin-top: 4px; }

.budget { margin-bottom: 1rem; }
.budget .nums { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .4rem; }
.budget .left { font: 800 1.6rem var(--display); color: var(--accent); }
.budget.over .left { color: var(--danger); }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s; }
.budget.over .bar > span { background: var(--danger); }

.market > li { cursor: pointer; }
.market > li.on .name { color: var(--accent); }
.addbtn { width: 36px; height: 36px; padding: 0; border-radius: 50%; flex: none; }
.market li.on .addbtn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.price { font: 700 1.05rem var(--display); white-space: nowrap; }

.savebar {
  position: sticky; bottom: 12px; z-index: 5;
  margin-top: 1rem;
}
.savebar button { box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }

/* ratings */
.rate-card { padding: .9rem 0; border-top: 1px solid var(--line); }
.rate-card:first-of-type { border-top: 0; padding-top: 0; }
.rate-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.rate-head .grow { flex: 1; min-width: 0; }
.mvp-toggle { position: relative; }
.mvp-toggle span { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--line); font-size: .8rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.mvp-toggle input:checked + span { background: var(--gold); border-color: var(--gold); color: #3a2a00; }
.scores { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.scores label { position: relative; margin: 0; }
.scores input, .mvp-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.scores span {
  display: grid; place-items: center; height: 38px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  font: 700 1rem var(--display); color: var(--muted); cursor: pointer; transition: background .12s;
}
.scores input:focus-visible + span { outline: 2px solid var(--accent); }
.scores input:checked + span { color: var(--accent-ink); border-color: transparent; transform: scale(1.06); }
.scores .s-low input:checked + span { background: var(--danger); }
.scores .s-mid input:checked + span { background: var(--amber); }
.scores .s-good input:checked + span { background: var(--green); }
.scores .s-top input:checked + span { background: var(--accent); }

.rating { display: inline-grid; place-items: center; min-width: 2.4rem; padding: .2rem .4rem; border-radius: 8px; font: 800 1rem var(--display); color: var(--accent-ink); }
.rating.s-low { background: var(--danger); }
.rating.s-mid { background: var(--amber); }
.rating.s-good { background: var(--green); }
.rating.s-top { background: var(--accent); }

/* results */
.mvp-card {
  position: relative; overflow: hidden; text-align: center;
  padding: 1.5rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
  background: radial-gradient(400px 200px at 50% 0, rgba(255, 197, 61, .28), transparent 70%), var(--surface);
  border: 1px solid rgba(255, 197, 61, .4);
}
.mvp-card .label { font: 700 .8rem var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); display: flex; align-items: center; justify-content: center; gap: .35rem; margin-bottom: .75rem; }
.mvp-card .avatar { margin: 0 auto .6rem; box-shadow: 0 0 0 3px var(--gold), 0 10px 30px rgba(0, 0, 0, .4); }
.mvp-card .who { font: 800 1.8rem var(--display); text-transform: uppercase; }
.bigpts { text-align: center; }
.bigpts b { display: block; font: 800 3.4rem var(--display); color: var(--accent); line-height: 1; }
.bigpts span { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.stat-inline { display: inline-flex; align-items: center; gap: .2rem; font-size: .8rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.chip { font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.chip.cap { border-color: var(--gold); color: var(--gold); }
.up { color: var(--green); font-weight: 700; }
.down { color: var(--danger); font-weight: 700; }

/* podium */
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: .5rem; margin-bottom: 1rem; text-align: center; }
.podium .spot { display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 0; }
.podium .who { font-weight: 700; font-size: .85rem; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .block { width: 100%; border-radius: 12px 12px 4px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--display); }
.podium .block b { font-size: 1.5rem; line-height: 1; }
.podium .block small { font-size: .7rem; color: inherit; opacity: .75; font-family: var(--body); font-weight: 600; }
.podium .p1 .block { height: 104px; background: linear-gradient(180deg, var(--gold), #c28a12); color: #2e2100; }
.podium .p2 .block { height: 80px; background: linear-gradient(180deg, #d8e1dc, #94a39b); color: #17201a; }
.podium .p3 .block { height: 62px; background: linear-gradient(180deg, #e2a26b, #a8693a); color: #2a1406; }
.podium .p1 .avatar { box-shadow: 0 0 0 3px var(--gold); }

.rank { width: 1.6rem; flex: none; text-align: center; font: 800 1.1rem var(--display); color: var(--muted); }
.list > li.me { background: var(--accent-soft); margin: 0 -1.1rem; padding-left: 1.1rem; padding-right: 1.1rem; }
.list > li.me .name { color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .6rem .4rem; text-align: left; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font: 700 .72rem var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .who { display: flex; align-items: center; gap: .55rem; color: inherit; font-weight: 600; }
.table-wrap { overflow-x: auto; margin: 0 -.4rem; }

.statgrid td input[type=number] { width: 3.6rem; padding: .45rem; text-align: center; }

/* player profile */
.profile { text-align: center; padding: 1.5rem 1rem 1.1rem; }
.profile .avatar { margin: 0 auto .75rem; }
.profile h1 { margin-bottom: .3rem; }
.profile .value { font: 800 2.2rem var(--display); color: var(--accent); line-height: 1; margin: .6rem 0 .2rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1rem; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: .7rem .4rem; text-align: center; }
.stat b { display: block; font: 800 1.6rem var(--display); line-height: 1.1; }
.stat small { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { font: 600 10px var(--body); fill: var(--muted); }

/* squad grid */
.squad { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.pcard {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem;
  padding: 1rem .6rem .8rem; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line);
  color: inherit;
}
.pcard.off { opacity: .45; }
.pcard .name { font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .price { color: var(--accent); }
.pcard .sub { font-size: .75rem; color: var(--muted); }
.pcard .corner { position: absolute; top: .55rem; left: .55rem; }
.pcard .mvps { position: absolute; top: .55rem; right: .55rem; color: var(--gold); font-size: .75rem; font-weight: 700; display: flex; align-items: center; gap: 2px; }
.pcard .mvps .ic { width: 14px; height: 14px; }
.pcard .claim { margin-top: .3rem; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 30;
  transform: translate(-50%, 160%);
  max-width: calc(100% - 32px);
  padding: .75rem 1.2rem; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .9rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  opacity: 0; visibility: hidden;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.2), opacity .2s, visibility .2s;
}
body.has-nav #toast { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 1rem); }
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
#toast.error { background: var(--danger); color: #fff; }

.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth { max-width: 420px; margin: 1.5rem auto; }
.logo-ball { width: 32px; height: 32px; display: block; }
.auth .logo-ball { width: 60px; height: 60px; margin: 0 auto 1rem; }
.auth h1 { text-align: center; }

@media (min-width: 760px) {
  .tabbar {
    position: static; height: auto; padding: 4px; margin-bottom: 1rem;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  }
  .tabbar a { flex-direction: row; gap: .4rem; padding: .55rem .8rem; border-radius: 999px; font-size: .85rem; max-width: none; }
  .tabbar a.on { background: var(--accent); color: var(--accent-ink); }
  .tabbar a.on .ic { filter: none; }
  body.has-nav main { padding-bottom: 3rem; }
  body.has-nav #toast { bottom: 1.25rem; }
  .savebar { bottom: 12px; }
}
@media (max-width: 480px) {
  .grid2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .team-hero { padding: 1rem; }
  .team-hero .crest { width: 52px; height: 60px; }
  .team-hero h1 { font-size: 1.6rem; }
  .token { width: 64px; }
  .token .avatar { width: 44px; height: 44px; font-size: 1rem; }
  .token.empty .slot { width: 44px; height: 44px; }
  .scores span { height: 34px; font-size: .92rem; }
}

/* ---------- the two sides of a pachanga ---------- */
.side-tag { display: inline-flex; align-items: center; font: 700 .72rem var(--body); padding: .12rem .5rem; border-radius: 6px; vertical-align: middle; }
.side-A { background: #eef3ef; color: #0a120e; }
.side-B { background: #050806; color: #edf6ef; box-shadow: inset 0 0 0 1px #3a5246; }
.seg { display: inline-flex; gap: 3px; }
.seg label { position: relative; margin: 0; }
.seg input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.seg span {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 9px;
  font: 700 .85rem var(--display); cursor: pointer; opacity: .35;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.seg span.side-A { background: #eef3ef; color: #0a120e; border-color: transparent; }
.seg span.side-B { background: #050806; color: #edf6ef; border-color: #3a5246; }
.seg input:checked + span { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.sides .card { margin-bottom: 0; padding: .9rem; }
.side-col.winner { border-color: rgba(200, 245, 60, .45); background: linear-gradient(180deg, rgba(200, 245, 60, .08), transparent 60%), var(--surface); }
.side-score { font: 800 2rem var(--display); line-height: 1; }
.side-col .list > li { padding: .5rem 0; gap: .5rem; }
.side-col .pts { font-size: 1.1rem; }
.sides + .section-title { margin-top: 1.5rem; }
.statgrid th, .statgrid td { padding: .45rem .2rem; }
.statgrid .avatar { display: none; }
.statgrid td input[type=number] { width: 2.9rem; padding: .45rem .2rem; }
.statgrid .seg span { width: 1.9rem; height: 1.9rem; }
@media (min-width: 481px) { .statgrid .avatar { display: grid; } .statgrid td input[type=number] { width: 3.6rem; } }

/* ---------- photos & profile ---------- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-link { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-weight: 600; font-size: .9rem; }
.me-link .avatar { box-shadow: 0 0 0 2px var(--accent); }
.photo-edit { position: relative; display: inline-block; margin: 0 auto .75rem; cursor: pointer; }
.photo-edit .avatar { margin: 0; }
.photo-btn {
  position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 3px var(--surface);
}
.photo-btn .ic { width: 17px; height: 17px; }
.quote { color: var(--muted); font-style: italic; margin: .2rem 0 .5rem; }

/* ---------- installed app ---------- */
.topbar { padding-top: calc(.75rem + env(safe-area-inset-top)); }
.install .card-head h3 { display: flex; align-items: center; gap: .45rem; }
.steps-ios { margin: 0 0 .6rem; padding-left: 1.2rem; }
.steps-ios li { margin-bottom: .35rem; }
.kbd { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--surface-3); vertical-align: middle; color: #4aa3ff; }
.kbd .ic { width: 16px; height: 16px; }

/* ---------- squad ---------- */
.squad-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.squad-item { display: inline-flex; align-items: center; gap: .45rem; padding: .22rem .7rem .22rem .22rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; }
.squad-item .avatar { width: 28px; height: 28px; font-size: .72rem; }
.squad-side + .squad-side { margin-top: .9rem; }
.squad-side > .side-tag, .squad-side > .muted { display: inline-block; margin-bottom: .45rem; }
.seg span.side-X { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-family: var(--body); font-size: .72rem; }
#squadForm .seg span { width: 2.2rem; }

/* ---------- judge election ---------- */
.pick-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.pick-chip { position: relative; margin: 0; }
.pick-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pick-chip > span {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  padding: .25rem .8rem .25rem .25rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: .88rem;
}
.pick-chip .avatar { width: 28px; height: 28px; font-size: .72rem; }
.pick-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pick-chip input:disabled + span { opacity: .4; cursor: not-allowed; }
.pick-chip input:focus-visible + span { outline: 2px solid var(--accent); }
.sides-sum { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 0; padding: .55rem; border-radius: 10px; background: var(--surface-2); font-family: var(--display); font-size: 1.15rem; }

/* ---------- notifications & everyone's lineups ---------- */
.push-kinds { display: grid; gap: .55rem; }
.check { display: flex; align-items: center; gap: .6rem; font-size: .92rem; cursor: pointer; }
.check input { flex: none; }
.most-picked { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0 0 .6rem; font-size: .85rem; }
.most-picked .chip b { color: var(--accent); margin-left: .2rem; }
.list.lineups li { display: block; }
.lineup-row { display: flex; align-items: flex-start; gap: .7rem; cursor: pointer; }
.lineup-row .chev { flex: none; align-self: center; color: var(--muted); transform: rotate(-90deg); transition: transform .2s; }
.lineup-row .chev .ic { width: 1rem; height: 1rem; }
li.open .lineup-row .chev { transform: rotate(90deg); }
.lineup-pitch:not(:empty) { margin-top: .8rem; }
.signup-bar { margin: .2rem 0 .6rem; }
.squad-item.me { border-color: var(--accent); color: var(--accent); }
.squad-side.reserves { margin-top: .9rem; opacity: .8; }

/* ---------- porra, balón de playa, logros ---------- */
.vote-toggles { display: inline-flex; gap: .3rem; flex: none; }
.mvp-toggle.beach input:checked + span { background: #4fc3f7; border-color: #4fc3f7; color: #04293a; }
.porra-inputs { display: flex; align-items: flex-end; justify-content: center; gap: .8rem; margin: .4rem 0 1rem; }
.porra-inputs label { display: grid; gap: .3rem; text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); }
.porra-inputs input { width: 4.5rem; text-align: center; font: 800 1.8rem var(--display); padding: .3rem; }
.porra-inputs .dash { font: 800 1.8rem var(--display); color: var(--muted); padding-bottom: .4rem; }
details.porra > summary { cursor: pointer; list-style: none; }
details.porra > summary::-webkit-details-marker { display: none; }
details.porra[open] > summary { margin-bottom: .6rem; }
.beach-card {
  display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; margin-bottom: 1rem; border-radius: var(--radius);
  background: radial-gradient(300px 120px at 0 50%, rgba(79, 195, 247, .22), transparent 70%), var(--surface);
  border: 1px solid rgba(79, 195, 247, .4);
}
.beach-card .beach-ball { font-size: 1.8rem; }
.beach-card .grow { flex: 1; min-width: 0; display: grid; }
.beach-card .label { font: 700 .72rem var(--display); letter-spacing: .18em; text-transform: uppercase; color: #4fc3f7; }
.beach-card b { font: 800 1.3rem var(--display); text-transform: uppercase; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.badge { position: relative; display: grid; justify-items: center; gap: .2rem; text-align: center; padding: .8rem .5rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); opacity: .55; }
.badge.on { opacity: 1; border-color: rgba(200, 245, 60, .45); background: radial-gradient(160px 80px at 50% 0, var(--accent-soft), transparent 70%), var(--surface-2); }
.badge:not(.on) .badge-icon { filter: grayscale(1); }
.badge-icon { font-size: 1.8rem; line-height: 1.2; }
.badge b { font: 700 .95rem var(--display); text-transform: uppercase; letter-spacing: .02em; }
.badge small { color: var(--muted); font-size: .72rem; line-height: 1.3; }
.badge .bar { width: 80%; height: 5px; margin-top: .3rem; }
.badge-kind { position: absolute; top: .4rem; right: .4rem; font-size: .6rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.closes-at { margin: 0 0 .8rem; padding: .5rem .75rem; border-radius: 10px; background: rgba(255, 197, 61, .1); color: var(--gold); font-size: .88rem; }
.list.awards > li { gap: .65rem; }
.award-icon { font-size: 1.4rem; width: 1.8rem; text-align: center; flex: none; }
.award .grow { display: grid; }
.award .sub { font: 700 .7rem var(--display); letter-spacing: .14em; text-transform: uppercase; }
.award-champion .sub, .award-gold .sub { color: var(--gold); }
.award-revelation .sub { color: #7fdcff; }
.award-copper .sub { color: #d98b5f; }
details.past-season > summary { cursor: pointer; list-style: none; }
details.past-season > summary::-webkit-details-marker { display: none; }
details.past-season[open] > summary { margin-bottom: .6rem; }

/* ---------- match tabs & to-do ---------- */
.subtabs { position: sticky; top: calc(3.6rem + env(safe-area-inset-top)); z-index: 5; display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none;
  margin: 0 -1rem .9rem; padding: .45rem 1rem; background: color-mix(in srgb, var(--bg) 92%, transparent); }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { position: relative; flex: none; padding: .5rem .95rem; border-radius: 999px; font-size: .88rem; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.subtabs button.on { background: var(--accent); border-color: var(--accent); color: #0a120e; }
.dot-pending { position: absolute; top: .3rem; right: .35rem; width: 7px; height: 7px; border-radius: 50%; background: #ff6b6b; box-shadow: 0 0 0 2px var(--surface-2); }
.subtabs button.on .dot-pending { box-shadow: 0 0 0 2px var(--accent); }
.todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.todo-list li { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: .92rem; }
.todo-list li[data-tab] { cursor: pointer; }
.todo-list li:not(.done):not(.wait) { border-color: rgba(200, 245, 60, .45); }
.todo-list li.done { color: var(--muted); font-weight: 500; }
.todo-list li.wait { color: var(--muted); border-style: dashed; }
.todo-check { flex: none; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--surface-3); font-size: 1rem; }
.todo-list li.done .todo-check { background: var(--accent); color: #0a120e; }
.todo-list li.done .todo-check .ic { width: 1rem; height: 1rem; }
.todo-list .chev { color: var(--accent); }
.todo.all-done { padding-bottom: .8rem; }
.todo.all-done .todo-list { display: none; }
.todo.all-done .card-head { margin: 0; }

/* ---------- home dashboard ---------- */
.dash { padding-top: .9rem; }
.dash-head { display: flex; align-items: center; gap: .8rem; color: inherit; text-decoration: none; }
.dash-head .grow { flex: 1; min-width: 0; }
.dash-head .vs { font: 800 1.35rem var(--display); text-transform: uppercase; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-head .sub { font-size: .8rem; color: var(--muted); }
.dash-rank { display: grid; justify-items: end; line-height: 1.1; }
.dash-rank b { font: 800 1.8rem var(--display); color: var(--accent); }
.dash-rank small { color: var(--muted); font-size: .75rem; }
.dash .section-title { margin: 1rem 0 .5rem; }
.dash-next { display: flex; align-items: center; gap: .8rem; padding: .75rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.dash-next .grow { flex: 1; min-width: 0; display: grid; gap: .25rem; }
.dash-next .vs { font: 700 1.15rem var(--display); text-transform: uppercase; }
.dash-next .sub { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.dash-signup { display: flex; align-items: center; gap: .5rem; }
.dash-signup .bar { flex: 1; height: 6px; }
.dash-signup small { color: var(--muted); font-weight: 700; }
.dash-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.dash-chips .chip { display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .75rem; font-size: .82rem; text-decoration: none; color: inherit; }
.dash-chips .chip.todo { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dash-chips .chip.done { color: var(--muted); }
.dash-chips .chip .ic { width: .85rem; height: .85rem; }
.dash-empty { margin: 0; }
.dash-last { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .88rem; color: inherit; text-decoration: none; }
.new-badges { border-color: rgba(255, 197, 61, .5); background: radial-gradient(300px 120px at 50% 0, rgba(255, 197, 61, .2), transparent 70%), var(--surface); }
.new-badges h3 { margin-top: 0; }

/* ---------- loading, transitions, confetti ---------- */
.skel { border-radius: var(--radius); margin-bottom: .9rem; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 45%, var(--surface) 65%); background-size: 300% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.enter { animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }
@media (prefers-reduced-motion: reduce) {
  .enter, .skel { animation: none; }
}
.todo-list .grow { flex: 1; min-width: 0; }
@media (max-width: 420px) { .subtabs button { padding: .45rem .75rem; font-size: .82rem; } }

/* Lineup bench */
.bench-strip { display: flex; align-items: center; gap: .6rem; margin: -.4rem 0 1rem; padding: .7rem .8rem; border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface-2); border: 1px dashed var(--line); overflow-x: auto; }
.bench-label { font-size: .78rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.bench-strip .token { flex: none; }
.bench-strip .token.in { outline: 2px solid var(--accent); border-radius: 12px; }
.armband.sub { background: var(--accent); color: var(--accent-ink); }
.pitch .token.out { opacity: .4; filter: grayscale(1); }
.bench-help { font-size: .82rem; margin: .2rem .2rem 1rem; }
.bench-tag { color: var(--accent); }
.chip.bench { border-style: dashed; opacity: .75; }
.chip.bench.in { opacity: 1; border-color: var(--accent); }
.chip.out { text-decoration: line-through; opacity: .5; }

/* Auth extras and legal links */
.forgot { text-align: right; margin: -.4rem 0 .9rem; font-size: .85rem; }
.legal-note { font-size: .78rem; color: var(--muted); text-align: center; margin: .8rem 0 0; }
.legal-links { text-align: center; font-size: .8rem; color: var(--muted); margin: 2rem 0 .5rem; }
.legal-links a { color: var(--muted); }
.delete-account { margin-top: 1.5rem; }
.delete-account summary { cursor: pointer; color: var(--danger); font-weight: 600; }
.delete-account form { margin-top: .8rem; }
