:root {
  --teal: #2AB7A9;
  --lima: #9BC53D;
  --grad: linear-gradient(135deg, var(--teal), var(--lima));
  --ink: #1e2a2b;
  --gris: #6b7a7b;
  /* Colores canon IRHP (definición de Gonzalo) */
  --rojo: #E74C3C;
  --amarillo: #F1C40F;
  --verde: #2ECC71;
}

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

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: #fff;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
  position: relative;
}

.screen { display: none; animation: fade .3s ease; }
.screen.active { display: flex; flex-direction: column; gap: 18px; min-height: 70vh; min-height: 70dvh; justify-content: center; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Inicio */
.hero { text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.logo { margin: 0; line-height: 0; }
.logo img { width: min(62vw, 240px); height: auto; }
.logo-cta { width: min(38vw, 150px); height: auto; align-self: center; margin-top: 6px; }
.claim { font-size: 1.45rem; font-weight: 700; line-height: 1.25; }
.sub { color: var(--gris); font-size: 1rem; }

/* Botones */
.btn-primary {
  display: block;
  width: 100%;
  padding: 18px 24px;
  border: 0;
  border-radius: 16px;
  background: var(--grad);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform .1s ease, box-shadow .15s ease;
  box-shadow: 0 4px 14px rgba(42,183,169,.35);
}
.btn-primary:active { transform: scale(.98); }
.btn-ghost {
  background: none;
  border: 0;
  color: var(--gris);
  font-size: 1rem;
  padding: 12px;
  cursor: pointer;
  text-decoration: underline;
}

h2 { font-size: 1.35rem; line-height: 1.3; }
.hint { color: var(--gris); font-size: .95rem; }
.or { text-align: center; color: var(--gris); }
.paso { color: #157a71; font-weight: 700; font-size: .9rem; letter-spacing: .06em; }

/* Opciones grandes */
.opts { display: flex; flex-direction: column; gap: 12px; }
.opts button {
  padding: 18px;
  border: 2px solid #e3ebe9;
  border-radius: 16px;
  background: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color .12s ease, background .12s ease;
}
.opts button:active { border-color: var(--teal); background: #f0faf8; }

/* Autocomplete */
.autocomplete { position: relative; }
.autocomplete input {
  width: 100%;
  padding: 16px;
  border: 2px solid #e3ebe9;
  border-radius: 16px;
  font-size: 1.05rem;
  outline: none;
}
.autocomplete input:focus { border-color: var(--teal); }
#ac-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #e3ebe9;
  border-radius: 12px;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
#ac-list li { padding: 14px 16px; cursor: pointer; font-size: 1rem; }
#ac-list li:active, #ac-list li:hover { background: #f0faf8; }

.err { color: var(--rojo); font-size: .95rem; }

/* Semáforo */
.semaforo {
  width: 92px;
  margin: 0 auto;
  background: #24312f;
  border-radius: 26px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.luz {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: #3a4a47;
  transition: background .3s ease, box-shadow .3s ease;
}
.semaforo.rojo .roja { background: var(--rojo); box-shadow: 0 0 28px var(--rojo); animation: pulso 1.6s ease infinite; }
.semaforo.amarillo .amarilla { background: var(--amarillo); box-shadow: 0 0 28px var(--amarillo); animation: pulso 1.6s ease infinite; }
.semaforo.verde .verde { background: var(--verde); box-shadow: 0 0 28px var(--verde); animation: pulso 1.6s ease infinite; }
@keyframes pulso { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }

#s-resultado { text-align: center; }
#s-resultado h2 { font-size: 1.5rem; }
.res-zona { color: var(--gris); font-size: 1rem; }
.razones { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.razones li {
  background: #f5f9f8;
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .98rem;
  line-height: 1.4;
}

/* Loader */
.loader {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.92);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.loader[hidden] { display: none; }
.spin {
  width: 44px; height: 44px;
  border: 4px solid #e3ebe9;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
.loader p { color: var(--gris); }

footer {
  text-align: center;
  color: var(--gris);
  font-size: .8rem;
  line-height: 1.5;
  padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
}

/* Marca chica en recorrido */
.screen { position: relative; }
.logo-mini { position: absolute; top: 4px; left: 0; width: 84px; height: auto; }
/* En las preguntas va a la derecha: el "1 de 3" y el título arrancan a la izquierda */
#s-ubicacion .logo-mini, #s-q1 .logo-mini, #s-q2 .logo-mini, #s-q3 .logo-mini { left: auto; right: 0; }
/* Aire arriba para que el contenido centrado nunca pise la marca en pantallas cortas */
#s-ubicacion.active, #s-q1.active, #s-q2.active, #s-q3.active { padding-top: 72px; min-height: calc(70vh - 72px); min-height: calc(70dvh - 72px); }

/* Crédito AgentNeo en portada */
.credito { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; color: var(--gris); font-size: .78rem; text-decoration: none; }
.credito b { color: #157a71; }

/* Estabilidad táctil + accesibilidad de movimiento */
button, .btn-primary, .btn-ghost, #ac-list li { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h2 { outline: none; }
@media (prefers-reduced-motion: reduce) {
  .screen, .luz, .spin, .semaforo .roja, .semaforo .amarilla, .semaforo .verde { animation: none !important; transition: none !important; }
}

/* Formulario de lead (pantalla resultado) */
.lead, .lead-ok { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.lead[hidden], .lead-ok[hidden] { display: none; }
.lead h3, .lead-ok h3 { margin: 0; font-size: 1.15rem; }
.lead input[type="text"], .lead input[type="tel"], .lead input[type="email"] {
  width: 100%; box-sizing: border-box; padding: 14px 16px; font-size: 1rem;
  border: 2px solid #dfe7e7; border-radius: 14px; outline: none; font-family: inherit;
}
.lead input:focus { border-color: var(--teal); }
.lead .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.consent { display: flex; gap: 6px; align-items: flex-start; text-align: left; font-size: .72rem; color: var(--gris); line-height: 1.3; }
.consent input { margin: 1px 0 0; width: 14px; height: 14px; flex: none; }
.consent a { color: var(--gris); }
.btn-primary[hidden] { display: none; }

/* Portada: contenido informativo debajo del hero (SEO/GEO + confianza) */
#s-inicio .hero { min-height: 78vh; min-height: 78dvh; justify-content: center; }
#s-inicio .credito { position: static; margin-top: 8px; }
.info { display: flex; flex-direction: column; gap: 14px; padding-top: 12px; border-top: 1px solid #e3ebe9; }
.info h2 { font-size: 1.2rem; margin-top: 10px; }
.pasos, .analiza { padding-left: 1.3em; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; }
.faq { display: flex; flex-direction: column; gap: 8px; }
.faq details { border: 1px solid #e3ebe9; border-radius: 12px; padding: 12px 14px; }
.faq summary { font-weight: 600; cursor: pointer; line-height: 1.35; }
.faq details p { margin-top: 8px; color: var(--gris); line-height: 1.5; font-size: .95rem; }

/* Contacto */
#s-contacto.active { padding-top: 72px; justify-content: flex-start; }
#s-contacto .claim { font-size: 1.6rem; }
.lead select, .lead textarea {
  width: 100%; box-sizing: border-box; padding: 14px 16px; font-size: 1rem; font-family: inherit;
  border: 2px solid #dfe7e7; border-radius: 14px; outline: none; background: #fff; color: var(--ink);
}
.lead textarea { resize: vertical; min-height: 120px; }
.lead select:focus, .lead textarea:focus { border-color: var(--teal); }
footer a { color: var(--gris); }
