create-template-html-css 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS-GALLERY.html +124 -11
- package/README.md +6 -2
- package/bin/cli.js +8 -2
- package/demo-games/guess-number/index.html +71 -0
- package/demo-games/guess-number/script.js +216 -0
- package/demo-games/guess-number/style.css +337 -0
- package/demo-games/memory-game/index.html +50 -0
- package/demo-games/memory-game/script.js +216 -0
- package/demo-games/memory-game/style.css +288 -0
- package/demo-games/snake-game/index.html +61 -0
- package/demo-games/snake-game/script.js +360 -0
- package/demo-games/snake-game/style.css +246 -0
- package/demo-games/tic-tac-toe/index.html +57 -0
- package/demo-games/tic-tac-toe/script.js +156 -0
- package/demo-games/tic-tac-toe/style.css +244 -0
- package/package.json +1 -1
- package/templates/guess-number/index.html +71 -0
- package/templates/guess-number/script.js +216 -0
- package/templates/guess-number/style.css +337 -0
- package/templates/memory-game/index.html +50 -0
- package/templates/memory-game/script.js +216 -0
- package/templates/memory-game/style.css +288 -0
- package/templates/snake-game/index.html +61 -0
- package/templates/snake-game/script.js +360 -0
- package/templates/snake-game/style.css +246 -0
- package/templates/tic-tac-toe/index.html +57 -0
- package/templates/tic-tac-toe/script.js +156 -0
- package/templates/tic-tac-toe/style.css +244 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
* {
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
body {
|
|
8
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
9
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding: 20px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.container {
|
|
18
|
+
width: 100%;
|
|
19
|
+
max-width: 500px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.game-card {
|
|
23
|
+
background: white;
|
|
24
|
+
border-radius: 16px;
|
|
25
|
+
padding: 30px;
|
|
26
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.game-card h1 {
|
|
30
|
+
text-align: center;
|
|
31
|
+
color: #333;
|
|
32
|
+
margin-bottom: 20px;
|
|
33
|
+
font-size: 2.5rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.game-info {
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
padding: 15px;
|
|
40
|
+
background: #f3f4f6;
|
|
41
|
+
border-radius: 12px;
|
|
42
|
+
margin-bottom: 20px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.info-item {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.label {
|
|
52
|
+
font-size: 0.9rem;
|
|
53
|
+
color: #6b7280;
|
|
54
|
+
margin-bottom: 5px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.value {
|
|
58
|
+
font-size: 1.3rem;
|
|
59
|
+
font-weight: bold;
|
|
60
|
+
color: #333;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#gameCanvas {
|
|
64
|
+
width: 100%;
|
|
65
|
+
max-width: 400px;
|
|
66
|
+
height: auto;
|
|
67
|
+
display: block;
|
|
68
|
+
margin: 0 auto 20px;
|
|
69
|
+
border-radius: 8px;
|
|
70
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.message {
|
|
74
|
+
text-align: center;
|
|
75
|
+
font-size: 1.1rem;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
height: 35px;
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
margin-bottom: 20px;
|
|
82
|
+
color: #6b7280;
|
|
83
|
+
opacity: 0;
|
|
84
|
+
transition: opacity 0.3s ease;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.message.show {
|
|
88
|
+
opacity: 1;
|
|
89
|
+
animation: pulse 1.5s ease-in-out infinite;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.message.game-over {
|
|
93
|
+
color: #ef4444;
|
|
94
|
+
font-size: 1.2rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@keyframes pulse {
|
|
98
|
+
0%, 100% {
|
|
99
|
+
opacity: 1;
|
|
100
|
+
}
|
|
101
|
+
50% {
|
|
102
|
+
opacity: 0.6;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.controls {
|
|
107
|
+
margin-bottom: 20px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.arrow-buttons {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
align-items: center;
|
|
114
|
+
gap: 5px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.arrow-row {
|
|
118
|
+
display: flex;
|
|
119
|
+
gap: 5px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.arrow-btn {
|
|
123
|
+
width: 60px;
|
|
124
|
+
height: 60px;
|
|
125
|
+
border: 2px solid #e5e7eb;
|
|
126
|
+
border-radius: 8px;
|
|
127
|
+
background: white;
|
|
128
|
+
font-size: 1.5rem;
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
transition: all 0.2s ease;
|
|
131
|
+
color: #333;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.arrow-btn:hover {
|
|
135
|
+
background: #f3f4f6;
|
|
136
|
+
border-color: #9ca3af;
|
|
137
|
+
transform: scale(1.05);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.arrow-btn:active {
|
|
141
|
+
transform: scale(0.95);
|
|
142
|
+
background: #e5e7eb;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.button-group {
|
|
146
|
+
display: flex;
|
|
147
|
+
gap: 10px;
|
|
148
|
+
margin-bottom: 20px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.btn {
|
|
152
|
+
flex: 1;
|
|
153
|
+
padding: 12px 20px;
|
|
154
|
+
border: none;
|
|
155
|
+
border-radius: 8px;
|
|
156
|
+
font-size: 1rem;
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
transition: all 0.3s ease;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.btn:disabled {
|
|
163
|
+
opacity: 0.5;
|
|
164
|
+
cursor: not-allowed;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.btn-success {
|
|
168
|
+
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
|
|
169
|
+
color: white;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.btn-success:hover:not(:disabled) {
|
|
173
|
+
transform: translateY(-2px);
|
|
174
|
+
box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.btn-warning {
|
|
178
|
+
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
|
|
179
|
+
color: white;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.btn-warning:hover:not(:disabled) {
|
|
183
|
+
transform: translateY(-2px);
|
|
184
|
+
box-shadow: 0 5px 15px rgba(245, 158, 11, 0.4);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.btn-danger {
|
|
188
|
+
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
|
|
189
|
+
color: white;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.btn-danger:hover:not(:disabled) {
|
|
193
|
+
transform: translateY(-2px);
|
|
194
|
+
box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.instructions {
|
|
198
|
+
background: #f9fafb;
|
|
199
|
+
border-radius: 8px;
|
|
200
|
+
padding: 15px;
|
|
201
|
+
font-size: 0.9rem;
|
|
202
|
+
color: #6b7280;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.instructions p {
|
|
206
|
+
margin-bottom: 8px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.instructions p:last-child {
|
|
210
|
+
margin-bottom: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@media (max-width: 480px) {
|
|
214
|
+
.game-card {
|
|
215
|
+
padding: 20px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.game-card h1 {
|
|
219
|
+
font-size: 2rem;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.game-info {
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
gap: 10px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.info-item {
|
|
228
|
+
flex-direction: row;
|
|
229
|
+
justify-content: space-between;
|
|
230
|
+
width: 100%;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.arrow-btn {
|
|
234
|
+
width: 50px;
|
|
235
|
+
height: 50px;
|
|
236
|
+
font-size: 1.2rem;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.button-group {
|
|
240
|
+
flex-direction: column;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.instructions {
|
|
244
|
+
font-size: 0.85rem;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>{{name}} - Tic Tac Toe</title>
|
|
7
|
+
<link rel="stylesheet" href="style.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<div class="game-card">
|
|
12
|
+
<h1>Tic Tac Toe</h1>
|
|
13
|
+
|
|
14
|
+
<div class="game-info">
|
|
15
|
+
<div class="current-player">
|
|
16
|
+
<span>Current Player: </span>
|
|
17
|
+
<span id="currentPlayer" class="player-x">X</span>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="score-board">
|
|
20
|
+
<div class="score-item">
|
|
21
|
+
<span class="player-x">X:</span>
|
|
22
|
+
<span id="scoreX">0</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="score-item">
|
|
25
|
+
<span>Draws:</span>
|
|
26
|
+
<span id="scoreDraw">0</span>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="score-item">
|
|
29
|
+
<span class="player-o">O:</span>
|
|
30
|
+
<span id="scoreO">0</span>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div class="board" id="board">
|
|
36
|
+
<div class="cell" data-cell="0"></div>
|
|
37
|
+
<div class="cell" data-cell="1"></div>
|
|
38
|
+
<div class="cell" data-cell="2"></div>
|
|
39
|
+
<div class="cell" data-cell="3"></div>
|
|
40
|
+
<div class="cell" data-cell="4"></div>
|
|
41
|
+
<div class="cell" data-cell="5"></div>
|
|
42
|
+
<div class="cell" data-cell="6"></div>
|
|
43
|
+
<div class="cell" data-cell="7"></div>
|
|
44
|
+
<div class="cell" data-cell="8"></div>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="message" id="message"></div>
|
|
48
|
+
|
|
49
|
+
<div class="button-group">
|
|
50
|
+
<button id="resetBtn" class="btn btn-primary">New Game</button>
|
|
51
|
+
<button id="resetScoreBtn" class="btn btn-secondary">Reset Score</button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<script src="script.js"></script>
|
|
56
|
+
</body>
|
|
57
|
+
</html>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// Tic Tac Toe Game Logic
|
|
2
|
+
|
|
3
|
+
const board = document.getElementById('board');
|
|
4
|
+
const cells = document.querySelectorAll('.cell');
|
|
5
|
+
const currentPlayerDisplay = document.getElementById('currentPlayer');
|
|
6
|
+
const messageDisplay = document.getElementById('message');
|
|
7
|
+
const resetBtn = document.getElementById('resetBtn');
|
|
8
|
+
const resetScoreBtn = document.getElementById('resetScoreBtn');
|
|
9
|
+
const scoreX = document.getElementById('scoreX');
|
|
10
|
+
const scoreO = document.getElementById('scoreO');
|
|
11
|
+
const scoreDraw = document.getElementById('scoreDraw');
|
|
12
|
+
|
|
13
|
+
let currentPlayer = 'X';
|
|
14
|
+
let gameBoard = ['', '', '', '', '', '', '', '', ''];
|
|
15
|
+
let gameActive = true;
|
|
16
|
+
let scores = { X: 0, O: 0, draw: 0 };
|
|
17
|
+
|
|
18
|
+
// Winning combinations
|
|
19
|
+
const winningCombinations = [
|
|
20
|
+
[0, 1, 2], [3, 4, 5], [6, 7, 8], // Rows
|
|
21
|
+
[0, 3, 6], [1, 4, 7], [2, 5, 8], // Columns
|
|
22
|
+
[0, 4, 8], [2, 4, 6] // Diagonals
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// Initialize game
|
|
26
|
+
function initGame() {
|
|
27
|
+
gameBoard = ['', '', '', '', '', '', '', '', ''];
|
|
28
|
+
gameActive = true;
|
|
29
|
+
currentPlayer = 'X';
|
|
30
|
+
updateCurrentPlayerDisplay();
|
|
31
|
+
messageDisplay.textContent = '';
|
|
32
|
+
messageDisplay.className = 'message';
|
|
33
|
+
|
|
34
|
+
cells.forEach(cell => {
|
|
35
|
+
cell.textContent = '';
|
|
36
|
+
cell.className = 'cell';
|
|
37
|
+
cell.addEventListener('click', handleCellClick);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Handle cell click
|
|
42
|
+
function handleCellClick(e) {
|
|
43
|
+
const cell = e.target;
|
|
44
|
+
const cellIndex = parseInt(cell.getAttribute('data-cell'));
|
|
45
|
+
|
|
46
|
+
if (gameBoard[cellIndex] !== '' || !gameActive) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
makeMove(cell, cellIndex);
|
|
51
|
+
checkResult();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Make a move
|
|
55
|
+
function makeMove(cell, index) {
|
|
56
|
+
gameBoard[index] = currentPlayer;
|
|
57
|
+
cell.textContent = currentPlayer;
|
|
58
|
+
cell.classList.add(`player-${currentPlayer.toLowerCase()}`);
|
|
59
|
+
cell.classList.add('taken');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Check game result
|
|
63
|
+
function checkResult() {
|
|
64
|
+
let roundWon = false;
|
|
65
|
+
let winningCombination = [];
|
|
66
|
+
|
|
67
|
+
for (let i = 0; i < winningCombinations.length; i++) {
|
|
68
|
+
const [a, b, c] = winningCombinations[i];
|
|
69
|
+
if (gameBoard[a] && gameBoard[a] === gameBoard[b] && gameBoard[a] === gameBoard[c]) {
|
|
70
|
+
roundWon = true;
|
|
71
|
+
winningCombination = [a, b, c];
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (roundWon) {
|
|
77
|
+
handleWin(winningCombination);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!gameBoard.includes('')) {
|
|
82
|
+
handleDraw();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
switchPlayer();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Handle win
|
|
90
|
+
function handleWin(winningCombination) {
|
|
91
|
+
gameActive = false;
|
|
92
|
+
messageDisplay.textContent = `Player ${currentPlayer} Wins! 🎉`;
|
|
93
|
+
messageDisplay.className = `message show ${currentPlayer === 'X' ? 'win-x' : 'win-o'}`;
|
|
94
|
+
|
|
95
|
+
// Highlight winning cells
|
|
96
|
+
winningCombination.forEach(index => {
|
|
97
|
+
cells[index].classList.add('winner');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Update score
|
|
101
|
+
scores[currentPlayer]++;
|
|
102
|
+
updateScoreDisplay();
|
|
103
|
+
|
|
104
|
+
// Auto reset after 2 seconds
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
initGame();
|
|
107
|
+
}, 2000);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Handle draw
|
|
111
|
+
function handleDraw() {
|
|
112
|
+
gameActive = false;
|
|
113
|
+
messageDisplay.textContent = "It's a Draw! 🤝";
|
|
114
|
+
messageDisplay.className = 'message show draw';
|
|
115
|
+
|
|
116
|
+
scores.draw++;
|
|
117
|
+
updateScoreDisplay();
|
|
118
|
+
|
|
119
|
+
// Auto reset after 2 seconds
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
initGame();
|
|
122
|
+
}, 2000);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Switch player
|
|
126
|
+
function switchPlayer() {
|
|
127
|
+
currentPlayer = currentPlayer === 'X' ? 'O' : 'X';
|
|
128
|
+
updateCurrentPlayerDisplay();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Update current player display
|
|
132
|
+
function updateCurrentPlayerDisplay() {
|
|
133
|
+
currentPlayerDisplay.textContent = currentPlayer;
|
|
134
|
+
currentPlayerDisplay.className = `player-${currentPlayer.toLowerCase()}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Update score display
|
|
138
|
+
function updateScoreDisplay() {
|
|
139
|
+
scoreX.textContent = scores.X;
|
|
140
|
+
scoreO.textContent = scores.O;
|
|
141
|
+
scoreDraw.textContent = scores.draw;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Reset score
|
|
145
|
+
function resetScore() {
|
|
146
|
+
scores = { X: 0, O: 0, draw: 0 };
|
|
147
|
+
updateScoreDisplay();
|
|
148
|
+
initGame();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Event listeners
|
|
152
|
+
resetBtn.addEventListener('click', initGame);
|
|
153
|
+
resetScoreBtn.addEventListener('click', resetScore);
|
|
154
|
+
|
|
155
|
+
// Initialize on load
|
|
156
|
+
initGame();
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
* {
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
body {
|
|
8
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
9
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding: 20px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.container {
|
|
18
|
+
width: 100%;
|
|
19
|
+
max-width: 500px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.game-card {
|
|
23
|
+
background: white;
|
|
24
|
+
border-radius: 16px;
|
|
25
|
+
padding: 30px;
|
|
26
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.game-card h1 {
|
|
30
|
+
text-align: center;
|
|
31
|
+
color: #333;
|
|
32
|
+
margin-bottom: 20px;
|
|
33
|
+
font-size: 2.5rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.game-info {
|
|
37
|
+
margin-bottom: 20px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.current-player {
|
|
41
|
+
text-align: center;
|
|
42
|
+
font-size: 1.3rem;
|
|
43
|
+
margin-bottom: 15px;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
color: #555;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.player-x {
|
|
49
|
+
color: #3b82f6;
|
|
50
|
+
font-weight: bold;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.player-o {
|
|
54
|
+
color: #ef4444;
|
|
55
|
+
font-weight: bold;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.score-board {
|
|
59
|
+
display: flex;
|
|
60
|
+
justify-content: space-around;
|
|
61
|
+
padding: 15px;
|
|
62
|
+
background: #f3f4f6;
|
|
63
|
+
border-radius: 12px;
|
|
64
|
+
margin-bottom: 20px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.score-item {
|
|
68
|
+
text-align: center;
|
|
69
|
+
font-size: 1.1rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.score-item span:last-child {
|
|
73
|
+
display: block;
|
|
74
|
+
font-size: 1.5rem;
|
|
75
|
+
font-weight: bold;
|
|
76
|
+
margin-top: 5px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.board {
|
|
80
|
+
display: grid;
|
|
81
|
+
grid-template-columns: repeat(3, 1fr);
|
|
82
|
+
gap: 10px;
|
|
83
|
+
margin: 20px 0;
|
|
84
|
+
padding: 10px;
|
|
85
|
+
background: #f9fafb;
|
|
86
|
+
border-radius: 12px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.cell {
|
|
90
|
+
aspect-ratio: 1;
|
|
91
|
+
background: white;
|
|
92
|
+
border: 3px solid #e5e7eb;
|
|
93
|
+
border-radius: 12px;
|
|
94
|
+
font-size: 3rem;
|
|
95
|
+
font-weight: bold;
|
|
96
|
+
display: flex;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
align-items: center;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
transition: all 0.3s ease;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.cell:hover:not(.taken) {
|
|
104
|
+
background: #f3f4f6;
|
|
105
|
+
transform: scale(1.05);
|
|
106
|
+
border-color: #9ca3af;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.cell.taken {
|
|
110
|
+
cursor: not-allowed;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.cell.player-x {
|
|
114
|
+
color: #3b82f6;
|
|
115
|
+
animation: scaleIn 0.3s ease;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.cell.player-o {
|
|
119
|
+
color: #ef4444;
|
|
120
|
+
animation: scaleIn 0.3s ease;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.cell.winner {
|
|
124
|
+
background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
|
|
125
|
+
animation: winnerPulse 0.6s ease;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@keyframes scaleIn {
|
|
129
|
+
0% {
|
|
130
|
+
transform: scale(0);
|
|
131
|
+
}
|
|
132
|
+
50% {
|
|
133
|
+
transform: scale(1.2);
|
|
134
|
+
}
|
|
135
|
+
100% {
|
|
136
|
+
transform: scale(1);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@keyframes winnerPulse {
|
|
141
|
+
0%, 100% {
|
|
142
|
+
transform: scale(1);
|
|
143
|
+
}
|
|
144
|
+
50% {
|
|
145
|
+
transform: scale(1.1);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.message {
|
|
150
|
+
text-align: center;
|
|
151
|
+
font-size: 1.3rem;
|
|
152
|
+
font-weight: bold;
|
|
153
|
+
height: 40px;
|
|
154
|
+
display: flex;
|
|
155
|
+
justify-content: center;
|
|
156
|
+
align-items: center;
|
|
157
|
+
margin-bottom: 20px;
|
|
158
|
+
opacity: 0;
|
|
159
|
+
transition: opacity 0.3s ease;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.message.show {
|
|
163
|
+
opacity: 1;
|
|
164
|
+
animation: slideDown 0.4s ease;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.message.win-x {
|
|
168
|
+
color: #3b82f6;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.message.win-o {
|
|
172
|
+
color: #ef4444;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.message.draw {
|
|
176
|
+
color: #8b5cf6;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@keyframes slideDown {
|
|
180
|
+
from {
|
|
181
|
+
transform: translateY(-20px);
|
|
182
|
+
opacity: 0;
|
|
183
|
+
}
|
|
184
|
+
to {
|
|
185
|
+
transform: translateY(0);
|
|
186
|
+
opacity: 1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.button-group {
|
|
191
|
+
display: flex;
|
|
192
|
+
gap: 10px;
|
|
193
|
+
justify-content: center;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.btn {
|
|
197
|
+
flex: 1;
|
|
198
|
+
padding: 12px 24px;
|
|
199
|
+
border: none;
|
|
200
|
+
border-radius: 8px;
|
|
201
|
+
font-size: 1rem;
|
|
202
|
+
font-weight: 600;
|
|
203
|
+
cursor: pointer;
|
|
204
|
+
transition: all 0.3s ease;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.btn-primary {
|
|
208
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
209
|
+
color: white;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.btn-primary:hover {
|
|
213
|
+
transform: translateY(-2px);
|
|
214
|
+
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.btn-secondary {
|
|
218
|
+
background: #6b7280;
|
|
219
|
+
color: white;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.btn-secondary:hover {
|
|
223
|
+
background: #4b5563;
|
|
224
|
+
transform: translateY(-2px);
|
|
225
|
+
box-shadow: 0 5px 15px rgba(107, 114, 128, 0.4);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@media (max-width: 480px) {
|
|
229
|
+
.game-card {
|
|
230
|
+
padding: 20px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.game-card h1 {
|
|
234
|
+
font-size: 2rem;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.cell {
|
|
238
|
+
font-size: 2rem;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.button-group {
|
|
242
|
+
flex-direction: column;
|
|
243
|
+
}
|
|
244
|
+
}
|