
body {
    font-family: Arial, sans-serif;
    background-color: #140f0f;
    display: flex;
    color: #ffffff;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.container {
    text-align: center;
    max-width: 500px;
    width: 90%; /* Scales down for smaller devices */
}

.title {
    font-size: 2rem;
    margin-bottom: 20px;
}

.moves {
    margin-bottom: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Always 4 columns */
    gap: 10px;
    margin-bottom: 20px;
}

.card {
    width: 100%; /* Full width of the grid cell */
    aspect-ratio: 1; /* Keeps cards square */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background-color: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.card.flipped {
    background-color: #4f46e5;
    color: white;
}

.card:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05); /* Slight scale effect */
}

.congratulations {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

.new-game-button, #backToGamePageButton {
    padding: 10px 20px;
    background-color: #4f46e5;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
}

.new-game-button:hover, #backToGamePageButton:hover {
    background-color: #4338ca;
}

.visible {
    display: none;
}

/* Responsive styling for small screens */
@media (max-width: 600px) {
    .card {
        font-size: 1.5rem; /* Smaller card text for small screens */
        gap: 8px;
    }
}

@media (max-width: 400px) {
    .card {
        font-size: 1.2rem; /* Adjust card text size */
    }

    .container {
        width: 95%; /* Max width for very small devices */
    }
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #f44336, #d32f2f);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.close-btn:hover {
    transform: rotate(90deg);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4);
}

.close-btn::before,
.close-btn::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: white;
    border-radius: 1px;
}

.close-btn::before {
    transform: rotate(45deg);
}

.close-btn::after {
    transform: rotate(-45deg);
}