<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Minecraft Survival para Rosa</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-image: url('https://noticias.upc.edu.pe/wp-content/uploads/2019/05/minecraft.jpg'); /* Cambia la URL con la ruta de tu imagen */
            background-size: cover;
            background-position: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            color: white; /* Cambié el color del texto para hacerlo más visible en fondos oscuros */
        }
        h1 {
            font-size: 24px;
            margin-bottom: 20px;
            color: #fff;
        }
        .heart {
            font-size: 50px;
            color: red;
            margin-bottom: 30px;
        }
        .status-bar {
            width: 100%;
            height: 10px;
            background-color: #ddd;
            margin-bottom: 20px;
            border-radius: 5px;
        }
        .status-bar .status {
            height: 100%;
            width: 0;
            border-radius: 5px;
            transition: width 0.5s ease;
        }
        .status-bar.connected .status {
            background-color: green;
            width: 100%;
        }
        .status-bar.disconnected .status {
            background-color: red;
            width: 100%;
        }
        input {
            padding: 10px;
            font-size: 16px;
            margin: 10px;
            border-radius: 5px;
            border: 1px solid #ccc;
        }
        button {
            padding: 10px 20px;
            font-size: 16px;
            margin: 10px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            background-color: #007bff;
            color: white;
            transition: background-color 0.3s;
        }
        button:hover {
            background-color: #0056b3;
        }
        button:disabled {
            background-color: #bbb;
            cursor: not-allowed;
        }
    </style>
</head>
<body>
    <h1>Minecraf Survival Interactivo</h1>

    <!-- Corazón -->
    <div class="heart"></div>

    <!-- Campo para ingresar el nombre de usuario de TikTok (deshabilitado para edición) -->
    <input type="text" id="username" value="gabu.lml" readonly />

    <!-- Barra de estado -->
    <div id="statusBar" class="status-bar disconnected">
        <div id="status" class="status"></div>
    </div>

    <button id="startBtn">Iniciar</button>
    <button id="stopBtn" disabled>Detener</button>

    <script>
        const { ipcRenderer } = require('electron');

        const startBtn = document.getElementById('startBtn');
        const stopBtn = document.getElementById('stopBtn');
        const usernameInput = document.getElementById('username');
        const statusBar = document.getElementById('statusBar');
        

        startBtn.addEventListener('click', () => {
            const username = usernameInput.value;
            if (username) {
                ipcRenderer.send('start-connection', username);
                statusBar.classList.remove('disconnected');
                statusBar.classList.add('connected');
                startBtn.disabled = true;
                stopBtn.disabled = false;
            }
        });

        stopBtn.addEventListener('click', () => {
            ipcRenderer.send('stop-connection');
            statusBar.classList.remove('connected');
            statusBar.classList.add('disconnected');
            startBtn.disabled = false;
            stopBtn.disabled = true;
        });
    </script>
</body>
</html>
