/* MX Fantasy League — TV mode.
   Fixed 1920x1080 stage, scaled to fit by tv_display.js (same look on 1080p and 4K). */

:root {
  --cyan: #19c3ff;
  --cyan-glow: rgba(25, 195, 255, 0.55);
  --navy: #071225;
  --white: #ffffff;
  --row-line: rgba(120, 150, 185, 0.22);
  --cond: "Saira Condensed", "Arial Narrow", sans-serif;
  --xcond: "Saira Extra Condensed", "Saira Condensed", "Arial Narrow", sans-serif;
}

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

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  color: var(--white);
  font-family: var(--cond);
  -webkit-font-smoothing: antialiased;
}

body.tv-idle, body.tv-idle * { cursor: none !important; }

.tv-viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--navy);
}

.tv-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  overflow: hidden;
}

/* ---------- Background ---------- */
.tv-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 620px 520px at 1480px 520px, rgba(20, 110, 190, 0.22), transparent 70%),
    radial-gradient(ellipse 900px 600px at 420px 560px, rgba(14, 50, 95, 0.35), transparent 75%),
    radial-gradient(ellipse 1400px 900px at 960px 540px, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(180deg, #0a1a33 0%, #071427 45%, #050e1d 100%);
}
.tv-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background: repeating-linear-gradient(
    -38deg,
    rgba(255, 255, 255, 0) 0 22px,
    rgba(255, 255, 255, 0.018) 22px 24px
  );
}
.tv-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .6  0 0 0 0 .75  0 0 0 0 1  0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

.tv-rider {
  position: absolute;
  left: 1490px;
  top: 40px;
  width: 430px;
  height: auto;
  z-index: 3;
  opacity: 0.13;
  filter: grayscale(1) brightness(1.4) sepia(1) hue-rotate(165deg) saturate(2.2);
  pointer-events: none;
  -webkit-mask-image: linear-gradient(200deg, #000 35%, transparent 85%);
  mask-image: linear-gradient(200deg, #000 35%, transparent 85%);
}

/* ---------- Header ---------- */
.tv-hdr-slashes {
  position: absolute;
  left: 14px;
  top: 30px;
  height: 110px;
  display: flex;
  gap: 7px;
  z-index: 2;
}
.tv-hdr-slashes i {
  display: block;
  width: 9px;
  height: 100%;
  background: var(--cyan);
  transform: skewX(-18deg);
  box-shadow: 0 0 10px var(--cyan-glow);
}
.tv-hdr-slashes i:nth-child(2) { opacity: 0.65; }
.tv-hdr-slashes i:nth-child(3) { opacity: 0.35; }

.tv-hdr-topline {
  position: absolute;
  left: 58px;
  top: 20px;
  width: 560px;
  height: 3px;
  z-index: 2;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--cyan) 70%, rgba(25, 195, 255, 0) 100%);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.tv-brand {
  position: absolute;
  left: 60px;
  top: 30px;
  margin: 0;
  z-index: 2;
  font-family: var(--xcond);
  font-weight: 800;
  font-style: italic;
  font-size: 118px;
  line-height: 1;
  letter-spacing: 2px;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 30px rgba(0, 0, 0, 0.5);
}

.tv-updated-wrap {
  position: absolute;
  right: 34px;
  top: 28px;
  width: 340px;
  z-index: 2;
}
.tv-updated {
  padding-right: 30px;
  text-align: right;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 36px;
  line-height: 44px;
  letter-spacing: 2px;
  color: var(--cyan);
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(25, 195, 255, 0.35);
}
.tv-updated.is-error { color: #ff7a7a; }
.tv-updated-line {
  display: block;
  margin-top: 4px;
  filter: drop-shadow(0 0 5px var(--cyan-glow));
}

/* ---------- Leaderboard ---------- */
.tv-tab-frame {
  position: absolute;
  left: 38px;
  top: 176px;
  z-index: 2;
  filter: drop-shadow(0 0 8px rgba(25, 195, 255, 0.35));
}
.tv-tab {
  position: absolute;
  left: 72px;
  top: 176px;
  height: 54px;
  z-index: 3;
  font-family: var(--cond);
  font-weight: 600;
  font-style: italic;
  font-size: 36px;
  line-height: 56px;
  letter-spacing: 5px;
  color: var(--cyan);
  white-space: nowrap;
}

.tv-lb-box {
  position: absolute;
  left: 38px;
  top: 236px;
  width: 1003px;
  height: 640px;
  z-index: 2;
  border: 2px solid rgba(85, 115, 150, 0.55);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(10, 24, 42, 0.72), rgba(6, 15, 28, 0.78));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.tv-lb {
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tv-row {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  border-bottom: 2px solid var(--row-line);
}
.tv-row:last-child { border-bottom: 0; }
.tv-row--podium {
  flex: 0 0 98px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012) 70%, rgba(255, 255, 255, 0.03));
}

.tv-row > * {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
}

.tv-row__rank {
  left: 20px;
  width: 84px;
  text-align: center;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 42px;
  line-height: 1;
  color: #e9eef4;
}
.tv-row--podium .tv-row__rank {
  font-weight: 800;
  font-style: italic;
  font-size: 84px;
}

.tv-row__divider {
  left: 120px;
  width: 2px;
  height: 46px;
  background: rgba(120, 150, 185, 0.3);
}

.tv-row__medal {
  left: 124px;
  width: 64px;
  height: 76px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

.tv-row__name {
  left: 234px;
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 46px;
  line-height: 1.1;
  letter-spacing: 3px;
  color: #eef2f7;
}
.tv-row--podium .tv-row__name {
  font-weight: 700;
  font-size: 72px;
  letter-spacing: 3px;
}

.tv-row__pts {
  right: 42px;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 44px;
  line-height: 1;
  letter-spacing: 1px;
  color: #eef2f7;
}
.tv-row__pts small {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-left: 12px;
  opacity: 0.92;
}
.tv-row--podium .tv-row__pts { font-size: 52px; }
.tv-row--podium .tv-row__pts small { font-size: 36px; }

/* Podium metal text */
.is-gold .tv-row__rank,
.is-gold .tv-row__name,
.is-silver .tv-row__rank,
.is-silver .tv-row__name,
.is-bronze .tv-row__rank,
.is-bronze .tv-row__name {
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.is-gold .tv-row__rank,
.is-gold .tv-row__name {
  background-image: linear-gradient(180deg, #ffe596 0%, #f0bf4c 45%, #c58a22 100%);
}
.is-silver .tv-row__rank,
.is-silver .tv-row__name {
  background-image: linear-gradient(180deg, #ffffff 0%, #d5dbe2 50%, #98a2ad 100%);
}
.is-bronze .tv-row__rank,
.is-bronze .tv-row__name {
  background-image: linear-gradient(180deg, #f3b783 0%, #cc8350 50%, #97552c 100%);
}
.is-gold .tv-row__pts { color: #eab24c; }
.is-silver .tv-row__pts { color: #e8edf2; }
.is-bronze .tv-row__pts { color: #cd8754; }

.tv-empty {
  padding: 40px;
  font-size: 36px;
  color: #8fa3bd;
}

/* ---------- Next race panel ---------- */
.tv-race-frame {
  position: absolute;
  left: 1088px;
  top: 202px;
  z-index: 2;
  filter: drop-shadow(0 0 10px rgba(25, 195, 255, 0.45)) drop-shadow(0 0 28px rgba(25, 195, 255, 0.18));
}

.tv-race {
  position: absolute;
  left: 1088px;
  top: 202px;
  width: 780px;
  height: 676px;
  z-index: 4;
}
.tv-race > * { position: absolute; }

.tv-race__eyebrow {
  left: 52px;
  top: 30px;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 44px;
  line-height: 60px;
  letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(25, 195, 255, 0.35);
}

.tv-race__bars {
  left: 320px;
  top: 54px;
  display: flex;
  gap: 10px;
}
.tv-race__bars i {
  display: block;
  width: 30px;
  height: 14px;
  background: var(--cyan);
  transform: skewX(-45deg);
  box-shadow: 0 0 8px var(--cyan-glow);
}
.tv-race__bars i:nth-child(4) { opacity: 0.7; }
.tv-race__bars i:nth-child(5) { opacity: 0.4; }

.tv-race__name {
  left: 44px;
  top: 82px;
  margin: 0;
  padding-right: 34px;
  max-width: none;
  transform-origin: 0 50%;
  font-family: var(--xcond);
  font-weight: 800;
  font-style: italic;
  font-size: 256px;
  line-height: 1;
  letter-spacing: -1px;
  white-space: nowrap;
  color: #fff;
  background-image: linear-gradient(180deg, #ffffff 0%, #f1f4f8 55%, #cfd6df 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  -3 0 0 0 3.1'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23g)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  -3 0 0 0 3.1'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23g)'/%3E%3C/svg%3E");
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
}

.tv-race__meta {
  left: 48px;
  top: 336px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 35px;
  letter-spacing: 1px;
  color: #f2f5f9;
  white-space: nowrap;
}
.tv-race__cal { flex: 0 0 auto; }

.tv-race__divider {
  left: 40px;
  top: 400px;
  width: 700px;
  height: 2px;
  background: linear-gradient(90deg, rgba(25, 195, 255, 0.55), rgba(25, 195, 255, 0.25) 80%, rgba(25, 195, 255, 0.05));
}

.tv-race__cdlabel {
  left: 50px;
  top: 420px;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 40px;
  line-height: 50px;
  letter-spacing: 2px;
  color: var(--cyan);
}

.tv-cd {
  left: 0;
  top: 0;
  width: 780px;
  height: 676px;
  pointer-events: none;
}
.tv-cd__grp {
  position: absolute;
  top: 452px;
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tv-cd__grp--a { left: 15px; }
.tv-cd__grp--b { left: 251px; }
.tv-cd__grp--c { left: 486px; }

.tv-cd__num {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 172px;
  line-height: 168px;
  letter-spacing: -3px;
  color: #22c4ff;
  text-shadow: 0 0 22px rgba(25, 195, 255, 0.55), 0 0 4px rgba(25, 195, 255, 0.6);
  font-variant-numeric: tabular-nums;
}
.tv-cd__lbl {
  margin-top: 2px;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 34px;
  line-height: 40px;
  letter-spacing: 2px;
  color: var(--cyan);
}

.tv-cd__colon {
  position: absolute;
  top: 510px;
  width: 16px;
  height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tv-cd__colon--1 { left: 251px; }
.tv-cd__colon--2 { left: 486px; }
.tv-cd__colon i {
  display: block;
  width: 15px;
  height: 15px;
  background: #d9f3ff;
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* ---------- Bottom ticker ---------- */
.tv-ticker-frame {
  position: absolute;
  left: 34px;
  top: 912px;
  z-index: 2;
  filter: drop-shadow(0 0 8px rgba(25, 195, 255, 0.4));
}
.tv-ticker-chev {
  position: absolute;
  left: 64px;
  top: 956px;
  z-index: 3;
  filter: drop-shadow(0 0 6px var(--cyan-glow));
}
.tv-ticker-label {
  position: absolute;
  left: 134px;
  top: 952px;
  z-index: 3;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 38px;
  line-height: 52px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  white-space: nowrap;
}
.tv-ticker-divider {
  position: absolute;
  left: 352px;
  top: 938px;
  width: 2px;
  height: 80px;
  z-index: 3;
  background: rgba(120, 160, 200, 0.45);
}

.tv-ticker-track {
  position: absolute;
  left: 380px;
  top: 933px;
  width: 1486px;
  height: 90px;
  z-index: 3;
  display: flex;
  gap: 26px;
  overflow: hidden;
}

.tv-chip {
  position: relative;
  flex: 0 0 226px;
  height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.tv-chip__frame {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.tv-chip__frame path {
  fill: rgba(9, 20, 36, 0.92);
  stroke: rgba(140, 170, 205, 0.55);
  stroke-width: 2;
}
.tv-chip.is-active .tv-chip__frame path {
  fill: #0b4f8a;
  stroke: var(--cyan);
}
.tv-chip.is-active { filter: drop-shadow(0 0 10px rgba(25, 195, 255, 0.45)); }

.tv-chip__round,
.tv-chip__name {
  position: relative;
  z-index: 1;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--cond);
  font-size: 28px;
  line-height: 33px;
  letter-spacing: 1px;
  color: #f2f5f9;
}
.tv-chip__round { font-weight: 500; }
.tv-chip__name { font-weight: 500; }

.tv-chip--empty {
  flex: 1 1 auto;
  align-items: flex-start;
  padding-left: 10px;
  font-size: 30px;
  color: #8fa3bd;
}

/* ---------- Click areas (desktop / wallpaper) ---------- */
.tv-hit {
  position: absolute;
  z-index: 20;
  display: block;
  border-radius: 18px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.tv-hit:hover,
.tv-hit:focus-visible {
  background-color: rgba(25, 195, 255, 0.05);
  box-shadow: 0 0 0 2px rgba(25, 195, 255, 0.35), 0 0 28px rgba(25, 195, 255, 0.25);
  outline: none;
}
.tv-hit--brand { left: 40px; top: 24px; width: 820px; height: 130px; }
.tv-hit--lb { left: 38px; top: 176px; width: 1003px; height: 700px; }
.tv-hit--race { left: 1088px; top: 202px; width: 780px; height: 676px; }

/* ---------- Help overlay (outside stage, real pixels) ---------- */
.tv-fab {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 18px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(25, 195, 255, 0.35);
  background: rgba(5, 12, 22, 0.9);
  color: var(--cyan);
  font: 700 18px/1 var(--cond);
  opacity: 0.35;
  cursor: pointer;
}
.tv-fab:hover, .tv-fab:focus { opacity: 1; outline: none; }
body.tv-kiosk .tv-fab { display: none; }

.tv-help {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 12, 0.82);
  backdrop-filter: blur(6px);
}
.tv-help[hidden] { display: none !important; }
.tv-help__card {
  width: min(92vw, 540px);
  padding: 24px;
  border: 1px solid rgba(25, 195, 255, 0.35);
  background: #0a1524;
  box-shadow: 0 0 36px rgba(25, 195, 255, 0.18);
  font-family: var(--cond);
  font-size: 18px;
}
.tv-help__card h2 {
  margin: 0 0 12px;
  font-size: 28px;
  letter-spacing: 1px;
  color: var(--cyan);
}
.tv-help__card ol { margin: 0; padding-left: 20px; line-height: 1.45; }
.tv-help__qr-wrap {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.tv-help__qr-wrap img {
  width: 140px;
  height: 140px;
  padding: 6px;
  background: #fff;
  border-radius: 4px;
}
.tv-help__qr-wrap p { margin: 0; max-width: 320px; color: #8fa3bd; line-height: 1.4; }
.tv-help__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tv-help__btn {
  border: 1px solid rgba(25, 195, 255, 0.35);
  background: rgba(25, 195, 255, 0.14);
  color: var(--cyan);
  font: 700 17px/1 var(--cond);
  padding: 10px 16px;
  cursor: pointer;
}
.tv-help__btn--ghost { background: transparent; color: #8fa3bd; }
