/* The watch page (D87, D138). Values from design/tokens.css (the RinkNotes design system). Dark by default: it is mostly
   watched at the rink and at night. The player is dark in both themes. */

@font-face { font-family: "Inter"; src: url("/assets/fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/Inter-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/assets/fonts/Inter-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/JetBrainsMono-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }

:root {
  --bg: #0d1117;
  --card: #161b22;
  --card-2: #11161d;
  --border: #21262d;
  --border-2: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --ghost: #6e7681;
  --green: #2ea043;
  --green-bright: #3fb950;
  --green-soft: rgba(46, 160, 67, .10);
  --green-border: rgba(46, 160, 67, .28);
  --amber: #d29922;
  --red: #f85149;
  --blue: #388bfd;
  --purple: #bc8cff;
  --on-green: #0d1117;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  /* The player's own colours, the same in both themes. */
  --p-bg: #010409;
  --p-text: #e6edf3;
  --p-muted: #8b949e;
  --p-track: rgba(230, 237, 243, .16);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff;
    --card: #f6f8fa;
    --card-2: #eef1f4;
    --border: #d0d7de;
    --border-2: #afb8c1;
    --text: #1f2328;
    --muted: #59636e;
    --ghost: #6e7781;
    --green: #2da44e;
    --green-bright: #1a7f37;
    --green-soft: rgba(45, 164, 78, .12);
    --green-border: rgba(45, 164, 78, .32);
    --amber: #9a6700;
    --red: #cf222e;
    --blue: #0969da;
    --purple: #8250df;
    --on-green: #ffffff;
    color-scheme: light;
  }
}
/* A viewer's explicit choice wins over the system's, both ways. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --card: #f6f8fa;
  --card-2: #eef1f4;
  --border: #d0d7de;
  --border-2: #afb8c1;
  --text: #1f2328;
  --muted: #59636e;
  --ghost: #6e7781;
  --green: #2da44e;
  --green-bright: #1a7f37;
  --green-soft: rgba(45, 164, 78, .12);
  --green-border: rgba(45, 164, 78, .32);
  --amber: #9a6700;
  --red: #cf222e;
  --blue: #0969da;
  --purple: #8250df;
  --on-green: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.45 var(--sans); }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.page { max-width: 1240px; margin: 0 auto; padding-block: max(14px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 14px; min-height: 100dvh; }
.brandline { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.kicker { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.note { margin: 0; color: var(--muted); font-size: 14px; }
/* A demo team's line: small and plain, so the page still looks like a real team's. */
.example { align-self: flex-start; margin: 0; padding: 4px 10px; border: 1px solid var(--border-2); border-radius: 10px;
  color: var(--muted); font-size: 13px; line-height: 1.4; }
.example b { color: var(--text); font-weight: 600; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.foot a { color: inherit; }

.layout { display: grid; gap: 18px; }
.watch, .side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.title h1 { margin: 2px 0 2px; font-size: 22px; line-height: 1.2; font-weight: 700; text-wrap: balance; }
.title p { margin: 0; color: var(--muted); font-size: 14px; }
/* The privacy note: a little room between its parts. */
main.title { display: flex; flex-direction: column; gap: 6px; }
main.title .kicker { margin-top: 12px; }
main.title p { font-size: 15px; color: var(--text); }

@media (min-width: 960px) {
  .page { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); }
  .layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 28px; }
  .title h1 { font-size: 30px; }
  .side { position: sticky; top: 16px; max-height: calc(100dvh - 32px); }
  .side .mlist { overflow: auto; }
}

/* ---------- The player ---------- */
/* Mux Player (D138), themed from the tokens: the green accent, the page's type, and the player's own dark colours in
   both themes. Its Cast button is hidden: Cast is off on this page (D139 Q3). */
.player { position: relative; background: var(--p-bg); color: var(--p-text); border-radius: 14px; overflow: hidden; }
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; }
mux-player {
  display: block; width: 100%; height: 100%; aspect-ratio: 16 / 9;
  --media-accent-color: var(--green);
  --media-primary-color: var(--p-text);
  --media-secondary-color: rgba(1, 4, 9, .72);
  --media-font-family: var(--sans);
  --media-control-background: transparent;
  --media-control-hover-background: rgba(230, 237, 243, .08);
  --media-range-track-background: var(--p-track);
  --media-tooltip-background: rgba(1, 4, 9, .92);
  --media-object-fit: contain;
  --cast-button: none;
}
mux-player:not(:defined) { visibility: hidden; }

.controls { padding: 6px 10px 6px; display: flex; flex-direction: column; gap: 2px; background: var(--p-bg); }

/* The marks above the track: one flag per moment, at its start. */
.markrow { position: relative; height: 22px; margin: 0 6px; }
.flag { position: absolute; top: 2px; transform: translateX(-50%); min-width: 18px; height: 18px; padding: 0 3px; border-radius: 5px; border: 0; font: 600 11px/18px var(--mono); color: #0d1117; text-align: center; cursor: pointer; }
.flag.cur { outline: 2px solid #fff; outline-offset: 1px; }
.flag::after { content: ""; position: absolute; left: 50%; top: 18px; width: 1px; height: 6px; background: currentColor; opacity: .5; }

/* The moments bar: the whole reel, each moment coloured by kind where it is. */
.scrub { position: relative; height: 30px; margin: 0 6px; cursor: pointer; touch-action: none; outline: none; }
.scrub:focus-visible { box-shadow: 0 0 0 2px var(--blue); border-radius: 6px; }
.segments { position: absolute; left: 0; right: 0; top: 11px; height: 8px; }
.seg { height: 100%; border-radius: 3px; opacity: .38; min-width: 2px; }
.seg.cur { opacity: .7; }
.segments .seg { position: absolute; top: 0; }
.played { position: absolute; left: 0; top: 11px; height: 8px; border-radius: 3px; background: rgba(255,255,255,.85); mix-blend-mode: soft-light; pointer-events: none; }
.head { position: absolute; top: 7px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: none; }
.tip { position: absolute; bottom: 34px; transform: translateX(-50%); white-space: nowrap; padding: 4px 8px; border-radius: 8px; background: rgba(1, 4, 9, .92); border: 1px solid #30363d; font: 600 12px/1.3 var(--sans); pointer-events: none; }
.tip .t { font-family: var(--mono); color: var(--p-muted); margin-left: 6px; }

.buttons { display: flex; align-items: center; gap: 2px; }
.icon { width: 44px; height: 44px; border: 0; background: transparent; color: var(--p-text); display: grid; place-items: center; border-radius: 10px; cursor: pointer; }
.icon:hover { background: rgba(255,255,255,.08); }
.icon:disabled { opacity: .35; cursor: default; }
.icon:disabled:hover { background: transparent; }
.icon svg { width: 24px; height: 24px; fill: currentColor; }
.time { font-size: 13px; color: var(--p-muted); margin-left: 6px; white-space: nowrap; }

/* Full screen takes the whole player, the marks bar too (Mux Player's fullscreen-element). On an iPhone, Safari takes
   only the video, in Apple's own player. */
.fsbtn { margin-left: auto; }
.fsbtn .fs-off, .player.isfull .fsbtn .fs-on { display: none; }
.player.isfull .fsbtn .fs-off { display: block; }
.player:fullscreen { display: flex; flex-direction: column; width: 100vw; height: 100vh; border-radius: 0; }
.player:fullscreen .stage { flex: 1; min-height: 0; aspect-ratio: auto; }
.player:fullscreen mux-player { aspect-ratio: auto; }
.player::backdrop { background: #000; }

.nowplaying { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.nowplaying b { color: var(--text); font-weight: 600; }
.linkbtn { border: 0; background: none; color: var(--green-bright); font-weight: 600; font-size: 14px; min-height: 44px; padding: 0 4px; cursor: pointer; white-space: nowrap; }

/* ---------- The game: each period's line, the marks at their game times ---------- */
.game { padding: 12px 14px 8px; display: flex; flex-direction: column; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); justify-content: flex-end; }
.legend .k { display: inline-flex; align-items: center; gap: 4px; }
.legend .k i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; font: 600 10px/14px var(--mono); font-style: normal; color: #0d1117; text-align: center; }
.period { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; min-height: 44px; }
.period .p { font: 500 13px var(--mono); color: var(--muted); }
.line { position: relative; height: 44px; }
.line::before { content: ""; position: absolute; left: 0; right: 0; top: 21px; height: 2px; background: var(--border-2); border-radius: 1px; }
.line .end { position: absolute; right: 0; top: 28px; font: 500 10px var(--mono); color: var(--ghost); }
.line .start { position: absolute; left: 0; top: 28px; font: 500 10px var(--mono); color: var(--ghost); }
.dot { position: absolute; top: 12px; width: 20px; height: 20px; margin-left: -10px; border-radius: 6px; border: 0; padding: 0; font: 600 11px/20px var(--mono); color: #0d1117; text-align: center; cursor: pointer; }
/* A bigger touch area than the dot itself. */
.dot::before { content: ""; position: absolute; inset: -12px -4px; }
.dot.cur { outline: 2px solid var(--text); outline-offset: 2px; }
.dot.out { opacity: .3; }

/* ---------- Filters and the moment list ---------- */
.reeltabs { display: flex; flex-wrap: wrap; gap: 6px; }
.reeltab { min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; }
.reeltab[aria-current="page"] { background: var(--green-soft); border-color: var(--green-border); color: var(--green-bright); }
.nomoments .game, .nomoments .side > .cardhead, .nomoments #filters, .nomoments #moments, .nomoments #prev, .nomoments #next { display: none; }
.onevideo .side { display: none; }
@media (min-width: 960px) { .layout.onevideo { grid-template-columns: minmax(0, 1fr); } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-2); background: transparent; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip .n { font-family: var(--mono); color: var(--muted); font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green-border); color: var(--green-bright); }
.mlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mlist li + li, .mlist button + button { border-top: 1px solid var(--border); }
.mrow { width: 100%; display: grid; grid-template-columns: 26px 64px 1fr auto; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px; border: 0; background: transparent; text-align: left; cursor: pointer; font-size: 15px; color: var(--text); }
.mrow:hover { background: var(--card-2); }
.mrow .badge { width: 22px; height: 22px; border-radius: 6px; font: 600 12px/22px var(--mono); color: #0d1117; text-align: center; }
.mrow .when { font: 500 13px var(--mono); color: var(--muted); }
.mrow .d { font: 500 12px var(--mono); color: var(--muted); }
.mrow.cur { background: var(--green-soft); }
.mrow.cur .when { color: var(--green-bright); }
.mrow.plain { grid-template-columns: 1fr auto; }

/* Kind colours: the Mac app's (GameReviewView.colour). A letter goes with each, so colour is never the only signal. */
.k-blue { background: var(--blue); }
.k-green { background: #3fb950; }
.k-red { background: #f85149; }
.k-purple { background: #bc8cff; }
.k-amber { background: #d29922; }
.k-muted { background: #8b949e; }

/* ---------- The team page (TEAM_PAGE_PLAN T2) ---------- */
.teampage { display: flex; flex-direction: column; gap: 18px; }
.dash { display: grid; gap: 14px; }
@media (min-width: 960px) { .dash { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: stretch; } }
.latest, .totals { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.latestbody { display: flex; flex-direction: column; gap: 12px; }
.latestbody h3 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 700; text-wrap: balance; }
.latestbody .where { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.tally { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--muted); }
.cnt { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cnt i, .stat .lab i { display: inline-block; width: 18px; height: 18px; border-radius: 5px; font: 600 11px/18px var(--mono); font-style: normal; color: #0d1117; text-align: center; }
.cnt b { color: var(--text); font: 500 14px var(--mono); }
/* Saves by goalie (D145): a team's name can be long, so these may wrap; the letter stays beside the first word. */
.cnt.goalie { white-space: normal; flex-wrap: wrap; gap: 0 6px; }
.novideo { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.playbtn { min-height: 48px; display: inline-flex; align-items: center; gap: 8px; padding: 0 20px 0 16px; border-radius: 999px; background: var(--green); color: var(--on-green); font-weight: 700; font-size: 15px; text-decoration: none; }
.playbtn svg { width: 20px; height: 20px; fill: currentColor; }
.playbtn:hover { background: var(--green-bright); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) and (max-width: 959px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-size: 26px; line-height: 1.15; }
.stat .lab { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.games { display: flex; flex-direction: column; gap: 8px; }
.glist { list-style: none; margin: 0; padding: 0; }
.glist li + li { border-top: 1px solid var(--border); }
.grow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 12px; }
.gmain { flex: 1 1 300px; min-height: 56px; display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 10px; color: var(--text); text-decoration: none; border-radius: 10px; }
.gmain:hover b { text-decoration: underline; }
.gmain:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.gdate { font-size: 13px; color: var(--muted); }
.gwho { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gwho b { font-weight: 600; font-size: 15px; }
.gwho .where { font-size: 13px; color: var(--muted); }
.gwho .tally { font-size: 13px; gap: 2px 12px; }
.greels { display: flex; flex-wrap: wrap; gap: 6px; }
.reellink { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-2); display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; }
.reellink:hover { background: var(--card-2); }
/* On a phone the date sits above the game, so the game's own words get the whole width. */
@media (max-width: 599px) {
  .grow { padding: 10px 12px 12px; }
  .gmain { grid-template-columns: minmax(0, 1fr); gap: 2px; min-height: 0; flex-basis: 100%; }
  .gdate { font-size: 12px; }
}

/* ---------- The left menu (TEAM_PAGE_PLAN T3) ---------- */
.brandleft { display: inline-flex; align-items: center; gap: 6px; }
.menubtn { width: 44px; height: 44px; margin: -12px 0 -12px -10px; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; border-radius: 10px; cursor: pointer; }
.menubtn:hover { background: var(--card); }
.menubtn svg { width: 22px; height: 22px; fill: currentColor; }
.content { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.sidenav { display: flex; flex-direction: column; gap: 6px; }
.navhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.navteam { font-weight: 700; font-size: 15px; }
.navclose { color: var(--text); }
.navclose:hover { background: var(--card); }
.navlist, .navlist ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.navlist ul { margin: 2px 0 6px 12px; padding-left: 10px; border-left: 2px solid var(--border); }
.navsec { margin: 12px 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.navlink { min-height: 44px; display: flex; flex-direction: column; justify-content: center; padding: 4px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.navlink .sub { font: 500 12px var(--mono); color: var(--muted); }
.navlink:hover { background: var(--card); }
.navlink:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.navlink[aria-current="page"] { background: var(--green-soft); color: var(--green-bright); }
.navlink[aria-current="true"] { color: var(--green-bright); }
.navlist ul .navlink { font-weight: 500; min-height: 40px; }
.scrim { position: fixed; inset: 0; background: rgba(1, 4, 9, .55); z-index: 19; }

/* Phones and narrow windows: the menu is a drawer, opened from the top line. */
@media (max-width: 959px) {
  .sidenav { position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); overflow-y: auto; background: var(--bg); border-right: 1px solid var(--border); padding: max(10px, env(safe-area-inset-top, 0px)) 12px max(16px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); transform: translateX(-102%); visibility: hidden; }
  /* It slides in, and closes at once, so a closed menu is never reachable by Tab even if an animation is skipped. */
  .sidenav.open { transform: none; visibility: visible; transition: transform .2s ease; }
}
/* Wide screens: the menu is a column on the left, and the close button and the menu button go. */
@media (min-width: 960px) {
  .page.withnav { max-width: 1480px; }
  .shell.hasnav { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
  .shell.hasnav .sidenav { position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; padding-right: 4px; }
  .menubtn, .navclose, .scrim { display: none !important; }
  /* Between 960 and 1200 px the moments go under the player, so three columns never squeeze it. */
  .shell.hasnav .layout { grid-template-columns: minmax(0, 1fr); }
  .shell.hasnav .side { position: static; max-height: none; }
  .shell.hasnav .side .mlist { overflow: visible; }
}
@media (min-width: 1200px) {
  .shell.hasnav .layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .shell.hasnav .side { position: sticky; top: 16px; max-height: calc(100dvh - 32px); }
  .shell.hasnav .side .mlist { overflow: auto; }
  .shell.hasnav .layout.onevideo { grid-template-columns: minmax(0, 1fr); }
}

.missing { text-align: center; padding: 60px 10px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.missing h1 { margin: 0; font-size: 22px; }
.missing p { margin: 0; color: var(--muted); max-width: 420px; }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 10px 14px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
