/* Live board: one screen, no scrolling. The current act is the hero; scores sit in one slim row. */
body.live {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  z-index: 65; /* above the winner screen, so sound and share stay reachable */
  background: var(--sky);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
}
.topbar .spacer { flex: 1; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: #2bb673; flex: none; }
.conn-dot.off { background: var(--red); animation: pulse 1s infinite; }

.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* stage */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 18px);
  padding: clamp(14px, 3vh, 40px) clamp(16px, 3vw, 32px) clamp(16px, 3vh, 36px);
}
.title-box { flex: 1; min-height: 0; display: flex; align-items: center; overflow: hidden; }
.act-title {
  font-size: 64px; /* set by fitTitle() */
  line-height: 1; /* a touch looser than .display, so descenders never touch the next line */
  width: 100%;
  overflow-wrap: normal;
  word-break: normal;
}
.stage[data-status="live"] .act-title { animation: rise 0.5s var(--ease); }
.sub-line { flex: none; font-family: var(--mono); font-size: clamp(12px, 1.7vh, 16px); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; margin: 0; color: var(--muted); }
.sub-line b { color: var(--ink); }
.sub-line:empty { display: none; }
.stage-info { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; min-width: 0; }
.stage-info > * { min-width: 0; }
.stage-info .sub-line { flex: 1 1 100%; line-height: 1.3; overflow-wrap: anywhere; }
#status-line { max-width: 100%; line-height: 1.3; overflow-wrap: anywhere; }
.stage-info:not(:has(.sub-line:not(:empty))):not(:has(.verse:not([hidden]))) { display: none; }
.verse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: clamp(15px, 2.2vh, 20px);
  letter-spacing: -0.01em;
  animation: pop-in 0.35s var(--spring);
  transition: transform 0.15s var(--spring);
}
.verse:active { transform: scale(0.96); }
.verse > i { color: var(--butter); font-size: 1.15em; flex: none; }
.verse-lbl { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sky-on-ink); flex: none; }
.verse-ref { min-width: 0; line-height: 1.15; overflow-wrap: anywhere; }
.verse .verse-go { width: 26px; height: 26px; border-radius: 50%; background: var(--butter); color: var(--ink); display: grid; place-items: center; font-size: 14px; }

/* big timer */
.clock {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: clamp(48px, min(16vw, 11vh), 140px);
  line-height: 0.85;
  transition: color 0.2s;
}
.clock .lbl { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.clock.danger { color: var(--red); animation: bump 1s ease-in-out infinite; transform-origin: left bottom; }
.clock.paused { opacity: 0.45; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(17, 18, 20, 0.08); }
.progress i { display: block; height: 100%; background: var(--ink); transform-origin: left; transition: transform 0.25s linear; }
.progress.danger i { background: var(--red); }

/* scores: one slim row */
.scores {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 10px clamp(16px, 3vw, 32px) max(10px, env(safe-area-inset-bottom));
}
/* side by side when they fit, wrapping onto a second row when names need the room */
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.team {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 22px;
  border: 1.5px solid var(--line);
  padding: 6px 8px 6px 14px;
  transition: background 0.3s, color 0.3s;
}
.team.acting { background: var(--ink); color: #fff; border-color: var(--ink); }
.team i { flex: none; font-size: 15px; }
.team.acting i { color: var(--butter); }
.team-name { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; line-height: 1.15; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.team-score {
  flex: none;
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--sky-on-ink);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.03em;
}
.team.acting .team-score { background: var(--butter); color: var(--ink); }
.team-score.bump { animation: bump 0.6s var(--spring); }

/* header icon buttons */
.icon-pill {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--sky-on-ink);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 17px;
  flex: none;
  transition: transform 0.15s var(--spring);
}
.icon-pill:active { transform: scale(0.9); }
.icon-pill.off { background: transparent; color: var(--ink); }

/* sound opt-in for people who join mid-game: lives in the header, covers nothing */
.sound-nudge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  animation: nudge-in 0.5s var(--spring) both, nudge-bob 2.4s ease-in-out 1.2s infinite;
}
.sound-nudge .go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--butter);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  border: 1.5px solid var(--ink);
}
@keyframes nudge-in { from { transform: scale(0.8); opacity: 0; } }
@keyframes nudge-bob { 50% { transform: translateY(2px); } }
@media (max-width: 640px) {
  .sound-nudge .off-lbl { display: none; }
  /* on phones the nudge stands in for the sound icons until the viewer chooses */
  .topbar:has(.sound-nudge:not([hidden])) :is(#music-btn, #sfx-btn) { display: none; }
}
@media (max-width: 360px) { .sound-nudge .go { padding: 0 10px; font-size: 13px; } }


/* finale */
.finale {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--ink);
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 24px;
  text-align: center;
  animation: pop-in 0.5s var(--ease);
  overflow-y: auto;
}
.finale-inner { display: grid; gap: 22px; justify-items: center; min-width: 0; }
.finale .eyebrow { color: var(--muted-on-ink); }
.finale-box { width: min(1000px, calc(100vw - 48px)); height: 42vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.finale h2 { color: var(--butter); font-size: 64px; width: 100%; line-height: 1; }
.finale .final-scores { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.finale .final-scores { max-width: 100%; }
.finale .final-scores .fs-name { display: block; min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.finale .final-scores > span { max-width: 100%; display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--line-on-ink); border-radius: 999px; padding: 8px 14px; }
.finale .final-scores b { color: var(--butter); flex: none; }
.finale .fine { font-family: var(--mono); font-size: 11px; color: var(--muted-on-ink); letter-spacing: 0.14em; text-transform: uppercase; }

/* sound gate */
.gate {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--sky);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  padding: 24px 20px;
  overflow-y: auto;
  animation: pop-in 0.3s var(--ease);
}
.gate.leaving { animation: gate-out 0.45s var(--ease) forwards; }
@keyframes gate-out { to { transform: translateY(-100%); } }
.gate-inner { max-width: 1100px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.gate h1 { font-size: clamp(84px, 22vw, 190px); }
.gate .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.gate .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px; max-width: 720px; }
.gate .meta p { margin: 4px 0 0; font-weight: 700; }
.gate .meta .mono { color: var(--muted); font-size: 10px; letter-spacing: 0.14em; }
.linklike { background: none; border: 0; padding: 8px 4px; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; color: var(--ink-2); }

@media (max-width: 640px) {
  .topbar { gap: 6px; }
  .topbar .chip { display: none; }
}
/* very short screens (landscape phones) */
@media (max-height: 520px) {
  .sub-line { display: none; }
}
