/* ================================================================
   stylesMemoria.css  —  Módulo del juego "Parejas Braille"
   Complementa styles.css · Solo afecta a memoria.html
   ================================================================ */

/* ── Barra superior: sonido + reiniciar ──────────────────────────── */

.mem-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.btn-reiniciar-memoria {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    color: #4a3728;
    background: #fd8d32;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-reiniciar-memoria:hover { background: #ff9d4a; }

.btn-reiniciar-memoria:focus-visible {
    outline: 3px solid #fd8d32;
    outline-offset: 2px;
}

/* ── Mensaje de estado (aria-live) ──────────────────────────────── */

.mem-feedback {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #ffffff;
    min-height: 1.4em;
    margin-bottom: 1rem;
}

/* ── Tablero 4×4 ──────────────────────────────────────────────────
   4 columnas fijas de igual tamaño; el alto de cada cajetín sigue
   al ancho vía aspect-ratio para mantenerlos cuadrados en cualquier
   pantalla, sin necesidad de medir nada en JS.                     */

.mem-tablero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 480px;
    margin: 0 auto 1.5rem;
}

.mem-cajetin {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    padding: 4px;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.mem-cajetin--oculto {
    background: #2f2c2b;
}

.mem-cajetin--oculto:hover {
    background: #4a3728;
}

.mem-cajetin--revelado {
    background: rgba(253, 141, 50, 0.12);
    border: 2px solid #fd8d32;
}

.mem-cajetin--emparejado {
    background: rgba(253, 141, 50, 0.22);
    border: 2px solid #fd8d32;
    cursor: default;
}

.mem-cajetin:focus-visible {
    outline: 3px solid #fd8d32;
    outline-offset: 2px;
}

.mem-cajetin-letra {
    font-family: 'Courier New', monospace;
    font-size: clamp(20px, 6vw, 32px);
    font-weight: bold;
    color: #ffffff;
}

/* Temblor breve al fallar una pareja — respeta prefers-reduced-motion
   más abajo, igual que el resto del proyecto. */
.mem-cajetin--error {
    animation: mem-shake 0.35s ease;
}

@keyframes mem-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
    .mem-cajetin--error {
        animation: none;
    }
}

/* ── Mensaje de partida completada ──────────────────────────────── */

.mem-completado {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    color: #fffdfb;
    background: #4a3728;
    border-radius: 6px;
    padding: 20px;
    max-width: 480px;
    margin: 0 auto;
}

.mem-completado.activa {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

/* ── Responsive: cajetines y separación más compactos en móvil ──── */

@media (max-width: 768px) {
    .mem-tablero {
        gap: 6px;
        max-width: 100%;
    }

    .mem-cajetin {
        border-radius: 8px;
    }
}
