<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JILI | <%= gameName %>
    </title>
    <link rel="shortcut icon" href="/favicon.png" type="image/x-icon">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.6.8/axios.min.js"
        integrity="sha512-PJa3oQSLWRB7wHZ7GQ/g+qyv6r4mbuhmiDb8BjSFZ8NZ2a42oTtAq5n0ucWAwcQDlikAtkub+tPVCw4np27WCg=="
        crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>

<body>

    <style>
        body {
            background: #090135;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
            padding: 0px;
            margin: 0px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .app {
            background: #ffffff;
            max-width: 400px;
            min-height: 100VH;
            min-width: 100%;
        }

        @media (min-width:400px) {
            .app {
                min-width: 400px;
            }
        }

        body nav {
            display: flex;
            align-items: center;
            width: 100%;
            justify-content: space-between;
        }

        body nav .back_button {
            display: flex;
            border: 0;
            background: transparent;
            color: #000000;
        }

        body nav .page_title {
            color: #000000;

        }

        main {
            display: grid;
            grid-gap: 0.21333rem;
            margin-bottom: 0.56rem;
            grid-template-columns: repeat(3, 1fr);
            box-sizing: border-box;
            gap: 10PX;
            padding: 10px;
        }

        main .jili_games_card {
            position: relative;
            border-radius: 0.26667rem;
            width: 100%;
            height: auto;
            aspect-ratio: 1/1;
            box-sizing: border-box;
            overflow: clip;
            isolation: isolate;
            position: relative;
            padding: 0PX;
            margin: 0PX;
            background: transparent;
            border: 0;
            background: rgb(8, 3, 156);
            background: -moz-linear-gradient(52deg, rgba(8, 3, 156, 1) 0%, rgba(214, 0, 255, 1) 100%);
            background: -webkit-linear-gradient(52deg, rgba(8, 3, 156, 1) 0%, rgba(214, 0, 255, 1) 100%);
            background: linear-gradient(52deg, rgba(8, 3, 156, 1) 0%, rgba(214, 0, 255, 1) 100%);
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#08039c", endColorstr="#d600ff", GradientType=1);
        }

        main .jili_games_card img {
            box-sizing: border-box;
            object-fit: cover;
            object-fit: fill;
            border-radius: 0.26667rem;
            background: linear-gradient(153deg, #a4ebf3 5.33%, #ccf2f4 93.42%), linear-gradient(153deg, #a4ebf3 5.33%, #ccf2f4 93.42%);
            box-shadow: 0 -0.05333rem 0.16rem #92a7ff inset;
            width: 100%;
            height: auto;
            aspect-ratio: 1/1;

        }

        main .jili_games_card .back_ct {
            position: absolute;
            top: 0px;
            bottom: 0px;
            left: 0px;
            right: 0px;
            z-index: -1;
            font-weight: 700;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #FFF;
            rotate: 25deg;
            font-size: 20px;
        }
    </style>

    <div class="app">

        <nav>
            <button class="back_button" onclick="window.history.back()">
                <svg width="24" height="24" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path
                        d="M6.85355 3.14645C7.04882 3.34171 7.04882 3.65829 6.85355 3.85355L3.70711 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H3.70711L6.85355 11.1464C7.04882 11.3417 7.04882 11.6583 6.85355 11.8536C6.65829 12.0488 6.34171 12.0488 6.14645 11.8536L2.14645 7.85355C1.95118 7.65829 1.95118 7.34171 2.14645 7.14645L6.14645 3.14645C6.34171 2.95118 6.65829 2.95118 6.85355 3.14645Z"
                        fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path>
                </svg>
            </button>

            <h4 class="page_title">JILI | <%= gameName %>
                    </h1>
                    <div></div>
        </nav>
        <main>


            <% gameList.forEach(function(item) { %>
                <button class="jili_games_card" onclick="openGameById(<%= item.GameId %>)">
                    <img src="/jili_games/<%=item.sqImageSrc%>" alt="" onerror="this.style.display='none'">
                    <div class="back_ct">
                        <%=item.name%>
                    </div>
                </button>
                <% }); %>
        </main>

        <style>
            .loader_main {
                border: 9px solid #f3f3f3;
                /* Light grey */
                border-top: 9px solid #3498db;
                /* Blue */
                border-radius: 50%;
                width: 50px;
                height: 50px;
                animation: spin 1.3s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;

            }


            @keyframes spin {
                0% {
                    transform: rotate(0deg);
                }

                100% {
                    transform: rotate(360deg);
                }
            }

            .loader_popup {
                width: 100%;
                height: 100%;
                position: fixed;
                top: 0px;
                bottom: 0px;
                left: 0px;
                right: 0px;
                align-items: center;
                justify-content: center;
                flex-direction: column;
                background: rgba(0, 0, 0, 0.767);
                display: none;
            }

            .loader_main.display {
                display: flex;
            }


            .loader_popup .loader_text {
                color: #fff;
                font-size: 18px;
                margin-top: 15px;
            }
        </style>
        <div class="loader_popup display">
            <div class="loader_main"></div>
            <h6 class="loader_text">
                Loading Game
            </h6>
        </div>
    </div>
    <script>

        function openGameById(gameId) {
            try {
                window.location.href = `/jili/game_link?game_id=${gameId}`
            } catch (error) {
                console.log(error)
            }
        }


    </script>
</body>

</html>