/* ABOUTME: Styles the shared SVG court, controls, and accessible event details. */
/* ABOUTME: Keeps tracking, analysis, and exploration courts responsive within their mounting surface. */
.shared-court {
    position: relative; z-index: auto; width: 100%; aspect-ratio: auto; border: 1px solid #d4d7cc; border-radius: 10px;
    background: #fdfdfb; padding: var(--court-spacing); color: #20221f;
    box-shadow: 0 15px 35px -24px #26301150;
}
/* The empty first 34px column mirrors the gear button so the legend stays centred. */
.match-explorer .explorer-heading { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: center; gap: 4px; min-height: 34px; }
.match-explorer [data-court-ref="explorer-card-settings-toggle"] { grid-column: 3; }
.match-explorer .hit { color: var(--dbst-hit); }
.match-explorer .catch { color: var(--explorer-catch-color, var(--dbst-catch)); }
.match-explorer .miss { color: var(--dbst-miss-stroke); }
.match-explorer [data-court-ref="throw-court"] { display: block; width: 100%; height: auto; max-height: none; overflow: visible; }
.shared-court[data-interaction="explore"] [data-court-ref="throw-court"] { max-height: 85dvh; }
.match-explorer .court-label { font-size: 11px; fill: #4c5845; }
.match-explorer .explorer-path { fill: none; stroke: var(--dbst-hit); stroke-width: 1.2; opacity: .45; }
.match-explorer .explorer-path.miss { stroke: var(--dbst-miss-stroke); stroke-dasharray: 4 4; }
.match-explorer .explorer-path.catch { stroke: var(--explorer-catch-color, var(--dbst-catch)); }
.match-explorer .explorer-path.is-active { opacity: 1; stroke-width: 2.5; }
.match-explorer .explorer-point { fill: var(--dbst-hit); stroke: #fdfdfb; stroke-width: 2; cursor: pointer; }
.match-explorer .explorer-point.miss { fill: var(--dbst-miss-fill); }
.match-explorer .explorer-point.catch { fill: var(--explorer-catch-color, var(--dbst-catch)); }
.match-explorer .explorer-point.origin { fill: #fff; stroke: var(--dbst-miss-stroke); r: 3; }
.match-explorer .explorer-point.is-active { r: 8; stroke: #20221f; }
.match-explorer .explorer-hover { transform: translateY(-4px); filter: drop-shadow(0 4px 2px #20221f40); }
.match-explorer [data-court-ref="throw-points"] .is-active, .match-explorer [data-court-ref="throw-lines"] .is-active { opacity: 0; }
.match-explorer .explorer-point:focus-visible { outline: 2px solid #156cd1; outline-offset: 3px; }
.match-explorer [data-court-ref="explorer-detail"] { position: fixed; z-index: 1080; max-width: min(320px, calc(100vw - 16px)); padding: 8px 12px; margin: 0; border: 1px solid #d4d7cc; border-radius: 6px; background: #fdfdfb; color: #20221f; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; pointer-events: none; box-shadow: 0 4px 16px #26301126; }
.match-explorer .explorer-legend { grid-column: 2; display: flex; justify-content: center; gap: 8px; font-size: 12px; white-space: nowrap; }

.match-explorer .explorer-catch-color { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 12px; font-weight: 600; }
.match-explorer .explorer-catch-color input { width: 42px; height: 30px; visibility: hidden; }
.match-explorer .explorer-catch-color .clr-field button { width: 100%; border: 1px solid #cbd0c5; border-radius: 6px; pointer-events: auto; cursor: pointer; }
.match-explorer .explorer-catch-color button:focus-visible, #clr-picker .clr-swatches button:focus-visible { outline: 2px solid #156cd1; outline-offset: 2px; }
#clr-picker { z-index: 1100; }
#clr-picker .clr-swatches button[aria-pressed="true"] { outline: 2px solid #20221f; outline-offset: 1px; }

.match-explorer .explorer-actions { display: flex; justify-content: center; align-items: center; gap: 4px; min-height: 34px; margin-top: var(--court-spacing); }
.match-explorer .explorer-settings-menu { position: fixed; right: 4.75rem; bottom: 1.25rem; z-index: 1090; }
.match-explorer [data-court-ref="explorer-settings-toggle"] { display: flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; border: 0; border-radius: 50%; background: #212529; color: #fff; font-size: 1.25rem; box-shadow: 0 4px 12px #0004; }
.match-explorer [data-court-ref="explorer-settings-toggle"]:hover, .match-explorer [data-court-ref="explorer-settings-toggle"]:focus-visible { background: #000; }
.match-explorer [data-court-ref="explorer-settings-toggle"][aria-expanded="true"] { background: #dc3545; }

.match-explorer .explorer-settings { position: absolute; bottom: 3.5rem; right: 0; width: 320px; max-width: calc(100vw - 5.75rem); max-height: calc(100dvh - 6rem); overflow-y: auto; padding: 16px; border: 1px solid #d4d7cc; border-radius: 10px; background: #fdfdfb; box-shadow: 0 8px 24px #26301126; }
.match-explorer .explorer-settings-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 14px; }
.match-explorer .explorer-settings-heading .btn-close { flex-shrink: 0; }
.match-explorer .explorer-setting { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; }
.match-explorer .explorer-setting + .explorer-setting { margin-top: 10px; }
/* Court line switches stack at half the gap of the other settings rows. */
.match-explorer .explorer-line-setting .form-check { min-height: 0; margin-bottom: 0; }
.match-explorer .explorer-line-setting + .explorer-line-setting { margin-top: 6px; }
.match-explorer .explorer-setting > label, .match-explorer .explorer-setting > .explorer-setting-label { flex: 0 0 6rem; }
.match-explorer .explorer-setting select { width: auto; }
.match-explorer .explorer-map { position: relative; margin-top: var(--court-spacing); }
.match-explorer .explorer-camera-controls { position: absolute; bottom: 66px; right: 20px; z-index: 1040; width: 300px; max-width: calc(100% - 40px); max-height: min(calc(100dvh - 120px), calc(100% - 120px)); overflow-y: auto; padding: 16px; border: 1px solid #d4d7cc; border-radius: 10px; background: #fdfdfb; box-shadow: 0 8px 24px #26301126; }
@media (min-width: 768px) {
    .match-explorer .explorer-camera-controls { top: 20px; bottom: auto; left: calc(100% + 16px); right: auto; max-width: none; max-height: calc(100dvh - 120px); }
}
.match-explorer .explorer-camera-setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; margin-bottom: 16px; font-size: 12px; font-weight: 600; }
.match-explorer .explorer-camera-setting output { color: var(--dbst-muted); font-variant-numeric: tabular-nums; font-weight: 400; }
.match-explorer .explorer-camera-setting input { grid-column: 1 / -1; width: 100%; min-width: 0; margin: 0; accent-color: #4c5845; }
.match-explorer .explorer-camera-setting input:disabled { opacity: .45; }
.match-explorer .explorer-camera-setting div { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--dbst-muted); font-size: 10px; font-weight: 400; }
.match-explorer .explorer-camera-setting p { grid-column: 1 / -1; margin: 0; color: var(--dbst-muted); font-size: 11px; font-weight: 400; }
.match-explorer .explorer-team-label-settings { margin-top: 16px; padding-top: 12px; }
.match-explorer .explorer-team-label-settings summary { cursor: pointer; font-size: 12px; font-weight: 600; }
.match-explorer .explorer-team-label-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; margin-top: 12px; font-size: 12px; font-weight: 600; }
.match-explorer .explorer-team-label-control output { color: var(--dbst-muted); font-variant-numeric: tabular-nums; font-weight: 400; }
.match-explorer .explorer-team-label-control input { grid-column: 1 / span 2; width: 100%; margin: 0; accent-color: #4c5845; }

@font-face {
    font-family: 'Atkinson Hyperlegible Next';
    src: url('../vendor/fonts/atkinsonhyperlegiblenext/font.ttf') format('truetype');
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../vendor/fonts/inter/font.ttf') format('truetype');
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}
.match-explorer .explorer-team-font { margin: 18px 0 0; padding: 0; border: 0; }
.match-explorer .explorer-team-font legend { float: none; width: auto; margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.match-explorer .explorer-team-font label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; cursor: pointer; }
.match-explorer .explorer-team-font input { accent-color: #4c5845; }

/* Explorer actions are icon actions (common.css) holding 20px SVGs, so they drop the side padding. */
.match-explorer .btn.explorer-action { width: 34px; flex-shrink: 0; padding: 0; }
/* The card settings panel holds one select, so it never scrolls and its open list clears the card edge. */
.match-explorer [data-court-ref="explorer-card-settings"] { top: calc(100% + 8px); bottom: auto; right: 0; z-index: 1040; max-width: 100%; max-height: none; overflow: visible; }

.match-explorer .explorer-view-preset svg { display: block; width: 20px; height: 20px; }

@media (max-width: 480px) { .match-explorer .explorer-camera-controls { bottom: 58px; right: 12px; max-width: calc(100% - 24px); max-height: min(calc(100dvh - 120px), calc(100% - 104px)); } }

.match-explorer [data-court-ref="explorer-event-video"] { display: block; width: 280px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: contain; margin-top: 8px; border-radius: 4px; background: #20221f; }
.match-explorer [data-court-ref="explorer-event-video"][hidden] { display: none; }
.match-explorer [data-event-video-status]:not(:empty) { margin-top: 6px; color: var(--dbst-muted); font-size: 11px; }

/* An event's markings on the court floor of a video, in the tracker and on clips. */
.video-court-event-point, .video-court-event-path { pointer-events: none; }
.video-court-event-point { fill: var(--dbst-hit); stroke: #fdfdfb; stroke-width: 2; }
.video-court-event-point.origin { fill: #fff; stroke: var(--dbst-miss-stroke); }
.video-court-event-point.miss { fill: var(--dbst-miss-fill); }
.video-court-event-point.catch { fill: var(--dbst-catch); }
.video-court-event-point.is-draft { stroke-width: 3; }
.video-court-event-path { stroke: var(--dbst-hit); stroke-width: 2; opacity: .65; }
.video-court-event-path.miss { stroke: var(--dbst-miss-stroke); stroke-dasharray: 4 4; }
.video-court-event-path.catch { stroke: var(--dbst-catch); }
.clip-court-overlay { position: absolute; pointer-events: none; }

.shared-court {
    --court-spacing: 16px;
    --court-horizontal-space: calc(2 * var(--court-spacing) + 2px);
    --court-heading-space: calc(34px + var(--court-spacing));
    --court-actions-space: calc(34px + var(--court-spacing));
    --court-controls-height: calc(2 * var(--court-spacing) + 2px + var(--court-heading-space) + var(--court-actions-space));
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    width: calc((var(--court-max-height, 100dvh) - var(--court-controls-height)) * var(--court-surface-aspect-ratio, 0.5) + var(--court-horizontal-space));
    flex: none;
}
@media (max-width: 480px) {
    .shared-court { --court-spacing: 12px; }
}
.shared-court:has(> .explorer-heading[hidden]) { --court-heading-space: 0px; }
.shared-court:has(> .explorer-actions[hidden]) { --court-actions-space: 0px; }
.shared-court > .explorer-heading[hidden] + .explorer-map { margin-top: 0; }
.shared-court[data-interaction="explore"] { width: 100%; }
.dodgeball-court-container { --court-max-height: 100dvh; display: flex; justify-content: center; align-items: flex-start; }
.dodgeball-court-container > [data-court-mount] { width: 100%; min-width: 0; display: flex; justify-content: center; }
.shared-court button, .shared-court select, .shared-court input { font: inherit; }
.shared-court button { cursor: pointer; }
.shared-court [hidden] { display: none !important; }
.shared-court .btn-close { width: 16px; height: 16px; padding: 0; border: 0; background: transparent; color: #65705f; }
.shared-court .btn-close::before { content: '×'; font-size: 20px; line-height: 16px; }
.shared-court .explorer-point.is-highlighted { r: 8; stroke: #20221f; }
.shared-court .explorer-path.is-highlighted { opacity: 1; stroke-width: 2.5; }
.shared-court[data-interaction="track"] .explorer-point { cursor: crosshair; }
.shared-court[data-interaction="track"] [data-court-ref="throw-court"] { cursor: crosshair; }
.shared-court[data-interaction="display"] .explorer-point { pointer-events: none; }
.shared-court .explorer-point.is-draft { stroke-width: 2.5; }
.shared-court .court-overlay { overflow: hidden; }
.match-explorer video { display: block; width: 280px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: contain; margin-top: 8px; border-radius: 4px; background: #20221f; }
.match-explorer video[hidden] { display: none; }

.dodgeball-court-container.court-loading .shared-court > :not(.court-status-overlay),
.dodgeball-court-container.court-error .shared-court > :not(.court-status-overlay) {
    opacity: 0.35;
    pointer-events: none;
}

.court-status-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    text-align: center;
    color: #dc3545;
    z-index: 20; /* Above markers, labels, and the on-court flip button */
}

.court-status-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

.court-status-icon {
    font-size: 3rem;
    line-height: 1;
}

.court-status-message {
    margin: 0;
    font-weight: 600;
}

.shared-court .explorer-action > svg { display: block; width: 20px; height: 20px; }

/* The tracker's enter and move tools sit after a divider at the end of the tray. */
.match-explorer .explorer-actions-divider { align-self: stretch; width: 1px; margin: 4px 6px; background: #d4d7cc; }
.shared-court[data-court-tool="move"] [data-court-ref="throw-court"] { cursor: default; }
.shared-court[data-court-tool="move"] .explorer-point { cursor: grab; }
.shared-court[data-court-tool="move"] [data-court-ref="throw-court"]:active .explorer-point { cursor: grabbing; }

/* The events-shown segments share the width beside their label so they stay inside the court settings popover. */
.match-explorer .explorer-events-shown .btn-group {
    flex: 1 1 auto;
    min-width: 0;
}

.match-explorer .explorer-events-shown .btn {
    flex: 1 1 0;
    padding-inline: 0.25rem;
    font-size: 12px;
    white-space: nowrap;
}
