/* ============================================================
   UCC BROADCAST OVERLAY — base system + 3 theme directions
   Canvas: 1920 x 1080. Edge title-safe margin ~46px.
   ============================================================ */

:root {
  --safe: 46px;
  --ff-cond: "Saira Condensed", "Arial Narrow", sans-serif;
  --ff-ui:   "Saira", system-ui, sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05060a; overflow: hidden; }
body { font-family: var(--ff-ui); -webkit-font-smoothing: antialiased; }

/* ---- viewport scaler ---- */
#viewport {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 120% at 50% 0%, #0b0d12 0%, #050609 70%);
}
#stageScale { transform-origin: center center; }

.stage {
  position: relative;
  width: 1920px; height: 1080px;
  overflow: hidden;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  --accent:   #E51D24;
  --accent-2: #FF3A2F;
  --accent-blue: #2C66DE;
  --ink:      #F4F6FA;
  --ink-dim:  #9AA3B2;
  --ink-mut:  #5E6675;
  --panel:    rgba(9,11,15,.86);
  --panel-2:  rgba(16,19,26,.92);
  --stroke:   rgba(255,255,255,.10);
  --stroke-2: rgba(255,255,255,.06);
  --rad: 3px;
  --gap: 0px;
}

/* program feed placeholder behind graphics */
.feed { position: absolute; inset: 0; z-index: 0; }
.feed image-slot { width: 100%; height: 100%; display: block; }
.feed::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0,0,0,.32) 0%, transparent 14% 70%, rgba(0,0,0,.45) 100%);
}
.feed-fallback {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(115deg, #0a0c11 0 38px, #0c0f15 38px 76px);
  display: grid; place-items: center;
}
.feed-fallback span {
  font-family: var(--ff-ui); font-weight: 600; letter-spacing: .28em;
  font-size: 19px; color: rgba(255,255,255,.16); text-transform: uppercase;
}

.layer { position: absolute; z-index: 5; }
.hidden-sect { opacity: 0; pointer-events: none; transform: translateY(8px); }
.layer { transition: opacity .35s var(--ease), transform .35s var(--ease); }

/* shared helpers */
.eyebrow {
  font-family: var(--ff-ui); font-weight: 700; text-transform: uppercase;
  letter-spacing: .22em; font-size: 15px; color: var(--accent);
}
.tnum { font-variant-numeric: tabular-nums; }
.accent-bar { background: var(--accent); }

/* ============================================================
   BUG  (top-left event identity — wide logo lockup)
   ============================================================ */
.bug { top: var(--safe); left: var(--safe); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.bug-logo { width: 348px; height: 119px; flex: none; }
.bug-logo image-slot { width: 100%; height: 100%; display: block; }
.bug-sub {
  font-family: var(--ff-ui); font-weight: 600; font-size: 16px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim);
  display: flex; align-items: center; gap: 12px; white-space: nowrap; padding-left: 4px;
}
.live-dot {
  display: inline-flex; align-items: center; gap: 7px;
  color: #fff; font-weight: 700;
}
.live-dot i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 0 0 var(--accent-2);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,42,26,.6); }
  70% { box-shadow: 0 0 0 12px rgba(255,42,26,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,42,26,0); }
}

/* ============================================================
   RUN TELEMETRY  (top-center hero readout)
   ============================================================ */
.run { top: var(--safe); left: 50%; transform: translateX(-50%); width: 760px; }
.run.hidden-sect { transform: translateX(-50%) translateY(8px); }
.run-shell {
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: var(--rad); backdrop-filter: blur(14px);
  overflow: hidden;
}
.run-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px; border-bottom: 1px solid var(--stroke-2);
  background: linear-gradient(90deg, rgba(255,90,31,.16), transparent 60%);
}
.run-disc {
  font-family: var(--ff-cond); font-weight: 800; font-size: 22px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.run-disc b { color: var(--accent); }
.run-roundtag {
  font-family: var(--ff-ui); font-weight: 700; font-size: 13px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent-blue);
}
.run-body { display: flex; }
.run-stat {
  flex: 1; padding: 16px 18px 18px; position: relative;
}
.run-stat + .run-stat { border-left: 1px solid var(--stroke-2); }
.run-stat .k {
  font-family: var(--ff-ui); font-weight: 700; font-size: 13px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim);
}
.run-stat .v {
  font-family: var(--ff-cond); font-weight: 800; line-height: .9;
  font-size: 72px; margin-top: 4px; letter-spacing: -.01em;
}
.run-stat .u {
  font-family: var(--ff-ui); font-weight: 700; font-size: 18px;
  color: var(--ink-dim); margin-left: 6px;
}
.run-stat.lead .v { color: var(--accent); }
.run-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 18px; border-top: 1px solid var(--stroke-2);
  font-family: var(--ff-ui); font-size: 14px; color: var(--ink-dim);
}
.run-foot .nm { color: var(--ink); font-weight: 700; letter-spacing: .02em; }
.run-foot .no {
  margin-left: auto; font-family: var(--ff-cond); font-weight: 800;
  font-size: 24px; color: var(--accent);
}

/* ============================================================
   STANDINGS  (right column leaderboard, up to 20)
   ============================================================ */
.standings { top: 150px; right: var(--safe); width: 432px; max-height: 800px; }
.stand-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--accent); color: #0a0a0a;
  border-radius: var(--rad) var(--rad) 0 0;
}
.stand-title {
  font-family: var(--ff-cond); font-weight: 800; font-size: 24px;
  text-transform: uppercase; letter-spacing: .03em;
}
.stand-meta {
  font-family: var(--ff-ui); font-weight: 700; font-size: 13px;
  letter-spacing: .12em; text-transform: uppercase; opacity: .8;
}
.stand-list {
  background: var(--panel); border: 1px solid var(--stroke); border-top: none;
  border-radius: 0 0 var(--rad) var(--rad); backdrop-filter: blur(12px);
  overflow: hidden;
}
.srow {
  display: grid; grid-template-columns: 40px 38px 1fr auto;
  align-items: center; gap: 10px;
  padding: 0 14px; height: 34px;
  border-bottom: 1px solid var(--stroke-2);
  font-size: 15px;
}
.srow:last-child { border-bottom: none; }
.srow .pos {
  font-family: var(--ff-cond); font-weight: 800; font-size: 19px;
  color: var(--ink-dim); text-align: center;
}
.srow.t1 .pos, .srow.t2 .pos, .srow.t3 .pos { color: var(--accent); }
.srow .car {
  font-family: var(--ff-cond); font-weight: 700; font-size: 16px;
  color: var(--ink); text-align: center;
  background: rgba(255,255,255,.07); border-radius: 2px; padding: 1px 0;
}
.srow .nm {
  font-family: var(--ff-ui); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: .01em;
}
.srow .nm small { color: var(--ink-mut); font-weight: 600; margin-left: 7px; font-size: 12px; letter-spacing:.08em; text-transform:uppercase; }
.srow .pts {
  font-family: var(--ff-cond); font-weight: 800; font-size: 19px;
  color: var(--ink); text-align: right; min-width: 64px;
}
.srow.me { background: linear-gradient(90deg, rgba(255,90,31,.20), rgba(255,90,31,.04)); }
.srow.me .pts { color: var(--accent); }
.srow .delta { font-size: 11px; color: var(--ink-mut); font-weight: 700; margin-left: 6px; }
.srow .delta.up { color: #38d39f; }
.srow .delta.dn { color: #ff5a5a; }

/* ============================================================
   LOWER THIRD  (bottom-left)
   ============================================================ */
.lower { left: var(--safe); bottom: 118px; display: flex; align-items: stretch; }
.lt-num {
  width: 96px; display: grid; place-items: center;
  background: var(--accent); color: #0a0a0a;
  border-radius: var(--rad) 0 0 var(--rad);
  font-family: var(--ff-cond); font-weight: 800; font-size: 56px;
  line-height: 1;
}
.lt-body {
  background: var(--panel); border: 1px solid var(--stroke); border-left: none;
  border-radius: 0 var(--rad) var(--rad) 0; backdrop-filter: blur(14px);
  padding: 14px 30px 16px 24px; min-width: 480px;
}
.lt-tag {
  font-family: var(--ff-ui); font-weight: 700; font-size: 14px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--accent);
}
.lt-name {
  font-family: var(--ff-cond); font-weight: 800; font-size: 54px;
  line-height: .92; text-transform: uppercase; margin: 2px 0 4px;
}
.lt-meta {
  display: flex; align-items: center; gap: 14px; white-space: nowrap;
  font-family: var(--ff-ui); font-size: 18px; color: var(--ink-dim); font-weight: 600;
}
.lt-meta > span, .lt-meta > b { white-space: nowrap; }
.lt-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-mut); }
.lt-meta b { color: var(--ink); font-weight: 700; }

/* ============================================================
   UP NEXT  (above lower third / bottom-left stack)
   ============================================================ */
.upnext { left: var(--safe); bottom: 320px; width: 446px; }
.un-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--stroke);
  border-radius: var(--rad); padding: 10px 16px; backdrop-filter: blur(12px);
}
.un-label {
  font-family: var(--ff-ui); font-weight: 800; font-size: 13px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--accent-blue);
  padding-right: 12px; border-right: 1px solid var(--stroke); white-space: nowrap;
}
.un-name {
  font-family: var(--ff-cond); font-weight: 700; font-size: 24px; flex: 1; min-width: 0;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.un-no { margin-left: auto; font-family: var(--ff-cond); font-weight: 800; font-size: 24px; color: var(--accent); }

/* ============================================================
   TICKER  (bottom full-width marquee + sponsor cap)
   ============================================================ */
.ticker { left: 0; right: 0; bottom: 0; height: 60px; display: flex; z-index: 6; }
.tk-cap {
  flex: none; display: flex; align-items: center; gap: 12px;
  background: var(--accent); color: #0a0a0a; padding: 0 22px 0 var(--safe);
  font-family: var(--ff-cond); font-weight: 800; font-size: 23px;
  text-transform: uppercase; letter-spacing: .03em; position: relative; z-index: 2;
}
.tk-cap::after {
  content: ""; position: absolute; right: -18px; top: 0; bottom: 0; width: 36px;
  background: var(--accent); transform: skewX(-18deg); transform-origin: bottom;
}
.tk-track-wrap {
  flex: 1; overflow: hidden; background: var(--panel-2);
  border-top: 1px solid var(--stroke); display: flex; align-items: center;
}
.tk-track { display: inline-flex; align-items: center; white-space: nowrap; will-change: transform; animation: scroll-left linear infinite; }
.tk-item {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 0 30px; font-family: var(--ff-ui); font-size: 19px; font-weight: 600;
  color: var(--ink);
}
.tk-item .tag {
  font-family: var(--ff-ui); font-weight: 800; font-size: 13px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
}
.tk-item::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-mut); margin-left: 18px; }
@keyframes scroll-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* sponsor rotator (right cap of ticker) */
.tk-spon {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 var(--safe) 0 24px; background: var(--panel-2);
  border-top: 1px solid var(--stroke); border-left: 1px solid var(--stroke);
}
.tk-spon .sp-lab { font-family: var(--ff-ui); font-weight: 800; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); }
.sp-slot { width: 116px; height: 38px; border-radius: 3px; overflow: hidden; background: rgba(255,255,255,.05); }
.sp-slot image-slot { width: 100%; height: 100%; display: block; }

/* ============================================================
   INTERMISSION / COUNTDOWN  (full-screen)
   ============================================================ */
.intermission {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 90% at 50% 18%, rgba(255,90,31,.12), transparent 55%),
    linear-gradient(180deg, #07090d, #04050a);
  transition: opacity .45s var(--ease);
}
.im-inner { text-align: center; max-width: 1280px; padding: 0 60px; display: flex; flex-direction: column; align-items: center; }
.im-logo {
  width: 560px; height: 190px; margin: 0 auto 34px;
}
.im-logo image-slot { width: 100%; height: 100%; display: block; }
.im-eyebrow {
  font-family: var(--ff-ui); font-weight: 800; font-size: 20px;
  letter-spacing: .34em; text-transform: uppercase; color: var(--accent); white-space: nowrap;
}
.im-title {
  font-family: var(--ff-cond); font-weight: 800; font-size: 90px;
  line-height: .96; text-transform: uppercase; margin: 14px 0 10px; text-wrap: balance;
}
.im-sub { font-family: var(--ff-ui); font-size: 24px; color: var(--ink-dim); font-weight: 500; }
.im-clock {
  font-family: var(--ff-cond); font-weight: 800; font-size: 150px; line-height: 1;
  margin-top: 30px; letter-spacing: .02em; color: var(--ink);
}
.im-clock b { color: var(--accent); }
.im-clock .lab { display:block; font-family: var(--ff-ui); font-size: 18px; font-weight: 700; letter-spacing: .3em; color: var(--ink-dim); margin-top: 10px; }

/* ============================================================
   DRAG MATCHUP  (head-to-head lower third)
   ============================================================ */
.matchup {
  left: 50%; transform: translateX(-50%); bottom: 82px; width: 1680px;
  --lane-l: #E51D24; --lane-r: #2C66DE;
}
.matchup.hidden-sect { transform: translateX(-50%) translateY(8px); }

.mu-banner { display: flex; justify-content: center; position: relative; z-index: 2; }
.mu-banner span {
  font-family: var(--ff-cond); font-weight: 800; font-size: 22px; line-height: 1; white-space: nowrap;
  letter-spacing: .16em; text-transform: uppercase; color: #fff; padding: 8px 64px 7px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 26%, #ff4136 50%, var(--accent) 74%, transparent 100%);
}

.mu-bar {
  position: relative; display: flex; align-items: stretch; height: 132px;
  background: var(--panel); border: 1px solid var(--stroke); border-radius: var(--rad) var(--rad) 0 0;
  backdrop-filter: blur(14px);
}
.mu-side {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 20px; padding: 0 26px;
}
.mu-side.l { --lane: var(--lane-l); border-top: 3px solid var(--lane-l); }
.mu-side.r { --lane: var(--lane-r); border-top: 3px solid var(--lane-r); justify-content: flex-end; text-align: right; }
.mu-num {
  flex: none; min-width: 112px; height: 86px; padding: 0 12px;
  display: grid; place-items: center; border-radius: var(--rad);
  border: 2px solid var(--lane); background: rgba(255,255,255,.04); color: #fff;
  font-family: var(--ff-cond); font-weight: 800; font-size: 48px; line-height: 1; letter-spacing: .01em;
}
.mu-info { min-width: 0; }
.mu-name {
  font-family: var(--ff-cond); font-weight: 800; font-size: 43px; line-height: .95;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mu-meta {
  display: flex; align-items: center; gap: 12px; margin-top: 5px; white-space: nowrap;
  font-family: var(--ff-ui); font-size: 17px; color: var(--ink-dim); font-weight: 600;
}
.mu-side.r .mu-meta { justify-content: flex-end; }
.mu-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-mut); }

.mu-center {
  flex: none; width: 286px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 0 8px;
  border-left: 1px solid var(--stroke-2); border-right: 1px solid var(--stroke-2);
}
.mu-logo { width: 160px; height: 56px; }
.mu-logo image-slot { width: 100%; height: 100%; display: block; }
.mu-vs { display: flex; align-items: baseline; gap: 16px; }
.mu-vs b { font-family: var(--ff-cond); font-weight: 800; font-size: 26px; color: var(--ink); letter-spacing: .05em; }
.mu-vs .dial { font-family: var(--ff-cond); font-weight: 800; font-size: 23px; font-variant-numeric: tabular-nums; }
.mu-vs .dial.l { color: var(--lane-l); }
.mu-vs .dial.r { color: var(--lane-r); }

.mu-next {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 44px; background: var(--panel-2);
  border: 1px solid var(--stroke); border-top: 1px solid var(--stroke-2);
  border-radius: 0 0 var(--rad) var(--rad);
}
.mu-next-tag {
  justify-self: start; align-self: stretch; display: flex; align-items: center;
  background: var(--accent); color: #0a0a0a; white-space: nowrap;
  font-family: var(--ff-ui); font-weight: 800; font-size: 13px; letter-spacing: .16em;
  text-transform: uppercase; padding: 0 18px 0 26px; border-radius: 0 0 0 var(--rad);
}
.mu-next-pair {
  justify-self: center; display: flex; align-items: center; gap: 13px; white-space: nowrap;
  font-family: var(--ff-ui); font-weight: 700; font-size: 18px; color: var(--ink);
}
.mu-next-pair b {
  font-family: var(--ff-cond); font-weight: 800; color: var(--ink-dim);
  font-size: 15px; letter-spacing: .08em; padding: 0 2px;
}
.mu-next-pair .chip {
  font-family: var(--ff-cond); font-weight: 800; font-size: 17px; color: #fff;
  border: 1.5px solid; border-radius: 3px; padding: 1px 9px; line-height: 1.25;
}
.mu-next-pair .chip.l { border-color: var(--lane-l); }
.mu-next-pair .chip.r { border-color: var(--lane-r); }
.mu-next-class {
  justify-self: end; padding-right: 22px; white-space: nowrap;
  font-family: var(--ff-cond); font-weight: 800; font-size: 16px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-mut);
}

/* ============================================================
   THEME: APEX  (F1-style angled frosted glass) — default
   ============================================================ */
.stage[data-theme="apex"] .run-shell,
.stage[data-theme="apex"] .lt-body,
.stage[data-theme="apex"] .stand-list { clip-path: polygon(0 0, 100% 0, 100% 100%, 14px 100%); }
.stage[data-theme="apex"] .stand-head { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
.stage[data-theme="apex"] .lt-num { clip-path: polygon(0 0, 100% 0, 100% 100%, 18px 100%); }

/* ============================================================
   THEME: GRID  (NASCAR-style bold solid blocks)
   ============================================================ */
.stage[data-theme="grid"] {
  --accent: #E10600; --accent-2: #FF3A2F; --accent-blue: #2C66DE;
  --panel: rgba(7,8,11,.96); --panel-2: rgba(12,14,19,.98);
  --stroke: rgba(255,255,255,.14); --rad: 0px;
}
.stage[data-theme="grid"] .run-shell,
.stage[data-theme="grid"] .lt-body,
.stage[data-theme="grid"] .un-bar,
.stage[data-theme="grid"] .mu-bar,
.stage[data-theme="grid"] .stand-list { backdrop-filter: none; }
.stage[data-theme="grid"] .run-head { background: var(--accent); }
.stage[data-theme="grid"] .run-disc, .stage[data-theme="grid"] .run-roundtag { color: #0a0a0a; }
.stage[data-theme="grid"] .run-disc b { color: #0a0a0a; }
.stage[data-theme="grid"] .lt-name,
.stage[data-theme="grid"] .stand-title { letter-spacing: 0; }
.stage[data-theme="grid"] .lower { border-left: 4px solid var(--accent); }
.stage[data-theme="grid"] .tk-cap::after { display: none; }

/* ============================================================
   THEME: SLATE  (minimal hairline modern)
   ============================================================ */
.stage[data-theme="slate"] {
  --accent: #FF6A2C; --accent-2: #FF3B30; --accent-blue: #98A0AE;
  --panel: rgba(13,15,20,.66); --panel-2: rgba(18,21,28,.72);
  --stroke: rgba(255,255,255,.16); --rad: 12px;
  --ink-dim: #AEB6C4;
}
.stage[data-theme="slate"] .run-shell,
.stage[data-theme="slate"] .lt-body,
.stage[data-theme="slate"] .un-bar,
.stage[data-theme="slate"] .mu-bar,
.stage[data-theme="slate"] .stand-list { backdrop-filter: blur(20px); border-width: 1px; }
.stage[data-theme="slate"] .stand-head { background: transparent; color: var(--ink); border: 1px solid var(--stroke); border-bottom: none; }
.stage[data-theme="slate"] .stand-head { border-radius: var(--rad) var(--rad) 0 0; }
.stage[data-theme="slate"] .stand-meta { color: var(--accent); opacity: 1; }
.stage[data-theme="slate"] .lt-num {
  background: transparent; color: var(--accent);
  border: 1px solid var(--stroke); border-right: none;
}
.stage[data-theme="slate"] .tk-cap { background: transparent; color: var(--accent); border-top: 1px solid var(--stroke); border-right: 1px solid var(--stroke); }
.stage[data-theme="slate"] .tk-cap::after { display: none; }
.stage[data-theme="slate"] .lt-name { font-weight: 700; }
