@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Press Start 2P', sans-serif;
}


:root {
    --font-base: 16px;
    --font-title: 2rem;
    --font-small: 0.875rem;
    --line-height: 1.5;
    --bg: #ffffff;
    --bg-secondary: #272525;
    --color: #f7f4f4;
}


body {
    /* background: linear-gradient(to right, rgb(47, 128, 90), rgb(13, 41, 119)); */
    font-size: var(--font-base);
    line-height: var(--line-height);
    color: var(--color);
    background-color: var(--bg);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    background-color: var(--bg-secondary);
    padding: 40px 30px;
    border-radius: 30px;
}

h2 {
    font-size: var(--font-title);
    font-style: normal;
    color: var(--color);
    text-transform: uppercase;
    letter-spacing: 0.1rem;
}

.reset {
    padding: 10px 20px;
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--color);
    color: var(--bg-secondary);
    border-radius: 30px;
    font-size: var(--font-small);
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.reset:focus {
    outline: none;
    color: red;
    background-color: var(--bg-secondary);
}

.game {
    width: 440px;
    height: 440px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    transform-style: preserve-3d;
    perspective: 500px;
}

.item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    border: 2px solid var(--bg);
    transform: rotateY(180deg);
    transition: 0.6s;
}

.item.boxOpen {
    transform: rotateY(0deg);
}

.item.boxMatch {
    transform: rotateY(0deg);
}

.item::after {
    content: "";
    transition: 0.6s;
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background-color: var(--bg-secondary);
    transform: rotateY(0deg);
    backface-visibility: hidden;
}

.item:hover {
    cursor: pointer;
    border-color: red;
}


.boxOpen:after,
.boxMatch:after {
    transform: rotateY(180deg);
}

@media screen and (min-width: 275px) and (max-width: 700px),
(max-width: 440px),
(min-width: 375px) and (max-width: 500px) {
    * {
        box-sizing: content-box;
    }

    .container {
        padding: 5px 5px;
        gap: 5px;
    }

    .game {
        width: 340px;
        height: 350px;
    }

    .item {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .reset {
        padding: 5px 10px;
    }
}