/* ══════════════════════════════════════════ */
/* ═══════ آمارهای بالا ═══════ */
/* ══════════════════════════════════════════ */

.memory-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.memory-stat {
    text-align: center;
    padding: 15px;
    margin-bottom: 0 !important;
}

.memory-stat-label {
    font-size: 12px;
    color: #86868b;
    font-weight: 600;
}

.memory-stat-value {
    font-size: 20px;
    color: #1d1d1f;
    margin-top: 5px;
    font-weight: 800;
    transition: color 0.3s;
}

/* ══════════════════════════════════════════ */
/* ═══════ شبکه بازی حافظه ═══════ */
/* ══════════════════════════════════════════ */

.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.memory-card {
    aspect-ratio: 1;
    cursor: pointer;
    position: relative;
    background: none;
    border: none;
    padding: 0;
    transform-style: preserve-3d;
    transition: transform 0.5s;
}

.memory-card.flipped, .memory-card.matched {
    transform: rotateY(180deg);
}

.memory-card.matched {
    cursor: default;
}

.memory-card-face {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* پشت کارت (؟) */
.memory-card-back {
    background: #f5f5f7;
    color: #0071e3;
    font-size: 24px;
    font-weight: bold;
    border: 1px solid #e5e5ea;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.memory-card-back::after {
    content: "?";
    font-family: serif;
}

/* روی کارت (ایموجی) */
.memory-card-front {
    background: white;
    border: 1px solid #e5e5ea;
    transform: rotateY(180deg);
    transition: background-color 0.3s, border-color 0.3s;
}

.memory-card.matched .memory-card-front {
    background: #e8f8ed;
    border-color: #34c759;
}

/* ══════════════════════════════════════════ */
/* ═══════ پیام برد ═══════ */
/* ══════════════════════════════════════════ */

.win-message {
    display: none;
    text-align: center;
    padding: 30px;
    background: #e8f8ed;
    border-radius: 20px;
    border: 1px solid #34c759;
    margin-top: 20px;
    animation: winFadeIn 0.5s ease;
}

@keyframes winFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.win-icon {
    font-size: 50px;
    margin-bottom: 10px;
}

.win-title {
    color: #1d1d1f;
    font-size: 22px;
    font-weight: 800;
}

.win-text {
    color: #555;
    margin: 10px 0 20px 0;
    line-height: 1.8;
}

/* ══════════════════════════════════════════ */
/* ═══════ 🌟 حالت تاریک (Dark Mode) ═══════ */
/* ══════════════════════════════════════════ */

/* آمارها */
body.dark .memory-stat {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

body.dark .memory-stat-value {
    color: #f8fafc !important;
}

body.dark .memory-stat-label {
    color: #94a3b8 !important;
}

/* کارت‌ها */
body.dark .memory-card-back {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #60a5fa !important;
}

body.dark .memory-card-front {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.dark .memory-card.matched .memory-card-front {
    background: #1e3a2e !important;
    border-color: #4ade80 !important;
}

body.dark .memory-card-face {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* پیام برد در دارک */
body.dark .win-message {
    background: #1e3a2e;
    border-color: #34c759;
}

body.dark .win-title {
    color: #f8fafc;
}

body.dark .win-text {
    color: #cbd5e1;
}