/* GAME-SPECIFIC STYLES: memory-game.css */

.game-wrapper {
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    width: 100%;
    max-width: 800px;
    padding: 30px 20px;
    margin: 20px auto; /* Centers the card horizontally */
}

/* --- Level Selection Screen --- */
#level-selection-container {
    text-align: center;
}
#level-selection-container h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
}
.game-description {
    font-size: 16px;
    color: #555;
    margin-bottom: 30px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}
.level-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}
.level-btn {
    font-family: var(--body-font);
    width: 80%;
    max-width: 250px;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 12px;
    border: none;
    color: white;
    background-color: var(--info-color);
    transition: background-color 0.3s, transform 0.2s;
}
.level-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

/* --- Game Area --- */
#game-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap; 
    gap: 20px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
}
#game-board {
    display: grid;
    /* CSS variables for dynamic grid, set by JS */
    grid-template-columns: repeat(var(--grid-cols, 4), 1fr);
    gap: 10px;
    margin: 0 auto;
    max-width: 600px; 
}
.card {
    aspect-ratio: 1 / 1; /* Makes cards perfectly square */
    perspective: 1000px;
    cursor: pointer;
}
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.card.flipped .card-inner {
    transform: rotateY(180deg);
}
.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.card-front {
    background: #fff;
    border: 2px solid var(--info-color);
    color: var(--primary-color);
    font-size: clamp(1.5rem, 10vw, 3rem); /* Responsive font size */
    font-family: 'Noto Sans Armenian', sans-serif;
    font-weight: bold;
    transform: rotateY(180deg);
}
.card-back {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    font-size: clamp(2rem, 12vw, 4rem);
    border: 2px solid #fff;
}
.restart-btn {
    display: block;
    margin: 25px auto 0 auto;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}
.restart-btn:hover {
    background-color: #d96d00;
}

/* --- Pop-up styles --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.popup-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 100; animation: fadeIn 0.3s; }
.popup { background-color: white; padding: 30px 40px; border-radius: 15px; text-align: center; box-shadow: 0 5px 25px rgba(0,0,0,0.2); transform: scale(0.9); animation: popIn 0.3s forwards; width: 90%; max-width: 400px; }
.popup h2 { margin-top: 0; color: var(--success-color); }
.popup p { font-size: 18px; margin: 20px 0; }
.popup button { background-color: var(--info-color); color: white; border: none; border-radius: 8px; padding: 12px 25px; font-size: 16px; font-weight: bold; cursor: pointer; transition: background-color 0.3s; }
.popup button:hover { background-color: #0056b3; }

.hide { display: none; }

@media (max-width: 600px) {
    .game-wrapper {
        padding: 20px 10px;
    }
    #game-board {
        gap: 8px;
    }
}