/* The league court drawing (shared by the live tracker, dashboard and View/Edit)
   and the live court stage: the stretched court box, shot markers and the
   on-court selector arcs. Geometry is drawn in feet by app/court.js; this file
   only styles it.

   The floor is a near-black plank surface in both themes; lines are the
   off-white court line token and the rim is the orange opponent-miss token.
   Floor shades are declared once here (they are not theme colours). */
.court.league-court {
  --court-floor: #121110;
  --court-floor-plank: #1b1918;
  --court-floor-paint: #1d1b1a;
  --court-rim: var(--mark-def-miss);
  --court-stroke: var(--court-line);
}
.court.league-court .court-floor-base { fill: var(--court-floor); }
.court.league-court .court-plank { stroke: var(--court-floor-plank); stroke-width: 0.05px; }
.court.league-court #court-floor .court-shell { stroke: none; opacity: 1; }
.court.league-court #court-floor .court-paint { fill: var(--court-floor-paint); opacity: 1; stroke: none; }

/* Lines: square caps, one crisp non-scaling stroke at any size. */
.court.league-court #court-markings > .court-line {
  fill: none;
  stroke: var(--court-stroke);
  stroke-width: 2.25px;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
  opacity: 1;
}
.court.league-court #court-markings > .court-restricted { stroke-width: 1.5px; opacity: 0.8; }
.court.league-court #court-markings > .court-hash { stroke-width: 1.75px; }
.court.league-court #court-markings > .court-ft-circle-inner { stroke-dasharray: 8 7; stroke-linecap: butt; }
.court.league-court #court-markings > .court-deep { stroke-width: 1.25px; stroke-dasharray: 3 7; stroke-linecap: butt; opacity: 0.32; }
.court.league-court #court-markings > .court-backboard { stroke-width: 4px; }
.court.league-court #court-markings > .court-stem { stroke-width: 1.75px; }
.court.league-court #court-markings > .court-rim { stroke: var(--court-rim); stroke-width: 2.5px; }
.court.league-court #court-markings > .court-block { fill: var(--court-stroke); stroke: none; }

/* Faint small-caps distance labels. */
.court.league-court .court-distance {
  fill: var(--court-line);
  opacity: 0.32;
  font-family: var(--font-display);
  font-size: 0.95px;
  font-weight: 700;
  letter-spacing: 0.1px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
/* Region numbers and the hover tint read against a dark floor. */
.court.league-court .label { fill: var(--court-line); }
.court.league-court .region:hover { fill: color-mix(in srgb, var(--court-line) 10%, transparent); }
.court.league-court .region.active { fill: color-mix(in srgb, var(--brand-ink) 24%, transparent); }
.court.league-court .pending-v2 { fill: none; stroke: var(--court-line); stroke-width: 0.2px; }

/* ---------------------------------------------------------------- live court stage */
.lv-court-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  container-type: size;
}
/* Fixed geometry: only the slot's size decides the court box (the court is the
   league ratio stretched ~1.15 horizontally); selectors never take layout space. */
.lv-court {
  --lv-ratio: 1.2;
  position: relative;
  width: min(100cqw, calc(100cqh * var(--lv-ratio)));
  aspect-ratio: var(--lv-ratio);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 1px var(--line);
}
/* Whose ball: the court outline and the "[Team] Ball" label take the colour
   of the team in possession (its assigned colour, never a fixed one). */
.lv-court[data-side="offense"] { --ball-color: var(--lv-us, var(--brand-ink)); }
.lv-court[data-side="defense"] { --ball-color: var(--lv-opp, var(--defense)); }
.lv-court[data-side="offense"], .lv-court[data-side="defense"] { box-shadow: 0 0 0 3px var(--ball-color), 0 0 22px color-mix(in srgb, var(--ball-color) 22%, transparent); transition: box-shadow 0.2s ease; }
.lv-ball {
  position: absolute; left: 10px; bottom: 10px; z-index: 3;
  display: inline-flex; align-items: center; gap: 7px; max-width: 40%;
  padding: 5px 12px 5px 9px; border: 1px solid var(--ball-color); border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--ball-color) 26%, rgba(0, 0, 0, 0.55));
  color: #fff; font: 700 13px/1.1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; user-select: none;
}
.lv-ball i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--ball-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ball-color) 35%, transparent); }
/* What to do next, quietly under the play: never takes a click. */
.lv-court-hint.lv-instruction {
  position: absolute; left: 50%; bottom: 12px; z-index: 2; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 0; max-width: 52%; padding: 0;
  border: 0; text-align: center; pointer-events: none;
  text-shadow: 0 1px 3px #000, 0 0 8px #000;
}
.lv-court-hint.lv-instruction strong { font-size: 13px; color: var(--court-line, var(--ink)); }
.lv-court-hint.lv-instruction span { font-size: 11px; min-height: 0; }
.lv-court:has(.lv-chips) .lv-court-hint { display: none; }
.lv-court[data-side="jump"] { box-shadow: 0 0 0 2px var(--line-strong); }
.lv-court > .court { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; }
.lv-court .region { cursor: pointer; }
.lv-court.is-locked .region { cursor: default; }
.lv-court .region.is-unavailable { fill: color-mix(in srgb, #000 55%, transparent); cursor: not-allowed; }
.lv-court .region.is-unavailable:hover { fill: color-mix(in srgb, #000 55%, transparent); }
.lv-court.is-locked .region:hover { fill: transparent; }
.lv-court-watermark {
  position: absolute;
  top: 8px;
  right: 12px;
  text-align: right;
  font: 700 clamp(22px, 4.2cqw, 38px) / 1 var(--font-display);
  letter-spacing: 0.14em;
  color: var(--lv-us, var(--brand-ink));
  opacity: 0.26;
  pointer-events: none;
  user-select: none;
}
/* Shot markers are drawn in the shooting team's colour (ours: brand red,
   opponent: blue); a make is a filled dot and a miss is an X, so the result
   never depends on colour. Shared by the live court and session detail. */
.court.league-court { --court-mark-us: var(--brand-ink); --court-mark-opp: var(--defense); }
.screen.light .court.league-court, [data-theme="light"] .court.league-court {
  --court-mark-us: color-mix(in srgb, var(--brand) 60%, #fff);
  --court-mark-opp: color-mix(in srgb, var(--defense) 70%, #fff);
}
.court.league-court #shot-markers .marker-off-make { fill: var(--shot-color, var(--court-mark-us)); stroke: var(--court-floor); stroke-width: 0.14px; }
.court.league-court #shot-markers .marker-def-make { fill: var(--shot-color, var(--court-mark-opp)); stroke: var(--court-floor); stroke-width: 0.14px; }
.court.league-court #shot-markers .marker-off-miss path { stroke: var(--shot-color, var(--court-mark-us)); stroke-width: 2px; fill: none; vector-effect: non-scaling-stroke; filter: none; }
.court.league-court #shot-markers .marker-def-miss path { stroke: var(--shot-color, var(--court-mark-opp)); stroke-width: 2px; fill: none; vector-effect: non-scaling-stroke; filter: none; }
.court.league-court #shot-markers .marker-off-shooting-foul { fill: none; stroke: var(--shot-color, var(--court-mark-us)); }
.court.league-court #shot-markers .marker-def-shooting-foul { fill: none; stroke: var(--shot-color, var(--court-mark-opp)); }

/* ---------------------------------------------------------------- selector arcs */
.lv-arc {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.lv-arc > * { pointer-events: auto; }
/* Jump ball: a soft spotlight on the decision, the rest of the court dimmed. */
.lv-arc > .lv-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--spot-x, 50%) var(--spot-y, 60%), transparent 0, transparent 150px, color-mix(in srgb, var(--court-floor, #000) 55%, transparent) 300px);
  animation: lv-spot-in 0.25s ease-out;
}
@keyframes lv-spot-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lv-arc > .lv-spotlight { animation: none; } }
.lv-arc-stems { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.lv-arc-stems line { stroke: color-mix(in srgb, var(--court-line) 55%, transparent); stroke-width: 1.5; stroke-linecap: round; }
.lv-choice, .lv-bubble, .lv-chip {
  font: inherit;
  color: var(--ink);
}
.lv-choice {
  position: absolute;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 4px 6px;
  border: 1.5px solid var(--lv-tone, var(--line-strong));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--lv-tone, var(--line-strong)) 22%, var(--surface));
  font-weight: 700;
  font-size: calc(14px * var(--lv-arc-scale, 1));
  line-height: 1.1;
  text-align: center;
  box-shadow: 0 6px 18px #00000066;
  cursor: pointer;
  transition: transform var(--dur, 0.12s) var(--ease, ease), background var(--dur, 0.12s) var(--ease, ease);
}
.lv-choice:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--lv-tone, var(--line-strong)) 38%, var(--surface)); }
.lv-choice[aria-pressed="true"] { background: var(--lv-tone, var(--brand)); color: var(--on-brand); }
.lv-choice small { display: block; font-size: 0.72em; font-weight: 500; opacity: 0.8; }
.lv-choice kbd { position: absolute; top: 2px; right: 4px; font: 600 10px var(--font-mono, monospace); opacity: 0.7; background: none; border: 0; padding: 0; }
.lv-choice.is-major { font-size: calc(19px * var(--lv-arc-scale, 1)); }
.lv-choice.is-minor { font-size: calc(12px * var(--lv-arc-scale, 1)); font-weight: 600; }
.lv-choice.tone-make { --lv-tone: var(--mark-make); }
.lv-choice.tone-miss { --lv-tone: var(--mark-miss); }
.lv-choice.tone-gold { --lv-tone: var(--warning); }
.lv-choice.tone-neutral { --lv-tone: var(--line-strong); }
.lv-choice.tone-us { --lv-tone: var(--lv-us, var(--brand-ink)); }
.lv-choice.tone-opp { --lv-tone: var(--lv-opp, var(--defense)); }
.lv-choice:focus-visible, .lv-chip:focus-visible, .lv-bubble:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lv-bubble {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 6px 18px #00000066;
}
button.lv-bubble { cursor: pointer; }
.lv-bubble small { font-weight: 500; letter-spacing: 0; text-transform: none; opacity: 0.8; }
.lv-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 8px;
  max-width: 94%;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-pop);
}
.lv-card h3 { margin: 0; font: 700 15px var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; }
.lv-card .lv-card-grid { display: grid; grid-template-columns: repeat(var(--lv-card-cols, 3), minmax(112px, 1fr)); gap: 8px; }
.lv-card .lv-bubble { position: relative; justify-self: center; }
.lv-card .lv-choice { position: relative; min-height: 48px; }
.lv-card ul { margin: 0; padding-left: 18px; color: var(--ink-muted); font-size: 13px; }
.lv-chips {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 5;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 94%;
  pointer-events: auto;
}
.lv-chip {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.lv-chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.lv-chip-group { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 6px; }
.lv-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.lv-chip .lv-drain { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; min-width: 0; border-radius: 0; }
.lv-chips .lv-chip-label { align-self: center; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
/* A game card over the court (between periods). */
.lv-court-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 22px 30px;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-pop);
}
.lv-court-card h3 { margin: 0; font: 700 22px var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; }
.lv-court-card p { margin: 0; color: var(--ink-muted); max-width: 34ch; }

/* The one visible timer: Save now counts down while only optional questions are left. */
.lv-drain { display: block; height: 3px; width: 100%; min-width: 48px; overflow: hidden; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--ink) 16%, transparent); }
.lv-drain::after {
  content: "";
  display: block;
  height: 100%;
  background: var(--brand-ink);
  transform-origin: left center;
  animation: lv-drain var(--lv-drain-ms, 5000ms) linear var(--lv-drain-delay, 0ms) forwards;
}
.lv-root.is-paused .lv-drain::after { animation-play-state: paused; }
@keyframes lv-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  .lv-choice { transition: none; }
}
.lv-chip[data-late] { opacity: 0; animation: lv-show 0s linear 450ms forwards; }
@keyframes lv-show { to { opacity: 1; } }
.lv-choice { overflow: hidden; min-width: 0; }
.lv-choice-label, .lv-choice small, .lv-bubble strong, .lv-bubble small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-bubble { max-width: 100%; overflow: hidden; }
.lv-chip { max-width: 100%; }

/* The optional-questions fan */
.lv-fan-block { position: absolute; display: grid; align-content: center; justify-items: center; gap: 4px; padding: 0; border: 0; background: none; box-shadow: none; overflow: visible; }
.lv-fan-label { text-shadow: 0 1px 3px #000, 0 0 6px #000; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 10px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); }
.lv-fan-chips { display: grid; width: 100%; gap: 6px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.lv-fan-block[data-cols="1"] .lv-fan-chips { --cols: 1; }
.lv-fan-block[data-area="left"] .lv-fan-chips { --cols: 2; }
.lv-fan-block[data-area="right"] .lv-fan-chips { --cols: 1; }
.lv-fan-block[data-area="top"] .lv-fan-chips { --cols: 2; }
.lv-fan-block[data-area="bottom"] { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 3px 6px; background: none; border: 0; box-shadow: none; overflow: visible; }
.lv-fan-chips .lv-choice { position: relative; min-height: 44px; padding: 0 12px; font-size: 15px; }
.lv-fan-chips .lv-choice kbd { position: static; margin-left: 4px; }
.lv-fan-block[data-area="top"] .lv-choice { padding: 0 6px; }
.lv-fan-chips .lv-choice { display: inline-flex; align-items: center; justify-content: center; }
.lv-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lv-fan-block[data-area="bottom"] .lv-chip { min-height: 44px; }

@keyframes lv-pop { from { opacity: 0; transform: scale(0.86); } to { opacity: 1; transform: scale(1); } }
.lv-choice:not(.is-steady) { animation: lv-pop 160ms ease-out both; }
@media (prefers-reduced-motion: reduce) { .lv-choice, .lv-fan-chips .lv-choice { animation: none; } }

/* The possession the arrow suggests for an overtime. */
.lv-choice.is-suggested { box-shadow: 0 0 0 2px var(--ink), 0 6px 18px #00000066; }
.lv-choice.is-suggested small { font: 700 9px var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.9; }

/* Free throws: the original shot stays on the court, dimmed; the pips list the recorded attempts. */
.lv-court[data-ft="true"] #pendingMarker { opacity: 0.3; }
.lv-ft-counter { grid-auto-flow: column; align-items: center; gap: 8px; }
.lv-pips { display: inline-flex; gap: 4px; align-items: center; }
.lv-pip { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--court-mark-us, currentColor); box-sizing: border-box; }
.lv-pip.is-make { background: var(--court-mark-us, currentColor); }
.lv-pip.is-miss { background: transparent; border-color: var(--text-muted, currentColor); }
.lv-choice.is-major[data-k="attemptResult"] { font-size: calc(14px * var(--lv-arc-scale, 1)); letter-spacing: 0; }

/* ---- Flow buttons: as easy to see as Make / Miss ------------------------------- */
.lv-choice.tone-neutral {
  --lv-tone: color-mix(in srgb, var(--ink) 64%, var(--surface));
  border-width: 2px;
  background: color-mix(in srgb, var(--ink) 18%, var(--surface));
  color: var(--ink);
  font-weight: 700;
}
.lv-choice.tone-neutral:hover { background: color-mix(in srgb, var(--ink) 30%, var(--surface)); }
.lv-choice.tone-neutral[aria-pressed="true"] { background: var(--brand); border-color: color-mix(in srgb, var(--brand) 55%, #fff); color: var(--on-brand); }
.lv-chip, button.lv-bubble {
  min-height: 44px;
  padding: 0 18px;
  border-width: 2px;
  border-color: color-mix(in srgb, var(--ink) 58%, transparent);
  background: color-mix(in srgb, var(--ink) 16%, var(--surface));
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 18px #00000066;
}
.lv-chip:hover, button.lv-bubble:hover { background: color-mix(in srgb, var(--ink) 28%, var(--surface)); }
.lv-chip.is-primary { background: var(--brand); border-color: color-mix(in srgb, var(--brand) 50%, #fff); color: var(--on-brand); }
.lv-chip.is-primary:hover { background: color-mix(in srgb, var(--brand) 82%, #fff); }
.lv-chip-text { display: inline-flex; align-items: center; gap: 6px; }
.lv-chip.is-primary .lv-drain { height: 5px; background: color-mix(in srgb, #fff 24%, transparent); }
.lv-chip.is-primary .lv-drain::after { background: #fff; }
.lv-fan-block[data-area="left"] .lv-choice, .lv-fan-block[data-area="top"] .lv-choice { padding: 0 8px; font-size: 14.5px; }
.lv-fan-label { padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 82%, transparent); }
/* Compact screens: the ball label moves to the top-left corner so it never
   meets the hint, and the hint keeps only its question. */
@media (max-height: 700px), (max-width: 1100px) {
  .lv-ball { top: 6px; bottom: auto; left: 6px; padding: 3px 8px 3px 6px; font-size: 10px; gap: 5px; }
  .lv-ball i { width: 7px; height: 7px; }
  .lv-court-hint.lv-instruction { bottom: 6px; max-width: 70%; }
  .lv-court-hint.lv-instruction strong { font-size: 11px; }
  .lv-court-hint.lv-instruction span { display: none; }
}
/* Two-line bubbles (the player question): content centred, never clipped. */
.lv-bubble { align-content: center; line-height: 1.2; }
.lv-ask-bubble { gap: 2px; padding: 4px 14px; }
.lv-ask-bubble strong { font-size: 12px; }
.lv-ask-bubble small { font-size: 11px; }
