       console.error('Animation initialization failed:', error);
                // Provide fallback behavior if needed
            }
        }

        // === REQUIRED: EVENT LISTENERS ===
        // Standard initialization - use 'load' for most cases, 'DOMContentLoaded' for simple animations
        window.addEventListener('load', initAnimation);

        // === OPTIONAL: VIDEO EVENT HANDLERS ===
        // Uncomment if your animation uses video:
        /*
        const video = document.querySelector('vi