/* Layout: one mobile column; sticky club bar, week stepper, team chips, then
   each field drawn as a mown pitch with chalk-lined training squares. */
:root {
  --bg: #f3f6f2;
  --surface: #ffffff;
  --fg: #16231b;
  --muted: #5b6b61;
  --line: #d6dfd8;
  --accent: #1f5a37;          /* club bar, active states */
  --accent-fg: #ffffff;
  --turf-a: #3f8a4f;
  --turf-b: #38804a;
  --chalk: rgba(255, 255, 255, .78);
  --empty: rgba(255, 255, 255, .16);
  --focus: #f2b233;
  /* age groups */
  --o7: #f2b233;  --o7-fg: #2b1f00;
  --o8: #e8f0ff;  --o8-fg: #12306b;
  --o9: #f4d6ef;  --o9-fg: #5a1450;
  --o10: #ffd9cc; --o10-fg: #6b1d05;
  --hi: #111a14; --hi-fg: #ffe27a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1511; --surface: #16211b; --fg: #e6efe8; --muted: #93a79a; --line: #26352c;
    --accent: #2f7a4d; --accent-fg: #ffffff;
    --turf-a: #24583a; --turf-b: #205234; --chalk: rgba(255,255,255,.55); --empty: rgba(255,255,255,.08);
    --o8: #cfe0ff; --o9: #efc6e8; --o10: #ffcab8;
    --hi: #ffe27a; --hi-fg: #111a14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1511; --surface: #16211b; --fg: #e6efe8; --muted: #93a79a; --line: #26352c;
  --accent: #2f7a4d; --accent-fg: #ffffff;
  --turf-a: #24583a; --turf-b: #205234; --chalk: rgba(255,255,255,.55); --empty: rgba(255,255,255,.08);
  --o8: #cfe0ff; --o9: #efc6e8; --o10: #ffcab8;
  --hi: #ffe27a; --hi-fg: #111a14;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.4 var(--font);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* club bar */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--accent); color: var(--accent-fg);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.brand { display: flex; align-items: center; gap: 12px; max-width: 640px; width: 100%; margin: 0 auto; }
.crest {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 2px solid var(--accent-fg); font: 800 15px/1 var(--font-num); letter-spacing: -.5px;
}
h1 { margin: 0; font-size: 19px; line-height: 1.1; letter-spacing: .2px; }
.sub { margin: 2px 0 0; font-size: 13px; opacity: .85; }
.days { display: flex; gap: 6px; max-width: 640px; width: 100%; margin: 0 auto; overflow-x: auto; }
.days button {
  border: 1px solid rgba(255,255,255,.5); background: transparent; color: var(--accent-fg);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; white-space: nowrap;
}
.days button[aria-pressed="true"] { background: var(--accent-fg); color: var(--accent); }

main { max-width: 640px; margin: 0 auto; padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 14px; }

/* week stepper */
.weekbar { display: grid; grid-template-columns: 48px 1fr 48px; gap: 8px; align-items: stretch; }
.nav {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r);
  font-size: 28px; line-height: 1; min-height: 56px;
}
.nav:disabled { opacity: .35; cursor: default; }
.weekinfo {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 6px 8px; min-width: 0; position: relative;
}
.wk { font: 800 20px/1.1 var(--font-num); font-variant-numeric: tabular-nums; }
.date { font-size: 13px; color: var(--muted); }
.badge {
  position: absolute; top: -8px; right: 10px;
  background: var(--o7); color: var(--o7-fg);
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
}
.badge.past { background: var(--line); color: var(--muted); }

/* team chips */
.teams-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 0; font-size: 13px; }
.chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px;
  scroll-snap-type: x proximity; scrollbar-width: thin;
}
.chip {
  flex: none; scroll-snap-align: start;
  border: 1px solid transparent; border-radius: 999px;
  padding: 7px 12px; font: 700 14px/1 var(--font-num); font-variant-numeric: tabular-nums;
}
.chip[aria-selected="true"] { background: var(--hi) !important; color: var(--hi-fg) !important; }

.age-O7  { background: var(--o7);  color: var(--o7-fg); }
.age-O8  { background: var(--o8);  color: var(--o8-fg); }
.age-O9  { background: var(--o9);  color: var(--o9-fg); }
.age-O10 { background: var(--o10); color: var(--o10-fg); }
.age-x   { background: var(--line); color: var(--fg); }

/* spotlight for selected team */
.spot {
  background: var(--hi); color: var(--hi-fg); border-radius: var(--r);
  padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.spot .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spot .who { font-size: 13px; opacity: .85; }
.spot .where { font: 800 26px/1.1 var(--font-num); }
.spot .where.none { font-size: 18px; }
.spot .next { font-size: 13px; opacity: .85; margin-top: 4px; }
.spot .share {
  flex: none; border: 1.5px solid currentColor; background: transparent; color: inherit;
  border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px;
}

/* tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.tabs button { border: 0; background: transparent; border-radius: 9px; padding: 8px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* pitches */
.map { display: grid; gap: 12px; }
@media (min-width: 560px) { .map { grid-template-columns: 1fr 1fr; } .map .pitch.wide { grid-column: 1 / -1; } }
.pitch { display: flex; flex-direction: column; gap: 6px; }
.pitch h2 {
  margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between;
}
.pitch h2 .count { font-weight: 500; letter-spacing: 0; text-transform: none; }
.turf {
  position: relative; border-radius: 10px; padding: 8px;
  background: repeating-linear-gradient(90deg, var(--turf-a) 0 24px, var(--turf-b) 24px 48px);
}
.grid {
  position: relative; display: grid; gap: 0;
  border: 2px solid var(--chalk); border-radius: 3px;
}
.cell {
  min-height: 66px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-right: 2px dashed var(--chalk); border-bottom: 2px dashed var(--chalk);
  background: transparent; border-top: 0; border-left: 0; border-radius: 0;
  min-width: 0;
}
.cell.lastcol { border-right: 0; }
.cell.lastrow { border-bottom: 0; }
.cell .code { font: 700 11px/1 var(--font-num); color: var(--chalk); letter-spacing: .5px; }
.cell .team {
  font: 800 15px/1 var(--font-num); padding: 5px 8px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.cell.free { background: var(--empty); }
.cell.free .team { background: transparent; box-shadow: none; color: var(--chalk); font-weight: 500; font-size: 13px; }
.cell.me { background: rgba(255, 226, 122, .28); }
.cell.me .team { background: var(--hi); color: var(--hi-fg); outline: 2px solid var(--hi-fg); animation: pop .5s ease-out; }
.cell.dim .team { opacity: .55; }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .cell.me .team { animation: none; } }

.hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* season list */
.season-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.season-head strong { font-size: 17px; }
.tally { display: flex; flex-wrap: wrap; gap: 6px; }
.tally span { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.rows li + li { border-top: 1px solid var(--line); }
.rows button {
  width: 100%; border: 0; background: transparent; text-align: left;
  display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px;
}
.rows .w { font: 800 15px/1 var(--font-num); font-variant-numeric: tabular-nums; }
.rows .d { color: var(--muted); font-size: 13px; }
.rows .f { font: 800 15px/1 var(--font-num); background: var(--turf-a); color: #fff; padding: 5px 10px; border-radius: 8px; min-width: 64px; text-align: center; }
.rows li.past { opacity: .5; }
.rows li.next button { background: rgba(242, 178, 51, .18); }
.rows li.sel button { box-shadow: inset 4px 0 0 var(--accent); }
.empty { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }

.err { background: #fde2e1; color: #6b0f0c; padding: 12px; border-radius: var(--r); }
.foot { max-width: 640px; margin: 0 auto; padding: 0 16px 24px; font-size: 12px; color: var(--muted); text-align: center; }
