'F1') { e.preventDefault(); openAIAssistant(); } if (e.ctrlKey && e.key === 'r') { e.preventDefault(); resetGame(); } } // AI Assistant Integration function openAIAssistant() { const difficultyName = gameState.currentDifficulty === 'hard' ? 'ONCE Master' : gameState.currentDifficulty === 'normal' ? 'Normal' : 'Easy'; const context = `I'm practicing What is Love? from TWICE! This is TWICE's cute movie concept song with romantic comedy vibes. The MV features various movie references and romantic scenes, exploring the concept of love through cinema! Current What is Love Stats: - Progress: ${gameState.currentLineIndex}/${gameState.totalLines} lines - WPM: ${gameState.wpm} - ONCE Accuracy: ${gameState.accuracy}% - Love Score: ${gameState.score.toLocaleString()} - Max Movie Streak: ${gameState.maxStreak} - Difficulty: ${difficultyName} Mode - Movie Achievements: ${gameState.achievements.length} What is Love is about discovering romance through movies and cinema. The concept is adorable and innocent, featuring classic movie homages. Please help me improve my typing skills or discuss TWICE's beautiful movie concept in What is Love?!`; window.open(`https://chat.openai.com/?q=${encodeURIComponent(context)}`, '_blank'); } // Initialize Game on Load window.addEventListener('load', initGame); // Prevent page refresh during game window.addEventListener('beforeunload', (e) => { if (gameState.isPlaying) { e.preventDefault(); e.returnValue = ''; } });