/* Overall page background */
body {
    background: #dbf8fa; /* 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;
}

.target-box {
    width: 40px;
    height: 40px;
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    background-color: white;
}

/* Style the target letter boxes */
.target-container {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.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);
    }
}

.target-box.filled {
    animation: bounceIn 0.3s ease-out;
}

/* 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;
}

/* Style buttons */
.button-container {
    margin-top: 25px;
    text-align: center;
}
/* Optional: Add spacing between the buttons */
.button-container button {
    background: #ff7675; /* Soft red */
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: 0.3s;
}

.button-container button:hover {
    background: #d63031; /* Darker red on hover */
}

/* Button Container */
.button-container {
    margin-top: 50px;
    text-align: center;
    display: flex;
    flex-direction: column; /* Stack buttons vertically */
    gap: 10px; /* Adds space between buttons */
}

/* Hint and Clear Buttons - Move Slightly Below */
#hint-button,
#clear-word {
    margin-top: 15px; /* Moves the buttons slightly down */
    background: linear-gradient(135deg, #ff758c, #eb8cb4);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

/* Hover Effect */
#hint-button:hover,
#clear-word:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Ripple Effect */
#hint-button::after,
#clear-word::after {
    content: "";
    position: absolute;
    width: 300%;
    height: 300%;
    top: 50%;
    left: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: width 0.4s ease-out, height 0.4s ease-out, opacity 0.4s ease-out;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 0;
}

#hint-button:active::after,
#clear-word:active::after {
    width: 0%;
    height: 0%;
    opacity: 1;
    transition: 0s;
}

/* Click Animation */
#hint-button:active,
#clear-word:active {
    transform: scale(0.95);
}

.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 */
}

@keyframes popOut {
    0% { transform: scale(1); }
    50% { transform: scale(5); }
    100% { transform: scale(1); }
}

.bounce-animation {
    animation: popOut 0.4s ease-in-out;
    position: relative; /* Ensures it can be layered above other elements */
    z-index: 1000; /* Temporarily bring it on top */
}

.prefilled {
    background-color: #d3ffd3;
    font-weight: bold;
}

.target-box.fixed {
    background-color: #f0f0f0;
    font-weight: bold;
    color: #333;
}

.target-box.editable {
    background-color: #fff;
    border: 2px dashed #aaa;
}

/* === 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);
    }
}
