/* /css/memory.css */

/* Stile, die ausschließlich für das Memory-Spiel verwendet werden. */

#memory-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    perspective: 1000px;
    max-width: 1000px;
    width: 100%;
    padding: 1rem;
}

@media (min-width: 640px) {
    #memory-board {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

.memory-card {
    background-color: transparent;
    aspect-ratio: 2 / 3;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    position: relative;
    width: 100%;
}


.memory-card.is-flipped {
    transform: rotateY(180deg);
}

.memory-card.is-found {
    transform: rotateY(180deg);
    cursor: default;
}

@keyframes found-glow {
    0%, 100% { box-shadow: 0 0 15px 3px rgba(52, 211, 153, 0.7); }
    50% { box-shadow: 0 0 25px 8px rgba(52, 211, 153, 0.9); }
}

.memory-card.is-found .card-front {
    outline: 2px solid #34d399;
    animation: found-glow 1.5s ease-in-out infinite;
}

.memory-card.is-found .card-front::after {
    font-family: 'Material Symbols Outlined';
    content: 'check_circle';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 6px #10b981;
}


.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

.card-back {
    background-color: #1e293b;
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-front {
    background-color: #334155;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
}

.card-front img {
    width: 100%;
    height: 70%;
    object-fit: cover;
}

.card-front .card-name {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes mismatch-animation {
    0%, 100% { transform: rotateY(180deg) rotateZ(0); }
    25% { transform: rotateY(180deg) rotateZ(-5deg); }
    75% { transform: rotateY(180deg) rotateZ(5deg); }
}

.is-mismatch {
    animation: mismatch-animation 0.5s ease-in-out;
}

.is-mismatch .card-front {
    box-shadow: 0 0 20px 5px rgba(248, 113, 113, 0.7);
}


/* Belohnungs-Overlay */
#memory-reward-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}
#memory-reward-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.reward-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reward-card-container {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 350px;
}

@keyframes fly-in-from-top {
    from {
        transform: translateY(-150%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.reward-card {
    /* KORREKTUR v90-hotfix2: 'backwards' auf 'forwards' geändert, damit die Karten nach der Animation sichtbar bleiben. */
    animation: fly-in-from-top 0.6s ease-out forwards;
    width: 120px;
    height: 180px;
}

.reward-card:nth-child(2) {
    animation-delay: 0.1s;
}


@keyframes green-glow-bounce {
    0%, 100% { transform: scale(1); box-shadow: 0 0 25px 8px rgba(52, 211, 153, 0.6); }
    50% { transform: scale(1.05); box-shadow: 0 0 35px 12px rgba(52, 211, 153, 0.8); }
}

.reward-card.is-found .card-front {
    animation: green-glow-bounce 1.2s ease-in-out infinite;
}

#memory-reward-continue-btn {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-in-out 0.5s, transform 0.5s ease-in-out 0.5s;
}

#memory-reward-overlay.visible #memory-reward-continue-btn {
    opacity: 1;
    transform: translateY(0);
}

/* Sammelalbum */
#memory-sammlung {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 1000px;
}
.sammlung-item {
    background-color: #1e293b;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}
.sammlung-item.is-locked {
    background-color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 2 / 3;
    color: #64748b;
    font-size: 3rem;
}
.sammlung-item img {
    width: 100%;
    height: 70%;
    object-fit: cover;
}
.sammlung-item .sammlung-name {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
}

.sammlung-reset-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    padding-bottom: 2rem;
}