script>

  <script>
    // ---------- A) Basic Dimension Validation ----------
    let validImage = false;
    const imageInput = document.getElementById("imageInput");
    const preview = document.getElementById("imgPreview");
    preview.style.display = "none";

    imageInput.addEventListener("change", evt => {
      const file = evt.target.files[0];
      validImage = false;
      const resultBox = document.getElementById("resultBox");
      resultBox.textContent = "";
      resultBox.classList.remove("