:root {
  --void: #0e0e12;
  --panel: #18181d;
  --hair: #2c2c35;
  --tally: #ff2a3a;
  --amber: #f5c518;
  --paper: #efece6;
  --mute: #8b8794;
  --chat: #0b0b0ecc;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  background: var(--void);
  color: var(--paper);
  overflow: hidden;
}
body {
  font-family: Figtree, system-ui, sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.booth {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rack {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--hair);
  background: var(--panel);
}

.tally { display: flex; align-items: center; gap: 0.55rem; }
.led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tally);
  box-shadow: 0 0 0 3px #ff2a3a33, 0 0 14px var(--tally);
  animation: pulse 1.6s ease-in-out infinite;
}
.onair {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 1.05rem;
}
.tc {
  font-family: "IBM Plex Mono", monospace;
  color: var(--amber);
  font-size: 0.92rem;
}
.wordmark {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.28em;
  font-size: 1.15rem;
  text-align: center;
}
.viewers { justify-self: end; text-align: right; }
.count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.35rem;
  color: var(--amber);
}
.watching { display: block; color: var(--mute); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 0;
  overflow: hidden;
}

.program {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.frame {
  position: relative;
  flex: 1;
  margin: 0.85rem;
  background: #050506;
  border: 1px solid var(--hair);
  overflow: hidden;
  min-height: 220px;
}
#programVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
#programVideo.live { display: block; }
.poster {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.4rem;
  text-align: center;
  padding: 2rem;
  color: var(--mute);
  background:
    repeating-linear-gradient(0deg, transparent, transparent 3px, #ffffff05 4px),
    radial-gradient(ellipse at center, #1a1a22 0%, #050506 70%);
}
.poster-kicker {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.22em;
  color: var(--tally);
  margin: 0;
}
.poster p { margin: 0; max-width: 28ch; justify-self: center; }
.poster.hidden { display: none; }

.lower-third {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 28rem;
  padding: 0.55rem 0.7rem 0.6rem 0.85rem;
  background: linear-gradient(90deg, #ff2a3a 4px, #141418 4px);
  border: 1px solid #ffffff14;
}
.lower-third input {
  border: 0;
  background: transparent;
  color: var(--paper);
  font: inherit;
  outline: none;
  width: 100%;
}
#title { font-weight: 700; font-size: 1.15rem; }
#category {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.deck {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0 0.85rem 0.4rem;
}
.deck button, .say button {
  font: 600 0.85rem Figtree, sans-serif;
  background: var(--panel);
  color: var(--paper);
  border: 1px solid var(--hair);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}
.deck button:hover, .say button:hover { border-color: var(--amber); }
.name-field {
  margin-left: auto;
  color: var(--mute);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.name-field input {
  width: 7rem;
  background: var(--panel);
  border: 1px solid var(--hair);
  color: var(--paper);
  padding: 0.35rem 0.45rem;
  font: inherit;
}
.status { width: 100%; margin: 0; color: var(--amber); font-size: 0.8rem; }
.legal {
  margin: 0 0.85rem 0.8rem;
  color: var(--mute);
  font-size: 0.78rem;
}

.chat-col {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--hair);
  background: var(--chat);
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.chat-head {
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.16em;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--hair);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--mute);
  border: 1px solid var(--hair);
  padding: 0.1rem 0.35rem;
}
.pill.llm { color: #7ee787; border-color: #7ee78755; }
.chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0.7rem 0.8rem;
  font-size: 0.92rem;
  line-height: 1.35;
}
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb {
  background: #3a3a46;
  border-radius: 4px;
}
.line { margin: 0 0 0.45rem; word-wrap: break-word; }
.line .u { font-weight: 700; margin-right: 0.35rem; }
.line.streamer .u { color: var(--amber); }
.say {
  display: flex;
  gap: 0.35rem;
  padding: 0.55rem;
  border-top: 1px solid var(--hair);
}
.say input {
  flex: 1;
  background: #111116;
  border: 1px solid var(--hair);
  color: var(--paper);
  padding: 0.5rem 0.6rem;
  font: inherit;
}

.alert {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--amber);
  padding: 0.7rem 1.1rem;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.08em;
  font-size: 1.4rem;
  z-index: 5;
}

@keyframes pulse {
  50% { opacity: 0.45; box-shadow: 0 0 0 3px #ff2a3a11; }
}
@media (prefers-reduced-motion: reduce) {
  .led { animation: none; }
}

.lockout {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-content: center;
  gap: 0.45rem;
  padding: 2rem;
  background: #0e0e12f2;
  text-align: center;
}
.lockout[hidden] { display: none; }
.lockout h1 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.12em;
  font-size: 1.8rem;
}
.lockout p { margin: 0; color: var(--mute); max-width: 42ch; }
.lockout .eta {
  font-family: "IBM Plex Mono", monospace;
  color: var(--amber);
  font-size: 1.2rem;
}

@media (max-width: 860px) {
  .rack { grid-template-columns: 1fr 1fr; }
  .wordmark { display: none; }
  .stage {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 42vh;
  }
  .chat-col {
    height: 42vh;
    max-height: 42vh;
    border-left: 0;
    border-top: 1px solid var(--hair);
  }
  .name-field { margin-left: 0; }
}
