#game-container { background: rgba(0, 0, 0, 0.8); padding: 20px; border-radius: 10px; text-align: center; } #word-grid { display: grid; grid-template-columns: repeat(15, 30px); gap: 2px; margin: 20px 0; } .letter { width: 30px; height: 30px; background: white; color: black; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; border-radius: 4px; } .selected { background: #ff69b4; color: white; } .found { background: #4CAF50; color: white; } #word-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; justify-content: center; } .word-item { padding: 5px 10px; background: rgba(255, 255, 255, 0.2); border-radius: 15px; } .found-word { text-decoration: line-through; opacity: 0.7; } #timer { font-size: 24px; margin: 10px 0; } #score { font-size: 20px; margin: 10px 0; } #message { margin: 10px 0; padding: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.2); } Tempo: 5:00 Pontuação: 0 const words = [ 'DIVERSIDADE', 'ORGULHO', 'PRIDE', 'LESBICA', 'TRANSEXUAL', 'VISIBILIDADE', 'BISSEXUAL', 'PARADA', 'DRAGQUEEN' ]; const messages = [ "Amor é amor! 🌈", "Seja orgulhosamente você! ✨", "Visibilidade importa! 🏳️🌈", "Juntos somos mais fortes! 💪", "Resistência e amor! ❤️", "Celebre sua autenticidade! 🌟", "Orgulhe-se de quem você é! 🦋", "Amor não tem gênero! 💕", "Respeito e igualdade sempre! ✊" ]; let grid = []; let selectedCells = []; let foundWords = []; let score = 0; let timeLeft = 300; // 5 minutes in seconds function createGrid() { const gridSize = 15; const grid = Array(gridSize).fill().map(() => Array(gridSize).fill('')); words.forEach(word => { let placed = false; while (!placed) { const direction = Math.random() < 0.5 ? 'horizontal' : 'vertical'; const row = Math.floor(Math.random() * gridSize); const col = Math.floor(Math.random() * gridSize); if (canPlaceWord(grid, word, row, col, direction, gridSize)) { placeWord(grid, word, row, col, direction); placed = true; } } }); for (let i = 0; i < gridSize; i++) { for (let j = 0; j < gridSize; j++) { if (grid[i][j] === '') { grid[i][j] = String.fromCharCode(65 + Math.floor(Math.random() * 26)); } } } return grid; } function canPlaceWord(grid, word, row, col, direction, gridSize) { if (direction === 'horizontal' && col + word.length > gridSize) return false; if (direction === 'vertical' && row + word.length > gridSize) return false; for (let i = 0; i < word.length; i++) { const currentRow = direction === 'horizontal' ? row : row + i; const currentCol = direction === 'horizontal' ? col + i : col; if (grid[currentRow][currentCol] !== '' && grid[currentRow][currentCol] !== word[i]) { return false; } } return true; } function placeWord(grid, word, row, col, direction) { for (let i = 0; i < word.length; i++) { if (direction === 'horizontal') { grid[row][col + i] = word[i]; } else { grid[row + i][col] = word[i]; } } } function initializeGame() { grid = createGrid(); const gridElement = document.getElementById('word-grid'); gridElement.innerHTML = ''; for (let i = 0; i < grid.length; i++) { for (let j = 0; j < grid[i].length; j++) { const cell = document.createElement('div'); cell.className = 'letter'; cell.textContent = grid[i][j]; cell.dataset.row = i; cell.dataset.col = j; cell.addEventListener('mousedown', startSelection); cell.addEventListener('mouseover', continueSelection); gridElement.appendChild(cell); } } const wordList = document.getElementById('word-list'); wordList.innerHTML = words.map(word => `${word}` ).join(''); document.addEventListener('mouseup', endSelection); const timerInterval = setInterval(() => { timeLeft--; updateTimer(); if (timeLeft cell.textContent).join(''); const reverseWord = word.split('').reverse().join(''); if (words.includes(word) && !foundWords.includes(word)) { foundWords.push(word); selectedCells.forEach(cell => cell.classList.add('found')); updateScore(); showMessage(); document.querySelector(`[data-word="${word}"]`).classList.add('found-word'); } else if (words.includes(reverseWord) && !foundWords.includes(reverseWord)) { foundWords.push(reverseWord); selectedCells.forEach(cell => cell.classList.add('found')); updateScore(); showMessage(); document.querySelector(`[data-word="${reverseWord}"]`).classList.add('found-word'); } selectedCells.forEach(cell => cell.classList.remove('selected')); selectedCells = []; if (foundWords.length === words.length) { endGame(); } } function updateScore() { score += 100; document.getElementById('score').textContent = `Pontuação: ${score}`; } function showMessage() { const message = messages[Math.floor(Math.random() * messages.length)]; const messageElement = document.getElementById('message'); messageElement.textContent = message; messageElement.style.animation = 'none'; messageElement.offsetHeight; // Trigger reflow messageElement.style.animation = 'fadeIn 0.5s'; } function updateTimer() { const minutes = Math.floor(timeLeft / 60); const seconds = timeLeft % 60; document.getElementById('timer').textContent = `Tempo: ${minutes}:${seconds.toString().padStart(2, '0')}`; } function endGame() { alert(`Jogo terminado! Sua pontuação final é: ${score}`); } window.onload = initializeGame;