/* SimbiosysAPP — Test de diagnóstico (/test/)
   Se carga después de styles.css y usa sus colores y letras. Solo modo claro. */

.pagina-test { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pagina-test .test { flex: 1 0 auto; overflow-x: clip; }

/* ---------- barra de progreso (bajo la cabecera) ---------- */
.test__barra { height: 4px; margin: 0 26px 14px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.test__progreso { display: block; height: 100%; width: 0; background: var(--cian); border-radius: 4px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }

.test__contenedor { max-width: calc(760px + var(--gutter) * 2); padding-bottom: 56px; }
.test__arriba { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; margin-top: 8px; }
.test__atras {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 6px; margin-left: -6px;
  background: none; border: 0; border-radius: 10px; font: inherit; font-weight: 700; font-size: .9375rem; color: var(--gris); cursor: pointer;
}
.test__atras:hover { color: var(--texto); }
.test__atras svg { width: 20px; height: 20px; }
.test__paso { margin-left: auto; color: var(--gris); font-size: .875rem; font-weight: 600; text-align: right; }

/* ---------- entrada de cada pantalla ---------- */
.test__pantalla { outline: none; }
.entra { animation: entraDer .45s cubic-bezier(.2, .8, .2, 1); }
.entra--atras { animation: entraIzq .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes entraDer { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes entraIzq { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

/* ---------- portada ---------- */
.portada-test { padding: clamp(24px, 6vh, 72px) 0 24px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.portada-test .entrada { margin: 18px auto 0; }
.portada-test .boton { margin-top: 32px; }
.portada-test__icono {
  display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; margin-bottom: 22px;
  border-radius: 24px; background: #fff; border: 1px solid var(--linea); box-shadow: var(--sombra);
}
.portada-test__icono img { width: 40px; height: auto; }
.portada-test__nota { margin-top: 16px; color: var(--gris); font-size: .9375rem; }

.boton--grande { min-height: 56px; padding: 14px 28px; font-size: 1.0625rem; }
.boton svg { width: 20px; height: 20px; }

/* ---------- pregunta ---------- */
.pregunta { padding-top: 8px; }
.titular--pregunta { font-size: clamp(1.55rem, 1.15rem + 2vw, 2.35rem); outline: none; }
.titular--portada, .titular--seccion { outline: none; }
.portada-test .titular--portada { font-size: clamp(38px, 6vw, 76px); }
.resultado__titulo.titular--seccion { font-size: clamp(30px, 4vw, 48px); line-height: 1.1; }
.pregunta__ayuda { margin-top: 10px; color: var(--gris); }
.pregunta__subtitulo { margin: 32px 0 0; font-size: 1.1875rem; font-weight: 800; letter-spacing: -0.02em; }
.pregunta__extra { margin-top: 16px; }
.pregunta__pie {
  position: sticky; bottom: 0; z-index: 5; margin-top: 16px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #fff 70%, rgba(255, 255, 255, 0));
}
.pregunta__pie:not(:has(.boton)):not(:has(.reaccion--visible)) { padding: 0; }
@media (max-width: 560px) { .pregunta__pie .boton, .portada-test .boton, .resultado .boton, .formulario--test .boton { width: 100%; } }

/* ---------- opciones grandes para tocar ---------- */
.opciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 24px; }
@media (max-width: 420px) { .opciones { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.opcion {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 132px; padding: 20px 12px; text-align: center;
  background: #fff; border: 1.5px solid var(--linea-fuerte); border-radius: 20px;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.3; color: var(--texto); cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.opcion:hover { border-color: var(--acento); box-shadow: 0 6px 18px rgba(21, 108, 221, .1); }
.opcion:active { transform: scale(.97); }
.opcion__icono {
  display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px;
  border-radius: 20px; background: var(--palido); color: var(--acento); transition: background-color .15s ease, color .15s ease;
}
.opcion__icono svg { width: 34px; height: 34px; }
.opcion__grande { font-family: var(--fuente-titular); font-size: 2.1rem; letter-spacing: -0.04em; line-height: 1; color: var(--acento); }
.opcion__grande small { font-size: .5em; margin-left: 2px; letter-spacing: 0; color: var(--gris); }
.opcion[aria-pressed="true"] { border-color: var(--acento); background: #f1f6ff; box-shadow: 0 0 0 3px rgba(21, 108, 221, .15); }
.opcion[aria-pressed="true"] .opcion__icono { background: var(--acento); color: #fff; }
.opcion__marca {
  position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid var(--linea-fuerte); background: #fff;
}
.opcion[aria-pressed="true"] .opcion__marca {
  background: var(--acento) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat;
  border-color: var(--acento);
}

/* lista para opciones con texto largo */
.opciones--lista { grid-template-columns: 1fr; gap: 10px; }
.opciones--lista .opcion { flex-direction: row; justify-content: flex-start; min-height: 68px; padding: 12px 52px 12px 14px; text-align: left; gap: 14px; }
.opciones--lista .opcion__icono { width: 44px; height: 44px; border-radius: 14px; flex: none; }
.opciones--lista .opcion__icono svg { width: 24px; height: 24px; }
.opciones--lista .opcion__marca { top: 50%; transform: translateY(-50%); right: 16px; }

/* ---------- reacción tras cada respuesta ---------- */
.reaccion { align-self: flex-start; display: flex; }
.reaccion:empty { display: none; }
.reaccion__burbuja {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 16px 16px 16px 4px;
  background: var(--palido); color: #0f4fa8; font-weight: 700; line-height: 1.4;
  opacity: 0; transform: translateY(6px) scale(.98);
}
.reaccion__burbuja svg { width: 20px; height: 20px; flex: none; }
.reaccion--visible .reaccion__burbuja { animation: burbuja .35s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes burbuja { to { opacity: 1; transform: none; } }

/* ---------- respuesta abierta con micrófono ---------- */
.abierta { display: grid; gap: 12px; margin-top: 20px; }
.abierta__texto { min-height: 120px; resize: vertical; line-height: 1.5; }
.microfono {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 20px;
  border: 0; border-radius: 18px; background: var(--acento); color: #fff;
  font: inherit; font-weight: 800; font-size: 1.0625rem; cursor: pointer;
  box-shadow: 0 8px 22px rgba(21, 108, 221, .25); transition: background-color .2s ease;
}
.microfono:hover { background: var(--acento-hover); }
.microfono__icono { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.microfono__icono svg { width: 24px; height: 24px; }
.microfono--activo { background: var(--texto); box-shadow: 0 0 0 0 rgba(21, 108, 221, .45); }
.microfono--activo:hover { background: var(--texto); }
@media (prefers-reduced-motion: no-preference) {
  .microfono--activo { animation: latido 1.6s ease-out infinite; }
}
@keyframes latido { 0% { box-shadow: 0 0 0 0 rgba(21, 108, 221, .45); } 100% { box-shadow: 0 0 0 16px rgba(21, 108, 221, 0); } }
.abierta__audio { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.abierta__audio audio { flex: 1 1 220px; min-width: 0; height: 44px; }
.abierta__nota { color: var(--gris); font-size: .875rem; min-height: 1.2em; }
.enlace-boton { min-height: 44px; padding: 0 8px; background: none; border: 0; font: inherit; font-weight: 700; color: var(--acento); cursor: pointer; }

/* ---------- contacto ---------- */
.formulario--test { margin-top: 24px; }
.casilla { display: flex; align-items: flex-start; gap: 12px; font-weight: 500 !important; font-size: .9375rem !important; color: var(--gris); line-height: 1.5; cursor: pointer; }
.casilla input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--acento); cursor: pointer; }
.casilla a { font-weight: 700; }

/* ---------- resultado ---------- */
.resultado { padding: clamp(16px, 4vh, 48px) 0 16px; }
.resultado__rotulo { font-weight: 800; color: var(--gris); text-transform: uppercase; letter-spacing: .06em; font-size: .875rem; }
.resultado__cifra { margin-top: 6px; font-family: var(--fuente-titular); font-size: clamp(4rem, 3rem + 5vw, 6rem); line-height: 1; letter-spacing: -0.05em; }
.resultado__sobre { font-size: .35em; color: var(--gris); letter-spacing: -0.02em; margin-left: 4px; }
.resultado__barra { position: relative; height: 16px; margin-top: 22px; border-radius: 999px; background: var(--linea); overflow: hidden; }
.resultado__barra span { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; }
.resultado__barra i { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.resultado--verde .resultado__barra span { background: #16a34a; }
.resultado--amarillo .resultado__barra span { background: #eab308; }
.resultado--rojo .resultado__barra span { background: #dc2626; }
.resultado__escala { position: relative; height: 20px; margin-top: 6px; font-size: .75rem; font-weight: 700; color: var(--gris); }
.resultado__escala span { position: absolute; transform: translateX(-50%); }
.resultado__escala span:nth-child(1) { left: 0; transform: none; }
.resultado__escala span:nth-child(2) { left: 35%; }
.resultado__escala span:nth-child(3) { left: 65%; }
.resultado__escala span:nth-child(4) { right: 0; transform: none; }
.resultado__titulo { margin-top: 28px; }
.resultado .entrada { margin-top: 12px; }
.resultado .boton { margin-top: 28px; }
.resultado__correo { margin-top: 16px; color: var(--gris); font-size: .9375rem; }
.resultado__correo strong { color: var(--texto); overflow-wrap: anywhere; }
.resultado .pendiente { margin-top: 16px; }

.pie--test { padding: 24px 0 28px; }

/* ---------- Escenas animadas encima de cada pregunta ----------
   Dibujos de 160×96 con los colores de la marca. Si el dispositivo
   pide reducir el movimiento, se ven quietos. */
.escena { height: 84px; margin-bottom: 12px; }
.escena svg { height: 100%; width: auto; overflow: hidden; }
@media (min-width: 720px) { .escena { height: 104px; margin-bottom: 16px; } }

.escena * { transform-box: fill-box; transform-origin: center; }
.escena .esc-vb { transform-box: view-box; }

.esc-acento { fill: var(--acento); }
.esc-palido { fill: var(--palido); }
.esc-palido-f { fill: #a9c8f8; }
.esc-blanco { fill: #fff; }
.esc-tinta { fill: var(--texto); }
.esc-borde-a { stroke: var(--acento); stroke-width: 2.5; }
.esc-borde-l { stroke: var(--linea-fuerte); stroke-width: 2; stroke-dasharray: 5 5; }
.esc-borde-b { fill: none; stroke: #fff; stroke-width: 2; }
.esc-linea-a, .esc-icono, .esc-gruesa, .esc-tinta-trazo, .esc-acento-trazo, .esc-suelo, .esc-grieta, .esc-estela {
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.esc-linea-a { stroke: var(--acento); stroke-width: 2; }
.esc-icono { stroke: var(--acento); stroke-width: 2; }
.esc-icono--fino { stroke-width: 1.4; }
.esc-gruesa { stroke: var(--acento); stroke-width: 4; }
.esc-tinta-trazo { stroke: var(--texto); stroke-width: 4; }
.esc-acento-trazo { stroke: var(--acento); stroke-width: 3; }
.esc-suelo { stroke: var(--linea-fuerte); stroke-width: 4; }
.esc-grieta { stroke: var(--linea-fuerte); stroke-width: 1.5; }
.esc-estela { stroke: #a9c8f8; stroke-width: 3; stroke-dasharray: 1 8; }
.esc-num { fill: #fff; font: 800 10px var(--fuente); text-anchor: middle; }
.esc-dia { fill: var(--texto); font: 700 22px var(--fuente-titular); text-anchor: middle; }
.esc-punto { fill: var(--palido); }

/* Estado quieto (también el de «reducir movimiento»): un solo icono y un solo día */
.esc-ciclo, .esc-dia { opacity: 0; }
.esc-ciclo--1, .esc-dia--1 { opacity: 1; }
.esc-punto:first-of-type { fill: var(--acento); }

@media (prefers-reduced-motion: no-preference) {
  .esc-ciclo { animation: escCiclo 8s ease-in-out infinite both; }
  .esc-punto { animation: escPunto 8s steps(1) infinite; }
  .esc-persona { animation: escPersona 4.5s cubic-bezier(.3, 1.4, .5, 1) infinite both; transform-origin: center bottom; }
  .esc-flota { animation: escFlota var(--d, 3s) ease-in-out infinite; }
  .esc-aguja-m { animation: escGiro 1.5s linear infinite; }
  .esc-aguja-h { animation: escGiro 18s linear infinite; }
  .esc-gira { animation: escGiro 3s linear infinite; }
  .esc-moneda { animation: escMoneda 3.2s ease-in infinite both; }
  .esc-noti { animation: escNoti 2.4s ease-out infinite both; }
  .esc-latido { animation: escLatido 1.2s ease-in-out infinite; }
  .esc-pieza { animation: escOrdena 4s cubic-bezier(.5, 0, .2, 1) infinite both; }
  .esc-varita { animation: escVarita 4s ease-in-out infinite; }
  .esc-chispa { animation: escChispa 1.6s ease-in-out infinite both; }
  .esc-viaja { animation: escViaja 1.5s linear infinite both; }
  .esc-vuelve { animation: escVuelve 1.5s linear infinite both; }
  .esc-dia { animation: escDia 3s steps(1) infinite; }
  .esc-cohete { animation: escCohete 3s ease-in infinite; }
  .esc-humo { animation: escHumo 1.5s ease-out infinite both; }
  .esc-sobre { animation: escSobre 3.4s ease-in-out infinite both; }

  /* Al tocar una opción, su icono da un saltito */
  .opcion[aria-pressed="true"] .opcion__icono svg,
  .opcion[aria-pressed="true"] .opcion__grande { animation: escSalto .45s cubic-bezier(.3, 1.6, .5, 1); }
}

@keyframes escCiclo { 0% { opacity: 0; transform: translateY(10px); } 4%, 22% { opacity: 1; transform: none; } 27%, 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes escPunto { 0% { fill: var(--acento); } 25%, 100% { fill: var(--palido); } }
@keyframes escPersona { 0% { opacity: 0; transform: translateY(8px) scale(.5); } 12%, 80% { opacity: 1; transform: none; } 92%, 100% { opacity: 0; transform: none; } }
@keyframes escFlota { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-7px) rotate(var(--r, 0deg)); } }
@keyframes escGiro { to { transform: rotate(360deg); } }
@keyframes escMoneda {
  0% { opacity: 0; transform: translateX(-60px) rotate(0); }
  8% { opacity: 1; }
  45% { transform: translateX(0) rotate(360deg); }
  55% { opacity: 1; transform: translateY(5px) rotate(380deg); }
  82% { opacity: 0; transform: translateY(42px) rotate(440deg); }
  100% { opacity: 0; transform: translateY(42px); }
}
@keyframes escNoti { 0% { opacity: 0; transform: scale(.4); } 12% { opacity: 1; transform: scale(1.08); } 18%, 70% { opacity: 1; transform: none; } 85%, 100% { opacity: 0; transform: translateY(-6px); } }
@keyframes escLatido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
@keyframes escOrdena {
  0%, 12% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); }
  45%, 85% { transform: none; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); }
}
@keyframes escVarita { 0%, 40%, 100% { transform: rotate(0); } 10% { transform: rotate(-14deg); } 22% { transform: rotate(10deg); } 32% { transform: rotate(-4deg); } }
@keyframes escChispa { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
@keyframes escViaja { 0% { opacity: 0; transform: translateX(0); } 20%, 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(34px); } }
@keyframes escVuelve { 0% { opacity: 0; transform: translateX(0); } 20%, 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-34px); } }
@keyframes escDia { 0% { opacity: 1; } 33.3%, 100% { opacity: 0; } }
@keyframes escCohete {
  0%, 30% { opacity: 1; transform: none; }
  34% { transform: translate(1px, 1px); } 38% { transform: translate(-1px, 0); } 42% { transform: none; }
  75% { opacity: 0; transform: translate(34px, -40px); }
  76%, 88% { opacity: 0; transform: none; }
  100% { opacity: 1; transform: none; }
}
@keyframes escHumo { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6) translateY(4px); } }
@keyframes escSobre {
  0% { opacity: 0; transform: translate(-72px, 34px) rotate(-12deg); }
  15% { opacity: 1; }
  50%, 70% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translate(34px, -30px) rotate(8deg); }
}
@keyframes escSalto { 0% { transform: scale(1); } 40% { transform: scale(1.25) translateY(-3px); } 100% { transform: none; } }

/* ---------- Campos cortos «¿Cuál?» ---------- */
.abierta--corta { gap: 8px; margin-top: 16px; }
.abierta--corta .abierta__texto { min-height: 0; }
.abierta__etiqueta { font-weight: 700; font-size: .9375rem; }

/* ---------- Escenas de las preguntas de contexto ---------- */
@media (prefers-reduced-motion: no-preference) {
  .esc-escribe { transform-origin: left center; animation: escEscribe 3.6s ease-in-out infinite both; }
  .esc-cursor { animation: escCursor 1s steps(1) infinite; }
  .esc-tarjeta { animation: escTarjeta 3s ease-in-out infinite both; }
}
@keyframes escEscribe { 0% { transform: scaleX(0); } 30%, 80% { transform: scaleX(1); } 100% { transform: scaleX(0); opacity: 0; } }
@keyframes escCursor { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes escTarjeta {
  0% { transform: translate(-44px, 14px) rotate(-12deg); opacity: 0; }
  20% { opacity: 1; }
  50%, 75% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(0, 0); opacity: 0; }
}
