EventListener('click', saveImage);
    window.addEventListener('keydown', (e)=>{ if (e.key.toLowerCase()==='s') saveImage(); });

    function saveImage(){
      const link = document.createElement('a');
      link.download = 'cloud-painting.png';
      link.href = canvas.toDataURL('image/png');
      link.click();
    }

    function drawBackground(t){
      const g = ctx.createLinearGradient(0,0,0,H);
      g.addColorStop(0, '#b9e6ff');
      g.addColorStop(0.4, '#d6efff');
      g.addColorStop(1, '#f7fbf