/* General Styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', 'Arial', sans-serif;
    background: linear-gradient(135deg, #3b82f6, #9333ea);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #ffffff;
    animation: fadeIn 1s ease-in-out;
}

h1 {
    margin-bottom: 20px;
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
    animation: slideDown 1s ease-in-out;
}

.memory-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 120px);
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* Card Styles */
.card {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #dbeafe, #93c5fd); /* Light blue gradient */
    display: flex;
    align-items: center; /* Vertically center the text */
    justify-content: center; /* Horizontally center the text */
    font-size: 1.2rem; /* Adjust font size to fit inside the card */
    color: #1e3a8a; /* Dark blue text for better contrast */
    border-radius: 15px; /* Rounded corners */
    cursor: pointer;
    user-select: none;
    transition: transform 0.4s, background-color 0.4s, box-shadow 0.4s, color 0.4s;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); /* Subtle shadow */
    text-align: center; /* Center-align the text */
    padding: 5px; /* Add padding to prevent text from touching edges */
    overflow: hidden; /* Ensure text does not overflow */
    word-wrap: break-word; /* Break long words if necessary */
}

.card:hover {
    transform: scale(1.1) rotate(3deg);
    background: linear-gradient(135deg, #bfdbfe, #60a5fa); /* Slightly darker gradient on hover */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25); /* Enhanced shadow on hover */
}

.card.flipped {
    background: linear-gradient(135deg, #6366f1, #8b5cf6); /* Purple gradient for flipped cards */
    color: #ffffff; /* White text for better contrast */
    font-weight: 700;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); /* Subtle shadow */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); /* Add shadow for readability */
}

/* Stats Section */
.stats {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    color: #facc15;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Buttons */
#restart-btn, #start-btn {
    margin-top: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

#restart-btn:hover, #start-btn:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    transform: scale(1.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Dark overlay with slight transparency */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in-out; /* Smooth fade-in animation */
}

.modal-content {
    background: linear-gradient(135deg, #3b82f6, #9333ea); /* Match the site's gradient theme */
    color: #ffffff; /* White text for readability */
    padding: 30px;
    border-radius: 20px; /* Rounded corners for consistency */
    width: 90%;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3); /* Subtle shadow for depth */
    max-height: 80%; /* Limit the height of the modal */
    overflow: hidden; /* Prevent content overflow */
    animation: slideUp 0.5s ease; /* Smooth slide-up animation */
}

.scrollable-content {
    max-height: 300px; /* Set a fixed height for the scrollable area */
    overflow-y: auto; /* Enable vertical scrolling */
    margin-bottom: 20px; /* Add spacing between content and the close button */
    text-align: left; /* Align text to the left for better readability */
    padding-right: 10px; /* Add padding for better spacing */
    font-size: 1rem; /* Adjust font size for readability */
    color: #e0e7ff; /* Light text for contrast against the gradient background */
}

#close-summary-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4ade80, #22c55e); /* Green gradient for the button */
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Subtle shadow for the button */
}

#close-summary-btn:hover {
    background: linear-gradient(135deg, #22c55e, #16a34a); /* Darker green on hover */
    transform: scale(1.1); /* Slightly enlarge on hover */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); /* Enhanced shadow on hover */
}

/* Helpful Symbol Styles */
.helpful-symbol {
    display: inline-block;
    padding: 6px 12px;
    margin: 6px 0;
    background-color: #6366f1; /* Match the site's purple theme */
    border: 1px solid #4f46e5;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: #ffffff; /* White text for readability */
    cursor: pointer;
    user-select: all;
    transition: background-color 0.3s, transform 0.2s;
}

.helpful-symbol:hover {
    background-color: #4f46e5; /* Darker purple on hover */
    transform: scale(1.05);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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