/* Corner Canyon Chargers Peewee — navy / silver / white, game-night dark */
:root {
  --bg: #060a12;
  --bg-elev: #0c1420;
  --panel: #121a28;
  --border: #2a3548;
  --text: #f4f6fa;
  --muted: #9aa6b8;
  --navy: #0b1f3a;
  --navy-mid: #15305a;
  --silver: #c5ced9;
  --silver-bright: #e8eef5;
  --accent: #c5ced9;
  --accent-hot: #e8eef5;
  --accent-dim: rgba(197, 206, 217, 0.16);
  --glow: rgba(197, 206, 217, 0.28);
  --link: #8eb4e8;
  --danger: #ff6b6b;
  --ok: #5ddea0;
  --radius: 14px;
  --tap: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(21, 48, 90, 0.55), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 100%, rgba(197, 206, 217, 0.06), transparent 40%),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

/* —— Hero / wordmark —— */
.hero {
  text-align: center;
  padding: 1.1rem 0 1rem;
}

.wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  margin-bottom: 0.85rem;
}

.wm-top {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--silver);
}

.wm-chargers {
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--silver-bright);
  text-shadow:
    0 0 1px #fff,
    0 1px 0 var(--navy-mid),
    0 0 24px rgba(197, 206, 217, 0.25);
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--silver);
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.45rem, 5.5vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

.date {
  margin: 0.4rem 0 0;
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  color: var(--silver-bright);
  font-weight: 600;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* —— TV bezel —— */
.tv-wrap {
  margin: 0.5rem 0 1rem;
}

.tv-bezel {
  position: relative;
  background: linear-gradient(160deg, #152238 0%, #0a101c 55%, #101828 100%);
  border: 2px solid #3a465c;
  border-radius: 18px;
  padding: 10px 10px 0;
  box-shadow:
    0 0 0 1px rgba(197, 206, 217, 0.12),
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tv-glow {
  pointer-events: none;
  position: absolute;
  inset: -2px;
  border-radius: 20px;
  box-shadow: 0 0 28px var(--glow), 0 0 60px rgba(21, 48, 90, 0.45);
  opacity: 0.55;
  z-index: 0;
}

.tv-screen {
  position: relative;
  z-index: 1;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #1a2434;
}

.tv-screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  transform-origin: center center;
  transition: transform 0.2s ease;
}

.tv-screen.zoomed video {
  transform: scale(1.35);
}

.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 3px
  );
  opacity: 0.35;
  mix-blend-mode: multiply;
}

.empty-state {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(180deg, #0a1220 0%, #101828 100%);
  padding: 1.5rem;
  text-align: center;
}

.empty-state[hidden] { display: none !important; }

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--silver);
  color: var(--silver-bright);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
  opacity: 0.85;
}

.empty-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.empty-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.empty-hint code {
  color: var(--silver-bright);
  font-size: 0.8em;
}

.capture-canvas {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tv-chin {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.35rem 0.65rem;
}

.tv-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--navy);
  background: linear-gradient(180deg, var(--silver-bright), var(--silver));
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  min-width: 2.4rem;
  text-align: center;
}

.tv-label {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 600;
}

/* —— Player chrome —— */
.player-chrome {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem 1rem;
  outline: none;
  margin-bottom: 1.25rem;
}

.player-chrome:focus-visible {
  box-shadow: 0 0 0 2px var(--silver);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.time {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 2.6rem;
  text-align: center;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.progress-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 3px;
  background: #243044;
}

.progress-fill {
  position: absolute;
  left: 0;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--navy-mid), var(--silver-bright));
  width: 0%;
  pointer-events: none;
}

.progress-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--silver-bright);
  border: 2px solid var(--navy-mid);
  left: 0%;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: 0 0 8px var(--glow);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn {
  font-family: inherit;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  background: #1a2436;
  min-height: var(--tap);
  padding: 0 0.85rem;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--silver); outline-offset: 2px; }

.btn-icon {
  min-width: var(--tap);
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}

.btn-play {
  min-width: 64px;
  min-height: 56px;
  font-size: 1.25rem;
  background: linear-gradient(145deg, var(--silver-bright), var(--silver));
  color: var(--navy);
  border-color: transparent;
  box-shadow: 0 4px 16px var(--glow);
}

.btn-play .icon-play { display: inline-block; }

.btn-speed {
  min-height: 40px;
  min-width: 48px;
  padding: 0 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: transparent;
  border-color: var(--border);
}

.btn-speed.active,
.btn-speed[aria-pressed="true"] {
  color: var(--navy);
  background: var(--silver-bright);
  border-color: var(--silver);
}

.btn-primary {
  background: linear-gradient(145deg, var(--silver-bright), var(--silver));
  color: var(--navy);
  border: none;
}

.btn-secondary {
  background: var(--accent-dim);
  color: var(--silver-bright);
  border-color: rgba(197, 206, 217, 0.35);
}

.btn-lg {
  min-height: 52px;
  padding: 0 1.25rem;
  font-size: 1rem;
  width: 100%;
}

.volume {
  width: 88px;
  height: 28px;
  accent-color: var(--silver);
  cursor: pointer;
}

/* —— Tools —— */
.tools {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .tools { grid-template-columns: 1fr 1fr; }
  .btn-lg { width: auto; }
  .share-actions { flex-wrap: nowrap; }
}

.tool-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 1.15rem;
}

.tool-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--silver-bright);
}

.tool-desc {
  margin: 0 0 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
}

.check-deeplink {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  min-height: 40px;
}

.check-deeplink input {
  width: 18px;
  height: 18px;
  accent-color: var(--silver);
}

.clip-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.clip-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.clip-form input[type="number"] {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: #0a1220;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: var(--tap);
  padding: 0 0.75rem;
}

.clip-form #btnUseCurrent {
  grid-column: 1 / -1;
}

.clip-form #btnSaveClip {
  grid-column: 1 / -1;
}

.status {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.25em;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }
.status.busy { color: var(--link); }

/* —— Footer —— */
.footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer p { margin: 0.2rem 0; }

.credit {
  color: var(--silver-bright);
  font-weight: 600;
  margin-top: 0.35rem !important;
}

/* Landscape / short screens */
@media (orientation: landscape) and (max-height: 500px) {
  .hero { padding: 0.5rem 0 0.35rem; }
  .hero h1 { font-size: 1.25rem; }
  .wm-chargers { font-size: 1.1rem; }
  .page { padding: 0.5rem 0.75rem 1.5rem; }
  .tv-wrap { margin: 0.25rem 0 0.65rem; }
  .tv-chin { padding: 0.35rem 0.25rem 0.45rem; }
}

@media (min-width: 900px) {
  .page { padding-top: 1.75rem; }
}

/* —— Fullscreen stage (desktop / Android web FS API) —— */
.player-stage {
  position: relative;
}

.player-stage:fullscreen,
.player-stage:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-width: none;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.player-stage:fullscreen .tv-wrap,
.player-stage:-webkit-full-screen .tv-wrap {
  flex: 1 1 auto;
  margin: 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.player-stage:fullscreen .tv-bezel,
.player-stage:-webkit-full-screen .tv-bezel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 0;
  padding: 0;
  background: #000;
  box-shadow: none;
  min-height: 0;
}

.player-stage:fullscreen .tv-glow,
.player-stage:fullscreen .scanlines,
.player-stage:fullscreen .tv-chin,
.player-stage:-webkit-full-screen .tv-glow,
.player-stage:-webkit-full-screen .scanlines,
.player-stage:-webkit-full-screen .tv-chin {
  display: none;
}

.player-stage:fullscreen .tv-screen,
.player-stage:-webkit-full-screen .tv-screen {
  flex: 1;
  aspect-ratio: auto;
  height: 100%;
  border: none;
  border-radius: 0;
  min-height: 0;
}

.player-stage:fullscreen .tv-screen video,
.player-stage:-webkit-full-screen .tv-screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-stage:fullscreen .player-chrome,
.player-stage:-webkit-full-screen .player-chrome {
  flex: 0 0 auto;
  position: relative;
  z-index: 5;
  margin: 0;
  padding: 0.65rem 0.85rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  border-radius: 0;
  border: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.88) 28%);
  box-shadow: none;
}

.player-stage.is-fs-active .btn-fullscreen-active,
#btnFullscreen[aria-pressed="true"] {
  outline: 2px solid var(--silver);
  outline-offset: 2px;
}


/* —— Hero stadium art —— */
.hero-art {
  margin: 0.75rem 0 0.35rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(197, 206, 217, 0.22);
  box-shadow:
    0 0 0 1px rgba(21, 48, 90, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.45);
  background: #0a1220;
}
.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(42vh, 360px);
  object-fit: cover;
  object-position: center 40%;
}
@media (orientation: landscape) and (max-height: 500px) {
  .hero-art { margin: 0.35rem 0; }
  .hero-art img { max-height: 28vh; }
}

.landing-main { margin-top: 0.75rem; }
.landing-card { text-align: center; }
.landing-card .btn { display: inline-flex; margin-top: 0.75rem; text-decoration: none; }
