<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Home Page</title>
    <link href="https://fonts.googleapis.com/css2?family=Unbounded:wght@900&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Unbounded', sans-serif;
            font-weight: 900;
            margin: 0;
            padding: 0;
            background: #000000;
            color: #fff;
            height: 100%;
        }

        header {
            background-color: #000;
            color: #fff;
            padding: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
            position: relative;
        }

        .logo a {
            display: flex;
            align-items: center;
            text-decoration: none;
            color: white;
            font-size: 24px;
        }

        .logo a span {
            color: white;
        }

        nav {
            display: flex;
            gap: 20px;
        }

        nav a {
            text-decoration: none;
            color: white;
            font-size: 18px;
            transition: color 0.3s;
        }

        nav a:hover {
            color: #87CEEB;
        }

        .button-container {
            display: flex;
            gap: 10px;
        }

        .button-container button {
            background-color: transparent;
            border: none;
            padding: 0;
            cursor: pointer;
            width: 50px;
            height: 50px;
            background-size: cover;
            background-position: center;
            border-radius: 5px;
            transition: opacity 0.3s ease;
            box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
        }

        .button-container .refresh-btn {
            background-image: url('assets/images/refresh.png');
        }

        .button-container .fullscreen-btn {
            background-image: url('assets/images/fullscreen.jpg');
        }

        .button-container button:hover {
            opacity: 0.8;
        }

        iframe {
            width: 100%;
            height: calc(100vh - 120px);
            border: none;
        }

        .rule-breaker-container {
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            text-align: center;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: black;
            color: red;
            z-index: 9999;
        }

        .rule-breaker-title {
            font-size: 48px;
            margin-bottom: 20px;
        }

        .rule-breaker-ip {
            font-size: 24px;
            color: white;
        }
    </style>
</head>
<body>
    <header>
        <div class="logo">
            <a href="index.html">
                <span>Fun-Fri</span>
            </a>
        </div>
        <nav>
            <a href="Activities.html">Games</a>
            <a href="Apps.html">Apps</a>
            <a href="Extra.html">Extras</a>
        </nav>
        <div class="button-container">
            <button class="refresh-btn" onclick="refreshIframe()"></button>
            <button class="fullscreen-btn" onclick="toggleFullScreen()"></button>
        </div>
    </header>

    <iframe id="gameIframe" src="assets/mainstorage/Ovo0261.html" allowfullscreen></iframe>

    <script>
        function refreshIframe() {
            const iframe = document.getElementById('gameIframe');
            iframe.src = iframe.src;
        }

        function toggleFullScreen() {
            const iframe = document.getElementById('gameIframe');
            if (iframe.requestFullscreen) iframe.requestFullscreen();
            else if (iframe.mozRequestFullScreen) iframe.mozRequestFullScreen();
            else if (iframe.webkitRequestFullscreen) iframe.webkitRequestFullscreen();
            else if (iframe.msRequestFullscreen) iframe.msRequestFullscreen();
        }

        // Developer tools detection and tab closure
        (function detectDevTools() {
            const threshold = 160;
            let isDevToolsOpen = false;

            const interval = setInterval(() => {
                const widthThreshold = window.outerWidth - window.innerWidth > threshold;
                const heightThreshold = window.outerHeight - window.innerHeight > threshold;

                if (widthThreshold || heightThreshold) {
                    isDevToolsOpen = true;
                } else {
                    isDevToolsOpen = false;
                }

                if (isDevToolsOpen) {
                    clearInterval(interval);

                    // Clear the entire DOM except styles
                    document.body.innerHTML = '';

                    // Create and display the "Rule Breaker!" message
                    const ruleBreakerContainer = document.createElement('div');
                    ruleBreakerContainer.className = 'rule-breaker-container';

                    const ruleBreakerTitle = document.createElement('div');
                    ruleBreakerTitle.className = 'rule-breaker-title';
                    ruleBreakerTitle.innerText = 'Rule Breaker!';

                    const ruleBreakerIp = document.createElement('div');
                    ruleBreakerIp.className = 'rule-breaker-ip';
                    ruleBreakerIp.innerText = 'Fetching your IP...';

                    ruleBreakerContainer.appendChild(ruleBreakerTitle);
                    ruleBreakerContainer.appendChild(ruleBreakerIp);
                    document.body.appendChild(ruleBreakerContainer);

                    // Fetch and display IP address
                    fetch('https://api.ipify.org?format=json')
                        .then(response => response.json())
                        .then(data => {
                            ruleBreakerIp.innerText = `Your IP address is: ${data.ip}`;
                        })
                        .catch(() => {
                            ruleBreakerIp.innerText = 'Failed to fetch your IP.';
                        });

                    // Close the tab after 3 seconds
                    setTimeout(() => {
                        window.close();
                    }, 3000);
                }
            }, 1000); // Check every second
        })();
    </script>
</body>
</html>