error");
      preview.style.display = "none";
      preview.src = "";

      if (file) {
        const tempImg = new Image();
        tempImg.onload = () => {
          const w = tempImg.width, h = tempImg.height;
          const pixels = w * h;
          const ratio = w / h;

          if (w < 64 || h < 64) {
            setError("Each side must be >=64px. Please use a larger image.");
            return;
          }
          if (pixels < 4096 || pixels > 9437184) {
            setError("Total pixels mus