:root {
  /* Paleta Nova: Premium, Mística e de Alta Conversão */
  --quiz-bg1: #0f0518; /* Roxo muito escuro/Meia-noite */
  --quiz-bg2: #361154; /* Roxo místico */
  --quiz-text: #ffffff;
  --quiz-muted: #bfa8d8;
  --quiz-accent: #d4af37; /* Dourado Premium */
  --quiz-danger: #e53935; /* Vermelho mais sólido para alertas */
  --quiz-btn: #ffffff;
  --quiz-btn-text: #1a0b2e;
  --quiz-radius: 18px;
  --quiz-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --quiz-maxw: 540px;

  --wa-green: #128c7e;
  --wa-dark: #1f2c34;
  --wa-chat: #111b21;
  --bot: #202c33;
  --user: #005c4b;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  background: #000;
}

body.is-quiz {
  color: var(--quiz-text);
  background: radial-gradient(
    100% 150% at 50% 0%,
    var(--quiz-bg2),
    var(--quiz-bg1)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

body.is-chat {
  background: #000;
  padding: 0;
  display: block;
}

[hidden] {
  display: none !important;
}

/* ================= QUIZ ================= */
#quizApp {
  width: 100%;
  max-width: var(--quiz-maxw);
}

#quizApp .stage {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--quiz-radius);
  box-shadow: var(--quiz-shadow);
  padding: 20px 18px 24px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#quizApp .topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

#quizApp .logo {
  height: 36px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#quizApp .progress {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

#quizApp .progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #d4af37, #ffe58f, #d4af37);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#quizApp h1 {
  font-size: 22px;
  line-height: 1.3;
  margin: 10px 0 6px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#quizApp #screen[data-step="video"] h1 {
  font-size: clamp(25px, 6vw, 32px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin-top: 14px;
}

#quizApp .sub {
  color: var(--quiz-muted);
  margin: 4px 0 14px;
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}

#quizApp .hl {
  background: var(--quiz-danger);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
}

#quizApp .hl-yellow {
  background: var(--quiz-accent);
  color: #1a0b2e;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

#quizApp .media {
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  margin: 12px 0 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#quizApp .media img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

#quizApp .media iframe {
  width: 100%;
  height: 320px;
  display: block;
  border: 0;
  border-radius: 14px;
}

#quizApp .quiz-video {
  position: relative;
  background: #000;
  isolation: isolate;
}

#quizApp .quiz-testimonial-video {
  width: min(100%, 32.625dvh, 315px);
  height: auto;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  margin-left: auto;
  margin-right: auto;
}

#quizApp .quiz-testimonial-video iframe {
  width: 100%;
  height: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}

#quizApp .quiz-video-shield {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  cursor: default;
}

#quizApp .quiz-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #d4af37, #f3d674);
  color: #1a0b2e;
  box-shadow: 0 0 0 0 rgba(243, 214, 116, 0.65);
  cursor: pointer;
  animation: quiz-video-play-pulse 1.4s ease-out infinite;
}

#quizApp .quiz-video-play[hidden] {
  display: none;
}

#quizApp .quiz-video-play:disabled {
  cursor: wait;
}

#quizApp .quiz-video-play span {
  display: block;
  width: 0;
  height: 0;
  margin-left: 28px;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 20px solid currentColor;
}

@keyframes quiz-video-play-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 214, 116, 0.65);
  }
  70%,
  100% {
    box-shadow: 0 0 0 20px rgba(243, 214, 116, 0);
  }
}

#quizApp .options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

#quizApp .btn {
  appearance: none;
  border: 1px solid transparent;
  width: 100%;
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--quiz-btn);
  color: var(--quiz-btn-text);
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  text-align: left;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
}

#quizApp .btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#quizApp .btn.center {
  text-align: center;
}

#quizApp .btn[data-variant="primary"] {
  background: linear-gradient(135deg, #d4af37, #f3d674);
  color: #1a0b2e;
  border: none;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#quizApp .btn[data-variant="danger"] {
  background: #ffebee;
  color: #c62828;
}
#quizApp .btn[data-variant="ok"] {
  background: #e8f5e9;
  color: #2e7d32;
}

#quizApp .footer-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

#quizApp .ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
#quizApp .ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

#quizApp .disclaimer {
  font-size: 11px;
  color: #bfa8d8;
  opacity: 0.7;
  margin-top: 14px;
  text-align: center;
}

/* Quiz mobile: uma etapa inteira sempre visível, sem rolagem da página */
@media (max-width: 480px) {
  body.is-quiz {
    min-height: 100dvh;
    height: 100dvh;
    align-items: center;
    overflow: hidden;
    padding: max(8px, env(safe-area-inset-top)) 10px
      max(8px, env(safe-area-inset-bottom));
    box-sizing: border-box;
  }

  #quizApp {
    height: auto;
    max-height: 100%;
  }

  #quizApp .stage {
    height: auto;
    max-height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 14px;
    box-sizing: border-box;
  }

  #quizApp .topbar {
    flex: 0 0 auto;
    gap: 8px;
    margin-bottom: 6px;
  }

  #quizApp .logo {
    width: 44px;
    height: 30px;
    object-fit: contain;
  }

  #quizApp .progress {
    height: 6px;
  }

  #quizApp #screen {
    flex: 0 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  #quizApp h1 {
    flex: 0 0 auto;
    font-size: clamp(15.5px, 4.45vw, 18px);
    line-height: 1.2;
    margin: 5px 0 3px;
  }

  #quizApp .sub {
    flex: 0 0 auto;
    margin: 2px 0 6px;
    font-size: clamp(10.5px, 3vw, 12px);
    line-height: 1.3;
  }

  #quizApp .hl,
  #quizApp .hl-yellow {
    font-size: 10.5px;
  }

  #quizApp .media {
    flex: 0 1 auto;
    min-height: 48px;
    margin: 6px 0 8px;
    border-radius: 11px;
  }

  #quizApp .media img {
    height: auto;
    max-height: 100%;
  }

  #quizApp .media iframe {
    width: 100%;
    height: auto;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 11px;
  }

  #quizApp .quiz-testimonial-video {
    width: min(100%, 32.625dvh, 315px);
    height: auto;
    max-width: 100%;
    aspect-ratio: 9 / 16;
  }

  #quizApp .quiz-testimonial-video iframe {
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: 9 / 16;
  }

  #quizApp .options {
    flex: 0 0 auto;
    gap: 6px;
    margin-top: 2px;
  }

  #quizApp .btn {
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 11px;
    font-size: clamp(12.5px, 3.55vw, 14.5px);
    line-height: 1.22;
  }

  #quizApp .btn[data-variant="primary"] {
    font-size: clamp(12.5px, 3.7vw, 15px);
    letter-spacing: 0.2px;
  }

  #quizApp .footer-actions {
    flex: 0 0 auto;
    margin-top: 6px;
  }

  #quizApp .ghost {
    padding: 4px 10px;
    font-size: 11px;
  }

  #quizApp .disclaimer {
    flex: 0 0 auto;
    margin-top: 6px;
    font-size: 9.5px;
    line-height: 1.2;
  }

  #quizApp #screen.is-entering {
    animation: quiz-enter 0.2s ease-out;
  }
}

@media (max-width: 480px) and (max-height: 700px) {
  body.is-quiz {
    align-items: flex-start;
  }

  #quizApp,
  #quizApp .stage {
    height: 100%;
  }

  #quizApp #screen {
    flex: 1 1 auto;
  }
}

@media (max-width: 360px) and (max-height: 540px) {
  #quizApp .stage {
    padding: 9px 10px;
  }
  #quizApp .topbar {
    margin-bottom: 3px;
  }
  #quizApp .logo {
    width: 38px;
    height: 26px;
  }
  #quizApp h1 {
    font-size: 14.5px;
    line-height: 1.16;
    margin: 3px 0 2px;
  }
  #quizApp .media {
    min-height: 36px;
    margin: 4px 0 6px;
  }
  #quizApp .btn {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 12px;
  }
  #quizApp .footer-actions {
    margin-top: 4px;
  }
  #quizApp .disclaimer {
    margin-top: 4px;
    font-size: 9px;
  }
}

@keyframes quiz-enter {
  from {
    transform: translateY(4px);
  }
  to {
    transform: translateY(0);
  }
}
