1+ * , * ::after , * ::before {
2+ box-sizing : border-box;
3+ }
4+
5+ : root {
6+ --cell-size : 100px ;
7+ --mark-size : calc (var (--cell-size ) * .9 );
8+ }
9+
10+ body {
11+ margin : 0 ;
12+ }
13+
14+ .board {
15+ width : 100vw ;
16+ height : 100vh ;
17+ display : grid;
18+ justify-content : center;
19+ align-content : center;
20+ justify-items : center;
21+ align-items : center;
22+ grid-template-columns : repeat (3 , auto)
23+ }
24+
25+ .cell {
26+ width : var (--cell-size );
27+ height : var (--cell-size );
28+ border : 1px solid black;
29+ display : flex;
30+ justify-content : center;
31+ align-items : center;
32+ position : relative;
33+ cursor : pointer;
34+ }
35+
36+ .cell : first-child ,
37+ .cell : nth-child (2 ),
38+ .cell : nth-child (3 ) {
39+ border-top : none;
40+ }
41+
42+ .cell : nth-child (3n + 1) {
43+ border-left : none;
44+ }
45+
46+ .cell : nth-child (3n + 3) {
47+ border-right : none;
48+ }
49+
50+ .cell : last-child ,
51+ .cell : nth-child (8 ),
52+ .cell : nth-child (7 ) {
53+ border-bottom : none;
54+ }
55+
56+ .cell .x ,
57+ .cell .circle {
58+ cursor : not-allowed;
59+ }
60+
61+ .cell .x ::before ,
62+ .cell .x ::after ,
63+ .cell .circle ::before {
64+ background-color : black;
65+ }
66+
67+ .board .x .cell : not (.x ): not (.circle ): hover ::before ,
68+ .board .x .cell : not (.x ): not (.circle ): hover ::after ,
69+ .board .circle .cell : not (.x ): not (.circle ): hover ::before {
70+ background-color : lightgrey;
71+ }
72+
73+ .cell .x ::before ,
74+ .cell .x ::after ,
75+ .board .x .cell : not (.x ): not (.circle ): hover ::before ,
76+ .board .x .cell : not (.x ): not (.circle ): hover ::after {
77+ content : '' ;
78+ position : absolute;
79+ width : calc (var (--mark-size ) * .15 );
80+ height : var (--mark-size );
81+ }
82+
83+ .cell .x ::before ,
84+ .board .x .cell : not (.x ): not (.circle ): hover ::before {
85+ transform : rotate (45deg );
86+ }
87+
88+ .cell .x ::after ,
89+ .board .x .cell : not (.x ): not (.circle ): hover ::after {
90+ transform : rotate (-45deg );
91+ }
92+
93+ .cell .circle ::before ,
94+ .cell .circle ::after ,
95+ .board .circle .cell : not (.x ): not (.circle ): hover ::before ,
96+ .board .circle .cell : not (.x ): not (.circle ): hover ::after {
97+ content : '' ;
98+ position : absolute;
99+ border-radius : 50% ;
100+ }
101+
102+ .cell .circle ::before ,
103+ .board .circle .cell : not (.x ): not (.circle ): hover ::before {
104+ width : var (--mark-size );
105+ height : var (--mark-size );
106+ }
107+
108+ .cell .circle ::after ,
109+ .board .circle .cell : not (.x ): not (.circle ): hover ::after {
110+ width : calc (var (--mark-size ) * .7 );
111+ height : calc (var (--mark-size ) * .7 );
112+ background-color : white;
113+ }
114+
115+ .winning-message {
116+ display : none;
117+ position : fixed;
118+ top : 0 ;
119+ left : 0 ;
120+ right : 0 ;
121+ bottom : 0 ;
122+ background-color : rgba (0 , 0 , 0 , .9 );
123+ justify-content : center;
124+ align-items : center;
125+ color : white;
126+ font-size : 5rem ;
127+ flex-direction : column;
128+ }
129+
130+ .winning-message button {
131+ font-size : 3rem ;
132+ background-color : white;
133+ border : 1px solid black;
134+ padding : .25em .5em ;
135+ cursor : pointer;
136+ }
137+
138+ .winning-message button : hover {
139+ background-color : black;
140+ color : white;
141+ border-color : white;
142+ }
143+
144+ .winning-message .show {
145+ display : flex;
146+ }
0 commit comments