     }
    });

    function setError(msg) {
      const rb = document.getElementById("resultBox");
      rb.textContent = msg;
      rb.classList.add("error");
    }

    // ---------- B) Prompt Suggestions ----------
    function onPresetChange() {
      const selected = document.getElementById("promptSuggestions").value;
      if (selected) {
        document.getElementById("prompt").value = selected;
      }
    }

    // ---------- C) Improve Prompt (OpenAI) ----------
    async function improvePrompt(