export default async function main(req: Request): Response {
const htmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Crazy Wordle Game</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
font-family: 'Comic Sans MS', cursive, sans-serif;
text-align: center;
}
.game-container {
display: grid;
gap: 10px;
}
.row {
display: flex;
gap: 5px;
}
.cell {
width: 50px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
border-radius: 10px;
background: linear-gradient(45deg, #ee9ca7, #ffdde1);
animation: cell-animation 2s infinite;
}
@keyframes cell-animation {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.correct { background: linear-gradient(45deg, #a3e635, #16a34a); }
.present { background: linear-gradient(45deg, #fbbf24, #f59e0b); }
.absent { background: linear-gradient(45deg, #9ca3af, #6b7280); }
</style>
</head>
<body>
<div class="game-container" id="game">
</div>
<script>
const word = 'CRAZY';
let currentRow = 0;
let gameContainer = document.getElementById('game');
function createGrid() {
for (let i = 0; i < 6; i++) {
let row = document.createElement('div');
row.className = 'row';
for (let j = 0; j < 5; j++) {
let cell = document.createElement('div');
cell.className = 'cell';
row.appendChild(cell);
}
gameContainer.appendChild(row);
}
}
function handleKeyPress(e) {
let row = gameContainer.children[currentRow];
let cells = Array.from(row.children);
if (e.key === 'Enter') {
if (cells.filter(cell => cell.textContent !== '').length === 5) {
checkWord(cells);
currentRow++;
}
} else if (e.key === 'Backspace') {
let cell = cells.reverse().find(cell => cell.textContent !== '');
if (cell) cell.textContent = '';
} else if (/^[A-Za-z]$/.test(e.key)) {
let cell = cells.find(cell => cell.textContent === '');
if (cell) cell.textContent = e.key.toUpperCase();
}
}
function checkWord(cells) {
let guess = cells.map(cell => cell.textContent).join('');
for (let i = 0; i < 5; i++) {
if (guess[i] === word[i]) {
cells[i].classList.add('correct');
} else if (word.includes(guess[i])) {
cells[i].classList.add('present');
} else {
cells[i].classList.add('absent');