function submitTest() {
    const totalQuestions = 20;
    let score = 0;

    for (let i = 1; i <= totalQuestions; i++) {
        const question = document.querySelector(`input[name="q${i}"]:checked`);
        if (question && question.value === '1') {
            score++;
        }
    }

    let result = "";

    if (score >= 16) {
        result = "Autismo Común";
        window.location.href = "autismo-comun.html";
    } else if (score >= 12 && score < 16) {
        result = "Síndrome de Asperger";
        window.location.href = "sindrome-asperger.html";
    } else if (score >= 8 && score < 12) {
        result = "Trastorno Desintegrativo Infantil";
        window.location.href = "trastorno-desintegrativo-infantil.html";
    } else {
        result = "Trastorno Generalizado del Desarrollo";
        window.location.href = "trastorno-generalizado-desarrollo.html";
    }

    alert("Resultado: " + result);
}
