:root {
  --coral: #E15751;
  --coral-escuro: #C43F3A;
  --amber: #F5A623;
  --creme: #FBEEE4;
  --tinta: #221A18;
  --tinta-suave: #6B5C56;
  --branco: #FFFFFF;
  --verde: #34C759;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
  background: var(--creme);
  color: var(--tinta);
  overscroll-behavior: none;
}

.tela {
  display: none;
  height: 100dvh;
  width: 100%;
}
.tela.ativa { display: flex; flex-direction: column; }

/* ---------- INTRO ---------- */
#tela-intro.ativa {
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  text-align: center;
}
.intro-logo { width: 180px; margin-bottom: 24px; }
.intro-titulo { font-size: 24px; font-weight: 800; margin-bottom: 12px; }
.intro-texto { font-size: 14px; color: var(--tinta-suave); line-height: 1.6; margin-bottom: 30px; max-width: 340px; }
.intro-legal { font-size: 11px; color: var(--tinta-suave); margin-top: 18px; max-width: 300px; }

.botao-primario {
  background: linear-gradient(135deg, var(--coral), var(--coral-escuro));
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 100px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 12px 24px -8px rgba(225,87,81,0.55);
  cursor: pointer;
  width: 100%;
  max-width: 320px;
}
.botao-secundario {
  background: white;
  color: var(--tinta);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 15px 32px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  max-width: 320px;
  margin-top: 12px;
}

/* ---------- CHAMANDO ---------- */
#tela-chamando.ativa {
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2c1f1c, #120c0b);
  color: white;
  text-align: center;
}
.chamando-conteudo { position: relative; display: flex; flex-direction: column; align-items: center; }
.chamando-logo { width: 90px; margin-bottom: 22px; filter: brightness(0) invert(1); opacity: 0.9; }
.pulso-anel {
  position: absolute;
  top: -30px;
  width: 150px; height: 150px;
  border-radius: 50%;
  border: 2px solid rgba(225,87,81,0.4);
  animation: pulsar 1.6s infinite;
}
@keyframes pulsar {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.chamando-titulo { font-size: 19px; font-weight: 700; }
.chamando-sub { font-size: 12.5px; color: rgba(255,255,255,0.6); margin-top: 8px; }

/* ---------- CHAMADA (vídeo + mapa) ---------- */
#tela-chamada.ativa { flex-direction: column; }
.video-secao {
  flex: 1;
  position: relative;
  background: #111;
  overflow: hidden;
}
#video-remoto {
  width: 100%; height: 100%;
  object-fit: cover;
  background: #1a1a1a;
}
.video-self {
  position: absolute;
  bottom: 12px; right: 12px;
  width: 84px; height: 112px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.6);
  background: #333;
}
.ice-status {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(52,199,89,0.18);
  border: 1px solid rgba(52,199,89,0.5);
  color: var(--verde);
  font-size: 10px; font-weight: 800;
  padding: 5px 10px;
  border-radius: 100px;
}
.ice-status.reconectando { background: rgba(245,166,35,0.2); border-color: rgba(245,166,35,0.6); color: var(--amber); }
.video-remoto-label {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,0.45);
  color: white; font-size: 11px; font-weight: 700;
  padding: 6px 12px; border-radius: 100px;
  display: flex; align-items: center; gap: 6px;
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #ff4b4b; animation: piscar 1.4s infinite; }
@keyframes piscar { 0%,100%{opacity:1} 50%{opacity:0.3} }
.controles-chamada {
  position: absolute; bottom: 12px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 16px;
}
.ctrl-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none; color: white; font-size: 18px;
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.ctrl-btn.encerrar { background: #ff4b4b; }

.mapa-secao { flex: 1; position: relative; }
.mapa { width: 100%; height: 100%; }
.mapa-badge {
  position: absolute; top: 10px; left: 10px; z-index: 500;
  background: white; border-radius: 10px; padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
}
.mapa-badge b { font-size: 12px; }
.mapa-badge span { font-size: 10.5px; color: var(--tinta-suave); }
.mapa-acoes {
  position: absolute; bottom: 10px; left: 10px; right: 10px; z-index: 500;
  display: flex; gap: 8px;
}
.mapa-botao {
  flex: 1; background: white; border-radius: 12px; padding: 12px;
  text-align: center; text-decoration: none; color: var(--tinta);
  font-size: 12px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.mapa-botao.primario { background: var(--coral); color: white; }

/* ---------- TELAS DE TEXTO CENTRAL (ninguém atendeu / recado / fim) ---------- */
.conteudo-central {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  text-align: center;
}
.icone-grande { font-size: 52px; margin-bottom: 16px; }
.titulo-central { font-size: 21px; font-weight: 800; margin-bottom: 10px; }
.texto-central { font-size: 13.5px; color: var(--tinta-suave); line-height: 1.6; margin-bottom: 26px; max-width: 340px; }

.campo-textarea, .campo-input {
  width: 100%; max-width: 340px;
  background: white;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  padding: 14px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 12px;
  resize: none;
}

/* ---------- FUNDOS DA MARCA ----------
   Só nas telas calmas (intro, ninguém atendeu, fim). Chamada, chamando e recado ficam sem arte. */
#tela-intro.ativa, #tela-fim.ativa, #tela-ninguem-atendeu.ativa { background-color: var(--creme); background-position: center; background-size: cover; background-repeat: no-repeat; }
#tela-intro.ativa, #tela-fim.ativa { background-image: url('fundos/bg-completo-vertical.jpg'); background-image: image-set(url('fundos/bg-completo-vertical.webp') type('image/webp'), url('fundos/bg-completo-vertical.jpg') type('image/jpeg')); }
#tela-ninguem-atendeu.ativa { background-image: url('fundos/bg-suave-vertical.jpg'); background-image: image-set(url('fundos/bg-suave-vertical.webp') type('image/webp'), url('fundos/bg-suave-vertical.jpg') type('image/jpeg')); }
@media (min-width: 768px) {
  #tela-intro.ativa, #tela-fim.ativa { background-image: url('fundos/bg-completo-16x9.jpg'); background-image: image-set(url('fundos/bg-completo-16x9.webp') type('image/webp'), url('fundos/bg-completo-16x9.jpg') type('image/jpeg')); }
  #tela-ninguem-atendeu.ativa { background-image: url('fundos/bg-suave-16x9.jpg'); background-image: image-set(url('fundos/bg-suave-16x9.webp') type('image/webp'), url('fundos/bg-suave-16x9.jpg') type('image/jpeg')); }
}

.botao-cancelar-chamando {
  margin-top: 28px;
  padding: 13px 28px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.55);
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.botao-cancelar-chamando:active { background: rgba(255,255,255,0.15); }

/* a animação de pulso não pode engolir o toque no botão de cancelar */
.pulso-anel { pointer-events: none; }
.botao-cancelar-chamando { position: relative; z-index: 5; }
