Changed around line 1
+ // Particle system
+ class Particle {
+ constructor() {
+ this.x = Math.random() * window.innerWidth;
+ this.y = Math.random() * window.innerHeight;
+ this.size = Math.random() * 5 + 1;
+ this.speedX = Math.random() * 3 - 1.5;
+ this.speedY = Math.random() * 3 - 1.5;
+ }
+
+ update() {
+ this.x += this.speedX;
+ this.y += this.speedY;
+
+ if (this.x > window.innerWidth || this.x < 0) this.speedX *= -1;
+ if (this.y > window.innerHeight || this.y < 0) this.speedY *= -1;
+ }
+
+ draw(ctx) {
+ ctx.fillStyle = 'rgba(255,107,107,0.1)';
+ ctx.beginPath();
+ ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
+ ctx.fill();
+ }
+ }
+
+ // Initialize canvas
+ const canvas = document.getElementById('particles');
+ const ctx = canvas.getContext('2d');
+ canvas.width = window.innerWidth;
+ canvas.height = window.innerHeight;
+
+ let particles = [];
+ for (let i = 0; i < 50; i++) {
+ particles.push(new Particle());
+ }
+
+ function animate() {
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ particles.forEach(particle => {
+ particle.update();
+ particle.draw(ctx);
+ });
+ requestAnimationFrame(animate);
+ }
+
+ animate();
+
+ // Theme toggler
+ const themeToggle = document.querySelector('.theme-toggle');
+ themeToggle.addEventListener('click', () => {
+ document.body.dataset.theme =
+ document.body.dataset.theme === 'dark' ? 'light' : 'dark';
+ });
+
+ // Surprise button
+ const surpriseBtn = document.querySelector('.surprise-btn');
+ surpriseBtn.addEventListener('click', () => {
+ const surprises = [
+ '🎉', '🌈', '✨', '🎨', '🎭', '🎪', '🎯', '🎲'
+ ];
+ const randomSurprise = surprises[Math.floor(Math.random() * surprises.length)];
+ surpriseBtn.textContent = randomSurprise;
+ setTimeout(() => {
+ surpriseBtn.textContent = 'Click for Magic';
+ }, 1000);
+ });
+
+ // Resize handler
+ window.addEventListener('resize', () => {
+ canvas.width = window.innerWidth;
+ canvas.height = window.innerHeight;
+ });