:root {
  color-scheme: dark;
  --brand-red: #a30012;
  --brand-gold: linear-gradient(180deg,#ffeca0 0%,#e8c45b 28%,#c9962c 55%,#ffd66e 82%,#fff0a7 100%);
  --brand-header: linear-gradient(110deg,#a30012 0%,#a30012 42%,#c8323e 72%,#e46a6f 100%);
  --nav-height: 64px;
  font-family: system-ui, sans-serif;
  --brand-selected: linear-gradient(125deg,#a30012,#bd2534);
  --brand-text: #f2f4f8;
  --brand-muted: #bdc8d9;
  color: var(--brand-text);
  background: linear-gradient(180deg,#0b1422,#121c2b);
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='700' viewBox='0 0 1200 700'%3E%3Cg stroke='%23ffffff' opacity='.025' fill='none' stroke-width='2'%3E%3Cpath d='M60 80H1140V620H60Z M600 80V620 M60 147.5A162 162 0 0 1 222 309.5V390.5A162 162 0 0 1 60 552.5 M1140 147.5A162 162 0 0 0 978 309.5V390.5A162 162 0 0 0 1140 552.5 M249 336.5V363.5 M168 348V352 M60 309.5H33V390.5H60 M951 336.5V363.5 M1032 348V352 M1140 309.5H1167V390.5H1140'/%3E%3Cpath stroke-dasharray='14 10' d='M139.9 80A243 243 0 0 1 303 309.5V390.5A243 243 0 0 1 139.9 620 M1060.1 80A243 243 0 0 0 897 309.5V390.5A243 243 0 0 0 1060.1 620'/%3E%3C/g%3E%3C/svg%3E") center top / min(1200px, 100%) auto repeat-y;
}
button, select { font: inherit; }
:focus-visible { outline: 3px solid #ffd66e; outline-offset: 2px; }
.shell-header {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem max(1rem,calc((100% - 72rem) / 2));
  background: var(--brand-header);
  border-bottom: 2px solid #c9962c;
  box-shadow: 0 10px 35px #a3001218;
}
.shell-header::after {
  content: '';
  position: absolute;
  right: 10%;
  top: -80px;
  width: 150px;
  height: 320px;
  transform: skew(-28deg);
  border-inline: 1px solid #ffd66e16;
  pointer-events: none;
}
.shell-brand { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.shell-shield { width: 38px; height: 42px; object-fit: contain; }
.shell-wordmark {
  width: 92px;
  height: 42px;
  object-fit: contain;
}
.shell-role:not(:empty) {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #ffffff99;
  border-radius: 5px;
  background: linear-gradient(180deg,#ffffff14,#ffffff06),rgba(75,0,9,.82);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
}
.shell-main { max-width: 74rem; min-width: 0; margin: auto; padding: 1rem 1rem calc(var(--nav-height) + env(safe-area-inset-bottom) + 1rem); }
.shell-nav {
  position: fixed;
  z-index: 10;
  inset: auto 0 0;
  display: flex;
  justify-content: center;
  gap: .375rem;
  padding: .375rem .5rem calc(.375rem + env(safe-area-inset-bottom));
  background: #0b1422;
  border-top: 1px solid #47556b;
}
.shell-nav[hidden] { display: none; }
.shell-nav-link {
  flex: 1 1 0;
  min-width: 0;
  max-width: 13rem;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--brand-muted);
  text-decoration: none;
  font: 700 11px/1.2 system-ui,sans-serif;
}
.shell-nav-link svg { width: 20px; height: 20px; flex: none; }
.shell-nav-link[aria-current] { color: #e8c66c; }
.shell-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .5rem 1rem;
  border: 0;
  border-radius: .625rem;
  background: white;
  color: var(--brand-red);
  font-weight: 700;
}
.match-picker {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: .5rem;
  border: 1px solid #e8c66c;
  border-radius: .625rem;
  background: #121c2b;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-bar {
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  color: var(--brand-text);
  font: 700 clamp(36px,12vw,56px)/1.1 Impact,system-ui,sans-serif;
  font-variant-numeric: tabular-nums;
}
.score-bar-empty { font: 700 .875rem/1.4 system-ui,sans-serif; color: var(--brand-muted); }
.match-card-link .score-bar:not(.score-bar-empty) { font-size: clamp(26px,8vw,44px); }
.choice-buttons, .mission-rounds { display: grid; gap: .65rem; }
.choice-button { min-height: 44px; max-inline-size: 100%; overflow-wrap: anywhere; }
.choice-button[aria-pressed="true"] { outline: 2px solid currentColor; outline-offset: 2px; }
.court-diagram { display: block; inline-size: 100%; max-inline-size: 36rem; }
.court-surface { fill: #166a43; stroke: #eef8ef; }
.court-lines { fill: none; stroke: #effaf2; }
.court-goal-area { fill: #104e32; }
.court-goal { fill: #f2f6ef; stroke: #fff; }
.court-input-point, .court-shooter { fill: #e8c45b; stroke: #fff; stroke-width: .16; }
.court-legend, .court-playback { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.court-legend { padding: 0; list-style: none; }
.court-board:has(.court-zones) .court-legend :is([data-team="referee_candidate"], [data-team="unknown"]) {
  display: none;
}
.court-legend li::before {
  content: '';
  display: inline-block;
  width: .8em;
  height: .8em;
  margin-inline-end: .35em;
  border-radius: 50%;
  background: var(--court-team);
}
.court-board [data-team="KINGS"] { --court-team: #a30012; }
.court-board [data-team="opponent"] { --court-team: #252c39; }
.court-board [data-team="referee_candidate"] { --court-team: #e8c45b; }
.court-board [data-team="unknown"] { --court-team: #a7b3c5; }
.court-dot { fill: var(--court-team); stroke: #fff; stroke-width: .12; }
.court-track { stroke: #fff; stroke-opacity: .35; stroke-width: .12; }
.stack { display: grid; gap: .75rem; min-width: 0; overflow-wrap: anywhere; }
.stack h1, .stack h2, .stack p { margin: 0; }
.stack h1, .stack h2 { font-weight: 800; }
.stack h1 { font-size: 23px; }
.stack h2 { font-size: 17px; color: #ffe6a6; }
.action-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.action {
  min-height: 44px; max-width: 100%; padding: .5rem .75rem; overflow-wrap: anywhere;
  border: 1px solid #a89051; border-radius: 10px; background: linear-gradient(130deg,#101a29,#172130); color: #e7ca7d; font-weight: 700;
}
.action[aria-pressed="true"], .action[aria-current="true"] { background: var(--brand-selected); color: #fff; border-color: #d9b35f; }
.action-group select { min-height: 44px; max-width: 100%; }
.item-list { display: grid; gap: .5rem; padding: 0; margin: .5rem 0 0; list-style: none; }
.panel, .player-tile {
  min-width: 0;
  padding: 12px;
  border: 1px solid #47556b;
  border-radius: 12px;
  background: #1e2530;
  box-shadow: 0 5px 16px #00000012;
}
.match-card { padding: 0; }
.match-card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .625rem;
  width: 100%;
  min-height: 68px;
  padding: 8px 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  text-align: left;
}
.match-card-detail { display: grid; min-width: 0; gap: 4px; overflow-wrap: anywhere; }
.match-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.match-chip {
  padding: .125rem .45rem;
  border: 1px solid #47556b;
  border-radius: 6px;
  color: var(--brand-muted);
  font-size: 11px;
}
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .75rem; }
.player-tile img { width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: .5rem; }
.player-tile button, .player-tile > div:first-child, .stat-number { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.stat-number { gap: .35rem .65rem; color: var(--brand-muted); }
.stat-number strong { color: var(--brand-text); font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.omission {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .25rem;
  padding: .125rem .45rem;
  border: 1px solid #bd736d;
  border-radius: 6px;
  background: #302029;
  color: #ffb7ab;
  font-size: 12px;
}
.omission[hidden] { display: none; }
.video-player { position: sticky; top: 0; z-index: 2; min-width: 0; background: #121c2b; }
.video-stage { display: grid; justify-items: center; gap: .25rem; }
.video-stage video, .video-stage iframe {
  display: block; width: min(100%, 42rem); height: auto; aspect-ratio: 16 / 9;
  max-height: 24vh; border: 0; background: #0b1422;
}

.record-card, .mission-card { border-color: #d6b85e; background: linear-gradient(130deg,#2a2028,#1e2530); }
.record-numbers, .player-card-numbers { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.5rem; text-align:center; }
.record-numbers > span { display:grid; justify-items:center; }
.record-numbers strong { font-size:clamp(2rem,8vw,3.5rem); line-height:1.1; color:#e8c66c; }
.notice-strip { padding:.35rem .65rem; background:#1e2530; border-inline-start:3px solid #c1494f; }
.mission-card .action { width:100%; background:var(--brand-header); color:white; }
.feature-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
.tab-strip > .action { flex:1 1 0; min-inline-size:0; padding-inline:.25rem; }
.tab-strip > .action[aria-pressed="true"] { background:var(--brand-gold); color:#141820; }
.score-panel { text-align:center; }
.score-panel h1 { font-size:.875rem; color:var(--brand-muted); }
.player-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:.5rem; }
.player-tile { padding:.375rem; }
.player-tile .player-tile-button, .player-tile .player-tile-card {
  display:grid; justify-items:center; gap:.25rem; width:100%; min-height:44px;
  padding:.25rem; border:0; background:transparent; color:inherit; overflow-wrap:anywhere;
}
.player-tile .player-tile-card { justify-items:stretch; }
.player-tile-card > strong { font-size:1.75rem; }
.player-portrait-frame { display:grid; place-items:center; min-inline-size:0; }
.player-tile-button .player-portrait-frame { width:100%; height:3rem; }
.player-tile-button img.player-portrait { width:100%; height:100%; max-width:3rem; }
.player-silhouette { display:grid; justify-items:center; gap:.18em; font-size:2.25rem; color:#8290a6; }
.player-silhouette::before { content:''; width:.48em; height:.48em; border-radius:50%; background:currentColor; }
.player-silhouette::after { content:''; width:.88em; height:.47em; border-radius:.6em .6em 0 0; background:currentColor; }
.player-tile-card .player-portrait-frame { min-height:clamp(10rem,68vw,19rem); background:#141820; border:1px dashed #47556b; border-radius:12px; }
.player-tile-card .player-silhouette { font-size:6rem; }
.player-tile-card img.player-portrait { width:100%; height:100%; max-height:19rem; object-fit:contain; }
.player-card-panel { border:2px solid #e8c66c; border-radius:18px; }
.player-card-panel .player-tile { padding:0; background:transparent; border:0; box-shadow:none; }
.player-card-numbers .stat-number { display:grid; justify-content:center; background:#141820; padding:.5rem; border-radius:.5rem; }
.player-grid .stat-number { font-size:.75rem; gap:.15rem; }
.video-player:first-child { margin-block-start:-1rem; }
.video-controls { display:flex; flex-wrap:nowrap; gap:4px; min-width:0; margin-block:.25rem; }
.video-controls > * { min-width:0; min-height:44px; padding-inline:.25rem; }
.video-controls > button:first-child, .video-controls > button:last-child { flex:1 1 auto; }
.video-controls > select { max-width:25%; color:inherit; background:#121c2b; border-color:#a89051; border-radius:.5rem; }
.video-options { display:flex; flex-wrap:wrap; gap:.25rem; }
.video-options:empty, .video-controls:empty { display:none; }


.shot-location-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  overflow-wrap: anywhere;
  font-size: .875rem;
}
.shot-location-table caption {
  margin-block-end: .375rem;
  color: var(--brand-muted);
  text-align: left;
}
.shot-location-table th,
.shot-location-table td {
  padding: .25rem .125rem;
  border-bottom: 1px solid #47556b;
  text-align: center;
  white-space: normal;
}
.shot-location-table td {
  font-variant-numeric: tabular-nums;
}

.court-zone-band, .court-zone-lane {
  fill: none;
  stroke: #ffe6a6;
  stroke-width: .12;
  pointer-events: none;
}
.court-zone-band {
  fill: #ffe6a6;
  fill-opacity: .13;
  stroke-opacity: .75;
}
.court-zone-band + .court-zone-band { fill-opacity: .06; }
.court-zone-lane { stroke-opacity: .6; stroke-dasharray: .35 .25; }

.court-board [data-act="select-court-shot"] { cursor: pointer; }
.court-board [data-act="select-court-shot"]:focus-visible {
  stroke: #ffe6a6;
  stroke-width: .22;
}


.shot-location-cell {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: .25rem .125rem;
  border: 1px solid #47556b;
  border-radius: 6px;
  background: #1e2530;
  color: var(--brand-text);
  overflow-wrap: anywhere;
  cursor: pointer;
}
.shot-location-cell[aria-pressed="true"] {
  border-color: #e8c66c;
  background: #302929;
}

.scene-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: .25rem;
}
.scene-strip > li { flex: 0 0 auto; white-space: nowrap; }
.scene-list { min-width: 0; }

.round-two-answers, .round-two-players {
  display: grid;
  gap: .375rem;
  min-width: 0;
}
.round-two-answers { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.round-two-where { grid-column: 1 / -1; display: grid; justify-items: center; gap: .25rem; }
.round-two-where .court-input { width: min(100%, 300px, max(150px, calc(100dvh - 500px))); }
.round-two-where .round-two-answers { width: 100%; }
.round-two-players { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.round-two-answers .action { min-height: 56px; }
.round-two-players .action {
  min-height: 48px;
  min-width: 0;
  padding: .25rem;
  display: grid;
  align-content: center;
  font-size: .75rem;
}
.round-two-players strong { font-size: 1.05rem; }
.round-two-players > .round-two-unknown { grid-column: 1 / -1; }
.round-two-players:has(> :nth-child(22)) { max-height: 17rem; overflow-y: auto; }

.round-two-saved-result { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 380px) {
  .round-two-players .action { min-height: 44px; }
  .round-two-players { gap: .25rem; }
}

.round-two-location {
  font-size: .75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.round-two { gap: .375rem; padding: .5rem; }
.round-two-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .5rem; }
.round-two-header h1, .round-two h2 { font-size: 1rem; }
.round-two-location { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-two-replay { align-items: flex-start; gap: .25rem; }
.round-two-replay .action { font-size: .75rem; padding-inline: .4rem; }

.round-four-detail { gap: .375rem; padding: .5rem; }
.round-four-detail h2 { font-size: .875rem; }
.round-four-detail .round-two-answers .action { min-height: 44px; }

.match-video-player .video-stage:has(video + video) {
  grid-template-columns: minmax(0, 1fr);
}
.match-video-player .video-stage:has(video + video) video {
  width: min(100%, 42rem);
  max-height: none;
}

.uniform-flick-card {
  touch-action: none;
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
}
.uniform-jersey {
  width: 150px;
  height: 160px;
  background: #475569;
  clip-path: polygon(30% 4%, 40% 0, 44% 10%, 56% 10%, 60% 0, 70% 4%, 100% 22%, 86% 44%, 75% 37%, 75% 100%, 25% 100%, 25% 37%, 14% 44%, 0 22%);
}
.uniform-jersey[data-tone="red"] { background: #b91c1c; }
.uniform-jersey[data-tone="blue"] { background: #1d4ed8; }
.uniform-jersey[data-tone="green"] { background: #15803d; }
.uniform-jersey[data-tone="yellow"] { background: #ca8a04; }

@media (min-width: 64rem) {
  .stack:has(> .match-video-player) {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    align-items: start;
  }
  .stack:has(> .match-video-player) > .match-video-player {
    grid-column: 1;
    grid-row: 1 / span 3;
    margin-block-start: 0;
  }
  .match-video-player .video-stage :is(video, iframe) {
    width: 100%;
    max-height: none;
  }
  .stack:has(> .match-video-player) > :not(.match-video-player) {
    grid-column: 2;
    min-width: 0;
  }
}

@media (min-width: 64rem) {
  :is(.mission-video-layout, .m3-layout, .m4-review):has(> .video-player) {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-rows: repeat(7, auto) 1fr;
    align-items: start;
  }
  :is(.mission-video-layout, .m3-layout, .m4-review) > .video-player {
    grid-column: 1;
    grid-row: 1 / span 8;
    margin-block-start: 0;
  }
  :is(.mission-video-layout, .m3-layout, .m4-review) > .video-player .video-stage :is(video, iframe) {
    width: 100%;
    max-height: none;
  }
  :is(.mission-video-layout, .m3-layout, .m4-review):has(> .video-player) > :not(.video-player) {
    grid-column: 2;
    min-width: 0;
  }
}
.player-shot-map-compact { max-inline-size: 220px; }

.m4-review { gap: .25rem; }
.m4-review .m4-title { font-size: 1rem; margin: 0; }
.m4-review .video-options { order: -1; justify-content: flex-end; }
.m4-review .video-stage video { width: 100%; aspect-ratio: 16 / 9; max-height: none; }
.m4-review .round-four-detail h2 { margin: 0; }
.m4-review .round-four-detail > .stack { gap: .125rem; }
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-side"]),
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-category"]) { display: contents; }
.m4-review .round-four-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m4-review .round-four-detail > .stack h2 { grid-row: 1; }
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-side"]) > div,
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-category"]) > div { grid-row: 2; }
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-category"]) > div {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-subtype"]),
.m4-review .round-four-detail > .action-group,
.m4-review .round-four-detail > p { grid-column: 1 / -1; }
.m4-review .round-four-detail .action { min-width: 0; padding-inline: .15rem; font-size: .75rem; }

.m4-review .video-player { display: flex; flex-direction: column; }
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-side"]) > h2,
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-side"]) > div { grid-column: 1; }
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-category"]) > h2,
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-category"]) > div { grid-column: 2; }

.m4-review [hidden],
.m4-review.m4-answer-open .m4-record-list { display: none; }

/* Design 2031 D: append after the existing m4 review rules. */
.m4-review .round-four-detail { grid-template-columns: minmax(0, 1fr); }
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-side"]),
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-category"]) {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr);
}
.m4-review .round-four-detail > .stack > h2 { grid-area: auto; }
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-side"]) > :is(h2, div),
.m4-review .round-four-detail > .stack:has([data-act="m4-detail-category"]) > :is(h2, div) {
  grid-area: auto;
}
.m4-review .round-four-detail :is([data-act="m4-detail-side"], [data-act="m4-detail-category"]) {
  min-width: 56px;
}
.m4-review .m4-record-list .scene-strip {
  display: flex;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
}


/* Design 2058 D2: keep undo beside the record filters. */
.m4-review .m4-record-bar { position: absolute; inset-block-start: 0; inset-inline-end: 0; }
.m4-review .m4-record-bar .action { min-height: 44px; padding: .2rem .4rem; }
.m4-review:has(.m4-record-bar) .m4-record-list .tab-strip { padding-inline-end: 9rem; }
.m4-review .m4-records { position: relative; min-width: 0; }
.m4-review.m4-answer-open .m4-records { display: none; }
@media (max-width: 370px) {
  .m4-review .round-four-detail { gap: .125rem; padding-block: .25rem; }
  .m4-review .round-four-detail > .stack { gap: 0; }
  .m4-review .round-four-detail .round-two-players .action[data-act="m4-detail-subtype"] {
    min-height: 40px; height: 40px; padding-block: 0;
  }
}

/* Design 2111 D3: retain the subtype heading for assistive technology. */
@media (max-width: 370px) {
  .m4-review .round-four-detail { row-gap: 0; padding-block: 0; }
  .m4-review .round-four-detail > .stack:has([data-act="m4-detail-subtype"]) > h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .m4-review .round-four-detail .round-two-players { row-gap: 2px; }
}
