/* Football Session Planner (Phase 0 proof). The form, the diagram editor, and the practice sheets: one A4 landscape
   sheet (1123 x 794 px) per practice, laid out like the reference (diagram left, coaching sections right). Colours on
   the sheets come from the session (set inline by the page script), never typed in here. */

.fsp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fsp-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.fsp-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.fsp-file:focus-visible + label { outline: 3px solid var(--graphite); outline-offset: 2px; }
.fsp-msg { margin: 8px 0 0; font-size: 15px; }
.fsp-fit { font-weight: 600; }
.fsp-custom { display: grid; gap: 8px; margin-top: 10px; }
.fsp-colour { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.fsp-colour input { width: 44px; height: 36px; padding: 0; border: 1px solid var(--silver); border-radius: 6px; background: none; }
.fsp-badge-thumb { width: 44px; height: 44px; object-fit: contain; border: 1px solid var(--silver); border-radius: 6px; }
.fsp-tick { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.fsp-tick input { width: 22px; height: 22px; accent-color: var(--graphite); }
.fsp-num { max-width: 120px; }
.fsp-link { border: 0; background: none; padding: 6px 0; font: inherit; font-size: 14px; text-align: left; color: var(--graphite); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 32px; }
.fsp-link[aria-current="true"] { font-weight: 650; }
.fsp-list { margin: 0; padding-left: 20px; display: grid; gap: 2px; }
.fsp-sec { min-height: 88px; }

/* ---------- the editor ---------- */
.fsp-editor { margin: 28px 0 0; display: grid; grid-auto-rows: max-content; gap: 10px; min-width: 0; } /* rows never squeezed: nothing above the diagram moves when something is selected */
.fsp-editor__which { margin: 2px 0 0; font-size: 14px; color: var(--slate); }
.fsp-editor .more { margin: 0; }
/* One tap, one action: no double-tap-to-zoom (or its wait) on anything in this tool's form or editor. */
#tool-form, .fsp-editor, .fsp-views, .result-bar { touch-action: manipulation; }
/* Save and Open: a compact bar at the top of the form, outside the filling-in order. */
.fsp-filebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; padding: 0 0 14px; border-bottom: 1px solid var(--silver); }
.fsp-filebar__l { font-size: 14px; font-weight: 600; color: var(--slate); margin-right: 4px; }
.fsp-filebar .btn { min-height: 44px; }
.fsp-filebar .fsp-msg { flex-basis: 100%; margin: 0; }
.fsp-secadd .btn, .fsp-letters .btn { min-height: 44px; }
.fsp-letters { display: grid; gap: 6px; justify-items: start; margin-bottom: 8px; }
.fsp-letters .field__hint { margin: 0; }
/* Drawing mode, said plainly above the diagram, with a way out. */
.fsp-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border: 2px solid var(--graphite); border-radius: 6px; }
.fsp-mode__t { flex: 1 1 200px; margin: 0; font-size: 15px; font-weight: 600; }
.fsp-mode .btn { min-height: 44px; }
/* Undo, Redo, zoom and Fit whole diagram: right above the diagram, so they're in view while editing. */
.fsp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.fsp-tools__g { display: flex; gap: 6px; }
.fsp-tools .btn { min-height: 44px; min-width: 44px; }
/* Narrow: zoom and Fit on the first row, Undo and Redo on the row right above the diagram. */
.fsp-zoom__b { font-size: 20px; line-height: 1; }
/* Narrow: zoom and Fit on the first row, Undo and Redo on the row right above the diagram; every thing to add in view, three to a row; the how-to line under the diagram, so the diagram itself comes up sooner. */
@media (max-width: 600px) {
  .fsp-tools__g { order: 2; flex-basis: 100%; }
  .fsp-editor .fsp-palette { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .fsp-editor .fsp-palette .btn { width: 100%; padding-left: 6px; padding-right: 6px; white-space: normal; line-height: 1.15; text-align: center; justify-content: center; }
  .fsp-editor > .fsp-below { order: 1; }
  .fsp-editor > .fsp-edhint { order: 2; }
  .fsp-editor > .fsp-keys, .fsp-editor > .more:not(#fsp-pitch-more) { order: 3; }
}
.fsp-editor__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fsp-editor__h { margin: 0; font-size: 17px; }
.fsp-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.fsp-palette .btn { min-height: 44px; }
.fsp-draw[aria-pressed="true"] { background: var(--graphite); color: var(--white); }
.fsp-stage { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 6px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; outline-offset: 3px; background: var(--white); }
/* No taller than the screen leaves room for the bar above it, so the bar and the whole diagram are in view together. */
@media screen and (min-width: 921px) { .fsp-editor > .fsp-stage { width: min(100%, calc(100vh - 230px)); justify-self: center; } }
.fsp-editor.is-full > .fsp-stage { width: 100%; }
.fsp-stage:focus-visible { outline: 3px solid var(--graphite); }
.fsp-stage svg { display: block; width: 100%; height: 100%; }
.fsp-stage [data-id] { cursor: grab; }
/* Words on the drawing (a player's letter, a label's text) pass a press through to their disc or chip. */
.fsp-stage text { pointer-events: none; }
.fsp-stage.is-drawing { cursor: crosshair; outline: 3px solid var(--graphite); outline-offset: -3px; } /* drawing mode shows on the diagram itself */
.fsp-stage .fsp-h { cursor: move; }
.fsp-below { display: grid; gap: 8px; align-content: start; }
.fsp-below__empty { display: none; margin: 0; font-size: 14px; color: var(--slate); }
/* The bigger view: nothing above the diagram ever changes size (the drawing bar and a selected thing's controls sit under
   it), and the space under it is kept at the height of its tallest contents, so selecting, unselecting or drawing
   never moves the diagram or the scroll. */
.fsp-editor.is-full .fsp-below { min-height: 260px; } /* the tallest: a player or label picked (236 px at 390 wide) */
.fsp-editor.is-full .fsp-below__empty:not([hidden]) { display: block; padding: 10px 2px; }
.fsp-selbar { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--silver); border-radius: 6px; }
.fsp-selwhat { margin: 0; font-size: 14px; font-weight: 600; }
/* Touch: every control here is at least 44 px. */
.fsp-nudge { display: flex; gap: 6px; }
.fsp-nudge__b { min-width: 44px; min-height: 44px; font-size: 18px; line-height: 1; }
.fsp-zoom { display: flex; align-items: center; gap: 6px; }
.fsp-zoom .btn { min-height: 44px; min-width: 44px; }
.fsp-zoom__level { min-width: 3em; text-align: center; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--slate); }
.fsp-selbar .btn { min-height: 44px; }
/* The bigger view: the editor fills the screen; the page underneath doesn't scroll. */
.fsp-editor.is-full { position: fixed; inset: 0; z-index: 60; margin: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--white); overflow: auto; align-content: start; }
.fsp-editor.is-full .fsp-stage { aspect-ratio: auto; height: min(calc(100vh - 390px), calc(100vw - 24px)); min-height: 280px; max-height: 900px; }
/* svh: the screen's height with the browser's bars showing, which doesn't change as they slide away, so the diagram
   doesn't resize while scrolling on a phone. */
@supports (height: 100svh) { .fsp-editor.is-full .fsp-stage { height: min(calc(100svh - 390px), calc(100vw - 24px)); } }
.fsp-editor.is-full .fsp-edhint, .fsp-editor.is-full .fsp-editor__which, .fsp-editor.is-full #fsp-keys, .fsp-editor.is-full .more { display: none; }
html.fsp-full, html.fsp-full body { overflow: hidden; }

/* ---------- the preview: one sheet at a time, scaled to fit ---------- */
.fsp-nav { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.fsp-nav__label { flex: 1; margin: 0; font-size: 15px; text-align: center; color: var(--slate); }
@media screen {
  .fsp-view { position: relative; width: 100%; display: grid; gap: 14px; }
  .fsp-view__pg { position: relative; overflow: hidden; border-radius: 6px; box-shadow: 0 2px 16px rgba(0, 0, 0, .14); background: var(--white); }
  .fsp-view__in { position: relative; width: 1123px; height: 794px; transform-origin: 0 0; }
  /* Every sheet, laid out at full size off screen: measured there, printed and put in the PDF from there. */
  .fsp-sheets { position: absolute; left: -40000px; top: 0; width: 1123px; pointer-events: none; }
}

/* ---------- a practice sheet ----------
   Laid out from the reference sheet (900 x 690 pt, i.e. 1200 x 920 px), scaled by A4's height (--k = 595.28 / 690)
   and centred across (--dx), approved by David on 28 Nov 2026. Every number below is the reference's own, in its px,
   times --k; the bands run to the paper's edges. Baselines: a line box of line-height 1 puts the baseline 0.952 of the
   size below its top in Oswald, 0.8 in Bebas Neue (1.2 ems tall, 0.9 above), and Barlow's 25 px lines put it 18.7 px
   below the line's top. Measured off the reference: kicker baseline 59, title 121, legend 790, first heading 213,
   heading to first line 31, line to line 25, last line to next heading 38, footer 908. Then calibrated against the
   reference PDF (tests/fixtures/fsp-reference/compare.py, 28 Nov 2026): the browser sets Oswald's and Barlow's
   baselines slightly higher than these sums give (0.5 to 1.4 px) and its letter-spacing a little tighter, so those
   few numbers carry the measured corrections. */
.fsp-page { --k: 0.862718; --dx: 43.626px; position: relative; width: 1123px; height: 794px; overflow: hidden; background: white; text-align: left; letter-spacing: normal; font-kerning: normal; }
.fsp-page > * { position: absolute; margin: 0; }
.fsp-page__band { left: 0; top: 0; width: 100%; height: calc(var(--k) * 150px); }
.fsp-page__kicker { left: calc(var(--dx) + var(--k) * 64px); top: calc(var(--k) * (60.05px - 15px * 0.952)); font: 600 calc(var(--k) * 15px) / 1 "Oswald", sans-serif; letter-spacing: 0.1223em; text-transform: uppercase; white-space: nowrap; }
.fsp-page__title { left: calc(var(--dx) + var(--k) * 64px); top: calc(var(--k) * (121px - 66px * 0.8)); font: 400 calc(var(--k) * 66px) / 1 "Bebas Neue", sans-serif; text-transform: uppercase; white-space: nowrap; }
.fsp-page__badge { right: calc(var(--dx) + var(--k) * 64px); top: calc(var(--k) * 23px); width: calc(var(--k) * 104px); height: calc(var(--k) * 104px); object-fit: contain; }
.fsp-page__panel { left: calc(var(--dx) + var(--k) * 64px); top: calc(var(--k) * 194px); width: calc(var(--k) * 560px); height: calc(var(--k) * 560px); box-sizing: border-box; border: calc(var(--k) * 1px) solid; border-radius: calc(var(--k) * 3px); }
.fsp-page__panel > svg { position: absolute; left: 0; top: 0; width: calc(var(--k) * 558px); height: calc(var(--k) * 558px); display: block; }
.fsp-page__words { position: absolute; left: 0; top: 0; width: calc(var(--k) * 558px); height: calc(var(--k) * 558px); }
.fsp-page__words span { position: absolute; font-family: "Oswald", sans-serif; font-weight: 600; line-height: 1; white-space: pre; }
.fsp-page__legend { left: calc(var(--dx) + var(--k) * 64px); top: calc(var(--k) * 777.7px); display: flex; align-items: flex-start; gap: calc(var(--k) * 20.2px); padding: 0; list-style: none; white-space: nowrap; }
.fsp-key { display: flex; align-items: flex-start; }
.fsp-key--line { gap: calc(var(--k) * 6.7px); }
.fsp-key--dot { gap: calc(var(--k) * 4.75px); }
.fsp-key__sw { height: calc(var(--k) * 14px); flex: none; display: block; }
.fsp-key span { margin-top: calc(var(--k) * (790px - 777px - 13px * 0.952)); font: 600 calc(var(--k) * 13px) / 1 "Oswald", sans-serif; letter-spacing: 0.04em; text-transform: uppercase; }
.fsp-page__col { top: calc(var(--k) * (213.5px - 18px * 0.952)); width: calc(var(--k) * 457px); height: calc(var(--k) * (870px - 213px + 18px * 0.952)); overflow: hidden; }
.fsp-page__col--1 { left: calc(var(--dx) + var(--k) * 64px); }
.fsp-page__col--2 { left: calc(var(--dx) + var(--k) * 679px); }
.fsp-page__right { left: calc(var(--dx) + var(--k) * 679px); top: calc(var(--k) * (213.5px - 18px * 0.952)); width: calc(var(--k) * 457px); height: calc(var(--k) * (870px - 213px + 18px * 0.952)); overflow: hidden; }
.fsp-s { margin: 0 0 calc(var(--k) * 14.56px); }
.fsp-s__h { margin: 0 0 calc(var(--k) * 11.44px); font: 600 calc(var(--k) * 18px) / 1 "Oswald", sans-serif; letter-spacing: 0.015em; text-transform: uppercase; }
.fsp-s__l { position: relative; top: calc(var(--k) * 0.94px); margin: 0; padding: 0 0 0 calc(var(--k) * 21px); list-style: none; font: 400 calc(var(--k) * 15.5px) / calc(var(--k) * 25px) "Barlow", sans-serif; }
.fsp-s__l li { position: relative; margin: 0; }
.fsp-s__l li::before { content: ""; position: absolute; left: calc(var(--k) * -15px); top: calc(var(--k) * (18.7px - 5.5px - 2.5px)); width: calc(var(--k) * 5px); height: calc(var(--k) * 5px); border-radius: 50%; background: currentColor; }
.fsp-s__l strong { font-weight: 700; }
.fsp-page__foot { left: 0; top: calc(var(--k) * 880px); width: 100%; height: calc(794px - var(--k) * 880px); }
.fsp-page__footer { left: calc(var(--dx) + var(--k) * 64px); top: calc(var(--k) * (908.5px - 14px * 0.952)); font: 600 calc(var(--k) * 14px) / 1 "Oswald", sans-serif; letter-spacing: 0.1433em; text-transform: uppercase; white-space: nowrap; }

/* ---------- paper: one practice per A4 landscape sheet, edge to edge ---------- */
@page { size: A4 landscape; margin: 0; }
@page :first { margin: 0; }
@media print {
  .fsp-nav, .fsp-view, .fsp-issues { display: none !important; }
  /* Held back: something to fix first (Before you print); the sheets don't print, a note says why. */
  html.fsp-blocked .fsp-sheets { display: none !important; }
  html.fsp-blocked .fsp-print-blocked { display: block !important; font: 600 16pt/1.4 sans-serif; margin: 20mm; }
  .fsp-sheets { position: static !important; left: auto !important; width: auto !important; }
  .fsp-sheets .fsp-page { break-after: page; break-inside: avoid; }
  .fsp-sheets .fsp-page:last-child { break-after: auto; }
  #sheet.fsp-sheetarea { margin: 0 !important; padding: 0 !important; }
}
@media (max-width: 600px) { .fsp-two { grid-template-columns: minmax(0, 1fr); } }

/* Phones can't show a "Leave page?" prompt, so with session files hidden they get this line instead (David, 29 Nov 2026). */
.fsp-keep { display: none; }
@media screen and (max-width: 920px) {
  .fsp-keep { display: block; margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; background: var(--mist); font-size: 15px; font-weight: 600; color: var(--graphite); }
}

/* ---------- phones: Details, Diagram and Preview, one at a time (the switch sticks under the site header) ---------- */
.fsp-views { display: none; }
@media screen and (max-width: 920px) {
  .fsp-views { display: flex; gap: 4px; position: sticky; top: var(--fsp-top, 0px); z-index: 25; margin: 18px 0 0; padding: 4px; border-radius: 12px; background: rgba(238, 238, 241, .94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  .fsp-views__b { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: none; font: inherit; font-size: 15px; font-weight: 600; color: var(--slate); cursor: pointer; }
  .fsp-views__b[aria-pressed="true"] { background: var(--white); color: var(--graphite); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
  .tool-layout { margin-top: 14px; }
  html[data-fsp-view="preview"] #tool-form, html[data-fsp-view="diagram"] #tool-form { display: none; }
  html[data-fsp-view="form"] .tool-layout > section > .result-bar, html[data-fsp-view="form"] .fsp-nav, html[data-fsp-view="form"] .fsp-view, html[data-fsp-view="form"] .print-reason { display: none; }
  html[data-fsp-view="diagram"] .tool-layout > section > .result-bar, html[data-fsp-view="diagram"] .fsp-nav, html[data-fsp-view="diagram"] .fsp-view, html[data-fsp-view="diagram"] .print-reason { display: none; }
  html[data-fsp-view="form"] .fsp-editor, html[data-fsp-view="preview"] .fsp-editor { display: none; }
  html[data-fsp-view="diagram"] .fsp-editor { margin-top: 0; }
}

/* ---------- fixing before printing: counts, field errors, the list ---------- */
.fsp-count { margin: 6px 0 0; font-size: 14px; color: var(--slate); }
.fsp-count.is-bad, .fsp-err { color: var(--graphite); font-weight: 600; }
.fsp-err { margin: 6px 0 0; font-size: 14px; }
.fsp-editor .input[aria-invalid="true"], #tool-form .input[aria-invalid="true"] { border-color: var(--graphite); box-shadow: inset 0 0 0 2px var(--graphite); }
.fsp-print-blocked { display: none; }
.fsp-issues { margin: 0 0 14px; padding: 14px 16px; border: 2px solid var(--graphite); border-radius: 8px; background: var(--white); }
.fsp-issues__h { margin: 0 0 4px; font-size: 17px; }
.fsp-issues__p { margin: 0 0 8px; font-size: 14px; color: var(--slate); }
.fsp-issues__l { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.fsp-issue p { margin: 0 0 6px; font-size: 15px; overflow-wrap: anywhere; }
.fsp-issue .btn { min-height: 44px; }
