@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap');

@keyframes flip {
    from { transform: perspective(1000px) rotateY(0deg); }
    to { transform: perspective(1000px) rotateY(180deg); }
}

@keyframes shake { /* Animación para sacudir */
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}


/* Neon glow effect for text and borders (del CSS anterior) */
@keyframes neon-glow-text {
    from { text-shadow: 0 0 5px rgba(0, 255, 153, 0.7), 0 0 10px rgba(0, 255, 153, 0.5), 0 0 15px rgba(0, 255, 153, 0.3); }
    to { text-shadow: 0 0 10px rgba(0, 255, 153, 1), 0 0 20px rgba(0, 255, 153, 0.7), 0 0 30px rgba(0, 255, 153, 0.5); }
}

@keyframes neon-glow-box {
    from { box-shadow: 0 0 8px rgba(0, 255, 153, 0.3), 0 0 12px rgba(0, 255, 153, 0.2), inset 0 0 5px rgba(0, 255, 153, 0.1); }
    to { box-shadow: 0 0 15px rgba(0, 255, 153, 0.5), 0 0 25px rgba(0, 255, 153, 0.3), inset 0 0 8px rgba(0, 255, 153, 0.2); }
}


body {
    background: rgb(10, 10, 20);
    background: radial-gradient(circle, rgba(10,10,20,1) 0%, rgba(20,20,45,1) 50%, rgba(5,5,15,1) 100%);
    font-family: 'Roboto Mono', monospace;
    color: rgb(0, 255, 153);
    font-size: medium;
    line-height: 1.6;
    margin: 0;
    overflow-x: hidden;
}

main {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding: 20px;
    gap: 30px;
}

.section1 {
    flex: 3;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    text-align: center;
    font-size: 2.8em;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 3px;
    animation: neon-glow-text 1.5s ease-in-out infinite alternate;
}

table {
    border-collapse: separate;
    border-spacing: 8px;
}

td {
    padding: 0;
}

button {
    /* La imagen trasera se aplicará por JS al inicio,
       pero podemos definir aquí el color de fondo por si acaso y otros estilos base */
    background-color: #080812; /* Fondo oscuro si la imagen no carga */
    /* background-image: url('images/sielsic.png'); Ya no aquí, se pone con JS */
    /* background-size: 60%; Ya no aquí */
    background-repeat: no-repeat;
    background-position: center;
    border: 2px solid rgba(0, 255, 153, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    /* padding: 3% 3px; Removido para no interferir con el tamaño fijo */
    height: 120px;
    width: 120px;
    font-size: 0; /* Para que no haya texto visible si se añade por error */
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5), inset 0 0 4px rgba(0, 255, 153, 0.2);
    border-radius: 10px;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out, border-color 0.3s ease-out;
    backface-visibility: hidden; /* Importante para la animación de volteo */
    transform-style: preserve-3d; /* Ayuda con la animación de volteo */
    overflow: hidden; /* Para que la imagen de fondo no se salga si es 'cover' */
}

/* Cuando una carta es "flipped", se anima y su background-image es cambiado por JS */
button.flipped {
    animation: flip 0.6s ease-in-out; /* SE ELIMINÓ 'forwards' */
    /* El JS se encarga de cambiar el background-image */
}

/* Evitar hover en cartas ya volteadas (correctas) o deshabilitadas temporalmente */
button:hover:not(.disabled):not(.correct):not(.disabled-temp) {
    cursor: pointer;
    transform: scale(1.08) translateY(-5px);
    border-color: rgb(0, 255, 153);
    box-shadow: 0 5px 20px rgba(0, 255, 153, 0.5), inset 0 0 8px rgba(0, 255, 153, 0.3);
}

.right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    padding-top: 20px;
}

#animacion1 {
    width: clamp(150px, 80%, 220px);
    margin-bottom: 10px;
}

#animacion1 img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 0 10px rgba(0, 255, 153, 0.3));
}

.section2 {
    width: 100%;
    max-width: 380px;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 2px solid rgb(0, 255, 153);
    border-radius: 10px;
    padding: 25px;
    background: rgba(10, 10, 30, 0.9);
    animation: neon-glow-box 2s ease-in-out infinite alternate;
}

.section2-title {
    font-size: 1.6em;
    text-align: center;
    margin-bottom: 15px;
    color: rgb(0, 255, 153);
    text-transform: uppercase;
    font-weight: bold;
    animation: neon-glow-text 1.5s ease-in-out infinite alternate;
}

.estadisticas {
    border: 1px solid rgba(0, 255, 153, 0.6);
    height: auto;
    min-height: 65px;
    border-radius: 8px;
    padding: 15px 20px;
    box-sizing: border-box;
    font-size: 1.15em;
    background-color: rgba(5, 5, 20, 0.75);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease-out;
    text-align: left;
}

.estadisticas:hover {
    background-color: rgba(0, 255, 153, 0.15);
    box-shadow: 0 0 12px rgba(0, 255, 153, 0.4);
    transform: translateX(5px);
}

.correct {
    border-color: rgb(0, 255, 153) !important; /* Importante para sobreescribir */
    background-color: rgba(0, 255, 153, 0.1);
    box-shadow: 0px 0px 25px 10px rgba(0, 255, 153, 0.9) !important; /* Más fuerte */
    /* transform: scale(1.03); El 'flipped' ya maneja la transformación de volteo */
    cursor: default !important;
}
/* Si la carta está .correct y .flipped, no debería re-animarse el volteo */
.correct.flipped {
    animation: none; /* Evita que se re-anime el flip si ya está correcta */
}


footer {
    text-align: center;
    padding: 25px 20px;
    margin-top: 40px;
    border-top: 1px solid rgba(0, 255, 153, 0.3);
    color: rgba(0, 255, 153, 0.8);
}

footer p {
    margin: 0;
    font-size: 0.95em;
}

footer a {
    text-decoration: none;
    color: rgb(0, 255, 153);
    font-weight: bold;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

footer a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(0, 255, 153, 1);
}

.disabled { /* Para cartas permanentemente deshabilitadas (ej. fin de juego) */
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    filter: grayscale(50%);
}
.disabled-temp { /* Para deshabilitar temporalmente mientras se comparan cartas */
    cursor: not-allowed !important;
    pointer-events: none; /* Más efectivo para prevenir clics */
}

button.disabled:hover, button.disabled-temp:hover {
    transform: none !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5), inset 0 0 4px rgba(0, 255, 153, 0.2) !important;
    border-color: rgba(0, 255, 153, 0.4) !important;
}

/* ... (Todo tu CSS existente va aquí arriba) ... */

/* Estilos para el botón de reinicio */
.restart-btn {
    display: block; 
    width: 80%;     
    max-width: 300px; /* Para que no sea demasiado ancho en pantallas grandes */
    margin: 25px auto; 
    padding: 12px 20px;
    font-size: 1.1em; /* Un poco más grande que el texto base */
    font-weight: bold;
    color: #ffffff;
    background-color: rgb(0, 150, 100); /* Un verde un poco menos brillante para diferenciar */
    border: 2px solid rgb(0, 255, 153);
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 0 10px rgba(0, 255, 153, 0.5), 0 0 15px rgba(0, 255, 153, 0.3) inset;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.restart-btn:hover {
    background-color: rgb(0, 180, 120);
    box-shadow: 0 0 15px rgba(0, 255, 153, 0.7), 0 0 20px rgba(0, 255, 153, 0.5) inset, 0 0 5px #ffffff;
    transform: translateY(-3px); /* Ligero levantamiento */
}

.restart-btn:active {
    background-color: rgb(0, 120, 80);
    box-shadow: 0 0 5px rgba(0, 255, 153, 0.3), 0 0 10px rgba(0, 255, 153, 0.2) inset;
    transform: translateY(1px); /* Efecto de presión */
}

/* Asegúrate de que .disabled-temp tenga pointer-events: none para prevenir clics */
.disabled-temp { 
    cursor: not-allowed !important;
    pointer-events: none; /* Más efectivo para prevenir clics */
}

/* Corrección para que el hover no afecte a botones temporalmente deshabilitados */
button:hover:not(.disabled):not(.correct):not(.disabled-temp) {
    cursor: pointer;
    transform: scale(1.08) translateY(-5px);
    border-color: rgb(0, 255, 153);
    box-shadow: 0 5px 20px rgba(0, 255, 153, 0.5), inset 0 0 8px rgba(0, 255, 153, 0.3);
}

button.disabled:hover, button.disabled-temp:hover { /* Estilo hover para deshabilitados */
    transform: none !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5), inset 0 0 4px rgba(0, 255, 153, 0.2) !important;
    border-color: rgba(0, 255, 153, 0.4) !important;
}

