|
5 | 5 | align-items: center; |
6 | 6 | background-color: #282c34; |
7 | 7 | color: white; |
| 8 | + padding: 20px; |
| 9 | + min-height: 100vh; |
| 10 | + box-sizing: border-box; |
8 | 11 | } |
9 | 12 |
|
10 | 13 | h1 { |
11 | 14 | color: red; |
| 15 | + margin: 0.5em 0; |
| 16 | + font-size: clamp(1.5em, 5vw, 2.5em); |
12 | 17 | } |
13 | 18 |
|
14 | 19 | .scoreboard { |
15 | 20 | display: flex; |
16 | 21 | justify-content: space-around; |
17 | | - width: 300px; |
| 22 | + width: min(300px, 90vw); |
18 | 23 | margin-bottom: 20px; |
19 | | - font-size: 1.2em; |
| 24 | + font-size: clamp(1em, 3vw, 1.2em); |
20 | 25 | } |
21 | 26 |
|
22 | 27 | .game-board { |
23 | 28 | display: grid; |
24 | | - grid-template-columns: repeat(3, 100px); |
25 | | - grid-template-rows: repeat(3, 100px); |
| 29 | + grid-template-columns: repeat(3, min(100px, 25vw)); |
| 30 | + grid-template-rows: repeat(3, min(100px, 25vw)); |
26 | 31 | gap: 5px; |
| 32 | + max-width: 90vw; |
27 | 33 | } |
28 | 34 |
|
29 | 35 | .cell { |
30 | | - width: 100px; |
31 | | - height: 100px; |
| 36 | + width: 100%; |
| 37 | + aspect-ratio: 1; |
32 | 38 | background-color: #61dafb; |
33 | 39 | border: 2px solid #282c34; |
34 | 40 | display: flex; |
35 | 41 | justify-content: center; |
36 | 42 | align-items: center; |
37 | | - font-size: 3em; |
| 43 | + font-size: clamp(2em, 8vw, 3em); |
38 | 44 | cursor: pointer; |
39 | 45 | transition: background-color 0.3s; |
40 | 46 | } |
|
72 | 78 |
|
73 | 79 | .game-over-message { |
74 | 80 | margin-top: 20px; |
75 | | - font-size: 1.5em; |
| 81 | + font-size: clamp(1.2em, 4vw, 1.5em); |
76 | 82 | color: #ff4757; |
77 | 83 | height: 30px; |
| 84 | + text-align: center; |
78 | 85 | } |
79 | 86 |
|
80 | 87 | #restart-button { |
81 | 88 | margin-top: 20px; |
82 | 89 | padding: 10px 20px; |
83 | | - font-size: 1em; |
| 90 | + font-size: clamp(0.9em, 3vw, 1em); |
84 | 91 | cursor: pointer; |
85 | 92 | background-color: #61dafb; |
86 | 93 | border: none; |
87 | 94 | color: #282c34; |
88 | 95 | border-radius: 5px; |
89 | 96 | transition: background-color 0.3s; |
| 97 | + min-width: 120px; |
90 | 98 | } |
91 | 99 |
|
92 | 100 | #restart-button:hover { |
93 | 101 | background-color: #4a9eb4; |
94 | 102 | } |
| 103 | + |
| 104 | +/* Media queries for better mobile experience */ |
| 105 | +@media (max-width: 480px) { |
| 106 | + body { |
| 107 | + padding: 10px; |
| 108 | + } |
| 109 | + |
| 110 | + .scoreboard { |
| 111 | + width: 100%; |
| 112 | + font-size: 0.9em; |
| 113 | + } |
| 114 | + |
| 115 | + .game-board { |
| 116 | + gap: 3px; |
| 117 | + } |
| 118 | + |
| 119 | + .cell { |
| 120 | + border-width: 1px; |
| 121 | + } |
| 122 | + |
| 123 | + #restart-button { |
| 124 | + width: 100%; |
| 125 | + max-width: 200px; |
| 126 | + } |
| 127 | +} |
0 commit comments