-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtic.css
142 lines (123 loc) · 2.64 KB
/
tic.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
:root {
--cell-size: 100px;
--mark-size: calc(var(--cell-size) * .9);
}
*, *::before, *::after {
box-sizing: border-box;
outline: none;
list-style: none;
border: none;
text-decoration: none;
font-family: sans-serif;
padding: 0%; margin: 0%;
background: none;
}
button {
cursor: pointer;
}
button:active {
opacity: 0.9;
}
.game {
width: 100vw;
height: 100vh;
display: grid;
justify-content: center;
align-content: center;
justify-items: center;
align-items: center;
grid-template-columns: repeat(3, auto);
}
.box {
width: var(--cell-size);
height: var(--cell-size);
border: 1px solid #000;
display: flex;
align-items: center;
position: relative;
cursor: pointer;
justify-content: center;
}
.box:first-child,
.box:nth-child(2),
.box:nth-child(3) {
border-top: none;
}
.box:nth-child(3n + 1) {
border-left: none;
}
.box:nth-child(3n + 3) {
border-right: none;
}
.box:nth-child(9),
.box:nth-child(7),
.box:nth-child(8) {
border-bottom: none;
}
.box.x::after,
.box.x::before,
.game.x .box:not(.x):not(.circle):hover:before,
.game.x .box:not(.x):not(.circle):hover:after {
content: '';
position: absolute;
width: calc(var(--mark-size) * .15);
height: var(--mark-size);
background: #000;
}
.game.x .box:not(.x):not(.circle):hover::after,
.game.x .box:not(.x):not(.circle):hover::before {
background: lightgray;
}
.box.x::before,
.game.x .box:not(.x):not(.circle):hover::before {
transform: rotate(45deg);
}
.box.x::after,
.game.x .box:not(.x):not(.circle):hover:after {
transform: rotate(-45deg);
}
.box.circle::after,
.box.circle::before,
.game.circle .box:not(.x):not(.circle):hover::before,
.game.circle .box:not(.x):not(.circle):hover::after {
content: '';
position: absolute;
border-radius: 50%;
background: #000;
}
.box.circle::before,
.game.circle .box:not(.x):not(.circle):hover::before {
width: var(--mark-size);
height: var(--mark-size);
background: #000;
}
.box.circle::after,
.game.circle .box:not(.x):not(.circle):hover::after {
width: calc(var(--mark-size) * .7);
height: calc(var(--mark-size) * .7);
background: #FFF;
}
.game.circle .box:not(.x):not(.circle):hover:before {
background: lightgray;
}
.winning-message {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0%;
background: rgba(0, 0, 0, .9);
display: none;
align-items: center;
justify-content: center;
flex-direction: column;
color: #FFF;
font-size: 4em;
}
#restartButton {
margin-top: 1em;
color: #FFF;
}
.show {
display: flex;
}
.box {
font-size: 3em;
}