• Updated 30 Nov, 18:10 UTC
  • Next run 1 Dec, 05:17 UTCNext 1 Dec 05:17
  • Last 7 days: 5 new models · 76 runs7 d: 5 models · 76 runs
Playable Breakout

LingSante 3.1 Air VLinclusionAI

Network offOpen alone (new tab)

Run details

Model
inclusionai/lingsante-3.1-air-vl
Route
OpenRouter API
Served by
DeepInfra
Effort
model default
Limits
60 min · 32,768 output tokens (model max)
Date
26 Nov 2026
Time
1 min 32 s
Size
30 kB
Tokens
98 in, 7,863 out (356 thinking)
List price
$0.001 at today's price ($0.06 in / $0.18 out per M)
Paid
$0.001

Raw: output · meta.json

Prompt

Make a Breakout game I can play right now with the keyboard or the mouse. Give it several levels, a score and some juice.

It must be one complete, self-contained HTML file: inline all CSS and JavaScript, and make no network requests of any kind (no CDNs, web fonts or remote images). Reply with the file in a single ```html code block.

Source

30 kB 900 lines Raw

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Breakout Game</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Courier New', monospace;
            background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            overflow: hidden;
            color: #fff;
        }
        
        #gameContainer {
            position: relative;
            border: 4px solid #4cc9f0;
            border-radius: 8px;
            box-shadow: 0 0 30px rgba(76, 201, 240, 0.5);
            background: #0f3460;
        }
        
        canvas {
            display: block;
            background: #000;
        }
        
        #uiOverlay {
            position: absolute;
            top: 10px;
            left: 10px;
            right: 10px;
            display: flex;
            justify-content: space-between;
            font-size: 18px;
            font-weight: bold;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
        }
        
        #startScreen, #gameOverScreen, #levelCompleteScreen {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: rgba(0, 0, 0, 0.85);
            z-index: 10;
            text-align: center;
            padding: 20px;
        }
        
        h1 {
            font-size: 48px;
            margin-bottom: 20px;
            color: #4cc9f0;
            text-shadow: 0 0 10px #4cc9f0;
        }
        
        h2 {
            font-size: 36px;
            margin-bottom: 20px;
            color: #f72585;
            text-shadow: 0 0 10px #f72585;
        }
        
        button {
            background: #f72585;
            color: white;
            border: none;
            padding: 15px 30px;
            font-size: 18px;
            border-radius: 30px;
            cursor: pointer;
            font-family: 'Courier New', monospace;
            font-weight: bold;
            margin-top: 20px;
            transition: all 0.3s;
            border: 2px solid #4cc9f0;
        }
        
        button:hover {
            background: #4cc9f0;
            color: #1a1a2e;
            transform: scale(1.05);
            box-shadow: 0 0 15px #4cc9f0;
        }
        
        .hidden {
            display: none;
        }
        
        #instructions {
            max-width: 600px;
            margin: 20px auto;
            line-height: 1.6;
            background: rgba(26, 26, 46, 0.7);
            padding: 15px;
            border-radius: 10px;
        }
        
        .powerup-indicator {
            position: absolute;
            bottom: 10px;
            left: 10px;
            font-size: 16px;
            color: #ffbe0b;
        }
    </style>
</head>
<body>
    <div id="gameContainer">
        <canvas id="gameCanvas" width="800" height="600"></canvas>
        
        <div id="uiOverlay">
            <div id="scoreDisplay">Score: 0</div>
            <div id="levelDisplay">Level: 1</div>
            <div id="livesDisplay">Lives: 3</div>
        </div>
        
        <div class="powerup-indicator hidden" id="powerupIndicator"></div>
        
        <div id="startScreen">
            <h1>BREAKOUT</h1>
            <div id="instructions">
                <p><strong>CONTROLS:</strong></p>
                <p>Mouse: Move paddle horizontally</p>
                <p>Keyboard: Left/Right Arrow keys or A/D</p>
                <p>Space: Launch ball / Start game</p>
                <p><strong>GOAL:</strong> Destroy all bricks to advance to next level!</p>
                <p>Collect power-ups for special abilities!</p>
            </div>
            <button id="startButton">START GAME</button>
        </div>
        
        <div id="gameOverScreen" class="hidden">
            <h2>GAME OVER</h2>
            <div id="finalScore">Score: 0</div>
            <button id="restartButton">PLAY AGAIN</button>
        </div>
        
        <div id="levelCompleteScreen" class="hidden">
            <h2>LEVEL COMPLETE!</h2>
            <div id="levelScore">Score: 0</div>
            <button id="nextLevelButton">NEXT LEVEL</button>
        </div>
    </div>

    <script>
        // Game elements
        const canvas = document.getElementById('gameCanvas');
        const ctx = canvas.getContext('2d');
        const startScreen = document.getElementById('startScreen');
        const gameOverScreen = document.getElementById('gameOverScreen');
        const levelCompleteScreen = document.getElementById('levelCompleteScreen');
        const startButton = document.getElementById('startButton');
        const restartButton = document.getElementById('restartButton');
        const nextLevelButton = document.getElementById('nextLevelButton');
        const scoreDisplay = document.getElementById('scoreDisplay');
        const levelDisplay = document.getElementById('levelDisplay');
        const livesDisplay = document.getElementById('livesDisplay');
        const finalScoreDisplay = document.getElementById('finalScore');
        const levelScoreDisplay = document.getElementById('levelScore');
        const powerupIndicator = document.getElementById('powerupIndicator');
        
        // Game state
        let gameRunning = false;
        let score = 0;
        let lives = 3;
        let level = 1;
        let animationId;
        
        // Paddle properties
        const paddle = {
            width: 100,
            height: 15,
            x: canvas.width / 2 - 50,
            y: canvas.height - 30,
            speed: 8,
            dx: 0
        };
        
        // Ball properties
        const ball = {
            radius: 10,
            x: canvas.width / 2,
            y: paddle.y - 10,
            speed: 5,
            dx: 4,
            dy: -4,
            launched: false
        };
        
        // Bricks
        const brick = {
            row: 0,
            column: 0,
            width: 75,
            height: 20,
            padding: 10,
            offsetTop: 60,
            offsetLeft: 30
        };
        
        // Power-up system
        const powerups = {
            types: {
                enlarge: { color: '#4cc9f0', duration: 5000, active: false },
                laser: { color: '#f72585', duration: 4000, active: false },
                sticky: { color: '#ffbe0b', duration: 0, active: false },
                slow: { color: '#8338ec', duration: 3000, active: false }
            },
            active: null,
            timer: null
        };
        
        // Bricks array
        let bricks = [];
        
        // Audio context for sound effects
        let audioContext;
        
        // Initialize audio
        function initAudio() {
            try {
                audioContext = new (window.AudioContext || window.webkitAudioContext)();
            } catch (e) {
                console.log('Web Audio API not supported');
            }
        }
        
        // Play sound effect
        function playSound(frequency, duration, type = 'sine') {
            if (!audioContext) return;
            
            const oscillator = audioContext.createOscillator();
            const gainNode = audioContext.createGain();
            
            oscillator.connect(gainNode);
            gainNode.connect(audioContext.destination);
            
            oscillator.frequency.value = frequency;
            oscillator.type = type;
            
            gainNode.gain.setValueAtTime(0.3, audioContext.currentTime);
            gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + duration);
            
            oscillator.start();
            oscillator.stop(audioContext.currentTime + duration);
        }
        
        // Initialize bricks for current level
        function initBricks() {
            bricks = [];
            const rows = Math.min(5 + level, 8); // Increase rows with level
            const cols = Math.min(10 + level, 12); // Increase cols with level
            
            for (let r = 0; r < rows; r++) {
                bricks[r] = [];
                for (let c = 0; c < cols; c++) {
                    // Different brick types with different hit points
                    let hits = 1;
                    if (r > rows - 3) hits = 2;
                    if (r > rows - 1 && level > 3) hits = 3;
                    
                    // Color gradient based on row
                    const hue = (r * 30) % 360;
                    
                    bricks[r][c] = {
                        x: c * (brick.width + brick.padding) + brick.offsetLeft,
                        y: r * (brick.height + brick.padding) + brick.offsetTop,
                        status: hits,
                        color: `hsl(${hue}, 70%, 50%)`,
                        glow: 0
                    };
                }
            }
        }
        
        // Draw paddle
        function drawPaddle() {
            ctx.beginPath();
            ctx.rect(paddle.x, paddle.y, paddle.width, paddle.height);
            
            // Paddle appearance
            if (powerups.active === 'enlarge') {
                ctx.fillStyle = '#4cc9f0';
            } else if (powerups.active === 'laser') {
                ctx.fillStyle = '#f72585';
            } else {
                ctx.fillStyle = '#4361ee';
            }
            
            ctx.fill();
            ctx.closePath();
            
            // Paddle glow effect
            ctx.shadowColor = powerups.active === 'laser' ? '#f72585' : '#4cc9f0';
            ctx.shadowBlur = 15;
            ctx.fill();
            ctx.shadowBlur = 0;
            
            // Sticky indicator when sticky powerup is active
            if (powerups.types.sticky.active && ball.launched === false) {
                ctx.beginPath();
                ctx.arc(paddle.x + paddle.width/2, paddle.y - 5, 5, 0, Math.PI * 2);
                ctx.fillStyle = '#ffbe0b';
                ctx.fill();
            }
        }
        
        // Draw ball
        function drawBall() {
            ctx.beginPath();
            ctx.arc(ball.x, ball.y, ball.radius, 0, Math.PI * 2);
            
            // Ball appearance with glow
            const gradient = ctx.createRadialGradient(
                ball.x, ball.y, 0,
                ball.x, ball.y, ball.radius
            );
            gradient.addColorStop(0, '#ffffff');
            gradient.addColorStop(1, powerups.active === 'slow' ? '#8338ec' : '#4cc9f0');
            
            ctx.fillStyle = gradient;
            ctx.fill();
            ctx.closePath();
            
            // Ball glow
            ctx.shadowColor = powerups.active === 'slow' ? '#8338ec' : '#4cc9f0';
            ctx.shadowBlur = 10;
            ctx.fill();
            ctx.shadowBlur = 0;
        }
        
        // Draw bricks
        function drawBricks() {
            for (let r = 0; r < bricks.length; r++) {
                for (let c = 0; c < bricks[r].length; c++) {
                    const b = bricks[r][c];
                    
                    if (b.status > 0) {
                        ctx.beginPath();
                        ctx.rect(b.x, b.y, brick.width, brick.height);
                        
                        // Brick color with health indicator
                        const healthRatio = b.status / 3;
                        const baseColor = b.color;
                        
                        // Create gradient for brick
                        const gradient = ctx.createLinearGradient(0, b.y, 0, b.y + brick.height);
                        gradient.addColorStop(0, baseColor);
                        gradient.addColorStop(1, darkenColor(baseColor, 30));
                        
                        ctx.fillStyle = gradient;
                        ctx.fill();
                        ctx.closePath();
                        
                        // Brick glow effect
                        ctx.shadowColor = baseColor;
                        ctx.shadowBlur = b.glow;
                        ctx.fill();
                        ctx.shadowBlur = 0;
                        
                        // Health indicator on brick
                        if (b.status > 1) {
                            ctx.font = '12px Courier New';
                            ctx.fillStyle = 'white';
                            ctx.textAlign = 'center';
                            ctx.fillText(b.status, b.x + brick.width/2, b.y + brick.height/2 + 4);
                        }
                        
                        // Animate glow
                        b.glow = (b.glow + 0.2) % 20;
                    }
                }
            }
        }
        
        // Helper function to darken colors
        function darkenColor(color, percent) {
            const num = parseInt(color.replace("#",""), 16);
            const amt = Math.round(2.55 * percent);
            const R = (num >> 16) + amt;
            const G = (num >> 8 & 0x00FF) + amt;
            const B = (num & 0x0000FF) + amt;
            
            return "#" + (
                0x1000000 +
                (R < 255 ? (R < 1 ? 0 : R) : 255) * 0x10000 +
                (G < 255 ? (G < 1 ? 0 : G) : 255) * 0x100 +
                (B < 255 ? (B < 1 ? 0 : B) : 255)
            ).toString(16).slice(1);
        }
        
        // Draw power-up indicator
        function drawPowerupIndicator() {
            if (powerups.active) {
                powerupIndicator.textContent = `POWER-UP: ${powerups.active.toUpperCase()}`;
                powerupIndicator.classList.remove('hidden');
            } else {
                powerupIndicator.classList.add('hidden');
            }
        }
        
        // Move paddle
        function movePaddle() {
            paddle.x += paddle.dx;
            
            // Wall detection
            if (paddle.x < 0) {
                paddle.x = 0;
            }
            if (paddle.x + paddle.width > canvas.width) {
                paddle.x = canvas.width - paddle.width;
            }
        }
        
        // Move ball
        function moveBall() {
            ball.x += ball.dx;
            ball.y += ball.dy;
            
            // Wall collision (left/right)
            if (ball.x + ball.radius > canvas.width || ball.x - ball.radius < 0) {
                ball.dx = -ball.dx;
                playSound(400, 0.1);
            }
            
            // Wall collision (top)
            if (ball.y - ball.radius < 0) {
                ball.dy = -ball.dy;
                playSound(400, 0.1);
            }
            
            // Paddle collision
            if (
                ball.x > paddle.x &&
                ball.x < paddle.x + paddle.width &&
                ball.y + ball.radius > paddle.y &&
                ball.y - ball.radius < paddle.y + paddle.height
            ) {
                // Calculate bounce angle based on where ball hits paddle
                const hitPoint = (ball.x - (paddle.x + paddle.width/2)) / (paddle.width/2);
                const angle = hitPoint * Math.PI/4; // Max 45 degrees
                
                const speed = Math.sqrt(ball.dx * ball.dx + ball.dy * ball.dy);
                ball.dx = speed * Math.sin(angle);
                ball.dy = -speed * Math.cos(angle);
                
                playSound(600, 0.2, 'triangle');
                
                // Sticky paddle logic
                if (powerups.types.sticky.active && !ball.launched) {
                    ball.y = paddle.y - ball.radius - 1;
                    ball.dy = 0;
                }
            }
            
            // Bottom wall - lose a life
            if (ball.y + ball.radius > canvas.height) {
                if (powerups.types.sticky.active) {
                    powerups.types.sticky.active = false;
                    clearTimeout(powerups.timer);
                }
                
                lives--;
                livesDisplay.textContent = `Lives: ${lives}`;
                playSound(200, 0.5, 'sawtooth');
                
                if (lives <= 0) {
                    gameOver();
                    return;
                }
                
                resetBall();
            }
            
            // Brick collision
            for (let r = 0; r < bricks.length; r++) {
                for (let c = 0; c < bricks[r].length; c++) {
                    const b = bricks[r][c];
                    
                    if (b.status > 0) {
                        // Check collision
                        if (
                            ball.x > b.x &&
                            ball.x < b.x + brick.width &&
                            ball.y > b.y &&
                            ball.y < b.y + brick.height
                        ) {
                            // Determine which side was hit
                            const left = ball.x - b.x;
                            const right = b.x + brick.width - ball.x;
                            const top = ball.y - b.y;
                            const bottom = b.y + brick.height - ball.y;
                            
                            const minOverlap = Math.min(left, right, top, bottom);
                            
                            if (minOverlap === left || minOverlap === right) {
                                ball.dx = -ball.dx;
                            } else {
                                ball.dy = -ball.dy;
                            }
                            
                            b.status--;
                            
                            // Score based on brick health
                            if (b.status === 0) {
                                score += 10 * b.status + 10;
                                maybeDropPowerup(b);
                            } else {
                                score += 5;
                            }
                            
                            scoreDisplay.textContent = `Score: ${score}`;
                            playSound(800, 0.15, 'square');
                        }
                    }
                }
            }
            
            // Check if all bricks are destroyed
            let allDestroyed = true;
            for (let r = 0; r < bricks.length; r++) {
                for (let c = 0; c < bricks[r].length; c++) {
                    if (bricks[r][c].status > 0) {
                        allDestroyed = false;
                        break;
                    }
                }
                if (!allDestroyed) break;
            }
            
            if (allDestroyed) {
                levelComplete();
            }
        }
        
        // Randomly drop power-ups
        function maybeDropPowerup(brick) {
            // 20% chance to drop a power-up
            if (Math.random() < 0.2) {
                const types = Object.keys(powerups.types);
                const randomType = types[Math.floor(Math.random() * types.length)];
                createPowerup(brick.x + brick.width/2, brick.y + brick.height/2, randomType);
            }
        }
        
        // Power-up system
        function createPowerup(x, y, type) {
            powerups.activeType = {
                type: type,
                x: x,
                y: y,
                speed: 2,
                radius: 10
            };
        }
        
        function updatePowerup() {
            if (powerups.activeType) {
                powerups.activeType.y += powerups.activeType.speed;
                
                // If power-up hits paddle, activate it
                if (
                    powerups.activeType.y + powerups.activeType.radius > paddle.y &&
                    powerups.activeType.x > paddle.x &&
                    powerups.activeType.x < paddle.x + paddle.width
                ) {
                    activatePowerup(powerups.activeType.type);
                    powerups.activeType = null;
                    playSound(1000, 0.3, 'sine');
                }
                
                // If power-up falls off screen, remove it
                if (powerups.activeType.y > canvas.height) {
                    powerups.activeType = null;
                }
            }
        }
        
        function drawPowerup() {
            if (powerups.activeType) {
                ctx.beginPath();
                ctx.arc(powerups.activeType.x, powerups.activeType.y, powerups.activeType.radius, 0, Math.PI * 2);
                ctx.fillStyle = powerups.types[powerups.activeType.type].color;
                ctx.fill();
                ctx.closePath();
                
                // Glow effect
                ctx.shadowColor = powerups.types[powerups.activeType.type].color;
                ctx.shadowBlur = 10;
                ctx.fill();
                ctx.shadowBlur = 0;
            }
        }
        
        function activatePowerup(type) {
            // Deactivate any existing power-up
            if (powerups.active) {
                powerups.types[powerups.active].active = false;
                clearTimeout(powerups.timer);
            }
            
            powerups.active = type;
            powerups.types[type].active = true;
            
            // Apply power-up effects
            switch(type) {
                case 'enlarge':
                    paddle.width = 150;
                    playSound(500, 0.3);
                    break;
                case 'laser':
                    // Destroy all bricks in front of paddle
                    const laserY = paddle.y - 5;
                    for (let r = 0; r < bricks.length; r++) {
                        for (let c = 0; c < bricks[r].length; c++) {
                            const b = bricks[r][c];
                            if (b.status > 0 && 
                                b.x < paddle.x + paddle.width && 
                                b.x + brick.width > paddle.x &&
                                b.y < laserY) {
                                score += 10 * b.status;
                                scoreDisplay.textContent = `Score: ${score}`;
                                b.status = 0;
                            }
                        }
                    }
                    playSound(300, 0.5, 'sawtooth');
                    break;
                case 'sticky':
                    powerups.types.sticky.active = true;
                    playSound(700, 0.2);
                    break;
                case 'slow':
                    ball.dx *= 0.7;
                    ball.dy *= 0.7;
                    playSound(450, 0.4);
                    break;
            }
            
            // Set timer for duration-based power-ups
            if (powerups.types[type].duration > 0) {
                powerups.timer = setTimeout(() => {
                    powerups.types[type].active = false;
                    powerups.active = null;
                    
                    // Reverse effects
                    if (type === 'enlarge') {
                        paddle.width = 100;
                    } else if (type === 'slow') {
                        ball.dx /= 0.7;
                        ball.dy /= 0.7;
                    }
                    
                    playSound(350, 0.3);
                }, powerups.types[type].duration);
            }
        }
        
        // Reset ball position
        function resetBall() {
            ball.x = canvas.width / 2;
            ball.y = paddle.y - ball.radius - 1;
            ball.dx = 4 * (Math.random() > 0.5 ? 1 : -1);
            ball.dy = -4;
            ball.launched = false;
            
            // If sticky power-up is active, keep ball on paddle
            if (powerups.types.sticky.active) {
                ball.dy = 0;
            }
        }
        
        // Level complete
        function levelComplete() {
            gameRunning = false;
            cancelAnimationFrame(animationId);
            
            // Bonus score for completing level
            const bonus = lives * 100 + score;
            score += bonus;
            scoreDisplay.textContent = `Score: ${score}`;
            
            level++;
            levelDisplay.textContent = `Level: ${level}`;
            levelScoreDisplay.textContent = `Score: ${score}`;
            
            playSound(1000, 0.5, 'sine');
            setTimeout(() => {
                levelCompleteScreen.classList.remove('hidden');
            }, 500);
        }
        
        // Game over
        function gameOver() {
            gameRunning = false;
            cancelAnimationFrame(animationId);
            
            finalScoreDisplay.textContent = `Score: ${score}`;
            playSound(150, 1, 'sawtooth');
            setTimeout(() => {
                gameOverScreen.classList.remove('hidden');
            }, 500);
        }
        
        // Game loop
        function gameLoop() {
            // Clear canvas
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            
            // Draw background grid
            drawBackground();
            
            // Draw game elements
            drawBricks();
            drawPaddle();
            drawBall();
            drawPowerup();
            drawPowerupIndicator();
            
            // Move game elements
            movePaddle();
            
            if (ball.launched || !powerups.types.sticky.active) {
                moveBall();
            }
            
            updatePowerup();
            
            // Continue game loop if game is running
            if (gameRunning) {
                animationId = requestAnimationFrame(gameLoop);
            }
        }
        
        // Draw background
        function drawBackground() {
            // Draw grid
            ctx.strokeStyle = 'rgba(76, 201, 240, 0.1)';
            ctx.lineWidth = 1;
            
            // Vertical lines
            for (let x = 0; x < canvas.width; x += 40) {
                ctx.beginPath();
                ctx.moveTo(x, 0);
                ctx.lineTo(x, canvas.height);
                ctx.stroke();
            }
            
            // Horizontal lines
            for (let y = 0; y < canvas.height; y += 40) {
                ctx.beginPath();
                ctx.moveTo(0, y);
                ctx.lineTo(canvas.width, y);
                ctx.stroke();
            }
        }
        
        // Start game
        function startGame() {
            initAudio();
            
            // Reset game state
            score = 0;
            lives = 3;
            level = 1;
            
            scoreDisplay.textContent = `Score: ${score}`;
            levelDisplay.textContent = `Level: ${level}`;
            livesDisplay.textContent = `Lives: ${lives}`;
            
            // Reset paddle and ball
            paddle.width = 100;
            paddle.x = canvas.width / 2 - 50;
            resetBall();
            
            // Initialize bricks for level 1
            initBricks();
            
            // Hide screens
            startScreen.classList.add('hidden');
            gameOverScreen.classList.add('hidden');
            levelCompleteScreen.classList.add('hidden');
            
            // Start game
            gameRunning = true;
            gameLoop();
        }
        
        // Next level
        function nextLevel() {
            levelCompleteScreen.classList.add('hidden');
            initBricks();
            resetBall();
            gameRunning = true;
            gameLoop();
        }
        
        // Event listeners
        startButton.addEventListener('click', startGame);
        restartButton.addEventListener('click', startGame);
        nextLevelButton.addEventListener('click', nextLevel);
        
        // Keyboard controls
        document.addEventListener('keydown', (e) => {
            if (!gameRunning) return;
            
            switch(e.key) {
                case 'ArrowRight':
                case 'd':
                case 'D':
                    paddle.dx = paddle.speed;
                    break;
                case 'ArrowLeft':
                case 'a':
                case 'A':
                    paddle.dx = -paddle.speed;
                    break;
                case ' ':
                    if (!ball.launched) {
                        ball.launched = true;
                        ball.dy = -4;
                        playSound(500, 0.1);
                    }
                    break;
            }
        });
        
        document.addEventListener('keyup', (e) => {
            switch(e.key) {
                case 'ArrowRight':
                case 'd':
                case 'D':
                    paddle.dx = 0;
                    break;
                case 'ArrowLeft':
                case 'a':
                case 'A':
                    paddle.dx = 0;
                    break;
            }
        });
        
        // Mouse controls
        canvas.addEventListener('mousemove', (e) => {
            if (!gameRunning) return;
            
            const rect = canvas.getBoundingClientRect();
            const root = document.documentElement;
            const mouseX = e.clientX - rect.left - root.scrollLeft;
            
            // Center paddle on mouse
            paddle.x = mouseX - paddle.width / 2;
            
            // Keep paddle within canvas
            if (paddle.x < 0) {
                paddle.x = 0;
            }
            if (paddle.x + paddle.width > canvas.width) {
                paddle.x = canvas.width - paddle.width;
            }
        });
        
        // Click to launch ball
        canvas.addEventListener('click', () => {
            if (gameRunning && !ball.launched) {
                ball.launched = true;
                ball.dy = -4;
                playSound(500, 0.1);
            }
        });
        
        // Initialize game
        initBricks();
        drawBackground();
        drawBricks();
        drawPaddle();
        drawBall();
        
        // Show start screen
        startScreen.classList.remove('hidden');
    </script>
</body>
</html>

Compare

Other runs