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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

header {
    margin-bottom: 20px;
}

h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 10px;
    color: #d63384;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

header p {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    color: #6f42c1;
    margin-bottom: 15px;
}

.score {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    font-weight: bold;
    color: #495057;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 10px;
    }
}

@media (max-width: 350px) {
    .game-board {
        gap: 5px;
    }
}

.card {
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    perspective: 1000px;
    border-radius: 12px;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: scale(1.05);
}

.card:active {
    transform: scale(0.95);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

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

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

.card-front {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.3);
}

.card-back {
    transform: rotateY(180deg);
    background: white;
    border: 3px solid #ff6b6b;
}

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

.card.matched {
    animation: matchPulse 0.6s ease-in-out;
}

.card.matched .card-inner {
    box-shadow: 0 0 20px rgba(40, 167, 69, 0.6);
    border: 2px solid #28a745;
}

@keyframes matchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Present styles */
.present-container {
    margin: 40px auto;
    animation: slideUp 1s ease-out;
}

.present {
    display: inline-block;
    cursor: pointer;
    transition: transform 0.3s ease;
    animation: bounce 2s infinite;
}

.present:hover {
    transform: scale(1.1);
}

.present-box {
    font-size: 5rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.present-text {
    font-size: 1.2rem;
    color: #d63384;
    font-weight: bold;
    margin-top: 10px;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Congratulations modal */
.congratulations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-out;
}

.congrats-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    animation: popIn 0.5s ease-out;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.congrats-content h2 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    color: #d63384;
    margin-bottom: 20px;
}

.hug-message {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    color: #6f42c1;
    margin-bottom: 20px;
    font-weight: bold;
}

.hearts {
    font-size: 2rem;
    margin: 20px 0;
    animation: heartBeat 1.5s ease-in-out infinite;
}

.play-again {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s ease;
    font-weight: bold;
    margin-top: 10px;
}

.play-again:hover {
    transform: scale(1.05);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .congrats-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .score {
        gap: 15px;
        font-size: 0.9rem;
    }
    
    header p {
        padding: 0 10px;
    }
}
