<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Game Name Checker</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f4f4f9;
            color: #333;
        }
        .container {
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            background: #ffffff;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            border-radius: 8px;
        }
        h1 {
            text-align: center;
            color: #4CAF50;
        }
        input[type="text"], input[type="password"] {
            width: calc(100% - 20px);
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        button {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            cursor: pointer;
            border-radius: 4px;
        }
        button:hover {
            background-color: #45a049;
        }
        #result {
            margin-top: 20px;
            font-weight: bold;
            text-align: center;
        }
        .error {
            color: red;
        }
        .hidden {
            display: none;
        }
    </style>
    <script>
        // Database of games and their corresponding passwords (if required)
        const gameDatabase = { 
            "slope": { url: "https://sites.google.com/view/xds-sites-access/slope3423-5q4ayu_m-j-0-6", password: "Slope123" },
            "level devil": { url: "https://sites.google.com/view/xds-sites-access/level-devil8654-423jgh_p-l-0-2", password: "Level UP!" },
            "cookie clicker": { url: "https://sites.google.com/view/xds-sites-access/cookie-clicker5633-yrwe82_6-5-o-p", password: null }
        };

        function checkGame() {
            const gameName = document.getElementById("gameName").value.toLowerCase();
            const gameInfo = gameDatabase[gameName];

            const resultDiv = document.getElementById("result");
            const passwordDiv = document.getElementById("passwordDiv");
            const passwordInput = document.getElementById("passwordInput");
            const submitPasswordButton = document.getElementById("submitPassword");

            resultDiv.innerHTML = "";
            resultDiv.classList.remove("error");
            passwordDiv.classList.add("hidden");
            passwordInput.value = "";

            if (gameInfo) {
                resultDiv.textContent = "Site found!";
                resultDiv.style.color = "#4CAF50";

                if (gameInfo.password) {
                    passwordDiv.classList.remove("hidden");
                    submitPasswordButton.onclick = function() {
                        if (passwordInput.value === gameInfo.password) {
                            window.open(gameInfo.url, "_blank");
                        } else {
                            resultDiv.textContent = "Incorrect password!";
                            resultDiv.classList.add("error");
                            resultDiv.style.color = "red";
                        }
                    };
                } else {
                    window.open(gameInfo.url, "_blank");
                }
            } else {
                resultDiv.textContent = "Game not found.";
                resultDiv.classList.add("error");
                resultDiv.style.color = "red";
            }
        }
    </script>
</head>
<body>
    <div class="container">
        <h1>Game Finder</h1>
        <p>Enter the name of the game you want to access:</p>

        <input type="text" id="gameName" placeholder="Enter game name">
        <button onclick="checkGame()">Submit</button>

        <div id="result" style="margin-top: 20px;"></div>

        <div id="passwordDiv" class="hidden">
            <p>Password required:</p>
            <input type="password" id="passwordInput" placeholder="Enter password">
            <button id="submitPassword">Submit Password</button>
        </div>
    </div>
</body>
</html>