*,
*::after,
*::before {
    box-sizing: border-box;
}

:root {
    --cell-size: 100px;
    --mark-size: calc(var(--cell-size) * .9);
}

body {
    margin: 0;
}

.board {
    width: 100vw;
    height: 100vh;
    display: grid;
    justify-content: center;
    align-content: center;
    justify-items: center;
    align-items: center;
    grid-template-columns: repeat(3, auto);
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    border: 1px solid black;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
}

/* remove cell borders */

.cell:first-child,
.cell:nth-child(2),
.cell:nth-child(3) {
    border-top: none;
}

.cell:last-child,
.cell:nth-child(7),
.cell:nth-child(8){
    border-bottom: none;
}

.cell:nth-child(3n + 1) {
    border-left: none;
}

.cell:nth-child(3n + 3) {
    border-right: none;
}

.cell.x,
.cell.o {
    cursor: not-allowed;
}


.cell.x::before,
.cell.x::after,
.cell.o::before,
.cell.o::after {
    background-color: black;
}

/* mark shadows */

.board.x .cell:not(.x):not(.o):hover::after, 
.board.x .cell:not(.x):not(.o):hover::before,
.board.o .cell:not(.x):not(.o):hover::after,
.board.o .cell:not(.x):not(.o):hover::after {
    background-color: lightgrey;
}


/* X mark classes */

.cell.x::after,
.cell.x::before,
.board.x .cell:not(.x):not(.o):hover::after, 
.board.x .cell:not(.x):not(.o):hover::before {
    content: '';
    width: calc(var(--mark-size) * .15);
    height: var(--mark-size);
    position: absolute;
}

.cell.x::before,
.board.x .cell:not(.x):not(.o):hover::before {
    transform: rotate(45deg);
}


.cell.x::after,
.board.x .cell:not(.x):not(.o):hover::after{
    transform: rotate(-45deg);
}


/* O mark classes */

.cell.o::after,
.board.o .cell:not(.x):not(.o):hover::after {
    content: '';
    width: calc(var(--mark-size) * .90);
    height: calc(var(--mark-size) * .90);
    position: absolute;
    border-radius: 100%;
}

.cell.o::before,
.board.o .cell:not(.x):not(.o):hover::before {
    content: '';
    width: calc(var(--mark-size) * .60);
    height: calc(var(--mark-size) * .60);
    background-color: white;
    z-index: 1;
    position: absolute;
    border-radius: 100%;
}

/*  */

/* Overlay message */

.overlay {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
    color: white;
    font-size: 5rem;
}


.winning-message + button {
    font-size: 3rem;
    background-color: white;
    border: 2px solid black;
}

.winning-message + button:hover {
    font-size: 3rem;
    background-color: black;
    border: 2px solid white;
    color: white;
    cursor: pointer;
}

.show {
    display: flex;
    flex-direction: column;
}

/* Footer */

.fa-github {
    color: black;
    font-size: 24px;
    transition: transform 0.3s ease-in-out;
}

.fa-github:hover {
    transform: rotate(360deg) scale(1.2);
}

footer {
    text-align: center;
    margin: 10px;
    margin-top: auto;
    font-size: 20px;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-family: 'Courier New', Courier, monospace;
}


