body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #ffe5ec;
    font-family: Arial, sans-serif;
}

.game-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(4, 120px);
    gap: 15px;
}

.card {
    width: 120px;
    height: 120px;
    position: relative;
    perspective: 1000px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    will-change: transform; /* Add this line for better animation performance */
}

.card:hover:not(.matched) {
    transform: scale(1.2);
    z-index: 1;
}

.card:hover:not(.matched) .card-front,
.card:hover:not(.matched) .card-back {
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

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

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

.card .card-front, .card .card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border: 4px solid white;
    box-sizing: border-box;
    background-image: 
        linear-gradient(45deg, transparent 48%, gold 49%, gold 51%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, gold 49%, gold 51%, transparent 52%);
    background-size: 30px 30px;
    background-position: center;
    transition: box-shadow 0.3s ease;
}

.card.matched {
    cursor: default;
}

.card.matched .card-front,
.card.matched .card-back {
    box-shadow: none;
}

.card .card-front {
    background-color: pink;
}

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

.emoji {
    font-size: 48px;
}

.emoji[data-fruit="🍍"] {
    font-size: 64px;
}

.score-container {
    position: fixed;
    top: 20px;
    right: 20px; /* Changed from default position to right */
    font-size: 24px;
    background: white;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.score-points {
    position: fixed;
    color: #ff1493;
    font-size: 32px;
    font-weight: bold;
    pointer-events: none;
    z-index: 1000;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.firework {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
}

.ribbon {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
}

.countdown-timer {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    background: white;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: #333;
    font-weight: bold;
    border: 2px solid #ff1493;
}

.countdown-timer.warning {
    background: #ffeeee;
    color: #ff1493;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
    100% { transform: translateX(-50%) scale(1); }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: modalPopIn 0.5s ease-out;
}

@keyframes modalPopIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal h2 {
    color: #ff1493;
    margin-bottom: 15px;
}

.modal p {
    margin: 10px 0;
    font-size: 18px;
}

.modal button {
    background: #ff1493;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 15px;
    transition: transform 0.2s, background 0.2s;
}

.modal button:hover {
    transform: scale(1.05);
    background: #ff69b4;
}

.level-display {
    position: fixed;
    top: 20px;
    left: 20px;  /* Changed from right to left */
    font-size: 24px;
    background: white;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.big-countdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    color: #ff1493;
    font-weight: bold;
    z-index: 2000;
    text-shadow: 0 0 20px rgba(255, 20, 147, 0.5);
    pointer-events: none;
}

/* Add responsive design styles */
@media screen and (max-width: 768px) {
    #game-board {
        grid-template-columns: repeat(4, 80px);
        gap: 10px;
    }

    .card {
        width: 80px;
        height: 80px;
    }

    .emoji {
        font-size: 32px;
    }

    .emoji[data-fruit="🍍"] {
        font-size: 42px;
    }

    .score-container {
        font-size: 16px;
        padding: 8px 15px;
        top: 10px;
        right: 10px;
    }

    .level-display {
        font-size: 16px;
        padding: 8px 15px;
        top: 10px;
        left: 10px;
    }

    .countdown-timer {
        font-size: 16px;
        padding: 8px 15px;
        top: 10px;
    }

    .modal {
        padding: 20px;
        width: 80%;
        max-width: 300px;
    }

    .modal h2 {
        font-size: 20px;
    }

    .modal p {
        font-size: 16px;
    }

    .modal button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .big-countdown {
        font-size: 80px;
    }

    .score-points {
        font-size: 24px;
    }
}

@media screen and (max-width: 480px) {
    #game-board {
        grid-template-columns: repeat(4, 65px);
        gap: 8px;
    }

    .card {
        width: 65px;
        height: 65px;
    }

    .emoji {
        font-size: 28px;
    }

    .emoji[data-fruit="🍍"] {
        font-size: 36px;
    }

    .big-countdown {
        font-size: 60px;
    }
}