 function checkCompletion(lineIdx) {

    const userWords = userAnswers[lineIdx] || [];

    const blanksWords = blanks[lineIdx].words;

    if (userWords.length !== blanksWords.length) return;

    for (let w of userWords) {

      if (!w) return;

    }



    const feedbackEl = document.getElementById(`feedback-${lineIdx}`);

    let allCorrect = true;

    for (let i = 0; i < blanksWords.length; i++) {

      if (userWords[i].toLowerCase() !== blanksWords[i].toLowerCase()) {

        allCorrect = false;

        break;

      }

    }



    if (allCorrect) {

      feedbackEl.innerHTML = '✔️';

      feedbackEl.classList.remove('incorrect');

      feedbackEl.classList.add('correct');

    } else {

      feedbackEl.innerHTML = '❌';

      feedbackEl.classList.remove('correct');

      feedbackEl.classList.add('incorrect');

    }

  }
