(async () => {
  if (!window.Fireworks) {
    await new Promise((resolve, reject) => {
      const script = document.createElement('script');
      script.src = 'https://cdn.jsdelivr.net/npm/fireworks-js@2.x/dist/index.umd.js';
      script.onload = resolve;
      script.onerror = reject;
      document.head.appendChild(script);
    });
  }
  const FireworksClass = window.Fireworks.Fireworks || window.Fireworks.default;
  if (!FireworksClass) {
    console.error('Failed to load Fireworks library!');
    return;
  }
  const container = document.createElement('div');
  container.style.position = 'fixed';
  container.style.top = '0';
  container.style.left = '0';
  container.style.width = '100vw';
  container.style.height = '100vh';
  container.style.pointerEvents = 'none';
  container.style.zIndex = '9999';
  document.body.appendChild(container);
  const fireworks = new FireworksClass(container, {
    rocketsPoint: { min: 10, max: 90 },
    hue: { min: 0, max: 360 },
    delay: { min: 30, max: 60 },
    speed: 5,
    acceleration: 1.05,
    friction: 0.95,
    gravity: 1.5,
    particles: 60,
    traceLength: 3,
    traceSpeed: 10,
    explosion: 6,
    brightness: { min: 50, max: 80 },
    decay: { min: 0.015, max: 0.03 },
    flickering: 50,
    lineWidth: { trace: { min: 1, max: 2 }, explosion: { min: 1, max: 3 } },
    sound: { enabled: false },
    mouse: { click: false, move: false, max: 1 }
  });
  fireworks.start();

  const bursts = 10; // number of bursts
  fireworks.launch(bursts);

  setTimeout(() => {
    fireworks.stop(true);
    container.remove();
  }, 8000);
})();