/* ==========================================================================
   DESIGN TOKENS — one source of truth for the whole app.
   Change a value here and it changes everywhere. Do not hard-code a hex,
   radius, shadow or spacing value below this block.

   Brand: Bengals orange on true black, white sheet, black type.
   Contrast: every text/background pair below meets WCAG AA (4.5:1) at the size
   it is used, so the screen stays readable in direct sun on a sideline.
   ========================================================================== */
:root {
  /* --- brand ------------------------------------------------------------ */
  --black: #000000;
  --orange: #fb4f14;          /* primary action, on-field accent            */
  --orange-dark: #b83505;     /* orange text on white — AA at body size     */
  --orange-tint: #ffece2;     /* orange wash for chips and bands            */
  --orange-tint-2: #fde3d2;   /* one step deeper, for the Needs band        */

  /* --- surfaces --------------------------------------------------------- */
  --bg: #efefec;
  --card: #ffffff;
  --surface: #fbfbfa;         /* panel inside a card                        */
  --surface-2: #f4f4f2;       /* recessed panel (Off Field)                 */
  --surface-dark: #141414;    /* dark chrome: tabs, on-field cards          */

  /* --- type ------------------------------------------------------------- */
  --ink: #0b0b0b;
  --ink-2: #3d3d3d;           /* secondary text on white                    */
  --muted: #5f5f5f;           /* AA on --card and on --surface              */
  --on-dark: #ffffff;
  --on-dark-2: #c9c9c9;       /* secondary text on black — AA               */
  --line: #d9d9d5;
  --line-dark: #2e2e2e;

  /* --- status semantics ------------------------------------------------- *
     Used identically on lineup cards, the game table, stat tiles and the
     review list, so one color always means one thing.                      */
  --met: #157a3c;             /* at or above target — calm, never shouts    */
  --met-on-dark: #6fd39b;
  --met-tint: #e9f7ec;
  --short: var(--orange-dark);/* below target — needs attention             */
  --short-on-dark: #ffb37a;
  --danger: #c40000;          /* wrong number on the field, destructive act */
  --danger-soft: #ffe9e9;
  --caution: #fff6d8;         /* explanatory notes                          */

  /* legacy aliases kept so older rules keep working */
  --soft-orange: var(--orange-tint);
  --warning: var(--caution);
  --success: var(--met-tint);

  /* --- shape and depth -------------------------------------------------- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.05);
  --shadow-2: 0 5px 18px rgba(0,0,0,.05);
  --shadow-3: 0 -6px 22px rgba(0,0,0,.28);
  --ring: 0 0 0 3px #ffffff, 0 0 0 6px var(--orange);

  /* --- spacing rhythm (4px base) ---------------------------------------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px;

  /* --- minimum touch target --------------------------------------------- */
  --tap: 48px;
}

* { box-sizing: border-box; }
/* Elements below use display:flex/grid, which would otherwise beat [hidden]. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  /* proportional figures read better in prose; numbers opt into tabular below */
  font-variant-numeric: proportional-nums;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

/* --- touch quality -------------------------------------------------------
   Kills the 300ms tap delay and the double-tap-to-zoom gesture on the game
   controls, stops a fast tap from selecting text, and removes the grey iOS
   tap flash so the app's own press state is the only feedback. */
button, .tab, .pcard, .chip, label.picker-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* --- keyboard and switch-control focus ----------------------------------
   Visible on keyboard focus only, never on a finger tap. */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.pcard:focus-visible, .tab:focus-visible, .enter-play:focus-visible { border-radius: var(--r-md); }

/* --- respect reduced motion --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* --- numbers line up --------------------------------------------------- */
.pc-num, .pc-plays, .stat-card strong, .pb-stat strong, .fp-count,
.number-input, .progress-text, .needs-body, .count-chip {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* --- screen-reader-only live region ------------------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------- header --------------------------------- */
.app-header {
  background: var(--black);
  color: white;
  padding: 22px clamp(16px, 4vw, 52px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 0;
}
.stripe-bar {
  height: 12px;
  background: repeating-linear-gradient(112deg, var(--orange) 0 30px, #000 30px 40px);
}
.eyebrow { color: var(--orange); font-weight: 900; letter-spacing: .18em; margin: 0 0 4px; font-size: 13px; }
h1 { margin: 0; font-size: clamp(26px, 4vw, 44px); font-weight: 900; letter-spacing: -.015em; text-transform: uppercase; }
.subhead { margin: 6px 0 0; color: var(--on-dark-2); max-width: 720px; line-height: 1.45; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  background: var(--surface-dark);
  color: var(--on-dark-2);
  border: 1px solid var(--line-dark);
  border-radius: var(--r-pill);
  padding: 12px 22px;
  font-weight: 800;
  min-height: var(--tap);
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.tab:hover { border-color: var(--orange); color: var(--on-dark); }
.tab.active { background: var(--orange); border-color: var(--orange); color: var(--on-dark); }

/* -------------------------------- layout -------------------------------- */
main { padding: 24px clamp(12px, 3vw, 42px) 80px; max-width: 1500px; margin: 0 auto; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 22px;
  margin-bottom: var(--s-5);
}
.section-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 22px; }
.section-title p { margin: 5px 0 0; color: var(--muted); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.panel-footer { margin-top: 18px; display: flex; justify-content: flex-end; }

/* -------------------------------- buttons ------------------------------- */
.primary, .secondary, .danger, .ghost-danger {
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 800;
  border: 1px solid transparent;
  min-height: 48px;
}
.primary { background: var(--orange); color: white; }
.primary:hover { background: var(--orange-dark); }
.primary:disabled { background: #e2c0b1; cursor: not-allowed; }
.secondary { background: white; color: var(--ink); border-color: #bdbdb8; }
.secondary:hover { border-color: var(--orange); color: var(--orange-dark); }
.danger { background: var(--danger); color: white; }
.danger:hover { background: #a30000; }
.danger:disabled { background: #e9a5a5; cursor: not-allowed; }
.ghost-danger { background: white; color: var(--danger); border-color: #e6b9b9; }
.ghost-danger:hover { background: var(--danger-soft); }
.big { padding: 14px 26px; font-size: 17px; }
.link-btn { background: none; border: 0; color: var(--orange-dark); font-weight: 800; padding: 8px; }

.pill {
  display: inline-flex; align-items: center; padding: 8px 14px;
  background: #eeeeeb; border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: 13px; font-weight: 800; color: var(--ink-2);
}

/* -------------------------------- inputs -------------------------------- */
.grid-4 { display: grid; grid-template-columns: 1.1fr 1fr .8fr 1.6fr; gap: 14px; }
label { font-size: 13px; font-weight: 800; color: #454545; display: grid; gap: 7px; }
label.mini { font-size: 12px; }
label.grow { flex: 1; }
input, select {
  width: 100%;
  border: 1px solid #cfcfcc;
  border-radius: 9px;
  padding: 11px 10px;
  background: white;
  color: var(--ink);
  min-height: 46px;
}
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--orange); }
input:focus, select:focus { outline: 2px solid rgba(251,79,20,.25); border-color: var(--orange); }
.number-input { width: 72px; text-align: center; }
.number-input.wide { width: 100%; max-width: 110px; }
.inline-warning { color: var(--danger); font-weight: 700; margin: 12px 0 0; }

/* ----------------------------- start picker ----------------------------- */
.picker-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 10px; flex-wrap: wrap; }
.picker-actions { display: flex; gap: 6px; }
.count-chip {
  display: inline-flex; align-items: center; margin-left: 10px;
  background: var(--soft-orange); color: var(--orange-dark);
  border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 900;
  white-space: nowrap;
}
.count-chip.none { background: #ececea; color: #777; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.picker-grid.empty { color: var(--muted); display: block; }
.picker-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; background: #fafaf9;
  font-size: 15px; font-weight: 600; color: var(--ink);
  cursor: pointer; min-height: 56px;
}
.picker-item:has(input:checked) { border-color: var(--orange); background: var(--soft-orange); }
.picker-jersey { font-weight: 900; min-width: 40px; color: var(--orange-dark); font-size: 16px; }
.picker-name { font-weight: 700; }
.modal-picker { max-height: 320px; overflow-y: auto; grid-template-columns: 1fr; }

/* -------------------------------- table --------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1080px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #6e6e6e; padding: 9px 8px; border-bottom: 2px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid #ececea; vertical-align: middle; }
tr.status-special { background: #fff9f5; }
tr.status-other { background: #f8f8f7; }
tr.needs-review { box-shadow: inset 4px 0 0 #d88b00; }
.cell-jersey { font-weight: 900; color: var(--orange-dark); white-space: nowrap; font-size: 17px; }
.cell-name { font-weight: 700; min-width: 150px; }
.reason-stack { min-width: 190px; display: grid; gap: 6px; }
.status-select { min-width: 148px; }
.counter { display: flex; align-items: center; gap: 6px; }
.count-btn { width: 48px; height: 48px; border: 1px solid #d2d2cf; background: #fafafa; border-radius: 10px; font-weight: 900; font-size: 22px; }
.count-btn:hover { border-color: var(--orange); }
.count-btn:active { background: var(--soft-orange); }
.progress-cell { min-width: 120px; }
.bar { height: 8px; border-radius: 999px; background: #ececea; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s ease; }
.progress-text { display: block; margin-top: 4px; color: var(--muted); }
.field-toggle { white-space: nowrap; border: 1px solid #c7c7c3; background: #f4f4f2; color: #555; border-radius: 999px; padding: 12px 14px; font-weight: 800; min-width: 96px; min-height: 48px; }
.field-toggle.active { background: var(--black); color: white; border-color: var(--black); }
.remove-btn { border: 1px solid transparent; background: transparent; font-size: 24px; color: #9b9b9b; width: 44px; height: 44px; border-radius: 10px; }
.remove-btn:hover { color: var(--danger); border-color: #e6b9b9; background: var(--danger-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 14px; }
.legend span { background: #f4f4f2; padding: 7px 9px; border-radius: 8px; }

.mini-table { min-width: 520px; }
.mini-table td, .mini-table th { padding: 8px; }

/* ------------------------------ dashboard ------------------------------- */
.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
/* Stat tiles: label small and quiet, number large and loud, and a colored
   top rule that carries the same meaning it carries everywhere else. */
.stat-card { margin-bottom: 0; display: grid; gap: var(--s-1); padding: var(--s-4) var(--s-5); }
.stat-label {
  color: var(--muted); font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
}
.stat-card strong { font-size: 38px; font-weight: 900; letter-spacing: -.03em; line-height: 1.05; }
.stat-card { border-top: 4px solid var(--black); }
.stat-card.attention { background: var(--caution); border-top-color: var(--danger); }
.stat-card.attention strong { color: var(--danger); }
#metTargetCount { color: var(--met); }

/* -------------------------------- review -------------------------------- */
.review-list { display: grid; gap: 10px; }
.review-list.empty { color: var(--muted); }
.review-item { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-item.ok { background: var(--success); }
.review-item.warn { background: var(--warning); }
.review-item.special { background: var(--soft-orange); }
.review-item.explained { background: #f4f4f2; }
.review-main strong { display: block; }
.review-main small { color: var(--muted); }
.badge { border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 900; background: #efefec; white-space: nowrap; }

/* -------------------------------- roster -------------------------------- */
.add-player-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.add-player-row label { flex: 0 0 120px; }
.add-player-row label:nth-of-type(2) { flex: 1 1 260px; }

.roster-filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chip { border: 1px solid #cfcfcc; background: white; border-radius: 999px; padding: 10px 18px; font-weight: 800; color: #555; min-height: 44px; }
.chip.active { background: var(--black); color: white; border-color: var(--black); }

.roster-list { display: grid; gap: 12px; }
.roster-list.empty { color: var(--muted); }
.roster-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: #fcfcfb;
}
.roster-item.inactive { background: #f3f3f1; opacity: .92; }
.roster-fields { display: flex; gap: 12px; align-items: flex-end; }
.roster-fields label:first-child { flex: 0 0 92px; }
.roster-meta { display: grid; gap: 4px; }
.meta-note { color: var(--muted); font-size: 13px; }
.state-badge { justify-self: start; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 900; }
.state-badge.on { background: var(--success); color: #17632c; }
.state-badge.off { background: #e6e6e3; color: #5a5a5a; }
.roster-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ------------------------------ duplicates ------------------------------ */
.dupe-panel { border: 1px solid #e2c9a2; background: #fffaf0; border-radius: 14px; padding: 16px; margin-bottom: 18px; }
.dupe-panel.clean { border-color: #bfe0c6; background: var(--success); }
.dupe-panel p { margin: 6px 0 0; color: #5a5a5a; }
.dupe-group { border-top: 1px solid #ecdcc2; margin-top: 14px; padding-top: 14px; display: grid; gap: 10px; }
.dupe-reason { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--orange-dark); }
.dupe-option { display: flex; align-items: center; gap: 12px; background: white; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-weight: 600; cursor: pointer; }
.dupe-option small { display: block; color: var(--muted); font-weight: 600; }
.dupe-group button { justify-self: start; }

/* -------------------------------- history ------------------------------- */
.history-list { display: grid; gap: 12px; }
.history-list.empty, .season-list.empty { color: var(--muted); }
.history-game { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fcfcfb; }
.history-game summary { cursor: pointer; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; min-height: 40px; }
.history-game summary span { color: var(--muted); font-size: 14px; }
.history-notes { color: var(--muted); margin: 8px 0 0; }
.off-roster { color: var(--muted); font-weight: 700; }

.season-list { display: grid; gap: 8px; }
.season-item { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #ececea; padding: 10px 2px; flex-wrap: wrap; }
.season-nums { color: var(--muted); }

/* --------------------------------- modal -------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17,17,17,.55);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50;
}
.modal {
  background: white; border-radius: 16px; padding: 22px;
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.modal h3 { margin: 0 0 12px; font-size: 20px; }
.modal-body p { margin: 0 0 10px; }
.modal-hint { color: var(--muted); }
.modal-warn { background: var(--warning); border-radius: 10px; padding: 10px 12px; }
.modal-check { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; font-size: 14px; color: var(--ink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.toast { position: fixed; right: 20px; bottom: 20px; background: #111; color: white; padding: 14px 18px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); z-index: 60; max-width: 90vw; }

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .roster-item { grid-template-columns: 1fr; }
  .roster-actions { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .app-header { flex-direction: column; align-items: stretch; }
  .tabs .tab { flex: 1; text-align: center; }
  .grid-4, .dashboard-grid { grid-template-columns: 1fr; }
  .section-title { flex-direction: column; }
  .section-title .btn-row, .section-title .btn-row button { width: 100%; }
  .add-player-row { flex-direction: column; align-items: stretch; }
  .add-player-row label, .add-player-row button { width: 100%; }
  .number-input.wide { max-width: none; }
  .panel-footer button { width: 100%; }
  .roster-actions button { flex: 1; }
}

/* ------------------------- sideline play bar ---------------------------- */
/* iPhone home-indicator safe area: the bar sits above it, never under it,
   and the page reserves the bar's real height including that inset. */
body.has-play-bar { padding-bottom: calc(116px + env(safe-area-inset-bottom, 0px)); }
.play-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--black);
  border-top: 5px solid var(--orange);
  box-shadow: var(--shadow-3);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.play-bar-inner {
  max-width: 1500px; margin: 0 auto;
  padding: var(--s-3) clamp(12px, 3vw, 42px);
  padding-left: max(clamp(12px, 3vw, 42px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(12px, 3vw, 42px), env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.pb-stat { display: grid; gap: 2px; min-width: 88px; }
.pb-stat span { color: var(--on-dark-2); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.pb-stat strong { color: var(--on-dark); font-size: 26px; line-height: 1.1; }
.pb-stat.last strong { font-size: 17px; font-weight: 800; }
.pb-stat strong.off-count { color: #ff8a8a; }

.enter-play {
  flex: 1 1 320px;
  background: var(--orange); color: white;
  border: 0; border-radius: 14px;
  padding: 20px 24px;
  font-size: 22px; font-weight: 900; letter-spacing: .01em;
  min-height: 72px;
  text-transform: uppercase;
}
.enter-play { transition: background .12s ease, transform .06s ease; }
.enter-play:hover { background: #e0430c; }
.enter-play:active { transform: translateY(2px) scale(.995); }
.enter-play.off-count { background: var(--danger); }
.enter-play.off-count:hover { background: #a80000; }

.undo-play {
  background: transparent; color: var(--on-dark-2);
  border: 1px solid #4a4a4a; border-radius: var(--r-md);
  padding: 16px 18px; font-weight: 800; min-height: 60px;
  transition: border-color .12s ease, color .12s ease;
}
.undo-play:hover { border-color: var(--on-dark); color: var(--on-dark); }
.undo-play:disabled { color: #6a6a6a; border-color: #2b2b2b; cursor: not-allowed; }

.play-bar.flash { animation: pbflash .45s ease; }
@keyframes pbflash {
  0% { border-top-color: #ffffff; }
  100% { border-top-color: var(--orange); }
}

@media (max-width: 720px) {
  body.has-play-bar { padding-bottom: calc(190px + env(safe-area-inset-bottom, 0px)); }
  .play-bar-inner { gap: 10px; }
  .enter-play { flex: 1 1 100%; order: -1; }
  .undo-play { flex: 1 1 100%; }
  .pb-stat { flex: 1; min-width: 0; }
  .pb-stat strong { font-size: 20px; }
  .pb-stat.last strong { font-size: 14px; }
}

/* --------------------------- lineup card board -------------------------- */
.field-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-panel { border: 1px solid var(--line); border-radius: 14px; padding: var(--s-3); background: var(--surface); }
.field-panel.off { background: var(--surface-2); }
.field-panel h3 {
  margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.fp-count {
  background: var(--black); color: var(--on-dark); border-radius: var(--r-pill);
  padding: 2px 10px; font-size: 13px; font-weight: 900; letter-spacing: 0;
}
.fp-count.off-count { background: var(--danger); }

/* Needs Plays — read-only awareness line. Fixed height so the lineup cards
   below it never move when the numbers change. */
.needs-strip {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; padding: 8px 12px;
  border: 1px solid var(--line); border-left: 4px solid var(--orange);
  border-radius: var(--r-sm); background: var(--surface);
  height: 40px; box-sizing: border-box; overflow: hidden;
}
.needs-label {
  flex: 0 0 auto; font-size: 11px; font-weight: 900;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.needs-body {
  flex: 1 1 auto; min-width: 0;
  display: block; white-space: nowrap;
  /* scrolls sideways inside the strip only — the strip height never changes,
     so the lineup cards below it never move */
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  font-size: 14px; font-weight: 800; color: var(--ink);
}
.needs-body::-webkit-scrollbar { display: none; }
.needs-body.quiet, .needs-body.all-met { font-weight: 600; color: var(--muted); }
.needs-item em { font-style: normal; color: var(--short); font-weight: 900; }
.needs-dot { color: var(--line); padding: 0 7px; }
.needs-more { color: var(--muted); font-weight: 600; padding-left: 8px; }

.pcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pcard-empty { grid-column: 1 / -1; margin: 6px 2px; color: var(--muted); font-size: 13px; }

.pcard {
  position: relative;
  display: grid; gap: 0; justify-items: center; align-content: center;
  border: 2px solid #cfcfca; border-radius: var(--r-md);
  background: var(--card); color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: transform .06s ease, border-color .12s ease, box-shadow .12s ease;
  padding: 7px 6px 20px;
  min-height: 92px;
  line-height: 1.05;
  text-align: center;
  overflow: hidden;
}
.pcard:hover { border-color: var(--orange); box-shadow: 0 2px 10px rgba(251,79,20,.18); }
.pcard:active { transform: scale(.96); }
.pc-first, .pc-last {
  font-size: 11px; font-weight: 700; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pc-first { color: var(--muted); }
.pc-last { color: var(--ink); font-weight: 800; }
.pc-num { font-size: 31px; font-weight: 900; letter-spacing: -.03em; color: var(--orange-dark); }
.pc-foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 7px 4px;
  font-size: 11px; font-weight: 900;
}
.pc-status { color: var(--muted); }
.pc-plays { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 12px; }
.pc-check { color: var(--met); font-size: 12px; }

/* Below target vs at target is carried entirely by the count in the corner.
   No band, no badge — the number is the signal. */
.pcard.below .pc-plays { color: var(--short); }
.pcard.met .pc-plays { color: var(--met); }

/* on the field: black card, orange number */
#onFieldGrid .pcard { background: var(--black); border-color: var(--black); color: var(--on-dark); }
#onFieldGrid .pcard .pc-first { color: var(--on-dark-2); }
#onFieldGrid .pcard .pc-last { color: var(--on-dark); }
#onFieldGrid .pcard .pc-num { color: var(--orange); }
#onFieldGrid .pcard .pc-status { color: #a8a8a8; }
#onFieldGrid .pcard .pc-plays { color: var(--on-dark); }
#onFieldGrid .pcard:hover { border-color: var(--orange); }
#onFieldGrid .pcard.below .pc-plays { color: var(--short-on-dark); }
#onFieldGrid .pcard.met .pc-plays { color: var(--met-on-dark); }
#onFieldGrid .pcard .pc-check { color: var(--met-on-dark); }

/* exception statuses stay readable on both sides */
.pcard.status-S { border-color: var(--orange); }
.pcard.status-S .pc-status { color: var(--orange-dark); }
#onFieldGrid .pcard.status-S .pc-status { color: var(--orange); }
.pcard.status-O { border-style: dashed; }

@media (max-width: 760px) {
  .field-split { grid-template-columns: 1fr; }
  .pcard-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .pcard { min-height: 86px; }
  .pc-num { font-size: 26px; }
  .needs-strip { gap: 8px; padding: 8px 10px; }
  .needs-label { font-size: 10px; }
  .needs-body { font-size: 13px; }
}

/* ==========================================================================
   PRINT — a clean one-page-per-game summary a coach can hand to a parent.
   Everything interactive drops away; the numbers and reasons stay.
   ========================================================================== */
@media print {
  @page { size: letter portrait; margin: 0.6in 0.55in; }

  body { background: #fff; padding-bottom: 0 !important; }
  .app-header { background: #fff; color: #000; padding: 0 0 10px; border-bottom: 3px solid #000; }
  .app-header .subhead { color: #333; }
  .eyebrow { color: #000; }

  /* controls and chrome have no meaning on paper */
  .tabs, .stripe-bar, .play-bar, .btn-row, .picker-actions, .roster-filters,
  .modal-backdrop, .toast, #startGamePanel, .count-btn, .field-toggle,
  .remove-btn, .link-btn, #addFromRosterBtn, .needs-strip, .legend { display: none !important; }

  /* every tab prints, not just the one on screen */
  .view[hidden] { display: block !important; }

  .card {
    box-shadow: none; border: 1px solid #bbb; border-radius: 0;
    padding: 12px; margin-bottom: 12px; break-inside: avoid;
  }
  .section-title h2 { font-size: 15pt; }
  .section-title p { color: #444; }

  /* the lineup board prints as a plain at-a-glance grid */
  .field-split { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pcard { box-shadow: none; min-height: 78px; break-inside: avoid; }
  #onFieldGrid .pcard { background: #fff !important; color: #000 !important; border: 2px solid #000; }
  #onFieldGrid .pcard .pc-first, #onFieldGrid .pcard .pc-last,
  #onFieldGrid .pcard .pc-status, #onFieldGrid .pcard .pc-plays { color: #000 !important; }
  #onFieldGrid .pcard .pc-num { color: #000 !important; }

  /* the game table is the point of the printout */
  .table-wrap { overflow: visible; }
  table { font-size: 9pt; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr { break-inside: avoid; }
  input, select { border: 0 !important; background: transparent !important; padding: 0 !important; }
  .number-input { width: auto; text-align: left; }

  .review-item, .history-item, .season-row { break-inside: avoid; }
  a[href]::after { content: ""; }
}

/* ---------------------------- backup & restore --------------------------- */
.backup-row { gap: var(--s-3); flex-wrap: wrap; }
.backup-row .primary.big, .backup-row .secondary { min-height: var(--tap); }
.backup-hint { margin: var(--s-3) 0 0; color: var(--muted); font-size: 13px; max-width: 62ch; }
.pill.attention-pill {
  background: var(--danger-soft); border-color: #f3bcbc; color: var(--danger);
}
@media (max-width: 560px) {
  .backup-row { flex-direction: column; align-items: stretch; }
  .backup-row button { width: 100%; }
}
