/* LVSA Film: Las Vegas Sports Academy kit colours (black, red, white trim).
   Event colours are kept apart from the kit red so a goal never reads as "your clip". */
:root {
  --kit: #141414;          /* page: away-kit black */
  --panel: #1c1c1c;
  --panel-2: #262626;
  --line: #333333;
  --text: #f6f6f4;         /* shirt lettering white */
  --muted: #a6a6a6;
  --red: #d7262e;          /* home-kit red: main actions, your clips, played time */
  --red-hi: #e8353d;
  --on-red: #ffffff;
  --goal: #f5c542;
  --shot: #ff9f43;
  --setpiece: #6ec1ff;
  --restart: #a6a6a6;
  --clip: var(--red);
  --danger: #ff6b6b;
  --r-sm: 8px;
  --r-md: 12px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--kit); color: var(--text); font: 16px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Top bar: a red piping line under it, like the kit's trim */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 10px 20px;
  background: rgba(20, 20, 20, .94); backdrop-filter: blur(8px); box-shadow: inset 0 -2px 0 var(--red); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 24px/1 var(--display); letter-spacing: .3px; }
.brand-dot { width: 12px; height: 22px; background: var(--red); transform: skewX(-14deg); }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a { text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--text); border-radius: 0; }
.signout { margin: 0 0 0 auto; }
.signout button { padding: 6px 12px; font-size: 14px; color: var(--muted); }

main { max-width: 1400px; margin: 0 auto; padding: 24px 20px 48px; overflow-wrap: anywhere; }
h1 { font: 700 34px/1.05 var(--display); margin: 0 0 20px; letter-spacing: .2px; }
h2 { font: 700 24px/1.1 var(--display); margin: 0 0 14px; }
.muted { color: var(--muted); }
.empty { padding: 32px 24px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r-md); max-width: 60ch; }
.empty code { color: var(--text); }

/* Buttons */
.primary, .ghost, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 18px; border-radius: var(--r-sm); font-weight: 600; text-decoration: none; }
.primary { border: 0; background: var(--red); color: var(--on-red); }
.primary:hover { background: var(--red-hi); }
.ghost { border: 1px solid #4a4a4a; background: transparent; }
.ghost:hover { border-color: var(--text); }
.btn { border: 1px solid #4a4a4a; background: transparent; }
.btn:hover { border-color: var(--text); }
.btn[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: var(--kit); }

/* Clubhouse: newest game featured, earlier games as rows */
.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: end; margin-bottom: 40px; }
.hero-shot { position: relative; display: block; border-radius: var(--r-md); overflow: hidden; background: #000; }
.hero-shot img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-shot::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--red); }
.hero-text { padding-bottom: 4px; }
.hero-kicker { color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.hero h1 { font-size: clamp(40px, 5.4vw, 72px); line-height: .95; text-transform: uppercase; margin: 0 0 14px; }
.tally { display: flex; gap: 22px; margin: 0 0 22px; }
.tally div { display: flex; flex-direction: column; }
.tally b { font: 700 36px/1 var(--display); }
.tally span { color: var(--muted); font-size: 14px; }
.tally .goal b { color: var(--goal); } .tally .shot b { color: var(--shot); } .tally .clip b { color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.section-title { font: 700 24px/1.1 var(--display); margin: 0 0 12px; }
.rows { display: grid; gap: 2px; border-radius: var(--r-md); overflow: hidden; }
.row { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 10px;
  background: var(--panel); text-decoration: none; }
.row:hover { background: var(--panel-2); }
.row img { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #000; display: block; }
.row .title { font: 700 22px/1.1 var(--display); }
.row .sub { color: var(--muted); font-size: 14px; }
.counts { display: flex; gap: 14px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.counts b { font: 700 20px/1 var(--display); color: var(--text); margin-right: 3px; }
.counts .goal b { color: var(--goal); } .counts .shot b { color: var(--shot); } .counts .clip b { color: var(--red); }

/* Match */
.match-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.match-head h1 { margin: 0; cursor: text; text-transform: uppercase; font-size: clamp(28px, 3.4vw, 44px); }
.match-head h1:hover { text-decoration: underline dotted var(--muted); text-underline-offset: 6px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }

.player-ctl { display: none; align-items: center; gap: 10px; padding: 8px; margin-bottom: 10px; border-radius: var(--r-sm);
  background: var(--red); color: var(--on-red); font-weight: 600; }
.player-ctl.on { display: flex; }
.player-ctl .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.player-ctl button { border: 0; background: #0003; color: inherit; border-radius: 6px; min-width: 44px; min-height: 40px; font-weight: 700; }
.player-ctl button:hover { background: #0005; }

.video-wrap { background: #000; border-radius: var(--r-md); overflow: hidden; }
video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }

/* Timeline as a white touchline; red = watched */
.scrubber { position: relative; height: 48px; margin-top: 8px; cursor: pointer; touch-action: none; user-select: none; }
.scrubber .track { position: absolute; left: 0; right: 0; top: 28px; height: 4px; background: #5a5a5a; }
.scrubber .analysed { position: absolute; top: 28px; height: 4px; background: var(--text); }
.scrubber .dead { position: absolute; top: 28px; height: 4px; background: repeating-linear-gradient(90deg, #0000 0 4px, #141414cc 4px 8px); }
.scrubber .played { position: absolute; left: 0; top: 28px; height: 4px; background: var(--red); }
.scrubber .head { position: absolute; top: 20px; width: 3px; height: 20px; margin-left: -1.5px; background: var(--red); pointer-events: none; }
.dot { position: absolute; top: 23px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 3px solid var(--c, var(--restart));
  background: var(--kit); padding: 0; z-index: 2; }
.dot::before { content: ""; position: absolute; inset: -12px; }      /* bigger tap area than the dot */
.dot.clip { background: var(--c, var(--clip)); border-color: var(--kit); top: 3px; width: 16px; height: 16px; margin-left: -8px; }
.dot:hover, .dot:focus-visible { transform: scale(1.3); outline: none; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .time { font: 600 18px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--muted); margin-right: auto; }

/* Player bar: shirt numbers as little jerseys */
.playerbar { margin-top: 18px; }
.playerbar .label { font: 700 20px/1 var(--display); margin-bottom: 10px; }
.playerbar .nums { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; }
.playerbar .nums .muted { font-size: 15px; max-width: 60ch; }
.num { flex: none; width: 52px; height: 54px; border: 0; padding: 8px 0 0; background: #2e2e2e; color: var(--text);
  font: 700 24px/1 var(--display);
  clip-path: polygon(22% 0, 38% 0, 50% 10%, 62% 0, 78% 0, 100% 20%, 88% 40%, 80% 34%, 80% 100%, 20% 100%, 20% 34%, 12% 40%, 0 20%); }
.num:hover { background: #3c3c3c; }
.num.on { background: var(--red); color: var(--on-red); }
.num:focus-visible { outline: none; background: #555; }
.num.on:focus-visible { background: var(--red-hi); }

.side { background: var(--panel); border-radius: var(--r-md); overflow: hidden; }
.tabs { display: flex; box-shadow: inset 0 -1px 0 var(--line); }
.tabs button { flex: 1; border: 0; background: none; min-height: 48px; color: var(--muted); font-weight: 600; box-shadow: inset 0 -3px 0 transparent; }
.tabs button.on { color: var(--text); box-shadow: inset 0 -3px 0 var(--red); }
.list { max-height: calc(100vh - 200px); overflow-y: auto; }
.item { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:hover { background: var(--panel-2); }
.item.now { background: #d7262e22; box-shadow: inset 3px 0 0 var(--red); }
.item .mark { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--c, var(--restart)); }
.item .mark.fill { background: var(--c, var(--clip)); border-color: var(--c, var(--clip)); }
.item .txt { flex: 1; min-width: 0; }
.item .t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .t2 { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 14px; color: var(--muted); }
.item .acts { display: flex; gap: 2px; }
.icon { display: grid; place-items: center; border: 0; background: none; width: 40px; height: 40px; border-radius: var(--r-sm);
  color: var(--muted); font-size: 16px; text-decoration: none; }
.icon:hover { background: var(--panel-2); color: var(--text); }
.note { padding: 12px; font-size: 15px; color: var(--muted); border-bottom: 1px solid var(--line); }

/* Players */
.plist { display: grid; gap: 2px; border-radius: var(--r-md); overflow: hidden; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pcard { display: flex; align-items: center; gap: 14px; padding: 12px; text-decoration: none; background: var(--panel); }
.pcard:hover { background: var(--panel-2); }
.pcard .name { font: 700 22px/1.1 var(--display); }
.jersey { flex: none; width: 52px; height: 54px; display: grid; place-items: center; padding-top: 6px; background: var(--red); color: var(--on-red);
  font: 700 24px/1 var(--display);
  clip-path: polygon(22% 0, 38% 0, 50% 10%, 62% 0, 78% 0, 100% 20%, 88% 40%, 80% 34%, 80% 100%, 20% 100%, 20% 34%, 12% 40%, 0 20%); }

/* Dialog */
dialog { border: 0; border-top: 4px solid var(--red); border-radius: var(--r-md); background: var(--panel); color: var(--text); padding: 22px; width: min(440px, calc(100vw - 24px)); }
dialog::backdrop { background: #000b; }
dialog h2 { font-size: 28px; }
dialog label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
dialog input { display: block; width: 100%; margin-top: 4px; min-height: 44px; padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid #4a4a4a; background: var(--kit); }
dialog input:focus { border-color: var(--text); outline: none; }
dialog menu { display: flex; justify-content: flex-end; gap: 10px; padding: 0; margin: 16px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.hint { font-size: 14px; color: var(--muted); margin: 0; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(30px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--kit); padding: 10px 18px; border-radius: var(--r-sm); font-weight: 600; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translateX(-50%); }

/* Sign-in */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 20px;
  background: linear-gradient(180deg, transparent 0 calc(100% - 6px), var(--red) calc(100% - 6px)); }
.login { width: min(400px, 100%); }
.login h1 { font-size: clamp(56px, 16vw, 88px); line-height: .9; text-transform: uppercase; margin: 0 0 12px; }
.login h1 .stripe { display: block; width: 72px; height: 6px; background: var(--red); margin-bottom: 18px; }
.login .lede { color: var(--muted); font-size: 18px; margin: 0 0 28px; max-width: 32ch; }
.login label { display: block; font-weight: 600; margin-bottom: 6px; }
.login input { display: block; width: 100%; min-height: 50px; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid #4a4a4a; background: var(--panel); font-size: 17px; }
.login input:focus { border-color: var(--text); outline: none; }
.login .primary { width: 100%; min-height: 52px; font-size: 17px; }
.err { color: var(--danger); min-height: 1.5em; margin: 0 0 8px; font-size: 15px; }

/* Phones */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .list { max-height: none; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 640px) {
  .topbar { position: static; gap: 10px; padding: 10px 14px; }
  .brand { font-size: 21px; }
  .topbar nav a { padding: 8px; }
  .signout button { padding: 0 10px; }
  main { padding: 16px 14px 40px; }
  /* the video stays on screen while the event list scrolls under it: the player column dissolves into the
     page grid so the pinned video is bounded by the whole page, not by its own column */
  .layout { gap: 14px; }
  .layout > section { display: contents; }
  .watch { position: sticky; top: 0; z-index: 5; background: var(--kit); margin: 0 -14px; padding: 0 14px 4px; }
  .playerbar { margin-top: 0; }
  .video-wrap { border-radius: 0; margin: 0 -14px; }
  .player-ctl { margin: 0 -14px; border-radius: 0; }
  .hero-shot { margin: 0 -14px; border-radius: 0; }
  .actions > * { flex: 1; }
  .row { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; }
  .row img { width: 112px; }
  .row .counts { grid-column: 2; }
  .toolbar .time { font-size: 16px; }
}
