body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #000069;
    user-select: none;
}

.container {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    border-radius: 20px;
    background: linear-gradient(90deg, rgba(2, 0, 36, 1) 50%, rgba(9, 9, 121, 1) 70%, rgba(0, 212, 255, 1) 100%);
    padding: 40px 60px;
    border: 1px solid #fff;
}

h2 {
    font-size: 3em;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.reset {
    padding: 15px 20px;
    width: 100%;
    color: #000;
    background-color: #fff;
    border: none;
    font-size: 1.5em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    font-weight: 600;
    border-radius: 10px;
}

.reset:hover {
    background-color: #ff0000;
    color: #fff;
    transition: all 0.3s ease-in-out;
}

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

.item {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    font-size: 3em;
    transform: rotateY(180deg);
    transition: 0.25s;
    cursor: pointer;
    border-radius: 10px;
}

.item::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 1;
    background: #000;
    border: #fff 1px solid;
    transition: 0.25s;
    transform: rotateY(0deg);
    backface-visibility: hidden;
    border-radius: 10px;
}

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

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

@media (max-width: 900px) {
    .game {
        width: 360px;
        height: 360px;
        gap: 8px;
    }

    .item {
        width: 80px;
        height: 80px;
        font-size: 2.2em;
    }

    h2 {
        font-size: 2em;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px 30px;
        gap: 20px;
    }

    .game {
        width: 300px;
        height: 300px;
        gap: 6px;
    }

    .item {
        width: 65px;
        height: 65px;
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.8em;
    }

    .reset {
        font-size: 1.2em;
        padding: 10px;
    }
}

@media (max-width: 400px) {
    .game {
        width: 250px;
        height: 250px;
        gap: 5px;
    }

    .item {
        width: 55px;
        height: 55px;
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.5em;
    }

    .reset {
        font-size: 1em;
    }
}