/* SPORTZ mobile — one design for iOS and Android, light + dark (follows the phone, can be fixed in settings) */
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(../fonts/source-sans-3-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(../fonts/source-sans-3-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --brand: #DB0022; --brand-ink: #FFFFFF;
  --bg: #F2F3F5; --card: #FFFFFF; --text: #111418; --sub: #5B6470; --muted: #3A414B; --line: #E3E5E9; --row: #EEF0F2;
  --pill: #E3E5E9; --pill-text: #3A414B; --sel: #111418; --sel-text: #FFFFFF; --accent: #DB0022; --dash: #B8BEC6;
  --nav: rgba(255,255,255,.94); --track: #EEF0F2; --yellow: #F2B705; --red: #E03A2F; --green: #1E8E4B; --home: #DB0022; --away: #1D4ED8;
  --demo: #FFF4CC; --demo-text: #6B4E00; --shadow: 0 1px 2px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1014; --card: #1A1D23; --text: #F2F4F7; --sub: #A3ACB8; --muted: #C9CFD6; --line: #2A2F37; --row: #262A31;
    --pill: #23272E; --pill-text: #C9CFD6; --sel: #F2F4F7; --sel-text: #0E1014; --accent: #FF5A67; --dash: #4A515B;
    --nav: rgba(20,22,27,.94); --track: #2A2F37; --away: #4F7BFF; --demo: #3A2F0A; --demo-text: #F5D97A; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1014; --card: #1A1D23; --text: #F2F4F7; --sub: #A3ACB8; --muted: #C9CFD6; --line: #2A2F37; --row: #262A31;
  --pill: #23272E; --pill-text: #C9CFD6; --sel: #F2F4F7; --sel-text: #0E1014; --accent: #FF5A67; --dash: #4A515B;
  --nav: rgba(20,22,27,.94); --track: #2A2F37; --away: #4F7BFF; --demo: #3A2F0A; --demo-text: #F5D97A; --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.3;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto;
  padding-top: env(safe-area-inset-top); }

/* top bar */
.top { height: 60px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0;
  z-index: 5; background: var(--bg); }
.top .logo { height: 19px; width: auto; color: var(--brand); }
.top .acts { display: flex; align-items: center; gap: 8px; }
.livebtn { height: 36px; padding: 0 12px; border-radius: 18px; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 14px;
  letter-spacing: .6px; display: flex; align-items: center; gap: 6px; }
.livebtn .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.livebtn .n { background: rgba(255,255,255,.25); border-radius: 9px; padding: 0 6px; min-width: 18px; text-align: center; }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; background: var(--card); display: flex; align-items: center; justify-content: center; color: var(--text); }
.iconbtn svg { width: 20px; height: 20px; }
.back { display: flex; align-items: center; gap: 4px; height: 44px; padding-right: 8px; font-weight: 600; color: var(--text); }
.back svg { width: 22px; height: 22px; }

main { flex: 1; padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }
.demo-bar { margin: 0 16px 8px; padding: 6px 12px; border-radius: 10px; background: var(--demo); color: var(--demo-text); font-size: 14px; font-weight: 600; }

/* cards & lists */
.card { background: var(--card); border-radius: 20px; padding: 6px 16px; box-shadow: var(--shadow); }
.card + .card, .card + .sect, .sect + .card { margin-top: 12px; }
.sect { margin: 16px 0 8px; font-size: 14px; font-weight: 700; letter-spacing: .2px; color: var(--sub);
  display: flex; align-items: center; gap: 8px; }
.sect img { width: 18px; height: 18px; object-fit: contain; }
.sect.cap { font-size: 13px; letter-spacing: .9px; }
.empty { padding: 28px 8px; text-align: center; color: var(--sub); font-size: 16px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.err { color: var(--accent); }
.foot { margin: 10px 4px 0; font-size: 13px; color: var(--sub); }

/* match rows (lists) */
.mrow { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 64px; padding: 8px 0;
  border-bottom: 1px solid var(--row); width: 100%; text-align: left; }
.mrow:last-child { border-bottom: 0; }
.mrow .st { font-size: 15px; font-weight: 700; color: var(--sub); text-align: center; }
.mrow .st.live { color: var(--accent); }
.mrow .st.bad { color: var(--accent); font-size: 12px; }
.mrow .tm { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mrow .t { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; min-width: 0; }
.mrow .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .t img { width: 20px; height: 20px; object-fit: contain; flex: none; }
.mrow .sc { display: flex; flex-direction: column; gap: 4px; font-size: 17px; font-weight: 800; text-align: right; min-width: 24px; }
.mrow .ht { font-size: 12px; font-weight: 600; color: var(--sub); text-align: right; }
.mrow .sc .w { color: var(--text); } .mrow .sc .l { color: var(--sub); }

/* segmented chips */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; background: var(--pill); color: var(--pill-text); font-weight: 600; font-size: 15px;
  flex: none; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--sel); color: var(--sel-text); font-weight: 700; }
.chips.sticky { position: sticky; top: 60px; z-index: 4; background: var(--bg); }

/* match header */
.mh { background: var(--card); border-radius: 20px; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.mh .lg { font-size: 14px; color: var(--sub); font-weight: 600; text-align: center; }
.mh .row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.mh .team { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.mh .team img { width: 48px; height: 48px; object-fit: contain; }
.mh .team span { font-size: 18px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.mh .mid { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 110px; }
.mh .score { font-size: 48px; font-weight: 800; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; }
.mh .score i { font-style: normal; color: var(--dash); margin: 0 8px; }
.mh .score.ns { font-size: 34px; letter-spacing: 0; }
.mh .min { font-size: 16px; font-weight: 700; color: var(--sub); }
.mh .min.live { color: var(--accent); }
.mh .htl { font-size: 13px; font-weight: 600; color: var(--sub); }
.mh .scorers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 14px; color: var(--sub); }
.mh .scorers div:last-child { text-align: right; }
.mh .scorers p { margin: 0 0 2px; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { color: var(--accent); transform: scale(1.08); } 100% { transform: none; } }

/* stats */
.srow { padding: 10px 0; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--row); }
.srow:last-child { border-bottom: 0; }
.srow .nums { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; }
.srow .v { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.srow .v.r { text-align: right; }
.srow .v.lo { color: var(--sub); font-weight: 700; }
.srow .lb { font-size: 15px; font-weight: 600; color: var(--muted); text-align: center; }
.srow .bars { display: flex; gap: 4px; height: 6px; }
.srow .bars i { flex: 1; background: var(--track); border-radius: 3px; overflow: hidden; display: flex; }
.srow .bars i:first-child { justify-content: flex-end; }
.srow .bars b { display: block; height: 100%; border-radius: 3px; }

/* events */
.ev { display: grid; grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr); align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--row); }
.ev:last-child { border-bottom: 0; }
.ev .m { text-align: center; font-weight: 800; color: var(--sub); font-size: 15px; }
.ev .m.g { color: var(--accent); }
.ev .s { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 15px; }
.ev .s.h { justify-content: flex-end; text-align: right; }
.ev .s .tx { display: flex; flex-direction: column; min-width: 0; }
.ev .s.h .tx { align-items: flex-end; }
.ev .s b { font-weight: 700; } .ev .s small { color: var(--sub); font-size: 13px; }
.ev .ic { flex: none; display: flex; }
.sep { text-align: center; padding: 10px 0; font-size: 12px; font-weight: 700; letter-spacing: .8px; color: var(--sub); border-bottom: 1px solid var(--row); }

/* recent events on summary */
.rev { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--row); font-size: 16px; }
.rev:last-child { border-bottom: 0; }
.rev .m { font-weight: 800; color: var(--accent); width: 40px; flex: none; }
.rev .who { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rev .tm { color: var(--sub); font-size: 14px; flex: none; }

/* lineups */
.lu-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; font-size: 14px; color: var(--sub); font-weight: 600; }
.lu-h b { color: var(--text); font-size: 16px; }
.pr { display: grid; grid-template-columns: 34px 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--row); }
.pr:last-child { border-bottom: 0; }
.pr .no { font-weight: 800; font-size: 16px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.pr .ph { width: 30px; height: 30px; border-radius: 50%; background: var(--pill); object-fit: cover; }
.pr .nm { display: flex; flex-direction: column; min-width: 0; }
.pr .nm b { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr .nm small { color: var(--sub); font-size: 13px; }
.pr .tags { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--sub); }
.pr .tags span { display: flex; align-items: center; gap: 2px; }
.pr.small .nm b { font-weight: 500; color: var(--muted); }
.rtg { padding: 1px 6px; border-radius: 6px; color: #fff; font-size: 13px; font-weight: 700; }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { font-size: 12px; font-weight: 700; color: var(--sub); text-align: center; padding: 10px 2px 6px; letter-spacing: .4px; }
.tbl th.tn { text-align: left; }
.tbl td { padding: 9px 2px; text-align: center; font-size: 15px; border-top: 1px solid var(--row); }
.tbl td.rk { width: 26px; font-weight: 700; color: var(--sub); }
.tbl td.tn { text-align: left; }
.tbl td.tn div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tbl td.tn img { width: 20px; height: 20px; object-fit: contain; flex: none; }
.tbl td.tn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; font-weight: 600; }
.tbl td.pt { font-weight: 800; }
.tbl tr.me td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tbl tr.rel td { border-top: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.tbl tr.relz td.rk { color: var(--accent); }

/* leaders */
.lr { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--row); }
.lr:last-child { border-bottom: 0; }
.lr .rk { font-weight: 700; color: var(--sub); text-align: center; }
.lr .nm { display: flex; flex-direction: column; min-width: 0; }
.lr .nm b { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr .nm small { color: var(--sub); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.lr .nm small img { width: 16px; height: 16px; object-fit: contain; }
.lr .val { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* date strip */
.dates { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; margin-bottom: 4px; }
.dates .d { text-align: center; font-weight: 700; font-size: 17px; }
.dates .d small { display: block; font-weight: 600; font-size: 13px; color: var(--sub); }

/* bottom nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--nav); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.nav .in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; color: var(--sub);
  font-size: 12px; font-weight: 600; }
.nav a svg { width: 26px; height: 26px; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* sign-in */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 32px 24px calc(32px + env(safe-area-inset-bottom)); }
.login .logo { height: 26px; width: auto; color: var(--brand); align-self: flex-start; }
.login h1 { margin: 0; font-size: 26px; font-weight: 800; }
.login p { margin: 0; color: var(--sub); font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; }
.field input { height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit;
  font-size: 17px; padding: 0 14px; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.primary { height: 52px; border-radius: 14px; background: var(--brand); color: #fff; font-weight: 700; font-size: 17px; }
.primary:disabled { opacity: .6; }
.msg { min-height: 22px; font-size: 15px; }

/* settings sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; background: var(--card); border-radius: 22px 22px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px; }
.sheet h2 { margin: 0; font-size: 20px; }
.sheet .rowx { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 16px; }
.sheet .rowx small { color: var(--sub); }
.ghost { height: 48px; border-radius: 14px; background: var(--pill); font-weight: 700; color: var(--text); }
.danger { color: var(--accent); }
.status-line { font-size: 13px; color: var(--sub); text-align: center; margin-top: 12px; }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }
