/* Overall page background */
body {
    background: #f0fff4; /* Light pastel background */
    background-size: cover;
    font-family: 'Arial', sans-serif;
    text-align: center;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px;
}

.category {
    position: relative;
    display: inline-block;
    width: 150px;
    height: 150px;
    margin: 10px;
    cursor: pointer;
    text-align: center;
    border-radius: 10px;
    overflow: hidden; /* Ensures content stays within the box */
}

/* Category Image */
.category img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

/* Category Name - Centered Inside Image */
.category span {
    position: absolute;
    top: 50%;  /* Moves text to the middle */
    left: 50%;
    transform: translate(-50%, -50%);  /* Ensures perfect centering */
    width: 100%;  /* Ensures the text area spans full width */
    text-align: center;
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.5); /* Semi-transparent background for readability */
    padding: 5px;
    border-radius: 5px;
    box-sizing: border-box;
}

/* Category Name Overlay - Now Inside the Image */
.category-name {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Perfectly centers the text */
    background-color: rgba(0, 0, 0, 0.5); /* Dark overlay for better visibility */
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    width: 100%; /* Ensures full width */
    box-sizing: border-box;
}

#game-container {
    margin-top: 10px;
}

.game-container {
    background: linear-gradient(135deg, #ff9a9e, #fad0c4); /* Soft gradient background */
    padding: 10px;
    background-image: url('game-background.png');
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2); /* Adds a soft shadow */
    max-width: 600px;
    margin: auto;
    text-align: center;
}

.word-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.letter-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

/* Letter Box Animation on Click */
.letter-box {
    width: 50px;
    height: 50px;
    background-color: lightblue;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s ease, background-color 0.3s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    user-select: none; /* Prevents accidental text selection */
}

/* Click Effect */
.letter-box:active {
    transform: scale(1.1); /* Slightly increase size when clicked */
    background-color: #ffdd57; /* Flash effect */
}

/* Animation when moved to target box */
@keyframes bounceIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}



/* Style the available letters */
.letter-container {
    background: rgba(0, 0, 0, 0.1);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 20px;
}

/* Word Image in Game */
#word-image {
    width: 300px; /* Fixed width */
    height: 250px; /* Fixed height */
    object-fit: contain; /* Ensures the entire image fits inside without cropping */
    display: block;
    margin: 20px auto; /* Center the image */
    border: 2px solid #333;
    background-color: white;
    padding: 10px;
    border-radius: 10px;
}
/* Image Option Grid */
#image-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px;
    justify-items: center;
    align-items: center;
}

/* Option Image Styling */
.option-image {
    width: 230px;
    height: 200px;
    object-fit: contain;
    border: 4px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.option-image:hover {
    transform: scale(1.05);
    border-color: #74b9ff;
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

/* Correct selection animation (add/remove class with JS if desired) */
.option-image.correct {
    border-color: #55efc4;
    animation: popCorrect 0.4s ease;
}

/* Wrong selection animation */
.option-image.wrong {
    border-color: #fab1a0;
    animation: shakeWrong 0.4s ease;
}

/* Animation for correct image */
@keyframes popCorrect {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Animation for wrong image */
@keyframes shakeWrong {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

/* Responsive fix for small screens */
@media (max-width: 600px) {
    #word-display {
        font-size: 28px;
    }

    .option-image {
        width: 120px;
        height: 120px;
    }
}

.instruction-text {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    background-color: #ecf0f1;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 5px;
    margin-top: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    align-items: center;
}

.category-heading {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    color: #0f036a; /* Or any color you want */
    animation: 
        bounce 1.5s infinite,
        colorShift 4s infinite; /* Smooth color change */
    font-family: 'Comic Sans MS', cursive; /* Optional: kid-friendly font */
    margin-top: 5px;
    margin-bottom: 5px;
}

@keyframes colorShift {
    0%   { color: #5906b8; } /* Red */
    20%  { color: #cd0e1e; } /* Orange */
    40%  { color: #11ba44; } /* Yellow */
    60%  { color: #d5dc13; } /* Teal */
    80%  { color: #0ca2d0; } /* Purple */
    100% { color: #171111; } /* Back to red */
}

.flashcard-image {
    width: 300px; /* Fixed width */
    height: 250px; /* Fixed height */
    object-fit: contain; /* Ensures the entire image fits inside without cropping */
    display: block;
    margin: 20px auto; /* Center the image */
    border: 2px solid #333;
    background-color: white;
    padding: 1px;
    border-radius: 10px;
}


.back-button {
    display: inline-block;
    margin-top: 90px;
    margin-bottom: 20px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.back-button:hover {
    background: linear-gradient(135deg, #45a049, #4CAF50);
    transform: translateY(-3px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.3);
}

.back-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

footer {
    background: linear-gradient(135deg, #e30f16, #033ca0);
    color: white;
    padding: 20px;
    text-align: center;
    border-top: 2px solid #fff;
}

.social-media a {
    margin: 0 10px;
    text-decoration: none;
    color: white;
    font-size: 1.2em;
}

.footer-links {
    margin-top: 10px;
}

.footer-links a {
    color: #a6c1ee;
    text-decoration: none;
    margin: 0 10px;
}

.footer-links a:hover {
    text-decoration: underline;
}

.emoji {
    font-size: 1.5em;
    margin: 0 5px;
}

.word-option {
    padding: 5px 10px;
    margin: 10px;
    font-size: 1.5em;
    background-color: #ffeb3b;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
}

.word-option:hover {
    background-color: #fbc02d;
}

.instruction-text {
    font-size: 1.2em;
    color: #333;
    text-align: center;
    margin: 10px;
}

/* === Start Game Section Styles === */

#start-game-container {
    text-align: center;
    margin-top: 30px;
}

#start-game-container .start-box {
    border: 2px dashed #4CAF50;
    background: #f0fff4;
    padding: 25px;
    border-radius: 12px;
    max-width: 600px;
    margin: auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Start Game heading and message */
#start-game-container h2 {
    color: #332e7d;
    font-size: 1.8em;
    margin-bottom: 10px;
}

#start-game-container p {
    font-size: 1.1em;
    color: #444;
    margin-bottom: 20px;
}

/* Animated Start Game Button */
#startGameBtn {
    padding: 14px 30px;
    font-size: 1.2em;
    font-weight: bold;
    background: linear-gradient(45deg, #5855fa, #675def);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    animation: pulseBtn 2s infinite;
    transition: transform 0.2s ease;
}

#startGameBtn:hover {
    animation: none;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* === Animations === */
@keyframes pulseBtn {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(76, 175, 80, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}
