/* ==========================================================================
   Home Alone Pop-Up Trivia - TV display (also the Google Cast receiver)
   --------------------------------------------------------------------------
   Builds on /static/shared/theme.css. Same compatibility rules as that file
   (Chrome 68-era engine on a Chromecast): no flex gap, no inset, no
   aspect-ratio, no clamp()/min()/max(), no backdrop-filter, animations on
   transform/opacity only.

   SIZING: the design canvas is 1280 x 720 "units". --tu is one unit, taken
   from the viewport so the canvas always fits (width-limited on 16:9 and
   taller windows, height-limited on wider ones). --u starts equal to --tu;
   a few containers rescale --u locally (crowded lobby, tall question card)
   and use --tu for the measurements that must not move.
   .tv-stage is the centred 16:9 canvas - exactly where the film picture is.
   ========================================================================== */

:root {
  --tu: calc(100vw / 1280);
  --u: calc(100vw / 1280);
}
@media (min-aspect-ratio: 16/9) {
  :root {
    --tu: calc(100vh / 720);
    --u: calc(100vh / 720);
  }
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body.tv {
  background: #000;
  cursor: none;
  -webkit-user-select: none;
  user-select: none;
}

.tv-root {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

/* the 16:9 design canvas, centred in whatever window we got */
.tv-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(1280 * var(--tu));
  height: calc(720 * var(--tu));
  margin: calc(-360 * var(--tu)) 0 0 calc(-640 * var(--tu));
}

/* full-bleed background layer (image, video or gradient) */
.tv-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   Screens: wait / lobby / menu / final. None active = the movie is showing.
   -------------------------------------------------------------------------- */
.tv-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow: hidden;
  z-index: 10;
  background-color: #0b1a2e;
  background-image: radial-gradient(ellipse 130% 80% at 50% 0%, #21467a 0%, #14305a 32%, #0b1a2e 68%, #060f1d 100%);
}
.tv-screen.is-active { display: block; }
.tv-screen.is-active.is-fadein { animation: ha-fade-in 0.6s ease-out both; }
/* the outgoing screen fades away on top of the incoming one */
.tv-screen.is-leaving {
  display: block;
  z-index: 11;
  animation: ha-fade-out 0.45s ease-in both;
}

.tv-snowhost {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 20;
}
/* credits squeeze: the film sits on the right, keep the flakes off it */
.tv-root.is-credits .tv-snowhost { right: 40%; }

/* --------------------------------------------------------------------------
   Waiting for a room
   -------------------------------------------------------------------------- */
.tv-wait__box {
  position: absolute;
  top: calc(70 * var(--u));
  left: 0;
  right: 0;
  bottom: calc(30 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.tv-wait__logo {
  width: calc(420 * var(--u));
  margin-bottom: calc(18 * var(--u));
  animation: ha-float 5s ease-in-out infinite;
}
.tv-wait__msg {
  max-width: calc(900 * var(--u));
  margin: calc(18 * var(--u)) 0 calc(22 * var(--u));
  font-size: calc(26 * var(--u));
  font-weight: 800;
  line-height: 1.3;
  color: var(--snow-dim);
}

/* --------------------------------------------------------------------------
   Lobby
   -------------------------------------------------------------------------- */
.tv-lobby__shade {
  background-image:
    linear-gradient(180deg, rgba(6, 15, 29, 0.86) 0%, rgba(11, 26, 46, 0.62) 42%, rgba(6, 15, 29, 0.93) 100%);
}

.tv-lobby__top {
  position: absolute;
  top: calc(70 * var(--u));
  left: calc(38 * var(--u));
  right: calc(38 * var(--u));
  height: calc(384 * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
}
.tv-lobby__logo {
  flex: none;
  width: calc(380 * var(--u));
  margin-right: calc(38 * var(--u));
  animation: ha-float 5s ease-in-out infinite;
}

/* the join panel: readable from the far end of the sofa */
.tv-join {
  flex: none;
  display: flex;
  align-items: center;
  width: calc(800 * var(--u));
  padding: calc(34 * var(--u)) calc(26 * var(--u)) calc(22 * var(--u));
  border-width: calc(4 * var(--u));
  border-color: var(--snow);
}
.tv-join__steps {
  flex: 1 1 auto;
  min-width: 0;
}
.tv-join__step {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-height: calc(54 * var(--u));
  font-size: calc(31 * var(--u));
  font-weight: 900;
  line-height: 1.1;
  text-shadow: var(--shadow-text);
}
/* step numbers are little baubles */
.tv-join__num {
  flex: none;
  width: calc(42 * var(--u));
  height: calc(42 * var(--u));
  margin-right: calc(14 * var(--u));
  border: calc(3 * var(--u)) solid var(--snow);
  border-radius: 50%;
  background-color: var(--ans-0);
  background-image: radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0) 45%);
  color: #fff;
  font-family: var(--font-display);
  font-size: calc(25 * var(--u));
  font-weight: 400;
  line-height: calc(36 * var(--u));
  text-align: center;
  text-shadow: 0 calc(2 * var(--u)) 0 rgba(0, 0, 0, 0.28);
  box-shadow: 0 calc(3 * var(--u)) 0 rgba(0, 0, 0, 0.35);
}
.tv-join__num[data-n="2"] { background-color: var(--ans-1); }
.tv-join__num[data-n="3"] { background-color: var(--gold-dark); }
.tv-join__label { flex: none; }
.tv-join__host {
  flex: none;
  margin-left: 0.3em;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: calc(40 * var(--u));
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.1;
  white-space: nowrap;
  text-shadow: 0 calc(3 * var(--u)) 0 rgba(0, 0, 0, 0.4);
}
/* a long address gets a line to itself under "Go to" */
.tv-join__step.is-long .tv-join__host {
  flex: 0 0 100%;
  margin: calc(2 * var(--u)) 0 calc(6 * var(--u)) calc(56 * var(--u));
}
.tv-join__code {
  margin: calc(8 * var(--u)) 0 0 calc(2 * var(--u));
  font-size: calc(80 * var(--u));
}
.tv-join__code .ha-code__tile { animation: tv-tile-in 0.6s var(--ease-spring) both; }
.tv-join__code .ha-code__tile:nth-child(2) { animation-delay: 0.08s; }
.tv-join__code .ha-code__tile:nth-child(3) { animation-delay: 0.16s; }
.tv-join__code .ha-code__tile:nth-child(4) { animation-delay: 0.24s; }
.tv-join__qr {
  flex: none;
  width: calc(216 * var(--u));
  margin-left: calc(22 * var(--u));
  text-align: center;
}
.tv-join__qr img {
  width: 100%;
  height: auto;
  border: calc(7 * var(--u)) solid #fff;
  border-radius: calc(20 * var(--u));
  background: #fff;
  box-shadow: 0 calc(6 * var(--u)) 0 rgba(0, 0, 0, 0.35);
  image-rendering: pixelated;
}
.tv-join__qr span {
  display: block;
  margin-top: calc(12 * var(--u));
  font-size: calc(17 * var(--u));
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ice);
}

@keyframes tv-tile-in {
  0% { opacity: 0; margin-top: calc(-40 * var(--u)); }
  60% { opacity: 1; }
  100% { opacity: 1; margin-top: 0; }
}

.tv-lobby__bottom {
  position: absolute;
  top: calc(466 * var(--u));
  left: calc(50 * var(--u));
  right: calc(50 * var(--u));
  bottom: calc(18 * var(--u));
}
.tv-lobby__status {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(46 * var(--u));
  font-size: calc(25 * var(--u));
  font-weight: 900;
  text-shadow: var(--shadow-text);
}
.tv-lobby__status .ha-chip { margin-right: calc(16 * var(--u)); }
.tv-lobby__status .ha-dots { margin-left: calc(8 * var(--u)); }
.tv-lobby__empty {
  font-family: var(--font-display);
  font-size: calc(40 * var(--u));
  font-weight: 400;
  color: var(--gold);
  text-shadow: 0 calc(3 * var(--u)) 0 #b0721a, 0 calc(7 * var(--u)) 0 rgba(0, 0, 0, 0.35);
  animation: ha-pulse 1.6s ease-in-out infinite;
}

/* players arrive as gift tags; data-tier shrinks them as the room fills up */
.tv-players {
  --pw: 264;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  margin-top: calc(10 * var(--tu));
}
.tv-players[data-tier="b"] { --u: calc(var(--tu) * 0.86); --pw: 212; }
.tv-players[data-tier="c"] { --u: calc(var(--tu) * 0.76); --pw: 176; }
.tv-players[data-tier="d"] { --u: calc(var(--tu) * 0.7); --pw: 176; }
.tv-player {
  position: relative;
  flex: none;
  width: calc(var(--pw) * var(--tu));
  margin: calc(8 * var(--u)) calc(9 * var(--tu)) calc(10 * var(--u));
}
.tv-player .ha-tag { display: flex; width: 100%; }
.tv-player.is-new { animation: tv-tag-in 0.65s var(--ease-spring) both; }
.tv-player.is-off { opacity: 0.55; }
.tv-player__crown {
  position: absolute;
  top: calc(-22 * var(--u));
  right: calc(-10 * var(--u));
  display: none;
  width: calc(44 * var(--u));
  height: calc(44 * var(--u));
  transform: rotate(14deg);
}
.tv-player__crown svg { width: 100%; height: 100%; }
.tv-player.is-host .tv-player__crown { display: block; }

@keyframes tv-tag-in {
  0% { transform: scale(0.2) rotate(-14deg); opacity: 0; }
  55% { transform: scale(1.14) rotate(4deg); opacity: 1; }
  78% { transform: scale(0.96) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* --------------------------------------------------------------------------
   DVD-style menu
   -------------------------------------------------------------------------- */
.tv-menu__shade {
  background-image:
    linear-gradient(90deg, rgba(6, 15, 29, 0.78) 0%, rgba(6, 15, 29, 0.35) 55%, rgba(6, 15, 29, 0.6) 100%),
    linear-gradient(180deg, rgba(6, 15, 29, 0.55) 0%, rgba(6, 15, 29, 0.15) 40%, rgba(6, 15, 29, 0.85) 100%);
}

.tv-menu__page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-out, transform 0.45s cubic-bezier(0.2, 0.8, 0.3, 1), visibility 0s linear 0.45s;
}
.tv-menu__page--main { transform: translate3d(-5%, 0, 0); }
.tv-menu__page--scenes { transform: translate3d(5%, 0, 0); overflow: hidden; }
.tv-menu__page.is-active {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
  transition-delay: 0s;
}

.tv-menu__logo {
  position: absolute;
  top: calc(250 * var(--u));
  left: calc(84 * var(--u));
  width: calc(560 * var(--u));
}
.tv-menu__label {
  position: absolute;
  top: calc(246 * var(--u));
  left: calc(696 * var(--u));
  font-size: calc(18 * var(--u));
  font-weight: 900;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ice);
  text-shadow: var(--shadow-text);
}
.tv-menu__opts {
  position: absolute;
  top: calc(288 * var(--u));
  left: calc(680 * var(--u));
  width: calc(540 * var(--u));
}
.tv-menu__opt {
  position: relative;
  display: flex;
  align-items: center;
  height: calc(96 * var(--u));
  margin-bottom: calc(22 * var(--u));
  padding: 0 calc(30 * var(--u));
  border: calc(4 * var(--u)) solid transparent;
  border-radius: calc(26 * var(--u));
  color: var(--snow);
  font-family: var(--font-display);
  font-size: calc(50 * var(--u));
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-shadow: 0 calc(4 * var(--u)) 0 rgba(0, 0, 0, 0.5);
  opacity: 0.8;
  transition: transform 0.3s var(--ease-spring), opacity 0.2s;
}
.tv-menu__opt-icon {
  flex: none;
  width: calc(46 * var(--u));
  height: calc(46 * var(--u));
  margin-right: calc(18 * var(--u));
}
.tv-menu__opt-icon svg { width: 100%; height: 100%; }
.tv-menu__opt.is-sel {
  opacity: 1;
  border-color: var(--snow);
  background-color: var(--red-bright);
  background-image: linear-gradient(180deg, #f0505c 0%, #c8102e 100%);
  box-shadow:
    inset 0 calc(4 * var(--u)) 0 rgba(255, 255, 255, 0.3),
    0 calc(9 * var(--u)) 0 var(--red-dark),
    0 calc(20 * var(--u)) calc(30 * var(--u)) rgba(0, 0, 0, 0.45);
  transform: translate3d(calc(16 * var(--u)), 0, 0) scale(1.04);
}
/* the host picked it: a quick flash before the page changes */
.tv-menu__opt.is-go { animation: tv-opt-go 0.5s ease-out both; }
@keyframes tv-opt-go {
  0% { transform: translate3d(calc(16 * var(--u)), 0, 0) scale(1.04); }
  35% { transform: translate3d(calc(16 * var(--u)), 0, 0) scale(1.14); }
  100% { transform: translate3d(calc(16 * var(--u)), 0, 0) scale(1.04); }
}
/* classic animated selector: a swinging ornament that hops between options */
.tv-menu__cursor {
  position: absolute;
  top: 0;
  left: calc(-92 * var(--u));
  width: calc(78 * var(--u));
  height: calc(96 * var(--u));
  transition: transform 0.3s var(--ease-spring);
}
.tv-menu__cursor svg {
  width: calc(78 * var(--u));
  height: calc(78 * var(--u));
  margin-top: calc(6 * var(--u));
  transform-origin: 50% 0;
  animation: ha-swing 1.8s ease-in-out infinite;
}
.tv-menu__opts[data-sel="1"] .tv-menu__cursor { transform: translate3d(0, calc(118 * var(--u)), 0); }

.tv-menu__host {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(14 * var(--u));
  text-align: center;
  font-size: calc(21 * var(--u));
  font-weight: 900;
  color: var(--snow);
}
.tv-menu__host span {
  display: inline-flex;
  align-items: center;
  padding: calc(8 * var(--u)) calc(20 * var(--u));
  border: calc(3 * var(--u)) solid rgba(255, 253, 247, 0.45);
  border-radius: 999px;
  background: #10213a;
  box-shadow: 0 calc(4 * var(--u)) 0 rgba(0, 0, 0, 0.35);
}
.tv-menu__host svg {
  width: calc(26 * var(--u));
  height: calc(26 * var(--u));
  margin-right: calc(10 * var(--u));
}
.tv-menu__host b { margin-right: 0.3em; color: var(--gold); }

/* ---- scene selection: 3 x 2 thumbnails that slide page to page ---- */
.tv-scenes__head {
  position: absolute;
  top: calc(64 * var(--u));
  left: 0;
  right: 0;
  text-align: center;
  font-size: calc(46 * var(--u));
}
.tv-scenes__view {
  position: absolute;
  top: calc(134 * var(--u));
  left: calc(150 * var(--u));
  width: calc(980 * var(--u));
  height: calc(486 * var(--u));
}
.tv-scenes__grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-column-gap: calc(40 * var(--u));
  grid-row-gap: calc(20 * var(--u));
  column-gap: calc(40 * var(--u));
  row-gap: calc(20 * var(--u));
  transition: transform 0.5s cubic-bezier(0.25, 0.9, 0.3, 1), opacity 0.4s ease-out;
}
.tv-scenes__grid.is-from-right { transform: translate3d(125%, 0, 0); opacity: 0; transition: none; }
.tv-scenes__grid.is-from-left { transform: translate3d(-125%, 0, 0); opacity: 0; transition: none; }
.tv-scenes__grid.is-to-left { transform: translate3d(-125%, 0, 0); opacity: 0; }
.tv-scenes__grid.is-to-right { transform: translate3d(125%, 0, 0); opacity: 0; }
.tv-scenes__none {
  grid-column: 1 / 4;
  padding-top: calc(150 * var(--u));
  text-align: center;
  font-size: calc(28 * var(--u));
  color: var(--snow-dim);
}

.tv-scene { min-width: 0; }
.tv-scene__thumb {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 56.25%;
  border-radius: calc(16 * var(--u));
  background: #14294a;
  box-shadow:
    0 0 0 calc(4 * var(--u)) var(--snow),
    0 calc(8 * var(--u)) 0 calc(4 * var(--u)) rgba(6, 15, 29, 0.6);
  overflow: hidden;
}
.tv-scene__thumb img,
.tv-scene__fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.tv-scene__thumb img { max-width: none; object-fit: cover; }
/* shown when a thumbnail is missing: a wrapped-gift tile */
.tv-scene__fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1a7a4c;
  background-image: linear-gradient(135deg, #1a7a4c 0%, #0f5132 55%, #14294a 100%);
}
.tv-scene__fallback svg { width: calc(72 * var(--u)); height: calc(72 * var(--u)); }
.tv-scene__num {
  position: absolute;
  top: calc(8 * var(--u));
  left: calc(8 * var(--u));
  min-width: calc(40 * var(--u));
  height: calc(40 * var(--u));
  padding: 0 calc(6 * var(--u));
  border: calc(3 * var(--u)) solid var(--snow);
  border-radius: 999px;
  background: var(--red-bright);
  color: #fff;
  font-family: var(--font-display);
  font-size: calc(22 * var(--u));
  font-weight: 400;
  line-height: calc(34 * var(--u));
  text-align: center;
  box-shadow: 0 calc(3 * var(--u)) 0 rgba(0, 0, 0, 0.35);
}
.tv-scene__time {
  position: absolute;
  right: calc(8 * var(--u));
  bottom: calc(8 * var(--u));
  padding: calc(2 * var(--u)) calc(8 * var(--u));
  border-radius: calc(8 * var(--u));
  background: rgba(6, 15, 29, 0.82);
  font-size: calc(14 * var(--u));
  font-weight: 900;
  line-height: 1.3;
}
.tv-scene__title {
  height: 2.2em;
  margin-top: calc(12 * var(--u));
  overflow: hidden;
  font-family: var(--font-display);
  font-size: calc(21 * var(--u));
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 calc(2 * var(--u)) 0 rgba(0, 0, 0, 0.5);
}
.tv-scene.is-picked .tv-scene__thumb {
  box-shadow:
    0 0 0 calc(4 * var(--u)) var(--snow),
    0 0 0 calc(10 * var(--u)) var(--gold),
    0 calc(8 * var(--u)) 0 calc(10 * var(--u)) rgba(6, 15, 29, 0.6);
}
.tv-scene.is-picked { animation: ha-pulse 0.5s ease-in-out both; }

.tv-scenes__foot {
  position: absolute;
  top: calc(624 * var(--u));
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(20 * var(--u));
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow: var(--shadow-text);
}
.tv-scenes__pips { display: flex; align-items: center; margin-left: calc(16 * var(--u)); }
.tv-scenes__pips i {
  display: block;
  width: calc(12 * var(--u));
  height: calc(12 * var(--u));
  margin: 0 calc(4 * var(--u));
  border-radius: 50%;
  background: rgba(255, 253, 247, 0.3);
}
.tv-scenes__pips i.is-on { background: var(--gold); box-shadow: 0 0 0 calc(3 * var(--u)) rgba(255, 209, 102, 0.3); }

/* --------------------------------------------------------------------------
   The movie and its overlay
   -------------------------------------------------------------------------- */
.tv-movie {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 1;
  transform-origin: 50% 50%;
  transition: transform 1.3s cubic-bezier(0.3, 0, 0.2, 1);
}
.tv-movie__video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  background: #000;
}
/* end credits: the film squeezes to the right while final scores take the left */
.tv-movie.is-squeezed {
  z-index: 30;
  transform: translate3d(30%, 0, 0) scale(0.37);
  box-shadow: 0 0 0 calc(14 * var(--tu)) var(--snow), 0 calc(40 * var(--tu)) calc(70 * var(--tu)) rgba(0, 0, 0, 0.6);
}

.tv-overlay {
  overflow: hidden;
  pointer-events: none;
}

.tv-movie__error {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  width: calc(700 * var(--tu));
  margin: calc(-120 * var(--tu)) 0 0 calc(-350 * var(--tu));
  text-align: center;
  z-index: 40;
}
.tv-movie__error.is-on { display: block; animation: ha-pop-in 0.4s var(--ease-spring) both; }
.tv-movie__error-icon {
  width: calc(84 * var(--u));
  height: calc(84 * var(--u));
  margin: 0 auto calc(10 * var(--u));
}
.tv-movie__error-icon svg { width: 100%; height: 100%; }
.tv-movie__error p { margin-top: calc(12 * var(--u)); font-size: calc(20 * var(--u)); }
.tv-movie__error b { color: var(--gold); }

/* ---- room-code watermark (top right, on the letterbox bar) ---- */
.tv-water {
  position: absolute;
  top: calc(10 * var(--u));
  right: calc(16 * var(--u));
  display: flex;
  align-items: center;
  padding: calc(5 * var(--u)) calc(14 * var(--u));
  border: calc(3 * var(--u)) solid transparent;
  border-radius: 999px;
  background: rgba(6, 15, 29, 0.6);
  color: var(--snow);
  font-size: calc(15 * var(--u));
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.9s ease-out;
  z-index: 5;
}
.tv-water b {
  margin-left: 0.4em;
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.03em;
}
.tv-water i {
  margin-left: 0.5em;
  font-style: normal;
  opacity: 0.6;
}
.tv-water.is-on { opacity: 0.5; }
/* paused: latecomers can still get in, so it turns into a proper join card */
.tv-water.is-paused {
  padding: calc(8 * var(--u)) calc(18 * var(--u));
  border-color: var(--snow);
  background: #10213a;
  font-size: calc(21 * var(--u));
  opacity: 1;
  box-shadow: 0 calc(5 * var(--u)) 0 rgba(0, 0, 0, 0.4);
  transition-duration: 0.25s;
}
.tv-water.is-paused .tv-water__code { font-size: 1.25em; letter-spacing: 0.12em; }

.tv-paused {
  position: absolute;
  top: calc(12 * var(--u));
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(210 * var(--u));
  height: calc(50 * var(--u));
  margin-left: calc(-105 * var(--u));
  border: calc(4 * var(--u)) solid var(--snow);
  border-radius: 999px;
  background: #10213a;
  color: var(--snow);
  font-family: var(--font-display);
  font-size: calc(25 * var(--u));
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 calc(5 * var(--u)) 0 rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translate3d(0, -160%, 0);
  transition: transform 0.35s var(--ease-spring), opacity 0.2s;
  z-index: 6;
}
.tv-paused svg {
  width: calc(24 * var(--u));
  height: calc(24 * var(--u));
  margin-right: calc(10 * var(--u));
  color: var(--gold);
}
.tv-paused.is-on { opacity: 1; transform: translate3d(0, 0, 0); }

.tv-buffer {
  position: absolute;
  left: 50%;
  bottom: calc(22 * var(--u));
  display: none;
  align-items: center;
  width: calc(280 * var(--u));
  margin-left: calc(-140 * var(--u));
  padding: calc(8 * var(--u)) calc(18 * var(--u));
  border-radius: 999px;
  background: rgba(6, 15, 29, 0.8);
  font-size: calc(17 * var(--u));
  font-weight: 900;
  justify-content: center;
  z-index: 6;
}
.tv-buffer.is-on { display: flex; }
.tv-buffer .ha-dots { margin-right: calc(10 * var(--u)); }

/* ---- pop-up fact bubbles ----
   One wrapper per bubble spans a band (top or bottom) of the picture and
   aligns the bubble left / centre / right, so the bubble itself keeps its
   transform free for the pop animation. One bubble per band, and the bands
   never meet, so two bubbles cannot overlap.                               */
.tv-bubs {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
}
.tv-bub {
  position: absolute;
  left: calc(64 * var(--tu));
  right: calc(46 * var(--tu));
  display: flex;
}
.tv-bub--t { top: calc(74 * var(--tu)); align-items: flex-start; }
.tv-bub--b { bottom: calc(58 * var(--tu)); align-items: flex-end; }
.tv-bub--l { justify-content: flex-start; }
.tv-bub--c { justify-content: center; }
.tv-bub--r { justify-content: flex-end; }
.tv-bub .ha-bubble {
  flex: 0 1 auto;
  max-width: calc(780 * var(--tu));
}

/* ---- question card (lower left) ----
   --qs lets tv.js shrink everything inside until the card fits its box.   */
.tv-q {
  --qs: 1;
  --u: calc(var(--tu) * var(--qs));
  position: absolute;
  left: calc(28 * var(--tu));
  bottom: calc(26 * var(--tu));
  width: calc(600 * var(--tu));
  opacity: 0;
  transform: translate3d(-112%, 0, 0);
  z-index: 30;
}
.tv-q.is-in { animation: tv-q-in 0.6s var(--ease-spring) both; }
.tv-q.is-out { animation: tv-q-out 0.4s ease-in both; }
@keyframes tv-q-in {
  0% { transform: translate3d(-112%, 0, 0) rotate(-4deg); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
}
@keyframes tv-q-out {
  0% { transform: translate3d(0, 0, 0); opacity: 1; }
  100% { transform: translate3d(-112%, 0, 0) rotate(-3deg); opacity: 0; }
}
.tv-q__card {
  position: relative;
  padding: calc(32 * var(--u)) calc(20 * var(--u)) calc(16 * var(--u));
  border: calc(4 * var(--u)) solid var(--snow);
  border-radius: calc(26 * var(--u));
  background-color: #10213a;
  background-image: linear-gradient(180deg, #1d3a66 0%, #10213a 100%);
  box-shadow:
    0 0 0 calc(3 * var(--u)) rgba(6, 15, 29, 0.72),
    0 calc(9 * var(--u)) 0 calc(3 * var(--u)) rgba(6, 15, 29, 0.72),
    0 calc(22 * var(--u)) calc(30 * var(--u)) rgba(0, 0, 0, 0.5);
}
.tv-q__ribbon {
  position: absolute;
  top: calc(-24 * var(--u));
  left: calc(20 * var(--u));
  padding: calc(5 * var(--u)) calc(18 * var(--u)) calc(6 * var(--u));
  border: calc(3 * var(--u)) solid var(--snow);
  border-radius: calc(12 * var(--u));
  background: var(--red-bright);
  color: #fff;
  font-family: var(--font-display);
  font-size: calc(20 * var(--u));
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 0 calc(2 * var(--u)) 0 rgba(0, 0, 0, 0.28);
  box-shadow: 0 calc(4 * var(--u)) 0 var(--red-dark);
  transform: rotate(-3deg);
  z-index: 3;
}
.tv-q__text {
  margin-bottom: calc(16 * var(--u));
  font-size: calc(26 * var(--u));
  font-weight: 900;
  line-height: 1.18;
  text-shadow: var(--shadow-text);
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.tv-q .ha-answers {
  grid-column-gap: calc(14 * var(--u));
  grid-row-gap: calc(17 * var(--u));
  column-gap: calc(14 * var(--u));
  row-gap: calc(17 * var(--u));
}
.tv-q .ha-answer {
  min-height: calc(56 * var(--u));
  padding: calc(6 * var(--u)) calc(12 * var(--u)) calc(6 * var(--u)) calc(10 * var(--u));
  border-radius: calc(18 * var(--u));
  font-size: calc(19 * var(--u));
  cursor: default;
}
.tv-q .ha-answer__chip {
  width: calc(36 * var(--u));
  height: calc(36 * var(--u));
  margin: calc(5 * var(--u)) calc(10 * var(--u)) 0 0;
  font-size: calc(21 * var(--u));
  line-height: calc(36 * var(--u));
}
.tv-q .ha-answer__meta { font-size: calc(21 * var(--u)); }
.tv-q .ha-answer__meta > .ha-icon { width: calc(26 * var(--u)); height: calc(26 * var(--u)); margin-left: calc(4 * var(--u)); }

.tv-q__timer {
  display: flex;
  align-items: center;
  margin-top: calc(18 * var(--u));
}
.tv-q__timer .ha-candy { flex: 1 1 auto; }
/* glide between the server's ticks (about two a second) */
.tv-q__timer .ha-candy__fill { transition: width 0.5s linear; }
.tv-q__secs {
  flex: none;
  width: calc(58 * var(--u));
  margin-left: calc(10 * var(--u));
  color: var(--gold);
  font-family: var(--font-display);
  font-size: calc(32 * var(--u));
  font-weight: 400;
  line-height: 1;
  text-align: right;
  text-shadow: 0 calc(3 * var(--u)) 0 rgba(0, 0, 0, 0.35);
}
.tv-q.is-paused .tv-q__secs { color: var(--ice); }
.tv-q__progress {
  display: flex;
  align-items: center;
  min-height: calc(22 * var(--u));
  margin-top: calc(10 * var(--u));
  font-size: calc(16 * var(--u));
  font-weight: 900;
  color: var(--snow-dim);
}
.tv-q__dots { display: flex; flex-wrap: wrap; align-items: center; margin-right: calc(8 * var(--u)); }
.tv-q__dots i {
  display: block;
  width: calc(14 * var(--u));
  height: calc(14 * var(--u));
  margin-right: calc(5 * var(--u));
  border: calc(2 * var(--u)) solid rgba(255, 253, 247, 0.45);
  border-radius: 50%;
}
.tv-q__dots i.is-on {
  border-color: var(--snow);
  background: var(--gold);
  animation: ha-pop-in 0.35s var(--ease-spring) both;
}
.tv-q__state {
  margin-left: auto;
  color: var(--ice);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  visibility: hidden;
}
.tv-q.is-paused .tv-q__state { visibility: visible; }

.tv-q__result { display: none; margin-top: calc(16 * var(--u)); }
.tv-q.is-revealed .tv-q__timer,
.tv-q.is-revealed .tv-q__progress { display: none; }
.tv-q.is-revealed .tv-q__result { display: block; animation: ha-fade-in 0.35s ease-out both; }
.tv-q__nailed {
  display: flex;
  align-items: flex-start;
  color: var(--gold);
  font-size: calc(20 * var(--u));
  font-weight: 900;
  line-height: 1.2;
}
.tv-q__nailed svg {
  flex: none;
  width: calc(26 * var(--u));
  height: calc(26 * var(--u));
  margin: calc(-2 * var(--u)) calc(8 * var(--u)) 0 0;
}
.tv-q__nailed.is-nobody { color: var(--ice); }
.tv-q__explain {
  margin-top: calc(6 * var(--u));
  font-size: calc(17 * var(--u));
  font-weight: 800;
  line-height: 1.25;
}

/* ---- mini leaderboard (right edge) ---- */
.tv-lb {
  position: absolute;
  top: calc(150 * var(--tu));
  right: calc(24 * var(--tu));
  width: calc(330 * var(--tu));
  opacity: 0;
  transform: translate3d(118%, 0, 0);
  z-index: 25;
}
.tv-lb.is-in { animation: tv-lb-in 0.6s var(--ease-spring) both; }
.tv-lb.is-out { animation: tv-lb-out 0.4s ease-in both; }
@keyframes tv-lb-in {
  0% { transform: translate3d(118%, 0, 0); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate3d(0, 0, 0); opacity: 1; }
}
@keyframes tv-lb-out {
  0% { transform: translate3d(0, 0, 0); opacity: 1; }
  100% { transform: translate3d(118%, 0, 0); opacity: 0; }
}
.tv-lb__card {
  position: relative;
  padding: calc(30 * var(--u)) calc(14 * var(--u)) calc(14 * var(--u));
  border: calc(4 * var(--u)) solid var(--snow);
  border-radius: calc(24 * var(--u));
  background-color: #0f5132;
  background-image: linear-gradient(180deg, #1a7a4c 0%, #0f5132 100%);
  box-shadow:
    0 0 0 calc(3 * var(--u)) rgba(6, 15, 29, 0.72),
    0 calc(9 * var(--u)) 0 calc(3 * var(--u)) rgba(6, 15, 29, 0.72),
    0 calc(22 * var(--u)) calc(30 * var(--u)) rgba(0, 0, 0, 0.5);
}
.tv-lb__kicker {
  font-size: calc(13 * var(--u));
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
  color: #bff5d6;
}
.tv-lb__title {
  max-height: 2.2em;
  margin: calc(2 * var(--u)) 0 calc(8 * var(--u));
  overflow: hidden;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: calc(25 * var(--u));
  font-weight: 400;
  line-height: 1.1;
  text-shadow: 0 calc(2 * var(--u)) 0 rgba(0, 0, 0, 0.35);
}
.tv-lb__row {
  display: flex;
  align-items: center;
  height: calc(46 * var(--u));
  margin-top: calc(6 * var(--u));
  padding: 0 calc(8 * var(--u)) 0 calc(6 * var(--u));
  border-radius: calc(14 * var(--u));
  background: rgba(6, 15, 29, 0.38);
  animation: tv-row-in 0.45s var(--ease-out) both;
}
.tv-lb__row:nth-child(2) { animation-delay: 0.08s; }
.tv-lb__row:nth-child(3) { animation-delay: 0.16s; }
.tv-lb__row:nth-child(4) { animation-delay: 0.24s; }
.tv-lb__row:nth-child(5) { animation-delay: 0.32s; }
.tv-lb__row .ha-avatar { margin-left: calc(6 * var(--u)); }
.tv-lb__name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 calc(8 * var(--u));
  overflow: hidden;
  font-size: calc(19 * var(--u));
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-lb__score {
  flex: none;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: calc(21 * var(--u));
  font-weight: 400;
}
/* rank change since the board was last shown */
.tv-lb__move {
  flex: none;
  width: 0;
  height: 0;
  margin-right: calc(7 * var(--u));
  border-left: calc(7 * var(--u)) solid transparent;
  border-right: calc(7 * var(--u)) solid transparent;
}
.tv-lb__move--up { border-bottom: calc(11 * var(--u)) solid #5df0a4; }
.tv-lb__move--down { border-top: calc(11 * var(--u)) solid #ff8a94; }
.tv-lb__move--same {
  width: calc(12 * var(--u));
  height: calc(4 * var(--u));
  border: 0;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.4);
}
@keyframes tv-row-in {
  from { transform: translate3d(30%, 0, 0); opacity: 0; }
  to { transform: translate3d(0, 0, 0); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Final scores
   -------------------------------------------------------------------------- */
.tv-final {
  background-color: #0b1a2e;
  background-image: radial-gradient(ellipse 110% 85% at 30% 0%, #8e1a2d 0%, #4a1230 34%, #0b1a2e 72%, #060f1d 100%);
}
.tv-final__main {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: calc(720 * var(--tu));
  margin-top: calc(-360 * var(--tu));
  padding: calc(62 * var(--tu)) calc(30 * var(--tu)) 0;
  text-align: center;
}
.tv-final.is-credits .tv-final__main { width: 60%; }
.tv-final__title { animation: ha-drop 0.7s var(--ease-spring) both; }
.tv-final__sub {
  height: calc(24 * var(--u));
  margin-top: calc(6 * var(--u));
  font-size: calc(18 * var(--u));
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: calc(24 * var(--u));
  text-transform: uppercase;
  color: var(--ice);
}

/* podium: 2nd | 1st | 3rd, revealed one by one */
.tv-podium {
  --u: var(--tu);
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: calc(306 * var(--tu));
}
/* three players or fewer: nothing below the podium, so it can be bigger */
.tv-final.is-roomy .tv-podium { --u: calc(var(--tu) * 1.15); height: calc(352 * var(--tu)); }
.tv-final.is-credits.is-roomy .tv-podium { --u: calc(var(--tu) * 1.05); height: calc(324 * var(--tu)); }
/* a long standings list: the podium gives up some room */
.tv-final.is-crowded .tv-podium { --u: calc(var(--tu) * 0.84); height: calc(258 * var(--tu)); }
.tv-pod {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: calc(206 * var(--u));
  margin: 0 calc(7 * var(--u));
  visibility: hidden;
}
.tv-pod--1 { order: 2; }
.tv-pod--2 { order: 1; }
.tv-pod--3 { order: 3; }
.tv-pod.is-in { visibility: visible; animation: tv-pod-in 0.7s var(--ease-spring) both; }
@keyframes tv-pod-in {
  0% { transform: translate3d(0, 40%, 0) scale(0.5); opacity: 0; }
  55% { opacity: 1; }
  100% { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
}
.tv-pod__crown {
  width: calc(44 * var(--u));
  height: calc(44 * var(--u));
  margin-bottom: calc(-12 * var(--u));
  transform: rotate(-8deg);
  z-index: 1;
}
.tv-pod__crown svg { width: 100%; height: 100%; }
.tv-pod.is-in .tv-pod__crown { animation: ha-drop 0.6s 0.35s var(--ease-spring) both; }
.tv-pod__name {
  max-width: 100%;
  margin-top: calc(6 * var(--u));
  overflow: hidden;
  font-family: var(--font-display);
  font-size: calc(25 * var(--u));
  font-weight: 400;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 calc(3 * var(--u)) 0 rgba(0, 0, 0, 0.4);
}
.tv-pod--1 .tv-pod__name { font-size: calc(30 * var(--u)); color: var(--gold); }
.tv-pod__score {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: calc(22 * var(--u));
  font-weight: 400;
  line-height: 1.2;
  color: var(--snow);
}
.tv-pod__score .ha-chip { margin-left: calc(8 * var(--u)); }
.tv-pod__block {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  height: calc(44 * var(--u));
  margin-top: calc(8 * var(--u));
  padding-top: calc(6 * var(--u));
  border: calc(4 * var(--u)) solid var(--snow);
  border-bottom: 0;
  border-radius: calc(18 * var(--u)) calc(18 * var(--u)) 0 0;
  background-color: var(--ans-3-dark);
  background-image: linear-gradient(180deg, #6fcdf7 0%, #2484b8 100%);
}
.tv-pod--2 .tv-pod__block {
  height: calc(62 * var(--u));
  background-color: var(--ans-1-dark);
  background-image: linear-gradient(180deg, #25b56b 0%, #0c5a31 100%);
}
.tv-pod--1 .tv-pod__block {
  height: calc(84 * var(--u));
  background-color: var(--red);
  background-image: linear-gradient(180deg, #f0505c 0%, #9c0f25 100%);
}
.tv-pod__block .ha-medal { width: calc(34 * var(--u)); height: calc(34 * var(--u)); border-width: calc(3 * var(--u)); font-size: calc(19 * var(--u)); }
.tv-podium__nobody {
  align-self: center;
  max-width: calc(620 * var(--u));
  font-size: calc(28 * var(--u));
  font-weight: 900;
  line-height: 1.3;
  opacity: 0;
}
.tv-podium__nobody.is-in { animation: ha-pop-in 0.5s var(--ease-spring) both; }
.tv-podium__nobody svg { display: block; width: calc(96 * var(--u)); height: calc(96 * var(--u)); margin: 0 auto calc(12 * var(--u)); }

/* everyone below the podium; tv.js sets --cols / --rows / --rowh to fit */
.tv-standings {
  --cols: 2;
  --rows: 4;
  --rowh: 34;
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), calc(var(--rowh) * var(--tu)));
  grid-column-gap: calc(12 * var(--tu));
  grid-row-gap: calc(5 * var(--tu));
  column-gap: calc(12 * var(--tu));
  row-gap: calc(5 * var(--tu));
  max-width: calc(1040 * var(--tu));
  margin: calc(12 * var(--tu)) auto 0;
  opacity: 0;
  transform: translate3d(0, calc(30 * var(--tu)), 0);
  transition: opacity 0.5s ease-out, transform 0.6s var(--ease-out);
}
.tv-standings.is-in { opacity: 1; transform: translate3d(0, 0, 0); }
.tv-standings[data-cols="1"] { max-width: calc(460 * var(--tu)); }
.tv-st__row {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 0.6em 0 0.3em;
  border-radius: 0.6em;
  background: rgba(6, 15, 29, 0.5);
  font-size: calc(var(--rowh) * 0.52 * var(--tu));
  font-weight: 900;
  line-height: 1;
  text-align: left;
}
.tv-st__row.is-off { opacity: 0.6; }
.tv-st__rank {
  flex: none;
  width: 1.7em;
  color: var(--ice);
  font-family: var(--font-display);
  font-weight: 400;
  text-align: center;
}
.tv-st__avatar {
  flex: none;
  width: 1.5em;
  height: 1.5em;
  margin-right: 0.45em;
  padding: 0.14em;
  border-radius: 50%;
  background: #d9f0ff;
}
.tv-st__avatar svg { width: 100%; height: 100%; }
.tv-st__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-st__streak {
  flex: none;
  display: flex;
  align-items: center;
  margin-left: 0.4em;
  color: #ffb26b;
}
.tv-st__streak svg { width: 1.1em; height: 1.1em; margin-right: 0.1em; }
.tv-st__score {
  flex: none;
  margin-left: 0.6em;
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 400;
}

.tv-final__signoff {
  position: absolute;
  left: calc(20 * var(--tu));
  right: calc(20 * var(--tu));
  bottom: calc(20 * var(--tu));
  font-size: calc(21 * var(--u));
  font-weight: 900;
  line-height: 1.25;
  text-shadow: var(--shadow-text);
  opacity: 0;
  transition: opacity 0.8s ease-out;
}
.tv-final__signoff.is-in { opacity: 1; }
.tv-final__signoff b { color: var(--gold); }
.tv-final__signoff small {
  display: block;
  margin-top: calc(3 * var(--u));
  font-size: calc(15 * var(--u));
  color: var(--snow-dim);
}

/* right-hand column around the squeezed film (credits mode only) */
.tv-final__side {
  position: absolute;
  top: 50%;
  left: 61.5%;
  display: none;
  width: 37%;
  height: calc(720 * var(--tu));
  margin-top: calc(-360 * var(--tu));
  text-align: center;
}
.tv-final.is-credits .tv-final__side { display: block; }
.tv-final__side-logo {
  width: calc(330 * var(--tu));
  margin: calc(84 * var(--tu)) auto 0;
}
.tv-final__side-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(118 * var(--tu));
  font-size: calc(19 * var(--u));
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--ice);
}

/* --------------------------------------------------------------------------
   Connection pill and the "click to start" gate
   -------------------------------------------------------------------------- */
.tv-net {
  position: absolute;
  left: calc(18 * var(--tu));
  bottom: calc(16 * var(--tu));
  display: none;
  align-items: center;
  padding: calc(7 * var(--u)) calc(16 * var(--u));
  border: calc(3 * var(--u)) solid var(--gold);
  border-radius: 999px;
  background: #10213a;
  font-size: calc(16 * var(--u));
  font-weight: 900;
  z-index: 40;
}
.tv-net.is-on { display: flex; }
.tv-net .ha-dots { margin-right: calc(8 * var(--u)); }

.tv-gate {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  background-color: #0b1a2e;
  background-image: radial-gradient(ellipse 120% 80% at 50% 0%, #21467a 0%, #14305a 32%, #0b1a2e 68%, #060f1d 100%);
  cursor: pointer;
  outline: none;
  z-index: 600;
}
.tv-gate.is-on { display: block; animation: ha-fade-in 0.3s ease-out both; }
.tv-gate__box {
  position: absolute;
  top: calc(60 * var(--u));
  left: 0;
  right: 0;
  bottom: calc(30 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.tv-gate__logo { width: calc(400 * var(--u)); margin-bottom: calc(26 * var(--u)); }
.tv-gate__btn {
  display: flex;
  align-items: center;
  padding: calc(20 * var(--u)) calc(44 * var(--u));
  border: calc(5 * var(--u)) solid var(--snow);
  border-radius: calc(34 * var(--u));
  background-color: var(--red-bright);
  background-image: linear-gradient(180deg, #f0505c 0%, #c8102e 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: calc(48 * var(--u));
  font-weight: 400;
  line-height: 1.1;
  text-shadow: 0 calc(3 * var(--u)) 0 rgba(0, 0, 0, 0.3);
  box-shadow: 0 calc(10 * var(--u)) 0 var(--red-dark), 0 calc(24 * var(--u)) calc(36 * var(--u)) rgba(0, 0, 0, 0.45);
  animation: ha-pulse 1.3s ease-in-out infinite;
}
.tv-gate__btn-icon {
  width: calc(44 * var(--u));
  height: calc(44 * var(--u));
  margin-right: calc(18 * var(--u));
}
.tv-gate__btn-icon svg { width: 100%; height: 100%; }
.tv-gate__hint {
  margin-top: calc(34 * var(--u));
  font-size: calc(22 * var(--u));
  font-weight: 800;
  color: var(--snow-dim);
}

/* --------------------------------------------------------------------------
   Calm mode (?calm=1, or the OS asks for reduced motion)
   -------------------------------------------------------------------------- */
.ha-calm .tv-lobby__logo,
.ha-calm .tv-wait__logo,
.ha-calm .tv-lobby__empty,
.ha-calm .tv-menu__cursor svg,
.ha-calm .tv-gate__btn { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .tv-lobby__logo,
  .tv-wait__logo,
  .tv-lobby__empty,
  .tv-menu__cursor svg,
  .tv-gate__btn { animation: none !important; }
  .tv-movie { transition-duration: 0.01s; }
}

/* ==========================================================================
   Cue editor (?edit=1 on the PC that runs the server)
   --------------------------------------------------------------------------
   A desktop tool: the film sits top-left at 70% width with native controls,
   the transcript below it, the editor panel down the right. Sized in real
   pixels (--u: 1px inside the panel); modern-Chrome CSS is fine here.
   ========================================================================== */
.ed,
.ed-below { display: none; }

body.is-edit {
  cursor: auto;
  background: #070f1c;
}
body.is-edit .tv-root { background: #070f1c; }
body.is-edit .tv-movie {
  --tu: calc(70vw / 1280);
  --u: calc(70vw / 1280);
  width: 70vw;
  height: 39.375vw;
}
/* very wide windows: keep the transcript strip visible under the film */
@media (min-aspect-ratio: 2/1) {
  body.is-edit .tv-movie {
    --tu: calc(78vh / 720);
    --u: calc(78vh / 720);
    width: calc(78vh * 16 / 9);
    height: 78vh;
  }
}
body.is-edit .tv-snowhost,
body.is-edit .tv-screen,
body.is-edit .tv-net { display: none !important; }

body.is-edit .ed {
  --u: 1px;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 30vw;
  min-width: 0;
  border-left: 2px solid #24406d;
  background: #0d1a2e;
  color: var(--snow);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  -webkit-user-select: text;
  user-select: text;
  z-index: 50;
}
body.is-edit .ed-below {
  --u: 1px;
  position: absolute;
  top: 39.375vw;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 70vw;
  background: #0a1424;
  border-top: 2px solid #24406d;
  color: var(--snow);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  -webkit-user-select: text;
  user-select: text;
  z-index: 50;
}
@media (min-aspect-ratio: 2/1) {
  body.is-edit .ed-below { top: 78vh; }
  body.is-edit .ed { width: calc(100vw - 78vh * 16 / 9); }
  body.is-edit .ed-below { width: calc(78vh * 16 / 9); }
}

.ed button,
.ed-below button { font-family: var(--font-body); }

.ed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #3a5a8f;
  border-radius: 7px;
  background: #1b3358;
  color: var(--snow);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.ed-btn:hover { background: #25447a; }
.ed-btn:active { transform: translateY(1px); }
.ed-btn:disabled { opacity: 0.5; cursor: default; }
.ed-btn svg { width: 15px; height: 15px; margin-right: 5px; }
.ed-btn.is-on { border-color: var(--gold); background: #4a3a10; color: var(--gold); }
.ed-btn--mini { height: 22px; padding: 0 7px; border-radius: 6px; font-size: 11px; }
.ed-btn--gold { border-color: #c98a10; background: var(--gold); color: #33210a; }
.ed-btn--gold:hover { background: #ffdd8a; }
.ed-btn--fact { border-color: #c98a10; color: var(--gold); }
.ed-btn--q { border-color: #2484b8; color: #9be0ff; }
.ed-btn--danger { border-color: #9c0f25; color: #ff9aa3; }
.ed-btn--danger:hover { background: #4a0f1b; }

.ed__head {
  flex: none;
  display: flex;
  align-items: center;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #1f3558;
}
.ed__title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  white-space: nowrap;
}
.ed__dirty {
  display: none;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #5c2a00;
  color: #ffb26b;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}
.ed.is-dirty .ed__dirty { display: inline-block; }
.ed__counts { flex: none; margin-right: 10px; color: var(--snow-dim); font-size: 11px; }

.ed__clock {
  flex: none;
  display: flex;
  align-items: baseline;
  padding: 8px 12px 0;
}
.ed__time {
  flex: none;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.ed__where {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 12px;
  overflow: hidden;
  color: var(--snow-dim);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed__where b { color: var(--snow); }

.ed__transport {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 8px 10px 0;
}
.ed__transport .ed-btn { margin: 0 2px 4px; padding: 0 7px; }
.ed__transport .ed-btn--play { min-width: 74px; }
.ed__transport-gap { flex: 1 1 auto; }

/* scrubber: the whole film, with a tick for every cue */
.ed__scrub {
  flex: none;
  position: relative;
  height: 46px;
  margin: 6px 12px 0;
  cursor: pointer;
  touch-action: none;
}
.ed__scrub-track {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  height: 22px;
  border: 1px solid #3a5a8f;
  border-radius: 6px;
  background: #08142a;
  overflow: hidden;
}
.ed__scrub-played {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0;
  background: rgba(255, 253, 247, 0.1);
}
.ed-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
}
.ed-tick.is-fact { top: 50%; background: var(--gold); }
.ed-tick.is-question { bottom: 50%; background: #6fcdf7; }
.ed-tick.is-warn { background: #ff5263; top: 0; bottom: 0; }
.ed-tick--credits {
  width: auto;
  right: 0;
  margin: 0;
  background-image: repeating-linear-gradient(135deg, rgba(230, 57, 70, 0.4) 0, rgba(230, 57, 70, 0.4) 4px, transparent 4px, transparent 8px);
}
/* chapter marks sit above the track */
.ed-chap {
  position: absolute;
  top: 2px;
  width: 0;
  height: 0;
  margin-left: -4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 8px solid var(--snow);
}
.ed__scrub-head {
  position: absolute;
  top: 6px;
  left: 0;
  width: 2px;
  height: 34px;
  margin-left: -1px;
  background: #ff5263;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.ed__scrub-head::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5263;
}
.ed__legend {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--snow-dim);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.ed__legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 0 4px 0 10px;
  border-radius: 2px;
}
.ed__legend i:first-child { margin-left: 0; }

.ed__actions {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 8px 10px 6px;
  border-bottom: 1px solid #1f3558;
}
.ed__actions .ed-btn { margin: 0 2px 4px; }
.ed__follow {
  display: inline-flex;
  align-items: center;
  margin: 0 6px 4px;
  color: var(--snow-dim);
  font-size: 11px;
  cursor: pointer;
}
.ed__follow input { margin: 0 4px 0 0; }

.ed__list {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ed-empty { padding: 30px 16px; color: var(--snow-dim); text-align: center; }

.ed-row { border-bottom: 1px solid #172a47; border-left: 4px solid transparent; }
.ed-row.is-fact { border-left-color: #c98a10; }
.ed-row.is-question { border-left-color: #2484b8; }
.ed-row.is-cur { background: #14294a; }
.ed-row.is-open { background: #112240; border-bottom-color: #3a5a8f; }
.ed-row__head {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 3px 8px 3px 6px;
  cursor: pointer;
}
.ed-row__head:hover { background: rgba(255, 253, 247, 0.05); }
.ed-row__time {
  flex: none;
  width: 62px;
  color: var(--snow);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.ed-row__type {
  flex: none;
  width: 34px;
  margin-right: 7px;
  padding: 2px 0;
  border-radius: 5px;
  background: #5c4406;
  color: var(--gold);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}
.ed-row.is-question .ed-row__type { background: #0f3e5a; color: #9be0ff; }
.ed-row__text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--snow);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed-row__text:empty::before { content: "(no text yet)"; color: var(--snow-dim); font-style: italic; }
.ed-row__verify {
  flex: none;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #3a2a55;
  color: #d5b8ff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ed-row__flag {
  flex: none;
  display: none;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border-radius: 50%;
  background: #ff5263;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 17px;
  text-align: center;
}
.ed-row.is-warn .ed-row__flag { display: block; }
.ed-row__head .ed-btn { flex: none; margin-left: 6px; }

.ed-row__body { padding: 4px 10px 12px; }
.ed-tools { display: flex; flex-wrap: wrap; align-items: center; }
.ed-tools .ed-btn { margin: 0 4px 4px 0; }
.ed-tools__sep { flex: none; width: 6px; }
.ed-warns { margin: 2px 0 6px; }
.ed-warns li {
  margin-top: 3px;
  padding: 4px 8px;
  border-left: 3px solid #ff5263;
  border-radius: 4px;
  background: #3a121b;
  color: #ffc2c8;
  font-size: 11px;
}

.ed-form {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -4px;
}
.ed-f {
  display: block;
  flex: 1 1 30%;
  min-width: 90px;
  margin: 4px;
}
.ed-f--wide { flex: 1 1 100%; }
.ed-f > span,
.ed-f__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 3px;
  color: var(--ice);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ed-f em { color: var(--snow-dim); font-style: normal; letter-spacing: 0; text-transform: none; }
.ed-f input[type="text"],
.ed-f input[type="number"],
.ed-f select,
.ed-f textarea,
.ed-choice input[type="text"] {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #3a5a8f;
  border-radius: 6px;
  background: #08142a;
  color: var(--snow);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  outline: none;
}
.ed-f textarea { resize: vertical; min-height: 44px; }
.ed-f input:focus,
.ed-f select:focus,
.ed-f textarea:focus,
.ed-choice input[type="text"]:focus { border-color: var(--gold); }
.ed-f input[readonly] { color: var(--snow-dim); background: #0d1a2e; }

/* where the bubble sits: a little 3 x 2 map of the screen */
.ed-pos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 3px;
  gap: 3px;
  padding: 4px;
  border: 1px solid #3a5a8f;
  border-radius: 6px;
  background: #000;
}
.ed-pos button {
  height: 22px;
  padding: 0;
  border: 1px solid #2a4370;
  border-radius: 4px;
  background: #14294a;
  color: var(--snow-dim);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}
.ed-pos button:hover { background: #25447a; }
.ed-pos button.is-on { border-color: #c98a10; background: var(--gold); color: #33210a; }
.ed-pos__auto { grid-column: 1 / 4; }

.ed-icon { display: flex; align-items: center; }
.ed-icon__prev {
  flex: none;
  width: 30px;
  height: 30px;
  margin-right: 6px;
  padding: 3px;
  border-radius: 50%;
  background: #d9f0ff;
}
.ed-icon__prev svg { width: 100%; height: 100%; }

.ed-choice { display: flex; align-items: center; margin-top: 4px; }
.ed-choice input[type="radio"] { flex: none; margin: 0 6px 0 0; }
.ed-choice b {
  flex: none;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--ans-0);
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}
.ed-choice[data-i="1"] b { background: var(--ans-1); }
.ed-choice[data-i="2"] b { background: var(--ans-2); color: #33210a; }
.ed-choice[data-i="3"] b { background: var(--ans-3); color: #06283d; }
.ed-check {
  display: flex;
  align-items: center;
  flex: 1 1 100%;
  margin: 6px 4px 0;
  color: var(--snow);
  font-size: 12px;
  cursor: pointer;
}
.ed-check input { margin: 0 6px 0 0; }

.ed__status {
  flex: none;
  min-height: 26px;
  padding: 5px 12px;
  border-top: 1px solid #1f3558;
  color: var(--snow-dim);
  font-size: 11px;
}
.ed__status.is-good { color: #5df0a4; }
.ed__status.is-bad { color: #ff9aa3; }

/* ---- transcript strip under the film ---- */
.ed-below__bar {
  flex: none;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid #1f3558;
}
.ed-below__title { font-family: var(--font-display); font-size: 15px; font-weight: 400; margin-right: 10px; }
.ed-below__hint {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--snow-dim);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed-below__hint kbd {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid #3a5a8f;
  border-radius: 4px;
  background: #14294a;
  color: var(--snow);
  font-family: var(--font-body);
  font-size: 10px;
}
.ed-tr {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ed-below.is-collapsed .ed-tr { display: none; }
.ed-tr__line {
  display: flex;
  align-items: baseline;
  padding: 3px 10px;
  border-left: 4px solid transparent;
  cursor: pointer;
}
.ed-tr__line:hover { background: rgba(255, 253, 247, 0.06); }
.ed-tr__line.is-cur { border-left-color: var(--snow-dim); background: #14294a; }
.ed-tr__line.is-cur.is-speaking { border-left-color: var(--gold); }
.ed-tr__line .ed-btn { flex: none; align-self: center; margin-right: 8px; visibility: hidden; }
.ed-tr__line:hover .ed-btn,
.ed-tr__line.is-cur .ed-btn { visibility: visible; }
.ed-tr__time {
  flex: none;
  width: 70px;
  color: var(--snow-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.ed-tr__text { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 700; }
.ed-tr__line.is-cur .ed-tr__text { color: var(--gold); }

/* ---- score tally after a question ---- */
.tv-lb.is-tally .tv-lb__row { animation: none; transition: transform 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.15); position: relative; }
.tv-lb__gain {
  margin-left: auto; margin-right: calc(10 * var(--u)); padding: 0 calc(8 * var(--u));
  border-radius: calc(20 * var(--u)); background: #1a7a4c; color: #fffdf7;
  font-weight: 900; font-size: calc(20 * var(--u)); white-space: nowrap;
}
.tv-lb.is-tally .tv-lb__gain + .tv-lb__score { margin-left: 0; }
.tv-lb__row.is-leader { z-index: 2; animation: tv-leader 1.4s ease-out; box-shadow: 0 0 0 calc(3 * var(--u)) #fce20c, 0 0 calc(26 * var(--u)) rgba(252, 226, 12, 0.7); }
@keyframes tv-leader {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
