:root {
  --navy: #1E1A78;
  --plum: #2B1B49;
  --gold: #F0A830;
  --violet: #6E4BC4;
  --page: #f7f4ec;
  --outer: #e9e5da;
  --line: #e8e5dc;
  --muted: #8a8676;
  --body: #4d5366;
  --cream: #fbf3dc;
  --pen: #c0392b;
  --pen-text: #a0392f;
  --pen-bg: #fbe7e3;
  --win: #69b56a;
  --loss: #e45b4f;
  --draw: #c9c4b6;
  --display: 'Anton', Impact, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Hanken Grotesk', system-ui, sans-serif; -webkit-font-smoothing: antialiased; background: var(--outer); color: var(--body); }
a { color: var(--navy); }
a:hover { color: var(--violet); }
button { font-family: inherit; }
button:focus-visible, [role="button"]:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }

/* ---------- Layout ---------- */
.outer { min-height: 100vh; display: flex; justify-content: center; background: var(--outer); }
.shell {
  width: 100%; max-width: 440px; background: var(--page); min-height: 100vh;
  box-shadow: 0 0 40px rgba(10,15,40,.08);
  display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto;
  grid-template-areas: "head" "main" "league" "foot"; align-content: start;
}
.area-head { grid-area: head; min-width: 0; }
.area-main { grid-area: main; min-width: 0; }
.area-league { grid-area: league; align-self: start; padding: 18px 14px 8px; }
.area-foot { grid-area: foot; }

/* ---------- Header ---------- */
.header { background: var(--navy); padding: 16px 18px 22px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.roundel { width: 44px; height: 44px; display: block; flex-shrink: 0; }
.wordmark { display: flex; flex-direction: column; line-height: 1; }
.wm-1 { font-family: var(--display); color: #fff; font-size: 16px; letter-spacing: 1px; }
.wm-2 { color: var(--gold); font-size: 9px; font-weight: 700; letter-spacing: 3px; margin-top: 3px; }
.league-label { color: rgba(255,255,255,.7); font-size: 12px; font-weight: 600; text-align: right; line-height: 1.35; }
.title-block { margin-top: 22px; }
.eyebrow { font-weight: 700; font-size: 11.5px; letter-spacing: 2.5px; color: var(--gold); text-transform: uppercase; }
.div-title { font-family: var(--display); font-weight: 400; color: #fff; font-size: 44px; line-height: .95; margin: 6px 0 0; letter-spacing: .5px; text-transform: uppercase; }

/* Division chips */
.chips { display: flex; flex-wrap: nowrap; gap: 8px; margin: 18px -18px 0; padding: 0 18px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 1 0 124px; text-align: left; border: 1.5px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); border-radius: 14px; padding: 10px 12px; cursor: pointer; min-height: 56px; }
.chip-label { font-family: var(--display); font-size: 15px; letter-spacing: .5px; color: #fff; }
.chip-info { font-size: 12px; font-weight: 700; margin-top: 2px; line-height: 1.3; color: rgba(255,255,255,.7); }
.chip.on { background: var(--gold); border-color: var(--gold); }
.chip.on .chip-label { color: var(--navy); }
.chip.on .chip-info { color: var(--plum); }

/* ---------- Our team card ---------- */
.spot-wrap { padding: 0 14px 16px; margin-top: -2px; background: var(--navy); }
.spot { background: var(--plum); border-radius: 20px; padding: 18px; color: #fff; }
.toggle { display: flex; gap: 4px; background: rgba(255,255,255,.08); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.toggle button { flex: 1; border: 0; min-height: 36px; border-radius: 999px; font-weight: 700; font-size: 13px; cursor: pointer; background: transparent; color: #fff; }
.toggle button.on { background: var(--gold); color: var(--navy); }
.spot-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.spot-kicker { color: var(--gold); font-weight: 700; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }
.spot-name { font-weight: 800; font-size: 19px; margin-top: 4px; line-height: 1.2; }
.spot-stats { color: rgba(255,255,255,.7); font-size: 13px; margin-top: 6px; font-weight: 600; }
.spot-pos { text-align: right; flex-shrink: 0; }
.spot-pos-n { font-family: var(--display); color: var(--gold); font-size: 46px; line-height: .9; }
.spot-pts { color: rgba(255,255,255,.75); font-weight: 700; font-size: 12px; margin-top: 4px; }
.form-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.form-label { color: rgba(255,255,255,.55); font-size: 11.5px; font-weight: 700; letter-spacing: 1px; margin-right: 2px; }
.form-none { color: rgba(255,255,255,.55); font-size: 13px; font-weight: 600; }
.res { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; }
.res-W { background: var(--win); color: #fff; }
.res-L { background: var(--loss); color: #fff; }
.res-D { background: var(--draw); color: var(--plum); }
.next { margin-top: 16px; background: rgba(255,255,255,.08); border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.next-kicker { color: rgba(255,255,255,.55); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; }
.next-opp { font-weight: 700; font-size: 15px; margin-top: 2px; }
.next-when { text-align: right; flex-shrink: 0; }
.next-date { color: var(--gold); font-weight: 800; font-size: 14px; }
.next-venue { color: rgba(255,255,255,.6); font-size: 12px; font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs-bar { position: sticky; top: 0; z-index: 5; background: var(--page); padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; background: #ece8dc; border-radius: 999px; padding: 4px; }
.tabs button { border: 0; cursor: pointer; min-height: 44px; border-radius: 999px; font-weight: 700; font-size: 14px; background: transparent; color: var(--navy); }
.tabs button.on { background: var(--navy); color: #fff; }
.filters { display: flex; gap: 8px; margin-top: 10px; }
.filters button { border: 1.5px solid #d6d2c6; background: #fff; color: var(--navy); font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 999px; min-height: 36px; cursor: pointer; }
.filters button.on { border-color: var(--navy); background: var(--navy); color: #fff; }

/* ---------- Table ---------- */
.panel { padding: 14px; }
.table { background: #fff; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.trow { display: grid; grid-template-columns: 26px minmax(0,1fr) 24px 24px 24px 24px 36px 34px; gap: 2px; align-items: center; }
.trow > .c { text-align: center; }
.trow > .wide { display: none; }
.thead { padding: 11px 12px; background: var(--navy); color: #fff; font-weight: 700; font-size: 11.5px; letter-spacing: .5px; }
.thead .pts { color: var(--gold); }
.team-row { cursor: pointer; border-top: 1px solid #efece2; background: #fff; }
.team-row .trow { padding: 12px; font-size: 14px; color: var(--body); }
.team-row.k { background: var(--cream); }
.t-pos { font-family: var(--display); font-size: 16px; color: #c9c4b6; }
.team-row.k .t-pos { color: var(--gold); }
.t-team { display: flex; align-items: center; gap: 7px; min-width: 0; }
.t-name { color: #3f4458; font-weight: 600; line-height: 1.25; text-wrap: pretty; overflow-wrap: break-word; hyphens: auto; }
.team-row.k .t-name { color: var(--navy); font-weight: 800; }
.t-pts { font-weight: 800; color: var(--navy); font-size: 15px; }
.pen-star { color: var(--pen); font-weight: 800; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.row-detail { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 0 12px 14px 47px; }
.row-detail > div { background: var(--page); border-radius: 10px; padding: 8px 10px; }
.rd-k { font-size: 11px; color: var(--muted); font-weight: 700; }
.rd-v { font-weight: 800; color: var(--navy); font-size: 16px; }
.rd-form { letter-spacing: 1px; }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 12px 4px 0; }

/* ---------- Match lists ---------- */
.lists { padding: 6px 14px 14px; }
.group { margin-top: 14px; }
.group-head { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; }
.group-date { font-weight: 800; font-size: 13px; color: var(--navy); letter-spacing: .3px; }
.tag-next { background: var(--gold); color: var(--navy); font-weight: 800; font-size: 10.5px; letter-spacing: 1px; padding: 3px 8px; border-radius: 999px; }
.match-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.match { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.match.k { background: var(--cream); border-color: var(--gold); }
.m-row { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 10px; align-items: center; }
.m-side { display: flex; align-items: center; gap: 7px; min-width: 0; }
.m-side.home { justify-content: flex-end; text-align: right; }
.m-name { color: var(--body); font-weight: 500; font-size: 14px; line-height: 1.25; text-wrap: pretty; overflow-wrap: break-word; hyphens: auto; }
.m-name.won { color: var(--plum); font-weight: 700; }
.m-name.k { color: var(--navy); font-weight: 800; }
.m-score { display: flex; align-items: center; gap: 4px; }
.score { min-width: 34px; min-height: 34px; text-align: center; font-family: var(--display); font-size: 20px; color: #c9c4b6; background: #f4f1e8; border-radius: 8px; padding: 3px 4px; }
.score.played { color: var(--navy); }
.match.k .score.played { background: var(--navy); color: var(--gold); }
.m-v { font-size: 11px; font-weight: 700; color: #a29d8d; }
.m-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.badge { font-weight: 800; font-size: 11px; letter-spacing: 1px; padding: 3px 9px; border-radius: 999px; }
.badge.res-W, .badge.res-L, .badge.res-D { width: auto; height: auto; }
.pen-pill { color: var(--pen-text); background: var(--pen-bg); font-weight: 700; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; }
.empty { color: var(--muted); text-align: center; font-size: 14px; padding: 30px 0; }

/* ---------- League switcher ---------- */
.sw-kicker { font-weight: 700; font-size: 11.5px; letter-spacing: 2.5px; color: var(--violet); text-transform: uppercase; margin: 0 4px 10px; }
.sw { border-radius: 18px; border: 1.5px solid var(--navy); background: #fff; overflow: hidden; }
.sw-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; cursor: pointer; min-height: 64px; padding: 12px 14px; border: 0; background: var(--navy); }
.sw-name { display: block; font-weight: 800; font-size: 15px; color: #fff; line-height: 1.25; }
.sw-meta { display: block; font-size: 12.5px; font-weight: 600; margin-top: 3px; color: rgba(255,255,255,.7); }
.chev { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; transition: transform .2s; }
.sw-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.sw-list { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.sw-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; cursor: pointer; min-height: 60px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; }
.sw-item:hover { background: var(--cream); border-color: var(--gold); }
.sw-item .sw-name { color: var(--navy); }
.sw-item .sw-meta { color: var(--muted); }
.sw-view { flex-shrink: 0; font-weight: 800; font-size: 11px; letter-spacing: 1px; padding: 4px 10px; border-radius: 999px; background: #f4f1e8; color: var(--navy); }

/* ---------- Footer ---------- */
.area-foot { background: var(--plum); padding: 22px 18px; margin-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.foot-name { font-family: var(--display); color: #fff; font-size: 15px; letter-spacing: 1px; }
.foot-meta { color: rgba(255,255,255,.5); font-size: 11.5px; text-align: right; line-height: 1.5; }
.foot-meta a { color: rgba(255,255,255,.7); }
.foot-meta a:hover { color: var(--gold); }

/* Very narrow phones: give the team column more room */
@media (max-width: 359px) {
  .trow { grid-template-columns: 22px minmax(0,1fr) 20px 20px 20px 20px 32px 30px; }
  .team-row .trow, .thead { padding-left: 10px; padding-right: 10px; }
}

/* ---------- Tablet: 700–1023px ---------- */
@media (min-width: 700px) {
  .shell { max-width: 820px; }
  .chips { flex-wrap: wrap; }
  .trow { grid-template-columns: 34px minmax(0,1fr) 40px 40px 40px 40px 44px 44px 48px 46px; }
  .trow > .wide { display: block; }
  .match-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* ---------- Desktop: 1024px and up ---------- */
@media (min-width: 1024px) {
  .shell {
    max-width: 1240px; grid-template-columns: 420px minmax(0,1fr); grid-template-rows: auto 1fr auto;
    grid-template-areas: "head main" "league main" "foot foot";
  }
  .area-main { padding: 8px 20px 24px; }
}
