/* =====================================================
   JEUX — Aire de Jeu des Explorateurs
   ===================================================== */

/* ── Jeu Mémoire ── */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 500px;
    margin: 2rem auto;
}

.memory-card {
    aspect-ratio: 1;
    background: var(--gradient-primary);
    border-radius: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: transparent;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s ease,
                box-shadow 0.3s ease;
    user-select: none;
    box-shadow: 3px 4px 0 rgba(0,0,0,0.15);
}

.memory-card:hover:not(.matched) {
    transform: scale(1.06);
}

.memory-card.flipped {
    background: var(--bg-card);
    border: 2.5px solid var(--primary);
    color: var(--text-main);
    box-shadow: 3px 4px 0 rgba(45,106,79,0.2);
}

[data-theme="dark"] .memory-card {
    box-shadow: 3px 4px 0 rgba(100,255,218,0.15);
}

[data-theme="dark"] .memory-card.flipped {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(100,255,218,0.2);
}

.memory-card.matched {
    background: var(--success);
    color: white;
    cursor: default;
    box-shadow: 0 0 20px rgba(82,183,136,0.5),
                3px 4px 0 rgba(0,0,0,0.1);
    animation: bounceIn 0.4s ease;
}

[data-theme="dark"] .memory-card.matched {
    box-shadow: 0 0 25px rgba(0,184,148,0.55);
}

/* ── Jeu Calcul Mental ── */
.math-game {
    text-align: center;
    padding: 2rem;
}

.math-question {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    text-shadow: 2px 2px 0 rgba(45,106,79,0.12);
}

[data-theme="dark"] .math-question {
    color: var(--primary);
    text-shadow: 0 0 20px rgba(100,255,218,0.4);
}

.math-input {
    font-size: 2rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    padding: 0.5rem 1rem;
    width: 160px;
    text-align: center;
    border-radius: 1rem;
    border: 3px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 3px 4px 0 rgba(212,184,150,0.4);
}

.math-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(45,106,79,0.15),
                3px 4px 0 rgba(45,106,79,0.2);
}

[data-theme="dark"] .math-input {
    box-shadow: 3px 4px 0 rgba(100,255,218,0.1);
}

[data-theme="dark"] .math-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(100,255,218,0.15),
                3px 4px 0 rgba(100,255,218,0.15);
}

.math-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-muted);
}

.math-stats span {
    padding: 0.4rem 1rem;
    background: var(--stamp-color);
    border-radius: 50px;
    border: 2px solid var(--border);
    font-size: 0.95rem;
}

/* ── Simon & Réflexe ── */
.simon-btn.active {
    opacity: 1 !important;
    transform: scale(1.08);
    box-shadow: 0 0 25px currentColor;
    filter: brightness(1.3);
}

.reflex-target {
    position: absolute;
    font-size: 3rem;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 0 12px rgba(255,235,59,0.85));
    animation: targetPop 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}

@keyframes targetPop {
    from { transform: scale(0) rotate(-20deg); }
    to   { transform: scale(1) rotate(0deg);  }
}

/* ── Texte WOW ── */
@keyframes wowAnim {
    0%   { transform: translate(-50%,-50%) scale(0)   rotate(-20deg); opacity: 0; }
    20%  { transform: translate(-50%,-50%) scale(1.5) rotate( 10deg); opacity: 1; }
    80%  { transform: translate(-50%,-50%) scale(1.2) rotate( -5deg); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(2)   rotate( 20deg); opacity: 0; }
}

.wow-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%) scale(0);
    font-size: 8rem;
    font-weight: 900;
    color: var(--secondary);
    text-shadow: 0 0 25px rgba(233,168,58,0.85),
                 0 0 50px rgba(233,168,58,0.5),
                 4px 4px 0 rgba(0,0,0,0.15);
    z-index: 3000;
    animation: wowAnim 2s ease forwards;
    pointer-events: none;
    font-family: 'Outfit', sans-serif;
}

[data-theme="dark"] .wow-text {
    color: var(--secondary);
    text-shadow: 0 0 30px rgba(255,214,10,0.9),
                 0 0 60px rgba(255,214,10,0.5);
}
