Spaces:
Running

undefined / index.html
layiwola's picture
You are an expert email designer/coder. Generate a production-ready, responsive HTML email (not a webpage) for Ckrowd’s B2B outreach. Output ONLY HTML (no commentary). Requirements:
6da704e verified
Raw History Blame Contribute Delete
11.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tic Tac Toe Titans</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<style>
.cell {
transition: all 0.3s ease;
}
.cell:hover {
transform: scale(1.05);
}
.glow {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
</style>
</head>
<body class="bg-gradient-to-br from-indigo-900 via-purple-900 to-gray-900 min-h-screen text-white">
<div class="container mx-auto px-4 py-12">
<header class="text-center mb-12">
<h1 class="text-5xl font-bold mb-4 text-transparent bg-clip-text bg-gradient-to-r from-indigo-300 via-purple-300 to-pink-300">Tic Tac Toe Titans</h1>
<p class="text-xl text-indigo-200">The ultimate battle of X's and O's</p>
</header>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Game Board -->
<div class="lg:col-span-2 bg-gray-800 rounded-xl p-6 shadow-2xl">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold">Battle Arena</h2>
<div id="status" class="text-xl font-semibold bg-indigo-600 px-4 py-2 rounded-lg">Player X's turn</div>
</div>
<div class="grid grid-cols-3 gap-4">
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="0"></div>
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="1"></div>
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="2"></div>
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="3"></div>
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="4"></div>
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="5"></div>
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="6"></div>
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="7"></div>
<div class="cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300" data-index="8"></div>
</div>
<div class="mt-6 flex justify-center">
<button id="reset" class="bg-pink-600 hover:bg-pink-700 text-white font-bold py-3 px-6 rounded-full transition-all duration-300 flex items-center gap-2">
<i data-feather="refresh-cw" class="w-5 h-5"></i>
Reset Battle
</button>
</div>
</div>
<!-- Score and History -->
<div class="space-y-6">
<!-- Scoreboard -->
<div class="bg-gray-800 rounded-xl p-6 shadow-2xl">
<h2 class="text-2xl font-bold mb-4">Scoreboard</h2>
<div class="space-y-4">
<div class="flex justify-between items-center bg-gray-700 px-4 py-3 rounded-lg">
<span class="text-xl font-bold text-indigo-300">Player X</span>
<span id="score-x" class="text-2xl font-bold">0</span>
</div>
<div class="flex justify-between items-center bg-gray-700 px-4 py-3 rounded-lg">
<span class="text-xl font-bold text-pink-300">Player O</span>
<span id="score-o" class="text-2xl font-bold">0</span>
</div>
<div class="flex justify-between items-center bg-indigo-600 px-4 py-3 rounded-lg mt-4">
<span class="text-xl font-bold">Draws</span>
<span id="score-draw" class="text-2xl font-bold">0</span>
</div>
</div>
</div>
<!-- Game History -->
<div class="bg-gray-800 rounded-xl p-6 shadow-2xl">
<h2 class="text-2xl font-bold mb-4">Battle History</h2>
<div id="history" class="space-y-2 max-h-60 overflow-y-auto pr-2">
<div class="text-center py-4 text-gray-400">No battles recorded yet</div>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
feather.replace();
// Game state
let board = Array(9).fill(null);
let currentPlayer = 'X';
let gameOver = false;
let scores = { X: 0, O: 0, draw: 0 };
let gameHistory = [];
// DOM elements
const cells = document.querySelectorAll('.cell');
const statusElement = document.getElementById('status');
const scoreXElement = document.getElementById('score-x');
const scoreOElement = document.getElementById('score-o');
const scoreDrawElement = document.getElementById('score-draw');
const historyElement = document.getElementById('history');
const resetButton = document.getElementById('reset');
// Event listeners
cells.forEach(cell => {
cell.addEventListener('click', handleCellClick);
});
resetButton.addEventListener('click', resetGame);
// Functions
function handleCellClick(e) {
const index = e.target.dataset.index;
if (gameOver || board[index]) return;
board[index] = currentPlayer;
e.target.textContent = currentPlayer;
e.target.classList.add(currentPlayer === 'X' ? 'text-indigo-300' : 'text-pink-300');
if (checkWin()) {
gameOver = true;
scores[currentPlayer]++;
updateScoreboard();
statusElement.textContent = `Player ${currentPlayer} wins!`;
statusElement.classList.add('glow');
addToHistory(`Player ${currentPlayer} won`);
highlightWinningCells();
return;
}
if (checkDraw()) {
gameOver = true;
scores.draw++;
updateScoreboard();
statusElement.textContent = "It's a draw!";
statusElement.classList.add('bg-purple-600');
addToHistory(`Game ended in a draw`);
return;
}
currentPlayer = currentPlayer === 'X' ? 'O' : 'X';
statusElement.textContent = `Player ${currentPlayer}'s turn`;
}
function checkWin() {
const winPatterns = [
[0, 1, 2], [3, 4, 5], [6, 7, 8], // rows
[0, 3, 6], [1, 4, 7], [2, 5, 8], // columns
[0, 4, 8], [2, 4, 6] // diagonals
];
return winPatterns.some(pattern => {
const [a, b, c] = pattern;
return board[a] && board[a] === board[b] && board[a] === board[c];
});
}
function checkDraw() {
return board.every(cell => cell !== null);
}
function highlightWinningCells() {
const winPatterns = [
[0, 1, 2], [3, 4, 5], [6, 7, 8],
[0, 3, 6], [1, 4, 7], [2, 5, 8],
[0, 4, 8], [2, 4, 6]
];
const winningPattern = winPatterns.find(pattern => {
const [a, b, c] = pattern;
return board[a] && board[a] === board[b] && board[a] === board[c];
});
if (winningPattern) {
winningPattern.forEach(index => {
cells[index].classList.add('bg-gradient-to-br', 'from-yellow-500', 'to-pink-500');
});
}
}
function resetGame() {
board = Array(9).fill(null);
currentPlayer = 'X';
gameOver = false;
cells.forEach(cell => {
cell.textContent = '';
cell.className = 'cell bg-gray-700 rounded-lg aspect-square flex items-center justify-center text-6xl font-bold cursor-pointer hover:bg-indigo-700 transition-all duration-300';
});
statusElement.textContent = "Player X's turn";
statusElement.className = "text-xl font-semibold bg-indigo-600 px-4 py-2 rounded-lg";
}
function updateScoreboard() {
scoreXElement.textContent = scores.X;
scoreOElement.textContent = scores.O;
scoreDrawElement.textContent = scores.draw;
}
function addToHistory(message) {
const timestamp = new Date().toLocaleTimeString();
const historyItem = document.createElement('div');
historyItem.className = 'bg-gray-700 px-4 py-2 rounded-lg text-sm';
historyItem.innerHTML = `<span class="text-indigo-300">${timestamp}</span> - ${message}`;
if (historyElement.firstChild?.textContent === 'No battles recorded yet') {
historyElement.innerHTML = '';
}
historyElement.insertBefore(historyItem, historyElement.firstChild);
gameHistory.unshift(`${timestamp} - ${message}`);
}
});
</script>
<script>feather.replace();</script>
</body>
</html>