/* ==========================================================================
   quiz.css — Teste do Milheiro Empresarial (Modelo 1 e Modelo 2)
   Todos os seletores são escopados em .mg-quiz-page para não vazar para o
   tema (menu, rodapé, WhatsApp flutuante) nem sofrer interferência dele.
   Ver briefing: handoff/briefing-quiz-wordpress.md (seções 2.3 e 3).
   ========================================================================== */

/* --- Design tokens (escopados; não usar :root para não colidir com
       css/variables.css do tema) --------------------------------------- */
.mg-quiz-page {
  --ink-800: #0E0E0E;
  --ink-700: #131313;
  --surface: #1C1A18;
  --surface-2: #252220;
  --brown-hero: #2D1F14;

  --border: #34302C;
  --border-soft: rgba(255, 255, 255, .07);

  --brand-300: #FBB477;
  --brand-500: #F58634;
  --brand-600: #E0701C;
  --brand-700: #C0661E;
  --brand-soft: rgba(245, 134, 52, .12);

  --success: #3FB57A;
  --danger: #E5564B;

  --text-100: #F8F8F8;
  --text-300: #CFC9C2;
  --text-500: #9A938B;
  --text-700: #6B655F;

  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --sh-card: 0 18px 40px -24px rgba(0, 0, 0, .8);
  --sh-glow: 0 10px 30px -8px rgba(245, 134, 52, .45);

  --max-width: 480px;

  --font-title: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
}

/* Reset escopado (obrigatório para fechar os 480px; nunca usar seletor
   universal solto — quebraria menu e rodapé). */
.mg-quiz-page,
.mg-quiz-page *,
.mg-quiz-page *::before,
.mg-quiz-page *::after {
  box-sizing: border-box;
}

/* --- Seção do quiz -------------------------------------------------------- */
.mg-quiz-page {
  position: relative;
  min-height: 70vh;
  padding: 40px 16px 64px;
  font-family: var(--font-body);
  color: var(--text-300);
  background-color: var(--ink-800);
  /* dois glows radiais quentes; scroll (não fixed) para o fundo terminar
     junto com a seção e o rodapé do site aparecer normalmente */
  background-image:
    radial-gradient(900px 500px at 80% -10%, rgba(245, 134, 52, .10), transparent 60%),
    radial-gradient(700px 400px at -10% 0%, rgba(120, 80, 40, .10), transparent 55%);
  background-attachment: scroll;
  background-repeat: no-repeat;
}

.mg-quiz-app {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
}

/* --- Cabeçalho próprio do quiz ------------------------------------------- */
.quiz-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-soft);
}

/* logo do site — altura fixa e largura automática preservam a proporção
   original (sem distorção). A logo já contém o nome, sem texto duplicado. */
.quiz-header .quiz-logo {
  height: 32px;
  width: auto;
  flex: 0 0 auto;
  display: block;
}

/* --- Barra de progresso --------------------------------------------------- */
.mg-progress {
  margin-bottom: 24px;
}

.mg-progress[hidden] {
  display: none;
}

.mg-progress__label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-500);
  margin-bottom: 8px;
}

.mg-progress__track {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.mg-progress__fill {
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500));
  transition: width .35s ease;
}

/* --- Telas (single-page) -------------------------------------------------- */
.mg-screens {
  position: relative;
}

.screen {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .28s ease, transform .28s ease;
}

.screen.active {
  display: block;
  opacity: 1;
  transform: none;
}

/* a tela que sai fica absoluta para não empurrar o layout durante o fade */
.screen.leaving {
  display: block;
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

/* Tela inicial (intro): conteúdo centralizado verticalmente DENTRO da altura
   da seção (70vh), sem esticar a página — assim o rodapé fica na mesma altura
   de antes. Desconta header + paddings da seção (40 topo + ~72 header + 64
   base = 176px). Só a intro — as demais telas seguem alinhadas ao topo. */
#screen-intro.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(70vh - 176px);
}

/* --- Tipografia base do quiz --------------------------------------------- */
.mg-eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 12px;
  color: var(--brand-500);
  margin: 0 0 12px;
}

.mg-title {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.2;
  color: var(--text-100);
  margin: 0 0 14px;
}

.mg-subtitle {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-300);
  margin: 0 0 28px;
}

/* --- Botões --------------------------------------------------------------- */
.mg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 22px;
  border: none;
  border-radius: var(--r-pill);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  color: #1A0E04;
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}

.mg-btn:hover {
  background: linear-gradient(180deg, var(--brand-300), var(--brand-500));
}

.mg-btn:active {
  transform: translateY(1px);
  background: var(--brand-700);
}

.mg-btn:focus-visible {
  outline: 3px solid var(--brand-soft);
  outline-offset: 2px;
}

.mg-btn--ghost {
  color: var(--text-100);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mg-btn--ghost:hover {
  background: var(--surface);
}

/* CTA final com glow — só acende após revelar o cupom (.is-live) */
.mg-cta {
  margin-top: 24px;
  transition: box-shadow .3s ease, transform .3s ease;
}

.mg-cta.is-live {
  box-shadow: var(--sh-glow);
  animation: mg-cta-pop .5s ease;
}

@keyframes mg-cta-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* --- Alternativas --------------------------------------------------------- */
.mg-question__text {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.35;
  color: var(--text-100);
  margin: 0 0 22px;
}

.mg-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
}

.mg-options.visible {
  opacity: 1;
  transform: none;
}

.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-100);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.option-btn:hover:not(:disabled) {
  background: var(--brand-soft);
  border-color: var(--brand-600);
}

.option-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
  border-color: var(--brand-500);
}

.option-btn:disabled {
  cursor: default;
}

.option-btn.correct {
  border-color: var(--success);
  background: rgba(63, 181, 122, .14);
  color: var(--text-100);
}

.option-btn.selected.incorrect {
  border-color: var(--danger);
  background: rgba(229, 86, 75, .14);
  color: var(--text-100);
}

/* --- Painel de feedback (Modelo 2) --------------------------------------- */
.mg-feedback {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mg-feedback[hidden] {
  display: none;
}

.mg-feedback__title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 6px;
}

.mg-feedback.is-correct .mg-feedback__title {
  color: var(--success);
}

.mg-feedback.is-incorrect .mg-feedback__title {
  color: var(--danger);
}

.mg-feedback__text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-300);
  margin: 0 0 16px;
}

.mg-feedback .mg-btn {
  width: 100%;
}

/* --- Tela de cálculo ------------------------------------------------------ */
.mg-calculating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 320px;
  text-align: center;
}

.mg-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--brand-soft);
  border-top-color: var(--brand-500);
  animation: mg-spin .9s linear infinite;
}

@keyframes mg-spin {
  to { transform: rotate(360deg); }
}

.mg-calculating__text {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-300);
}

/* --- Card de nível (teaser + resultado) ---------------------------------- */
.mg-level-card {
  position: relative;
  overflow: hidden;
  padding: 24px 22px;
  border-radius: var(--r-xl);
  border: 1px solid var(--brand-700);
  background: linear-gradient(160deg, var(--brown-hero), var(--surface));
  box-shadow: var(--sh-card);
}

.mg-level-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(245, 134, 52, .28), transparent 70%);
  pointer-events: none;
}

.mg-level-card__name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 24px;
  line-height: 1.2;
  color: var(--text-100);
  margin: 4px 0 12px;
}

.mg-level-card__text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-300);
  margin: 0;
}

/* --- Formulário de captura ----------------------------------------------- */
.mg-capture {
  margin-top: 28px;
}

.mg-field {
  margin-bottom: 16px;
}

.mg-field label {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-300);
  margin-bottom: 6px;
}

.mg-field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--ink-700);
  color: var(--text-100);
  font-family: var(--font-body);
  font-size: 15px;
}

.mg-field input::placeholder {
  color: var(--text-700);
}

.mg-field input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.mg-field.has-error input {
  border-color: var(--danger);
}

.mg-field__error {
  display: none;
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--danger);
}

.mg-field.has-error .mg-field__error {
  display: block;
}

.mg-privacy {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-700);
}

.mg-privacy a {
  color: var(--text-500);
  text-decoration: underline;
}

/* --- Raspadinha do cupom -------------------------------------------------- */
.mg-scratch {
  position: relative;
  height: 136px;
  margin-top: 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--brand-700);
  overflow: hidden;
}

.mg-scratch__coupon {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(160deg, var(--brown-hero), var(--surface));
  text-align: center;
}

.mg-scratch__coupon-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--brand-300);
}

.mg-scratch__code {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: .04em;
  color: var(--text-100);
}

.mg-scratch__coupon-sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-300);
}

.mg-scratch__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  transition: opacity .5s ease;
}

.mg-scratch__canvas.is-cleared {
  opacity: 0;
  pointer-events: none;
}

/* botão copiar — escondido até revelar */
.mg-copy-btn {
  margin-top: 14px;
}

.mg-copy-btn[hidden],
.mg-reveal-btn[hidden] {
  display: none;
}

/* --- Confete -------------------------------------------------------------- */
.mg-confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* abaixo do botão flutuante do WhatsApp do tema */
  z-index: 900;
}

/* --- Responsivo ----------------------------------------------------------- */
@media (max-width: 380px) {
  .mg-title { font-size: 23px; }
  .mg-question__text { font-size: 17px; }
  .mg-scratch__code { font-size: 24px; }
}
