/* ============================================================
   DESIGN TOKENS
   Two layers: each theme sets a small PALETTE, and the semantic
   tokens below (surface / border / shadow / radius) are derived
   once, so every component speaks the same language.
   ============================================================ */
:root {
  --bg: #080b14;
  --bg2: #0d1220;
  --panel: #10162a;
  --panel2: #141b33;
  --text: #eef2fb;
  --muted: #94a3c4;
  --faint: #64748f;
  --line: #1e2742;
  --brand: #5b6cff;
  --brand2: #22d3c4;
  --accent: #ff4d8d;
  --live: #ff3b5c;
  --grad: radial-gradient(1100px 520px at 85% -15%, rgba(91, 108, 255, .16), transparent 62%),
    radial-gradient(800px 420px at -5% 0%, rgba(34, 211, 196, .09), transparent 58%);
}

[data-theme="cancha"] {
  --bg: #06120c;
  --bg2: #0a1a13;
  --panel: #0c2318;
  --panel2: #102c1f;
  --text: #eafff3;
  --muted: #93c9ac;
  --faint: #5f8a72;
  --line: #17402c;
  --brand: #16b877;
  --brand2: #ffd76a;
  --accent: #ff7a59;
  --live: #ff5a3c;
  --grad: radial-gradient(1100px 520px at 85% -15%, rgba(22, 184, 119, .15), transparent 62%),
    radial-gradient(800px 420px at -5% 0%, rgba(255, 215, 106, .07), transparent 58%);
}

[data-theme="medianoche"] {
  --bg: #04060d;
  --bg2: #070c17;
  --panel: #0a101f;
  --panel2: #0e1529;
  --text: #e8eeff;
  --muted: #8697bd;
  --faint: #58678c;
  --line: #16203a;
  --brand: #3b82f6;
  --brand2: #22d3ee;
  --accent: #a855f7;
  --live: #fb7185;
  --grad: radial-gradient(1100px 520px at 85% -15%, rgba(59, 130, 246, .14), transparent 62%),
    radial-gradient(800px 420px at -5% 0%, rgba(34, 211, 238, .07), transparent 58%);
}

[data-theme="atardecer"] {
  --bg: #150a12;
  --bg2: #1f0e19;
  --panel: #26121f;
  --panel2: #2e1627;
  --text: #fff0f6;
  --muted: #dda9c2;
  --faint: #a8788e;
  --line: #4a2237;
  --brand: #f2545b;
  --brand2: #ffc75a;
  --accent: #ff4d8d;
  --live: #ff3b5c;
  --grad: radial-gradient(1100px 520px at 85% -15%, rgba(242, 84, 91, .16), transparent 62%),
    radial-gradient(800px 420px at -5% 0%, rgba(255, 199, 90, .08), transparent 58%);
}

/* Federación — the identity from the commercial deck (navy + orange).
   Contrast verified on #0B1626: orange 7.6:1, sky 8.5:1, body text 16:1. */
[data-theme="federacion"] {
  --bg: #08111E;
  --bg2: #0B1626;
  --panel: #0E1A2C;
  --panel2: #122236;
  --text: #EAF1FB;
  --muted: #9AAECA;
  --faint: #7D93B2;
  --line: #1D2E47;
  --brand: #FB8A3C;
  --brand2: #38BDF8;
  --accent: #FB8A3C;
  --live: #FF4D5E;
  --grad: radial-gradient(1100px 520px at 85% -15%, rgba(251, 138, 60, .10), transparent 62%),
    radial-gradient(800px 420px at -5% 0%, rgba(56, 189, 248, .07), transparent 58%);
}

/* ---- semantic layer (theme-independent) ---- */
:root {
  --s1: rgba(255, 255, 255, .028);
  --s2: rgba(255, 255, 255, .055);
  --s3: rgba(255, 255, 255, .085);
  --hair: rgba(255, 255, 255, .07);
  --ink-on-brand: #06101f;

  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  --e1: 0 1px 2px rgba(0, 0, 0, .3);
  --e2: 0 4px 16px -6px rgba(0, 0, 0, .5);
  --e3: 0 18px 48px -22px rgba(0, 0, 0, .8);

  --t-fast: .14s cubic-bezier(.4, 0, .2, 1);
  --t-med: .24s cubic-bezier(.4, 0, .2, 1);
}

* {
  box-sizing: border-box
}

html,
body {
  margin: 0
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -.011em;
  min-height: 100vh;
  background-image: var(--grad);
  background-attachment: fixed;
}

/* every number in the product aligns in columns */
.tabular-nums,
.num {
  font-variant-numeric: tabular-nums
}

/* uppercase micro-label — the workhorse of a broadcast UI */
.label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--faint)
}

/* keyboard users get a real focus ring everywhere */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px
}

::selection {
  background: var(--brand);
  color: #fff
}

.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px
}

.glass {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  box-shadow: var(--e2);
}

.brandtext {
  color: var(--text);
  letter-spacing: -.03em
}

.chip {
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--muted);
  font-weight: 600;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}

.chip:hover {
  color: var(--text);
  background: var(--s2)
}

.chip.active {
  background: var(--s3);
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand) 55%, transparent);
  font-weight: 700
}

.btn {
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast);
}

.btn:hover {
  border-color: color-mix(in srgb, var(--brand) 60%, transparent);
  background: var(--s2)
}

/* ---- inline icons ---- */
.ic {
  width: 15px;
  height: 15px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ic-sm {
  width: 13px;
  height: 13px
}

.ic-lg {
  width: 18px;
  height: 18px
}

.ic-fill {
  fill: currentColor;
  stroke: none
}

/* ---- header ---- */
.hdrbar {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
}

.brandmark {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand2) 60%, var(--brand)));
  color: #fff;
  flex: none;
  box-shadow: var(--e1);
}

.brandwm {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--text);
}

.brandwm em {
  font-style: normal;
  color: var(--brand2)
}

.livepill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--live) 45%, var(--line));
  background: color-mix(in srgb, var(--live) 11%, transparent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text);
  flex: none;
}

.searchbox {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 380px
}

.searchbox .ic {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.searchbox input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 33px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.searchbox input::placeholder {
  color: var(--faint)
}

.searchbox input:focus {
  border-color: color-mix(in srgb, var(--brand) 65%, transparent);
  background: var(--s2)
}

.ctrl {
  height: 34px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.ctrl:hover {
  border-color: color-mix(in srgb, var(--brand) 55%, transparent);
  background: var(--s2)
}

.ctrl.on {
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  border-color: color-mix(in srgb, var(--brand) 70%, transparent);
  color: var(--text);
}

.delaybox {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--muted);
  font-size: 11px;
}

.delaybox input[type=range] {
  width: 74px;
  accent-color: var(--brand)
}

/* ---- tabs ---- */
.tabbar {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}

.tab:hover {
  color: var(--text);
  background: var(--s1)
}

.tab.active {
  color: var(--text);
  background: var(--s2);
  border-color: var(--line);
  font-weight: 700;
}

.tab.active .ic {
  color: var(--brand2)
}

.tab[data-filter="live"].active .ic {
  color: var(--live)
}

.tabcount {
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--s2);
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.tab.active .tabcount {
  background: color-mix(in srgb, var(--brand) 28%, transparent);
  color: var(--text)
}

.updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.updated::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand2);
  opacity: .8
}

/* ---- live indicator ---- */
.livepulse {
  position: relative
}

.livedot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 var(--live);
  animation: pulse 2s infinite;
  flex: none
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent)
  }

  70% {
    box-shadow: 0 0 0 8px transparent
  }

  100% {
    box-shadow: 0 0 0 0 transparent
  }
}

@media (prefers-reduced-motion: reduce) {

  .livedot,
  .skel {
    animation: none
  }

  * {
    transition-duration: .01ms !important
  }
}

/* ---- loading skeleton ---- */
.skel {
  background: linear-gradient(90deg, var(--s1) 25%, var(--s2) 37%, var(--s1) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  0% {
    background-position: 100% 0
  }

  100% {
    background-position: 0 0
  }
}

/* card — bigger tiles so the scoreboard reads as well as the featured one */
.grid-courts {
  display: grid;
  gap: 16px;
  /* min() keeps the track from forcing a 420px column on narrow phones,
     which was pushing the whole page into horizontal scroll */
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr))
}

.court {
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  /* flex column: CSS grid stretches .court to the tallest card in its row,
     and the media below grows into that height instead of leaving a gap */
  display: flex;
  flex-direction: column;
  transition: border-color var(--t-med), box-shadow var(--t-med);
}

.court:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  box-shadow: var(--e3)
}

/* Card header strip — court number, status and actions live ABOVE the video
   instead of floating over it. This is what removes the collisions with
   YouTube's own chrome (title top-left, buttons top-right, controls bottom)
   and reads like a broadcast rundown row. */
.chead {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--s1);
  min-height: 42px;
}

.chead-court {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--text);
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 3px 8px;
  flex: none;
}

.chead-court.is-featured {
  color: var(--brand2);
  border-color: color-mix(in srgb, var(--brand2) 40%, transparent);
  background: color-mix(in srgb, var(--brand2) 12%, transparent);
}

.chead-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  flex: none;
}

.chead-status.is-live {
  color: #fff;
  background: color-mix(in srgb, var(--live) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--live) 65%, transparent);
}

.chead-status.is-next {
  color: var(--muted);
  background: var(--s2);
  border: 1px solid var(--line);
}

.chead-status.is-done {
  color: var(--muted);
  background: var(--s2);
  border: 1px solid var(--line);
}

.chead-spacer {
  flex: 1;
  min-width: 0
}

.chead-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  flex: none;
}

.chead-act {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--muted);
  cursor: pointer;
  flex: none;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.chead-act:hover:not(:disabled) {
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand) 60%, transparent);
  background: var(--s2);
}

.chead-act:disabled {
  opacity: .38;
  cursor: not-allowed
}

/* .ratio is a container: the overlay below sizes itself in cqw (1% of video
 width), so the SAME scoreboard is small in a tile, bigger on the featured
 video, and big in fullscreen — "responsive inverso". */
.ratio {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  container-type: inline-size;
  /* keep exactly the 16:9 box aspect-ratio asks for — never let the flex
     parent stretch or squash a video */
  flex: 0 0 auto;
}

.ratio>iframe,
.ratio>img,
.ratio>.thumbwrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%
}

.ratio:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto
}

.ratio:fullscreen>iframe {
  width: 100%;
  height: 100%
}

/* the thumbnail lives inside .thumbwrap, so the .ratio>img rule doesn't
   reach it — size it explicitly or it renders at its natural 480×360 */
.thumbwrap {
  background:
    radial-gradient(520px 260px at 50% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 62%),
    linear-gradient(180deg, var(--panel), var(--panel2));
}

.thumb {
  width: 100%;
  height: 100%;
  /* every YouTube variant is either true 16:9 (mq/maxres) or 4:3 with black
     bars (hq/sd) — cover crops exactly those bars in both cases */
  object-fit: cover;
  display: block;
  filter: saturate(1.05);
  transition: opacity var(--t-med)
}

/* thumbnail 404'd (common on a freshly started live stream) — fade it out
   and let the branded .thumbwrap gradient show instead of a broken icon */
.thumb[data-failed] {
  opacity: 0
}

.playbtn {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(0, 0, 0, .1), rgba(0, 0, 0, .55))
}

.playbtn .pc {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .45);
  border: 2px solid rgba(255, 255, 255, .85);
  transition: transform .15s, background .15s
}

.playbtn:hover .pc {
  transform: scale(1.08);
  background: var(--live)
}

/* corner scoreboard — scales with the video via container query units */
.ov {
  position: absolute;
  left: 2.4cqw;
  bottom: 2.4cqw;
  z-index: 5;
  pointer-events: none;
  max-width: clamp(168px, 46%, 820px)
}

/* lift the score bug clear of YouTube's control bar while hovering */
.ov {
  transition: transform var(--t-med), opacity var(--t-med)
}

.ratio:hover .ov {
  transform: translateY(-38px)
}

.sb {
  display: flex;
  flex-direction: column;
  gap: clamp(2px, .55cqw, 8px);
  padding: clamp(5px, 1cqw, 14px) clamp(7px, 1.3cqw, 18px);
  border-radius: clamp(6px, 1cqw, 14px);
  background: linear-gradient(180deg, rgba(10, 14, 26, .93), rgba(6, 9, 18, .95));
  border: 1px solid rgba(255, 255, 255, .10);
  border-left: clamp(2px, .5cqw, 6px) solid var(--brand);
  backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .9);
  font-variant-numeric: tabular-nums
}

.sbrow {
  display: flex;
  align-items: center;
  gap: clamp(5px, 1.2cqw, 15px);
  min-width: 0
}

.crest {
  width: clamp(16px, 4.4cqw, 60px);
  height: clamp(16px, 4.4cqw, 60px);
  border-radius: clamp(3px, .8cqw, 11px);
  object-fit: contain;
  background: #fff;
  flex: none
}

.crestmono {
  width: clamp(16px, 4.4cqw, 60px);
  height: clamp(16px, 4.4cqw, 60px);
  border-radius: clamp(3px, .8cqw, 11px);
  display: grid;
  place-items: center;
  font-size: clamp(8px, 2cqw, 26px);
  font-weight: 800;
  color: #fff;
  flex: none
}

.tname {
  font-weight: 600;
  font-size: clamp(10px, 2.35cqw, 28px);
  line-height: 1.1;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 40px;
  color: #fff
}

.serve {
  width: clamp(4px, 1.1cqw, 13px);
  height: clamp(4px, 1.1cqw, 13px);
  border-radius: 50%;
  background: var(--brand2);
  box-shadow: 0 0 8px var(--brand2);
  flex: none
}

.serve.hidden {
  visibility: hidden
}

.sets {
  font-size: clamp(10px, 2.3cqw, 27px);
  font-weight: 700;
  color: rgba(255, 255, 255, .55);
  min-width: clamp(11px, 2.4cqw, 26px);
  text-align: center;
  flex: none
}

.pts {
  font-size: clamp(12px, 3cqw, 36px);
  font-weight: 800;
  letter-spacing: -.02em;
  min-width: clamp(20px, 4.4cqw, 56px);
  text-align: center;
  flex: none;
  background: rgba(255, 255, 255, .11);
  border-radius: clamp(3px, .7cqw, 8px);
  padding: 1px clamp(4px, .9cqw, 12px);
  color: #fff
}

.flash {
  animation: flash .7s ease-out
}

@keyframes flash {
  0% {
    background: var(--brand2);
    color: var(--ink-on-brand)
  }

  100% {
    background: rgba(255, 255, 255, .11)
  }
}

/* in-video badge (placeholder cards + spotlight) */
.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 6;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--r-xs);
  background: rgba(8, 12, 24, .78);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
}

.livebadge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 59, 92, .22);
  border: 1px solid color-mix(in srgb, var(--live) 70%, transparent);
  backdrop-filter: blur(6px);
  color: #fff
}

.viewers {
  position: absolute;
  top: 44px;
  right: 10px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: rgba(8, 12, 24, .78);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
}

/* In-video controls: revealed on hover so the video stays clean.
   Touch devices have no hover, so there they are always visible. */
.fsbtn,
.dvrbtn {
  position: absolute;
  right: 10px;
  z-index: 7;
  display: grid;
  place-items: center;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  pointer-events: auto;
  color: #fff;
  background: rgba(8, 12, 24, .8);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
  transition: opacity var(--t-med), border-color var(--t-fast), background var(--t-fast);
}

.fsbtn {
  bottom: 10px
}

.fsbtn:hover,
.dvrbtn:hover {
  border-color: var(--brand);
  background: rgba(8, 12, 24, .95)
}

@media (hover: hover) {

  .court .fsbtn,
  .court .dvrbtn {
    opacity: 0
  }

  .court:hover .fsbtn,
  .court:hover .dvrbtn,
  .court:focus-within .fsbtn,
  .court:focus-within .dvrbtn {
    opacity: 1
  }
}

.ratio:fullscreen .fsbtn {
  width: 48px;
  height: 48px;
  bottom: 24px;
  right: 24px;
  opacity: 1
}

/* per-court reload button (forces a fresh check of that court) */
.reloadbtn {
  position: absolute;
  top: 44px;
  left: 10px;
  z-index: 7;
  display: grid;
  place-items: center;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  pointer-events: auto;
  color: #fff;
  line-height: 1;
  background: rgba(8, 12, 24, .78);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
}

.reloadbtn:hover:not(:disabled) { border-color: var(--brand); background: rgba(8, 12, 24, .95) }
.reloadbtn:disabled { opacity: .4; cursor: not-allowed }
.reloadbtn.spin .ic, .chead-act.spin .ic { animation: spin 1s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }

/* the header variant sits in flow, not floating over the video */
.chead-act.reloadbtn {
  position: static;
  width: 28px;
  height: 28px;
  top: auto;
  left: auto;
  background: var(--s1);
  border-color: var(--line);
  color: var(--muted);
  backdrop-filter: none;
}

/* placeholder (scheduled / finished) — no video, so no 16:9 letterbox:
   a compact block fits many more matches on screen */
.placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: auto;
  /* grow into whatever height the row got (a 16:9 live sibling makes the row
     taller); on rows of only placeholders it stays at min-height, so the
     compact block still fits many more matches on screen */
  flex: 1 1 auto;
  min-height: 200px;
  padding: 22px 16px;
  background:
    radial-gradient(600px 300px at 50% -10%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 62%),
    linear-gradient(180deg, var(--panel), var(--panel2));
}

/* the live-without-stream card keeps room for the score bug */
.placeholder:has(.ov) {
  min-height: 260px
}

/* ads / sponsor inventory — a quiet reserved surface reads far more
   commercial than a dashed "PUBLICIDAD" box */
.ad {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--s1), transparent);
  display: grid;
  place-items: center;
  color: var(--faint);
  text-align: center
}

.ad .adtag {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 9px;
  letter-spacing: .12em;
  opacity: .7
}

.ad-leader {
  min-height: 90px
}

.ad-native {
  min-height: 100%;
}

.ad-sky {
  min-height: 600px
}

.ad-footer {
  min-height: 90px
}

.ad-anchor {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  min-height: 56px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: var(--panel)
}

.ad-hidden {
  display: none !important
}

.support-strip {
  margin-bottom: 18px
}

/* misc */
.scrollx::-webkit-scrollbar {
  height: 6px
}

.scrollx::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 9px
}

input,
select {
  outline: none
}

@media (prefers-reduced-motion:reduce) {
  * {
    animation: none !important;
    transition: none !important
  }
}

.fade-in {
  animation: fadein .4s ease both
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateY(6px)
  }

  to {
    opacity: 1
  }
}

/* inline text button that reads as a link */
.linkbtn {
  color: var(--brand2); background: none; border: none; cursor: pointer;
  padding: 0; font: inherit; text-decoration: underline;
}

/* partner / sponsor slot — a designed placeholder, not a dashed box */
.partner-slot {
  display: grid;
  place-items: center;
  min-height: 92px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, var(--s1), transparent);
}

.partner-slot span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--faint);
}

/* section title with a leading icon */
.viewtitle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}

.viewtitle .ic {
  color: var(--brand2)
}

/* bare icon button (modal close, etc.) */
.iconbtn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  flex: none;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}

.iconbtn:hover {
  color: var(--text);
  background: var(--s2);
  border-color: var(--line)
}

/* Feedback floating button + modal */
.fab {
  position: fixed; right: 16px; bottom: 80px; z-index: 45; width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid color-mix(in srgb, var(--brand) 55%, transparent);
  cursor: pointer;
  background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand2) 55%, var(--brand)));
  color: #fff;
  box-shadow: var(--e3);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.fab:hover { transform: translateY(-2px) }
@media (min-width: 1024px) { .fab { bottom: 24px; } }
.modal-back {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(3, 6, 15, .7); backdrop-filter: blur(4px);
}
.modal-card { width: 100%; max-width: 440px; border-radius: 18px; padding: 18px; }
#fbType .active { background: linear-gradient(90deg, var(--brand), var(--brand2)); color: #06101f; border-color: transparent; font-weight: 700; }

/* small "Diferido" button on finished grid cards */
.replaybtn {
  display: inline-flex; align-items: center; gap: 6px; margin: 10px auto 0;
  padding: 6px 12px; border: none; border-radius: 999px; cursor: pointer;
  background: #ff0000; color: #fff; font-size: 12px; font-weight: 700;
}
.replaybtn:hover { filter: brightness(1.1); }

/* replay player modal — wide, holds the video + synced scoreboard overlay */
.replay-card {
  width: 100%; max-width: 980px; border-radius: 18px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 94vh; overflow-y: auto;
}
.replay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.replay-title { font-size: 14px; font-weight: 800; color: var(--text); min-width: 0; }
.replay-title .vs { color: var(--muted); font-weight: 600; }
#replayMount { width: 100%; flex: none; }
#replayMount iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.replay-note { font-size: 11px; color: var(--muted); text-align: center; }

/* replay controls: custom scrubber (set-segmented, drag = scoreboard preview) */
.rp-controls { display: flex; flex-direction: column; gap: 10px; }
.rp-scrub { position: relative; padding: 16px 0 6px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.rp-track { position: relative; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .07); }
.rp-seg { position: absolute; top: 0; height: 100%; background: rgba(255, 255, 255, .05); border-left: 2px solid var(--bg); }
.rp-seg.alt { background: rgba(255, 255, 255, .12); }
.rp-prog { position: absolute; top: 0; left: 0; height: 100%; border-radius: 5px 0 0 5px; background: linear-gradient(90deg, var(--brand), var(--brand2)); opacity: .9; pointer-events: none; }
.rp-handle { position: absolute; top: 50%; left: 0; width: 16px; height: 16px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); box-shadow: 0 1px 8px rgba(0, 0, 0, .7); pointer-events: none; }
.rp-bubble { position: absolute; bottom: calc(100% - 10px); transform: translateX(-50%); background: rgba(8, 12, 24, .95); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; font-size: 11px; color: var(--text); white-space: nowrap; pointer-events: none; z-index: 3; }
.rp-bubble b { color: var(--brand2); }
.rp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rp-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rp-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--s1); color: var(--text); border-radius: var(--r-pill); padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast); }
.rp-chip:hover { background: var(--s2); border-color: color-mix(in srgb, var(--brand) 50%, transparent) }
.rp-chip b { color: var(--brand2); }
.rp-chip.active { background: linear-gradient(90deg, var(--brand), var(--brand2)); color: #06101f; border-color: transparent; font-weight: 700; }
.rp-chip.active b { color: #06101f; }
.rp-chip.rp-live { border-color: var(--live); display: inline-flex; align-items: center; gap: 6px; }
.rp-stats summary {
  display: flex; align-items: center; gap: 8px; list-style: none;
  cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 0;
}
.rp-stats summary::-webkit-details-marker { display: none }
.rp-stats summary .ic { color: var(--brand2) }
.rp-stats summary::after {
  content: ""; width: 6px; height: 6px; margin-left: auto;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform var(--t-fast);
}
.rp-stats[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px) }
.rp-stats summary:hover { color: var(--text) }
.rp-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin: 6px 0 2px; flex-wrap: wrap; }
.rp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.rp-set { margin-top: 8px; }
.rp-sethead { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 3px; flex-wrap: wrap; }
.rp-sethead span { color: var(--muted); font-size: 11px; }
.rp-worm { width: 100%; height: 56px; display: block; cursor: pointer; border-radius: 6px; background: rgba(255, 255, 255, .02); }
.rp-total { margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.9; }
.rp-statlink { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; padding: 0; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--brand2); }
.rp-statlink:hover { text-decoration: underline; }

/* "watch from the start" (DVR) button — stacked above the fullscreen one
   (shared visual styling lives in the .fsbtn/.dvrbtn rule above) */
.dvrbtn { bottom: 52px }
.ratio:fullscreen .dvrbtn, .ratio.fsmode .dvrbtn { display: none; }

/* big result / kickoff typography on placeholder cards */
.scoreline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
}

.scoreline span {
  color: var(--faint);
  font-weight: 500
}

.kickoff {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
}

/* team matchup block on placeholder cards */
.tblock {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
}

.tb-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 128px;
  min-width: 0;
}

.tb-crest {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
}

.tb-crest .crest,
.tb-crest .crestmono {
  width: 50px;
  height: 50px;
  border-radius: var(--r-sm);
  font-size: 17px;
}

.tb-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tb-name.is-link:hover {
  color: var(--brand2);
  text-decoration: underline
}

.tb-vs {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--faint);
  margin-top: 18px;
  flex: none;
}

/* Pseudo-fullscreen: CSS takeover used when the native Fullscreen API is
   unavailable (iOS) or silently fails — same DOM, so the scoreboard ALWAYS
   comes along. Toggled by goFullscreen()'s fallback. */
.ratio.fsmode {
  position: fixed; inset: 0; z-index: 100;
  width: 100vw; height: 100vh; height: 100dvh;
  aspect-ratio: auto; background: #000;
}
.ratio.fsmode>iframe { width: 100%; height: 100%; }
body.noscroll { overflow: hidden; }
.ratio.fsmode .fsbtn { width: 48px; height: 48px; font-size: 22px; bottom: 24px; right: 24px; }

/* Fullscreen view, TV-style: compact scoreboard TOP-LEFT so it never covers
   the court nor the player controls; redundant chrome hidden. */
.ratio:fullscreen .ov, .ratio.fsmode .ov {
  left: 18px; top: 18px; bottom: auto;
  transform: scale(.7); transform-origin: top left;
  opacity: .95;
}
.ratio:fullscreen .setspill, .ratio.fsmode .setspill,
.ratio:fullscreen .badge, .ratio.fsmode .badge,
.ratio:fullscreen .reloadbtn, .ratio.fsmode .reloadbtn,
.ratio:fullscreen .viewers, .ratio.fsmode .viewers { display: none; }

/* stale-streams warning chip (video feed not refreshed recently) */
.stalechip {
  position: fixed; left: 12px; bottom: 12px; z-index: 45;
  font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 999px;
  background: rgba(8, 12, 24, .85); border: 1px solid var(--line); color: var(--muted);
}

/* team directory + profile */
[data-team] { cursor: pointer; }
.team-card { display: flex; align-items: center; gap: 10px; padding: 12px; }
.team-card:hover { border-color: var(--brand); }
.team-card .crest, .team-card .crestmono { width: 38px; height: 38px; border-radius: 9px; flex: none; }
.tm-body { display: flex; flex-direction: column; gap: 14px; }
.tm-head { display: flex; align-items: center; gap: 12px; }
.tm-head .crest, .tm-head .crestmono { width: 54px; height: 54px; border-radius: 12px; font-size: 19px; flex: none; }
.tm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.tm-tile { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.tm-tile b { display: block; font-size: 19px; color: var(--text); font-variant-numeric: tabular-nums; }
.tm-tile span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tm-sec { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.tm-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.tm-bar .lbl { width: 42px; flex: none; }
.tm-bar .track { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; display: block; }
.tm-bar .fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--brand2)); display: block; }
.tm-bar .val { width: 88px; flex: none; text-align: right; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tm-match { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .03); margin-bottom: 6px; font-size: 12px; flex-wrap: wrap; }
.tm-match .date { color: var(--muted); font-size: 11px; width: 46px; flex: none; }
.tm-wl { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 11px; color: #06101f; }
.tm-wl.w { background: #19c37d; }
.tm-wl.l { background: #ff6b6b; }
.tm-bell { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--s1); color: var(--text); border-radius: var(--r-pill); padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; flex: none; }
.tm-bell.on { background: linear-gradient(90deg, var(--brand), var(--brand2)); color: #06101f; border-color: transparent; }
.hidden { display: none !important; }
