:root {
    /* Cotton Candy Sky background matched with Hub */
    --bg-gradient: linear-gradient(to right, #b3ffff, #fcb69f);
    --font-main: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: var(--bg-gradient);
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}


/* =========================================
   EYE-CATCHING BRANDING & TITLES
   ========================================= */
.site-branding {
    --bg-gradient: linear-gradient(to right, #b3ffff, #fcb69f);
    /* background: rgba(255, 255, 255, 0.9); */
    backdrop-filter: blur(10px);
    width: 100%;
    padding: 15px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    /* margin-bottom: 20px; */
    /* border-bottom: 4px solid #fff; */
}


.site-branding a {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    text-decoration: none;
    background: linear-gradient(45deg, #ff00cc, #3333ff, #ff9900, #ff00cc);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientMove 4s ease infinite;
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(2px 2px 1px rgba(255,255,255,0.8));
}
.site-branding a:hover { transform: scale(1.08) rotate(-2deg); }

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


/* .site-branding a {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: bold;
    color: #9c27b0;
    text-decoration: none;
    text-shadow: 2px 2px 0px #fff;
    transition: transform 0.2s;
    display: inline-block;
}
.site-branding a:hover { transform: scale(1.05); } */



.title {
    font-size: clamp(2rem, 4vw, 3.2rem);
    color:#ec51d8;
    margin: 5px 20px 15px 20px;
    text-shadow: 
        3px 3px 0 #0d1204,
        /* 6px 6px 0 #171617, */
        9px 9px 15px rgba(0,0,0,0.2);
    letter-spacing: 2px;
}




/* --- NEW: TOP BRANDING HEADING --- */



/* .title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    color: #c23989;
    margin: 5px 20px; 
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.7);
    
} */

/* Home / Hub Nav Buttons */
.home-nav { display: flex; justify-content: center; margin: 15px 0 20px; flex-wrap: wrap; }
.home-btn { padding: 10px 25px; font-size: 1.1rem; border-radius: 40px; background: #2196f3; color: white; text-decoration: none; font-weight: bold; box-shadow: 0 6px 12px rgba(0,0,0,0.2); border: 3px solid white; transition: transform 0.2s, background 0.2s; }
.home-btn:hover { transform: scale(1.05); }

/* Frosted Glass Effect for Ads */
.ad-container {
    width: 100%; display: none; justify-content: center;
    margin: 10px 0 20px 0; position: relative; z-index: 40; 
    padding: 0 15px; box-sizing: border-box;
}

.ad-space {
    background: rgba(255, 255, 255, 0.35); 
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 3px dashed rgba(255, 152, 0, 0.7); 
    border-radius: 15px; width: 100%; max-width: 728px; min-height: 90px; 
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1); color: #555;
    font-size: 0.9rem; font-weight: bold; overflow: hidden;
}

.page-wrapper {
    flex: 1; width: 100%; max-width: 1200px; margin: auto;
    padding: 0 20px; box-sizing: border-box; position: relative; z-index: 20;
}

/* Search Bar */
.hero-search-section { margin: 10px auto 30px auto; max-width: 600px; }
.search-box-container { position: relative; width: 100%; }
.search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); font-size: 24px; }
#worksheetSearch {
    width: 100%;
    padding: 18px 20px 18px 60px;
    font-size: 1.1rem;
    font-family: var(--font-main);
    font-weight: bold;
    border: 4px solid #fff;
    border-radius: 50px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    outline: none;
    box-sizing: border-box;
    transition: all 0.3s;
    color: #444;
}
#worksheetSearch:focus { border-color: #ff9800; transform: scale(1.02); }

/* Category Navigation Pills */
.category-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}
.filter-btn {
    border: 3px solid white;
    background: white;
    color: #555;
    padding: 10px 20px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    transition: all 0.2s;
}
.filter-btn:hover { transform: translateY(-3px); }
.filter-btn.active {
    background: var(--btn-color);
    color: white;
    border-color: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    transform: scale(1.05);
}

/* =========================================
   COMPACT FLEXBOX MATRIX LAYOUT
   ========================================= */
.worksheets-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    padding: 10px;
    margin: 0 auto 30px auto;
    max-width: 1100px;
}

/* SMALL & CUTE CARD STYLING */
.worksheet-card {
    width: 220px;
    flex-grow: 0; 
    flex-shrink: 0;
    background: white;
    border-radius: 25px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-bottom: 8px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.worksheet-card:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 20px rgba(0,0,0,0.2);
    border-bottom-color: #2196f3; 
}

.card-thumbnail-wrapper {
    background: #f1f8e9;
    width: 100%;
    height: 150px;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

.card-thumbnail-wrapper img {
    max-width: 130px;
    max-height: 130px;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.worksheet-card:hover img { transform: rotate(3deg) scale(1.05); }

/* Tiny corner badge for Language/Age */
.lang-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff5722;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 20px;
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.worksheet-card h2 {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin: 0 0 15px 0;
    line-height: 1.3;
    flex-grow: 1; /* Pushes the button to the bottom */
}

.download-btn {
    width: 100%;
    background: #4caf50;
    color: white;
    border: none;
    padding: 10px 0;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: bold;
    border-radius: 50px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 0 #388e3c;
    transition: all 0.1s;
}
.download-btn:active { transform: translateY(4px); box-shadow: none; }

/* Smart Mobile Sizing */
@media (max-width: 500px) {
    .worksheet-card { width: 160px; padding: 10px; }
    .card-thumbnail-wrapper { height: 120px; }
    .card-thumbnail-wrapper img { max-width: 100px; max-height: 100px; }
    .worksheet-card h2 { font-size: 1rem; }
    .download-btn { font-size: 1rem; padding: 8px 0; }
    .worksheets-grid { gap: 15px; } 
    .filter-btn { font-size: 0.95rem; padding: 8px 15px; }
}

/* Empty State */
.no-results { text-align: center; padding: 40px 20px; width: 100%; }
.no-results-emoji { font-size: 4rem; display: block; margin-bottom: 10px; animation: bounce 2s infinite; }
.no-results h2 { color: #f44336; font-size: 2rem; margin: 0; }
.no-results p { color: #555; font-size: 1.2rem; font-weight: bold; }
.hidden { display: none !important; }

@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* --- NEW: BOTTOM BACK BUTTON --- */
.bottom-actions { margin: 20px 0 30px 0; }
.action-btn { background: #9c27b0; color: white; border: 3px solid white; padding: clamp(10px, 1.5vh, 15px) 40px; font-size: clamp(16px, 2.5vh, 20px); font-family: inherit; font-weight: bold; border-radius: 50px; cursor: pointer; box-shadow: 0 6px 15px rgba(0,0,0,0.15); transition: transform 0.1s; }
.action-btn:hover { transform: scale(1.05); background: #8e24aa; }
.action-btn:active { transform: translateY(6px); box-shadow: none; }

/* Frosted Glass SEO Box */
.seo-intro-box {
    max-width: 900px; margin: 10px auto 30px auto; padding: 20px 30px; 
    background: rgba(255, 255, 255, 0.45); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.6); border-radius: 20px;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem); color: #222; line-height: 1.6;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1); position: relative; z-index: 30; 
}

/* Footer */
.footer { text-align: center; padding: 20px 15px; background: #2c3e50; color: white; margin-top: 20px; width: 100%; position: relative; z-index: 20; box-sizing: border-box;}
.footer a { color: #ffcc00; text-decoration: none; margin: 0 10px; display: inline-block; padding: 5px 0; font-size: 1rem; transition: color 0.2s; }
.footer a:hover { color: #fff; text-decoration: underline; }
.copyright { margin-top: 10px; font-size: 0.85rem; color: #aaa; }