// Quiz screen — 5 dynamic questions, sound effects, animated feedback const QUESTIONS = [ { q: 'Qual a maior estrela portuguesa de sempre em Mundiais?', sub: 'Há mais do que uma resposta certa 😉', type: 'choice', options: [ { label: 'Eusébio', emoji: '🏆', correct: true }, { label: 'Figo', emoji: '⭐', correct: true }, { label: 'Pauleta', emoji: '⚽', correct: true }, { label: 'Cristiano', emoji: '🐐', correct: true }, ], hint: 'Todos contam! +5%', }, { q: 'Quantos craques tem o álbum completo?', sub: '48 seleções no Mundial 2026', type: 'choice', options: [ { label: '512', correct: false }, { label: '736', correct: true }, { label: '850', correct: false }, { label: '1024', correct: false }, ], hint: '736 cromos · acerta para +10%', }, { q: 'Que tipo de colecionador és tu?', sub: 'Não há resposta errada — só perfis!', type: 'persona', options: [ { label: 'Casual', sub: 'Só os meus favoritos', emoji: '😎', kit: 'Basic' }, { label: 'Sério', sub: 'Quero a maioria', emoji: '🎯', kit: 'Inicial' }, { label: 'Competitivo', sub: 'Tenho de completar', emoji: '🔥', kit: 'Campeão' }, { label: 'Lenda', sub: 'Coleção + duplicados', emoji: '👑', kit: 'Colecionador' }, ], }, { q: 'Vais ver quantos jogos do Mundial?', sub: 'Arrasta o slider', type: 'slider', min: 0, max: 64, default: 20, labels: ['0', 'só finais', 'metade', 'todos!'], }, { q: 'Qual é o teu cromo dos sonhos?', sub: 'Toca no que te chama mais', type: 'cromo', options: [ { team: 'POR', num: 7, name: 'Cristiano Ronaldo', pos: 'AVA', img: 'uploads/ronaldo-figurinha.webp', rare: true }, { team: 'POR', num: 22, name: 'Diogo Costa', pos: 'GR', img: 'uploads/diogo-costa-figurinha.jpg' }, { team: 'POR', num: 18, name: 'Rúben Neves', pos: 'MEI', img: 'uploads/ruben-neves-figurinha.jpg' }, { team: 'POR', num: 17, name: 'Francisco Trincão', pos: 'AVA', img: 'uploads/francisco-trincao-figurinha.jpg' }, ], }, ]; function Quiz({ onComplete }) { const [step, setStep] = React.useState(0); const [answers, setAnswers] = React.useState([]); const [feedback, setFeedback] = React.useState(null); // {correct, points} const [sliderVal, setSliderVal] = React.useState(20); const [transitioning, setTransitioning] = React.useState(false); const Q = QUESTIONS[step]; React.useEffect(() => { window.Sound?.playWhistle(); }, []); const advance = (data) => { const next = [...answers, data]; setAnswers(next); setTransitioning(true); setTimeout(() => { setFeedback(null); if (step + 1 >= QUESTIONS.length) { window.Sound?.playGoal(); onComplete(next); } else { setStep(step + 1); setTransitioning(false); } }, 1100); }; const onChoice = (opt) => { if (transitioning) return; const correct = opt.correct !== false; if (correct) window.Sound?.playGoal(); else window.Sound?.playWrong(); setFeedback({ correct, label: opt.label }); advance({ q: step, choice: opt.label, correct, kit: opt.kit }); }; const onSlider = () => { window.Sound?.playWhistle(); setFeedback({ correct: true, label: `${sliderVal} jogos` }); setTransitioning(true); advance({ q: step, value: sliderVal }); }; return (