/* css/memory_battle.css */

.memory-game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    width: 95%;
    max-width: 700px;
    margin: 0 auto;
}

.memory-game-layout {
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    /* Asegura espacio para que el botón no colapse el layout */
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 280px;
    /* No margin auto here to let the parent center it properly via flex */
}

.memory-tile {
    aspect-ratio: 1 / 1;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 800;
    color: transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    user-select: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.memory-tile.active {
    background: linear-gradient(145deg, #ffd700, #b48a04);
    border-color: #fff;
    color: #000;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.memory-tile.clicked-correct {
    background: linear-gradient(145deg, #22c55e, #15803d);
    border-color: #fff;
    color: #fff;
    animation: success-pulse 0.4s ease;
}

.memory-tile.clicked-wrong {
    background: linear-gradient(145deg, #ef4444, #991b1b);
    border-color: #fff;
    color: #fff;
    animation: shake 0.4s ease;
}

@keyframes success-pulse {
    0% {
        transform: scale(1.05);
    }

    50% {
        transform: scale(1.2);
    }

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

.phase-indicator {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    margin-bottom: 5px;
    text-align: center;
}

.round-info {
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    margin-bottom: 5px;
    text-align: center;
}

/* --- REPEAT BUTTON (Gamer Style - Side Position) --- */
.memory-side-controls {
    position: absolute;
    right: 10px;
    /* Lo pegamos a la derecha del contenedor principal */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.btn-gamer-side {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    border: 2px solid #6366f1;
    border-radius: 12px;
    color: white;
    font-family: 'Cinzel', serif;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 0 #1e1b4b, 0 6px 12px rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 80px;
}

.btn-gamer-side .btn-icon {
    font-size: 1.4rem;
    transition: transform 0.5s ease;
}

.btn-gamer-side .btn-text {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.btn-gamer-side:hover:not(:disabled) {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    box-shadow: 0 8px 0 #1e1b4b, 0 12px 18px rgba(79, 70, 229, 0.3);
    transform: translateY(-5px);
}

.btn-gamer-side:hover:not(:disabled) .btn-icon {
    transform: rotate(180deg);
}

.btn-gamer-side:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1e1b4b, 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn-gamer-side:disabled {
    opacity: 0.3;
    filter: grayscale(1);
    cursor: not-allowed;
    background: #475569;
    border-color: #64748b;
    box-shadow: 0 3px 0 #1e293b;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .memory-game-layout {
        flex-direction: column;
        min-height: auto;
    }

    .memory-side-controls {
        position: static;
        margin-top: 20px;
    }

    .btn-gamer-side {
        flex-direction: row;
        padding: 8px 15px;
        min-width: auto;
        transform: none;
    }

    .btn-gamer-side:hover:not(:disabled) {
        transform: translateY(-2px);
    }
}