.quiz-page {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgb(0 21 43 / 0.98), rgb(0 11 28 / 0.98)),
    var(--navy);
}

.quiz-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.5rem clamp(1.25rem, 4vw, 4rem) 4rem;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.quiz-brand,
.quiz-exit,
.quiz-option,
.quiz-button,
.quiz-restart {
  display: flex;
  align-items: center;
}

.quiz-brand__logo {
  display: block;
  width: clamp(158px, 15vw, 194px);
  height: auto;
  max-height: 52px;
  object-fit: contain;
}

.quiz-exit,
.quiz-button,
.quiz-restart {
  min-height: 44px;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid var(--border);
  color: var(--ivory);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.quiz-exit { padding: 0 0.85rem; }
.quiz-exit svg { width: 16px; height: 16px; }
.quiz-exit:hover { border-color: var(--gold-light); background: rgb(230 184 75 / 0.08); }

.quiz {
  width: min(100%, 920px);
  margin: clamp(4rem, 11vh, 8rem) auto 0;
}

.quiz__progress { margin-bottom: clamp(2.5rem, 6vh, 4.5rem); }

.quiz__progress-track {
  display: block;
  width: 100%;
  height: 1px;
  overflow: hidden;
  background: var(--border-soft);
}

.quiz__progress-track i {
  display: block;
  width: 14.285%;
  height: 100%;
  background: var(--gold-light);
  transform-origin: left;
  transition: width 400ms var(--ease-expo);
}

.quiz__progress p {
  margin: 0.75rem 0 0;
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quiz-step { animation: quiz-step-enter 350ms var(--ease-expo); }

@keyframes quiz-step-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-step__intro { max-width: 790px; }

.quiz-step__eyebrow {
  margin: 0 0 1rem;
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quiz-step h1,
.quiz-step h2 {
  max-width: 790px;
  margin: 0;
  color: var(--ivory);
  font-family: var(--font-display);
  font-size: clamp(2.45rem, 5.4vw, 4.7rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.12;
}

.quiz-step__intro > p:last-child,
.quiz-complete > p {
  max-width: 640px;
  margin: 1.2rem 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

@media (min-width: 768px) {
  .quiz-page { overflow: hidden; }

  .quiz-shell {
    width: 100%;
    max-width: none;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: clamp(1rem, 2.4vh, 1.5rem) clamp(1.5rem, 4vw, 4rem);
    overflow: hidden;
  }

  .quiz {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
    min-height: 0;
    margin: clamp(1.5rem, 4.2vh, 3.25rem) 0 0;
  }

  .quiz__progress { margin-bottom: clamp(1.15rem, 3vh, 2rem); }
  .quiz-step__intro { max-width: 100%; }
  .quiz-step h1,
  .quiz-step h2 {
    max-width: 100%;
    font-size: clamp(2.25rem, 3.8vw, 3.75rem);
    line-height: 1.12;
    text-wrap: balance;
  }
  .quiz-step__intro > p:last-child,
  .quiz-complete > p { max-width: 100%; margin-top: 0.85rem; text-wrap: balance; }

  .quiz-options { margin-top: clamp(1rem, 2.6vh, 1.65rem); }
  .quiz-option { min-height: clamp(56px, 8vh, 68px); padding: 0.75rem 1rem; }
  .quiz-step[data-step="1"] .quiz-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quiz-step[data-step="5"] .quiz-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quiz-field--wide { margin-top: 0.85rem; }

  .quiz-contact-grid { gap: 0.9rem; margin-top: clamp(1rem, 2.6vh, 1.65rem); }
  .quiz-contact-preferences { margin-top: 1rem; }
  .quiz-consent { margin-top: 1rem; }
  .quiz__actions { margin-top: clamp(1rem, 2.8vh, 1.75rem); }
}

@media (min-width: 768px) and (max-height: 700px) {
  .quiz-shell { padding-block: 0.85rem; }
  .quiz { margin-top: 1rem; }
  .quiz__progress { margin-bottom: 0.85rem; }
  .quiz__progress p { margin-top: 0.45rem; }
  .quiz-step__eyebrow { margin-bottom: 0.55rem; }
  .quiz-step h1,
  .quiz-step h2 { font-size: clamp(2rem, 3.35vw, 3rem); }
  .quiz-step__intro > p:last-child,
  .quiz-complete > p { margin-top: 0.55rem; font-size: 0.92rem; line-height: 1.45; }
  .quiz-options { gap: 0.55rem; margin-top: 0.8rem; }
  .quiz-option { min-height: 50px; padding: 0.55rem 0.8rem; font-size: 0.83rem; }
  .quiz-option svg { width: 17px; height: 17px; }
  .quiz-field input { min-height: 46px; }
  .quiz-field textarea { height: 50px; min-height: 50px; }
  .quiz-contact-grid { gap: 0.65rem; margin-top: 0.8rem; }
  .quiz-contact-preferences { margin-top: 0.75rem; }
  .quiz-consent { margin-top: 0.7rem; font-size: 0.75rem; }
  .quiz__actions { margin-top: 0.8rem; }

  .quiz-step[data-step="5"] {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
    column-gap: 1.2rem;
    align-items: start;
  }

  .quiz-step[data-step="5"] .quiz-step__intro { grid-column: 1; grid-row: 1; }
  .quiz-step[data-step="5"] .quiz-options {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0;
  }
  .quiz-step[data-step="5"] .quiz-field--wide { grid-column: 1 / -1; margin-top: 0.55rem; }

  .quiz-step[data-step="7"] {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(520px, 1.1fr);
    column-gap: 1.2rem;
    align-items: start;
  }

  .quiz-step[data-step="7"] .quiz-step__intro { grid-column: 1; grid-row: 1 / span 3; }
  .quiz-step[data-step="7"] .quiz-contact-grid { grid-column: 2; margin-top: 0; }
  .quiz-step[data-step="7"] .quiz-contact-preferences { grid-column: 2; }
  .quiz-step[data-step="7"] .quiz-consent { grid-column: 2; }
}

.quiz-options {
  display: grid;
  gap: 0.75rem;
  margin: clamp(2rem, 5vh, 3.4rem) 0 0;
  padding: 0;
  border: 0;
}

.quiz-options--two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quiz-options--three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quiz-options--stack { max-width: 620px; }

.quiz-option {
  min-height: 76px;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem 1rem 1.25rem;
  border: 1px solid var(--border);
  color: var(--ivory);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.35;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.quiz-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.quiz-option svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--gold); }
.quiz-option:hover { border-color: rgb(247 211 108 / 0.7); background: rgb(230 184 75 / 0.06); transform: translateY(-1px); }
.quiz-option:has(input:checked) { border-color: var(--gold-light); background: rgb(230 184 75 / 0.13); color: var(--gold-bright); }
.quiz-option:has(input:focus-visible) { outline: 2px solid var(--gold-light); outline-offset: 3px; }

.quiz-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-field--wide { display: flex; margin-top: 1.25rem; }

.quiz-field > span,
.quiz-contact-preferences legend {
  color: var(--ivory);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.quiz-field small,
.quiz-contact-preferences small { color: var(--text-subtle); font-size: 0.75em; font-weight: 500; }
.quiz-field__hint { min-height: 1.1em; margin-top: -0.15rem; color: var(--text-subtle) !important; font-size: 0.72rem !important; }
.quiz-field:has(input[aria-invalid="true"]) .quiz-field__hint { color: #f2a1a1 !important; }
.quiz-field.is-valid .quiz-field__hint { color: #a8d6b0 !important; }

.quiz-field input,
.quiz-field textarea {
  width: 100%;
  min-height: 54px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0;
  outline: none;
  color: var(--ivory);
  background: rgb(0 11 28 / 0.36);
  font-size: 0.95rem;
  transition: border-color 180ms ease, background 180ms ease;
}

.quiz-field textarea { min-height: 104px; resize: vertical; }
.quiz-field input::placeholder, .quiz-field textarea::placeholder { color: var(--text-subtle); }
.quiz-field input:focus, .quiz-field textarea:focus { border-color: var(--gold-light); background: rgb(0 11 28 / 0.62); }
.quiz-field input[aria-invalid="true"], .quiz-field textarea[aria-invalid="true"] { border-color: #dd8080; }

.quiz-contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: clamp(2rem, 5vh, 3.4rem);
}

.quiz-contact-preferences { margin: 1.6rem 0 0; padding: 0; border: 0; }
.quiz-contact-preferences legend { padding: 0; }
.quiz-contact-preferences .quiz-options { margin-top: 0.75rem; }

.quiz-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.quiz-consent input { width: 16px; height: 16px; margin: 0.15rem 0 0; accent-color: var(--gold); }

.quiz__actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-top: clamp(2.5rem, 6vh, 4.5rem);
}

.quiz-button { padding: 0 1.15rem; cursor: pointer; }
.quiz-button svg, .quiz-restart svg { width: 18px; height: 18px; }
.quiz-button--ghost { color: var(--text-muted); }
.quiz-button--ghost:disabled { opacity: 0.35; cursor: default; }
.quiz-button--ghost:not(:disabled):hover, .quiz-restart:hover { border-color: var(--gold-light); color: var(--ivory); }
.quiz-button--primary { min-width: 150px; border-color: var(--gold); background: var(--gold); color: var(--navy); }
.quiz-button--primary:hover { border-color: var(--gold-light); background: var(--gold-light); }
.quiz-button--primary:disabled { border-color: rgb(181 193 207 / 0.18); background: rgb(181 193 207 / 0.14); color: rgb(181 193 207 / 0.45); cursor: not-allowed; }
.quiz-button--primary:disabled:hover { border-color: rgb(181 193 207 / 0.18); background: rgb(181 193 207 / 0.14); }
.quiz-error { min-height: 1.2em; margin: 0; color: #f2a1a1; font-size: 0.8rem; text-align: center; }

.iti { width: 100%; }
.iti__country-container { height: 54px; }
.iti__selected-country { padding: 0 0.45rem 0 0.72rem; border-right: 1px solid var(--border-soft); background: rgb(230 184 75 / 0.05); }
.iti__selected-country:hover { background: rgb(230 184 75 / 0.1); }
.iti__selected-dial-code { color: var(--ivory); font-size: 0.88rem; }
.iti__arrow { border-top-color: var(--gold-light); }
.iti__dropdown-content { color-scheme: dark; background: #02172e !important; }
.iti__country-list { width: 100% !important; max-width: none !important; border: 1px solid var(--border); color: var(--ivory); background: #02172e; box-shadow: var(--shadow-card); scrollbar-width: thin; scrollbar-color: var(--gold-deep) var(--navy); }
.iti__search-container { padding: 0.65rem; background: var(--navy) !important; }
.iti__search-input { min-height: 44px; padding: 0.6rem 0.75rem 0.6rem 2.6rem !important; border: 1px solid var(--border); border-radius: 0; color: var(--ivory); background-color: #03172d !important; }
.iti__search-input::placeholder { color: var(--text-subtle); opacity: 1; }
.iti__country { padding: 0.6rem 0.8rem; }
.iti__country:hover, .iti__country.iti__highlight { background: rgb(230 184 75 / 0.1); }
.iti__country-name, .iti__dial-code { font-size: 0.85rem; }
.iti__dial-code { color: var(--gold-light); }
.iti__country-list::-webkit-scrollbar { width: 8px; }
.iti__country-list::-webkit-scrollbar-track { background: var(--navy); }
.iti__country-list::-webkit-scrollbar-thumb { border: 2px solid var(--navy); border-radius: 0; background: var(--gold-deep); }

.quiz-complete { max-width: 790px; }
.quiz-complete h2 { max-width: 720px; }
.quiz-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 2.3rem; border: 1px solid var(--border); background: var(--border); }
.quiz-summary div { padding: 1rem; background: var(--navy-elevated); }
.quiz-summary div:last-child { grid-column: 1 / -1; }
.quiz-summary span { display: block; margin-bottom: 0.3rem; color: var(--gold-light); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.quiz-summary strong { color: var(--ivory); font-size: 0.92rem; font-weight: 500; line-height: 1.45; }
.quiz-complete__notice { color: var(--text-subtle) !important; font-size: 0.82rem !important; }
.quiz-restart { margin-top: 1.5rem; padding: 0 1rem; cursor: pointer; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.quiz [hidden] { display: none !important; }

@media (max-width: 767px) {
  .quiz-shell { padding: 1rem 1.1rem 2.5rem; }
  .quiz-brand__logo { width: clamp(136px, 40vw, 156px); max-height: 44px; }
  .quiz-exit span { display: none; }
  .quiz-exit { width: 44px; padding: 0; }
  .quiz { margin-top: 3.5rem; }
  .quiz__progress { margin-bottom: 2.5rem; }
  .quiz-step h1, .quiz-step h2 { font-size: clamp(1.875rem, 9vw, 2.5rem); }
  .quiz-step__intro > p:last-child, .quiz-complete > p { font-size: 0.92rem; }
  .quiz-options--two-columns, .quiz-options--three-columns, .quiz-contact-grid, .quiz-summary { grid-template-columns: 1fr; }
  .quiz-option { min-height: 64px; font-size: 0.88rem; }
  .quiz__actions { grid-template-columns: auto 1fr; }
  .quiz-error { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .quiz-button--primary { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-step, .quiz__progress-track i, .quiz-option, .quiz-field input, .quiz-field textarea { animation: none; transition: none; }
}

/* Telas baixas de desktop e notebook: prevalece sobre as medidas-base do formulário. */
@media (min-width: 768px) and (max-height: 700px) {
  .quiz-options { gap: 0.55rem; margin-top: 0.8rem; }
  .quiz-option { min-height: 50px; padding: 0.55rem 0.8rem; font-size: 0.83rem; }
  .quiz-option svg { width: 17px; height: 17px; }
  .quiz-field input { min-height: 46px; }
  .quiz-field textarea { height: 50px; min-height: 50px; }
  .quiz-contact-grid { gap: 0.65rem; margin-top: 0.8rem; }
  .quiz-contact-preferences { margin-top: 0.75rem; }
  .quiz-consent { margin-top: 0.7rem; font-size: 0.75rem; }
  .quiz__actions { margin-top: 0.5rem; }
}

/* Mantém a etapa de investimento na mesma grade usada nas demais escolhas. */
.quiz__form { position: relative; }
.quiz-step.is-transitioning-out { position: absolute; right: 0; left: 0; pointer-events: none; }

@media (min-width: 768px) {
  .quiz-step[data-step="4"] .quiz-options--stack {
    max-width: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .quiz-step[data-step="4"] .quiz-options--stack .quiz-option:last-child { grid-column: 2; }

  .quiz-complete { max-width: none; text-align: center; }
  .quiz-complete h2 { width: 100%; max-width: none; }
  .quiz-complete > p { max-width: 860px; margin-right: auto; margin-left: auto; }
  .quiz-complete__notice { max-width: 620px !important; }
  .quiz-summary { width: min(100%, 760px); margin-right: auto; margin-left: auto; text-align: left; }
  .quiz-restart { margin-right: auto; margin-left: auto; }
}

.quiz-summary__item {
  position: relative;
  display: block;
  width: 100%;
  padding: 1rem 4.8rem 1rem 1rem;
  border: 0;
  color: inherit;
  background: var(--navy-elevated);
  cursor: pointer;
  text-align: left;
  transition: background 180ms ease;
}
.quiz-summary__item:hover,
.quiz-summary__item:focus-visible { background: rgb(230 184 75 / 0.1); outline: 1px solid var(--gold-light); outline-offset: -1px; }
.quiz-summary__item em {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--gold-light);
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.quiz-summary .quiz-summary__item:last-child { grid-column: 1 / -1; }

.quiz-confetti { position: fixed; z-index: 10; inset: 0; overflow: hidden; pointer-events: none; }
.quiz-confetti span {
  position: absolute;
  top: -24px;
  left: var(--confetti-left);
  width: 7px;
  height: 12px;
  opacity: 0;
  background: var(--confetti-color);
  animation: quiz-confetti-fall var(--confetti-duration) var(--confetti-delay) ease-in forwards;
}
@keyframes quiz-confetti-fall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  12% { opacity: 0.9; }
  100% { opacity: 0; transform: translate3d(var(--confetti-drift), 105vh, 0) rotate(540deg); }
}
