  <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Big Fish Gaming</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: #000;
            font-family: Arial, sans-serif;
            color: white;
            min-height: 100vh;
            overflow: hidden;
        }

        #particles-js {
            position: absolute;
            width: 100%;
            height: 100%;
            z-index: 0;
        }

        .content {
            position: relative;
            text-align: center;
            padding-top: 20vh;
            z-index: 1;
        }

        h1 {
            font-size: 2.5em;
            color: white;
            margin-bottom: 10px;
        }

        .subtitle {
            color: #888;
            font-size: 0.9em;
            margin-bottom: 30px;
        }

        .button-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 15px;
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
        }

        .button {
            background: rgba(40, 40, 40, 0.9);
            border: none;
            padding: 10px 25px;
            color: white;
            border-radius: 25px;
            cursor: pointer;
            font-size: 14px;
            min-width: 120px;
            z-index: 2;
        }

        .button:hover {
            background: rgba(60, 60, 60, 0.9);
        }

        .time {
            position: absolute;
            top: 10px;
            right: 10px;
            color: white;
            z-index: 2;
        }

        .title {
            position: absolute;
            top: 10px;
            left: 10px;
            color: white;
            z-index: 2;
        }

        .popup {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(40, 40, 40, 0.95);
            padding: 20px;
            border-radius: 10px;
            z-index: 1000;
        }

        .popup input {
            margin: 10px 0;
            padding: 5px;
            width: 100%;
            background: rgba(60, 60, 60, 0.9);
            border: none;
            color: white;
            border-radius: 5px;
        }

        .popup button {
            margin: 5px;
            padding: 5px 10px;
            background: rgba(80, 80, 80, 0.9);
            border: none;
            color: white;
            border-radius: 5px;
            cursor: pointer;
        }
    </style>
    <script>
        window.onload = function() {
            let password = prompt("Enter password to access Big Fish Gaming:");
            if (password !== "bfg") {
                window.close();
                document.body.innerHTML = '';
                window.location.href = 'about:blank';
            }
        }
    </script>
</head>
<body>
    <div id="particles-js"></div>
    <div class="title">Big Fish Gaming</div>
    <div class="time" id="clock"></div>

    <div class="content">
        <h1>Welcome to Big Fish Gaming</h1>
        <div class="subtitle">
            Credits to Pulsecodes for helping me<br>
            He's one of the devs for Project Existence
        </div>

        <div class="button-container">
            <button class="button" onclick="showTabCloakPopup()">Tab Cloak</button>
            <button class="button" onclick="openGames()">Games</button>
            <button class="button" onclick="openProxy()">Proxy</button>
            <button class="button" onclick="loadAI()">AI Chat</button>
            <button id="ASong" class="button" onclick="playPause()"><span>Toggle Music</span></button>
             <button id="openInAboutBlank" class="button">Open In About:blank</button>
            <a href="https://pulsecodes.cc" class="button" target="_blank" style="text-decoration: none;">Pulse Codes</a>
        </div>
    </div>

    <div id="tabCloakPopup" class="popup">
        <h3>Tab Cloak Settings</h3>
        <input type="text" id="tabName" placeholder="Enter Tab Name">
        <input type="text" id="tabIcon" placeholder="Enter Icon URL">
        <button onclick="setTabCloak()">Apply</button>
        <button onclick="closePopup()">Cancel</button>
    </div>

    <audio id="backgroundMusic" src="https://static.wixstatic.com/mp3/1492ca_4f4d5001c7fd4f69a3848f393e80578d.mp3" loop></audio>

    <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
    <script>
        let games = [
            { name: "Google", url: "https://google.com/?igu=1" },
  { name: "Burrito Bison", url: "https://mcpshomeworkhelp-wixsite-com.filesusr.com/html/5378fb_eef382ca8b60fdf11be05f87d6b9f5eb.html" },  
  { name: "Tye of link", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/ixl-classroom/attach/29dd9d06d1387/lithium.xml?part=0.1&view=1&container=ig" },  
  { name: "Skibidi Toilet", url: "https://google-opensocial.googleusercontent.com/gadgets/ifr?url=https://147294106-271957305593713958.preview.editmysite.com/uploads/b/146211889-736862448591698921/files/stio.xml&container=ig" },  
  { name: "Tiny Fishing", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://72682389-756457502729861133.preview.editmysite.com/uploads/b/11886820-896015480911618794/files/tf.xml&container=ig" },  
  { name: "The Final Earth 2", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://529473016-184630684593625815.preview.editmysite.com/uploads/b/139890129-811652923688457694/files/tfe2.xml&container=ig" },  
  { name: "Slope", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/sk1bx/WebStarterkit@ebc61d8a952e7630c8c5ca3410335bf5d5f04711/src/sp.xml&container=ig" },  
  { name: "World's Hardest Game", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://s3.amazonaws.com/production-assetsbucket-8ljvyr1xczmb/1ee20621-61bc-4ec8-a8ec-5e839c2e6edc%2Fthe-world-s-hardest-game.xml&container=ig" },  
  { name: "Super Hot", url: "https://a6936-20249810.cluster7.canvas-user-content.com/courses/6936~1014013/files/6936~20249810/course%20files/superhot/index.html?download=1&inline=1" },  
  { name: "There Is No Game", url: "https://a6936-20098220.cluster7.canvas-user-content.com/courses/6936~1014013/files/6936~20098220/course%20files/there%20is%20no%20game/index.html?download=1&inline=1" },  
  { name: "Cookie Clicker", url: "https://a6936-19424025.cluster7.canvas-user-content.com/courses/6936~1014013/files/6936~19424025/course%20files/cookie%20clicker/index.html?download=1&inline=1" },  
  { name: "Time Shooter 2", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/sk1bx/element@1dd0b99d2004b84795f2745a5eb3468deb1c38a4/ts2.xml&container=ig" },  
  { name: "Time Shooter 3", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/sk1bx/version@0d8fb9c7430567ed0900902593eee6ba2ba8d297/ts3.xml&container=ig" },  
  { name: "Subway Surfers", url: "https://a6936-19375562.cluster7.canvas-user-content.com/courses/6936~1010708/files/6936~19375562/course%20files/vfcd/index.html" },  
  { name: "Retro Bowl", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://274079163-174037128449362058.preview.editmysite.com/uploads/b/139890129-899796311729593176/files/rtbl.xml&container=ig" },  
  { name: "Fallerz.io", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/gertdoro/learning-Python-3@4abaa4be3df458528ebc4487dcfe6b1c49d4ee7d/notebooks/fall.xml&container=ig" },  
  { name: "Tetris", url: "https://dionyziz.com/graphics/canvas-tetris/" },  
  { name: "Snow Rider 3D", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/sk1bx/89574567@71f165531792ae450fe0a522a52ba4e827344de2/sr3d.xml&container=ig" },  
  { name: "Eggy Car", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://googleusercontent.b-cdn.net/eggy-car/ec.xml&container=ig" },  
  { name: "Snowball.io", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/gertdoro/SQLite4Unity3d@8516fc0bd1d2be662ca484f5dc506268b24763ef/Example/Assets/snowball.xml&container=ig" },  
  { name: "Moving Co.", url: "https://movingco.h5games.usercontent.goog/v/8fe98e0f-b1b7-4fc6-8023-200af0320f20/?origin=https%3A%2F%2Fgamesnacks.com&gameCenterId=yt&userActivityMetrics=true&eids=95340509&features=InterstitialFreqCap__freq_cap_60s%2CInterstitialFreqCap__block_pga_1m_interstitials%2CMonetization__populate_google_global_correlator%2CMonetization__use_ppabg_tag#pc=3401423534985718&preStart=1726706962732" },  
  { name: "Snowdown Showdown", url: "https://educate.stemfuse.com/sf-serve/76/snowdown_showdown/index.html?class_id=&course_id=&active=" },  
  { name: "Johnny Trigger", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/yrgen73/Jtrigger@3d4eb8d328bab8af057daa77acd4cee7608f1ec1/jt.xml&container=ig" },  
  { name: "Elastic Face", url: "https://d21u3ic0kp9e91.cloudfront.net/elasticman/0/index.html" },  
  { name: "n-gon", url: "https://d272xss3wq00xu.cloudfront.net/n-gon/index.html" },  
  { name: "Craft Mine", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/bobydob/JSEngine@bdd7d45deaeaa50131e1913f2f0598cf147f8c56/build/crmine/crmi.xml&container=ig" },  
  { name: "Stack Bounce", url: "https://stackbounce.h5games.usercontent.goog/v/1aqsvv0aegbjg/?origin=https%3A%2F%2Fgamesnacks.com&gameCenterId=yt&userActivityMetrics=true&eids=95340509&features=InterstitialFreqCap__freq_cap_60s%2CInterstitialFreqCap__block_pga_1m_interstitials%2CMonetization__populate_google_global_correlator%2CMonetization__use_ppabg_tag#pc=4279443280740350&preStart=1726705971318&gameData=eyJsb2dsZXZlbCI6IkVSUk9SIiwiY2xldmVsQ3VycmVudCI6IjYiLCJjYmVzdFNjb3JlIjoiMTAxMTUiLCJjc3R5bGVJRCI6IjMiLCJjY2hvc2VuU2tpbklkIjoiMCIsImNwbGF0Zm9ybXNCcm9rZW5Ub3RhbCI6IjczMyIsImNsZXZlbC5yaW5nVHlwZUlEIjoiMyIsImNsZXZlbC5yaW5nc0NvdW50IjoiMjAwIiwiY2xldmVsLnJpbmdTY2FsaW5nIjoiMCJ9" },  
  { name: "Minecraft Parkour", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://s3.amazonaws.com/production-assetsbucket-8ljvyr1xczmb/9ecda005-11e9-4b52-ab9e-700b4d46d00f%2Fminep.xml&container=ig" },  
  { name: "2048", url: "https://d272xss3wq00xu.cloudfront.net/2048/index.html" },  
  { name: "Only Up Ball", url: "https://d272xss3wq00xu.cloudfront.net/a/index.html" },  
  { name: "Pocket Battle Royale", url: "https://pocketbattleroyale.h5games.usercontent.goog/v/7a1tg7kmi4mfg/?origin=https%3A%2F%2Fgamesnacks.com&gameCenterId=yt&userActivityMetrics=true&eids=95340509&features=InterstitialFreqCap__freq_cap_60s%2CInterstitialFreqCap__block_pga_1m_interstitials%2CMonetization__populate_google_global_correlator%2CMonetization__use_ppabg_tag#pc=30652399916874&preStart=1726706652900" },  
  { name: "Adventure Drivers", url: "https://d272xss3wq00xu.cloudfront.net/adventure-drivers/index.html" },  
  { name: "Angry Birds", url: "https://d272xss3wq00xu.cloudfront.net/angrybirds/index.html" },  
  { name: "Aquapark Slides", url: "https://d272xss3wq00xu.cloudfront.net/aquapark-slides/index.html" },  
  { name: "Backrooms", url: "https://d272xss3wq00xu.cloudfront.net/backrooms/index.html" },  
  { name: "Bacon May Die", url: "https://d272xss3wq00xu.cloudfront.net/bacon-may-die/index.html" },  
  { name: "Ball Hop", url: "https://d272xss3wq00xu.cloudfront.net/Ball-Hop/index.html" },  
  { name: "Ballistic", url: "https://d272xss3wq00xu.cloudfront.net/ballistic/index.html" },  
  { name: "You Are Jeff Bezos", url: "https://d272xss3wq00xu.cloudfront.net/bezos/index.html" },  
  { name: "BitLife", url: "https://d272xss3wq00xu.cloudfront.net/bitlife/index.html" },  
  { name: "Bottle Flip", url: "https://d272xss3wq00xu.cloudfront.net/bottle-flip-3d/index.html" },  
  { name: "Bottle Flip 3D", url: "https://d272xss3wq00xu.cloudfront.net/bottle-flip/index.html" },  
  { name: "Candy Crush Saga", url: "https://d272xss3wq00xu.cloudfront.net/candycrushsaga.html" },  
  { name: "Cars Simulator", url: "https://d272xss3wq00xu.cloudfront.net/cars-simulator/index.html" },  
  { name: "Chrome Dino", url: "https://d272xss3wq00xu.cloudfront.net/chrome-dino/index.html" },  
  { name: "Clicker Heroes", url: "https://d272xss3wq00xu.cloudfront.net/clicker-heroes/index.html" },  
  { name: "Make Sure It's Closed", url: "https://d272xss3wq00xu.cloudfront.net/closed/index.html" },  
  { name: "Cluster Rush", url: "https://d272xss3wq00xu.cloudfront.net/cluster-rush/index.html" },  
  { name: "Cooking Frenzy", url: "https://d272xss3wq00xu.cloudfront.net/bitlife/index.html" },  
  { name: "Crazy Cars", url: "https://d272xss3wq00xu.cloudfront.net/crazy-cars/index.html" },  
  { name: "Crossy Road", url: "https://d272xss3wq00xu.cloudfront.net/crossyroad/index.html" },  
  { name: "CS:GO Clicker", url: "https://d272xss3wq00xu.cloudfront.net/csgoclicker/index.html" },  
  { name: "Cut The Rope", url: "https://d272xss3wq00xu.cloudfront.net/cuttherope-Timetravel/index.html" },  
  { name: "Epic Stunt Cars", url: "https://d272xss3wq00xu.cloudfront.net/d/index.html" },  
  { name: "Deal Or No Deal", url: "https://d272xss3wq00xu.cloudfront.net/deal-or-no-deal/index.html" },  
  { name: "Doodle Jump", url: "https://d272xss3wq00xu.cloudfront.net/doodle-jump/index.html" },  
  { name: "Draw The Hill", url: "https://d272xss3wq00xu.cloudfront.net/draw-the-hill/index.html" },  
  { name: "Drift Boss", url: "https://d272xss3wq00xu.cloudfront.net/drift-boss/index.html" },  
  { name: "Drive Mad", url: "https://d272xss3wq00xu.cloudfront.net/drivemad/index.html" },  
  { name: "Duck Life 4", url: "https://d272xss3wq00xu.cloudfront.net/ducklife4/index.html" },  
  { name: "Tap Tap Shots", url: "https://d272xss3wq00xu.cloudfront.net/e/index.html" },  
  { name: "Edge Surf", url: "https://d272xss3wq00xu.cloudfront.net/edge-surf/index.html" },  
  { name: "Eel Slap", url: "https://d272xss3wq00xu.cloudfront.net/eel-slap/index.html" },  
  { name: "Eggy Car", url: "https://d272xss3wq00xu.cloudfront.net/eggy-car/index.html" },  
  { name: "Fake Virus", url: "https://d272xss3wq00xu.cloudfront.net/fake-virus/index.html" },  
  { name: "Flappy Bird", url: "https://d272xss3wq00xu.cloudfront.net/FNAF4/index.html" },  
  { name: "FNAF 4", url: "https://d272xss3wq00xu.cloudfront.net/flappy-bird/index.html" },  
  { name: "Football Legends", url: "https://d272xss3wq00xu.cloudfront.net/football-legends/index.html" },  
  { name: "Football Strike", url: "https://d272xss3wq00xu.cloudfront.net/football-strike/index.html" },  
  { name: "Fruit Ninja", url: "https://d272xss3wq00xu.cloudfront.net/fruitninja/index.html" },  
  { name: "Geometry Dash", url: "https://d272xss3wq00xu.cloudfront.net/geometry-dash/index.html" },  
  { name: "Geometry Dash Lite", url: "https://d272xss3wq00xu.cloudfront.net/geometrydash/index.html" },  
  { name: "Getting Over It", url: "https://d272xss3wq00xu.cloudfront.net/getting-over-it/index.html" },  
  { name: "Glass City", url: "https://d272xss3wq00xu.cloudfront.net/glass-city/index.html" },  
  { name: "Google Feud", url: "https://d272xss3wq00xu.cloudfront.net/google-feud/index.html" },  
  { name: "Google Snake", url: "https://d272xss3wq00xu.cloudfront.net/googlesnake.html" },  
  { name: "G-Switch 3", url: "https://d272xss3wq00xu.cloudfront.net/gswitch-3/index.html" },  
  { name: "Hop Pop It", url: "https://d272xss3wq00xu.cloudfront.net/hop-pop-it/index.html" },  
  { name: "Idle Restaurants", url: "https://d272xss3wq00xu.cloudfront.net/idle-restaurants/index.html" },  
  { name: "The Impossible Quiz", url: "https://d272xss3wq00xu.cloudfront.net/impossiblequiz/index.html" },  
  { name: "Jetpack Joyride", url: "https://d272xss3wq00xu.cloudfront.net/jetpack-joyride/index.html" },  
  { name: "Lemonade Stand", url: "https://d272xss3wq00xu.cloudfront.net/lemonadestand.html" },  
  { name: "New Super Mario Bros", url: "https://d272xss3wq00xu.cloudfront.net/mario-bros/index.html" },  
  { name: "Super Mario Bros", url: "https://d272xss3wq00xu.cloudfront.net/mario/index.html" },  
  { name: "Masked Special Forces", url: "https://d272xss3wq00xu.cloudfront.net/maskedspecialforces/index.html" },  
  { name: "Minecraft 1.5", url: "https://d272xss3wq00xu.cloudfront.net/minecraft-15/index.html" },  
  { name: "Minecraft 1.8", url: "https://d272xss3wq00xu.cloudfront.net/minecraft-18/index.html" },  
  { name: "Minecraft Case", url: "https://d272xss3wq00xu.cloudfront.net/minecraft-case/index.html" },  
  { name: "Minesweeper", url: "https://d272xss3wq00xu.cloudfront.net/minesweeper/index.html" },  
  { name: "Moto X3M", url: "https://d272xss3wq00xu.cloudfront.net/Moto-X3M/index.html" },  
  { name: "Mr. Bullet", url: "https://d272xss3wq00xu.cloudfront.net/mr-bullet/index.html" },  
  { name: "Nut Simulator", url: "https://d272xss3wq00xu.cloudfront.net/nut-simulator/index.html" },  
  { name: "osu!", url: "https://d272xss3wq00xu.cloudfront.net/osu.html" },  
  { name: "OvO 2", url: "https://d272xss3wq00xu.cloudfront.net/ovo-2/index.html" },  
  { name: "Pacman", url: "https://d272xss3wq00xu.cloudfront.net/pacman/index.html" },  
  { name: "Papa's Scooperia", url: "https://d272xss3wq00xu.cloudfront.net/papasscooperia/index.html" },  
  { name: "Paper Minecraft", url: "https://d272xss3wq00xu.cloudfront.net/paper-minecraft/index.html" },  
  { name: "Paper.io 3", url: "https://d272xss3wq00xu.cloudfront.net/paperio3.html" },  
  { name: "Papery Planes", url: "https://d272xss3wq00xu.cloudfront.net/papery-planes/index.html" },  
  { name: "Plants vs Zombies", url: "https://d272xss3wq00xu.cloudfront.net/plantsvszombies/plants%20vs%20zombies.html" },  
  { name: "Popcat", url: "https://d272xss3wq00xu.cloudfront.net/popcat/index.html" },  
  { name: "Rise Higher", url: "https://d272xss3wq00xu.cloudfront.net/risehigher/index.html" },  
  { name: "Rocket League", url: "https://d272xss3wq00xu.cloudfront.net/Rocket-League/index.html" },  
  { name: "Scrap Metal 3", url: "https://d272xss3wq00xu.cloudfront.net/scrapmetal/index.html" },  
  { name: "Skibidi Strike", url: "https://d272xss3wq00xu.cloudfront.net/skibidi-strike/index.html" },  
  { name: "Slope 2", url: "https://d272xss3wq00xu.cloudfront.net/slope-2/index.html" },  
  { name: "Super Mario 64", url: "https://d272xss3wq00xu.cloudfront.net/sm64/index.html" },  
  { name: "Smash Karts", url: "https://d272xss3wq00xu.cloudfront.net/smashkarts/index.html" },  
  { name: "Sniper Shot", url: "https://d272xss3wq00xu.cloudfront.net/sniper-shot/index.html" },  
  { name: "Soccer Heads", url: "https://d272xss3wq00xu.cloudfront.net/soccer-heads/index.html" },  
  { name: "Soundboard", url: "https://d272xss3wq00xu.cloudfront.net/soundboard/index.html" },  
  { name: "Space Company", url: "https://d272xss3wq00xu.cloudfront.net/space-company/index.html" },  
  { name: "Stack Bump 3D", url: "https://d272xss3wq00xu.cloudfront.net/stack-bump-3d/index.html" },  
  { name: "Stack", url: "https://d272xss3wq00xu.cloudfront.net/stack/index.html" },  
  { name: "Stack Ball", url: "https://d272xss3wq00xu.cloudfront.net/stackball/index.html" },  
  { name: "Stickman Hook", url: "https://d272xss3wq00xu.cloudfront.net/stickman-hook/index.html" },  
  { name: "Stickman Survival", url: "https://d272xss3wq00xu.cloudfront.net/Stickman-Survival/index.html" },  
  { name: "Super Mario Run", url: "https://d272xss3wq00xu.cloudfront.net/supermariorun.html" },  
  { name: "Tactical Assasin 2", url: "https://d272xss3wq00xu.cloudfront.net/tacticalassasin2/index.html" },  
  { name: "Temple Run 2", url: "https://d272xss3wq00xu.cloudfront.net/temple-run-2/index.html" },  
  { name: "Territorial", url: "https://d272xss3wq00xu.cloudfront.net/territorial.html" },  
  { name: "Tunnel Rush", url: "https://d272xss3wq00xu.cloudfront.net/tunnel-rush/index.html" },  
  { name: "Vex 7", url: "https://d272xss3wq00xu.cloudfront.net/vex7/index.html" },  
  { name: "Wordle", url: "https://d272xss3wq00xu.cloudfront.net/wordle/index.html" },  
  { name: "Yohoho", url: "https://d272xss3wq00xu.cloudfront.net/yohoho/index.html" },  
  { name: "Gun Spin", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/RobiFet/workflow@60b41ef8c9123ae41b86bf04c9b39e1a5713aaa9/bin/gs.xml&container=ig" },  
  { name: "Rooftop Snipers", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/sk1bx/version@f8de953e5d955baef80e3994a1105d74ad76315b/Rooftop-Snipers.xml&container=ig" },  
  { name: "Basket Random", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/classroom-google-new/google.net@main/newgoogletrendd.xml&container=ig" },  
  { name: "Hole.io", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/gertdoro/Toolkit@93a27eabbbe5eb626af5b9b7dd0926ac16810a41/Code/Java/hole.xml&container=ig" },  
  { name: "Snake", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://26515722-282596139816136697.preview.editmysite.com/uploads/b/7547235-562404422326578714/files/sis.xml&container=ig" },  
  { name: "Vex 5", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/bobydob/JSEngine@dae52f4583f3cc7612451ea7f02965aeff6077bf/build/v5/v5.xml&container=ig" },  
  { name: "Cookie Clicker", url: "https://google-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/bobydob/JSEngine@0d9afabd2522344a702e1b692ad58039f6290b0d/build/c-c/cc.xml&container=ig" },  
  { name: "Tomb Of The Mask", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/sk1bx/element@9cccb2fafb569c963501a5d818472b561121cea6/totm.xml&container=ig" },  
  { name: "Work Madness", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/27a7a2ce95d5c/google.xml?part=0.1&view=1&container=ig" },  
  { name: "Monster Truck Race", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/27f7898b1dc1b/yyyy.xml?part=0.1&view=1&container=ig" },  
  { name: "Geometry Dash 3D", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/54029c83177b1/geyee.xml?part=0.1&view=1&container=ig" },  
  { name: "Cyber Cars", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/b14b0568a59ba/yu7tc.xml?part=0.1&view=1&container=ig" },  
  { name: "Aquapark Cars", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/ad1b0f5720964/bbbgf.xml?part=0.1&view=1&container=ig" },  
  { name: "Aim Trainer", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/27a856ab4f4d3/google.xml?part=0.1&view=1&container=ig" },  
  { name: "Zombie Exploder", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/27a8f79c6acbe/google.xml?part=0.1&view=1&container=ig" },  
  { name: "Mortal Kombat", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/27aa8c8fdd5ac/google.xml?part=0.1&view=1&container=ig" },  
  { name: "Electric Man", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/27ab7e09f8875/google.xml?part=0.1&view=1&container=ig" },  
  { name: "Bounzy 2", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/27ad4a72a840f/google.xml?part=0.1&view=1&container=ig" },  
  { name: "Ambulance Rush", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/27acba29ab944/google.xml?part=0.1&view=1&container=ig" },  
  { name: "Russians Drive", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/54r7m5resdndren65dx/attach/ac5505094336e/z64.xml?part=0.1&view=1&container=ig" },  
  { name: "OvO", url: "https://s6jf3nx0gk1d6n-opensocial.googleusercontent.com/gadgets/ifr?url=https://427396048-642845047394716217.preview.editmysite.com/uploads/b/139890129-761103484729797659/files/ovof.xml&container=ig" },  
  { name: "OvO 2", url: "https://s6jf3nx0gk1d6n-opensocial.googleusercontent.com/gadgets/ifr?url=https://googleusercontent.b-cdn.net/ovo2/ovo2.xml&container=ig" },  
  { name: "Proxy Links", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/u/6/group/google-forms-work/attach/6e87fda052412/googlecom.xml?part=0.1&view=1&authuser=6&container=ig" },  
  { name: "Do Not Stop", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/classroom-management/teacher@main/dotgoogle.xml&container=ig" },  
  { name: "BitLife", url: "https://d272xss3wq00xu.cloudfront.net/bitlife/index.html" },  
  { name: "Helix Jump", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/u/6/group/54r7m5resdndren65dx/attach/a634c8ae323d5/h4643.xml?part=0.1&view=1&authuser=6&container=ig" },  
  { name: "Pixel Shooter", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://groups.google.com/group/classroomgoogl-net/attach/99c0874f1098d/zy55555.xml?part=0.1&view=1&container=ig" },  
  { name: "Highway Rider Extreme", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/234sd4w5w45wers5tr-645758574456456/9900@main/5234234.xml?part=0.1&view=1&container=ig" },  
  { name: "Paper IO 2", url: "https://d272xss3wq00xu.cloudfront.net/paperio2/index.html" },  
  { name: "Paper IO 3", url: "https://d272xss3wq00xu.cloudfront.net/paperio3.html" },  
  { name: "Acid Rain", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://s3.amazonaws.com/production-assetsbucket-8ljvyr1xczmb/1ee20621-61bc-4ec8-a8ec-5e839c2e6edc%2Facid-rain.xml&container=ig" },  
  { name: "UNO!", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/gertdoro/UnityPy@388b260053eaa47c3ac01b18c66d5508c6cfe231/tests/samples/uno.xml&container=ig" },  
  { name: "Elastic Face", url: "https://s6jf3nx0gk1d6n-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/bobydob/godotpack@e2eaacc90db7a760867d838a1224e490a92da39b/side/eman/face.xml&container=ig" },  
  { name: "Hill Climbing", url: "https://s6jf3nx0gk1d6n-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/bessiegasbarro/HCR@402cc488704523b469aa22506bf4c6c2207097c4/hcr.xml&container=ig" },  
  { name: "3D Block Builder", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/classroom-management/tyt@main/google.net.xml?part=0.1&view=1&container=ig" },  
  { name: "Basketball Shooter", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/yrgen73/BSD2@b5104af0b3a445248e829ff728017e5cc40d72e8/bsd2.xml?part=0.1&view=1&container=ig" },  
  { name: "Bouncy Rush", url: "https://classroom-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/gertdoro/UnityExplorer@f5d8c1af690a04f18c72ae56dad76e216b6ecbf2/CacheObject/Bouncy.xml&container=ig" },  
  { name: "Agar IO lite", url: "https://d272xss3wq00xu.cloudfront.net/agario.html" },  
  { name: "Mario Party 4", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://s3.amazonaws.com/production-assetsbucket-8ljvyr1xczmb/f107b843-3661-4036-9397-2b0c6414a369%2Fmarioparty4.xml&container=ig" },  
  { name: "Dead Zed", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://s3.amazonaws.com/production-assetsbucket-8ljvyr1xczmb/1ee20621-61bc-4ec8-a8ec-5e839c2e6edc%2Fdead_zed.xml&container=ig" },  
  { name: "Galaga", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://s3.amazonaws.com/production-assetsbucket-8ljvyr1xczmb/1ee20621-61bc-4ec8-a8ec-5e839c2e6edc%2Fgalaga.xml&container=ig" },  
  { name: "Riddle School 1", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://s3.amazonaws.com/production-assetsbucket-8ljvyr1xczmb/1ee20621-61bc-4ec8-a8ec-5e839c2e6edc%2Friddle-school.xml&container=ig" },  
  { name: "Obby Robby", url: "https://qrvqrzbrdnhtbikofnemykr8-opensocial.googleusercontent.com/gadgets/ifr?url=https://s3.amazonaws.com/production-assetsbucket-8ljvyr1xczmb/9ecda005-11e9-4b52-ab9e-700b4d46d00f%2Fobby.xml&container=ig" },  
  { name: "Soccer Random", url: "https://azqjxdsdtqfbdwfvzlny3kgl-opensocial.googleusercontent.com/gadgets/ifr?url=https://471058263-725410472258601738.preview.editmysite.com/uploads/b/139890129-510930859892590631/files/sr.xml&container=ig" },  
  { name: "Save My Pet", url: "https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/nurimoores/DataSources@9f54c673948151d03a62f5e63c67efaf558759ab/smp.xml&container=ig" },  
  { name: "Noob Miner", url: "https://my79w0vvvo1to8nev0pnvq08-opensocial.googleusercontent.com/gadgets/ifr?url=https://428048613-274630817493625816.preview.editmysite.com/uploads/b/139890129-289556751581345554/files/nm.xml&container=ig" },  
  { name: "Soccer Skills", url: "https://aa6hthgbtn19gwwl28pelv1q-opensocial.googleusercontent.com/gadgets/ifr?url=https://471904738-852049328537117493.preview.editmysite.com/uploads/b/139890129-154348492386095606/files/ssee.xml&container=ig" },  
  { name: "Death Run 3D", url: "https://sv2emrfgjawywpy44osygatn-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/sk1bx/version@93f7f60b0f054c956ca9b6622f2daeeeb450632c/death_run.xml&container=ig" },  
  { name: "Noob vs Pro", url: "https://bdjfc7hca56th6oqeynmkizy-opensocial.googleusercontent.com/gadgets/ifr?url=https://374610594-153905749316385925.preview.editmysite.com/uploads/b/139890129-538277031118477931/files/nvp.xml&container=ig" }, 
        ];
        
       document.getElementById("openInAboutBlank").onclick = function() {
      var newTab = window.open('about:blank', '_blank');
      newTab.document.open();
      newTab.document.write(document.documentElement.outerHTML);  
      newTab.document.close();
    };

        
        

        function updateClock() {
            const now = new Date();
            const timeString = now.toLocaleTimeString('en-US', {
                hour: 'numeric',
                minute: '2-digit',
                hour12: true
            });
            document.getElementById('clock').textContent = timeString;
        }

        setInterval(updateClock, 1000);
        updateClock();

        function showTabCloakPopup() {
            document.getElementById('tabCloakPopup').style.display = 'block';
        }

        function closePopup() {
            document.getElementById('tabCloakPopup').style.display = 'none';
        }

        function setTabCloak() {
            const name = document.getElementById('tabName').value;
            const icon = document.getElementById('tabIcon').value;

            if (name) document.title = name;
            if (icon) {
                const favicon = document.querySelector("link[rel~='icon']") || document.createElement('link');
                favicon.rel = 'icon';
                favicon.href = icon;
                document.head.appendChild(favicon);
            }

            closePopup();
        }

        particlesJS('particles-js', {
            particles: {
                number: {
                    value: 100,
                    density: {
                        enable: true,
                        value_area: 800
                    }
                },
                color: {
                    value: '#ffffff'
                },
                shape: {
                    type: 'circle',
                },
                opacity: {
                    value: 0.5,
                    random: true,
                    anim: {
                        enable: true,
                        speed: 1,
                        opacity_min: 0.1
                    }
                },
                size: {
                    value: 3,
                    random: true,
                    anim: {
                        enable: false
                    }
                },
                line_linked: {
                    enable: false
                },
                move: {
                    enable: true,
                    speed: 1,
                    direction: 'bottom',
                    random: true,
                    straight: false,
                    out_mode: 'out'
                }
            },
            interactivity: {
                events: {
                    onhover: {
                        enable: false
                    },
                    onclick: {
                        enable: false
                    }
                }
            },
            retina_detect: true
        });

        function openGames() {
            const win = window.open('');
            win.document.write(`
                <!DOCTYPE html>
                <html>
                <head>
                    <title>Games</title>
                    <style>
                        * { margin: 0; padding: 0; box-sizing: border-box; }
                        body {
                            background: #000;
                            color: white;
                            font-family: Arial, sans-serif;
                            min-height: 100vh;
                            padding: 20px;
                            overflow: hidden;
                        }
                        #particles-js {
                            position: fixed;
                            width: 100%;
                            height: 100%;
                            top: 0;
                            left: 0;
                            z-index: 0;
                        }
                        .container {
                            position: relative;
                            z-index: 1;
                            max-width: 1200px;
                            margin: 0 auto;
                            padding: 20px;
                        }
                        h1 {
                            text-align: center;
                            font-size: 3em;
                            margin-bottom: 40px;
                            color: white;
                        }
                        .game-buttons {
                            display: grid;
                            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
                            gap: 20px;
                            margin-bottom: 20px;
                            max-height: calc(100vh - 100px);
                            overflow-y: auto;
                            padding: 20px;
                            border-radius: 15px;
                            background: rgba(0, 0, 0, 0.8);
                            border: 1px solid rgba(255, 255, 255, 0.1);
                        }
                        .game-button {
                            background: rgba(0, 0, 0, 0.8);
                            border: 2px solid rgba(255, 255, 255, 0.1);
                            padding: 15px 25px;
                            color: white;
                            border-radius: 10px;
                            cursor: pointer;
                            font-size: 16px;
                            transition: all 0.3s ease;
                            height: 60px;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                        }

                        .game-button:hover {
                            background: rgba(0, 0, 0, 1);
                            transform: translateY(-2px);
                            border-color: rgba(255, 255, 255, 0.3);
                        }

                        #gameFrame {
                            position: fixed;
                            top: 0;
                            left: 0;
                            width: 100%;
                            height: 100%;
                            border: none;
                            background: #000;
                            display: none;
                            z-index: 1000;
                        }
                    </style>
                </head>
                <body>
                    <div id="particles-js"></div>
                    <div class="container">
                        <h1>Games</h1>
                        <div class="game-buttons">
                            ${games.map(game => `
                                <button class="game-button" onclick="loadGame('${game.url}')">${game.name}</button>
                            `).join('')}
                        </div>
                        <iframe id="gameFrame"></iframe>
                    </div>
                    <script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"><\/script>
                    <script>
                        function loadGame(url) {
                            const frame = document.getElementById('gameFrame');
                            const buttons = document.querySelector('.game-buttons');
                            const backBtn = document.querySelector('.back-button');
                            const title = document.querySelector('h1');

                            frame.style.display = 'block';
                            frame.src = url;
                            buttons.style.display = 'none';
                            backBtn.style.display = 'block';
                            title.style.display = 'none';
                        }

                        function closeGame() {
                            const frame = document.getElementById('gameFrame');
                            const buttons = document.querySelector('.game-buttons');
                            const backBtn = document.querySelector('.back-button');
                            const title = document.querySelector('h1');

                            frame.style.display = 'none';
                            frame.src = '';
                            buttons.style.display = 'grid';
                            backBtn.style.display = 'none';
                            title.style.display = 'block';
                        }

                        particlesJS('particles-js', {
                            particles: {
                                number: {
                                    value: 100,
                                    density: {
                                        enable: true,
                                        value_area: 800
                                    }
                                },
                                color: {
                                    value: '#ffffff'
                                },
                                shape: {
                                    type: 'circle',
                                },
                                opacity: {
                                    value: 0.5,
                                    random: true,
                                    anim: {
                                        enable: true,
                                        speed: 1,
                                        opacity_min: 0.1
                                    }
                                },
                                size: {
                                    value: 3,
                                    random: true,
                                    anim: {
                                        enable: false
                                    }
                                },
                                line_linked: {
                                    enable: false
                                },
                                move: {
                                    enable: true,
                                    speed: 1,
                                    direction: 'bottom',
                                    random: true,
                                    straight: false,
                                    out_mode: 'out'
                                }
                            },
                            interactivity: {
                                events: {
                                    onhover: {
                                        enable: false
                                    },
                                    onclick: {
                                        enable: false
                                    }
                                }
                            },
                            retina_detect: true
                        });
                    <\/script>
                    <style>
                        @keyframes colorChange {
                            0% { color: #ff0000; text-shadow: 0 0 10px #ff0000; }
                            20% { color: #00ff00; text-shadow: 0 0 10px #00ff00; }
                            40% { color: #0000ff; text-shadow: 0 0 10px #0000ff; }
                            60% { color: #ff00ff; text-shadow: 0 0 10px #ff00ff; }
                            80% { color: #ffff00; text-shadow: 0 0 10px #ffff00; }
                            100% { color: #ff0000; text-shadow: 0 0 10px #ff0000; }
                        }

                        .credit-text {
                            position: fixed;
                            top: 20px;
                            right: 20px;
                            font-weight: bold;
                            font-family: Arial, sans-serif;
                            font-size: 24px;
                            z-index: 1000;
                            animation: colorChange 4s infinite;
                            filter: drop-shadow(0 0 15px rgba(255,255,255,0.5));
                            text-shadow: 0 0 10px currentColor,
                                         0 0 20px currentColor,
                                         0 0 30px currentColor;
                            text-decoration: none;
                        }

                        .credit-text:hover {
                            transform: scale(1.1);
                            transition: transform 0.3s ease;
                        }
                    </style>
                    <a href="https://images-opensocial.googleusercontent.com/gadgets/ifr?url=https://cdn.jsdelivr.net/gh/bigfishgaming/bigfishgaming@refs/heads/main/nobonenowanyboneysome.xml&container=ig" target="_blank" class="credit-text">Games By BigFishGaming</a>
                </body>
                </html>
            `);
            win.document.close();
        }

        function openProxy() {
            const win = window.open('about:blank', '_blank');
            win.document.write(`
                <!DOCTYPE html>
                <html>
                <head>
                <title>Proxy</title>
                    <style>
                        body, html {
                            margin: 0;
                            padding: 0;
                            width: 100%;
                            height: 100%;
                            overflow: hidden;
                        }
                        iframe {
                            width: 100%;
                            height: 100%;
                            border: none;
                        }
                    </style>
                </head>
                <body>
                   <iframe src="data:text/html;base64,PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgICA8bWV0YSBjaGFyc2V0PSJVVEYtOCI+CiAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLCBpbml0aWFsLXNjYWxlPTEuMCI+CiAgICA8dGl0bGU+UHJveHk8L3RpdGxlPgogICAgPHN0eWxlPgogICAgICAgIGJvZHkgewogICAgICAgICAgICBtYXJnaW46IDA7CiAgICAgICAgICAgIHBhZGRpbmc6IDA7CiAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgIGp1c3RpZnktY29udGVudDogY2VudGVyOwogICAgICAgICAgICBhbGlnbi1pdGVtczogY2VudGVyOwogICAgICAgICAgICBoZWlnaHQ6IDEwMHZoOwogICAgICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZjBmMGYwOwogICAgICAgIH0KICAgICAgICBpZnJhbWUgewogICAgICAgICAgICBib3JkZXI6IG5vbmU7CiAgICAgICAgICAgIHdpZHRoOiAxMDAlOwogICAgICAgICAgICBoZWlnaHQ6IDEwMCU7CiAgICAgICAgfQogICAgPC9zdHlsZT4KPC9oZWFkPgo8Ym9keT4KICAgIDxpZnJhbWUgc3JjPSJodHRwczovL3BvcnRhbC5qb2FvcGVkcm9yZWlzLmNvbS8iIHRpdGxlPSJwcm94eSI+PC9pZnJhbWU+CjwvYm9keT4KICA8c3R5bGU+CiAgICAgICAgQGtleWZyYW1lcyBjb2xvckNoYW5nZSB7CiAgICAgICAgICAgIDAlIHsgY29sb3I6ICNmZjAwMDA7IHRleHQtc2hhZG93OiAwIDAgMTBweCAjZmYwMDAwOyB9CiAgICAgICAgICAgIDIwJSB7IGNvbG9yOiAjMDBmZjAwOyB0ZXh0LXNoYWRvdzogMCAwIDEwcHggIzAwZmYwMDsgfQogICAgICAgICAgICA0MCUgeyBjb2xvcjogIzAwMDBmZjsgdGV4dC1zaGFkb3c6IDAgMCAxMHB4ICMwMDAwZmY7IH0KICAgICAgICAgICAgNjAlIHsgY29sb3I6ICNmZjAwZmY7IHRleHQtc2hhZG93OiAwIDAgMTBweCAjZmYwMGZmOyB9CiAgICAgICAgICAgIDgwJSB7IGNvbG9yOiAjZmZmZjAwOyB0ZXh0LXNoYWRvdzogMCAwIDEwcHggI2ZmZmYwMDsgfQogICAgICAgICAgICAxMDAlIHsgY29sb3I6ICNmZjAwMDA7IHRleHQtc2hhZG93OiAwIDAgMTBweCAjZmYwMDAwOyB9CiAgICAgICAgfQoKICAgICAgICAuY3JlZGl0LXRleHQgewogICAgICAgICAgICBwb3NpdGlvbjogZml4ZWQ7CiAgICAgICAgICAgIHRvcDogMjBweDsKICAgICAgICAgICAgcmlnaHQ6IDIwcHg7CiAgICAgICAgICAgIGZvbnQtd2VpZ2h0OiBib2xkOwogICAgICAgICAgICBmb250LWZhbWlseTogQXJpYWwsIHNhbnMtc2VyaWY7CiAgICAgICAgICAgIGZvbnQtc2l6ZTogMjRweDsKICAgICAgICAgICAgei1pbmRleDogMTAwMDsKICAgICAgICAgICAgYW5pbWF0aW9uOiBjb2xvckNoYW5nZSA0cyBpbmZpbml0ZTsKICAgICAgICAgICAgZmlsdGVyOiBkcm9wLXNoYWRvdygwIDAgMTVweCByZ2JhKDI1NSwyNTUsMjU1LDAuNSkpOwogICAgICAgICAgICB0ZXh0LXNoYWRvdzogMCAwIDEwcHggY3VycmVudENvbG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgMCAwIDIwcHggY3VycmVudENvbG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgMCAwIDMwcHggY3VycmVudENvbG9yOwogICAgICAgICAgICB0ZXh0LWRlY29yYXRpb246IG5vbmU7CiAgICAgICAgfQoKICAgICAgICAuY3JlZGl0LXRleHQ6aG92ZXIgewogICAgICAgICAgICB0cmFuc2Zvcm06IHNjYWxlKDEuMSk7CiAgICAgICAgICAgIHRyYW5zaXRpb246IHRyYW5zZm9ybSAwLjNzIGVhc2U7CiAgICAgICAgfQogICAgPC9zdHlsZT4KICAgIDxhIGhyZWY9ImFib3V0OmJsYW5rIiB0YXJnZXQ9Il9ibGFuayIgY2xhc3M9ImNyZWRpdC10ZXh0Ij5Qcm94eSBieSBCaWdGaXNoR2FtaW5nPC9hPgo8L2h0bWw+Cg=="></iframe>
                </body>
                </html>
            `);
            win.document.close();
        }

        function loadAI() {
            const contentArea = document.createElement('div');
            contentArea.id = 'content-area';
            contentArea.style.position = 'fixed';
            contentArea.style.top = '0';
            contentArea.style.left = '0';
            contentArea.style.width = '100%';
            contentArea.style.height = '100%';
            contentArea.style.background = 'linear-gradient(145deg, #1e1b4b, #0d0f45)';
            contentArea.style.color = '#e1e2ec';
            contentArea.style.overflow = 'hidden';
            contentArea.style.zIndex = '1000';
            contentArea.innerHTML = `
                <div style="height: 100%; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center;">
                    <h1 style="text-align: center; font-size: 3rem; margin: 20px 0; background: linear-gradient(45deg, #fff, #a5a3ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">AI Chat</h1>
                    <style>
                        .chat-container {max-width: 800px; width: 100%; margin: 0 auto; background: rgba(255, 255, 255, 0.05); border-radius: 15px; overflow: hidden; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);}
                        .chatbox {height: calc(100% - 100px); overflow-y: auto; padding: 20px;}
                        .chat {list-style: none; margin: 15px 0; padding: 0;}
                        .chat-incoming p {background: rgba(255, 255, 255, 0.1); color: #e1e2ec; border-radius: 15px 15px 15px 0; padding: 12px 16px; max-width: 75%; width: fit-content; margin: 0;}
                        .chat-outgoing {display: flex; justify-content: flex-end;}
                        .chat-outgoing p {background: #4945ff; color: #fff; border-radius: 15px 15px 0 15px; padding: 12px 16px; max-width: 75%; width: fit-content; margin: 0;}
                        .chat-input {display: flex; gap: 10px; padding: 20px; background: rgba(255, 255, 255, 0.05); border-top: 1px solid rgba(255, 255, 255, 0.1); width: 100%;}
                        .chat-input textarea {width: 100%; padding: 12px; border: none; border-radius: 10px; background: rgba(255, 255, 255, 0.1); color: #e1e2ec; resize: none; height: 45px; font-size: 16px; outline: none;}
                        .chat-input button {padding: 0 20px; border: none; border-radius: 10px; background: #4945ff; color: #fff; cursor: pointer; transition: background 0.3s ease;}
                        .chat-input button:hover {background: #6e6aff;}
                        .error {color: #ff4545 !important;}
                    </style>
                    <div class="chat-container">
                        <ul class="chatbox"></ul>
                        <div class="chat-input">
                            <textarea placeholder="Enter your message..." required></textarea>
                            <button>Send</button>
                        </div>
                    </div>
                </div>
            `;

            document.body.appendChild(contentArea);

            const chatInput = document.querySelector('.chat-input textarea');
            const sendChatBtn = document.querySelector('.chat-input button');
            const chatbox = document.querySelector(".chatbox");
            let userMessage;
            const API_KEY = "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";

            const createChatLi = (message, className) => {
                const chatLi = document.createElement("li");
                chatLi.classList.add("chat", className);
                let chatContent = className === "chat-outgoing" ? `<p>${message}</p>` : `<p>${message}</p>`;
                chatLi.innerHTML = chatContent;
                return chatLi;
            }

            const generateResponse = (incomingChatLi) => {
                const API_URL = "https://api.groq.com/openai/v1/chat/completions";
                const messageElement = incomingChatLi.querySelector("p");

                const requestOptions = {
                    method: "POST",
                    headers: {
                        "Content-Type": "application/json",
                        "Authorization": `Bearer ${API_KEY}`
                    },
                    body: JSON.stringify({
                        "model": "mixtral-8x7b-32768",
                        "messages": [
                            {"role": "system", "content": "You are a helpful AI assistant."},
                            {"role": "user", "content": userMessage}
                        ],
                        "temperature": 0.9,
                        "max_tokens": 1024,
                        "stream": false
                    })
                };

                fetch(API_URL, requestOptions)
                    .then(res => {
                        if (!res.ok) throw new Error("Network response was not ok");
                        return res.json();
                    })
                    .then(data => {
                        messageElement.textContent = data.choices[0].message.content;
                    })
                    .catch(() => {
                        messageElement.classList.add("error");
                        messageElement.textContent = "Oops! Something went wrong. Please try again!";
                    })
                    .finally(() => chatbox.scrollTo(0, chatbox.scrollHeight));
            };

            const handleChat = () => {
                userMessage = chatInput.value.trim();
                if (!userMessage) return;

                chatbox.appendChild(createChatLi(userMessage, "chat-outgoing"));
                chatInput.value = '';
                chatbox.scrollTo(0, chatbox.scrollHeight);

                setTimeout(() => {
                    const incomingChatLi = createChatLi("Thinking...", "chat-incoming");
                    chatbox.appendChild(incomingChatLi);
                    chatbox.scrollTo(0, chatbox.scrollHeight);
                    generateResponse(incomingChatLi);
                }, 600);
            }

            sendChatBtn.addEventListener("click", handleChat);
            chatInput.addEventListener("keydown", (e) => {
                if (e.key === "Enter" && !e.shiftKey) {
                    e.preventDefault();
                    handleChat();
                }
            });
        }

        let isPlaying = false;

        function playPause() {
            const audioPlayer = document.getElementById('backgroundMusic');
            const toggleButton = document.getElementById('ASong');

            if (isPlaying) {
                audioPlayer.pause();
                toggleButton.querySelector('span').textContent = 'Toggle Music';
            } else {
                audioPlayer.play();
                toggleButton.querySelector('span').textContent = 'Pause Music';
            }

            isPlaying = !isPlaying;
        }
    </script>
</body>
</html>
