// Reveal screen — animated discount unveil function Reveal({ answers, onContinue }) { const [phase, setPhase] = React.useState(0); // 0: spinning, 1: revealed const [display, setDisplay] = React.useState(0); // Compute discount from answers: base 15% + per question 5% bonus, capped const score = React.useMemo(() => { let d = 15; answers.forEach((a) => { if (a.correct !== false) d += 5; }); return Math.min(d, 35); }, [answers]); // Pick recommended kit from persona answer const recommended = React.useMemo(() => { const persona = answers.find((a) => a.kit); return persona?.kit || 'Campeão'; }, [answers]); React.useEffect(() => { window.Sound?.playReveal(); let raf; const start = Date.now(); const tick = () => { const t = (Date.now() - start) / 1000; if (t < 2.2) { setDisplay(Math.floor(Math.random() * 35)); raf = requestAnimationFrame(tick); } else { setDisplay(score); setPhase(1); window.Sound?.playGoal(); } }; raf = requestAnimationFrame(tick); return () => cancelAnimationFrame(raf); }, [score]); return (