/* Coach presentation overrides, isolated from stat and event contracts. */
.shell, .page, .card, .grow, .film-main, .tagger-body > *, .clip-body { min-width: 0; }
.box-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.box-table tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.coach-snapshot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.coach-snapshot > div { display: flex; flex-direction: column; gap: var(--space-tight); }
.coach-snapshot strong { font-size: 24px; }
.coach-snapshot span { font-size: var(--type-body); }
.print-scope, .stats-filter-toggle { display: none; }
@media screen and (max-width: 899px) {
  .ai-coach, .film-ready, .ai-takeaways { display: flex; }
  .tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tabs a { font-size: var(--type-body); min-width: 0; }
  .page { padding-inline: 12px; }
  .card { padding: 14px 12px; }
  .page, .tagger, .clip-viewer { overflow-wrap: anywhere; }
  .film-head h1 { flex-basis: 12rem; }
  .page-head, .home-row, .game-line, .item, .last-game-body { flex-wrap: wrap; }
  .page :is(button, input, select, textarea, .btn, .keys-link, .linkish, .stats-pick label):not(.key),
  .tagger :is(button, input, select):not(.key), .clip-viewer :is(button, input, select) {
    min-height: 44px; min-width: 0; max-width: 100%; font-size: var(--type-body);
  }
  .page :is(.btn, .keys-link, .linkish), .tagger button, .clip-viewer button { min-width: 44px; }
  .keys-link { display: inline-flex; align-items: center; white-space: normal; }
  .page :is(.muted, .lbl, .takeaway-detail, .takeaway-drill, .box-table, .box-table thead th) { font-size: var(--type-body); }
  .page .box-table :is(a, button, a.keys-link) { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  .box-table tr > :first-child:not([colspan]) { max-width: 140px; white-space: normal; overflow-wrap: anywhere; }
  .box-table th, .box-table td { padding: 10px 8px; }
  .page :is(img, svg, video), .tagger video, .clip-viewer video { max-width: 100%; }
  .stats-filter-panel { display: contents; }
  .stats-filter-toggle { display: block; position: sticky; top: 0; z-index: 3; max-height: 15vh; overflow-y: auto; background: var(--surface); }
  .stats-filter-panel:not(.filters-open) .stats-controls { display: none; }
  .phone-more { position: relative; }
  .phone-more summary { min-height: 48px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
  .phone-more summary[aria-current="true"] { color: var(--data-ink); }
  .phone-more-links { position: absolute; top: 100%; right: 0; width: 200px; max-height: 65vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-popover); z-index: 12; }
  .phone-more-links a { min-height: 44px; }
  .box-table td:not(:first-child) { white-space: nowrap; overflow-wrap: normal; }
  .coach-scope { position: sticky; top: 0; z-index: 2; background: var(--surface); padding-block: 8px; }
  .coach-scope select { flex: 1 1 130px; }
  .bars { max-width: 100%; overflow-x: auto; flex-shrink: 0; }
  .tagger-body { grid-template-columns: minmax(0, 1fr); }
  .tagger :is(.row, .q), .clip-viewer .row { flex-wrap: wrap; }
  .clip-viewer .clip-body { max-width: 100%; }
  .stats, .stats-trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Phone audit: shrink intrinsic content rather than clipping the page. */
  :is(.page, .tagger, .clip-viewer) { overflow-wrap: anywhere; }
  :is(.page, .tagger, .clip-viewer) :is(.row, .card, .item, .list, label, h1, h2, .score-side, .score-mid) {
    min-width: 0; max-width: 100%;
  }
  .score-mid { flex: 0 1 auto; }
  :is(.page, .tagger, .clip-viewer) :is(a, button, input, select, textarea, summary, label[for], .btn):not(.sr-only):not(.key):not([type="checkbox"]):not([type="radio"]):not(.box-table a) {
    min-width: 44px; min-height: 44px; max-width: 100%; white-space: normal;
  }
  :is(.page, .tagger, .clip-viewer) a:not(.card):not(.item) {
    display: inline-flex; align-items: center;
  }
  :is(.page, .tagger, .clip-viewer) small { font-size: var(--type-caption); }
  /* Checkboxes/radios keep native size; their wrapping label carries the tap area. */
  :is(.page, .tagger, .clip-viewer) label:has(> :is(input[type="checkbox"], input[type="radio"])) {
    min-height: 44px; display: inline-flex; align-items: center; gap: var(--space-2);
  }
  /* Keep "Add and start tagging" reachable while the add-game card is on screen. Sticky (not fixed) so
     it never floats over other content, e.g. when the card sits at the end of Home. */
  .add-game .btn.primary {
    position: sticky;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    min-height: 48px; z-index: 4;
  }
  /* Coach Home phone: the last-game card is a real block link (the generic
     phone link rule would inline-flex it), and its 4-stat snapshot drops to
     two columns so it fits without sideways scroll. */
  .compact-home a.home-last.coach-home-card { display: block; }
  .home-last .home-snapshot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Tagger game tabs stay on one line so Summary/Clips/Tag/Film keep their
     full labels and remain tappable. */
  .tagger > .game-tabs .game-tab { white-space: nowrap !important; }
}
/* Live bench tagger (roadmap step sf-live-bench-1): phone-first, one hand,
   every control at least 56px tall. */
.live-bench { max-width: 860px; }
.live-bench :is(button, .btn, input) { min-height: 56px; }
.live-bench .live-bench-head { display: flex; align-items: center; gap: var(--space-2); }
.live-bench .grow { flex: 1 1 auto; }
.live-bench .live-tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.live-bench .live-tag { justify-content: center; font-weight: 700; font-size: var(--type-body); }
.live-bench .live-tag.goal-us, .live-bench .live-tag.shot-us, .live-bench .live-tag.penalty-us,
.live-bench .live-tag.faceoff-win, .live-bench .live-tag.takeaway { border-color: var(--data-ink); color: var(--data-ink); }
.live-bench .live-tag.goal-them, .live-bench .live-tag.shot-them, .live-bench .live-tag.penalty-them,
.live-bench .live-tag.faceoff-loss, .live-bench .live-tag.giveaway { border-color: var(--accent-ink); color: var(--accent-ink); }
.live-bench .live-ice-now { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 8px 0 12px; }
.live-bench .live-ice-now b { font-size: var(--type-body); }
.live-bench .live-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: 12px; }
.live-bench .live-chip { min-width: 56px; min-height: 56px; border-radius: var(--radius-pill); font-weight: 700; font-size: var(--type-body); }
.live-bench .live-chip.skater.on { background: var(--blue); color: var(--on-data); border-color: var(--data-ink); }
.live-bench .live-chip.goalie.on { background: var(--ok); color: var(--on-dark); border-color: var(--ok); }
.live-bench .live-lines { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: 4px; }
.live-bench .live-line.on, .live-bench .live-period.on { border-color: var(--data-ink); color: var(--data-ink); }
.live-bench .live-periods { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.live-bench .live-clock-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: 12px; }
.live-bench .live-clock, .live-bench .live-player { max-width: 180px; }
.live-bench .live-sync-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.live-bench .live-sync-input { max-width: 240px; }
.live-bench .live-last { min-height: 20px; }
.live-bench .live-side-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: 12px; }
.live-bench .live-side-confirm b { flex-basis: 100%; }

@media print {
  @page { size: landscape; margin: 10mm; }
  .tabs, .sidebar, .no-print, .stats-controls, .coach-scope { display: none !important; }
  .shell, .page { display: block; width: 100%; max-width: none; padding: 0; }
  .card, .stats-page .card, .report-page .card { margin-bottom: 12px; break-inside: auto; }
  .box-scroll { overflow: visible; max-width: none; }
  .print-scope { display: block; white-space: normal; overflow-wrap: anywhere; font-size: 8px; margin-bottom: 8px; }
  .box-table { width: 100%; table-layout: auto; font-size: 8px; }
  .box-table :is(th, td), .box-table thead th { white-space: normal; overflow-wrap: anywhere; padding: 4px 2px; font-size: 8px; }
  .box-table td:not(:first-child) { white-space: nowrap; overflow-wrap: normal; }
  .box-table tr > :first-child { position: static; background: transparent; }
  .box-table thead { display: table-header-group; }
  .box-table tr { break-inside: avoid; }
}

@media (pointer: coarse) {
  .team-subtab, .game-tab, .game-side, .tagger > .game-tabs .game-tab { min-height: 44px; }
}
