import { Game } from './Game.js';

window.log = (msg) => {
    const logDiv = document.getElementById('debug-log');
    if (logDiv) {
        const span = document.createElement('div');
        span.textContent = `> ${msg}`;
        logDiv.appendChild(span);
        logDiv.scrollTop = logDiv.scrollHeight;
    }
};

// Toggle debug log with 'P'
window.addEventListener('keydown', (e) => {
    if (e.code === 'KeyP') {
        const logDiv = document.getElementById('debug-log');
        if (logDiv) {
            logDiv.style.display = logDiv.style.display === 'none' ? 'block' : 'none';
        }
    }
});

window.addEventListener('DOMContentLoaded', () => {
    const game = new Game();
    game.start();
});
