:root {
    --o-color: #ff5722;
    --x-color: #009688;
    --tie-color: #ffeb3b;
}

body {
    margin: 0;
    background-color: black;
    display: flex;
    height: 100vh;
    height: 100dvh;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: whitesmoke;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-weight: bold;
    gap: 35px;
}

.score {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

h1 {
    text-transform: uppercase;
    text-align: center;
    margin: 0;
}

.result {
    display: none;
    position: absolute;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(7px);
    box-shadow: 0 0 20px rgb(26, 24, 24);
    border-radius: 8px;
    width: 100%;
    height: 100%;
    top: -12px;
    left: -12px;
    padding: 12px;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    animation: 0.8s down;
    z-index: 99;
}

.content {
    text-align: center;
}

h2 {
    margin: 0;
    margin-bottom: 25px;
    font-size: 80px;
    text-transform: uppercase;
}

p {
    margin: 0;
    font-size: 40px;
}

.buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

button {
    background-color: transparent;
    color: whitesmoke;
    border: none;
    outline: none;
    width: 200px;
    text-align: center;
    height: 80px;
    border-radius: 20px;
    box-shadow: 0 0 5px rgb(26, 24, 24);
    font-weight: bold;
    font-size: 30px;
    cursor: pointer;
    transition: 0.3s;
}

.again:hover,
.again:focus-visible {
    background-color: #00599f;
    box-shadow: none;
}

.reset:hover,
.reset:focus-visible {
    background-color: #6f0000;
    box-shadow: none;
}

.game {
    height: 500px;
    width: 500px;
    position: relative;
}

.game-squares {
    display: grid;
    background-color: #181818;
    height: 100%;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    border: 3px solid black;
    border-radius: 5px;
}

.square {
    border: 3px solid black;
    position: relative;
    outline: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.x {
    width: 12px;
    border-radius: 8px;
    background-color: var(--x-color);
    height: 0%;
    animation: 0.5s forwards x-animation;
}

.x-text {
    color: var(--x-color);
}

.first {
    transform: rotate(28deg);
}

.second {
    transform: rotate(-28deg);
}

.o {
    height: calc(100% - 25px);
    background-color: transparent;
    width: 100%;
    border: 12px solid transparent;
    border-radius: 50%;
    animation: 0.25s forwards o-animation;
}

.o-text {
    color: var(--o-color);
}

.tie-text {
    color: var(--tie-color);
}

[player="x"].win {
    background-color: var(--x-color) !important;
}

[player="x"].win > * {
    background-color: whitesmoke !important;
}

[player="o"].win {
    background-color: var(--o-color) !important;
}

[player="o"].win > * {
    border-color: whitesmoke !important;
}

.credits {
    position: absolute;
    bottom: 10px;
    font-size: small;
    color: #181818;
    word-spacing: 2px;
    letter-spacing: 0.5px;
    opacity: 0.6;
}

.name {
    text-transform: uppercase;
    color: whitesmoke;
    letter-spacing: 2px;
}

@media (max-width: 539px) {
    .game {
        height: 400px;
        width: 400px;
    }
    .buttons {
        gap: 10px;
    }
    button {
        font-size: 25px;
        width: 180px;
        height: 70px;
    }
    h2 {
        font-size: 60px;
        margin-bottom: 20px;
    }
    p {
        font-size: 30px;
    }
}

@media (max-width: 429px) {
    h1 {
        font-size: 25px;
    }
    .game {
        height: 300px;
        width: 300px;
    }
    h2 {
        font-size: 40px;
        margin-bottom: 15px;
    }
    p {
        font-size: 20px;
    }
    button {
        font-size: 20px;
        width: 150px;
        height: 60px;
    }
    .o {
        border: 8px solid transparent;
    }
    .x {
        width: 8px;
    }
}

@media (max-width: 329px) {
    h1 {
        font-size: 20px;
    }
    h2 {
        font-size: 30px;
        margin-bottom: 10px;
    }
    button {
        font-size: 18px;
        width: 130px;
        height: 50px;
    }
    .game {
        height: 250px;
        width: 250px;
    }
    .credits {
        font-size: x-small;
    }
}

@keyframes x-animation {
    100% {
        height: 100%;
    }
}

@keyframes o-animation {
    25% {
        border-top-color: var(--o-color);
        border-right-color: transparent;
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    50% {
        border-top-color: var(--o-color);
        border-right-color: var(--o-color);
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    75% {
        border-top-color: var(--o-color);
        border-right-color: var(--o-color);
        border-bottom-color: var(--o-color);
        border-left-color: transparent;
    }
    100% {
        border-color: var(--o-color);
    }
}

@keyframes shake {
    0% {
        transform: translate(2px, 0);
    }
    100% {
        transform: translate(-2px, 0);
    }
}

@keyframes down {
    0% {
        transform: translate(0, -100%);
    }

    100% {
        transform: translate(0);
    }
}

@keyframes up {
    100% {
        transform: translate(0, -200%);
    }
}
