:root{--page-title-display:none;}/* Start custom CSS */<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>Quiz de Vitalidad</title>

<!-- Meta Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '1027270116685443');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1027270116685443&ev=PageView&noscript=1"
/></noscript>
<!-- End Meta Pixel Code -->

<style>
  :root{
    --bg:#FFFFFF;
    --page-bg:#FFFFFF;
    --border:#E5E7EB;
    --text:#111827;
    --text-secondary:#6B7280;
    --accent:#2E9E6D;
    --accent-light:#F0FDF4;
    --track-inactive:#E5E7EB;
  }
  *{box-sizing:border-box;}
  body{
    margin:0;
    background:var(--page-bg);
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
    color:var(--text);
  }
  header.brand{
    text-align:center;
    padding:22px 20px 16px;
    font-size:22px;
    font-weight:800;
    letter-spacing:-0.02em;
  }
  .wrap{
    max-width:500px;
    margin:0 auto;
    padding:10px 20px 60px;
  }
  
  .track{
    display:flex;
    align-items:center;
    justify-content:center;
    margin-bottom:32px;
  }
  .track .line{
    width:80px;
    height:3px;
    background:var(--track-inactive);
  }
  .track .line.done{ background:var(--accent); }
  .track .dot{
    width:24px; height:24px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-size:11px; font-weight:700; color:#9CA3AF;
    border:2px solid var(--track-inactive); background:#fff; flex-shrink:0;
  }
  .track .dot.done, .track .dot.current{
    background:var(--accent); color:#fff; border-color:var(--accent);
  }

  h1.question{
    font-size:21px;
    font-weight:800;
    text-align:center;
    line-height:1.35;
    margin:0 0 6px;
    letter-spacing:-0.01em;
  }
  p.subtitle{
    font-size:14px;
    color:var(--text-secondary);
    text-align:center;
    margin:0 0 28px;
  }

  .options-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
    margin-bottom:24px;
  }
  .options-list{
    display:flex;
    flex-direction:column;
    gap:12px;
    margin-bottom:24px;
  }

  .option-card{
    background:#fff;
    border:1.5px solid var(--border);
    border-radius:14px;
    padding:20px 14px;
    font-size:14.5px;
    font-weight:600;
    color:var(--text);
    text-align:center;
    cursor:pointer;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    transition:all .18s ease;
    box-shadow:0 1px 2px rgba(0,0,0,0.02);
  }
  .option-card:hover{ border-color:var(--accent); background:var(--accent-light); }
  .option-card.selected{ border-color:var(--accent); background:var(--accent-light); box-shadow:0 0 0 1px var(--accent); }
  
  .card-media{
    width:56px;
    height:56px;
    margin-bottom:12px;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  .card-media img{
    width:100%;
    height:100%;
    object-fit:contain;
  }
  .card-media .emoji-icon{
    font-size:38px;
    line-height:1;
  }

  .skip-link{
    display:block;
    text-align:center;
    font-size:14px;
    text-decoration:underline;
    color:var(--text-secondary);
    margin-bottom:22px;
    cursor:pointer;
    background:none; border:none;
  }
  .nav-row{
    display:flex;
    gap:12px;
  }
  .btn{
    flex:1;
    padding:16px 20px;
    border-radius:10px;
    font-size:15px;
    font-weight:800;
    cursor:pointer;
    text-transform:uppercase;
    letter-spacing:0.03em;
    border:1.5px solid transparent;
    transition:background .15s ease;
  }
  .btn-back{
    background:#fff;
    border-color:var(--border);
    color:var(--text);
    flex:0 0 90px;
  }
  .btn-back:hover{ background:#F9FAFB; }
  .btn-next{
    background:var(--accent);
    color:#fff;
  }
  .btn-next:hover{ background:#268159; }
  .btn-next:disabled{
    background:#A7D9C3;
    cursor:not-allowed;
  }

  .chat-bubble{
    position:fixed;
    bottom:24px;
    right:24px;
    background:#fff;
    border:1px solid #E5E7EB;
    border-radius:12px;
    box-shadow:0 6px 20px rgba(0,0,0,0.08);
    padding:12px 16px;
    max-width:210px;
    font-size:12.5px;
    line-height:1.4;
    z-index:20;
  }
  .chat-bubble .close{
    position:absolute; top:6px; right:8px;
    cursor:pointer; color:#9CA3AF; font-size:14px;
    background:none; border:none;
  }
  .chat-bubble strong{ display:block; margin-bottom:2px; color:var(--text); }

  .loading-screen{
    text-align:center;
    padding:60px 20px;
  }
  .spinner{
    width:42px; height:42px; margin:0 auto 24px;
    border-radius:50%;
    border:3px solid var(--track-inactive);
    border-top-color:var(--accent);
    animation:spin .8s linear infinite;
  }
  @keyframes spin{ to{transform:rotate(360deg);} }
  .loading-text{ font-size:15px; font-weight:600; color:var(--text-secondary); }

  .results-screen{ text-align:center; }
  .result-icon{ font-size:48px; color:var(--accent); margin-bottom:12px; }
  h1.result-title{ font-size:20px; font-weight:800; margin:0 0 18px; line-height:1.4; }
  .result-card{
    background:var(--accent-light);
    border:1px solid #BBF7D0;
    border-radius:12px;
    padding:20px;
    text-align:left;
    margin-bottom:24px;
    font-size:14.5px;
    line-height:1.6;
    color:#166534;
  }
  .cta-button{
    display:block; width:100%;
    background:var(--accent); color:#fff;
    border:none; border-radius:10px;
    padding:18px 20px; font-size:16px; font-weight:800;
    cursor:pointer; text-transform:uppercase; letter-spacing:0.03em;
  }
  .cta-button:hover{ background:#268159; }

  footer{ text-align:center; padding:24px 20px; }
  footer a{ color:var(--text-secondary); font-size:11.5px; text-decoration:none; margin:0 6px; }
  footer a:hover{ text-decoration:underline; }
  .footer-disclaimer{ font-size:10px; color:#9CA3AF; max-width:440px; margin:10px auto 0; line-height:1.4; }
</style>
</head>
<body>

<header class="brand">Vital Euro Health</header>

<div class="wrap" id="wrap"></div>

<div class="chat-bubble" id="chatBubble">
  <button class="close" id="chatClose">✕</button>
  <strong>Hola :)</strong>
  Esto debería tardar menos de 60 segundos.
</div>

<script>
const REDIRECT_URL = "https://vitaleurohealth.store/adenofrin-es/";

const questions = [
  { 
    q: "¿En qué rango de edad te encuentras?", 
    sub: "Selecciona tu grupo de edad.",
    grid: true,
    multi: false,
    options: [
      { label: "35 a 44 años", icon: "👤" },
      { label: "45 a 54 años", icon: "👨" },
      { label: "55 años o más", icon: "👴" }
    ]
  },
  { 
    q: "¿Cómo evaluarías tu nivel de energía diaria?", 
    sub: "Elige la opción que mejor describe tu rutina.",
    grid: true,
    multi: false,
    options: [
      { label: "Excelente", icon: "⚡" },
      { label: "Fatiga por las tardes", icon: "🔋" },
      { label: "Bajo nivel constante", icon: "🛋️" }
    ]
  },
  { 
    q: "¿Qué te gustaría mejorar principal o prioritariamente?", 
    sub: "Puedes seleccionar varias opciones.",
    grid: true,
    multi: true,
    options: [
      { label: "Energía diaria", icon: "⚡" },
      { label: "Descanso nocturno", icon: "🌙" },
      { label: "Rendimiento físico", icon: "🛡️" },
      { label: "Claridad mental", icon: "🧠" }
    ]
  },
  { 
    q: "¿En qué momento del día notas más cansancio?", 
    sub: "",
    grid: false,
    multi: false,
    options: [
      { label: "Por la mañana, al despertar", icon: "🌅" },
      { label: "A mitad de la tarde (bajón de ritmo)", icon: "☀️" },
      { label: "Al finalizar la jornada laboral", icon: "🌙" }
    ]
  }
];

let currentStep = 0;
const selections = new Array(questions.length).fill(null);
const wrap = document.getElementById('wrap');

document.getElementById('chatClose').addEventListener('click', () => {
  document.getElementById('chatBubble').style.display = 'none';
});

function renderTrack(activeIndex){
  const totalDots = 3;
  const progressRatio = activeIndex / (questions.length - 1);
  let html = '<div class="track">';
  for (let i = 0; i < totalDots; i++){
    const dotState = i <= Math.round(progressRatio * (totalDots-1)) ? (i === Math.round(progressRatio*(totalDots-1)) ? 'current' : 'done') : '';
    html += `<div class="dot ${dotState}">${i+1}</div>`;
    if (i < totalDots-1){
      const lineDone = i < Math.round(progressRatio * (totalDots-1)) ? 'done' : '';
      html += `<div class="line ${lineDone}"></div>`;
    }
  }
  html += '</div>';
  return html;
}

function renderQuestion(index){
  const data = questions[index];
  let html = renderTrack(index);
  html += `<h1 class="question">${data.q}</h1>`;
  if (data.sub) html += `<p class="subtitle">${data.sub}</p>`;

  const containerClass = data.grid ? 'options-grid' : 'options-list';
  html += `<div class="${containerClass}" id="optionsWrap">`;

  data.options.forEach((opt, i) => {
    let mediaHtml = '';
    if (opt.image) {
      mediaHtml = `<div class="card-media"><img src="${opt.image}" alt="${opt.label}" /></div>`;
    } else if (opt.icon) {
      mediaHtml = `<div class="card-media"><span class="emoji-icon">${opt.icon}</span></div>`;
    }

    html += `
      <button type="button" class="option-card" data-i="${i}">
        ${mediaHtml}
        <span>${opt.label}</span>
      </button>
    `;
  });
  html += `</div>`;

  if (data.multi){
    html += `<button class="skip-link" id="skipBtn">Ninguna de las anteriores</button>`;
  }

  html += `<div class="nav-row">`;
  if (index > 0) html += `<button class="btn btn-back" id="backBtn">Atrás</button>`;
  html += `<button class="btn btn-next" id="nextBtn" ${data.multi ? 'disabled' : ''}>Siguiente</button>`;
  html += `</div>`;

  wrap.innerHTML = html;

  const selected = new Set(
    Array.isArray(selections[index]) ? selections[index] : (selections[index] !== null ? [selections[index]] : [])
  );

  document.querySelectorAll('.option-card').forEach(card => {
    const i = parseInt(card.dataset.i);
    if (selected.has(i)) card.classList.add('selected');

    card.addEventListener('click', () => {
      if (data.multi){
        card.classList.toggle('selected');
        if (card.classList.contains('selected')) selected.add(i); else selected.delete(i);
        selections[index] = Array.from(selected);
        document.getElementById('nextBtn').disabled = selected.size === 0;
      } else {
        document.querySelectorAll('.option-card').forEach(c => c.classList.remove('selected'));
        card.classList.add('selected');
        selections[index] = i;
        document.getElementById('nextBtn').disabled = false;
        setTimeout(goNext, 250);
      }
    });
  });

  if (document.getElementById('nextBtn')){
    document.getElementById('nextBtn').addEventListener('click', goNext);
  }
  if (document.getElementById('backBtn')){
    document.getElementById('backBtn').addEventListener('click', () => {
      currentStep--;
      renderQuestion(currentStep);
    });
  }
  if (document.getElementById('skipBtn')){
    document.getElementById('skipBtn').addEventListener('click', () => {
      selections[index] = [];
      goNext();
    });
  }
}

function goNext(){
  currentStep++;
  if (currentStep < questions.length){
    renderQuestion(currentStep);
  } else {
    renderLoading();
  }
}

function renderLoading(){
  wrap.innerHTML = `
    <div class="loading-screen">
      <div class="spinner"></div>
      <p class="loading-text" id="loadingText">Analizando tus respuestas...</p>
    </div>
  `;
  const messages = [
    "Analizando tus respuestas...",
    "Evaluando compatibilidad con tu perfil...",
    "¡Listo! Preparando tu recomendación..."
  ];
  let i = 0;
  const el = document.getElementById('loadingText');
  const interval = setInterval(() => {
    i++;
    if (i < messages.length) el.textContent = messages[i];
  }, 900);
  setTimeout(() => {
    clearInterval(interval);
    renderResults();
  }, 2800);
}

function renderResults(){
  // Dispara evento customizado quando o utilizador conclui o quiz
  if (typeof fbq !== 'undefined') {
    fbq('trackCustom', 'QuizCompleted');
  }

  wrap.innerHTML = `
    <div class="results-screen">
      <div class="result-icon">✓</div>
      <h1 class="result-title">Hemos preparado una recomendación personalizada para ti.</h1>
      <div class="result-card">
        Basado en tu perfil, un plan de bienestar diario con nutrientes de alta absorción es la opción más recomendada para acompañar tu ritmo diario.
      </div>
      <button class="cta-button" id="ctaBtn">VER RECOMENDACIÓN</button>
    </div>
    <footer>
      <a href="https://vitaleurohealth.store/privacy-policy/" target="_blank" rel="noopener">Privacy Policy</a> ·
      <a href="https://vitaleurohealth.store/cookie-policy/" target="_blank" rel="noopener">Cookie Policy</a>
      <p class="footer-disclaimer">Este sitio no es parte de Facebook ni de Facebook Inc.</p>
    </footer>
  `;
  
  document.getElementById('ctaBtn').addEventListener('click', () => {
    // Dispara o evento de Lead ao clicar para ir para a página do produto
    if (typeof fbq !== 'undefined') {
      fbq('track', 'Lead');
    }
    setTimeout(() => {
      window.location.href = REDIRECT_URL;
    }, 150);
  });
}

renderQuestion(0);
</script>

</body>
</html>/* End custom CSS */