click();
        document.body.removeChild(a);
        URL.revokeObjectURL(url);
    }

    function downloadProjectJSON() {
        ensureProjectData();  // Create projectData if needed
        const blob = new Blob([projectData.toJSON()], {type: 'application/json'});
        const url = URL.createObjectURL(blob);
        const a = document.createElement('a');
        a.href = url;
        a.download = 'goldenpond-project.json';
        document.body.appendChild(a);
        a.click();
        document.body