/* =========================================================
   JUEGOS DE MEMORIA
   Estilos generales
   ========================================================= */

#juegos-memoria {
    --bg-color: #f7f9fc;
    --text-color: #2c3e50 !important;
    --card-bg: #ffffff;
    --primary: #2e7d32;
    --primary-hover: #1b5e20;
    --error: #c62828;
    --border-radius: 16px;
    --menu-btn: #3f51b5;
    --menu-btn-hover: #283593;
 
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text-color);
}

#juegos-memoria *,
#juegos-memoria *::before,
#juegos-memoria *::after {
    box-sizing: border-box;
}

#juegos-memoria button,
#juegos-memoria input {
    font-family: inherit;
}


/* =========================================================
   CUERPO / CONTENEDOR PRINCIPAL
   ========================================================= */

#juegos-memoria {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    background: var(--bg-color);
}

#juegos-memoria header {
    width: 100%;
    max-width: 650px;
    margin: 0 auto 20px;
    text-align: center;
}

#juegos-memoria h1 {
    margin: 0 0 10px;
    color: #1a237e;
    font-size: 2.4rem;
    line-height: 1.2;
}

#juegos-memoria .subtitle {
    margin: 0;
    color: #5c6bc0;
    font-size: 1.3rem;
    line-height: 1.4;
}

#juegos-memoria .container {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    padding: 30px;
    background: var(--card-bg);
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

/* =========================================================
   BOTONES DE DIFICULTAD DEL TRIVIAL
   ========================================================= */

/* FÁCIL: mantiene el azul claro actual */
#juegos-memoria .tm-nivel[data-tm-nivel="facil"] {
    background: #64b5f6;
    color: #ffffff;
}

#juegos-memoria .tm-nivel[data-tm-nivel="facil"]:hover {
    background: #42a5f5;
}

/* MEDIO: naranja */
#juegos-memoria .tm-nivel[data-tm-nivel="medio"] {
    background: #ef8c32;
    color: #ffffff;
}

#juegos-memoria .tm-nivel[data-tm-nivel="medio"]:hover {
    background: #d97706;
}

/* DIFÍCIL: rojo */
#juegos-memoria .tm-nivel[data-tm-nivel="dificil"] {
    background: #e05252;
    color: #ffffff;
}

#juegos-memoria .tm-nivel[data-tm-nivel="dificil"]:hover {
    background: #c62828;
}
/* =========================================================
   PANTALLAS
   ========================================================= */

#juegos-memoria .screen {
    display: none;
}

#juegos-memoria .screen.active {
    display: block;
}

#juegos-memoria h2 {
    margin: 0 0 20px;
    text-align: center;
    color: #1a237e;
    font-size: 1.8rem;
}


/* =========================================================
   BOTONES GENERALES
   ========================================================= */

#juegos-memoria .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    margin: 8px 0;
    padding: 12px 18px;

    border: none;
    border-radius: 12px;

    background: var(--menu-btn);
    color: #ffffff;

    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.2;

    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease;
}

#juegos-memoria .btn:hover {
    background: var(--menu-btn-hover);
    transform: translateY(-1px);
}

#juegos-memoria .btn:active {
    transform: translateY(1px);
}

#juegos-memoria .btn-green {
    background: var(--primary);
}

#juegos-memoria .btn-green:hover {
    background: var(--primary-hover);
}

#juegos-memoria .btn-back {
    background: #607d8b;
}

#juegos-memoria .btn-back:hover {
    background: #455a64;
}

#juegos-memoria .btn-blue {
    background: #3f51b5;
}

#juegos-memoria .btn-blue:hover {
    background: #283593;
}

#juegos-memoria .especial-card.hidden .especial-card-emoji {
    visibility: hidden;
}

/* =========================================================
   BOTONES DE VOLVER A JUGAR - TODOS LOS JUEGOS
   ========================================================= */

#juegos-memoria .btn-replay {
    background: #8e44ad;
    color: #ffffff;
}

#juegos-memoria .btn-replay:hover {
    background: #6c3483;
}
/* =========================================================
   MENÚ PRINCIPAL
   ========================================================= */

#juegos-memoria .menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

#juegos-memoria .menu-grid .btn {
    margin: 0;
}


/* =========================================================
   DIFICULTADES
   ========================================================= */

#juegos-memoria .difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

#juegos-memoria .difficulty-btn {
    width: auto;
    min-width: 100px;
    min-height: 44px;
    margin: 0;
    padding: 10px 16px;
    background: #e8eaf6;
    color: #303f9f;
}

#juegos-memoria .difficulty-btn:hover {
    background: #c5cae9;
}

#juegos-memoria .difficulty-btn.active {
    background: #3f51b5;
    color: #ffffff;
}

/* =========================================================
   MEJORAS PARA ORDENADOR (BLOQUE DEFENSA TOTAL)
   ========================================================= */
@media (min-width: 900px) {

    /* Forzamos el contenedor general del plugin */
    #juegos-memoria {
        max-width: 900px !important;
        width: 100% !important;
        margin: 0 auto !important;
    }

    /* Forzamos el contenedor de la página */
    #juegos-memoria .container {
        max-width: 900px !important;
        width: 100% !important;
    }

    /* Forzamos la caja que envuelve la imagen */
    #juegos-memoria .menu-image-container {
        max-width: 900px !important;
        width: 100% !important;
        margin: 0 auto !important;
    }

    /* Nos aseguramos de que la imagen ocupe todo el espacio asignado */
    #juegos-memoria .menu-bg-img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
}

/* =====================================================
   TRIVIAL MAYORES
   Estilos limitados a este juego
   ===================================================== */

#juegos-memoria #screen-trivial-mayores #tm-visual {
    text-align: center;
    margin: 20px auto;
}

#juegos-memoria #screen-trivial-mayores .tm-emoji {
    display: block;
    font-size: clamp(4rem, 12vw, 7rem);
    line-height: 1.3;
}

#juegos-memoria #screen-trivial-mayores .tm-imagen {
    display: block;
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 12px;
}

#juegos-memoria #screen-trivial-mayores .tm-pregunta {
    max-width: 760px;
    margin: 20px auto;
    padding: 20px;
    background: #f5f7fa;
    border-radius: 16px;
    font-size: 1.3rem;
    font-weight: bold;
    line-height: 1.6;
    text-align: center;
}

#juegos-memoria #screen-trivial-mayores .tm-opciones {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 760px;
    margin: 20px auto;
}

#juegos-memoria #screen-trivial-mayores .tm-opcion {
    min-height: 58px;
    padding: 12px 18px;
    font-size: 1.1rem;
    white-space: normal;
}

#juegos-memoria #screen-trivial-mayores #tm-progreso,
#juegos-memoria #screen-trivial-mayores #tm-resultado {
    color: #1a202c !important;
    margin: 16px 0;
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: center;
}

#juegos-memoria #screen-trivial-mayores .tm-correcta {
    background: #dff3e4;
    border: 2px solid #32834a;
}

#juegos-memoria #screen-trivial-mayores .tm-incorrecta {
    background: #fbe5e5;
    border: 2px solid #b64242;
}

#juegos-memoria #screen-trivial-mayores button:disabled {
    opacity: 0.85;
    cursor: default;
}

#juegos-memoria #screen-trivial-mayores [hidden] {
    display: none !important;
}

@media (max-width: 600px) {
    #juegos-memoria #screen-trivial-mayores .tm-pregunta {
        padding: 14px;
        font-size: 1.15rem;
    }

    #juegos-memoria #screen-trivial-mayores .tm-imagen {
        max-height: 240px;
    }
}

/* =========================================================
   CORRECCIÓN DE VISIBILIDAD PARA TRIVIAL MAYORES
   ========================================================= */

/* Forzamos el color del texto a negro/oscuro y eliminamos efectos borrosos */
#juegos-memoria #screen-trivial-mayores .tm-pregunta {
    color: #1a202c !important; /* Color oscuro muy legible */
    text-shadow: none !important; /* Eliminamos sombras del menú que emborronen el texto */
    background: #f5f7fa !important; /* Mantenemos su fondo claro */
    opacity: 1 !important; /* Nos aseguramos de que no esté semitransparente */
    display: block !important; /* Asegura que el contenedor sea visible */
}

/* =====================================================
   TRIVIAL MAYORES: BOTONES DE DIFICULTAD
   ===================================================== */

#juegos-memoria #screen-trivial-mayores .tm-dificultades {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px auto;
}

#juegos-memoria #screen-trivial-mayores .tm-nivel {
    flex: 1 1 120px;
    min-height: 54px;
    font-size: 1.05rem;
    border: 2px solid #dce3ea;
}

/* Nivel seleccionado */
#juegos-memoria #screen-trivial-mayores .tm-nivel.active {
    background: #4b84cc;
    color: #ffffff;
    border-color: #17457f;
    font-weight: bold;
}

/* Mantener visible el texto de las respuestas */
#juegos-memoria #screen-trivial-mayores .tm-opcion {
    color: #ffffff;
}

#juegos-memoria #screen-trivial-mayores .tm-opcion.tm-correcta,
#juegos-memoria #screen-trivial-mayores .tm-opcion.tm-incorrecta {
    color: #000000 !important;
}

@media (max-width: 480px) {
    #juegos-memoria #screen-trivial-mayores .tm-dificultades {
        gap: 8px;
    }

    #juegos-memoria #screen-trivial-mayores .tm-nivel {
        flex-basis: 100%;
        width: 100%;
    }
}

/* =====================================================
   RECUERDA LA ESCENA
   Estilos limitados a este juego
   ===================================================== */

#juegos-memoria #screen-escena #escena-foto-panel {
    max-width: 760px;
    margin: 20px auto;
    padding: 16px;
    background: #f5f7fa;
    border-radius: 16px;
    text-align: center;
}

#juegos-memoria #screen-escena #escena-foto {
    display: block;
    width: 100%;
    max-height: 430px;
    object-fit: contain;
    margin: 0 auto;
    border-radius: 12px;
}

#juegos-memoria #screen-escena #escena-foto[hidden],
#juegos-memoria #screen-escena [hidden] {
    display: none !important;
}

#juegos-memoria #screen-escena #escena-aviso,
#juegos-memoria #screen-escena #escena-progreso,
#juegos-memoria #screen-escena #escena-resultado {
    color: #1a202c !important;
    font-size: 1.15rem;
    line-height: 1.6;
    margin: 16px 0;
}

#juegos-memoria #screen-escena .escena-pregunta {
    margin: 20px 0;
    padding: 18px;
    border: 1px solid #dce3ea;
    border-radius: 14px;
}

#juegos-memoria #screen-escena .escena-pregunta h3 {
    font-size: 1.25rem;
    line-height: 1.5;
}

#juegos-memoria #screen-escena .escena-opciones {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

#juegos-memoria #screen-escena .escena-opcion {
    min-height: 54px;
    white-space: normal;
    font-size: 1.1rem;
}

#juegos-memoria #screen-escena .escena-correcta {
    background: #dff3e4;
    border: 2px solid #32834a;
}

#juegos-memoria #screen-escena .escena-incorrecta {
    background: #fbe5e5;
    border: 2px solid #b64242;
}

#juegos-memoria #screen-escena button:disabled {
    opacity: 0.85;
    cursor: default;
}

@media (max-width: 600px) {
    #juegos-memoria #screen-escena #escena-foto-panel {
        padding: 10px;
    }

    #juegos-memoria #screen-escena #escena-foto {
        max-height: 300px;
    }
}


/* ======================================
   PALABRAS CRUZADAS
   ====================================== */

#juegos-memoria #screen-cruzadas .cruzadas-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}

#juegos-memoria #screen-cruzadas .cruzadas-header {
    text-align: center;
    margin-bottom: 20px;
}

#juegos-memoria #screen-cruzadas .cruzadas-header h2 {
    margin: 12px 0 8px;
    font-size: clamp(24px, 4vw, 34px);
}

#juegos-memoria #screen-cruzadas .cruzadas-header p {
    margin: 0;
    opacity: 0.8;
}

#juegos-memoria #screen-cruzadas .cruzadas-back {
    display: block;
    margin-bottom: 12px;
}

#juegos-memoria #screen-cruzadas .cruzadas-difficulty {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

#juegos-memoria #screen-cruzadas .cruzadas-level {
    padding: 10px 22px;
    border: 2px solid #3978c5;
    border-radius: 24px;
    background: #fff;
    color: #245a9d;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

#juegos-memoria #screen-cruzadas .cruzadas-level.active {
    background: #3978c5;
    color: #fff;
}

#juegos-memoria #screen-cruzadas .cruzadas-status {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0;
    font-size: 14px;
    font-weight: 700;
}

#juegos-memoria #screen-cruzadas .cruzadas-message {
    padding: 12px;
    margin: 12px 0 18px;
    border-radius: 10px;
    background: #edf4ff;
    color: #244d7c;
    text-align: center;
    line-height: 1.5;
}

#juegos-memoria #screen-cruzadas .cruzadas-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
    gap: 24px;
    align-items: start;
}

#juegos-memoria #screen-cruzadas .cruzadas-board-panel {
    min-width: 0;
}

#juegos-memoria #screen-cruzadas .cruzadas-grid {
    display: grid;
    grid-template-columns: repeat(var(--cruzadas-cols, 15), minmax(0, 1fr));
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    border-top: 1px solid #777;
    border-left: 1px solid #777;
    background: #202a36;
    gap: 0;
}

#juegos-memoria #screen-cruzadas .cruzadas-cell {
    position: relative;
    min-width: 0;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-right: 1px solid #777;
    border-bottom: 1px solid #777;
    border-radius: 0;
    background: #fff;
    color: #152334;
    font: inherit;
}

#juegos-memoria #screen-cruzadas .cruzadas-cell.black {
    background: #202a36;
}

#juegos-memoria #screen-cruzadas .cruzadas-cell:focus-within,
#juegos-memoria #screen-cruzadas .cruzadas-cell.selected {
    background: #b9dcff;
    outline: 2px solid #2878d0;
    outline-offset: -2px;
    z-index: 1;
}

#juegos-memoria #screen-cruzadas .cruzadas-cell.in-word {
    background: #e4f1ff;
}

#juegos-memoria #screen-cruzadas .cruzadas-cell input {
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #152334;
    text-align: center;
    text-transform: uppercase;
    font-size: clamp(12px, 2.5vw, 23px);
    font-weight: 700;
    caret-color: #2878d0;
    box-sizing: border-box;
}

#juegos-memoria #screen-cruzadas .cruzadas-cell input:focus {
    background: #b9dcff;
}

#juegos-memoria #screen-cruzadas .cruzadas-number {
    position: absolute;
    top: 1px;
    left: 2px;
    z-index: 2;
    font-size: clamp(7px, 1vw, 10px);
    line-height: 1;
    pointer-events: none;
    color: #334155;
}

#juegos-memoria #screen-cruzadas .cruzadas-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0;
}

#juegos-memoria #screen-cruzadas .cruzadas-action {
    padding: 10px 14px;
    border: 0;
    border-radius: 9px;
    background: #3978c5;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

#juegos-memoria #screen-cruzadas .cruzadas-action:hover {
    background: #285e9e;
}

#juegos-memoria #screen-cruzadas .cruzadas-clues {
    display: grid;
    gap: 20px;
}

#juegos-memoria #screen-cruzadas .cruzadas-clue-section h3 {
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #d9e3ee;
    font-size: 18px;
}

#juegos-memoria #screen-cruzadas .cruzadas-clue {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px;
    margin-bottom: 7px;
    border: 1px solid #dce3eb;
    border-radius: 8px;
    background: #fff;
    color: #263547;
    text-align: left;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    cursor: pointer;
}

/* Ajustar el recuadro al texto de cada definición */
#juegos-memoria #screen-cruzadas .cruzadas-clue {
    height: auto;
    min-height: 54px;
    align-items: center;
    padding: 12px;
    box-sizing: border-box;
}

#juegos-memoria #screen-cruzadas .cruzadas-clue-number {
    align-self: flex-start;
    padding-top: 2px;
}

#juegos-memoria #screen-cruzadas .cruzadas-clue-section {
    min-width: 0;
}



#juegos-memoria #screen-cruzadas .cruzadas-clue.active {
    border-color: #3978c5;
    background: #e4f1ff;
    box-shadow: inset 3px 0 #3978c5;
}

#juegos-memoria #screen-cruzadas .cruzadas-clue-number {
    flex: 0 0 24px;
    min-width: 24px;
    font-weight: 800;
    color: #2868ad;
}

#juegos-memoria #screen-cruzadas .cruzadas-clue.solved {
    color: #237448;
    background: #edf9f0;
}

@media (max-width: 700px) {
    #juegos-memoria #screen-cruzadas .cruzadas-container {
        padding: 10px;
    }

    #juegos-memoria #screen-cruzadas .cruzadas-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    #juegos-memoria #screen-cruzadas .cruzadas-grid {
        max-width: 100%;
    }

    #juegos-memoria #screen-cruzadas .cruzadas-actions {
        gap: 7px;
    }

    #juegos-memoria #screen-cruzadas .cruzadas-action {
        padding: 10px;
        font-size: 13px;
    }

    #juegos-memoria #screen-cruzadas .cruzadas-level {
        padding: 9px 17px;
    }
}



/* =========================================================
   BUSCAR PAREJAS
   ========================================================= */

#juegos-memoria #grid-parejas {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
}

#juegos-memoria .pareja-card {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;
    background: #3f51b5;
    color: transparent;

    font-size: 2rem;
    cursor: pointer;

    user-select: none;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

#juegos-memoria .pareja-card:hover {
    transform: scale(1.03);
}

#juegos-memoria .pareja-card.flipped,
#juegos-memoria .pareja-card.matched {
    background: #ffffff;
    color: #2c3e50;
    border: 3px solid #3f51b5;
}

#juegos-memoria .pareja-card.matched {
    border-color: var(--primary);
    background: #e8f5e9;
}


/* PAREJAS: colocar los dos botones en horizontal */
#juegos-memoria #btn-restart-parejas {
    display: inline-flex;
    width: calc(50% - 8px);
    vertical-align: top;
    margin-right: 8px;
}

#juegos-memoria #btn-restart-parejas + .btn-back {
    display: inline-flex;
    width: calc(50% - 8px);
    vertical-align: top;
    margin-left: 0;
}

/* =========================================================
   SOPA DE LETRAS
   ========================================================= */

#juegos-memoria #words-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;

    margin-bottom: 20px;
}

#juegos-memoria .word-item {
    padding: 7px 12px;
    border-radius: 20px;
    background: #e8eaf6;
    color: #303f9f;
    font-weight: 600;
}

#juegos-memoria .word-item.found {
    background: #c8e6c9;
    color: #1b5e20;
    text-decoration: line-through;
}

#juegos-memoria #sopa-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;

    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;

    user-select: none;
}

#juegos-memoria .sopa-cell {
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #f5f5f5;
    border: 1px solid #d0d0d0;
    border-radius: 4px;

    color: #2c3e50;
    font-size: clamp(0.8rem, 3vw, 1.15rem);
    font-weight: 700;

    cursor: pointer;
    user-select: none;
}

#juegos-memoria .sopa-cell.selected {
    background: #c5cae9;
    border-color: #3f51b5;
}

#juegos-memoria .sopa-cell.found {
    background: #c8e6c9;
    border-color: #2e7d32;
    color: #1b5e20;
}


/* SOPA DE LETRAS: botones en horizontal */
#juegos-memoria #btn-restart-sopa {
    display: inline-flex;
    width: calc(50% - 8px);
    vertical-align: top;
    margin-right: 8px;
}

#juegos-memoria #btn-restart-sopa + .btn-back {
    display: inline-flex;
    width: calc(50% - 8px);
    vertical-align: top;
    margin-left: 0;
}

/* =========================================================
   SIMÓN DICE
   ========================================================= */

#juegos-memoria #simon-status {
    min-height: 45px;
    margin: 10px 0 20px;

    text-align: center;
    color: #455a64;

    font-size: 1.1rem;
    font-weight: 600;
}

#juegos-memoria .simon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;

    max-width: 400px;
    margin: 0 auto 20px;
}

#juegos-memoria .simon-btn {
    width: 100%;
    aspect-ratio: 1 / 1;
  
    min-width: 140px;
    min-height: 140px;

    border: 5px solid rgba(0, 0, 0, 0.12);
    border-radius: 30px;

    cursor: pointer;

    transition:
        transform 0.12s ease,
        filter 0.12s ease,
        opacity 0.12s ease;
}

#juegos-memoria .simon-btn:hover {
    transform: scale(1.02);
}

#juegos-memoria .simon-btn:active,
#juegos-memoria .simon-btn.active {
    filter: brightness(1.8);
    transform: scale(0.96);
    box-shadow:
        0 0 25px rgba(255, 255, 255, 0.9),
        0 0 50px rgba(255, 255, 255, 0.8),
        0 0 80px rgba(255, 255, 255, 0.6);
}

#juegos-memoria .simon-red {
    background: #e53935;
}

#juegos-memoria .simon-blue {
    background: #1e88e5;
}

#juegos-memoria .simon-green {
    background: #43a047;
}

#juegos-memoria .simon-yellow {
    background: #fdd835;
}


/* =========================================================
   CÁLCULO MENTAL
   ========================================================= */

#juegos-memoria #calc-score {
    margin-bottom: 15px;

    text-align: center;
    color: #455a64;

    font-size: 1.15rem;
    font-weight: 700;
}

#juegos-memoria #calc-operation {
    min-height: 90px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 15px 0;

    color: #1a237e;

    font-size: 2.4rem;
    font-weight: 700;
    text-align: center;
}

#juegos-memoria #calc-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;

    margin-bottom: 20px;
}

#juegos-memoria #calc-options .btn {
    margin: 0;
    min-height: 65px;
    font-size: 1.3rem;
}

#juegos-memoria .calc-levels {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

#juegos-memoria .calc-level-btn {
    width: auto;
    min-width: 90px;
    min-height: 42px;
    margin: 0;
    padding: 8px 14px;
}

#juegos-memoria .calc-hint {
    margin: 10px 0;
    text-align: center;
    color: #5c6bc0;
    font-weight: 600;
}


/* =========================================================
   MEMORIA DE ANIMALES
   ========================================================= */

#juegos-memoria #especial-level {
    margin-bottom: 15px;

    text-align: center;
    color: #303f9f;

    font-size: 1.2rem;
    font-weight: 700;
}

#juegos-memoria #especial-start-panel {
    text-align: center;
}

#juegos-memoria #especial-game-content {
    display: none;
}

#juegos-memoria #especial-prompt {
    min-height: 50px;
    margin-bottom: 15px;

    text-align: center;

    color: #1a237e;
    font-size: 1.2rem;
    font-weight: 700;
}

#juegos-memoria #especial-countdown-wrapper {
    position: relative;

    width: 100%;
    height: 14px;

    margin: 10px 0 20px;

    overflow: hidden;

    background: #e0e0e0;
    border-radius: 10px;
}

#juegos-memoria #especial-countdown-fill {
    width: 100%;
    height: 100%;

    background: #3f51b5;
    border-radius: inherit;

    transition: width 0.1s linear;
}

#juegos-memoria #especial-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;

    margin: 20px 0;
}

#juegos-memoria .especial-card {
    position: relative;

    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 3px solid #c5cae9;
    border-radius: 14px;

    background: #ffffff;

    font-size: clamp(2rem, 8vw, 3.5rem);

    cursor: pointer;

    user-select: none;

    transition:
        transform 0.15s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

#juegos-memoria .especial-card:hover {
    transform: scale(1.03);
}

#juegos-memoria .especial-card.hidden {
    background: #3f51b5;
    color: transparent;
}

#juegos-memoria .especial-card.correct {
    background: #c8e6c9;
    border-color: #2e7d32;
}

#juegos-memoria .especial-card.incorrect {
    background: #ffcdd2;
    border-color: #c62828;
}

#juegos-memoria #especial-status {
    color: #1a202c !important;
    min-height: 40px;
    margin: 10px 0;

    text-align: center;

    font-size: 1.1rem;
    font-weight: 700;
}

#juegos-memoria #btn-ver-de-nuevo {
    display: none;
}
/* =========================================================
   SUDOKU
   ========================================================= */
#juegos-memoria #sudoku-grid {
    box-sizing: border-box;
    width: 100%;
    max-width: 450px;
}

#juegos-memoria .sudoku-cell {
    box-sizing: border-box;
    min-width: 0;
}
/* =========================
   TABLERO
   ========================= */

#juegos-memoria #sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));

    width: 100%;
    max-width: 450px;

    box-sizing: border-box;

    margin: 20px auto;

    border: 3px solid #333;
}

#juegos-memoria .sudoku-cell {
    width: 100%;
    min-width: 0;

    box-sizing: border-box;

    aspect-ratio: 1 / 1;

    padding: 0;

    border: 1px solid #c5cae9;

    background: #fff;
    color: #0f30e8;

    font-size: clamp(0.9rem, 4vw, 1.4rem);
    font-weight: 600;

    text-align: center;
}
#juegos-memoria .sudoku-cell:focus {
    outline: 3px solid #fff;
    outline-offset: -3px;
}

#juegos-memoria .sudoku-cell.fixed {
    background: #fff;
    color: #000;
    font-weight: 800;
}

#juegos-memoria .sudoku-cell.error {
    background: #ffcdd2;
    color: #c62828;
}

#juegos-memoria .sudoku-cell.correct {
    background: #fff;
    color: #0f30e8;
}


/* Líneas de los bloques 3x3 */

#juegos-memoria .sudoku-cell:nth-child(3n) {
    border-right: 3px solid #333;
}

#juegos-memoria .sudoku-cell:nth-child(9n) {
    border-right: none;
}

#juegos-memoria .sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
#juegos-memoria .sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
    border-bottom: 3px solid #333;
}


/* =========================
   BOTONES SUPERIORES
   ========================= */

#sudoku-top-buttons {
    display: flex;
    justify-content: space-between;

    gap: 10px;

    width: 100%;
    max-width: 450px;

    margin: 10px auto;
}

#sudoku-top-buttons .btn {
    flex: 1;
    margin: 0;
}


/* =========================
   CONTROLES
   ========================= */

#sudoku-controls {
    width: 100%;
    max-width: 450px;

    margin: 15px auto;

    text-align: center;
}


/* Reloj */

#juegos-memoria #sudoku-timer {
    margin: 10px 0;

    text-align: center;

    color: #455a64;

    font-size: 1.1rem;
    font-weight: 700;
}


/* Números 1 - 9 */

#sudoku-numbers {
    display: grid;
    grid-template-columns: repeat(9, 1fr);

    gap: 5px;

    width: 100%;

    margin-bottom: 8px;
}

.sudoku-number {
    width: 100%;

    padding: 7px 0;

    border: 1px solid #777;
    border-radius: 5px;

    background: #fff;
    color: #222;

    font-size: 1rem;
    font-weight: 700;
}


/* Borrar - Comprobar - Pista */

#sudoku-actions {
    display: grid;
    grid-template-columns: 1fr 1.15fr 1fr;

    gap: 6px;

    width: 100%;

    margin: 0;
}

#sudoku-actions .btn {
    width: 100%;

    margin: 0;

    padding: 8px 4px;

    font-size: 0.9rem;

    white-space: nowrap;
}


/* =========================
   MENSAJE
   ========================= */

#juegos-memoria #sudoku-message {
    min-height: 40px;

    margin: 10px 0;

    text-align: center;

    font-size: 1.1rem;
    font-weight: 700;
}


/* Pista */

#juegos-memoria #sudoku-hint {
    margin: 10px 0;
}


/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 600px) {

    /* Tablero */

    #juegos-memoria #sudoku-grid {
        width: 96%;
        max-width: 450px;

        box-sizing: border-box;

        border: 3px solid #222;
    }

    #juegos-memoria .sudoku-cell {
        box-sizing: border-box;

        border: 1px solid #9fa8da;

        background: #fff;
        color: #0f30e8;

        font-size: clamp(1.05rem, 5vw, 1.4rem);
        font-weight: 700;

        opacity: 1;

        -webkit-appearance: none;
        appearance: none;

        -webkit-text-fill-color: currentColor;
    }


    /* Celdas fijas */

    #juegos-memoria .sudoku-cell.fixed {
        background: #fff;
        color: #000;

        font-weight: 800;

        -webkit-text-fill-color: #000;
    }


    /* Celdas correctas */

    #juegos-memoria .sudoku-cell.correct {
        background: #fff;
        color: #0f30e8;

        -webkit-text-fill-color: #0f30e8;
    }


    /* Celdas con error */

    #juegos-memoria .sudoku-cell.error {
        background: #ffcdd2;
        color: #c62828;

        -webkit-text-fill-color: #c62828;
    }


    /* Líneas 3x3 */

    #juegos-memoria .sudoku-cell:nth-child(3n) {
        border-right: 3px solid #222;
    }

    #juegos-memoria .sudoku-cell:nth-child(9n) {
        border-right: none;
    }

    #juegos-memoria .sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
    #juegos-memoria .sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
        border-bottom: 3px solid #222;
    }


    /* Focus */

    #juegos-memoria .sudoku-cell:focus {
        outline: none;

        box-shadow: inset 0 0 0 2px #7986cb;
    }


    /* Reloj */

    #juegos-memoria #sudoku-timer {
        margin: 6px 0 8px;

        font-size: 1.05rem;

        opacity: 1;
    }


    /* Números */

    #sudoku-numbers {
        gap: 3px;

        margin-bottom: 6px;
    }

    .sudoku-number {
        padding: 6px 0;

        border-radius: 5px;

        font-size: 0.95rem;
    }


    /* Borrar - Comprobar - Pista */

    #sudoku-actions {
        grid-template-columns: 1fr 1.15fr 1fr;

        gap: 4px;
    }

    #sudoku-actions .btn {
        padding: 7px 2px;

        font-size: 0.8rem;

        border-radius: 6px;
    }


    /* Mensaje */

    #juegos-memoria #sudoku-message {
        margin: 6px 0;

        font-size: 1rem;

        opacity: 1;
    }


    /* Pista */

    #juegos-memoria #sudoku-hint {
        margin: 10px 0;
    }
}



/* =========================================================
   OBJETO DESAPARECIDO
   ========================================================= */

#juegos-memoria #objeto-message {
    min-height: 50px;
    margin: 10px 0 15px;

    text-align: center;

    color: #1a237e;
    font-size: 1.2rem;
    font-weight: 700;
}

#juegos-memoria #objeto-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;

    margin: 20px 0;
}

#juegos-memoria .objeto-card {
    min-height: 100px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 10px;

    border: 3px solid #e0e0e0;
    border-radius: 14px;

    background: #ffffff;

    text-align: center;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

#juegos-memoria .objeto-card:hover {
    transform: translateY(-2px);
}

#juegos-memoria .objeto-card .objeto-emoji {
    font-size: 2.5rem;
    line-height: 1;
}

#juegos-memoria .objeto-card .objeto-nombre {
    margin-top: 8px;

    color: #455a64;

    font-size: 0.9rem;
    font-weight: 600;
}

#juegos-memoria .objeto-card.missing {
    border-color: #e1e8ed;
    background: #f2f5f7;
}

#juegos-memoria #objeto-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;

    margin: 20px 0;
}

/* SOLO CAMBIO: TARJETAS DE OPCIONES */

#juegos-memoria #objeto-options .btn.objeto-option {
    margin: 0;

    min-height: 70px;
    padding: 8px;

    border: 3px solid #e0e0e0;
    border-radius: 14px;

    background: #f2f5f7;

    color: #455a64;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;

    box-shadow: none;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

#juegos-memoria #objeto-options .objeto-option:hover {
    transform: translateY(-2px);
    border-color: #90caf9;
    background: #f5f9ff;
}



#juegos-memoria .objeto-reveal {
    animation: objetoReveal 0.4s ease;
}

@keyframes objetoReveal {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* =========================================================
   ANIMACIONES GENERALES
   ========================================================= */

@keyframes jmPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

#juegos-memoria .pulse {
    animation: jmPulse 0.4s ease;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (min-width: 480px) {

    #juegos-memoria .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #juegos-memoria .menu-grid .btn {
        min-height: 70px;
    }
}


@media (max-width: 600px) {

    #juegos-memoria {
        padding: 10px;
    }

    #juegos-memoria .container {
        padding: 20px 15px;
    }

    #juegos-memoria h1 {
        font-size: 2rem;
    }

    #juegos-memoria .subtitle {
        font-size: 1.1rem;
    }

    #juegos-memoria #grid-parejas {
        gap: 7px;
    }

    #juegos-memoria #objeto-grid {
        gap: 8px;
    }

    #juegos-memoria #especial-grid-container {
        gap: 7px;
    }
}


@media (max-width: 380px) {

    #juegos-memoria .container {
        padding: 15px 10px;
    }

    #juegos-memoria h1 {
        font-size: 1.7rem;
    }

    #juegos-memoria h2 {
        font-size: 1.5rem;
    }

    #juegos-memoria .btn {
        font-size: 0.95rem;
    }

    #juegos-memoria .difficulty-btn {
        min-width: 85px;
        padding: 8px 10px;
    }

    #juegos-memoria #objeto-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

#juegos-memoria #cabecera-inicio {
    display: block;
}



/* =====================================================
   RECUERDA LA ESCENA: COLORES DE LAS RESPUESTAS
   ===================================================== */

/* Botones normales: texto blanco sobre azul */
#juegos-memoria .escena-opcion {
    color: #ffffff;
}

/* Respuesta correcta o incorrecta: texto negro */
#juegos-memoria .escena-opcion.escena-correcta,
#juegos-memoria .escena-opcion.escena-incorrecta {
    color: #000000 !important;
}
/* =====================================================
   TRIVIAL MAYORES: COLORES DE LAS RESPUESTAS
   ===================================================== */

/* Botones normales: texto blanco sobre azul */
#juegos-memoria #screen-trivial-mayores .tm-opcion {
    color: #ffffff;
}

/* Respuesta correcta: texto negro */
#juegos-memoria #screen-trivial-mayores .tm-opcion.tm-correcta {
    color: #000000 !important;
}

/* Respuesta incorrecta: texto negro */
#juegos-memoria #screen-trivial-mayores .tm-opcion.tm-incorrecta {
    color: #000000 !important;
}


/* =========================================================
   OBJETO DESAPARECIDO — MEJORA PARA ORDENADOR
   En móvil se conserva el diseño actual
   ========================================================= */

@media (min-width: 900px) {

    /* Tarjetas de los objetos que se muestran */
    #juegos-memoria #objeto-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
        max-width: 900px;
        margin: 28px auto;
    }

    #juegos-memoria .objeto-card {
        min-height: 170px;
        padding: 18px 12px;
        border-radius: 18px;
    }

    /* Animales y objetos más grandes */
    #juegos-memoria .objeto-card .objeto-emoji {
        font-size: 4rem;
        line-height: 1.2;
    }

    #juegos-memoria .objeto-card .objeto-nombre {
        margin-top: 12px;
        font-size: 1.05rem;
    }

    /* Tarjetas de opciones de respuesta */
    #juegos-memoria #objeto-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
        max-width: 700px;
        margin: 28px auto;
    }

    #juegos-memoria #objeto-options .btn.objeto-option {
        min-height: 110px;
        padding: 16px;
        border-radius: 18px;
        font-size: 1.1rem;
    }
}



/* Forzar el tamaño de los emojis en las respuestas */
#juegos-memoria #objeto-options .objeto-option .objeto-emoji {
    font-size: 2.5rem !important;
    line-height: 1.3 !important;
}

@media (min-width: 900px) {
    #juegos-memoria #objeto-options .objeto-option .objeto-emoji {
        font-size: 3.5rem !important;
    }
}

/* Contenedor relativo para posicionar los elementos encima */
.menu-image-container {
    position: relative;
    max-width: 500px; /* Ajusta al ancho que desees en tu web */
    margin: 0 auto;
    display: block;
}

/* La imagen se adapta al 100% del contenedor */
.menu-bg-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

/* Cuadrícula invisible encima de las tarjetas */
.interactive-grid {
  position: absolute;
  
  /* CAMBIO: Aumentamos top para bajar la cuadrícula y reducimos bottom para compensar */
  top: 15%;       /* Antes 15.5% -> Baja la posición inicial */
  bottom: 9.5%;   /* Antes 12%   -> Mantiene el límite inferior proporcionado */
  
  left: 4.5%;
  right: 4.5%;
  display: grid;
  grid-template-columns: 1fr 1fr; 
  grid-template-rows: repeat(6, 1fr); 
  gap: 20px 10px; 
}

/* Estilo de cada área clicable (Tarjeta) */
.clickable-area {
  cursor: pointer;
  background: rgba(255, 255, 255, 0); 
  border-radius: 15px;
  transition: background 0.2s ease;
  padding: 15px 10px; 
  background-clip: padding-box; 
}

/* Efecto visual al pasar el ratón */
.clickable-area:hover {
  background: rgba(255, 255, 255, 0.15); 
}

/* Área clicable para el botón grande de abajo */
.clickable-play-btn {
    position: absolute;
    bottom: 2.2%;
    left: 15%;
    width: 70%;
    height: 7.5%;
    cursor: pointer;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0);
    transition: background 0.2s ease;
}

.clickable-play-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* =====================================================
   FONDO COLORES
   ===================================================== */
/* Contenedor principal con fondo degradado de la imagen */
#juegos-memoria {
    font-family: 'Arial Black', 'Impact', sans-serif;
    background: linear-gradient(135deg, #3aa3ff 0%, #ff6b00 100%);
    padding: 30px 15px;
    border-radius: 20px;
    max-width: 500px;
    margin: 0 auto;
    color: #fff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

