/* Overall page background */
body {
    background: #e3f2fd; /* 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;
}

/* 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 - Centers the Buttons */
#button-container {
    display: flex;
    justify-content: center;
    gap: 20px; /* Even spacing between buttons */
    margin-top: 10px; /* Adjusted spacing */
}

/* Separate Container for "Next Word" - Ensures it is centered */
#next-button-container {
    display: flex;
    justify-content: center;
    margin-top: 10px; /* Space below Hint & Clear */
}

#reveal-button-container {
    display: flex;
    justify-content: center;
    margin-top: 10px; /* Space below Hint & Clear */
}

/* Universal Button Styles */
#hint-button,
#clear-word {
    width: 170px;  /* Fixed width for all buttons */
    height: 50px;  /* Fixed height for consistency */
    background: linear-gradient(135deg, #ff758c, #eb8cb4);
    color: white;
    border: none;
    padding: 14px 14px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}


#next-word {
    width: 180px;  /* Fixed width for all buttons */
    height: 50px;  /* Fixed height for consistency */
    background: linear-gradient(135deg, #a19cf3, #130598);
    color: white;
    border: none;
    padding: 7px 7px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}

#reveal-word {
    width: 180px;  /* Fixed width for all buttons */
    height: 50px;  /* Fixed height for consistency */
    background: linear-gradient(135deg, #90eea6, #04802b);
    color: white;
    border: none;
    padding: 7px 7px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}

/* Hover Effect */
#hint-button:hover,
#reveal-word,
#next-word:hover,
#clear-word:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Ripple Effect */
#hint-button::after,
#next-word::after,
#reveal-word::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,
#next-word:active::after,
#reveal-word:active::after,
#clear-word:active::after {
    width: 0%;
    height: 0%;
    opacity: 1;
    transition: 0s;
}

/* Click Animation */
#hint-button:active,
#next-word:active,
#reveal-word:active,
#clear-word:active {
    transform: scale(0.96);
}

/* Disabled Next Word Button */
#next-word:disabled {
    background: linear-gradient(135deg, #ccc, #ddd);
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}


@keyframes popOut {
    0% { transform: scale(1); }
    50% { transform: scale(5); }
    100% { transform: scale(1); }
}

.pop-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 */
}
.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 */
}

h1, h2 {
    color: #4CAF50;
    text-align: center;
}

.section {
    margin-bottom: 25px;
}
.tip {
    background: #e8f5e9;
    border-left: 5px solid #4CAF50;
    padding: 10px;
    margin-top: 10px;
}
ul {
    padding-left: 20px;
}

body1 {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fdfdfd;
    color: #333;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
  }

  .flashcards-howto {
    font-family: Arial, sans-serif;
    padding: 30px;
    max-width: 900px;
    margin: auto;
    background-color: #fffceb;
    color: #333;
}
.flashcards-howto-title {
    color: #e67e22;
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 20px;
}
.flashcards-howto-section {
    color: #2c3e50;
    margin-top: 40px;
    border-bottom: 2px solid #e67e22;
    padding-bottom: 5px;
}
.flashcards-howto-list {
    margin-top: 10px;
    padding-left: 20px;
    text-align: left;
}
.flashcards-howto-list li {
    margin-bottom: 10px;
}
.flashcards-howto-emoji {
    font-size: 1.2em;
}


/* === 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);
    }
}

/* --- AdSense Specific Styles (Revised) --- */

/* Wrapper for AdSense units */
.adsense-banner-container {
    width: 100%; /* Take full width of parent */
    max-width: 970px; /* Limit max width for large screens (e.g., typical desktop ad banner size) */
    margin: 20px auto; /* Center the container horizontally and add vertical space */
    min-height: 100px; /* Ensure there's space for the ad, even if blank initially */
    text-align: center; /* Center the ad visually within its container if it's smaller than the container */
    /* Optional: Add a temporary background or border here to visualize the container during testing */
    /* background-color: rgba(0, 255, 0, 0.1); */
    /* border: 1px dashed green; */
}

/* Styles for the AdSense INS tag itself */
ins.adsbygoogle {
    display: block; /* This is crucial and must remain */
    /* AdSense JavaScript will manage its width and height based on the parent container (.adsense-banner-container) */
    /* Any other purely visual styles for the ins tag like border-radius can go here */
    border-radius: 10px; /* Optional: Matches your general design */
    overflow: hidden; /* Important: Prevents content from spilling out */
}

/* This rule is good for hiding completely blank ad slots */
ins.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
}
/* Responsive AdSense tweaks for smaller screens - Apply to container! */
@media (max-width: 768px) {
    .adsense-banner-container {
        margin: 15px auto; /* Adjust margin for smaller screens */
    }
    /* No need to adjust ins.adsbygoogle here, as the container manages size */
}