:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #34d399;
  --error: #f87171;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.header {
  padding: 2rem 1.5rem 1rem;
  max-width: 960px;
  margin: 0 auto;
}

.header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

label.optional {
  margin-top: 1rem;
  font-weight: 500;
  color: var(--muted);
}

.url-input-wrap {
  width: 100%;
}

.url-input,
input[type="url"],
input[type="text"]#url,
textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}

.url-input,
input[type="url"],
input[type="text"]#url {
  display: block;
  min-height: 2.75rem;
  overflow-x: auto;
  white-space: nowrap;
  text-overflow: clip;
}

.url-input:focus,
input[type="url"]:focus,
input[type="text"]#url:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.url-input::placeholder,
input[type="url"]::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

textarea {
  resize: vertical;
  min-height: 3rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.4em;
}

.status.loading {
  color: var(--accent);
}

.status.error {
  color: var(--error);
}

.status.ok {
  color: var(--success);
}

.results.hidden {
  display: none;
}

.summary {
  margin-top: 1.5rem;
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.summary h2 {
  margin: 0;
  font-size: 1.1rem;
}

.timing-badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timing-badge.hidden {
  display: none;
}

#video-link a {
  color: var(--accent);
  word-break: break-all;
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

.rallies-heading {
  margin: 2rem 0 1rem;
  font-size: 1.15rem;
}

.rallies-heading span {
  color: var(--muted);
  font-weight: 500;
}

.player-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
  /* Break out of the 960px container so only the player area is wide. */
  width: min(1500px, 94vw);
  margin-left: 50%;
  transform: translateX(-50%);
}

.rally-sidebar {
  max-height: 80vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.rally-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rally-item {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.rally-item .rally-btn {
  flex: 1;
  min-width: 0;
}

.download-btn {
  flex-shrink: 0;
  align-self: stretch;
  min-width: 5.5rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--accent);
  cursor: pointer;
}

.download-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
}

.download-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.rally-btn {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  width: 100%;
}

.rally-btn:hover {
  border-color: var(--accent);
  background: #1f2c3f;
}

.rally-btn.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.18);
}

.rally-btn-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.rally-btn-index {
  font-weight: 700;
  font-size: 0.9rem;
}

.rally-btn-time {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rally-btn-desc {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.player-pane {
  position: sticky;
  top: 1rem;
}

.player-frame {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.player-frame iframe,
.player-frame > div {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.now-playing {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
  min-height: 1.3em;
}

@media (max-width: 760px) {
  .player-layout {
    grid-template-columns: 1fr;
    width: 100%;
    margin-left: 0;
    transform: none;
  }
  .rally-sidebar {
    max-height: none;
    order: 2;
  }
  .player-pane {
    position: static;
    order: 1;
  }
}

.rally-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.rally-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.rally-header {
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.rally-title {
  margin: 0;
  font-size: 1rem;
}

.rally-time {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.rally-desc {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.rally-commentary {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.rally-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rally-actions a,
.rally-actions button {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  text-decoration: none;
  border-radius: 6px;
}

.rally-actions a {
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--bg);
}

.rally-player {
  aspect-ratio: 16 / 9;
  background: #000;
}

.rally-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.rally-player.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.rally-player.placeholder:hover {
  background: #111;
}

@media (max-width: 600px) {
  .rally-header {
    flex-direction: column;
  }
}

.detections-panel { margin-top: 2rem; }
.det-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.det-inputs label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.det-inputs input[type="file"] { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem; color: var(--text); font-size: 0.85rem; }
.det-controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--muted); }
.det-controls label { display: flex; align-items: center; gap: 0.4rem; }
.det-stage { position: relative; width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; }
.det-stage video { display: block; width: 100%; height: auto; }
.det-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.det-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(200px, 1fr); gap: 1rem; align-items: start; }
.det-court { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; }
.det-court h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.det-court canvas { width: 100%; height: auto; display: block; background: #0a5c2f; border-radius: 6px; }
@media (max-width: 720px) { .det-layout { grid-template-columns: 1fr; } }

/* ---------- mode tabs ---------- */
.mode-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.mode-tab {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.5rem 1.1rem; font-size: 0.9rem; font-weight: 600;
}
.mode-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.mode-tab:hover:not(.active) { color: var(--text); border-color: var(--muted); }
.mode-panel.hidden { display: none; }

/* ---------- analyze form file grid ---------- */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.file-grid label {
  font-weight: 500; font-size: 0.82rem; color: var(--muted);
  display: flex; flex-direction: column; gap: 0.3rem;
}
.file-grid input[type="file"] {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.45rem; color: var(--text); font-size: 0.85rem;
}

.summary-actions { display: flex; align-items: center; gap: 0.6rem; }
.summary-actions .hidden { display: none; }

/* ---------- rally layout ---------- */
.rally-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
  width: min(1500px, 94vw);
  margin-left: 50%;
  transform: translateX(-50%);
}
.rally-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.rally-stage {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr);
  gap: 1rem;
  align-items: start;
}
.rally-stage .player-frame {
  aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.rally-stage .player-frame iframe,
.rally-stage .player-frame > div {
  width: 100%; height: 100%; border: 0; display: block;
}
.court-frame {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.85rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.court-heading { margin: 0; font-size: 0.95rem; color: var(--text); }
#court-canvas {
  width: 100%; height: auto; display: block; border-radius: 8px;
  background: #0a5c2f; box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
#court-info { margin: 0; font-size: 0.8rem; }

/* ---------- analytics ---------- */
.analytics { margin-top: 0; }
.analytics.hidden { display: none; }
.analytics-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.analytics-head h3 { margin: 0; font-size: 1rem; }
.analytics-toggles button { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.analytics-grid h4 {
  margin: 0 0 0.5rem; font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); font-weight: 700;
}
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.stats-table thead th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stats-table tbody th { color: var(--muted); font-weight: 500; }
.player-chip {
  display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%;
  margin-right: 0.5rem; vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

.heatmap-container { margin-top: 1.25rem; }
.heatmap-container.hidden { display: none; }
.heatmap-container h4 { margin: 0 0 0.5rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.heatmap-legend { display: flex; gap: 1rem; margin-bottom: 0.6rem; font-size: 0.8rem; color: var(--muted); }
.heatmap-legend .dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; margin-right: 0.3rem; vertical-align: middle; }
.heatmap-legend .p1 { background: #3b82f6; }
.heatmap-legend .p2 { background: #f97316; }
.heatmap-legend .p3 { background: #a855f7; }
.heatmap-legend .p4 { background: #22c55e; }
#heatmap-canvas {
  width: min(340px, 100%); height: auto; display: block;
  border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

@media (max-width: 900px) {
  .rally-layout { grid-template-columns: 1fr; }
  .rally-stage { grid-template-columns: 1fr; }
}

/* ---------- play style ---------- */
#play-style-card { display: flex; flex-direction: column; }
.play-style-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.ps-side {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.65rem 0.8rem;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.ps-side-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700;
}
.ps-badge {
  display: inline-block; align-self: flex-start;
  padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
}
.ps-badge.ps-aggressive { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border-color: rgba(239, 68, 68, 0.45); }
.ps-badge.ps-defensive  { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border-color: rgba(59, 130, 246, 0.45); }
.ps-badge.ps-balanced   { background: rgba(34, 197, 94, 0.18); color: #86efac; border-color: rgba(34, 197, 94, 0.45); }
.ps-reason { font-size: 0.82rem; color: var(--muted); line-height: 1.35; }

/* ---------- rally strip (horizontal row above player) ---------- */
.rally-strip-wrap {
  width: min(1500px, 94vw);
  margin: 1.5rem 50% 0;
  transform: translateX(-50%);
}
.rally-strip-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.rally-strip-head .rallies-heading { margin: 0; font-size: 1.05rem; }
.rally-strip {
  display: flex;
  flex-direction: row;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.4rem 0.2rem 0.8rem;
  scrollbar-width: thin;
}
.rally-strip::-webkit-scrollbar { height: 8px; }
.rally-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.rally-strip .rally-btn {
  flex: 0 0 220px;
  min-height: 78px;
}

/* ---------- rally layout: analytics left, video+court right ---------- */
.rally-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  align-items: start;
  width: min(1500px, 94vw);
  margin-left: 50%;
  transform: translateX(-50%);
}
.analytics-side { min-width: 0; position: sticky; top: 1rem; }
.analytics-side .meta { padding: 1rem; text-align: center; }

.analytics-title {
  margin: 0 0 1rem; font-size: 1rem; letter-spacing: 0.02em;
}
.analytics .stats-block { margin-top: 1rem; }
.analytics .ps-block { margin-top: 0.5rem; }
.analytics h4 {
  margin: 0 0 0.5rem; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); font-weight: 700;
}

/* Gamified bars */
.bars { display: flex; flex-direction: column; gap: 0.55rem; }
.bar { display: flex; flex-direction: column; gap: 0.3rem; }
.bar-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.82rem; }
.bar-name { color: var(--text); font-weight: 600; display: inline-flex; align-items: center; }
.bar-chip {
  display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%;
  margin-right: 0.4rem; box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
}
.bar-value {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--text);
}
.bar-unit { color: var(--muted); font-weight: 500; margin-left: 0.15rem; font-size: 0.75rem; }
.bar-track {
  height: 10px; background: rgba(255,255,255,0.06);
  border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%; border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(255,255,255,0.08) inset;
}
.bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: barShine 2.4s ease-in-out infinite;
  border-radius: 999px;
}
@keyframes barShine {
  0% { transform: translateX(-100%); }
  50%, 100% { transform: translateX(100%); }
}
.ball-meta { margin-top: 0.6rem; font-size: 0.78rem; }

/* Court panel: heatmap toggle inside */
.court-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.pill-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 999px;
  padding: 0.28rem 0.75rem; font-size: 0.78rem; font-weight: 600;
}
.pill-btn:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.pill-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.heatmap-legend {
  display: flex; gap: 0.85rem; margin-top: 0.5rem;
  font-size: 0.75rem; color: var(--muted);
}
.heatmap-legend.hidden { display: none; }

@media (max-width: 900px) {
  .rally-layout { grid-template-columns: 1fr; }
  .analytics-side { position: static; }
}

.player-column { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.player-column .now-playing { margin: 0; }

/* ---------- rally selection toolbar ---------- */
.rally-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
}
.selected-count {
  font-size: 0.82rem; color: var(--muted); font-weight: 600;
  font-variant-numeric: tabular-nums; padding-right: 0.4rem;
}
.pill-btn.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.pill-btn.primary:hover:not(:disabled) {
  background: var(--accent-hover); border-color: var(--accent-hover);
}
.pill-btn:disabled {
  opacity: 0.45; cursor: not-allowed;
}

/* ---------- rally card in the strip (checkbox + button) ---------- */
.rally-card-strip {
  position: relative;
  flex: 0 0 220px;
  display: flex;
}
.rally-card-strip .rally-btn {
  flex: 1;
  padding-left: 2.2rem;   /* space for the checkbox */
}
.rally-card-strip.selected .rally-btn {
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.10);
}
.rally-card-strip .rally-check {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  width: 1.05rem; height: 1.05rem;
  accent-color: var(--success);
  cursor: pointer;
  z-index: 2;
  margin: 0;
}

/* ---------- native-style player controls ---------- */
.player-frame { position: relative; }
.player-hover-guard {
  position: absolute; inset: 0;
  background: transparent;
  z-index: 5;
  pointer-events: auto;   /* eats all mouse events → no YT UI shows */
  cursor: default;
}
.player-controls {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 0.4rem;
}
.player-ctrl {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  width: 2.1rem; height: 2.1rem; padding: 0;
  font-size: 0.85rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.player-ctrl:hover { background: rgba(255,255,255,0.06); border-color: var(--muted); }
.player-time {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem; color: var(--muted);
  min-width: 5.2rem; text-align: center;
}
.player-progress {
  flex: 1;
  height: 6px; background: rgba(255,255,255,0.08);
  border-radius: 999px; cursor: pointer;
  overflow: hidden;
}
.player-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 999px;
  transition: width 0.1s linear;
}

/* ---------- in-video overlay ---------- */
.video-overlay {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 4;
}

/* ---------- global polish ---------- */
body {
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(59,130,246,0.10), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(34,197,94,0.06), transparent 60%),
    var(--bg);
  min-height: 100vh;
}
.header h1 {
  background: linear-gradient(180deg, #ffffff 0%, #b6c5db 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}
.panel {
  background: linear-gradient(180deg, rgba(26,35,50,0.9), rgba(20,28,42,0.9));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 8px 24px rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Rally strip cards */
.rally-strip .rally-btn {
  position: relative;
  background: linear-gradient(180deg, rgba(30,40,58,0.9), rgba(22,30,44,0.9));
  border: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.rally-strip .rally-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.5);
  background: linear-gradient(180deg, rgba(37,49,72,0.95), rgba(26,36,54,0.95));
}
.rally-strip .rally-btn.active {
  border-color: rgba(59,130,246,0.9);
  background: linear-gradient(180deg, rgba(59,130,246,0.18), rgba(59,130,246,0.08));
  box-shadow: 0 0 0 1px rgba(59,130,246,0.3), 0 8px 24px rgba(59,130,246,0.15);
}
.rally-strip .rally-btn.active::before {
  content: ""; position: absolute; inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(96,165,250,0.35), transparent 40%);
}

/* Player frame chrome */
.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.court-frame {
  background: linear-gradient(180deg, rgba(26,35,50,0.9), rgba(20,28,42,0.9));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

/* Analytics bars — glossier */
.bar-track {
  height: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.15));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
}
.bar-fill { box-shadow: 0 0 12px rgba(255,255,255,0.1) inset; }
.bar-value { letter-spacing: 0.01em; }

/* Play-style badges */
.ps-side {
  background: linear-gradient(180deg, rgba(15,20,25,0.85), rgba(10,14,20,0.85));
}
.ps-badge {
  padding: 0.28rem 0.75rem;
  letter-spacing: 0.02em;
}

/* Native controls glass */
.player-controls {
  background: linear-gradient(180deg, rgba(20,25,32,0.85), rgba(10,14,20,0.85));
  border-color: rgba(255,255,255,0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.player-ctrl {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
  transition: background 0.15s ease, transform 0.1s ease;
}
.player-ctrl:hover { background: rgba(255,255,255,0.1); }
.player-ctrl:active { transform: scale(0.96); }
.player-progress { height: 8px; }
.player-progress-fill {
  box-shadow: 0 0 8px rgba(59,130,246,0.5);
}

/* Court view heading */
.court-heading { letter-spacing: 0.02em; }
.pill-btn {
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
