t.r === r && t.c === c); const content = cellData || tempData; const special = SPECIAL_CELLS[`${r},${c}`]; let bgClass = "bg-white"; if(special === 'TW') bgClass = "bg-red-200 text-red-600"; else if(special === 'DL') bgClass = "bg-blue-200 text-blue-600"; else if(special === 'DW') bgClass = "bg-pink-300 text-pink-700"; else if(special === 'CENTER') bgClass = "bg-pink-400 text-white"; if(content) bgClass = "bg-amber-100"; cell.className = `w-full h-full aspect-square border-2 border-pink-200 rounded-md flex items-center justify-center relative ${bgClass} ${(!content && state.selectedHandIndex !== null) ? 'cursor-pointer hover:bg-pink-100 animate-pulse' : ''}`; cell.onclick = () => handleGridClick(r, c); if(!content && special) { cell.innerHTML = `${CELL_LABELS[special]}`; } if(content) { cell.innerHTML = renderTile(content.letter, content.score, !!tempData, false); } boardEl.appendChild(cell); } } // Validate Button State const valBtn = document.getElementById('btn-validate'); const canValidate = state.tempPlacements.length > 0; if(canValidate) { valBtn.className = `flex-1 py-3 rounded-2xl shadow-md font-bold text-white text-lg flex items-center justify-center gap-2 transition-all active:scale-95 duration-300 ${isP1 ? 'bg-gradient-to-r from-pink-400 to-pink-500 shadow-pink-200' : 'bg-gradient-to-r from-blue-400 to-blue-500 shadow-blue-200'}`; } else { valBtn.className = "flex-1 py-3 rounded-2xl shadow-md font-bold text-white text-lg flex items-center justify-center gap-2 transition-all active:scale-95 duration-300 bg-gray-300 cursor-not-allowed"; } // Player Rack const playerArea = document.getElementById('player-area'); const rackLabel = document.getElementById('rack-label'); const indicator = document.getElementById('turn-indicator'); playerArea.className = `fixed bottom-0 w-full bg-white border-t-4 p-4 pb-6 shadow-[0_-4px_6px_-1px_rgba(0,0,0,0.1)] transition-colors duration-500 ${isP1 ? 'border-pink-200' : 'border-blue-200'}`; rackLabel.textContent = `LETTRES DE ${currentP.name}`; rackLabel.className = `text-xs font-bold uppercase tracking-widest transition-colors duration-300 ${isP1 ? 'text-pink-500' : 'text-blue-500'}`; indicator.className = `w-3 h-3 rounded-full shadow-sm transition-colors duration-300 ${isP1 ? 'bg-pink-500' : 'bg-blue-500'}`; const handEl = document.getElementById('player-hand'); handEl.innerHTML = currentP.hand.map((tile, i) => `
${renderTile(tile.letter, tile.score, false, state.selectedHandIndex === i)}
`).join('') + Array(7 - currentP.hand.length).fill('').join(''); // Icons refresh lucide.createIcons(); } // Init startNewGame();