body {
    background: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

/* Game board "grounds"*/

.game-grounds, .game-grounds * {
    box-sizing: border-box; 
    font-family: 'Arial', sans-serif; 
}

.game-grounds {
    position: relative;
    background: #f9ecde;
    padding: clamp(15px, 4vw, 35px);
    border: 3px solid #b09670;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    /* padding-top: 50px; */

    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 3vw, 40px);

    max-width: 98vw; 
    margin: 0 auto;

    cursor: url('Pieces/CursorPaw.png') 25 25, auto; 
    overflow:visible;
}

#turn-indicator {
    position: absolute;
    top: 15px; 
    left: 50%;
    transform: translateX(-50%); 
    
    font-weight: bold;
    font-size: 1.1rem;
    color: #8b7355; 
    z-index: 10; 
    text-shadow: 1px 1px 0px rgba(255,255,255,0.5);
    display: none;
}

#reward-indicator {
    position: absolute;
    top: 40px; 
    left: 50%;
    transform: translateX(-50%); 
    
    font-weight: bold;
    font-size: 1.1rem;
    color: #8b7355; 
    z-index: 10; 
    text-shadow: 1px 1px 0px rgba(255,255,255,0.5);
    display: none;
    text-align: center;
}


#menu-zone{
    text-align: center;
    position: absolute;
}

#menu-zone.hidden {
    display: none;
}

#menu-zone p{
    font-weight: bold;
    font-size: 1.1rem;
    color: #8b7355; 
    z-index: 10; 
    text-shadow: 1px 1px 0px rgba(255,255,255,0.5);
}

.game-grounds::before{
    content: "";
    position: absolute;
    top: -226px;
    left: -350px;
    width: 70%;
    height: 70%;
    background: rgba(255, 255, 255, 0);
    border-radius: 12px;
    pointer-events: none;
    background-image: url("Pieces/AyaP1.png");
    background-repeat: no-repeat;
    background-position: right;
    background-size: contain;
    z-index: -1;
}
.game-grounds::after{
    content: "";
    position: absolute;
    top: -226px;
    left: -350px;
    width: 70%;
    height: 70%;
    background: rgba(255, 255, 255, 0);
    border-radius: 12px;
    pointer-events: none;
    background-image: url("Pieces/AyaP2.png");
    background-repeat: no-repeat;
    background-position: right;
    background-size: contain;
    z-index: 2;
}


/* Pieces grid */
.memory-game { 
    display: grid;
grid-template-columns: repeat(6, min(65px, 14vw)); 
    grid-gap: clamp(5px, 1.5vw, 20px);
    perspective: 1000px;
}

.tile { 
    width: 100%;
    aspect-ratio: 1 / 1; 
    height: auto; 
    position: relative;
    transform-style: preserve-3d; 
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1; 
}

.tile-front, .tile-back { 
    width: 100%;
    height: 100%;

    position: absolute;
    backface-visibility: hidden; 
    -webkit-backface-visibility: hidden; 

    display: flex;
    align-items: center;
    justify-content: center;
    border: none; 
    border-radius: 8px;
    transform-style: preserve-3d; 
    background-color: transparent !important; 
}

.tile.flip {
    transform: rotateY(180deg);
}

.tile.flip .symbol-img {
    opacity: 1;
}

.tile-front {
    background-color: transparent; 
    transform: rotateY(180deg);
}

.tile-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    pointer-events: none;
    z-index: 1; 
}

.symbol-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(1px); 
    width: 80%; 
    height: 80%;
    object-fit: contain; 
    pointer-events: none;
    z-index: 10; 

    opacity: 0;
}

.matched {
    visibility: hidden;
}


/* Score zones */
.score-zone {
    width: 140px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(2, 48px);
    grid-auto-rows: 48px;
    gap: 10px;
    width: 106px;
    height: 338px; 
    overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg width='58' height='58' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='1' y='1' width='46' height='46' fill='none' stroke='%23b09670' stroke-width='2' stroke-dasharray='5,3' rx='6'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-position: 0 0;
    visibility: hidden;
}

.collection-tile {
    width: 48px;
    height: 48px;

    position: relative;

    background: transparent; 
    border: none; 
    border-radius: 6px;

    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    place-self: center; 

    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.collection-tile .symbol-img {
    opacity: 1; 
}

@keyframes popIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.collection-tile .symbol-img {
    width: 70%; 
    height: 70%;
}

@media (min-width: 769px) {
.tile:not(.flip):hover .tile-back {
    filter: drop-shadow(0 0 5px #b26229); 
    box-shadow: none;
    border-radius: 8px;
    transform: scale(1.05); 
    transition: all 0.2s ease;
    z-index: 100;
}
}
/* Mobile solution... (kind of) */
@media (max-width: 768px) {
    .game-grounds {
        padding: 20px 10px;
        flex-direction: column; 
        gap: 15px;
        padding-top: 50px;
        width: 100%;
        position: relative;
    }

.game-grounds::before, .game-grounds::after {
        top: -126px; 
        left: 20%;
        transform: translateX(-50%);
        width: 280px; 
        height: 160px;
    }

    .memory-game { 
        grid-template-columns: repeat(6, 1fr); 
        grid-gap: 2%px; 
        width: 100%;
        max-width: 450px;
        justify-content: center;
    }

    .tile { 
        width: 100%;
        aspect-ratio: 1 / 1;
        height: auto;
    }

    .collection-grid {
        width: 100%;
        max-width: 450px;

        grid-template-columns: repeat(6, 1fr); 
        height: auto;
        aspect-ratio: 6 / 2;

        background-size: 16.66% auto;
        background-repeat: repeat;
    }
    .collection-tile {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    #aya-collection, #player-collection {
        transform: none; 
        width: 100%;
    }

    #reward-indicator {
        top: 50%; 
    }
}

