/* Broadcast stage — a fixed 720×1280 frame shared by /watch (scaled to fit)
   and the Egress cast (full size). Sizes are in stage pixels.

   Egress renders in Chrome with no GPU: animate only transform/opacity,
   no backdrop-filter, no blur, no filters on video. Fonts are self-hosted
   (OFL, see fonts/) so the cast never waits on a third-party font CDN. */

@font-face {
  font-family: "Anton";
  src: url("fonts/anton-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: block;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-display: block;
}

.stage-viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.stage {
  --accent: #ff7a00;
  --ink: #0b0b0b;
  --letter: #d92d20;
  /* Result colors, as the apps' result sticker: landed green, bailed red
     (--letter), redo brand orange (--accent), missed gray. */
  --landed: #219e52;
  --missed: #6b6b6b;
  --glass: rgba(10, 10, 10, 0.72);
  /* Nothing of YouTube's / Instagram's covers the top or bottom, so the
     scoreboard and logo sit as close to the edges as on /watch; the cast
     keeps wider side insets. */
  --inset-top: 32px;
  --inset-bottom: 64px;
  --inset-x: 72px;

  position: absolute;
  left: 50%;
  top: 50%;
  width: 720px;
  height: 1280px;
  transform: translate(-50%, -50%) scale(var(--fit, 1));
  overflow: hidden;
  background: #0b0b0b;
  color: #fff;
  font-family: "Barlow Condensed", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* /watch has no platform UI over it, so the HUD can sit closer to the sides. */
.stage[data-mode="watch"] {
  --inset-x: 40px;
}

/* Egress: the browser viewport is the 720×1280 stage itself. */
.stage[data-fit="none"] {
  left: 0;
  top: 0;
  transform: none;
}

.stage [hidden] {
  display: none !important;
}

.stage p,
.stage h1,
.stage h2 {
  margin: 0;
}

/* ---------- Video ---------- */

.video-layer {
  position: absolute;
  inset: 0;
}

.tile {
  position: absolute;
  overflow: hidden;
  background: #161616;
}

.tile.off {
  display: none;
}

.tile.spot {
  inset: 0;
  z-index: 0;
}

/* Judge column (voting) and pre-roll lineup: video.js sets the box. Both
   sit above the scrims and dim so they stay bright. */
.tile.pip,
.tile.grid {
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  box-sizing: border-box;
  z-index: 2;
}

.tile.pip {
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
}

/* Pre-roll: the cameras fill the stage (lineup.js); a ready player gets an
   orange ring. The transparent border shows the stage behind, not the tile. */
.tile.grid {
  border: 4px solid transparent;
  border-radius: 16px;
  background-clip: padding-box;
  transition: border-color 0.25s ease;
}

.tile.grid.ready { border-color: var(--accent); }

.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile-ph {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.42);
}

.tile.no-video .tile-ph {
  display: flex;
}

.tile-ph-icon {
  width: 120px;
  height: 120px;
}

.tile.pip .tile-ph-icon {
  width: 56px;
  height: 56px;
}

.tile.grid .tile-ph-icon {
  width: 88px;
  height: 88px;
}

.tile-ph-text {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tile.pip .tile-ph-text,
.tile.grid .tile-ph-text {
  display: none;
}

/* Demo stand-in for a live camera. */
.tile.fake {
  background: linear-gradient(160deg, #3a3f47 0%, #1b1d21 55%, #2a2118 100%);
}

.tile.fake::after {
  content: attr(data-name);
  position: absolute;
  left: 0;
  right: 0;
  top: 46%;
  text-align: center;
  font-family: Anton, "Barlow Condensed", sans-serif;
  font-size: 140px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.07);
}

.tile.pip.fake::after {
  font-size: 44px;
  top: 38%;
}

.tile.grid.fake::after {
  font-size: 72px;
  top: 44%;
}

.tile-label {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 12px;
  background: rgba(10, 10, 10, 0.76);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile.pip .tile-label {
  display: block;
}

/* Pre-roll name pill in the tile's outer top corner (video.js), with a
   READY tag once the player is ready. */
.tile.grid .tile-label {
  display: flex;
  align-items: center;
  gap: 8px;
  top: var(--label-y);
  left: auto;
  right: auto;
  bottom: auto;
  max-width: calc(100% - var(--label-side) - 12px);
  padding: 5px 12px;
  border-radius: 999px;
  box-sizing: border-box;
  font-size: 20px;
}

.tile.grid[data-edge="bottom"] .tile-label { top: auto; bottom: var(--label-y); }
.tile.grid[data-corner="left"] .tile-label { left: var(--label-side); }
.tile.grid[data-corner="right"] .tile-label { right: var(--label-side); }

.tile.grid .tile-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-letters {
  display: flex;
  flex: none;
  gap: 2px;
}

.tile-letters span {
  width: 15px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.tile-letters span.lit {
  background: var(--letter);
  color: #fff;
}

.tile.grid.winner { border-color: var(--accent); }

.tile.grid.ready .tile-label::after {
  content: "Ready";
  flex: none;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.tile-badge {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tile.pip .tile-badge[data-tone="landed"],
.tile.pip .tile-badge[data-tone="bailed"],
.tile.pip .tile-badge[data-tone="redo"],
.tile.pip .tile-badge[data-tone="voting"] {
  display: block;
}

.tile-badge[data-tone="landed"] { background: var(--landed); color: #fff; }
.tile-badge[data-tone="bailed"] { background: var(--letter); color: #fff; }
.tile-badge[data-tone="redo"]   { background: var(--accent); color: var(--ink); }
.tile-badge[data-tone="voting"] { background: var(--glass); color: rgba(255, 255, 255, 0.86); }

/* ---------- Scrims + dim ---------- */

.scrim {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
}

.scrim-top {
  top: 0;
  height: 300px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0));
}

.scrim-bottom {
  bottom: 0;
  height: 240px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0));
}

/* Dims the spotlight behind text-heavy frames. Opacity only — cheap. */
.dim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.stage[data-status="preparation"] .dim  { opacity: 0.12; }
.stage[data-status="voting"] .dim       { opacity: 0.14; }
.stage[data-status="result"] .dim       { opacity: 0.22; }
.stage[data-status="final"] .dim        { opacity: 0.46; }

/* ---------- HUD layout ---------- */

.hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: var(--inset-top) var(--inset-x) var(--inset-bottom);
  box-sizing: border-box;
  pointer-events: none;
}

.hud a {
  pointer-events: auto;
}

/* Center text reads over bright video without darkening it: a tight
   shadow for the edges of the letters, a soft one around them, and a small
   dark pill behind the short lines. */
.hud-center,
.hud-bottom {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75), 0 2px 14px rgba(0, 0, 0, 0.55);
}

.upnext-mode,
.result-line,
.cta-sub {
  padding: 4px 14px;
  border-radius: 12px;
  background: rgba(10, 10, 10, 0.6);
}

.stamp,
.letter,
.cta-link {
  text-shadow: none;
}

.hud-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hud-center {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.stage[data-status="voting"] .hud-center {
  justify-content: flex-start;
  padding-top: 32px;
}

.hud-center > .frame {
  max-width: 100%;
}

.hud-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.frame-in {
  animation: frame-in 0.35s ease-out both;
}

@keyframes frame-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Scoreboard ---------- */

.scoreboard {
  align-self: stretch;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 10px;
}

.chip {
  position: relative;
  flex: 1 1 170px;
  max-width: 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 9px;
  border: 3px solid transparent;
  border-radius: 14px;
  background: var(--glass);
  box-sizing: border-box;
  transition: border-color 0.25s ease, opacity 0.25s ease;
}

.chip.active { border-color: var(--accent); }
.chip.out    { opacity: 0.5; }

.chip-tag {
  display: none;
  position: absolute;
  top: -13px;
  left: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chip.active .chip-tag { display: block; }

.chip-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.letters {
  display: flex;
  gap: 4px;
}

.letter {
  width: 24px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  font-weight: 800;
}

.letter.lit {
  background: var(--letter);
  color: #fff;
}

.letter.pop {
  animation: letter-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes letter-pop {
  0%   { transform: scale(0.4); }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ---------- Turn bar ---------- */

.turnbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.turnbar-pill {
  display: flex;
  align-items: stretch;
  max-width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(10, 10, 10, 0.76);
}

.turnbar-time {
  display: flex;
  align-items: center;
  padding: 3px 16px;
  background: var(--accent);
  color: var(--ink);
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.turnbar-text {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 3px 18px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.turnbar-text span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.turnbar-track {
  width: 440px;
  max-width: 100%;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.turnbar-fill {
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
}

/* ---------- Shared type ---------- */

.logo-mark {
  background: url("logo-white.png") center / contain no-repeat;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
}

.big-title {
  font-family: Anton, "Barlow Condensed", sans-serif;
  font-weight: 400;
  font-size: 124px;
  line-height: 0.92;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: pre-line;
  overflow-wrap: break-word;
}

/* ---------- Pre-roll ---------- */

/* The area the card centers in (stage.js): the grid's free cell, or the
   whole safe area with the card floating over the cameras. */
.preroll {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preroll-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 16px 28px 18px;
  border-radius: 22px;
  background: rgba(10, 10, 10, 0.72);
  box-sizing: border-box;
}

.preroll-card .eyebrow {
  gap: 8px;
  font-size: 18px;
  letter-spacing: 0.14em;
}

.preroll-card .eyebrow::before {
  width: 10px;
  height: 10px;
}

.preroll-title {
  font-size: 64px;
  white-space: nowrap;
}

.preroll-line {
  font-size: 22px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.86);
}

.preroll-card .logo-bar {
  gap: 12px;
  margin-top: 6px;
}

.preroll-card .logo-bar .logo-mark {
  width: 56px;
  height: 54px;
}

.preroll-card .logo-divider { height: 40px; }
.preroll-card .logo-url { font-size: 24px; }
.preroll-card .logo-tag { font-size: 12px; }

/* In the free cell there's no video behind: no card background and a
   bigger two-line title. */
.preroll[data-place="cell"] .preroll-card {
  gap: 12px;
  padding: 0;
  background: none;
}

.preroll[data-place="cell"] .preroll-title {
  font-size: 76px;
  white-space: pre-line;
}

.preroll[data-place="cell"] .logo-bar { margin-top: 16px; }

/* ---------- Get ready ---------- */

.upnext {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.upnext-name {
  max-width: 100%;
  font-family: Anton, "Barlow Condensed", sans-serif;
  font-size: 120px;
  line-height: 1;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upnext-mode {
  max-width: 100%;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ---------- Voting ---------- */

.vote-q {
  font-family: Anton, "Barlow Condensed", sans-serif;
  font-weight: 400;
  font-size: 84px;
  line-height: 1;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

/* ---------- Result ---------- */

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.stamp {
  padding: 2px 26px 6px;
  font-family: Anton, "Barlow Condensed", sans-serif;
  font-size: 104px;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transform: rotate(-4deg);
}

.stamp[data-tone="landed"] { background: var(--landed); color: #fff; }
.stamp[data-tone="bailed"] { background: var(--letter); color: #fff; }
.stamp[data-tone="redo"]   { background: var(--accent); color: var(--ink); }
.stamp[data-tone="missed"] { background: var(--missed); color: #fff; }

.stamp-in {
  animation: stamp-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes stamp-in {
  from { opacity: 0; transform: rotate(-4deg) scale(1.8); }
  to   { opacity: 1; transform: rotate(-4deg) scale(1); }
}

.result-line {
  margin-top: 10px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.big-letters {
  gap: 8px;
}

.big-letters .letter {
  width: 50px;
  height: 58px;
  border-radius: 10px;
  font-size: 36px;
}

/* Over bright video the result row needs its own backing, unlike the
   scoreboard's letters, which sit on the chip. */
.big-letters .letter:not(.lit) {
  background: rgba(10, 10, 10, 0.6);
  color: rgba(255, 255, 255, 0.55);
}

.letter.fresh {
  box-shadow: 0 0 0 3px #fff;
}

/* ---------- Game over ---------- */

.final {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.final-board {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  box-sizing: border-box;
}

/* Chatter view: the players' cameras fill the stage and the board is a
   small card in the free cell or the middle (stage.js), like the pre-roll's. */
.final[data-view="chatter"] {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  flex-direction: row;
  justify-content: center;
}

.final[data-view="chatter"][data-align="bottom"] { align-items: flex-end; }

.final[data-view="chatter"] .final-board {
  align-self: auto;
  gap: 6px;
  padding: 14px 28px 16px;
  border-radius: 22px;
  background: rgba(10, 10, 10, 0.72);
}

.final[data-view="chatter"] .trophy { width: 40px; height: 40px; }
.final[data-view="chatter"] .final-eyebrow { font-size: 20px; }
.final[data-view="chatter"] .final-title { max-width: 100%; white-space: nowrap; }
.final[data-view="chatter"] .standings { display: none; }

.trophy {
  width: 76px;
  height: 76px;
  color: var(--accent);
}

.final-eyebrow {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.final-title {
  font-size: 150px;
}

.standings {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 30px;
  padding: 0 24px;
}

.standing {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border: 3px solid transparent;
  border-radius: 16px;
  background: var(--glass);
}

.standing.winner { border-color: var(--accent); }

.final.crowded .trophy { width: 60px; height: 60px; }
.final.crowded .standings { gap: 8px; margin-top: 20px; }
.final.crowded .standing { padding: 8px 18px; }
.final.crowded .standing-place,
.final.crowded .standing-name { font-size: 28px; }

.standing-place {
  width: 34px;
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.standing-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.cta-sub {
  font-size: 24px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

/* Primary action on its own row, the two store links side by side under it. */
.cta-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 460px;
  max-width: 100%;
}

.cta-link.primary {
  grid-column: 1 / -1;
}

.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 0 26px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  background: rgba(10, 10, 10, 0.8);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.cta-link.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
}

.cta-link:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
}

/* ---------- Logo lockup ---------- */

.logo-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-bar .logo-mark {
  width: 88px;
  height: 86px;
}

.hud-bottom > .logo-bar {
  gap: 14px;
  padding: 8px 20px 8px 14px;
  border-radius: 18px;
  background: rgba(10, 10, 10, 0.55);
  text-shadow: none;
}

.hud-bottom > .logo-bar .logo-mark {
  width: 72px;
  height: 70px;
}

.hud-bottom > .logo-bar .logo-divider { height: 50px; }
.hud-bottom > .logo-bar .logo-url { font-size: 30px; }

.logo-divider {
  width: 2px;
  height: 58px;
  background: rgba(255, 255, 255, 0.4);
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.logo-url {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

.logo-tag {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

/* Web viewers who ask for less motion get none (the timer line still runs —
   it's information, not decoration); the cast always animates. */
@media (prefers-reduced-motion: reduce) {
  .stage[data-mode="watch"] *:not(.turnbar-fill),
  .stage[data-mode="watch"] *::before,
  .stage[data-mode="watch"] *::after {
    animation: none !important;
    transition: none !important;
  }
}
