-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.css
314 lines (246 loc) · 4.96 KB
/
style.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Acme&family=Press+Start+2P&display=swap');
/* If newer grid 'gap' property is not supported, ensure backup for grid is applied */
@supports (gap: 1.5rem) {
.game-area {
margin: 1.5rem;
}
}
/* General reset */
* {
margin: 0;
padding: 0;
}
/* Set background / general styles */
body {
background-image: url('./media/bg.jpg');
color: #C34134;
font-family: 'Acme', sans-serif;
font-weight: 800;
letter-spacing: 2px;
}
/* Nav holds the heading and game control buttons
Adding 'right' property to nav reconciles incompatibility between 'fixed' & 'flex' */
nav {
border-bottom: 2px solid #74A674;
display: flex;
align-items: center;
justify-content: space-between;
opacity: 0.9;
padding: 0 2.5rem;
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 1000;
}
nav,
table {
background-color: #000;
}
/* Brand image & alien icon SVGs courtesy of flaticon.io */
.brand {
padding: 10px 0;
width: 80px;
}
.brand,
.win-badge-image,
.medal-title,
.medal-image {
height: auto;
}
h1 {
font-size: 4rem;
}
h1,
#msg-display {
color: #74A674;
}
/* Area that displays messages to players during game & end of game */
.ui {
margin-top: 8%;
}
.ui,
table {
text-align: center;
}
/* Game control buttons */
button {
border: none;
border-radius: 22px;
color: #000;
cursor: pointer;
margin: 1rem;
padding: 10px 20px 10px 20px;
}
button,
caption,
#msg-display {
font-size: 1.2rem;
}
button:active {
box-shadow: inset 1px 1px 6px #FFF;
}
.flip-btn {
background: #3DC72E;
}
.flip-btn:hover {
background: #3CE853;
}
.reset-game-btn {
background: #007DE4;
}
.reset-game-btn:hover {
background: #009AFF;
}
.reset-wins-btn {
background: #D93434;
}
.reset-wins-btn:hover {
background: #FF1919;
}
/* Scoreboard section */
caption {
margin: 30px;
}
table,
th,
td {
border: 3px solid #545454;
border-collapse: collapse;
color: #FFF;
font-family: 'Press Start 2P', cursive;
font-size: 0.7rem;
padding: 1rem;
}
table,
.medal-image {
margin: auto;
}
/* Game grid containing all images / cards */
.game-area {
display: grid;
grid-template-rows: repeat(4, 1fr);
grid-template-columns: repeat(5, 1fr);
gap: 1rem;
margin-top: 5%;
}
.card img {
height: 100%;
width: 100%;
}
/* Win badge that displays for the winner at the end of the game & medals that are acquired when enough games are won (initially hidden) */
.win-badge-image,
.medal-title,
.medal-image {
width: 70px;
}
.medal-title {
width: 30px;
}
/* Set general properties of each individual card */
.game-area div {
background-color: #74A674;
border-radius: 10%;
height: 250px;
width: 230px;
}
/* Sections that contain cards in divs */
.container {
height: 300px;
position: relative;
width: 200px;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
-o-perspective: 1000px;
perspective: 1000px;
}
/* Individual card styling */
.card,
.card div {
height: 100%;
position: absolute;
width: 100%;
}
.card {
transform-style: preserve-3d;
transition: transform 1s;
-webkit-transform-origin: 50% 50%;
}
/* 'Transform' and 'rotate' had a 98% compatibilty rating, so some webkits omitted */
.card div {
display: block;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
/* Back of each card & class applied with JS in order to turn card over when clicked */
.card .back,
.card.flipped {
transform: rotateY(180deg);
}
/* Animations: removing cards when pair is found */
@keyframes slide-left {
100% {
margin-left: -5000px;
}
}
@keyframes slide-up {
100% {
margin-top: -5000px;
}
}
/* Hide the divs that show a win animation - unnecessary until game over */
.span-container,
.medal-image {
display: none;
}
/* General styling & spacing between elements */
#msg-display,
#pvp-display {
padding: 20px;
}
#pvp-display,
#winner-title,
#winner-name {
font-size: 2.5rem;
}
/* Animation showing who plays who, which runs after users have entered their names */
@keyframes matchup {
0% {
font-size: 0;
opacity: 0;
}
50% {
font-size: 3rem;
text-shadow: 2px 2px 12px #74A674;
}
}
/* Animations for winner name displayed at the end of the game */
#winner-title {
animation: train 1.8s ease forwards;
margin-right: 1rem;
}
#winner-name {
animation: plane 2.8s ease forwards;
position: absolute;
}
/* First half of text slides in from left, 'train' */
@keyframes train {
0% {
margin-left: -2000px;
}
100% {
margin-left: inherit;
}
}
/* Second half of text drops in from top, 'plane' */
@keyframes plane {
0% {
margin-top: -2000px;
}
100% {
margin-top: inherit;
}
}