/* ==========================================================================
   VARIÁVEIS GERAIS E SETUP DE ALTA FIDELIDADE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red-primary:  #D01F2A;
  --red-gradient: linear-gradient(135deg, #FF3B4A 0%, #D01F2A 100%);
  --red-glow:     rgba(208, 31, 42, 0.4);
  --red-soft:     rgba(208, 31, 42, 0.08);
  
  --bg-dark:      #09090B;
  --surface:      rgba(24, 24, 27, 0.6);
  --surface-hover:rgba(39, 39, 42, 0.8);
  
  --border-subtle:rgba(255, 255, 255, 0.06);
  --border-focus: rgba(255, 255, 255, 0.15);
  
  --text-main:    #FAFAFA;
  --text-muted:   #A1A1AA;
  
  --ease-spring:  cubic-bezier(0.175, 0.885, 0.32, 1.05);
  --ease-smooth:  cubic-bezier(0.4, 0, 0.2, 1);
  --font:         'Plus Jakarta Sans', sans-serif;
}

html, body {
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background effects premium */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: radial-gradient(circle at center, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed; top: -20vh; left: -10vw;
  width: 60vw; height: 60vw; border-radius: 50%;
  background: radial-gradient(circle, rgba(208,31,42,0.1) 0%, transparent 60%);
  filter: blur(80px); pointer-events: none; z-index: 0;
  animation: float-glow 8s ease-in-out infinite alternate;
}

@keyframes float-glow {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(20px) scale(1.05); }
}

/* ==========================================================================
   BARRA SUPERIOR E PROGRESSO
   ========================================================================== */
#progress-bar {
  position: fixed; top: 0; left: 0; height: 3px;
  background: var(--red-gradient); width: 0%;
  transition: width 0.6s var(--ease-spring);
  z-index: 200; box-shadow: 0 0 10px var(--red-glow);
}

#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; z-index: 100;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 9, 11, 0.7); backdrop-filter: blur(20px);
}

#topbar .logo-img { height: 26px; width: auto; display: block; opacity: 0.9; transition: opacity 0.2s; }
#topbar .logo-img:hover { opacity: 1; }
#topbar .step-pill {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle); border-radius: 24px; padding: 6px 14px;
}

/* ==========================================================================
   INDICADORES
   ========================================================================== */
#save-indicator {
  position: fixed; bottom: 32px; left: 40px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); display: flex; align-items: center; gap: 8px;
  z-index: 100; opacity: 0; transition: opacity 0.4s var(--ease-smooth);
}
#save-indicator.show { opacity: 1; }
#save-indicator .si-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #10B981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}
#save-indicator.saving .si-dot { background: #F59E0B; box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); animation: blink 0.8s infinite alternate; }
#save-indicator.error .si-dot  { background: var(--red-primary); }
@keyframes blink { from {opacity: 1} to {opacity: 0.3} }

#fnav { position: fixed; bottom: 32px; right: 40px; display: flex; gap: 8px; z-index: 100; }
.fnav-btn {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--border-subtle); background: rgba(24, 24, 27, 0.4);
  backdrop-filter: blur(10px); color: var(--text-muted); font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.3s var(--ease-spring);
}
.fnav-btn:hover:not(:disabled) { border-color: var(--border-focus); color: var(--text-main); transform: translateY(-2px); background: rgba(24, 24, 27, 0.8); }
.fnav-btn:disabled { opacity: 0.15; cursor: not-allowed; transform: none; }

/* ==========================================================================
   ESTRUTURA DE SLIDES E TIPOGRAFIA
   ========================================================================== */
#slides { position: relative; z-index: 1; height: 100vh; overflow: hidden; width: 100%; }

.slide {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 80px 24px;
  opacity: 0; transform: translateY(30px) scale(0.98); pointer-events: none;
  transition: opacity 0.5s var(--ease-smooth), transform 0.5s var(--ease-spring);
  
  /* Permite o scroll se a tela for muito pequena */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.slide.active  { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }
.slide.exit-up { opacity: 0; transform: translateY(-30px) scale(0.98); pointer-events: none; }

.step-label {
  display: flex; align-items: center; gap: 12px; font-size: 11px; font-weight: 800;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--red-primary); margin-bottom: 24px;
  flex-shrink: 0;
}
.step-label::before, .step-label::after { content: ''; display: block; height: 1px; background: var(--red-primary); opacity: 0.3; }
.step-label::before { width: 32px; } .step-label::after  { width: 32px; }

.slide h2 {
  font-size: clamp(28px, 4vw, 52px); font-weight: 800; line-height: 1.1;
  text-align: center; max-width: 700px; margin-bottom: 16px; letter-spacing: -0.03em;
  flex-shrink: 0;
}

/* GRADIENTE ANIMADO NOS DESTAQUES */
.slide h2 em, #s0 h1 em, .result-title em, .powered em { 
  background: linear-gradient(270deg, #FF3B4A, #D01F2A, #FF3B4A);
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: normal; 
}
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.slide .sub { font-size: 16px; font-weight: 400; color: var(--text-muted); text-align: center; max-width: 520px; line-height: 1.6; margin-bottom: 48px; flex-shrink: 0; }

/* ==========================================================================
   FORMULÁRIOS
   ========================================================================== */
.field { width: 100%; max-width: 500px; position: relative; margin-bottom: 8px; flex-shrink: 0; }
.field input {
  width: 100%; background: var(--surface); backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle); border-radius: 12px; color: var(--text-main);
  font-family: var(--font); font-size: 18px; font-weight: 500; padding: 20px 24px;
  outline: none; transition: all 0.3s var(--ease-smooth); caret-color: var(--red-primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.field input::placeholder { color: #52525B; font-weight: 400; }
.field input:hover { border-color: var(--border-focus); background: rgba(39, 39, 42, 0.4); }
.field input:focus {
  border-color: var(--red-primary); background: rgba(24, 24, 27, 0.8);
  box-shadow: 0 0 0 4px var(--red-soft), 0 8px 32px rgba(0,0,0,0.2); transform: translateY(-2px);
}

.opts { display: grid; gap: 12px; width: 100%; flex-shrink: 0; }
.opts.two-col { grid-template-columns: 1fr 1fr; max-width: 640px; }
.opts.one-col { grid-template-columns: 1fr; max-width: 500px; }

.opt {
  display: flex; align-items: flex-start; gap: 16px; padding: 18px 22px;
  background: var(--surface); backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle); border-radius: 12px; cursor: pointer;
  transition: all 0.3s var(--ease-spring); user-select: none; position: relative;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.opt:hover { border-color: var(--border-focus); background: var(--surface-hover); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.opt:active { transform: scale(0.98); }
.opt.selected {
  border-color: var(--red-primary); background: var(--red-soft);
  box-shadow: 0 8px 24px var(--red-soft), inset 0 0 0 1px var(--red-primary); transform: translateY(-2px);
}
.opt-key {
  width: 28px; height: 28px; border-radius: 6px; background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; margin-top: 2px; transition: all 0.3s ease;
}
.opt.selected .opt-key { border-color: var(--red-primary); background: var(--red-primary); color: #fff; }
.opt-title { font-size: 15px; font-weight: 600; color: var(--text-main); line-height: 1.4; }
.opt-desc  { font-size: 13px; font-weight: 400; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* ANIMAÇÃO DE ERRO (TREMIDINHA) */
.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ==========================================================================
   BOTÕES PREMIUM
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--red-gradient); color: #fff; font-family: var(--font);
  font-size: 15px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border: none; border-radius: 10px; padding: 18px 36px; cursor: pointer; margin-top: 36px;
  transition: all 0.3s var(--ease-spring); flex-shrink: 0;
  box-shadow: 0 8px 24px var(--red-glow), inset 0 1px 1px rgba(255,255,255,0.2);
  position: relative; overflow: hidden;
}

/* Efeito de respiração suave e bonita (Smooth Glow) */
#s0 .btn { animation: smooth-glow 3.5s ease-in-out infinite; }
@keyframes smooth-glow {
  0%, 100% { box-shadow: 0 4px 16px rgba(208,31,42,0.3), inset 0 1px 1px rgba(255,255,255,0.2); transform: translateY(0); }
  50% { box-shadow: 0 12px 36px rgba(208,31,42,0.6), inset 0 1px 1px rgba(255,255,255,0.3); transform: translateY(-2px); }
}

.btn::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transition: all 0.5s ease;
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 12px 32px var(--red-glow), inset 0 1px 1px rgba(255,255,255,0.3); }
.btn:hover::after { left: 100%; }
.btn:active { transform: scale(0.96); box-shadow: 0 4px 12px var(--red-glow); }
.btn svg { transition: transform 0.3s var(--ease-spring); }
.btn:hover svg { transform: translateX(6px); }

/* ==========================================================================
   TELAS ESPECÍFICAS (S0 e RESULTADOS)
   ========================================================================== */
#s0 .welcome-tag {
  display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted);
  border: 1px solid rgba(208,31,42,0.3); border-radius: 30px; padding: 8px 20px;
  margin-bottom: 32px; background: rgba(208,31,42,0.05); backdrop-filter: blur(10px); flex-shrink: 0;
}
#s0 .welcome-tag .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red-primary);
  box-shadow: 0 0 12px var(--red-primary); animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(1.5)} }

#s0 h1 { font-size: clamp(38px, 6vw, 72px); font-weight: 800; line-height: 1.05; text-align: center; max-width: 800px; margin-bottom: 24px; letter-spacing: -0.03em; flex-shrink: 0; }
#s0 .welcome-sub { font-size: 18px; font-weight: 400; color: var(--text-muted); text-align: center; max-width: 580px; line-height: 1.7; margin-bottom: 48px; flex-shrink: 0; }

/* Correção de alinhamento com Flexbox nos números */
#s0 .stats {
  display: flex; border: 1px solid var(--border-subtle); border-radius: 16px; width: 100%; max-width: 600px;
  overflow: hidden; margin-bottom: 48px; background: rgba(24, 24, 27, 0.4);
  backdrop-filter: blur(16px); box-shadow: 0 8px 32px rgba(0,0,0,0.15); transition: transform 0.3s ease;
  flex-shrink: 0;
}
#s0 .stats:hover { transform: translateY(-4px); border-color: rgba(255,255,255,0.1); }
#s0 .stat { 
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 32px; text-align: center; border-right: 1px solid var(--border-subtle); flex: 1; 
}
#s0 .stat:last-child { border-right: none; }
#s0 .stat-num  { font-size: 26px; font-weight: 800; color: var(--text-main); line-height: 1; margin-bottom: 6px; letter-spacing: -0.02em; }
#s0 .stat-label{ font-size: 11px; font-weight: 600; color: var(--text-muted); line-height: 1; letter-spacing: 0.06em; text-transform: uppercase; }

/* Result Wrap */
.result-wrap { display: flex; flex-direction: column; align-items: center; max-width: 560px; text-align: center; flex-shrink: 0; }
.result-icon {
  width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin-bottom: 32px; position: relative;
  background: linear-gradient(135deg, rgba(208,31,42,0.2) 0%, rgba(208,31,42,0.05) 100%);
  border: 1px solid rgba(208,31,42,0.2); box-shadow: 0 0 32px var(--red-soft);
}
.result-icon::before {
  content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 1px solid var(--red-glow);
  animation: ring 2.5s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
@keyframes ring { 0%{transform:scale(1);opacity:0.8} 100%{transform:scale(1.6);opacity:0} }

.result-title { font-size: clamp(32px, 5vw, 48px); font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 20px; }
.result-desc { font-size: 16px; font-weight: 400; color: var(--text-muted); line-height: 1.7; margin-bottom: 8px; }
.result-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 40px; width: 100%; }
.result-btns .btn { margin-top: 0; width: 100%; max-width: 320px; }
.powered { margin-top: 48px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #3F3F46; }

/* ==========================================================================
   MOBILE - TOTALMENTE RESPONSIVO E SEGURO CONTRA CORTES
   ========================================================================== */
@media (max-width: 600px) {
  /* O SEGREDO DO SCROLL SEGURO NO IPHONE E SAFARI:
     No celular, abandonamos o "justify-content: center" que causa o corte do topo 
     e usamos flex-start + padding para empurrar o conteúdo para o meio com segurança. */
  .slide { 
    justify-content: flex-start; 
    padding: 100px 20px 120px; 
  }

  .opts.two-col { grid-template-columns: 1fr; }
  #topbar { padding: 0 20px; height: 60px; }
  #fnav { bottom: 16px; right: 16px; }
  #save-indicator { bottom: 16px; left: 20px; }
  
  /* Ajustes dos textos para celular */
  #s0 h1, .slide h2 { font-size: 32px; margin-bottom: 12px; }
  #s0 .welcome-sub, .slide .sub { font-size: 15px; margin-bottom: 32px; padding: 0 10px; line-height: 1.5; }
  
  /* Mantendo o bloco de stats igual ao de desktop, mas em coluna no celular */
  #s0 .stats { flex-direction: column; border-radius: 12px; margin-bottom: 24px; }
  #s0 .stat { border-right: none; border-bottom: 1px solid var(--border-subtle); padding: 16px 20px; }
  #s0 .stat:last-child { border-bottom: none; }
  
  /* Inputs confortáveis */
  .field input { font-size: 16px; padding: 16px 20px; }
  .opt { padding: 16px 20px; }
  
  /* Botão em largura total */
  .btn { width: 100%; max-width: 100%; padding: 16px 24px; font-size: 14px; margin-top: 16px; }
}