<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Rakuten eSIM製造機 - Neoral v6 Shop</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            text-align: center;
            background-color: #f4f4f4;
        }
        .container {
            max-width: 600px;
            margin: 50px auto;
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h2 {
            color: #333;
        }
        input, button {
            margin: 10px 0;
            padding: 10px;
            width: 80%;
            max-width: 300px;
            border: 1px solid #ccc;
            border-radius: 5px;
            font-size: 16px;
        }
        button {
            background-color: #7289DA;
            color: white;
            cursor: pointer;
            border: none;
        }
        button:disabled {
            background-color: #ccc;
            cursor: not-allowed;
        }
        button:hover:not(:disabled) {
            background-color: #5b6eae;
        }
        #qrCode {
            margin-top: 20px;
        }
    </style>
    <script>
        const validKey = "Neoral-Rakuten"; // 認証用のキー（適宜変更）

        function authenticate() {
            const inputKey = document.getElementById("authKey").value;
            if (inputKey === validKey) {
                document.getElementById("authMessage").textContent = "認証成功！生成ボタンが有効になりました。";
                document.getElementById("generateButton").disabled = false;
            } else {
                alert("認証失敗。正しいキーを入力してください。");
            }
        }

        function generateRandomString() {
            const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            let randomString = "";
            for (let i = 0; i < 16; i++) {
                randomString += characters.charAt(Math.floor(Math.random() * characters.length));
            }
            
            const baseString = "LPA:1$rakuten.prod.ondemandconnectivity.com$";
            const fullString = baseString + randomString;
            
            document.getElementById("output").textContent = fullString;
            document.getElementById("qrCode").src = "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" + encodeURIComponent(fullString);
        }
    </script>
</head>
<body>
    <div class="container">
        <h2>キーを入力して認証</h2>
        <input type="text" id="authKey" placeholder="認証キーを入力">
        <button onclick="authenticate()">認証</button>
        <p id="authMessage"></p>
        
        <h2>ランダムな16桁の英数字を生成</h2>
        <button id="generateButton" onclick="generateRandomString()" disabled>生成</button>
        <p id="output"></p>
        
        <h2>QRコード</h2>
        <img id="qrCode" src="" alt="QRコードがここに表示されます">
    </div>
</body>
</html>
