/* Junior Soccer Championships: the layout of each screen. Built for 1280x720 first; a wide screen gets more air, a phone on its side
   (844x390) keeps one row of everything, a phone upright (390x844) stacks. */
@import url('./depth.css');
@import url('./title.css');

/* ---- title */
.screen-title { grid-template-rows: minmax(0, 1fr) auto auto; max-width: 88rem; }
.title-main { min-height: 0; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0.6rem 1rem; align-items: center; overflow-y: auto; overflow-x: hidden; padding: 0.3rem; }
.title-head { grid-column: 1 / -1; text-align: center; display: grid; justify-items: center; gap: 0.3rem; }
.wordmark {
  font-size: clamp(2rem, 6.2vw, 5rem); line-height: 0.98; letter-spacing: 0.01em; text-wrap: balance; max-width: 16ch;
  color: var(--white); -webkit-text-stroke: 0.16em var(--ink); paint-order: stroke fill;
  text-shadow: 0 0.09em 0 var(--gold), 0 0.16em 0 var(--ink);
}
.wordmark-art { line-height: 0; }
.wordmark-art img { width: clamp(11rem, min(92vw, 50vh), 34rem); height: auto; filter: drop-shadow(0 0.25rem 0.4rem var(--shade-deep)); }
.ic-formation { width: 2.6rem; height: 2.6rem; }
.formation-note { display: flex; align-items: center; gap: 0.5rem; }
.ribbon { max-width: min(46rem, 94vw); padding: 0.25rem 1.4rem; background: var(--red); color: var(--white); border: var(--outline); border-radius: 0.5rem; font: 700 1.05rem var(--font-display); box-shadow: var(--shadow); transform: rotate(-1deg); }
.title-menu { justify-self: end; width: min(24rem, 100%); }
.menu { display: grid; gap: 0.45rem; }
.menu-btn { width: 100%; font-size: 1.15rem; }
.menu-btn.primary { font-size: 1.45rem; min-height: 60px; }
.title-cast { align-self: end; display: flex; align-items: flex-end; justify-content: center; min-width: 0; max-width: 44rem; width: 100%; padding-block-end: 0.5rem; }
.title-cast .figure { width: 26%; height: auto; aspect-ratio: 1; margin-inline: -3%; }
.title-cast .cast-1 { width: 32%; z-index: 1; }
.title-mascot { width: 17%; margin-inline: -1%; }
.title-warning { margin: 0.3rem auto; max-width: 44rem; padding: 0.4rem 0.9rem; background: var(--tint-warn); border: var(--outline); border-radius: var(--radius); font-weight: 700; }
.screen-title .notice { text-align: center; padding-block: 0.2rem; }

/* ---- credits and the fault card */
.credits { max-width: 46rem; margin-inline: auto; width: 100%; text-align: center; }
.credit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.8rem; margin-block: 0.8rem; }
.credit h2 { font-size: 0.85rem; color: var(--ink-soft); }
.credit-name { font: 700 1.1rem var(--font-display); }
.credits .notice { color: var(--ink-soft); text-shadow: none; }
.credits-thanks { font: 700 1.1rem var(--font-display); }
.screen-error { place-items: center; grid-template-rows: 1fr; }
.error-card { max-width: 30rem; text-align: center; }

/* ---- options */
.screen-options .screen-body { grid-template-columns: repeat(auto-fit, minmax(min(26rem, 100%), 1fr)); }
.opt-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.3rem 0.8rem; padding-block: 0.45rem; border-block-start: 2px dashed var(--paper-line); }
.opt-row[hidden] { display: none; }
.opt-text { flex: 1 1 14rem; min-width: 0; }
.opt-text label { font: 700 1rem var(--font-display); cursor: pointer; }
.opt-hint { font-size: 0.85rem; color: var(--ink-soft); }
.opt-detail { margin-block-start: 0.25rem; padding: 0.3rem 0.6rem; background: var(--tint-note); border-radius: var(--radius-small); font-size: 0.85rem; font-weight: 700; }
.opt-row .select { max-width: 100%; }

/* ---- which school is yours? */
.school-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }
.school-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.2rem; }
.school-card > * + * { margin-block-start: 0; }
.school-name { font: 700 1.25rem var(--font-display); }
.card-ribbon { margin-block-start: -2.75rem; min-height: 2.3rem; text-align: center; color: var(--white); text-shadow: 0 2px 0 var(--ink); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; font: 700 1.1rem var(--font-display); }
.school-card .school-name { margin-block-start: -2.6rem; min-height: 2.1rem; color: var(--white); text-shadow: 0 2px 0 var(--ink); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; font-size: 1.1rem; }
.school-art { display: flex; align-items: flex-end; justify-content: center; width: 100%; padding-block-start: 0.3rem; border-radius: var(--radius-small); background: linear-gradient(to bottom, color-mix(in srgb, var(--school) 30%, var(--white)), color-mix(in srgb, var(--school) 70%, var(--white))); }
.school-art .figure { width: 9rem; height: 9rem; margin-inline-start: -1.2rem; }
.school-art .mascot { width: 8rem; }
.school-blurb { flex: 1; font-weight: 700; }
.school-card .btn { margin-block-start: 0.4rem; }
.school-list-panel { max-width: 60rem; margin-inline: auto; width: 100%; }
.school-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 0.4rem; }
.school-row { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 0.5rem; padding: 0.15rem 0.6rem; background: var(--white); border: var(--outline); border-inline-start: 0.8rem solid var(--school); border-radius: var(--radius-small); cursor: pointer; text-align: start; font-weight: 700; }
.school-row:disabled { cursor: default; opacity: 0.6; }
.school-row-name { flex: 1; min-width: 0; }

/* ---- coach name */
.coach-layout { display: grid; grid-template-columns: auto minmax(0, 28rem); gap: 1.5rem; align-items: center; justify-content: center; }
.coach-form { display: grid; gap: 0.4rem; }
.coach-form label { font: 700 1rem var(--font-display); }
.field-problem { color: var(--bad); font-weight: 700; min-height: 1.4em; }

/* ---- the PE office */
.screen-hub { max-width: 84rem; }
.hub-head { display: flex; align-items: center; gap: 0.8rem; padding-block: 0.2rem; min-width: 0; }
.crest { flex: none; width: 4.6rem; height: 5rem; display: grid; place-items: center; background: var(--art-shield, none) center / contain no-repeat; }
.crest .mascot { width: 3.6rem; }
.hub-who { flex: 1; min-width: 0; }
.hub-coach { display: inline-block; padding: 0 0.7rem; border-radius: 999px; background: var(--school); color: var(--school-ink, var(--white)); border: 2px solid var(--ink); font: 700 0.9rem var(--font-display); }
.hub-now { flex: none; max-width: 46%; padding: 0.3rem 0.8rem; background: var(--glass); border: var(--outline); border-radius: var(--radius); text-align: end; }
.hub-today { font: 700 1.05rem var(--font-display); }
.hub-standing { display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; justify-content: flex-end; align-items: center; }
.hub-body { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.week { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.3rem; }
.day { display: grid; justify-items: center; padding: 0.2rem 0.1rem; border: var(--outline); border-radius: var(--radius-small); background: var(--glass); text-align: center; min-width: 0; }
.day.past { opacity: 0.6; }
.day.today { background: var(--gold); box-shadow: var(--shadow); transform: translateY(-2px); }
.day-match { border-color: var(--red); }
.day-name { font: 700 0.9rem var(--font-display); }
.day-slot { font-size: 0.75rem; }
.hub-fixture { min-width: 0; }
.fixture-head { display: flex; align-items: center; gap: 0.6rem; }
.fixture-head .mascot { width: 4.6rem; }
.fixture-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; font-size: 0.85rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: 0.4rem 0.9rem; }
.fact dt { font: 700 0.75rem var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.rtl .fact dt { letter-spacing: 0; }
.fact dd { display: grid; }
.fact dd span { font-size: 0.85rem; color: var(--ink-soft); }
.stake { padding: 0.3rem 0.6rem; background: var(--tint-note); border-radius: var(--radius-small); font-weight: 700; }
.board h2 { color: var(--white); text-shadow: 0 2px 0 var(--wood-dark); }
.board .notes li { padding: 0.3rem 0.5rem; background: var(--paper); border-radius: 4px; box-shadow: 0 2px 0 var(--shade); }
.board .notes li:nth-child(odd) { transform: rotate(-0.4deg); }
.board .notes li:nth-child(even) { transform: rotate(0.5deg); }
.board-record { color: var(--white); font-weight: 700; }
.hub-actions { justify-content: center; }
.hub-actions .btn.big { order: -1; }

/* ---- the week so far */
.days { max-width: 46rem; margin-inline: auto; width: 100%; }
.day-report + .day-report { margin-block-start: 0.7rem; padding-block-start: 0.5rem; border-block-start: 2px dashed var(--paper-line); }

/* ---- league table */
.table-panel { max-width: 60rem; margin-inline: auto; width: 100%; }
.league { width: 100%; border-collapse: collapse; font-weight: 700; }
.league th, .league td { padding: 0.3rem 0.4rem; text-align: start; border-block-end: 1px dashed var(--chalk-ghost); }
.league .num { text-align: center; font-family: var(--font-display); }
.league thead th { font: 700 0.85rem var(--font-display); text-align: center; }
.league thead th:nth-child(2) { text-align: start; }
.school-cell { display: flex; align-items: center; gap: 0.4rem; }
.league .mine { background: var(--gold-wash); }
.league .points { font-size: 1.1rem; color: var(--gold); }
.form-cell { white-space: nowrap; }
.form { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; margin-inline-end: 2px; padding-inline: 0.2rem; border-radius: 50%; font: 700 0.75rem var(--font-display); color: var(--ink); background: var(--white); }
.form-won { background: var(--tint-win); }
.form-lost { background: var(--tint-loss); border-radius: 4px; }
.form-drawn { border-radius: 8px; }

/* ---- squad list */
.squad-panel { max-width: 62rem; margin-inline: auto; width: 100%; }
.kid-list { display: grid; gap: 0.35rem; }
.kid-row { width: 100%; min-height: 56px; display: grid; grid-template-columns: auto minmax(5rem, 1.2fr) minmax(6rem, 1fr) auto minmax(6rem, 1fr); align-items: center; gap: 0.6rem; padding: 0.2rem 0.6rem; background: var(--white); border: var(--outline); border-radius: var(--radius-small); cursor: pointer; text-align: start; }
.kid-row:hover { background: var(--tint-hover); }
.kid-row.is-out { background: var(--paper-dim); }
.kid-row.is-out .portrait { filter: grayscale(0.8); }
.kid-row-main { display: grid; }
.kid-row-main strong { font: 700 1.05rem var(--font-display); }
.kid-row-role { display: flex; align-items: center; gap: 0.3rem; font-weight: 700; }
.kid-row-rating { font: 700 0.9rem var(--font-display); white-space: nowrap; }
.kid-row-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.4rem; justify-content: flex-end; }

/* ---- kid card */
.kid-card { display: grid; grid-template-columns: minmax(13rem, 0.8fr) minmax(0, 1.25fr) minmax(0, 1.15fr); gap: var(--gap); align-items: start; }
.kid-face { display: grid; justify-items: center; text-align: center; grid-row: span 2; }
.kid-face .figure { width: 11rem; height: 11rem; }
.kid-number { font: 700 1.1rem var(--font-display); margin-block-start: -2.5rem; color: var(--white); text-shadow: 0 2px 0 var(--ink); }
.kid-nick { font: 700 1rem var(--font-display); }
.kid-roles { display: flex; align-items: center; justify-content: center; gap: 0.3rem; font-weight: 700; text-align: start; }
.kid-skills { grid-row: span 2; }
.bars { display: grid; gap: 0.3rem; }
.person-name { font: 700 1.2rem var(--font-display); }
.habits dt { font: 700 0.75rem var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); margin-block-start: 0.35rem; }
.rtl .habits dt { letter-spacing: 0; }
.avail { font-weight: 700; padding: 0.25rem 0.6rem; border-radius: var(--radius-small); }
.avail-ok { background: var(--tint-good); }
.avail-tired { background: var(--tint-warn); }
.avail-out { background: var(--tint-bad); }
.bonds { display: grid; gap: 0.2rem; }
.bond { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; }
.kid-life h2 { margin-block-start: 0.7rem; }
.kid-life h2:first-child { margin-block-start: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.stat { flex: 1 1 4.5rem; padding: 0.2rem 0.4rem; background: var(--white); border: 2px solid var(--ink); border-radius: var(--radius-small); text-align: center; }
.stat dt { font-size: 0.75rem; }
.stat dd { font: 700 1.2rem var(--font-display); }

/* ---- team sheet (eleven a side) */
.sheet-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(16rem, 1fr); grid-template-areas: "tabs tabs" "board side" "rest rest"; gap: var(--gap); align-items: start; }
.sheet-tabs { grid-area: tabs; display: none; gap: 0.4rem; }
.sheet-tab { flex: 1 1 0; min-height: var(--tap); background: var(--paper); border: var(--outline); border-radius: var(--radius-small); font: 700 1rem var(--font-display); color: var(--ink); cursor: pointer; }
.sheet-tab.is-on { background: var(--gold); }
.sheet-board-col { grid-area: board; display: grid; gap: var(--gap); }
.sheet-side { grid-area: side; display: grid; gap: var(--gap); }
.sheet-rest { grid-area: rest; }
.pitch { position: relative; direction: ltr; width: 100%; aspect-ratio: 8 / 4.1; min-height: 15rem; }
.pitch-lines { position: absolute; inset: 0; border: 3px solid var(--chalk-line); border-radius: 4px; background:
  linear-gradient(to right, transparent calc(50% - 1.5px), var(--chalk-line) calc(50% - 1.5px), var(--chalk-line) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
  radial-gradient(circle at 50% 50%, transparent 0, transparent 9%, var(--chalk-line) 9%, var(--chalk-line) 10%, transparent 10%); }
.pitch-lines::before, .pitch-lines::after { content: ""; position: absolute; inset-block: 20%; width: 15%; border: 3px solid var(--chalk-line); }
.pitch-lines::before { left: 0; border-left: 0; }
.pitch-lines::after { right: 0; border-right: 0; }
.links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.link { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.link-friend { stroke: var(--friend); stroke-width: 5px; }
.link-feud { stroke: var(--feud); stroke-width: 4px; }
.spot { position: absolute; left: var(--left); top: var(--top); transform: translate(-50%, -50%); }
.chip-kid { position: relative; display: grid; justify-items: center; gap: 1px; min-width: 4rem; min-height: var(--tap); padding: 0.15rem 0.3rem; background: var(--paper); color: var(--ink); border: var(--outline); border-radius: var(--radius-small); cursor: pointer; text-align: center; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: var(--shadow); }
.chip-kid .portrait { width: 2.3rem; height: 2.3rem; pointer-events: none; }
.chip-kid.on-board .fit { position: absolute; inset-block-start: -0.6rem; inset-inline-start: -0.4rem; padding: 0 0.3rem; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; }
.chip-kid.on-board { min-width: 3.6rem; }
.chip-name { font: 700 0.8rem var(--font-display); max-width: 5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-pos { font-size: 0.7rem; color: var(--ink-soft); }
.chip-meta { display: flex; align-items: center; gap: 0.25rem; }
.chip-meta .ic { width: 1.1rem; height: 1.1rem; }
.chip-hole { width: 2.4rem; height: 2.4rem; border: 3px dashed var(--ink-soft); border-radius: 50%; }
.chip-kid.is-empty { background: var(--paper-glass); box-shadow: none; }
.chip-kid.is-held { background: var(--gold); transform: translateY(-4px) rotate(-2deg); }
.chip-kid.is-out { background: var(--paper-out); }
.chip-kid.is-out .portrait { filter: grayscale(0.8); }
.chip-kid.in-list { touch-action: manipulation; grid-template-columns: auto 1fr; justify-items: start; text-align: start; column-gap: 0.4rem; min-width: 0; box-shadow: none; }
.chip-kid.in-list .portrait { grid-row: span 2; }
.chip-kid.in-list .chip-name { max-width: none; }
.is-holding .chip-kid:not(.is-held), .is-holding .rest-drop { outline: 3px dashed var(--gold); outline-offset: 1px; }
.drop-hover { outline: 4px solid var(--gold) !important; }
.armband { position: absolute; inset-block-start: -0.5rem; inset-inline-end: -0.5rem; }
.armband .ic { width: 1.3rem; height: 1.3rem; }
.bench { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; padding-block-start: 0.5rem; margin-block-start: 0.5rem; border-block-start: 3px dashed var(--chalk-faint); }
.legend { padding-inline-start: 0.6rem; border-inline-start: 5px solid var(--friend); }
.legend-feud { border-inline-start: 5px dashed var(--feud); }
.legend-fit { border-inline-start: 5px solid var(--good); }
.rest-drop { width: 100%; min-height: var(--tap); background: none; border: 0; padding: 0; text-align: start; cursor: pointer; color: var(--ink); border-radius: var(--radius-small); }
.rest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr)); gap: 0.4rem; }
html[data-reduced-motion="on"] .chip-kid.is-held { transform: none; }

/* how well a kid suits his place: a shape as well as a colour (circle green, triangle amber, square red, dashed circle for an empty place) */
.fit { display: inline-flex; align-items: center; gap: 0.25rem; font: 700 0.72rem var(--font-display); }
.fit-shape { display: inline-block; width: 0.8rem; height: 0.8rem; box-sizing: border-box; }
.fit-good .fit-shape { background: var(--good); border-radius: 50%; }
.fit-ok .fit-shape { background: var(--warn); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.fit-poor .fit-shape { background: var(--bad); border-radius: 2px; }
.fit-empty .fit-shape { border: 2px dashed var(--ink-soft); border-radius: 50%; }

/* the six formations, the five presets and the dials */
.formation-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.35rem; }
.formation-btn { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: var(--tap); padding: 0.2rem; background: var(--paper); color: var(--ink); border: var(--outline); border-radius: var(--radius-small); cursor: pointer; font: 700 0.85rem var(--font-display); }
.formation-btn.is-on { background: var(--gold); }
.formation-diagram { width: 100%; max-width: 3.2rem; height: auto; }
.formation-diagram circle { fill: var(--ink); }
.formation-note { margin: 0.2rem 0 0; justify-self: start; padding: 0.1rem 0.6rem; background: var(--glass); border-radius: 999px; }
.word-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.word-btn { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0.15rem 0.5rem; background: var(--white); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--radius-small); font: 700 0.85rem var(--font-display); cursor: pointer; text-align: center; }
.word-btn.is-on { background: var(--gold); box-shadow: inset 0 0 0 2px var(--ink); }
.word-custom { cursor: default; border-style: dashed; }
.word-custom.is-on { border-style: solid; }
.dial { margin-block-start: 0.6rem; }
.dial-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.5rem; margin-block-end: 0.2rem; }
.sheet-takers .field { margin-block-end: 0.3rem; }

/* ---- training */
.drills-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.drill-table { width: 100%; border-collapse: separate; border-spacing: 0.3rem 0.25rem; }
.drill-table th { text-align: start; font-family: var(--font-display); }
.drill-table thead th { text-align: center; }
.drill-table .select { width: 100%; }
.drill-kid { display: flex; align-items: center; gap: 0.4rem; }
.drill-kid > span { display: grid; }
.drill-kid .portrait { width: 2.6rem; height: 2.6rem; }
.drill-everyone th { font-size: 1rem; }
.drill-list { display: grid; gap: 0.5rem; }
.drill-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; }
.drill-list li > span:nth-child(2) { display: grid; }

/* ---- incident and outcome */
.screen-incident { grid-template-rows: minmax(0, 1fr); }
.incident-body { grid-template-columns: auto minmax(0, 36rem); align-items: center; justify-content: center; align-content: center; gap: 1rem; }
.incident-art { display: flex; align-items: flex-end; }
.incident-art .figure { width: 12rem; height: 12rem; }
.incident-art .mascot { margin-inline-start: -2rem; }
.incident-card h1 { font-size: 1.5rem; }
.incident-text { font-size: 1.1rem; }
.answers { display: grid; gap: 0.45rem; }
.answer { width: 100%; justify-content: flex-start; text-align: start; }

/* ---- match day and the match */
.matchday-layout { display: grid; grid-template-columns: auto minmax(0, 40rem); gap: 1rem; align-items: center; justify-content: center; }
.versus { display: flex; align-items: flex-end; }
.versus .mascot-big { width: min(10rem, 22vw); margin-inline: -0.6rem; }
.screen-match { grid-template-rows: minmax(0, 1fr); max-width: none; padding: 0; }
.stand-in { place-content: center; }
.stand-in-board { min-width: min(34rem, 92vw); text-align: center; display: grid; justify-items: center; }

/* ---- result */
.screen-result { grid-template-rows: minmax(0, 1fr) auto; }
.result-body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-areas: "score potm" "numbers story"; }
.scoreboard { grid-area: score; text-align: center; }
.scoreboard h1 { font-size: 1.9rem; color: var(--gold); text-shadow: 0 2px 0 var(--shade-deep); }
.outcome-loss .scoreboard h1, .outcome-draw .scoreboard h1 { color: var(--paper); }
.score-row { display: flex; justify-content: center; align-items: center; gap: 1rem; direction: ltr; }
.score-num { font: 700 3.6rem/1 var(--font-display); color: var(--white); }
.score-dash { font: 700 2.4rem var(--font-display); }
.score-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; align-items: start; width: 100%; direction: ltr; }
.score-team { display: grid; justify-items: center; gap: 0.2rem; }
.score-team .mascot { width: 4.5rem; }
.score-name { padding: 0.05rem 0.7rem; border-radius: 999px; background: var(--school); color: var(--school-ink, var(--white)); border: 2px solid var(--paper); font: 700 0.95rem var(--font-display); }
.scorers { font-size: 0.9rem; }
.scoreboard .small { color: var(--paper); }
.potm { grid-area: potm; display: grid; justify-items: center; text-align: center; }
.potm h2 { margin-block-start: -2.5rem; color: var(--white); text-shadow: 0 2px 0 var(--ink); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.potm .figure { width: 10rem; height: 10rem; }
.potm-name { font: 700 1.4rem var(--font-display); }
.quote { position: relative; padding: 0.5rem 0.9rem; background: var(--white); border: var(--outline); border-radius: var(--radius); font-weight: 700; font-style: italic; }
.result-numbers { grid-area: numbers; }
.result-story { grid-area: story; }
.stat-pairs { display: grid; gap: 0.3rem; }
.stat-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.6rem; align-items: center; text-align: center; padding: 0.2rem 0.4rem; background: var(--white); border: 2px solid var(--ink); border-radius: var(--radius-small); }
.stat-pair dd { font: 700 1.15rem var(--font-display); }
.stat-pair dt { font-size: 0.85rem; font-weight: 700; }
.result-numbers h2, .result-story h2 { margin-block-start: 0.7rem; }
.result-numbers h2:first-child, .result-story h2:first-child { margin-block-start: 0; }
.tips { display: grid; gap: 0.35rem; }
.tips li { display: flex; gap: 0.45rem; align-items: flex-start; font-weight: 700; }
.story { display: grid; gap: 0.2rem; }
.story li { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.3rem; }
.minute { font: 700 0.9rem var(--font-display); color: var(--ink-soft); }

/* ---- saves */
.saves-panel { max-width: 52rem; margin-inline: auto; width: 100%; }
.slots { display: grid; gap: 0.4rem; }
.slot { display: flex; align-items: center; gap: 0.7rem; padding: 0.35rem 0.6rem; background: var(--white); border: var(--outline); border-radius: var(--radius-small); }
.slot.is-empty { background: var(--paper-empty); }
.slot-hole { flex: none; width: 3.2rem; height: 3.2rem; border: 3px dashed var(--paper-line); border-radius: 50%; }
.slot-text { flex: 1 1 11rem; min-width: 0; }
.slot-actions, .ask { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; justify-content: flex-end; }
.ask p { font-weight: 700; flex-basis: 100%; text-align: end; }

/* ---- a phone on its side and other short windows: keep the bars slim */
@media (max-height: 520px) {
  h1 { font-size: 1.25rem; }
  .lead { display: none; }
  .bar-top { padding-block: 0.1rem; }
  .wordmark { font-size: clamp(1.6rem, 5vw, 2.6rem); max-width: none; }
  .ribbon { font-size: 0.9rem; padding-block: 0.1rem; }
  .title-main { grid-template-rows: auto auto; }
  .wordmark-art img { width: clamp(8rem, min(60vw, 40vh), 20rem); }
  .menu { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.3rem; }
  .menu-btn { min-height: 44px; font-size: 1rem; }
  .menu-btn.primary { min-height: 48px; font-size: 1.2rem; grid-column: 1 / -1; }
  /* the school cards keep their button in view: a smaller picture and no second line about the rival */
  .school-art .figure { width: 5.4rem; height: 5.4rem; margin-inline-start: -0.8rem; }
  .school-art .mascot { width: 5rem; }
  .school-card .small { display: none; }
  .school-blurb { font-size: 0.9rem; line-height: 1.25; }
  .crest { width: 3.4rem; height: 3.6rem; }
  .crest .mascot { width: 2.6rem; }
  .btn.big { min-height: 46px; font-size: 1.05rem; }
  .hub-actions { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-inline: 4px; }
  .hub-actions .btn { flex: none; }
  .hub-actions .btn-label { font-size: 0.9rem; }
  .chip-kid .portrait, .chip-hole { width: 2rem; height: 2rem; }
}

/* ---- middling widths: the training menu goes under the plan */
@media (max-width: 1000px) {
  .drills-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---- upright phones and narrow windows: one column */
@media (max-width: 760px) {
  .title-main, .hub-body, .kid-card, .sheet-layout, .drills-layout, .result-body, .coach-layout, .incident-body, .matchday-layout, .school-cards { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .title-menu { justify-self: center; }
  .title-cast { order: 3; }
  .board-pitch, .sheet-side, .sheet-rest, .scoreboard, .potm, .result-numbers, .result-story { grid-area: auto; }
  .kid-face, .kid-skills { grid-row: auto; }
  .hub-head { flex-wrap: wrap; }
  .hub-now { max-width: none; flex: 1 1 100%; text-align: start; }
  .hub-standing { justify-content: flex-start; }
  .day-slot { font-size: 0.62rem; }
  .kid-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .kid-row-role, .kid-row-rating { display: none; }
  .opt-row { flex-wrap: wrap; }
  .opt-row .select { max-width: 100%; width: 100%; }
  .coach-art, .incident-art, .versus { justify-self: center; }
  .incident-art .figure { width: 8rem; height: 8rem; }
  .mascot-big { width: 8rem; }
  .pitch { aspect-ratio: 8 / 5.6; min-height: 15rem; }
  .chip-kid { min-width: 3.2rem; padding: 0.1rem 0.15rem; }
  .chip-kid .portrait, .chip-hole { width: 2rem; height: 2rem; }
  .chip-name { font-size: 0.72rem; max-width: 3.6rem; }
  .chip-kid.in-list { min-height: 52px; }
  .drill-table, .drill-table thead, .drill-table tbody { display: block; }
  .drill-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 0.4rem; margin-block-end: 0.5rem; }
  .drill-table tr > th[scope="row"] { grid-column: 1 / -1; }
  .drill-table thead tr:first-child > td { display: none; }
  .league .wdl { display: none; }
  .league th, .league td { padding-inline: 0.2rem; }
  .bar-bottom { justify-content: center; }
  .slot { flex-wrap: wrap; }
}

/* ---- team sheet on a small screen: the pitch, the squad and the plan are three tabs */
@media (max-width: 760px), (max-height: 520px) {
  .sheet-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .sheet-tabs { display: flex; grid-area: auto; position: sticky; inset-block-start: 0; z-index: 2; }
  .sheet-board-col, .sheet-side, .sheet-rest { grid-area: auto; }
  .sheet-layout[data-tab="pitch"] > .sheet-side, .sheet-layout[data-tab="pitch"] > .sheet-rest,
  .sheet-layout[data-tab="squad"] > .sheet-board-col, .sheet-layout[data-tab="squad"] > .sheet-side,
  .sheet-layout[data-tab="plan"] > .sheet-board-col, .sheet-layout[data-tab="plan"] > .sheet-rest { display: none; }
}
/* upright phone: a squarer pitch, so eleven small chips still have room */
@media (max-width: 760px) {
  .pitch { aspect-ratio: 8 / 6.6; min-height: 0; }
  .chip-kid.on-board { min-width: 3rem; }
  .chip-kid .portrait, .chip-hole { width: 1.9rem; height: 1.9rem; }
  .formation-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* a phone on its side: the pitch fills the left, the tabs, the six formations and the bench stand in a strip on the right */
@media (max-height: 520px) and (min-width: 761px) {
  .sheet-layout { grid-template-columns: minmax(0, 1fr) 15.5rem; column-gap: var(--gap); row-gap: 0.35rem; align-items: start; align-content: start; }
  .sheet-tabs { grid-column: 2; grid-row: 1; }
  .sheet-tab { min-height: 40px; font-size: 0.9rem; }
  .sheet-layout[data-tab="pitch"] .sheet-board-col, .sheet-layout[data-tab="pitch"] .board-pitch { display: contents; }
  .sheet-layout[data-tab="pitch"] .pitch { grid-column: 1; grid-row: 1 / span 4; height: calc(100vh - 9.5rem); aspect-ratio: auto; min-height: 0; background: var(--board-green); border: 5px solid var(--wood); border-radius: var(--radius-small); }
  .sheet-layout[data-tab="pitch"] .formation-picker { grid-column: 2; grid-row: 2; }
  .sheet-layout[data-tab="pitch"] .bench { grid-column: 2; grid-row: 3; gap: 0.2rem; margin: 0; padding: 0.3rem; border: 0; background: var(--board-green); border-radius: var(--radius-small); }
  .sheet-layout[data-tab="squad"] > .sheet-rest, .sheet-layout[data-tab="plan"] > .sheet-side { grid-column: 1; grid-row: 1 / span 4; }
  .formation-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.25rem; }
  .formation-btn { min-height: 38px; }
  .formation-diagram { max-width: 2.4rem; }
  .formation-note { display: none; }
  .chip-kid { min-width: 2.6rem; padding: 0.1rem 0.2rem; }
  .chip-kid.on-board { min-width: max(2.8rem, 44px); }
  .chip-kid .portrait, .chip-hole { width: 1.6rem; height: 1.6rem; }
  .chip-name { font-size: 0.64rem; max-width: 3.2rem; }
  .chip-kid.on-board .fit { font-size: 0.6rem; inset-block-start: -0.5rem; }
  .chip-kid.on-bench { min-width: 2.5rem; min-height: 38px; }
  .chip-kid.in-list { min-height: 44px; }
}

/* ---- quick match, who is playing, keys and buttons */
.quick-panel { display: grid; gap: var(--gap); width: min(100%, 40rem); margin-inline: auto; }
.derby-line { margin: 0; font: 700 1.25rem var(--font-display); text-align: center; }
.join-layout { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--gap); align-items: start; }
.join-board { min-height: 12rem; }
.join-empty { margin: 0; font: 700 1.1rem var(--font-display); }
.join-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--gap); list-style: none; padding: 0; margin: 0; }
.join-card { display: grid; gap: 0.4rem; padding: 0.6rem; background: var(--white); border: 4px solid var(--player); border-radius: var(--radius); }
.join-card.is-ready { background: var(--tint-good); }
.join-head { display: flex; align-items: center; gap: 0.5rem; }
.join-numeral { display: grid; place-items: center; flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--player); color: var(--player-ink); font: 700 1.4rem var(--font-display); }
.join-who { display: grid; flex: 1; min-width: 0; }
.join-state { font: 700 0.85rem var(--font-display); }
.join-side { margin: 0; font-weight: 700; }
.join-card-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.join-card-actions .btn[disabled] { opacity: 0.55; }
.join-keys { margin-block: 0.4rem 0; padding-inline-start: 1.1rem; }
.join-note { margin-block: 0.4rem 0; }
.remap-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: var(--gap); align-items: start; }
.remap-rows { display: grid; gap: 0.25rem; list-style: none; padding: 0; margin: 0 0 0.5rem; }
.remap-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.5rem; align-items: center; }
.remap-keys { padding: 0.1rem 0.5rem; background: var(--chalk-soft); border-radius: var(--radius-small); font: 700 0.9rem var(--font-display); }
.remap-change { min-height: 38px; padding-inline: 0.7rem; }
.remap-change.is-waiting { background: var(--gold); }
.remap-clashes { grid-column: 1 / -1; order: -1; }
@media (max-width: 760px) {
  .join-layout { grid-template-columns: minmax(0, 1fr); }
  .join-layout .versus { justify-self: center; }
  .remap-row { grid-template-columns: minmax(0, 1fr) auto; }
  .remap-keys { grid-column: 1; grid-row: 2; justify-self: start; }
  .remap-change { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-height: 520px) {
  .join-layout { grid-template-columns: minmax(0, 1fr); }
  .join-layout .versus { display: none; }
  .join-cards { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
  .join-card { gap: 0.25rem; padding: 0.4rem 0.5rem; }
  .quick-panel .versus .mascot-big { width: 6rem; }
}
@media (max-height: 520px) and (min-width: 761px) {
  .quick-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 54rem); gap: 0.4rem var(--gap); }
  .quick-panel .field-problem { grid-column: 1 / -1; }
}

/* ---- a short desktop window (1280x720, and the installed game's 1100x594): the office and the team sheet fit without anything cut off */
@media (min-width: 1000px) and (min-height: 521px) and (max-height: 800px) {
  .screen-hub .hub-head .crest { width: 3.2rem; height: 3.4rem; }
  .screen-hub .crest .mascot { width: 2.5rem; }
  .screen-hub .hub-now { max-width: 62%; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0 0.9rem; }
  .hub-body { gap: 0.4rem 0.75rem; padding-block: 0.15rem 0.25rem; }
  .hub-body .day { display: flex; justify-content: center; align-items: baseline; gap: 0.35rem; padding-block: 0.15rem; }
  .hub-side { gap: 0.4rem; }
  .hub-side .btn.tile { flex-direction: row; gap: 0.35rem; min-height: var(--tap); }
  .hub-side .btn.tile .ic-tile { width: 1.5rem; height: 1.5rem; }
  .hub-side .board { border-width: 1.1rem; border-image-width: 1.1rem; }
  .hub-side .board > * + * { margin-block-start: 0.25rem; }
  .hub-side .board .notes { gap: 0.2rem; }
  .hub-side .board .notes li { padding: 0.1rem 0.4rem; font-size: 0.85rem; }
  .hub-side .story-panel { border-width: 0.9rem 1rem 1rem 1.6rem; border-image-width: 0.9rem 1rem 1rem 1.6rem; padding-block: 0; }
  .hub-side .story-panel::before { display: none; }
  .hub-side .story-panel > * + * { margin-block-start: 0.3rem; padding-block-start: 0.25rem; }
  .hub-side .hero-card { gap: 0.4rem; }
  .hub-side .hero-card .portrait { width: 2.8rem; height: 2.8rem; }
  .hub-side .hero-card p { font-size: 0.85rem; line-height: 1.25; }
  .hub-side .hero-text { min-width: 10rem; }
  .hub-actions { gap: 0.25rem; padding-block-start: 0.2rem; }
  .hub-actions .btn { border-width: 0.5rem 0.5rem 0.65rem; padding-inline: 0.1rem; gap: 0.25rem; font-size: 0.9rem; }
  .hub-actions .btn .ic { width: 1.15rem; height: 1.15rem; }
  .hub-actions .btn.big { min-height: var(--tap); font-size: 1rem; }

  /* the team sheet: three tabs, as on a phone, with the team style beside the pitch */
  .screen-sheet .bar-top { padding-block: 0.1rem; }
  .sheet-layout { grid-template-columns: minmax(0, 1fr) 26rem; grid-template-areas: none; gap: 0.35rem var(--gap); align-content: start; }
  .sheet-tabs { display: flex; grid-area: auto; grid-column: 1 / -1; }
  .sheet-tab { min-height: 36px; font-size: 0.95rem; }
  .sheet-board-col, .sheet-side, .sheet-rest { grid-area: auto; }
  .sheet-layout[data-tab="pitch"] > .sheet-rest, .sheet-layout[data-tab="pitch"] .sheet-takers, .sheet-layout[data-tab="pitch"] .sheet-remarks,
  .sheet-layout[data-tab="squad"] > .sheet-board-col, .sheet-layout[data-tab="squad"] > .sheet-side,
  .sheet-layout[data-tab="plan"] > .sheet-board-col, .sheet-layout[data-tab="plan"] > .sheet-rest { display: none; }
  .sheet-layout[data-tab="squad"] > .sheet-rest { grid-column: 1 / -1; }
  .sheet-layout[data-tab="plan"] > .sheet-side { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .sheet-layout[data-tab="plan"] .sheet-tactics { grid-row: 1 / span 2; }
  /* the pitch takes whatever height the tabs, the formations and the bench leave */
  .screen-sheet .screen-body { grid-auto-rows: 100%; }
  .sheet-layout[data-tab="pitch"] { grid-template-rows: auto minmax(0, 1fr); }
  .sheet-layout[data-tab="pitch"] > .sheet-board-col { display: flex; flex-direction: column; gap: 0.3rem; min-height: 0; align-self: stretch; }
  .sheet-board-col .formation-btn { min-height: 40px; }
  .sheet-board-col .formation-diagram { max-width: 2.1rem; }
  .sheet-board-col .board-pitch { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; border-width: 0.7rem 0.7rem 1.1rem; border-image-width: 0.7rem 0.7rem 1.1rem; padding: 0.15rem 0.3rem; }
  .sheet-board-col .pitch { flex: 1 1 0; aspect-ratio: auto; min-height: 12.5rem; }
  .sheet-board-col .bench { flex: none; margin-block-start: 0.3rem; padding-block-start: 0.4rem; }
  .sheet-board-col .chip-kid { padding-block: 0.05rem; }
  .sheet-board-col .chip-kid .portrait, .sheet-board-col .chip-hole { width: 1.7rem; height: 1.7rem; }
  .sheet-side { gap: 0.4rem; align-content: start; }
  .sheet-side .panel-paper { border-width: 0.8rem 0.9rem 0.9rem 1.5rem; border-image-width: 0.8rem 0.9rem 0.9rem 1.5rem; padding-block: 0; }
  .sheet-side .panel-paper::before { display: none; }
  .sheet-tactics > * + * { margin-block-start: 0.2rem; }
  .sheet-tactics h2 { font-size: 1rem; }
  .sheet-tactics .word-row { gap: 0.2rem; }
  .sheet-tactics .word-btn { min-height: 32px; padding: 0 0.35rem; font-size: 0.78rem; }
  .sheet-tactics .preset-note { font-size: 0.76rem; line-height: 1.2; }
  .sheet-tactics .dial { margin-block-start: 0.25rem; }
  .sheet-tactics .dial-head { margin-block-end: 0.05rem; line-height: 1.15; }
  .sheet-tactics .dial-head .small { font-size: 0.72rem; }
  .sheet-takers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.2rem 0.6rem; }
  .sheet-takers > * + * { margin-block-start: 0; }
  .sheet-takers .field { margin-block-end: 0; }
}
/* the same window under a finger (a small tablet on its side): the sheet's buttons keep the full touch height */
@media (min-width: 1000px) and (min-height: 521px) and (max-height: 800px) and (pointer: coarse) {
  .sheet-tab, .sheet-tactics .word-btn, .sheet-board-col .formation-btn, .hub-actions .btn { min-height: var(--tap); }
}
