* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;

    background:
        radial-gradient(
            circle at 50% 0%,
            #241708 0%,
            #140D08 60%,
            #0D0805 100%
        );

    font-family: 'Nunito', sans-serif;

    color: #F3E3D3;

    display: flex;
    justify-content: center;

    padding: 24px 16px 60px;
}

.container {
    width: 100%;
    max-width: 780px;
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header h1 {
    font-family: 'Baloo 2', cursive;

    font-size: 32px;

    color: #F2B75B;

    text-shadow:
        0 0 18px rgba(239, 159, 39, 0.35);
}

.subtitle {
    margin-top: 6px;

    font-size: 15px;

    color: #C9A876;

    font-weight: 600;
}

.stats-bar {
    display: flex;

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

    gap: 14px;

    margin-bottom: 20px;

    flex-wrap: wrap;
}

.stat {
    background: #2A1D13;

    border: 2px solid #6B4A22;

    border-radius: 14px;

    padding: 8px 18px;

    text-align: center;

    min-width: 90px;
}

.stat-label {
    display: block;

    font-size: 12px;

    font-weight: 600;

    color: #C9A876;

    text-transform: uppercase;

    letter-spacing: 0.5px;
}

.stat-value {
    display: block;

    font-family: 'Baloo 2', cursive;

    font-size: 22px;

    color: #F2B75B;
}

.btn-restart {
    font-family: 'Baloo 2', cursive;

    font-size: 15px;

    background: #D85A30;

    color: #fff;

    border: none;

    border-radius: 14px;

    padding: 12px 20px;

    cursor: pointer;

    box-shadow: 0 4px 0 #7A3418;

    transition: transform 0.1s;
}

.btn-restart:active {
    transform: translateY(3px);

    box-shadow: 0 1px 0 #7A3418;
}

.board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.card {
    aspect-ratio: 1 / 1;

    perspective: 800px;

    cursor: pointer;
}

.card-inner {
    position: relative;

    width: 100%;
    height: 100%;

    transition: transform 0.5s;

    transform-style: preserve-3d;
}

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

.card-face {
    position: absolute;

    width: 100%;
    height: 100%;

    backface-visibility: hidden;

    border-radius: 12px;

    display: flex;

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

    overflow: hidden;
}

.card-back {
    background:
        repeating-linear-gradient(
            45deg,
            #3A2412,
            #3A2412 10px,
            #2E1B0C 10px,
            #2E1B0C 20px
        );

    border: 2px solid #6B4A22;
}

.card-back-pattern {
    width: 65%;
    height: 65%;
}

.card-back-pattern svg {
    width: 100%;
    height: 100%;
}

.card-front {
    background: #1A1108;

    border: 2px solid #F2B75B;

    transform: rotateY(180deg);

    position: relative;
}

.card-front img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

.card-front .caption {
    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    background:
        linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.85) 0%,
            rgba(0, 0, 0, 0) 100%
        );

    color: #F3E3D3;

    font-size: 10px;

    font-weight: 600;

    text-align: center;

    padding: 10px 2px 4px;

    line-height: 1.1;
}

.card.matched .card-front {
    border-color: #8FCB6B;

    box-shadow:
        0 0 12px rgba(143, 203, 107, 0.5);
}

.card.matched {
    animation: pop 0.4s ease;
}

@keyframes pop {

    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }

}

.credits {
    text-align: center;

    font-size: 11px;

    color: #6B5A46;

    margin-top: 20px;
}

.modal-overlay {
    display: none;

    position: fixed;

    inset: 0;

    background: rgba(10, 6, 3, 0.8);

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

    padding: 20px;

    z-index: 10;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #1F150D;

    border-radius: 20px;

    border: 2px solid #F2B75B;

    padding: 28px 24px;

    max-width: 400px;

    width: 100%;

    text-align: center;
}

.modal-icon {
    width: 130px;
    height: 130px;

    margin: 0 auto 14px;

    border-radius: 14px;

    overflow: hidden;

    border: 2px solid #F2B75B;
}

.modal-icon img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

.modal h2 {
    font-family: 'Baloo 2', cursive;

    font-size: 26px;

    color: #F2B75B;

    margin-bottom: 8px;
}

.modal-stats {
    font-size: 14px;

    margin-bottom: 16px;

    color: #E4CBAE;
}

.fact-box {
    background: #2A1D13;

    border: 1px solid #6B4A22;

    border-radius: 12px;

    padding: 14px;

    margin-bottom: 18px;

    text-align: left;
}

.fact-title {
    font-family: 'Baloo 2', cursive;

    font-size: 15px;

    color: #F2B75B;

    margin-bottom: 4px;
}

.fact-text {
    font-size: 14px;

    line-height: 1.5;

    color: #E4CBAE;
}

@media (max-width: 600px) {

    .board {
        grid-template-columns: repeat(4, 1fr);

        gap: 7px;
    }

    .header h1 {
        font-size: 24px;
    }

    .card-front .caption {
        font-size: 8.5px;
    }

}