<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>The Gingerbread Man's Secret Recipe</title>
    <style>
        body {
            font-family: 'Comic Sans MS', Arial, sans-serif;
            background: linear-gradient(to bottom, #f0f8ff, #87ceeb);
            text-align: center;
            padding: 20px;
            overflow: hidden;
            color: #333;
        }
        .container {
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            padding: 20px;
            width: 80%;
            max-width: 600px;
            margin: auto;
        }
        h1 {
            color: #ff6347;
            font-size: 2.5em;
        }
        .hint {
            background-color: #ffebcd;
            padding: 10px;
            border-radius: 5px;
            margin: 20px 0;
            font-size: 1.1em;
        }
        input {
            padding: 10px;
            font-size: 16px;
            width: 80%;
            max-width: 400px;
            margin: 10px 0;
            border: 2px solid #ff6347;
            border-radius: 5px;
        }
        button {
            padding: 10px 15px;
            background-color: #ff6347;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1em;
            transition: transform 0.2s ease;
        }
        button:hover {
            transform: scale(1.1);
        }
        /* Snowflake Animation */
        .snowflake {
            position: absolute;
            top: -50px;
            font-size: 24px;
            color: white;
            animation: fall linear infinite;
        }
        @keyframes fall {
            0% {
                transform: translateY(0) rotate(0deg);
                opacity: 1;
            }
            100% {
                transform: translateY(100vh) rotate(360deg);
                opacity: 0;
            }
        }
        .footer {
            margin-top: 20px;
            font-size: 0.9em;
            color: #888;
        }
        .christmas-scene {
            position: relative;
            margin-top: 30px;
        }
        .tree {
            position: absolute;
            bottom: 0;
            left: 20%;
            width: 100px;
            height: 150px;
            background-color: green;
            clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
        }
        .gifts {
            position: absolute;
            bottom: 0;
            right: 20%;
            width: 150px;
            height: 50px;
            display: flex;
            gap: 10px;
        }
        .gift {
            width: 50px;
            height: 50px;
            background-color: red;
            border: 2px solid white;
            border-radius: 5px;
            position: relative;
        }
        .gift:after, .gift:before {
            content: "";
            position: absolute;
            background-color: white;
        }
        .gift:after {
            width: 100%;
            height: 10%;
            top: 45%;
            left: 0;
        }
        .gift:before {
            height: 100%;
            width: 10%;
            left: 45%;
            top: 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>The Gingerbread Man's Secret Recipe 🎄</h1>
        <p>Can you decode the Gingerbread Man's secret plan hidden in a cookie jar? The message is encrypted, and only the sharpest minds can crack the code!</p>

        <!-- Hint Section -->
        <div class="hint">
            <p><strong>Hint:</strong> This message was encrypted using a Caesar cipher. Try shifting the letters to unlock the recipe!</p>
        </div>

        <!-- Input for User to Decode Message -->
        <p>Enter your decoded message below:</p>
        <input type="text" id="decodedMessage" placeholder="Your decoded message here">
        <button onclick="checkAnswer()">Submit</button>

        <p id="result"></p>
    </div>

    <!-- Christmas Scene -->
    <div class="christmas-scene">
        <div class="tree"></div>
        <div class="gifts">
            <div class="gift"></div>
            <div class="gift"></div>
        </div>
    </div>

    <!-- Snowflake Animation -->
    <script>
        function createSnowflake() {
            const snowflake = document.createElement("div");
            snowflake.classList.add("snowflake");
            snowflake.textContent = "❄";
            snowflake.style.left = Math.random() * 100 + "vw";
            snowflake.style.animationDuration = Math.random() * 3 + 2 + "s";
            document.body.appendChild(snowflake);

            setTimeout(() => snowflake.remove(), 5000);
        }

        // Generate snowflakes every 300ms
        setInterval(createSnowflake, 300);

        // Set the encrypted message (Caesar ciphered message)
        document.cookie = "encryptedMessage=Tvatreoernq Pbbxvrf, Rapelcgrq jvgu Ybir!; max-age=3600";

        // Function to check the user's decoded message
        function checkAnswer() {
            const userMessage = document.getElementById('decodedMessage').value;
            const correctMessage = "Gingerbread Cookies, Encrypted with Love!"; // The correct decoded message

            if (userMessage.trim() === correctMessage) {
                document.getElementById('result').innerHTML = "Congratulations! You've decoded the message!";
                document.getElementById('result').style.color = "green";
                // Redirect to another page that will display the flag
                window.location.href = "ginger_flag.html";
            } else {
                document.getElementById('result').innerHTML = "Oops! Try again.";
                document.getElementById('result').style.color = "red";
            }
        }
    </script>
</body>
</html>
