<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Matrix-Themed Flipsnack Widget</title>
    <style>
        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            background: black; /* Black background for Matrix theme */
            color: #00ff00; /* Green text for Matrix theme */
            font-family: 'Courier New', Courier, monospace;
            overflow: hidden; /* Prevent scrollbars */
        }
        canvas {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1; /* Place the canvas behind the content */
        }
        .widget-container {
            position: relative;
            z-index: 1; /* Ensure the widget is above the Matrix rain */
            max-width: 90%; /* Use a percentage for responsive width */
            margin: 20px auto; /* Center the widget horizontally with reduced margin */
            padding: 10px; /* Reduce padding for mobile */
            background: rgba(0, 0, 0, 0.8); /* Semi-transparent black background */
            border-radius: 10px;
            box-shadow: 0 0 10px #00ff00; /* Green glow effect */
            text-align: center;
        }
        iframe {
            width: 100%; /* Make the iframe responsive */
            height: 300px; /* Adjust height for mobile */
            border: none; /* Remove iframe border */
        }
        a {
            color: #00ff00; /* Green links for Matrix theme */
            text-decoration: underline;
            outline: none; /* Remove focus outline */
            font-size: 14px; /* Adjust font size for mobile */
        }
        a:focus {
            outline: none; /* Ensure no outline appears on focus */
        }

        /* Responsive Design for Mobile Portrait Mode */
        @media (max-width: 768px) {
            .widget-container {
                max-width: 95%; /* Further reduce width for smaller screens */
                padding: 5px; /* Reduce padding for smaller screens */
            }
            iframe {
                height: 250px; /* Adjust iframe height for smaller screens */
            }
            a {
                font-size: 12px; /* Smaller font size for links */
            }
        }
    </style>
</head>
<body>
    <canvas id="matrix"></canvas>
    <div class="widget-container">
        <iframe src="https://cdn.flipsnack.com/widget/v2/widget.html?hash=vp84kcde47"></iframe>
        <div>
            <a href="https://cdn.flipsnack.com/widget/v2/widget.html?hash=vp84kcde47" target="_blank">Fullscreen</a>
        </div>
    </div>
    <script>
        const canvas = document.getElementById('matrix');
        const ctx = canvas.getContext('2d');
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;

        const letters = Array(256).join(1).split('');
        const fontSize = 16;

        function draw() {
            ctx.fillStyle = 'rgba(0, 0, 0, 0.05)'; /* Light fade effect */
            ctx.fillRect(0, 0, canvas.width, canvas.height);
            ctx.fillStyle = '#00ff00'; /* Green droplets */
            ctx.font = `${fontSize}px monospace`;

            letters.forEach((y, index) => {
                const text = String.fromCharCode(0x30A0 + Math.random() * 96);
                const x = index * fontSize;
                ctx.fillText(text, x, y);
                letters[index] = y > canvas.height || Math.random() > 0.975 ? 0 : y + fontSize;
            });
        }

        setInterval(draw, 50);
    </script>
</body>
</html>