/* Player film room — shares tokens from style.css */
/* hidden attribute must win over explicit display rules below (modal, back btns) */
[hidden] { display: none !important; }
.film-body { background: var(--paper); }

.film-masthead { border-bottom: 2px solid var(--rule-strong); background: var(--bg); }
.film-masthead-inner {
  max-width: 1360px; margin: 0 auto; padding: 12px 28px;
  display: flex; align-items: center; gap: 16px;
}
.film-home-link { font-size: 13px; font-weight: 600; }
.film-brand {
  margin: 0 auto 0 0; font-family: 'Archivo Narrow', sans-serif; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 18px;
}
.film-brand span { color: var(--muted); }
.film-admin-btn {
  background: var(--accent); color: #fff; text-decoration: none;
  padding: 8px 16px; font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; border: 2px solid var(--accent); border-radius: 2px;
}
.film-admin-btn:hover { background: var(--accent-deep); color: #fff; }
.film-logout {
  background: none; border: 2px solid var(--rule);
  padding: 8px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; cursor: pointer; border-radius: 2px;
}
.film-logout:hover { border-color: var(--accent); color: var(--accent); }

.film-main { max-width: 1360px; margin: 0 auto; padding: 18px 28px; }

/* LOGIN + PICKER */
.film-login-card, .film-picker {
  max-width: 460px; margin: 40px auto; background: var(--bg);
  border: 2px solid var(--rule-strong); padding: 32px 28px;
}
.film-login-title {
  font-family: 'Archivo Narrow', sans-serif; text-transform: uppercase;
  font-size: 28px; margin: 0 0 18px;
}
.film-dev-note { margin: 18px 0 0; font-size: 13px; font-weight: 600; color: var(--accent); }
.film-picker-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.film-picker-btn {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; background: var(--paper); border: 2px solid var(--rule);
  font-size: 16px; font-weight: 700; cursor: pointer; text-align: left;
}
.film-picker-btn:hover { border-color: var(--accent); }

/* ROOM */
.film-room-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px; flex-wrap: wrap; border-bottom: 2px solid var(--rule-strong);
  padding-bottom: 12px; margin-bottom: 14px;
}
.film-room-eyebrow {
  margin: 0 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.2em; color: var(--accent);
}
.film-room-name {
  margin: 0; font-family: 'Archivo Narrow', sans-serif; text-transform: uppercase;
  font-size: clamp(28px, 4vw, 44px); line-height: 0.95;
}
.film-room-meta { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.film-room-head-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#film-room .film-room-head-actions { justify-content: flex-end; align-items: flex-end; }
/* Room header aligns to the grid below: nav | video | stats. align-items:end
   bottom-aligns the back/Week-1 block and actions with the big player name. */
#film-room .film-room-head {
  display: grid; grid-template-columns: minmax(180px, 0.8fr) 3fr minmax(215px, 0.85fr);
  gap: 18px; align-items: end;
}
/* Player name + the parent "Update availability" button sit on one row, the
   button immediately to the right of the (large) name and bottom-aligned. */
#film-room .rh-name { min-width: 0; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px; }
@media (max-width: 820px) { #film-room .film-room-head { grid-template-columns: 1fr; } }
.film-update-btn {
  background: var(--accent); color: #fff; text-decoration: none; padding: 12px 20px;
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  border: 2px solid var(--accent); cursor: pointer;
}
.film-update-btn:hover { background: var(--accent-deep); color: #fff; }
.film-dev-switch { padding: 10px 12px; border: 2px solid var(--rule); font-size: 13px; font-weight: 600; }

.film-room-grid {
  display: grid; grid-template-columns: minmax(180px, 0.8fr) 3fr minmax(215px, 0.85fr);
  gap: 18px; align-items: start;
}
.film-col { max-height: calc(100vh - 200px); overflow-y: auto; overflow-x: hidden; }
.film-hand-toggle { display: inline-flex; margin-top: 10px; border: 2px solid var(--rule-strong); border-radius: 6px; overflow: hidden; }
.film-hand-toggle button {
  background: var(--bg); border: none; padding: 8px 20px; font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; color: var(--ink);
}
.film-hand-toggle button + button { border-left: 2px solid var(--rule-strong); }
.film-hand-toggle button.active { background: var(--accent); color: #fff; }
.film-stage { min-width: 0; }
.film-vid-wrap { position: relative; }
.film-video {
  width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 225px);
  background: #000; display: block; border: 2px solid var(--rule-strong); object-fit: contain;
}
/* "WK N" corner overlay naming the footage's week (top-left, over the video) */
.film-vid-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2; pointer-events: none;
  background: rgba(20, 83, 45, 0.92); color: #fff; font-size: 11px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 9px; border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.film-now {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-top: 12px; flex-wrap: wrap;
}
.film-now-label { font-weight: 700; font-size: 16px; }
.film-now-nav { display: flex; align-items: center; gap: 10px; }
.film-now-count { font-size: 13px; color: var(--muted); min-width: 56px; text-align: center; }
.film-nav-btn {
  background: var(--bg); border: 2px solid var(--rule); padding: 8px 14px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.film-nav-btn:hover { border-color: var(--accent); color: var(--accent); }

.film-side-title {
  font-family: 'Archivo Narrow', sans-serif; text-transform: uppercase;
  font-size: 15px; letter-spacing: 0.06em; margin: 0 0 10px;
  padding-bottom: 6px; border-bottom: 2px solid var(--rule-strong);
}
.chap-pillar {
  font-family: 'Archivo Narrow', sans-serif; text-transform: uppercase;
  font-size: 12px; letter-spacing: 0.08em; color: var(--accent); font-weight: 700;
  margin: 12px 0 4px; padding-bottom: 3px; border-bottom: 1px solid var(--rule);
}
.chap-pillar:first-child { margin-top: 0; }
.chap-subgroup {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); margin: 8px 0 4px 4px;
}
.film-chapters { display: flex; flex-direction: column; gap: 5px; }
.film-chapter {
  text-align: left; background: var(--bg); border: 2px solid var(--rule);
  padding: 7px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 1px;
}
.film-chapter:hover:not(.empty) { border-color: var(--accent); }
.film-chapter.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.film-chapter.active .chap-sub { color: rgba(255,255,255,0.8); }
.film-chapter.empty { opacity: 0.45; cursor: default; }
.chap-main { font-weight: 700; font-size: 14px; }

/* Coach-only leaderboard-title drill-in: same look, just clickable. */
.lb-title-hist { cursor: pointer; }
.hist-card { width: min(980px, 94vw); }
.hist-body-wrap { padding: 12px 16px 16px; overflow: auto; max-height: 74vh; }
.hist-scroll { overflow-x: auto; }
.hist-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.hist-table th, .hist-table td {
  border: 1px solid var(--rule); padding: 5px 9px; text-align: center; white-space: nowrap;
}
.hist-table th {
  font-family: 'Archivo Narrow', sans-serif; text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.06em; background: var(--bg);
}
.hist-table td.hist-player { text-align: left; font-weight: 700; }
.hist-table td.hist-hand { font-size: 11px; text-transform: uppercase; color: var(--muted); }
.hist-table td.hist-total { font-weight: 800; }
.hist-none { color: var(--muted); }
.hist-up { color: #2e7d32; font-weight: 700; font-size: 11px; }
.hist-down { color: #c62828; font-weight: 700; font-size: 11px; }
.hist-even { color: var(--muted); font-size: 11px; }
.hist-base {
  font-size: 9px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); margin-left: 4px; vertical-align: 1px;
}
.hist-star { color: var(--accent); }
.hist-foot { font-size: 11px; color: var(--muted); margin: 10px 2px 0; }
.chap-new {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 9px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: #fff; background: #2e7d32; vertical-align: 2px;
}
.chap-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.stat-cat { margin-bottom: 12px; }
.stat-cat-title {
  font-family: 'Archivo Narrow', sans-serif; text-transform: uppercase;
  font-size: 13px; letter-spacing: 0.1em; color: #fff; background: var(--accent);
  margin: 0 0 0; padding: 6px 10px;
}
.film-stat-table { width: 100%; border-collapse: collapse; font-size: 13px; border: 2px solid var(--rule); }
.film-stat-table th, .film-stat-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--rule); }
.film-stat-table thead th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.film-stat-table tbody th { font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.film-stat-table td { font-variant-numeric: tabular-nums; }
.film-stat-table td b { font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }
.film-stat-table .stat-unit { font-size: 10px; color: var(--muted); margin-left: 3px; text-transform: uppercase; }
.film-stat-table .stat-solo b { color: var(--accent); }
/* highlight the row for the drill being watched; bolder for the hand playing */
.film-stat-table tr.stat-active { background: rgba(20, 83, 45, 0.08); }
.film-stat-table tr.stat-active th { color: var(--accent); }
.film-stat-table td.stat-active-cell { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(20, 83, 45, 0.16); }
.film-stat-table td.stat-active-cell b { color: var(--accent); }

/* COACHES VIEW */
.coach-cat {
  font-family: 'Archivo Narrow', sans-serif; text-transform: uppercase;
  font-size: 20px; letter-spacing: 0.04em; margin: 28px 0 12px;
  padding-bottom: 6px; border-bottom: 2px solid var(--rule-strong);
}
.lb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.lb-grid.solo { grid-template-columns: minmax(240px, 360px); }
.overall-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: stretch; margin-bottom: 8px; }
.overall-board > .lb { height: 100%; }
.win-row { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: 1fr 1fr; gap: 12px; }
.lb-head .info-bubble { margin-left: 6px; }
.lb-head .info-bubble::after { white-space: normal; width: 220px; text-align: left; line-height: 1.35; }
@media (max-width: 980px) { .overall-row { grid-template-columns: 1fr; } .win-row { grid-template-rows: auto; } }
.win-card { border: 2px solid var(--accent-gold); background: rgba(200,166,75,0.10); padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.win-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; color: var(--accent); }
.win-label .info-bubble { margin-left: 6px; vertical-align: middle; }
.win-label .info-bubble::after { white-space: normal; width: 190px; text-align: left; line-height: 1.35; }
.win-name { font-size: 23px; font-weight: 800; }
.win-detail { font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.win-note { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.lb-row-link { cursor: pointer; }
.lb-row-link:hover { background: rgba(20,83,45,0.10); }
.lb-row-locked { cursor: not-allowed; }
.lb-row-locked .lb-name { color: var(--muted); }
.lb-lock { margin-left: 6px; font-size: 11px; opacity: 0.7; cursor: help; }
.lb { border: 2px solid var(--rule); background: var(--bg); }
.lb-title {
  margin: 0; padding: 8px 12px; font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.05em; background: var(--paper);
  border-bottom: 2px solid var(--rule);
}
.lb-list { list-style: none; margin: 0; padding: 4px 0; }
.lb-list li { display: flex; align-items: center; gap: 8px; padding: 5px 12px; font-size: 14px; }
.lb-rank { width: 18px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
/* AP-poll-style rank movement vs last week (▲green up / ▼red down / NEW) */
.lb-move { width: 26px; margin-left: -4px; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.lb-move.lb-up { color: #15803d; }
.lb-move.lb-down { color: #dc2626; }
.lb-move.lb-new { color: var(--accent); font-size: 8px; letter-spacing: 0.04em; }
.lb-name { flex: 1; }
.lb-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-val small { font-size: 10px; color: var(--muted); margin-left: 2px; text-transform: uppercase; }
.lb-leader { background: rgba(20,83,45,0.08); }
.lb-leader .lb-rank { color: var(--accent-gold); font-weight: 800; }
.lb-leader .lb-name { font-weight: 800; }

/* The viewer's own player — highlighted wherever they appear (top N or pinned
   below at their true rank), plus the "…" gap and the not-ranked note. */
.lb-row-mine { background: rgba(200,166,75,0.22); box-shadow: inset 3px 0 0 var(--accent-gold); }
.lb-row-mine .lb-name { font-weight: 800; }
.lb-you { margin-left: 6px; color: var(--accent-gold); font-size: 12px; }
.lb-gap { justify-content: center; color: var(--muted); letter-spacing: 3px; padding: 1px 12px; user-select: none; }
.lb-row-unranked .lb-name { color: var(--muted); }
.lb-unranked-note { flex: 1; text-align: right; color: var(--muted); font-size: 12px; font-style: italic; }

/* Bars view (toggled by the View: List/Bars button) */
.lb-bar-wrap { display: none; }
.film-coach.bars .lb-name { flex: 0 0 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.film-coach.bars .lb-bar-wrap { display: block; flex: 1; height: 14px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.film-coach.bars .lb-bar { display: block; height: 100%; background: var(--accent); }
.film-coach.bars .lb-leader .lb-bar { background: var(--accent-gold); }
.film-coach.bars .lb-val { min-width: 52px; text-align: right; }

.ww-wrap { display: grid; gap: 18px; }
.ww-group .lb-title { background: var(--accent); color: #fff; border: none; }
.ww-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 10px; }
.ww { border: 2px solid var(--rule); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.ww-head { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 800; }
.ww-name { font-size: 20px; font-weight: 800; }
.ww-detail { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ww-best, .ww-even { border-color: var(--accent); background: rgba(20,83,45,0.07); }
.ww-best .ww-head, .ww-even .ww-head { color: var(--accent); }
.ww-worst { border-color: #c8102e; background: rgba(200,16,46,0.06); }

/* Team-best gold highlight in the player stat box */
.stat-legend { margin: 0 0 8px; font-size: 11px; color: var(--muted); }
.film-stat-table td.lead b { color: var(--accent-gold); }
.lead-star { color: var(--accent-gold); font-size: 12px; margin-left: 4px; }

/* Week selector bar + week-over-week improvement arrows */
.stat-weekbar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.stat-week { font-size: 13px; font-weight: 800; color: var(--ink); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-week-note { font-size: 10px; color: var(--muted); }
.stat-week-toggle {
  margin-left: auto; background: none; border: 1px solid var(--rule-strong); color: var(--accent);
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 4px; cursor: pointer;
}
.stat-week-toggle:hover { background: rgba(20,83,45,0.10); }
/* A drill the viewed week didn't test */
.film-stat-table td.stat-na { color: var(--muted); font-size: 12px; font-style: italic; }
.stat-delta {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 800;
  vertical-align: middle; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.stat-delta.stat-up   { color: #15803d; }   /* improved */
.stat-delta.stat-down { color: #dc2626; }   /* regressed */
.stat-delta.stat-flat { color: var(--muted); font-weight: 700; }

/* Back link (coach drill-down) + PDF button */
.film-back {
  background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 700;
  cursor: pointer; padding: 0 0 6px; display: inline-block;
}
.film-back:hover { text-decoration: underline; }
.film-pdf-btn {
  background: var(--bg); border: 2px solid var(--rule); padding: 12px 18px; font-size: 12px;
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer;
}
.film-pdf-btn:hover { border-color: var(--accent); color: var(--accent); }

/* leaderboard header row with a Watch button */
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--paper); border-bottom: 2px solid var(--rule); padding: 6px 8px 6px 12px; }
.lb-head .lb-title { background: none; border: none; padding: 0; }
.lb-watch { background: var(--accent); color: #fff; border: none; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 9px; cursor: pointer; white-space: nowrap; }
.lb-watch:hover { background: var(--accent-deep); }
.coach-note { margin: -4px 0 12px; font-size: 12px; color: var(--muted); }

/* Watch modal */
.film-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.film-modal-card { background: var(--bg); border: 2px solid var(--rule-strong); width: min(1040px, 100%); max-height: 90vh; display: flex; flex-direction: column; }
.film-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 2px solid var(--rule-strong); }
.film-modal-head h3 { margin: 0; font-family: 'Archivo Narrow', sans-serif; text-transform: uppercase; font-size: 18px; }
.film-modal-close { background: none; border: none; font-size: 20px; cursor: pointer; line-height: 1; color: var(--ink); }
.film-modal-body { display: grid; grid-template-columns: 2.4fr 1fr; min-height: 0; }
.film-modal-video { width: 100%; aspect-ratio: 16/9; max-height: 72vh; background: #000; display: block; object-fit: contain; }
.film-modal-nav { border-left: 2px solid var(--rule); overflow-y: auto; max-height: 72vh; }
.watch-nav-btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--bg); border: none; border-bottom: 1px solid var(--rule); padding: 9px 12px; cursor: pointer; font-size: 13px; }
.watch-nav-btn:hover { background: var(--paper); }
.watch-nav-btn.active { background: rgba(20,83,45,0.10); }
.watch-nav-rank { width: 18px; color: var(--muted); font-size: 12px; }
.watch-nav-name { flex: 1; font-weight: 700; }
.watch-nav-score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
@media (max-width: 700px) {
  .film-modal-body { grid-template-columns: 1fr; }
  .film-modal-nav { max-height: 30vh; border-left: none; border-top: 2px solid var(--rule); }
}

/* Print = clean PDF of the coaches leaderboards */
@media print {
  .film-masthead, .film-room-head-actions, .film-logout, .film-back, .film-dev-switch { display: none !important; }
  body.film-body { background: #fff; }
  .film-main { max-width: none; padding: 0; }
  .coach-cat { break-after: avoid; }
  .lb, .ww, .ww-group { break-inside: avoid; }
}

@media (max-width: 820px) {
  .film-room-grid { grid-template-columns: 1fr; }
}

/* Schedule button (masthead + room header) — primary accent action */
.film-sched-btn {
  background: var(--accent); color: #fff; border: 2px solid var(--accent);
  padding: 8px 16px; font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; cursor: pointer; border-radius: 2px;
}
.film-sched-btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }

/* Schedule modal — clinic session-times grid */
.sched-card { width: min(900px, 100%); }
.sched-body { display: flex; flex-direction: column; min-height: 0; }
.sched-wrap { overflow: auto; max-height: 74vh; }
.sched-table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.sched-table th, .sched-table td {
  border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule);
  padding: 8px 10px; text-align: center; white-space: nowrap;
}
.sched-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--paper);
  border-bottom: 2px solid var(--rule-strong);
}
.sched-wk-date { display: block; font-weight: 800; font-size: 13px; color: var(--ink); }
.sched-wk-label { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--muted); }
.sched-table .sched-name {
  position: sticky; left: 0; z-index: 1; background: var(--bg);
  text-align: left; font-weight: 700; color: var(--ink-soft);
}
.sched-table .sched-corner {
  position: sticky; left: 0; top: 0; z-index: 3; background: var(--paper);
  text-align: left; text-transform: uppercase; font-size: 11px;
  letter-spacing: 0.05em; color: var(--muted);
}
.sched-out { color: var(--muted); }
.sched-empty { color: var(--rule); }
.sched-table tr.sched-mine { background: rgba(200, 166, 75, 0.16); }
.sched-table tr.sched-mine .sched-name { background: rgba(200, 166, 75, 0.16); color: var(--ink); }
.sched-you { color: var(--accent-gold); margin-left: 5px; }
.sched-foot {
  margin: 0; padding: 10px 14px; font-size: 12px; color: var(--muted);
  border-top: 2px solid var(--rule); background: var(--paper);
}
