<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image Viewer</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            background: linear-gradient(135deg, #6a11cb, #2575fc);
            color: #fff;
        }
				.image-wrapper {
            display: flex;
            justify-content: space-between;
            gap: 20px;
            margin-top: 20px;
            width: 100%;
            max-width: 800px;
        }
        .container {
            text-align: center;
            margin-top: 20px;
            padding: 20px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 10px;
            box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
        }
        .image-container {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 10px;
            border: 2px solid #fff;
            overflow: hidden;
            height: 90vh;
        }
        .image-container img {
            max-width: 100%;
            max-height: 100%;
            border-radius: 10px;
            transition: transform 0.3s ease;
        }
        button:hover {
            background-color: #2575fc;
            color: #fff;
        }
    </style>
</head>
<body onload="fetchImage1();fetchImage2();">
    <div class="container">
        <div class="image-wrapper">
            <div class="image-container" id="imageContainer1"></div>
            <div class="image-container" id="imageContainer2"></div>
        </div>
    </div>

    <script>
        async function fetchImage1() {
            const imageContainer = document.getElementById('imageContainer1');

            try {
                const response = await fetch('https://api.waifu.pics/nsfw/neko');
                const data = await response.json();

                if (data.url) {
                    imageContainer.innerHTML = `<img src="${data.url}" alt="Fetched Image">`;
                } else {
                    imageContainer.innerHTML = '<p>Image not found.</p>';
                }
            } catch (error) {
                console.error('Error fetching image:', error);
                imageContainer.innerHTML = '<p>Failed to fetch image. Please try again later.</p>';
            }
        }
				async function fetchImage2() {
            const imageContainer = document.getElementById('imageContainer2');

            try {
                const response = await fetch('https://api.waifu.pics/nsfw/waifu');
                const data = await response.json();

                if (data.url) {
                    imageContainer.innerHTML = `<img src="${data.url}" alt="Fetched Image">`;
                } else {
                    imageContainer.innerHTML = '<p>Image not found.</p>';
                }
            } catch (error) {
                console.error('Error fetching image:', error);
                imageContainer.innerHTML = '<p>Failed to fetch image. Please try again later.</p>';
            }
        }
				window.addEventListener('keydown', () => {
          fetchImage1()
          fetchImage2()
        })
    </script>
</body>
</html>
