/* Sala de Live — espectador (estilo Instagram Live, mobile-first 360x760) */

:root {
  color-scheme: dark;
  --bg: #0b0b12;
  --vermelho: #ff3040;
  --texto: #ffffff;
  --texto-fraco: rgba(255, 255, 255, 0.72);
  --vidro: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#app-sala {
  position: relative;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input {
  font-family: inherit;
}

/* --- Estados de tela cheia (sem-live / entrada / reconectar) --------- */

#tela-sem-live,
#tela-entrada,
#tela-reconectar {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 24px;
  text-align: center;
}

#tela-sem-live[hidden],
#tela-entrada[hidden],
#tela-sala[hidden],
#modal-convite[hidden],
#tela-reconectar[hidden] {
  display: none !important;
}

#tela-sem-live p {
  color: var(--texto-fraco);
  font-size: 15px;
}

/* --- Tela de entrada --------------------------------------------------- */

#tela-entrada {
  width: 100%;
}

#tela-entrada header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

#titulo-live {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.badge-ao-vivo {
  display: inline-block;
  background: var(--vermelho);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  border-radius: 4px;
  padding: 4px 8px;
  text-transform: uppercase;
}

#form-registro,
#form-convidado {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#form-registro label,
#form-convidado label {
  font-size: 13px;
  color: var(--texto-fraco);
  text-align: left;
}

#form-registro input,
#form-convidado input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--texto);
  font-size: 15px;
}

#form-registro button,
#form-convidado button {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #6a3bd6, #ff3040);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.ou {
  color: var(--texto-fraco);
  font-size: 12px;
  margin: 4px 0;
}

#erro-entrada {
  color: #ff6b6b;
  font-size: 13px;
  background: rgba(255, 48, 64, 0.12);
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
}

/* --- Sala (dentro da live) --------------------------------------------- */

#tela-sala {
  position: relative;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: #000;
}

#palco {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

#video-host,
#video-cohost {
  position: relative;
  background: #101018;
  overflow: hidden;
}

#video-host {
  flex: 1 1 100%;
}

#video-host.dividido {
  flex: 1 1 50%;
}

#video-cohost {
  flex: 0 0 0;
  height: 0;
  transition: flex 0.2s ease;
}

#video-cohost.ativo {
  flex: 1 1 50%;
  height: auto;
}

#video-host video,
#video-cohost video {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}

#video-host::before {
  content: "Aguardando o apresentador...";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--texto-fraco);
  font-size: 13px;
  z-index: 0;
}

/* --- Overlay superior --------------------------------------------------- */

#topo-overlay {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
  pointer-events: none;
}

#contador-presentes {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* --- Corações voando ----------------------------------------------------- */

#area-coracoes {
  position: absolute;
  right: 6px;
  bottom: 76px;
  width: 60px;
  height: 62%;
  z-index: 6;
  pointer-events: none;
  overflow: visible;
}

.coracao-voando {
  position: absolute;
  right: 8px;
  bottom: 0;
  font-size: 26px;
  animation: subir-coracao 2.4s ease-out forwards;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

@keyframes subir-coracao {
  0% { transform: translate(0, 0) scale(0.5); opacity: 0; }
  12% { opacity: 1; transform: translate(0, -8%) scale(1); }
  100% { transform: translate(var(--drift, 0px), -420px) scale(1.15); opacity: 0; }
}

/* --- Botão de coração e contador ------------------------------------------ */

#btn-coracao {
  position: absolute;
  right: 12px;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--vidro);
  color: #fff;
  font-size: 22px;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
}

#contador-coracoes {
  position: absolute;
  right: 16px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  font-size: 12px;
  font-weight: 700;
  z-index: 7;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* --- Chat ------------------------------------------------------------- */

#painel-chat {
  position: absolute;
  left: 0;
  right: 64px;
  bottom: 0;
  height: 36%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));
  z-index: 4;
}

#chat-lista {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  scrollbar-width: none;
}

#chat-lista::-webkit-scrollbar { display: none; }

.chat-msg {
  font-size: 13.5px;
  line-height: 1.35;
  word-break: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.chat-msg b {
  margin-right: 4px;
  color: #ffd4d9;
}

#aviso-chat-fechado {
  font-size: 12px;
  color: var(--texto-fraco);
  margin: 0;
}

#form-chat {
  display: flex;
  align-items: center;
  gap: 8px;
}

#chat-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 14px;
}

#chat-input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

#chat-input:disabled {
  opacity: 0.5;
}

#btn-enviar-chat {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 16px;
}

/* --- Modal de convite ---------------------------------------------------- */

#modal-convite {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  padding: 24px;
}

#modal-convite .caixa {
  background: #17171f;
  border-radius: 14px;
  padding: 24px 20px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#texto-convite {
  margin: 0;
  font-size: 15px;
}

.botoes-convite {
  display: flex;
  gap: 10px;
}

.botoes-convite button {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 14px;
}

#btn-aceitar-convite {
  background: linear-gradient(135deg, #6a3bd6, #ff3040);
  color: #fff;
}

#btn-recusar-convite {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* --- Reconectar --------------------------------------------------------- */

#tela-reconectar {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--bg);
}

#btn-reconectar {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #6a3bd6, #ff3040);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
