/* 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: 1px;
    border-radius: 10px;
}

/* Displayed Word Styling */
#word-display {
    font-size: 48px;
    font-weight: bold;
    color: #ff6f61; /* Friendly coral color */
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
    background-color: #fff5e6;
    padding: 5px 10px;
    border-radius: 10px;
    display: block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-family: 'Comic Sans MS', 'Baloo 2', cursive;
    margin-top: 10px;
    margin-bottom: 5px;
    align-items: center;
}

/* Image Option Grid */
#image-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding: 1px;
    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;
    }
}

#word-display span {
    display: inline-block;
    opacity: 1;
    transform: scale(1);
    transition: transform 0.5s ease;
}

#word-display span.pop {
    animation: popIn 0.5s ease forwards;
}

@keyframes popIn {
    0% {
        transform: scale(1);
    }
    10% {
        transform: scale(1.5)
    }
    20% {
        transform: scale(2)
    }
    30% {
        transform: scale(2.5)
    }
    40% {
        transform: scale(3)
    }
    50% {
        transform: scale(3.5);
    }
    60% {
        transform: scale(3);
    }
    70% {
        transform: scale(2.5);
    }
    80% {
        transform: scale(2)
    }
    90% {
        transform: scale(1.5)
    }
    100% {
        transform: scale(1)
    }
}

.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 */
}
.game-instructions-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 30px;
    background-color: #fff9e6;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-family: "Segoe UI", sans-serif;
    line-height: 1.6;
}
.game-instructions-container h1 {
    text-align: center;
    color: #ff6600;
    margin-bottom: 20px;
}
.game-instructions-container ul {
    padding-left: 20px;
    text-align: left;
}
.game-instructions-container li {
    margin-bottom: 12px;
}

/* === 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);
    }
}
