/* Memory Game Custom Styles */

/* Wood texture background */
body {
    background: url('wood-background.jpg') repeat !important;
    background-size: 400px 400px !important;
    background-color: #8b7355 !important; /* Fallback wood color */
    min-height: 100vh !important;
    padding: 2rem !important;
    font-family: 'Baumans', sans-serif !important;
}

/* Header Styles */
.game-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    color: #3d5a80;
    margin-bottom: 0.5rem;
}

.game-subtitle {
    font-size: 1.125rem;
    color: #666;
    margin: 0;
    text-align: center;
}

.card {
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.25s;
    height: 100%;
    aspect-ratio: 1;
}

#gameBoard {
    width: min(calc(100vh - 250px), calc(100vw - 180px));
    height: min(calc(100vh - 250px), calc(100vw - 180px));
    max-width: 100%;
    margin: 0 auto;
}

.card.matched {
    pointer-events: none;
}

.card.flipping {
    pointer-events: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.25s;
    transform-style: preserve-3d;
}

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

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 5%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memory-card .card-front {
    --nav-color: #3d5a80;
    background: linear-gradient(135deg,
            var(--nav-color),
            color-mix(in srgb, var(--nav-color) 70%, black));
}

.card-back {
    transform: rotateY(180deg);
    background: white;
}

.card-back img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}


.card.matched {
    position: relative;
}


.memory-card {
    --nav-color: #3d5a80;
    background: linear-gradient(145deg,
            var(--nav-color),
            color-mix(in srgb, var(--nav-color) 80%, black));
    border-radius: 5%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.memory-card.flipped {
    background: transparent;
}

.memory-card.flipping {
    background: transparent;
}

.memory-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}


.checkmark-corner {
    position: absolute;
    top: min(1.5vw, 1vh);
    right: min(1.5vw, 1vh);
    font-size: min(4vw, 3vh);
    font-weight: bold;
    color: #10b981;
    text-shadow: 
        -1px -1px 0 white,
        1px -1px 0 white,
        -1px 1px 0 white,
        1px 1px 0 white,
        0 0 3px rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: opacity 0.25s;
    z-index: 10;
    pointer-events: none;
}

.card.matched .checkmark-corner {
    opacity: 1;
}

.card.matched .card-back {
    border: 3px solid #10b981;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.card.mismatch {
    animation: shake 0.25s;
}

.card.mismatch .card-back {
    border: 3px solid #ef4444;
}

.card-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: min(2vw, 1.5vh);
    font-size: min(1.6vw, 1.2vh);
    text-align: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: 0 0 5% 5%;
}

.card.matched .card-info-overlay {
    opacity: 1;
}

.card-title {
    font-weight: bold;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-author {
    font-size: min(1.4vw, 1.0vh);
    opacity: 0.9;
}