/* Rugby Tracker: self-hosted stylesheet (no external fonts or scripts). Mobile first; light + dark via the device setting.
   Identity: the page is a pitch. Turf green, flag gold, chalk rules (solid = main division, dashed = secondary), condensed jersey numerals. */
@font-face { font-family: "Big Shoulders Display"; src: url("fonts/big-shoulders-display.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/atkinson-hyperlegible-next.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
:root {
  color-scheme: light dark;
  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --bg: #edf0ee; --surface: #ffffff; --surface-2: #e2e8e4; --text: #14201a; --muted: #4a5a52; --border: #c3cdc7;
  --brand: #17432f; --brand-deep: #0f2e20; --link: #17432f; --line: #17432f; /* --line: the chalk rule under titles */
  --accent: #f2b31a; --accent-ink: #14201a; --leather: #7a4a2a;
  --btn-bg: #17432f; --btn-ink: #ffffff;
  --danger: #b3261e; --danger-bg: #fdeceb; --warn: #7a4a00; --warn-bg: #fff1cc; --success: #11683a; --success-bg: #e2f5e9; --info: #1a5a8e; --info-bg: #e5f0fa;
  --chip-admin-bg: #14263f; --chip-admin-ink: #ffffff; --chip-staff-bg: #f2b31a; --chip-staff-ink: #14201a; --chip-player-bg: #d6e6dd; --chip-player-ink: #0f3d28;
  --focus: #17432f; --field-border: #667a6e; /* at least 3:1 against the surface and the page (WCAG 1.4.11, 2.4.7) */
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px; --r-pill: 999px;
  --elev-1: 0 1px 0 rgba(15, 46, 32, .08); /* cards are flat sections: a one-pixel edge, not a drop shadow */
  --tabbar-h: 66px;
  /* Scales: spacing (--s-N is N x 2px, a 2px grid), type (--fs-1 to 8), radius, elevation. CSS uses these, not literals (CssTokenTest keeps it that way). */
  --fs-1: .75rem; --fs-2: .85rem; --fs-3: .9rem; --fs-4: 1rem; --fs-5: 1.1rem; /* text: 12, 13.6, 14.4, 16 and 17.6 px */
  --fs-6: 1.5rem; --fs-7: 2.25rem; --fs-8: 3.25rem; /* condensed display: 24, 36 and 52 px (jersey numerals, fixture dates, titles) */
  --s-1: .125rem; --s-2: .25rem; --s-3: .375rem; --s-4: .5rem; --s-5: .625rem; --s-6: .75rem; --s-7: .875rem; --s-8: 1rem; --s-9: 1.125rem; --s-10: 1.25rem; --s-11: 1.375rem; --s-12: 1.5rem; --s-13: 1.625rem; --s-14: 1.75rem; --s-16: 2rem; --s-18: 2.25rem; --s-20: 2.5rem; --s-24: 3rem; --s-28: 3.5rem;
  --elev-pop: 0 12px 40px rgba(0, 0, 0, .25); --elev-bar: 0 -1px 0 rgba(15, 46, 32, .1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1712; --surface: #13241c; --surface-2: #1b3027; --text: #e8f1eb; --muted: #a3b8ab; --border: #274236;
    --link: #f2b31a; --line: #e8f1eb;
    --btn-bg: #f2b31a; --btn-ink: #14201a;
    --danger: #ff8a80; --danger-bg: #3a1714; --warn: #f5c76b; --warn-bg: #3a2a07; --success: #7be0a2; --success-bg: #12301e; --info: #8cc4f0; --info-bg: #12283a;
    --chip-admin-bg: #2a4268; --chip-admin-ink: #ffffff; --chip-staff-bg: #f2b31a; --chip-staff-ink: #14201a; --chip-player-bg: #1f3d2d; --chip-player-ink: #c4ebd3;
    --focus: #f2b31a; --field-border: #86a092;
    --elev-1: 0 1px 0 rgba(0, 0, 0, .5);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-4); line-height: 1.6; color: var(--text); background: var(--bg); min-height: 100dvh; font-feature-settings: "tnum" 1, "lnum" 1; }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: .005em; line-height: 1.05; margin: 0 0 var(--s-5); }
h1 { font-size: clamp(var(--fs-7), 1.5rem + 3.2vw, var(--fs-8)); }
h2 { font-size: clamp(var(--fs-6), 1.2rem + 1.4vw, var(--fs-7)); margin-top: var(--s-14); }
h3 { font-size: var(--fs-6); font-weight: 700; }
p { margin: 0 0 var(--s-8); }
a { color: var(--link); text-decoration-thickness: .12em; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .2em; }
small, .hint { font-size: var(--fs-3); color: var(--muted); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--surface-2); padding: .1em .4em; border-radius: var(--r-sm); overflow-wrap: anywhere; }
pre { overflow: auto; background: var(--surface-2); padding: var(--s-8); border-radius: var(--r-md); font-size: var(--fs-1); }
dl { margin: 0; } dt { font-weight: 700; color: var(--muted); font-size: var(--fs-3); margin-top: var(--s-8); } dd { margin: var(--s-1) 0 0; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.topbar :focus-visible, .hero :focus-visible, .auth-hero :focus-visible, .skip-link:focus-visible { outline-color: #fff; }
/* The sticky header, the fixed tab bar and the sticky save bar must not cover the focused element (WCAG 2.4.11). */
html { scroll-padding-top: calc(58px + env(safe-area-inset-top) + 1rem); scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8rem); }
@media (min-width: 1024px) { html { scroll-padding-bottom: 1rem; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: .75rem; top: -4rem; background: var(--accent); color: var(--accent-ink); font-weight: 800; padding: var(--s-5) var(--s-8); border-radius: var(--r-pill); z-index: 100; }
.skip-link:focus { top: .75rem; }
.hp { position: absolute; left: -9999px; }
.inline { display: inline; }
.i { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 1.15rem; height: 1.15rem; }
.i-fill { fill: currentColor; stroke: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-4); min-height: 48px; padding: var(--s-5) var(--s-11); border: 2px solid transparent; border-radius: var(--r-md);
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; background: var(--btn-bg); color: var(--btn-ink);
  transition: transform .12s ease, filter .12s ease; }
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: transparent; color: var(--link); border-color: currentColor; }
.btn-danger { background: transparent; color: var(--danger); border-color: currentColor; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: var(--s-3) var(--s-8); font-size: var(--fs-3); }
@media (pointer: coarse) { .btn-sm { min-height: 44px; } }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-5); align-items: center; }

/* ---------- forms ---------- */
.field { display: grid; gap: var(--s-3); margin-bottom: var(--s-9); }
.field > label, .field > .label, legend { font-weight: 700; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]), select, textarea {
  width: 100%; min-height: 48px; padding: var(--s-5) var(--s-7); font: inherit; font-size: var(--fs-4); /* 16px: no zoom on iOS */
  color: var(--text); background: var(--surface); border: 2px solid var(--field-border); border-radius: var(--r-md); transition: border-color .12s, box-shadow .12s; }
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); } /* the 3px outline from :focus-visible stays visible */
input[type=file] { font: inherit; width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 800; border: 2px solid var(--link); color: var(--link); background: transparent; border-radius: var(--r-pill); padding: var(--s-4) var(--s-9); margin-right: var(--s-6); cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-error { color: var(--danger); font-weight: 700; font-size: var(--fs-3); }
.field-error::before { content: "⚠ "; }
.chips-select { display: flex; flex-wrap: wrap; gap: var(--s-4); }
.chips-select label { position: relative; }
.chips-select input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.chips-select span { display: inline-flex; align-items: center; min-height: 44px; padding: var(--s-3) var(--s-8); border-radius: var(--r-pill); border: 2px solid var(--field-border); background: var(--surface); font-weight: 700; transition: background .12s, border-color .12s; }
.chips-select input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips-select input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: var(--s-6); align-items: flex-start; font-weight: 700; margin: var(--s-3) 0 var(--s-7); }
.check input { width: 1.4rem; height: 1.4rem; margin-top: var(--s-1); accent-color: var(--brand); flex: none; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-10); box-shadow: var(--elev-1); }
.card > :last-child { margin-bottom: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.stack > * + * { margin-top: var(--s-8); }
.grid { display: grid; gap: var(--s-8); }
.page-head { margin: var(--s-4) 0 var(--s-10); padding-bottom: var(--s-6); border-bottom: 3px solid var(--line); } /* the try line: one solid rule closes every page title */
.page-head p { color: var(--muted); margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: var(--s-6); align-items: center; }
.row-between { justify-content: space-between; }
.empty { padding: var(--s-16) var(--s-8); color: var(--muted); border: 2px dashed var(--border); border-radius: var(--r-md); }

.alert { display: flex; gap: var(--s-6); align-items: flex-start; padding: var(--s-7) var(--s-8); border-radius: var(--r-md); font-weight: 700; margin-bottom: var(--s-8); border: 1px solid transparent; }
.alert .i { margin-top: var(--s-1); }
h1.alert { font-size: var(--fs-5); line-height: 1.45; } /* error pages: the message is the page heading */
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

.chip { display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-6); border-radius: var(--r-pill); font-size: var(--fs-2); font-weight: 800; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.chip-admin { background: var(--chip-admin-bg); color: var(--chip-admin-ink); }
.chip-staff { background: var(--chip-staff-bg); color: var(--chip-staff-ink); }
.chip-player { background: var(--chip-player-bg); color: var(--chip-player-ink); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-3); }

.avatar { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; color: #fff; font-weight: 800; background: hsl(var(--hue, 150) 45% 28%); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--line); }
.avatar-logo { border-radius: var(--r-md); object-fit: contain; background: var(--surface); }
.avatar-sm { width: 34px; height: 34px; font-size: var(--fs-2); box-shadow: none; }
.avatar-lg { width: 96px; height: 96px; font-size: var(--fs-7); font-family: var(--font-display); }
.avatar-xl { width: 128px; height: 128px; font-size: var(--fs-8); font-family: var(--font-display); }
.hue-0 { --hue: 150; } .hue-1 { --hue: 175; } .hue-2 { --hue: 200; } .hue-3 { --hue: 225; } .hue-4 { --hue: 255; } .hue-5 { --hue: 285; }
.hue-6 { --hue: 315; } .hue-7 { --hue: 345; } .hue-8 { --hue: 15; } .hue-9 { --hue: 35; } .hue-10 { --hue: 60; } .hue-11 { --hue: 120; }

/* ---------- list rows (people, teams, clubs) ---------- */
.items { display: grid; gap: var(--s-6); grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); list-style: none; padding: 0; margin: 0; }
.item { display: flex; gap: var(--s-7); align-items: center; padding: var(--s-7); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--elev-1); color: inherit; text-decoration: none; transition: border-color .12s; }
a.item:hover { border-color: var(--line); }
.item-main { min-width: 0; flex: 1; }
.item-name { font-weight: 800; display: block; overflow-wrap: anywhere; }
.item-sub { color: var(--muted); font-size: var(--fs-2); overflow-wrap: anywhere; }
.item-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-4); }
.item-actions select { min-height: 40px; width: auto; padding: var(--s-2) var(--s-5); }

/* ---------- hero + stats ---------- */
.hero { position: relative; overflow: hidden; color: #fff; border-radius: var(--r-lg); padding: var(--s-12) var(--s-12) var(--s-18); margin: var(--s-2) 0 var(--s-10); background: var(--brand); }
.hero::after { content: ""; position: absolute; left: var(--s-12); right: var(--s-12); bottom: var(--s-9); border-top: 3px solid #fff; transform-origin: left; } /* the chalk line, drawn once on arrival */
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin-bottom: var(--s-2); }
.hero p { color: rgba(255, 255, 255, .9); margin: 0; max-width: 32rem; }
.board { display: flex; align-items: center; gap: var(--s-10); margin-top: var(--s-10); color: #fff; text-decoration: none; }
.board:hover .board-main strong { text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .15em; }
.board-date { display: flex; flex-direction: column; align-items: center; min-width: 4.5rem; font-size: var(--fs-3); font-weight: 700; line-height: 1.1; }
.board-date b { font-family: var(--font-display); font-size: var(--fs-8); font-weight: 800; line-height: .9; }
.board-main { min-width: 0; }
.board-main strong { display: block; font-family: var(--font-display); font-size: var(--fs-6); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.board-main small { display: block; color: rgba(255, 255, 255, .9); font-size: var(--fs-3); overflow-wrap: anywhere; }
.tiles { display: grid; gap: var(--s-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.tile { display: flex; gap: var(--s-7); align-items: center; padding: var(--s-8); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--elev-1); text-decoration: none; color: inherit; transition: border-color .12s; }
a.tile:hover { border-color: var(--line); }
.tile .badge-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-ink); flex: none; }
.tile strong { display: block; font-weight: 800; }
.tile-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tile-accent .badge-ico { background: var(--accent-ink); color: var(--accent); }
.tile-accent small { color: var(--accent-ink); opacity: .85; }
.profile-hero { display: flex; gap: var(--s-10); align-items: center; flex-wrap: wrap; }
.profile-hero h1 { margin-bottom: var(--s-2); overflow-wrap: anywhere; }

/* ---------- tables become cards on phones ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--elev-1); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: var(--fs-2); font-weight: 700; color: var(--muted); }
th, td { padding: var(--s-6) var(--s-8); vertical-align: middle; overflow-wrap: anywhere; }
tbody tr + tr td { border-top: 1px dashed var(--border); }
@media (max-width: 719px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: var(--s-5) 0; }
  .table-cards tr + tr { border-top: 8px solid var(--bg); }
  .table-cards tbody tr + tr td { border-top: 0; }
  .table-cards td { display: flex; justify-content: space-between; gap: var(--s-8); padding: var(--s-3) var(--s-8); text-align: right; }
  .table-cards td::before { content: attr(data-label); font-weight: 800; color: var(--muted); text-align: left; flex: none; }
  .table-cards td > form, .table-cards td > .actions { justify-content: flex-end; }
}
details.fold { background: var(--surface); border: 1px dashed var(--field-border); border-radius: var(--r-md); }
details.fold > summary { cursor: pointer; font-weight: 800; padding: var(--s-8) var(--s-10); min-height: 48px; list-style: none; display: flex; align-items: center; gap: var(--s-5); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "＋"; margin-left: auto; font-size: 1.3rem; }
details.fold[open] > summary::after { content: "－"; }
details.fold > .fold-body { padding: 0 var(--s-10) var(--s-10); }
.sticky-save { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + .5rem); z-index: 5; padding: var(--s-6); margin-top: var(--s-8); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--elev-1); }

/* ---------- app shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; color: #fff; background: var(--brand); padding-top: env(safe-area-inset-top); }
.topbar-in { display: flex; align-items: center; gap: var(--s-6); height: 58px; width: min(100% - 1.5rem, 1120px); margin-inline: auto; }
.brand { display: inline-flex; align-items: center; gap: var(--s-4); color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-6); letter-spacing: .01em; }
.brand .logo { width: 34px; height: 34px; }
.nav { display: none; gap: var(--s-2); margin-left: var(--s-8); }
.nav a { display: inline-flex; align-items: center; gap: var(--s-4); min-height: 44px; padding: var(--s-3) var(--s-7); border-radius: var(--r-sm); color: rgba(255, 255, 255, .92); text-decoration: none; font-weight: 700; }
.nav a:hover { background: rgba(255, 255, 255, .12); }
.nav a[aria-current=page], .nav a[aria-current=true] { color: #fff; font-weight: 800; box-shadow: inset 0 -3px 0 var(--accent); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: var(--s-4); }
.topbar details { position: relative; }
.topbar summary, .more summary { list-style: none; cursor: pointer; }
.topbar summary::-webkit-details-marker, .more summary::-webkit-details-marker { display: none; }
.lang summary { display: inline-flex; align-items: center; gap: var(--s-3); min-height: 44px; padding: var(--s-2) var(--s-6); border-radius: var(--r-md); background: rgba(255, 255, 255, .12); font-weight: 800; }
.menu { position: absolute; right: 0; top: calc(100% + .5rem); min-width: 190px; padding: var(--s-3); border-radius: var(--r-md); background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--elev-1); z-index: 40; }
.menu a, .menu button { display: flex; align-items: center; gap: var(--s-5); width: 100%; min-height: 44px; padding: var(--s-4) var(--s-6); border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover, .menu a[aria-current] { background: var(--surface-2); }
.user-desktop { display: none; }
.shell { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1.5rem); }
.container { width: min(100% - 2rem, 1120px); margin-inline: auto; }
.page { padding-top: var(--s-10); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--elev-bar); }
.tab, .more > summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-1); min-height: var(--tabbar-h); color: var(--muted); text-decoration: none; font-size: var(--fs-1); font-weight: 700; }
.tab .pill, .more .pill { display: grid; place-items: center; width: 54px; height: 30px; }
.tab[aria-current=page], .more.is-current > summary { color: var(--text); font-weight: 800; box-shadow: inset 0 3px 0 var(--line); } /* the touchline: a rule above the current tab, not a colour alone */
.more { position: static; }
.more > summary { height: 100%; }
.more .sheet { max-height: calc(100vh - var(--tabbar-h) - env(safe-area-inset-bottom) - 1.5rem); max-height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom) - 1.5rem); overflow-y: auto; overscroll-behavior: contain; position: fixed; left: .75rem; right: .75rem; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + .6rem); padding: var(--s-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--elev-pop); }
.sheet a, .sheet button { display: flex; align-items: center; gap: var(--s-6); width: 100%; min-height: 50px; padding: var(--s-4) var(--s-7); border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; font-weight: 700; text-decoration: none; text-align: left; cursor: pointer; }
.sheet a:hover, .sheet button:hover { background: var(--surface-2); }
.sheet .sep { height: 1px; background: var(--border); margin: var(--s-3) var(--s-4); }

/* ---------- public (signed-out) shell ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: calc(1.25rem + env(safe-area-inset-top)) 1.25rem 4.2rem; background: var(--brand); }
.auth-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: var(--s-18); border-top: 3px solid #fff; } /* the try line */
.auth-hero > * { position: relative; z-index: 1; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-8); }
.auth-hero h2 { font-size: clamp(var(--fs-7), 1.5rem + 4vw, var(--fs-8)); margin: var(--s-12) 0 var(--s-3); color: #fff; max-width: 14ch; }
.auth-hero p { color: rgba(255, 255, 255, .9); max-width: 30ch; margin: 0; }
.auth-hero .lang .menu { right: auto; left: 0; }
.auth-panel { padding: 0 var(--s-8) var(--s-16); margin-top: -3rem; display: flex; justify-content: center; align-items: flex-start; }
.auth-card { width: min(100%, 460px); }
.auth-card.auth-card-wide { width: min(100%, 860px); }
.auth-card h1 { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .hero::after { animation: draw .7s .15s cubic-bezier(.2, .7, .2, 1) both; }
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- tablet ---------- */
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
  .hero { padding: var(--s-16) var(--s-18) var(--s-24); } .hero::after { left: var(--s-18); right: var(--s-18); }
  .card { padding: var(--s-13); }
  .menu { min-width: 220px; }
}

/* ---------- desktop: top navigation, no tab bar; split sign-in screen ---------- */
@media (min-width: 1024px) {
  .nav { display: flex; }
  .user-desktop { display: block; }
  .tabbar { display: none; }
  .shell { padding-bottom: var(--s-24); }
  .page { padding-top: var(--s-16); }
  .layout-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-12); align-items: start; }
  .hero { padding: var(--s-20) var(--s-24) var(--s-28); } .hero::after { left: var(--s-24); right: var(--s-24); }
  .auth { grid-template-columns: 1.1fr 1fr; grid-template-rows: 1fr; }
  .auth-hero { padding: var(--s-20) var(--s-28); display: flex; flex-direction: column; }
  .auth-hero .auth-body { margin-top: auto; margin-bottom: auto; }
  .auth-hero::after { left: auto; right: var(--s-12); top: 0; bottom: 0; border-top: 0; border-right: 3px dashed #fff; } /* beside the form the rule turns into the dashed 10 m line */
  .auth-panel { margin: 0; padding: var(--s-20); align-items: center; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.qr { display: inline-block; background: #fff; padding: var(--s-6); border-radius: var(--r-md); line-height: 0; max-width: 100%; }
.qr svg { width: min(240px, 100%); height: auto; }
.codes { list-style: none; padding: 0; margin: 0 0 var(--s-12); display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-5); }
.codes li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-6); text-align: center; }
.codes code { font-size: var(--fs-5); font-weight: 700; background: none; letter-spacing: .04em; }
@media (min-width: 720px) { .codes { grid-template-columns: repeat(5, 1fr); } }
h1 .i { vertical-align: -.15em; margin-right: var(--s-2); }
.row > input[type=search] { flex: 1 1 14rem; width: auto; }

/* ---------- polish after visual review ---------- */
:where(.page > div > * + *) { margin-top: var(--s-8); }                 /* vertical rhythm between sibling sections */
.brand { min-height: 44px; }
.item-top { align-items: flex-start; }
a.item-name { color: inherit; text-decoration: none; padding: var(--s-2) 0; min-height: 44px; display: inline-flex; align-items: center; }
a.item-name:hover { text-decoration: underline; text-decoration-thickness: .12em; }
.auth-hero h2 { max-width: 18ch; text-wrap: balance; }
.hero h1, .page-head h1 { text-wrap: balance; }
@media (max-width: 719px) {
  .table-cards td:first-child { justify-content: flex-start; text-align: left; font-weight: 800; font-size: var(--fs-4); padding-top: var(--s-4); }
  .table-cards td:first-child::before { display: none; }
}

/* roster for managers: wider cards, e-mail on its own line, lighter function editor */
.items-wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.item-email { display: block; }
.item details.fold { box-shadow: none; margin: var(--s-5) 0; background: var(--surface-2); border-color: transparent; }
.item details.fold > summary { padding: var(--s-4) var(--s-7); min-height: 44px; font-size: var(--fs-3); }
.item details.fold > .fold-body { padding: 0 var(--s-7) var(--s-7); }
.item .chips-select span { min-height: 40px; padding: var(--s-2) var(--s-6); font-size: var(--fs-3); }

/* ---------- legal pages, footer, privacy ---------- */
.site-footer { text-align: center; padding: var(--s-12) 0 var(--s-4); color: var(--muted); font-size: var(--fs-3); }
.legal { text-align: center; margin: var(--s-10) 0 0; color: var(--muted); font-size: var(--fs-2); }
.doc { max-width: 46rem; }
.doc h2 { margin-top: var(--s-14); }
.doc p { color: var(--text); }
.doc .meta { color: var(--muted); font-size: var(--fs-3); }
.doc .todo { background: var(--danger-bg); color: var(--danger); font-weight: 700; padding: .05em .4em; border-radius: var(--r-sm); }
.danger-zone { border-color: var(--danger); }
.site-footer, .legal { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 var(--s-2); }
.site-footer a, .legal a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-4); }
@media (min-width: 1024px) {
  .auth-hero { position: sticky; top: 0; height: 100vh; height: 100dvh; align-self: start; }   /* stays in view next to long pages */
}


/* ---------- events, availability, announcements, player status (release 1a) ---------- */
.pre { white-space: pre-line; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.announcements { list-style: none; margin: 0 0 var(--s-8); padding: 0; display: grid; gap: var(--s-5); }
.announcements .card p { margin: var(--s-2) 0 var(--s-4); }
.event-row { align-items: flex-start; }
.event-row .item-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } /* a long address stays at two lines */
.event-row.is-cancelled .item-name { text-decoration: line-through; color: var(--muted); }
.event-date { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 3.4rem; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--fs-2); font-weight: 700; color: var(--muted); line-height: 1.1; }
.event-date b { font-family: var(--font-display); font-size: var(--fs-6); font-weight: 800; line-height: 1; color: var(--text); }
.chip-event-match { background: var(--leather); color: #fff; }
.chip-event-training { background: var(--chip-player-bg); color: var(--chip-player-ink); }
.chip-event-meeting { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.chip-event-social { background: var(--info-bg); color: var(--info); }
.chip-ans-in, .chip-avail-fit { background: var(--success-bg); color: var(--success); }
.chip-ans-maybe, .chip-avail-returning { background: var(--info-bg); color: var(--info); }
.chip-ans-out, .chip-avail-injured, .chip-avail-unavailable, .chip-cancelled { background: var(--danger-bg); color: var(--danger); }
.chip-ans-none { background: var(--surface-2); color: var(--muted); }
.chip-on { outline: 2px solid var(--accent); outline-offset: 1px; }
a.chip { text-decoration: none; min-height: 36px; }
.chip-pos-primary { background: var(--accent); color: var(--accent-ink); }
.chip-pos-secondary { background: var(--chip-player-bg); color: var(--chip-player-ink); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-8); }
.pager-info { color: var(--muted); font-size: var(--fs-3); text-align: center; flex: 1 1 10rem; }
.is-disabled { opacity: .45; pointer-events: none; }
.nav-count { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; margin-left: var(--s-3); padding: 0 var(--s-3); border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-size: var(--fs-1); font-weight: 800; line-height: 1; }
.more > summary { position: relative; }
.tab-count { position: absolute; top: .3rem; left: calc(50% + .6rem); margin: 0; }
.sheet-group + .sheet-group { margin-top: var(--s-2); }
.sheet-label { display: block; padding: var(--s-4) var(--s-6) var(--s-1); font-size: var(--fs-2); font-weight: 800; color: var(--muted); }
.confirm { display: inline-block; }
.confirm > summary { list-style: none; cursor: pointer; }
.confirm > summary::-webkit-details-marker { display: none; }
.confirm[open] { display: block; width: 100%; }
.confirm[open] > summary { margin-bottom: var(--s-4); }
.confirm-body { padding: var(--s-6) var(--s-7); border: 1px solid var(--danger); border-radius: var(--r-md); background: var(--danger-bg); color: var(--text); }
.confirm-body p { margin: 0 0 var(--s-5); font-weight: 700; }
.item-actions .confirm { margin-top: var(--s-2); }
.event-waiting { align-items: flex-start; }
.event-waiting a.item-name { display: flex; padding: var(--s-1) 0; min-height: 0; }
.event-waiting-form { margin-top: var(--s-5); }
.rsvp-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
.rsvp-buttons .btn { min-width: 0; padding-inline: var(--s-3); justify-content: center; background: var(--surface-2); color: var(--text); border-color: var(--border); box-shadow: none; }
.rsvp-buttons .rsvp-in.is-current { background: var(--success); color: var(--surface); border-color: var(--success); }
.rsvp-buttons .rsvp-maybe.is-current { background: var(--info); color: var(--surface); border-color: var(--info); }
.rsvp-buttons .rsvp-out.is-current { background: var(--danger); color: var(--surface); border-color: var(--danger); }

/* ---------- match-day squads (release 1b) ---------- */
[hidden] { display: none !important; } /* elements marked hidden stay hidden even when a component class sets display (script-only controls) */
.chip-warn { background: var(--danger-bg); color: var(--danger); }
.squad-warnings ul { margin: var(--s-3) 0 0; padding-left: var(--s-10); }
.squad-js-hint { display: none; }
.squad.is-enhanced .squad-js-hint { display: block; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-5); }
.slot { display: flex; align-items: center; gap: var(--s-6); padding: var(--s-3); border-radius: var(--r-md); border: 1px dashed var(--border); }
.slot.is-filled { border-style: solid; }
.slot.is-over { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface-2); }
.slot-fields { display: flex; flex-wrap: wrap; gap: var(--s-4); flex: 1; min-width: 0; }
.slot-fields select { flex: 1 1 11rem; min-width: 0; }
.shirt { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 2.75rem; height: 2.75rem; padding: 0 var(--s-3); border-radius: var(--r-sm); background: var(--btn-bg); color: var(--btn-ink); font-family: var(--font-display); font-size: var(--fs-6); font-weight: 800; line-height: 1; }
.shirt-sub { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.squad.is-enhanced .squad-player { cursor: grab; }
.squad-player.is-selected { outline: 3px solid var(--focus); outline-offset: 1px; background: var(--surface-2); } /* a solid, high-contrast selection */
.squad-pick { appearance: none; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; display: block; min-height: 44px; }
.squad-pick:disabled { cursor: default; color: inherit; }
.chip-placed { background: var(--brand-deep); color: #fff; }
.squad-pool { max-height: 16rem; overflow: auto; }
.squad-selected { margin: 0 0 var(--s-4); font-weight: 700; overflow-wrap: anywhere; }
.squad-save-row { display: flex; flex-wrap: wrap; gap: var(--s-4); }
.squad-save-row .btn { flex: 1 1 auto; justify-content: center; }
.squad-unsaved { font-weight: 700; color: var(--danger); }
/* Without a player selected the per-shirt buttons stay out of the way; the selects remain. */
.squad.is-enhanced:not(.has-selection) .slot-assign { display: none; }
@media (max-width: 1099px) { .slot-fields select { flex-basis: 100%; } } /* the position select goes under the player select */
@media (min-width: 720px) { /* pool on the left (it stays in view), shirts on the right */
  .squad { display: grid; grid-template-columns: minmax(15rem, 21rem) minmax(0, 1fr); gap: var(--s-8); align-items: start; }
  .squad.stack > * + * { margin-top: 0; }
  .squad > .sticky-save { grid-column: 1 / -1; }
  .squad > .card:first-child { position: sticky; top: 4.5rem; max-height: calc(100vh - 6rem); max-height: calc(100dvh - 6rem); overflow: auto; }
  .squad-pool { max-height: none; overflow: visible; }
}
.sheet-page { max-width: 42rem; margin: 0 auto; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th, .sheet-table td { text-align: left; padding: var(--s-4) var(--s-5); border-bottom: 1px dashed var(--border); }
.sheet-group th { background: var(--surface-2); font-size: var(--fs-2); }
.sheet-no { width: 3.5rem; font-family: var(--font-display); font-size: var(--fs-6); font-weight: 800; }
@page { margin: 12mm; }
@media print {
  .topbar, .tabbar, .site-footer, .no-print, .alert { display: none !important; }
  body { background: #fff; color: #000; }
  .page, .container { padding: 0; max-width: none; }
  .sheet-table th, .sheet-table td { border-bottom: 1px solid #999; }
  .sheet-group th { background: #eee; color: #000; }
  .sheet-table tr { break-inside: avoid; }
}

/* ---------- Windows high contrast (forced colors): keep the selected and current states visible ---------- */
/* ---------- assessments: a rating is its number and name, the bar only repeats it ---------- */
.level { display: inline-flex; align-items: center; gap: var(--s-4); font-weight: 700; white-space: nowrap; }
.bar { position: relative; display: inline-block; width: 5rem; height: .5rem; border-radius: var(--r-pill); background: var(--border); overflow: hidden; flex: none; }
.bar::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; background: var(--brand); border-radius: var(--r-pill); }
.bar-1::after { width: 20%; } .bar-2::after { width: 40%; } .bar-3::after { width: 60%; } .bar-4::after { width: 80%; } .bar-5::after { width: 100%; }
.rating-name { overflow-wrap: anywhere; }
.muted-text { color: var(--muted); }
.state { display: inline-flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-5); border-radius: var(--r-pill); font-size: var(--fs-2); font-weight: 700; }
.state-ok { background: var(--success-bg); color: var(--success); }
.state-soon { background: var(--warn-bg); color: var(--warn); }
.state-expired { background: var(--danger-bg); color: var(--danger); }
.state-none { color: var(--muted); font-weight: 400; padding-left: 0; padding-right: 0; }
.grid-wrap { overflow-x: auto; }
.quick-grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.quick-grid th, .quick-grid td { padding: var(--s-3) var(--s-5); text-align: left; vertical-align: middle; white-space: nowrap; border-bottom: 1px solid var(--border); }
.quick-grid thead th { position: sticky; top: 0; background: var(--surface); font-size: var(--fs-2); }
.quick-grid tbody th { position: sticky; left: 0; background: var(--surface); text-transform: none; letter-spacing: 0; font-size: var(--fs-3); color: var(--text); }
.quick-grid select, .quick-grid input { min-height: 40px; width: auto; min-width: 4.5rem; }
.row-link { display: inline-flex; align-items: center; min-height: 40px; min-width: 40px; }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-6); padding: var(--s-2) 0; }
.setting-row .check { margin: 0; }
.setting-row select { width: auto; min-width: 8.5rem; }
.role-row { display: grid; gap: var(--s-3); padding: var(--s-2) 0; }
.role-name { font-weight: 700; overflow-wrap: anywhere; }
.role-pick { display: flex; gap: var(--s-4); }
.role-pick select { flex: 1; min-width: 0; width: auto; }
@media (min-width: 640px) {
  .role-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .role-pick select { flex: none; min-width: 9rem; }
}
@media (forced-colors: active) {
  .btn, .chip, .nav-count, .tab .pill, .item, .card, .tile { border: 1px solid CanvasText; }
  .nav a[aria-current=page], .menu a[aria-current=page], .sheet a[aria-current=page], .tab[aria-current=page] { outline: 2px solid Highlight; outline-offset: -2px; }
  .more.is-current > summary { outline: 2px solid Highlight; }
  .chips-select input:checked + span, .chip-on, .squad-player.is-selected, .slot.is-over { outline: 3px solid Highlight; }
  .rsvp-buttons .btn.is-current, .rsvp-buttons .btn[aria-pressed=true] { outline: 3px solid Highlight; }
  .slot.is-filled { border-style: solid; }
  .bar { border: 1px solid CanvasText; background: Canvas; }
  .bar::after { background: Highlight; }
  .hero::after, .auth-hero::after { display: none; }
  :focus-visible { outline: 3px solid Highlight; }
}

/* ---------- Print: the page content, without the navigation and the controls ---------- */
@media print {
  .lang, .user-desktop, .more, .nav-count, .skip-link, .confirm, .sticky-save, .rsvp-buttons, .actions { display: none !important; }
  .card, .item { box-shadow: none !important; border: 1px solid #999 !important; break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
}

.sheet-logo { display: block; width: 64px; height: 64px; object-fit: contain; margin-bottom: var(--s-4); }
