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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

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

header h1 {
    color: #4a5568;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

header p {
    color: #718096;
    font-size: 1.2rem;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.score, .attempts {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    padding: 10px 20px;
    border-radius: 25px;
    color: #4a5568;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.restart-btn {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    color: #4a5568;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 15px;
    cursor: pointer;
    position: relative;
    transition: all 0.6s ease;
    transform-style: preserve-3d;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

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

.card.matched {
    opacity: 0.7;
    transform: scale(0.95);
    pointer-events: none;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 2rem;
    transform: rotateY(180deg);
}

.card-back {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    font-size: 3rem;
}

.card-front img {
    width: 80%;
    height: 80%;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Modal Styles */
.message-modal, .victory-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    margin: 10% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

.close-btn {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #4a5568;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #e53e3e;
}

.modal-image img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.modal-content h2, .modal-content h3 {
    color: #4a5568;
    margin-bottom: 15px;
}

.modal-content p {
    color: #718096;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-board {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .game-info {
        flex-direction: column;
        text-align: center;
    }
    
    .card-back {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(2, 1fr);
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 20px;
    }
}

