страничка с играми

<!DOCTYPE html>
<html lang="pl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title id="page-title">Game</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <header>
        <div class="header-content">
            <button class="back-button" onclick="window.location.href='index.html'">Wróć</button>
            <h1 id="game-title">Game Promotion</h1>
        </div>
    </header>
    <main>
        <iframe 
            id="game-iframe"
            tabindex="0" 
            frameborder="0" 
            scrolling="no" 
            style="border:none; width: 100%; height: 80vh;">
        </iframe>
    </main>
    <footer>
        <p>&copy; 2024 Game Promotions</p>
    </footer>
    <script>
        // JavaScript-код из предыдущего шага
        const games = {
            'gates-of-olympus': {
                title: 'Gates of Olympus 1000',
                url: 'https://demogamesfree.pragmaticplay.net/gs2c/openGame.do?gameSymbol=vs20olympx&websiteUrl=https%3A%2F%2Fdemogamesfree.pragmaticplay.net&jurisdiction=99&lobby_url=https%3A%2F%2Fwww.pragmaticplay.com%2Fen%2F&lang=PL&cur=PLN'
            },
            'sweet-bonanza': {
                title: 'Sweet Bonanza',
                url: 'https://demogamesfree.pragmaticplay.net/gs2c/openGame.do?gameSymbol=vs20fruitsw&websiteUrl=https%3A%2F%2Fdemogamesfree.pragmaticplay.net&jurisdiction=99&lobby_url=https%3A%2F%2Fwww.pragmaticplay.com%2Fen%2F&lang=PL&cur=PLN'
            },
            // Добавьте другие игры здесь
        };

        function getParameterByName(name) {
            const url = window.location.href;
            const parsedName = name.replace(/[\[\]]/g, '\\$&');
            const regex = new RegExp('[?&]' + parsedName + '(=([^&#]*)|&|#|$)');
            const results = regex.exec(url);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, ' '));
        }

        function initGame() {
            const gameKey = getParameterByName('game');

            if (gameKey && games[gameKey]) {
                const game = games[gameKey];
                document.getElementById('game-iframe').src = game.url;
                document.getElementById('game-title').textContent = game.title;
                document.getElementById('page-title').textContent = game.title;
            } else {
                document.getElementById('game-iframe').style.display = 'none';
                document.getElementById('game-title').textContent = 'Gra nie znaleziona';
                alert('Wybrana gra nie została znaleziona. Proszę wybrać inną grę.');
                // window.location.href = 'index.html';
            }
        }

        window.onload = initGame;
    </script>
</body>
</html>


кнопка с главной странице индекс
<!-- DEMO 2 -->
            <div class="game-card">
                <div class="game-image" style="background-image: url('imeges/Gates of Olympus 1000.png');">
                    <div class="overlay">
                        <button class="play-button">GRAJ ZA PIENIĄDZE</button>
                        <button class="demo-button inactive" onclick="openGatesOfOlympusDemo()">GRAJ ZA DARMO</button>
                    </div>
                </div>
                <p class="game-title">Gates of Olympus 1000</p>
            </div>


 function openGatesOfOlympusDemo() {
            const url = 'game.html?game=gates-of-olympus';
            const demoButton = event.target;
            if (!demoButton.classList.contains('inactive')) {
                window.location.href = `gatesofolympus.html?gameUrl=${encodeURIComponent(url)}`;
            }
        }

как лучше улучшить главную страницу