:root {
  /* Paleta - mantida */
  --bg: #F2EBE4;
  --card: #ffffff;
  --text: #161616;
  --muted: #5e5e5e;
  --wine: #8E0736;
  --gold: #808050;
  --border: rgba(0,0,0,.08);
  --shadow: 0 12px 40px rgba(0,0,0,.10);

  /* Configuração das Fontes - mantida */
  --font-body: 'Nunito Sans', sans-serif;
  --font-title: 'Gentium Plus', serif;

  /* Novos tokens para melhor UX */
  --wine-light: rgba(142, 7, 54, 0.08);
  --wine-medium: rgba(142, 7, 54, 0.15);
  --gold-light: rgba(128, 128, 80, 0.1);
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Títulos com fonte Gentium Plus */
h1, h2, h3, .brand {
  font-family: var(--font-title);
  line-height: 1.3;
}

/* ========== Layout Principal ========== */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 600px) {
  .page {
    padding: 24px 16px 48px;
  }
}

/* ========== Header ========== */
.header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.logo {
  height: 72px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.08));
  transition: transform var(--transition-smooth);
}

.logo:hover {
  transform: scale(1.02);
}

.headline h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.headline p {
  color: var(--muted);
  font-size: 1rem;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ========== Card Principal ========== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 20px 50px -12px rgba(0, 0, 0, 0.12);
  border-radius: 24px;
  padding: 32px;
  flex: 1;
}

@media (max-width: 600px) {
  .card {
    padding: 24px 20px;
    border-radius: 20px;
  }
}

/* ========== Seções do Formulário ========== */
.section {
  padding: 28px 0;
  border-top: 1px solid var(--border);
}

.section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.section:last-of-type {
  padding-bottom: 0;
}

.section h2 {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 4px;
  font-weight: 700;
}

.prompt {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Seção destacada */
.highlight {
  background: linear-gradient(135deg, var(--wine-light) 0%, transparent 100%);
  margin-left: -32px;
  margin-right: -32px;
  padding-left: 32px;
  padding-right: 32px;
  border-left: 4px solid var(--wine);
  border-top: none;
  position: relative;
}

.highlight::before {
  content: '★';
  position: absolute;
  top: 28px;
  right: 32px;
  color: var(--wine);
  opacity: 0.3;
  font-size: 1.5rem;
}

@media (max-width: 600px) {
  .highlight {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .highlight::before {
    right: 20px;
  }
}

/* ========== Grid de Campos ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ========== Campos de Input e Select ========== */
.field {
  position: relative;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  color: var(--muted);
  transition: color var(--transition-fast);
}

.field:focus-within label {
  color: var(--wine);
}

/* Aplicando estilo para INPUT e SELECT */
.field input, 
.field select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  outline: none;
  font-size: 1rem;
  font-family: var(--font-body);
  background: #fafafa;
  transition: all var(--transition-fast);
  /* Garante que o select tenha altura correta */
  appearance: none; 
  -webkit-appearance: none;
  -moz-appearance: none;
  /* Ícone da setinha para o select (opcional, mas ajuda na UX) */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235e5e5e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
}

/* Remove a setinha dos inputs de texto normais, mantendo só no select */
.field input {
  background-image: none;
}

.field input::placeholder {
  color: #b0b0b0;
}

.field input:hover,
.field select:hover {
  border-color: rgba(0,0,0,0.15);
  background-color: #fff;
}

.field input:focus,
.field select:focus {
  border-color: var(--wine);
  background-color: #fff;
  box-shadow: 0 0 0 4px var(--wine-light);
}

/* ========== Opções de Radio ========== */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.opt {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px 16px 52px;
  display: block;
  cursor: pointer;
  background: #fafafa;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: all var(--transition-fast);
  user-select: none;
}

.opt input {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  accent-color: var(--wine);
  cursor: pointer;
}

.opt:hover {
  border-color: var(--gold);
  background: #fff;
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.opt:has(input:checked) {
  border-color: var(--wine);
  background: var(--wine-light);
  box-shadow: 0 4px 16px var(--wine-medium);
}

.opt:has(input:focus-visible) {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

/* ========== Botão de Envio ========== */
.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 18px 48px;
  background: linear-gradient(135deg, var(--wine) 0%, #6b0529 100%);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-smooth);
  box-shadow: 
    0 4px 14px rgba(142, 7, 54, 0.35),
    0 2px 4px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 100%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 24px rgba(142, 7, 54, 0.4),
    0 4px 8px rgba(0,0,0,0.15);
}

.btn:hover::before {
  opacity: 1;
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ========== Status Box ========== */
.status {
  display: flex;
  gap: 16px;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  background: #fff;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.status--loading {
  background: linear-gradient(90deg, #fff 0%, #f8f5f2 50%, #fff 100%);
  background-size: 200% 100%;
  animation: fadeIn 0.3s ease, shimmer 2s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.status strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

/* ========== Spinner ========== */
.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--wine-light);
  border-top-color: var(--wine);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ========== Utilitários ========== */
.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

.hidden {
  display: none !important;
}

/* ========== Footer ========== */
.footer {
  margin-top: 40px;
  text-align: center;
  padding-top: 24px;
}

.footer .muted {
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

/* ========== Animações de Entrada ========== */
.form {
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { 
    opacity: 0; 
    transform: translateY(16px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* ========== Scrollbar Customizada ========== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.25);
}

/* ========== Focus Visible para Acessibilidade ========== */
*:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

/* ========== Selection ========== */
::selection {
  background: var(--wine-medium);
  color: var(--text);
}

/* ============================================================
   WIZARD — uma tela (step) por vez
   ============================================================ */

/* Barra de progresso */
.progress {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 28px;
}
.progress[hidden] { display: none; }

.progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold) 0%, var(--wine) 100%);
  border-radius: 999px;
  transition: width var(--transition-smooth);
}

/* Cada step começa oculto; o JS adiciona .step--active para exibir um por vez */
.step { display: none; }

.step.step--active {
  display: block;
  animation: stepIn var(--transition-smooth) both;
}

/* Steps centralizados (início, processando, final, erro) */
.step.step--center.step--active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 320px;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step__title {
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 10px;
  font-weight: 700;
}

.lead {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.step--center .lead {
  max-width: 460px;
}

.intro-list {
  text-align: left;
  display: inline-block;
  margin: 4px auto 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}
.intro-list li { margin-bottom: 10px; }

/* Tela de observação (o formulário "conversando" com a pessoa) */
.step--obs.step--active {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.obs { position: relative; padding: 4px 4px 4px 8px; }

.obs__mark {
  font-family: var(--font-title);
  color: var(--wine);
  opacity: 0.22;
  font-size: 4.5rem;
  line-height: 0;
  display: block;
  height: 2.2rem;
  margin-bottom: 6px;
}

.obs__text {
  font-family: var(--font-title);
  font-size: 1.35rem;
  line-height: 1.55;
  color: var(--text);
}

/* Tela de Atenção (pausa antes da Pergunta 9) */
.step--attention {
  max-width: 560px;
  margin: 0 auto;
}

.step--attention .step__title {
  text-align: center;
  color: var(--wine);
  font-size: 1.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.step--attention .step__title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  margin: 14px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--wine) 100%);
}

.step--attention .lead {
  margin-bottom: 14px;
}

.step--attention .lead strong {
  color: var(--wine);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.step--attention .obs--quote {
  margin-top: 26px;
  padding: 18px 20px 20px 24px;
  border-left: 4px solid var(--wine);
  background: linear-gradient(135deg, var(--wine-light) 0%, transparent 100%);
  border-radius: 0 14px 14px 0;
}

.step--attention .obs--quote .obs__text {
  font-style: italic;
}

/* Navegação compartilhada (Voltar / Continuar) */
.wizard-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.wizard-nav[hidden] { display: none; }

#nextBtn { margin-left: auto; }

.btn[hidden] { display: none; }

.wizard-nav .btn { min-width: 150px; }

@media (max-width: 600px) {
  .wizard-nav { gap: 10px; margin-top: 28px; padding-top: 22px; }
  .wizard-nav .btn { min-width: 0; padding: 15px 16px; font-size: 1rem; }
  /* "Voltar" fica compacto; "Continuar/Enviar respostas" ocupa o resto da linha */
  .wizard-nav #backBtn { flex: 0 0 auto; }
  .wizard-nav #nextBtn { flex: 1 1 auto; margin-left: 0; }
}

/* Botão secundário (Voltar) */
.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 2px solid var(--border);
  box-shadow: none;
  padding: 16px 28px;
}
.btn--ghost::before { display: none; }
.btn--ghost:hover {
  background: #f3efe9;
  color: var(--text);
  border-color: rgba(0,0,0,0.15);
  transform: none;
  box-shadow: none;
}

.submit-hint {
  text-align: center;
  margin-top: 14px;
  min-height: 1.2em;
}

/* Selo das telas finais */
.badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 auto 8px;
}
.badge--ok { background: var(--wine-light); color: var(--wine); }
.badge--err { background: #fdecec; color: #b3261e; }

/* Spinner grande para a tela de processamento */
.spinner--lg {
  width: 42px;
  height: 42px;
  border-width: 4px;
  margin: 0 auto 12px;
}

/* Acessibilidade: reduzir movimento */
@media (prefers-reduced-motion: reduce) {
  .step.step--active { animation: none; }
  .progress__bar { transition: none; }
  .opt:hover { transform: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   RESPONSIVO — ajustes finos para celular
   ============================================================ */
@media (max-width: 600px) {
  .header { margin-bottom: 24px; padding-bottom: 24px; }
  .logo { height: 60px; }

  .step__title { font-size: 1.25rem; }
  .lead { font-size: 1rem; }
  .prompt { font-size: 0.95rem; }

  /* Opções com alvo de toque mais confortável */
  .opt { padding: 15px 16px 15px 46px; font-size: 0.95rem; }
  .opt input { left: 14px; width: 22px; height: 22px; }

  /* Telas de observação */
  .obs { padding-left: 4px; }
  .obs__text { font-size: 1.2rem; }
  .obs__mark { font-size: 3.6rem; }
  .step.step--center.step--active { min-height: 280px; }

  /* Tela de atenção ocupa a largura toda no celular */
  .step--attention { max-width: 100%; }
  .step--attention .step__title { font-size: 1.3rem; letter-spacing: 0.05em; margin-bottom: 18px; }
  .step--attention .obs--quote { margin-top: 22px; padding: 16px 16px 16px 18px; }
}

/* Celulares bem estreitos (≤360px) */
@media (max-width: 360px) {
  .card { padding: 20px 16px; }
  .opt { font-size: 0.92rem; padding-left: 44px; }
  .wizard-nav .btn { padding: 14px 12px; font-size: 0.95rem; }
  .obs__text { font-size: 1.12rem; }
}

/* Em telas de toque, não "prender" o efeito de hover (movimento) após o toque */
@media (hover: none) {
  .opt:hover { transform: none; }
  .btn:hover { transform: none; }
  .logo:hover { transform: none; }
}
