Fish Aquarium Animation

HTML

<div id="aquarium-container">
        <div class="info">
            Click to place food • Fishes will chase the nearest food
        </div>
        <canvas id="aquarium" width="900" height="600"></canvas>
    </div>

CSS

body {
            margin: 0;
            padding: 0;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            overflow: hidden;
        }

        #aquarium-container {
            position: relative;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            background: linear-gradient(180deg, #e3f2fd 0%, #90caf9 100%);
            padding: 10px;
        }

        #aquarium {
            border-radius: 15px;
            cursor: crosshair;
            display: block;
            background: linear-gradient(180deg, 
                rgba(135, 206, 250, 0.3) 0%, 
                rgba(70, 130, 180, 0.5) 50%, 
                rgba(25, 25, 112, 0.3) 100%);
            box-shadow: inset 0 0 50px rgba(255, 255, 255, 0.3),
                        inset 0 0 100px rgba(0, 119, 190, 0.2);
        }

        .info {
            position: absolute;
            top: 20px;
            left: 20px;
            color: white;
            background: rgba(0, 0, 0, 0.7);
            padding: 10px 15px;
            border-radius: 10px;
            font-size: 14px;
            pointer-events: none;
            z-index: 10;
        }

        .bubble {
            position: absolute;
            border-radius: 50%;
            background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
            pointer-events: none;
            animation: float-up 8s infinite ease-in-out;
        }

        @keyframes float-up {
            0% {
                transform: translateY(0) translateX(0);
                opacity: 0.7;
            }
            25% {
                transform: translateY(-25px) translateX(10px);
            }
            50% {
     ...

JavaScript

const canvas = document.getElementById('aquarium');
        const ctx = canvas.getContext('2d');
        const container = document.getElementById('aquarium-container');
        
        // Game state
        let fishes = [];
        let foodPieces = [];
        let bubbles = [];
        
        // Fish class
        class Fish {
            constructor(x, y) {
                this.x = x;
                this.y = y;
                this.size = Math.random() * 20 + 15; // 15-35px
                this.speed = Math.random() * 1.5 + 0.5; // 0.5-2.0
                this.angle = Math.random() * Math.PI * 2;
                this.targetAngle = this.angle;
                this.color = this.generateFishColor();
                this.tailPhase = Math.random() * Math.PI * 2;
                this.swimOffset = Math.random() * Math.PI * 2;
                this.targetFood = null;
                this.normalSwimTimer = 0;
            }
            
            generateFishColor() {
                const colors = [
                    { body: '#FF6B6B', dark: '#CC5555' }, // Red fish
                    { body: '#4ECDC4', dark: '#3BA39C' }, // Teal fish
                    { body: '#45B7D1', dark: '#3691A7' }, // Blue fish
                    { body: '#96CEB4', dark: '#77A690' }, // Green fish
                    { body: '#FFEAA7', dark: '#CCBA86' }, // Yellow fish
                    { body: '#DDA0DD', dark: '#B080B0' }, // Plum fish
                    { body: '#F4A460', dark: '#C3834C' }, // Sandy brown fish
                    { body: '#87CEEB', dark: '#6BA5C9' }  // Sky blue fish
                ];
                return colors[Math.floor(Math.random() * colors.length)];
            }
            update() {
                // Find nearest food if available
                if (foodPieces.length > 0) {
                    let nearestFood = null;
                    let minDistance = Infinity;
                    
                   ...