/* The TV view is designed for a 16:9 screen; sizes scale with the viewport. */
body.tv {
  overflow: hidden;
  font-size: 1.6vh;
}

#stage {
  position: fixed;
  inset: 0 0 11vh 0;
  z-index: 1;
}
body.fullbleed #stage { inset: 0; z-index: 5; }
body.fullbleed .scorebar, body.fullbleed .room-chip { display: none; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  opacity: 0;
}
.screen.active {
  display: flex;
  animation: fade-in 0.45s ease forwards;
}
@keyframes fade-in { to { opacity: 1; } }

/* ---------- Lobby ---------- */
#screen-lobby {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vh;
}
.lobby-hero { text-align: center; }
.lobby-hero .logo { font-size: 15vh; }
.tagline { font-size: 3.2vh; margin: 1vh 0 0; color: var(--gold-soft); }
.lobby-join {
  display: flex;
  align-items: center;
  gap: 4vw;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 207, 74, 0.5);
  border-radius: 3vh;
  padding: 3vh 4vw;
}
.qr-card {
  background: #fff;
  padding: 1.2vh;
  border-radius: 2vh;
  box-shadow: 0 0 0 0.6vh var(--red);
}
.qr-card img { width: 26vh; height: 26vh; display: block; }
.join-text p { margin: 0.5vh 0; font-size: 2.8vh; }
.join-url { color: var(--gold); font-weight: 700; font-size: 3.2vh !important; }
.room-code {
  font-family: var(--font-display);
  font-size: 12vh !important;
  font-weight: 900;
  letter-spacing: 0.25em;
  color: var(--snow);
  text-shadow: 0 0.5vh 0 var(--red-dark);
  line-height: 1;
}
.status { color: var(--gold-soft); opacity: 0.85; }
.lobby-teams { display: flex; gap: 1.5vw; flex-wrap: wrap; justify-content: center; }
.lobby-teams span {
  background: var(--red);
  border-radius: 99px;
  padding: 1vh 2vw;
  font-size: 2.6vh;
  font-weight: 700;
}

/* ---------- Video / placeholder ---------- */
.player {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.player.has-video video { display: block; }
.video-bg {
  object-fit: cover;
  filter: blur(40px) brightness(0.55) saturate(1.3);
  transform: scale(1.15);
}
.video-fg { object-fit: contain; }
/* Native 16:9 videos fill the screen; other ratios get the blurred backdrop. */
.player.widescreen .video-bg { display: none !important; }
.player.widescreen .video-fg { object-fit: cover; }

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5vw;
  padding: 6vh 7vw;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 207, 74, 0.25), transparent 50%),
    linear-gradient(135deg, var(--red-dark), #3b0610 50%, var(--green-dark));
}
.player.has-video .placeholder { display: none; }
.ph-photo {
  height: 62vh;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3vh;
  border: 0.8vh solid var(--gold);
  box-shadow: 0 2vh 6vh rgba(0, 0, 0, 0.6);
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-1.2vh) rotate(-1deg); } }
.ph-text { max-width: 55vw; }
.ph-text h2 {
  font-family: var(--font-display);
  font-size: 7vh;
  margin: 0 0 3vh;
  color: var(--gold);
  text-shadow: 0 0.5vh 0 rgba(0, 0, 0, 0.4);
}
.ph-text p { font-size: 4.2vh; line-height: 1.35; margin: 0; font-style: italic; }
.ph-badge {
  position: absolute;
  top: 4vh;
  left: 4vw;
  background: var(--gold);
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.2em;
  padding: 1vh 2vw;
  border-radius: 1vh;
  font-size: 2.4vh;
}
.ph-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1vh;
  background: rgba(255, 255, 255, 0.15);
}
#ph-bar { height: 100%; width: 0; background: var(--gold); }
.corner-tag {
  position: absolute;
  top: 3vh;
  right: 3vw;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid var(--gold);
  color: var(--gold);
  padding: 0.8vh 1.6vw;
  border-radius: 1vh;
  font-weight: 900;
  letter-spacing: 0.2em;
  font-size: 2.2vh;
  display: none;
}
#screen-video.is-commercial .player.has-video ~ .corner-tag { display: block; }

/* ---------- Board ---------- */
#screen-board { padding: 3vh 2.5vw 1.5vh; }
.board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: 1.25fr repeat(5, 1fr);
  gap: 1vh;
}
.board .cat, .board .tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 1.2vh;
  box-shadow: inset 0 0 0 0.3vh rgba(0, 0, 0, 0.35), 0 0.6vh 1.6vh rgba(0, 0, 0, 0.35);
}
.board .cat {
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  font-weight: 900;
  text-transform: uppercase;
  font-size: 2.6vh;
  padding: 0 0.8vw;
  line-height: 1.15;
  border-bottom: 0.5vh solid var(--gold);
}
.board .tile {
  background: linear-gradient(180deg, var(--board-blue-2), var(--board-blue));
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 6.2vh;
  text-shadow: 0.3vh 0.3vh 0 #000;
  transition: transform 0.3s, opacity 0.3s;
}
.board .tile.used {
  background: rgba(10, 31, 107, 0.35);
  color: transparent;
  text-shadow: none;
}
.board .tile.flash { animation: flash 0.6s ease 2; }
@keyframes flash { 50% { transform: scale(1.06); background: var(--gold); color: var(--ink); } }

/* ---------- Clue ---------- */
#screen-clue {
  align-items: center;
  justify-content: center;
  padding: 4vh 5vw;
}
.clue-card {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--board-blue-2), var(--board-blue));
  border-radius: 3vh;
  border: 0.6vh solid var(--gold);
  box-shadow: 0 2vh 6vh rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5vh 6vw;
  text-align: center;
  position: relative;
  animation: zoom-in 0.5s cubic-bezier(.2,1.4,.4,1);
}
@keyframes zoom-in { from { transform: scale(0.3); opacity: 0; } }
.clue-meta {
  position: absolute;
  top: 3vh;
  left: 3vw;
  right: 3vw;
  display: flex;
  justify-content: space-between;
  font-weight: 900;
  font-size: 3vh;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.clue-statement {
  font-family: var(--font-display);
  font-size: 6.4vh;
  line-height: 1.25;
  margin: 0;
  text-transform: uppercase;
  text-shadow: 0.35vh 0.35vh 0 #000;
}
.clue-answer {
  margin: 5vh 0 0;
  font-size: 5.4vh;
  font-weight: 900;
  color: var(--ink);
  background: var(--gold);
  padding: 1.4vh 3vw;
  border-radius: 1.5vh;
  display: none;
}
.clue-answer.show { display: block; animation: zoom-in 0.4s ease; }
.clue-award {
  margin: 3vh 0 0;
  font-size: 4vh;
  font-weight: 900;
  display: none;
}
.clue-award.show { display: block; animation: zoom-in 0.4s ease; }

/* ---------- End ---------- */
#screen-end {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
}
.end-title {
  font-family: var(--font-display);
  font-size: 12vh;
  margin: 0;
  color: var(--gold);
  text-shadow: 0 0.6vh 0 var(--red-dark);
  animation: bob 2.4s ease-in-out infinite;
}
.end-winner { font-size: 5vh; margin: 0; font-weight: 900; }
.podium { list-style: none; padding: 0; margin: 3vh 0 0; display: flex; align-items: flex-end; gap: 2vw; }
.podium li {
  width: 16vw;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
  border-radius: 2vh 2vh 0 0;
  text-align: center;
  padding: 2vh 1vw;
  border-top: 0.6vh solid var(--gold);
}
.podium li .place { font-size: 6vh; }
.podium li .name { font-size: 3vh; font-weight: 900; }
.podium li .pts { font-size: 4vh; color: var(--gold); font-weight: 900; }
.podium li:nth-child(1) { order: 2; min-height: 34vh; }
.podium li:nth-child(2) { order: 1; min-height: 26vh; }
.podium li:nth-child(3) { order: 3; min-height: 20vh; }
.podium li:nth-child(n+4) { order: 4; min-height: 14vh; background: rgba(0,0,0,.35); }

.confetti {
  position: fixed;
  top: -5vh;
  width: 1.2vh;
  height: 2vh;
  z-index: 3;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(115vh) rotate(720deg); } }

/* ---------- Score bar ---------- */
.scorebar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 11vh;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5vw;
  padding: 0 2vw;
  background: linear-gradient(0deg, rgba(0,0,0,.6), rgba(0,0,0,.25));
  border-top: 0.4vh solid var(--gold);
}
.scorebar .team {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 12vw;
  padding: 0.6vh 1.5vw;
  border-radius: 1.2vh;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.3s, transform 0.3s;
}
.scorebar .team .name { font-size: 2.3vh; font-weight: 700; }
.scorebar .team .pts { font-size: 4vh; font-weight: 900; color: var(--gold); font-family: var(--font-display); }
.scorebar .team.bump { animation: bump 0.9s ease; }
@keyframes bump { 30% { transform: scale(1.18); background: rgba(255, 207, 74, 0.45); } }
body.lobby .scorebar { display: none; }
body.lobby #stage { inset: 0; }

.room-chip {
  position: fixed;
  right: 1.5vw;
  bottom: 12vh;
  z-index: 2;
  font-size: 1.8vh;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.6vh 1vw;
  border-radius: 99px;
  opacity: 0.8;
}
body.lobby .room-chip { display: none; }

/* ---------- Unlock overlay ---------- */
.unlock {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 20, 12, 0.88);
  cursor: pointer;
}
.unlock.hidden { display: none; }
.unlock-card { text-align: center; }
.unlock-card .logo { font-size: 14vh; }
.unlock-card p { font-size: 4vh; margin: 2vh 0 0; }
.unlock-card .hint { font-size: 2.4vh; opacity: 0.7; margin-top: 0.5vh; }
