/* =========================================================
   Canteiro das IAs · Modal do questionário de nivelamento
   ========================================================= */

.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 4vw, 32px);
  overscroll-behavior: contain;
}

.quiz-overlay[hidden] { display: none; }

.quiz-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 11, 18, .82);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .28s var(--ease-out, ease);
}

.quiz-overlay.is-open .quiz-backdrop { opacity: 1; }

.quiz-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  max-height: min(92vh, 780px);
  max-height: min(92dvh, 780px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--offwhite);
  color: var(--ink);
  border-radius: var(--radius-2xl, 20px);
  --pad: clamp(22px, 4vw, 44px);
  padding: var(--pad) var(--pad) 0;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .55);
  opacity: 0;
  transform: translateY(18px) scale(.97);
  transition: opacity .32s var(--ease-out, ease), transform .32s var(--ease-out, ease);
}

.quiz-overlay.is-open .quiz-card { opacity: 1; transform: translateY(0) scale(1); }

.quiz-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(25, 24, 36, .06);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  border: 0;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}
.quiz-close:active { background: rgba(25, 24, 36, .14); }
.quiz-close:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* ---------- progresso ---------- */
.quiz-progress { margin-bottom: 24px; }
/* barra do topo divide a linha com o botão fechar */
.quiz-body > .quiz-progress:first-child { padding-right: 52px; }
.quiz-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: rgba(25, 24, 36, .55);
  margin-bottom: 8px;
  letter-spacing: .01em;
}
.quiz-progress-row strong { color: var(--violet); font-variant-numeric: tabular-nums; }
.quiz-progress-track {
  height: 7px;
  border-radius: 100px;
  background: rgba(25, 24, 36, .1);
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--violet);
  width: 0%;
  transition: width .35s var(--ease-out, ease);
}

/* ---------- conteúdo de cada etapa ---------- */
.quiz-step-title {
  font-family: var(--font-display);
  font-size: clamp(19px, 2.4vw, 24px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
}
/* títulos recebem foco via JS (leitor de tela); sem contorno visual */
.quiz-body [tabindex="-1"]:focus { outline: none; }
.quiz-step-sub {
  margin-top: 8px;
  font-size: 13.5px;
  color: rgba(25, 24, 36, .58);
  line-height: 1.5;
}

.quiz-error {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  background: #FDECEC;
  color: #B3261E;
  font-size: 12.5px;
  font-weight: 600;
}

/* ---------- opções (single / multi) ---------- */
.quiz-options { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }

.quiz-option {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(25, 24, 36, .14);
  background: #fff;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
@media (hover: hover) {
  .quiz-close:hover { background: rgba(25, 24, 36, .12); transform: rotate(90deg); }
  .quiz-option:hover { border-color: rgba(25, 24, 36, .28); background: #fbfbfa; }
  .quiz-btn-next:hover { background: var(--violet-strong); transform: translateY(-1px); }
  .quiz-btn-back:hover { color: var(--ink); }
  .quiz-result-cta:hover { transform: translateY(-2px); }
}
.quiz-option, .quiz-btn-next, .quiz-btn-back, .quiz-close, .quiz-result-cta { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.quiz-option:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.quiz-option.is-selected {
  border-color: var(--violet);
  background: rgba(123, 109, 255, .08);
  box-shadow: inset 0 0 0 1px rgba(123, 109, 255, .35);
}

.quiz-option-text { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.4; }

.quiz-option-mark {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(25, 24, 36, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.quiz-option.is-selected .quiz-option-mark { border-color: var(--violet); background: var(--violet); }
.quiz-option.is-selected .quiz-option-mark::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
/* checkbox (Q4): quadrado em vez de círculo */

/* ---------- formulário de lead ---------- */
.quiz-field { margin-top: 16px; }
.quiz-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(25, 24, 36, .55);
  margin-bottom: 6px;
}
.quiz-field input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(25, 24, 36, .16);
  background: #fff;
  padding: 13px 15px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
}
.quiz-field input[aria-invalid="true"] { border-color: #B3261E; }
.quiz-privacy { margin-top: 14px; font-size: 12px; line-height: 1.5; color: rgba(25, 24, 36, .5); }
/* honeypot anti-spam: fora da tela, invisível pra gente */
.quiz-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.quiz-field input:focus-visible, .quiz-field input:focus { outline: 2px solid var(--violet); outline-offset: 1px; border-color: var(--violet); }

/* ---------- navegação ---------- */
.quiz-nav {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-top: 22px;
  padding-bottom: calc(var(--pad) * .75 + env(safe-area-inset-bottom, 0px));
  background: var(--offwhite);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(25, 24, 36, .1);
  padding-top: 18px;
}
.quiz-nav-spacer { flex: 1; }

.quiz-btn-back {
  background: none;
  border: 0;
  color: rgba(25, 24, 36, .6);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
}

.quiz-btn-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--violet);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 13px 26px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(123, 109, 255, .7);
  transition: background .2s ease, transform .2s ease;
}
.quiz-btn-next:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- tela de cálculo ---------- */
.quiz-calc { text-align: center; padding: 30px 6px var(--pad); }
.quiz-calc-spinner {
  width: 54px; height: 54px; margin: 0 auto 22px;
  border-radius: 50%;
  border: 4px solid rgba(123, 109, 255, .18);
  border-top-color: var(--violet);
  animation: quiz-spin .9s linear infinite;
}
@keyframes quiz-spin { to { transform: rotate(360deg); } }
.quiz-calc-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.quiz-calc-phrase {
  margin-top: 8px;
  min-height: 20px;
  font-size: 13.5px;
  color: rgba(25, 24, 36, .6);
}
.quiz-calc .quiz-progress { margin-top: 22px; text-align: left; }

/* ---------- resultado ---------- */
.quiz-result { text-align: center; padding: 8px 2px calc(var(--pad) + env(safe-area-inset-bottom, 0px)); }
.quiz-result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px; height: 60px;
  border-radius: 50%;
  font-size: 28px;
  margin-bottom: 16px;
}
.quiz-result-badge.is-approved { background: rgba(91, 185, 140, .16); color: #2F8F60; }
.quiz-result-badge.is-rejected { background: rgba(160, 112, 85, .16); color: var(--terracota); }

.quiz-result-title { font-family: var(--font-display); font-size: clamp(21px, 3vw, 26px); font-weight: 800; }
.quiz-result-body { margin-top: 12px; font-size: 14.5px; line-height: 1.65; color: rgba(25, 24, 36, .7); }
.quiz-result-body p + p { margin-top: 10px; }

.quiz-result-community {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(160, 112, 85, .08);
  border: 1px solid rgba(160, 112, 85, .2);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
  text-align: left;
}

.quiz-result-cta {
  margin-top: 26px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  padding: 15px 30px;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
}
.quiz-result-cta.is-approved { background: #25D366; box-shadow: 0 14px 30px -12px rgba(37, 211, 102, .6); }
.quiz-result-cta.is-rejected { background: var(--terracota); box-shadow: 0 14px 30px -12px rgba(160, 112, 85, .6); }

@media (max-width: 560px) {
  .quiz-overlay { align-items: flex-end; padding: 0; }
  .quiz-card {
    max-width: none;
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
    transform: translateY(40px);
  }
  .quiz-overlay.is-open .quiz-card { transform: translateY(0); }
  .quiz-step-title { font-size: 19px; }
  .quiz-option { padding: 14px; min-height: 52px; }
  .quiz-option-text { font-size: 14.5px; }
  .quiz-btn-next { flex: 1; justify-content: center; padding: 15px 20px; font-size: 15px; }
  .quiz-nav-spacer { display: none; }
  .quiz-btn-back { padding: 12px 6px; }
  .quiz-result-cta { width: 100%; justify-content: center; padding: 16px 20px; }
  .quiz-result-body { font-size: 14px; }
}
