@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
  --primary-blue: #6a9cff;
  --secondary-green: #7fd1b9;
  --accent-orange: #ffb86c;
  --accent-pink: #f08a8a;
  --text-dark: #333d51;
  --text-light: #ffffff;
  --bg-light: #f7f9fb;
  --container-bg: #ffffff;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.2);
  --border-radius: 15px;
  --btn-transition: all 0.2s ease;
  --hover-lift: translateY(-5px);
  --active-scale: 0.98;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  font-family: 'Poppins', 'Comic Sans MS', cursive, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Main Container */
.container {
  text-align: center;
  background-color: var(--container-bg);
  padding: 20px 15px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 20px var(--shadow-medium);
  width: 90%;
  max-width: 1000px;
  margin: 20px auto;
  flex: 1;
  overflow-y: auto;
  min-height: calc(100vh - 100px);
}

/* Page Title */
.container h1 {
  color: var(--primary-blue);
  font-size: 2.4em;
  font-weight: 700;
  margin: 10px 0 20px;
  line-height: 1.2;
}

.container h1 br {
  display: none;
}

/* Scrolling Instruction Bar */
.scroll-instruction {
  overflow: hidden;
  width: 100%;
  margin: 10px 0 20px;
  background: #eaf209;
  border-radius: 6px;
  padding: 6px 0;
  box-shadow: 0 0 4px rgba(0,0,0,0.1);
}

.scroll-text {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: scroll-left 15s linear infinite;
  font-size: 18px;
  font-weight: bold;
  color: black;
}

@keyframes scroll-left {
  from { transform: translateX(0%); }
  to { transform: translateX(-100%); }
}

/* Modules Grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin: 15px auto;
  max-width: 900px;
  padding: 0 10px;
}

/* Module Button Base */
.module-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--secondary-green);
  color: var(--text-light);
  border: none;
  border-radius: var(--border-radius);
  padding: 16px 10px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--btn-transition);
  box-shadow: 0 5px 10px var(--shadow-light);
  line-height: 1.3;
  min-height: 90px;
  text-align: center;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Icon + Text Spacing */
.module-button span:first-child,
.module-button::before {
  font-size: 1.6em;
  margin-bottom: 6px;
}

/* Hover & Active States (WebView Safe) */
.module-button:hover,
.module-button:focus {
  transform: var(--hover-lift);
  box-shadow: 0 8px 15px var(--shadow-medium);
}

.module-button:active {
  transform: scale(var(--active-scale));
  opacity: 0.9;
}

/* Button Color Themes */
#downloads { background: linear-gradient(135deg, #4CAF50, #3d8b40); }
#games { background: linear-gradient(135deg, #9C27B0, #7B1FA2); }
#numbers { background: linear-gradient(135deg, var(--accent-orange), #e6a760); }
#alphabets { background: linear-gradient(135deg, var(--primary-blue), #5c8ae6); }
#animals { background: linear-gradient(135deg, var(--accent-pink), #d97878); }
#colors { background: linear-gradient(135deg, #9b72cb, #8460b3); }
#birds { background: linear-gradient(135deg, #6ccbe3, #5aa6c7); }
#fruits { background: linear-gradient(135deg, #ff8c42, #e37e3d); }
#vegetables { background: linear-gradient(135deg, #5cb85c, #4da04d); }
#math { background: linear-gradient(135deg, #b1e06d, #9dd05c); }
#publicservice { background: linear-gradient(135deg, #4682b4, #3e739e); }
#bodyparts { background: linear-gradient(135deg, #ff7f50, #e67248); }
#vehicles { background: linear-gradient(135deg, #5bc0de, #50a8c2); }
#plants { background: linear-gradient(135deg, #8bc34a, #79b040); }
#organs { background: linear-gradient(135deg, #c44e4e, #cf5e5e); }
#countries { background: linear-gradient(135deg, #433b9f, #5e60cf); }
#electronic-gadgets { background: linear-gradient(135deg, #010101, #050508); }
#fantasy-world { background: linear-gradient(135deg, #d1b140, #cfa63c); }
#scientists { background: linear-gradient(135deg, #9662b6, #973ccf); }
#reels { background: linear-gradient(135deg, #bb20cc, #e935bf); }

/* Sorting & Matching Games */
#odd-even-sorting,
#numbers-alphabets-sorting,
#fruits-vegetables-sorting,
#colours-sorting,
#animals-birds-sorting {
  background: linear-gradient(135deg, #6a9cff, #5c8ae6);
}

#match-words,
#match-shapes,
#match-numbers,
#match-animals {
  background: linear-gradient(135deg, #7fd1b9, #6fbfa4);
}

/* Grammar, Sentences, etc. */
#grammar,
#sentences,
#rhyming,
#sight,
#word-matching,
#patterns,
#counting,
#shapes {
  background: linear-gradient(135deg, #ffb86c, #e6a760);
}

/* New Modules */
.new { position: relative; }
.new .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #FF5252;
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* Music Toggle Button */
.music-toggle-absolute {
  position: absolute;
  top: 25px;
  right: 25px;
  background-color: var(--accent-orange);
  color: var(--text-light);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.6em;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 3px 6px var(--shadow-light);
  transition: var(--btn-transition);
  z-index: 100;
}

.music-toggle-absolute:hover,
.music-toggle-absolute:focus {
  transform: scale(1.1);
  box-shadow: 0 5px 10px var(--shadow-medium);
}

.music-toggle-absolute:active {
  transform: scale(0.95);
}

/* Download Button */
.download-button-container {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 1000;
}

#download-button {
  padding: 8px 16px;
  background-color: #1B2A5B;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 1em;
  background: #1B2A5B;
  color: white;
  margin-top: auto;
}

.site-footer .footer-nav {
  margin: 15px 0;
}
.site-footer .footer-nav a {
  display: inline-block;
  margin: 5px 8px;
  padding: 8px 16px;
  text-decoration: none;
  background: transparent;       /* transparent background */
  color: yellow;                 /* yellow text */
  border: 2px solid yellow;      /* yellow border */
  border-radius: 6px;
  font-weight: bold;
  transition: all 0.3s ease;
}
.site-footer .footer-nav a:hover {
  background: yellow;            /* yellow background on hover */
  color: #222;                   /* dark text for contrast */
}

.site-footer .footer-description {
  margin-top: 15px;
  font-size: 13px;
  line-height: 1.6;
  color: #ccc;
}
.site-footer button {
  background-color: #ffb400;
  color: black;
  padding: 0.5em 1em;
  margin: 0.3em;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  cursor: pointer;
}

.site-footer button:hover {
  background-color: #e0a000;
}

/* Responsive Design */
@media (max-width: 600px) {
  .container {
    width: 95%;
    padding: 25px 15px;
    border-radius: 12px;
  }

  .container h1 {
    font-size: 2.0em;
  }

  .modules-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 14px;
  }

  .module-button {
    padding: 14px 8px;
    font-size: 1.05em;
  }

  .music-toggle-absolute {
    width: 40px;
    height: 40px;
    font-size: 1.4em;
    top: 15px;
    right: 15px;
  }

  .download-button-container {
    top: 10px;
    left: 10px;
  }

  #download-button {
    padding: 6px 12px;
    font-size: 0.9em;
  }
}

@media (max-width: 400px) {
  .container h1 {
    font-size: 1.8em;
  }

  .modules-grid {
    grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
    gap: 12px;
  }

  .module-button {
    padding: 12px 6px;
    font-size: 0.95em;
    min-height: 80px;
  }

  .scroll-text {
    font-size: 14px;
  }
}

/* Accessibility */
.follow-me-icons {
  text-align: center;
  margin: 15px 0 25px;
  font-size: 15px;
}

.follow-me-icons span {
  font-weight: bold;
  margin-right: 8px;
}

.follow-me-icons a {
  margin: 0 6px;
  transition: transform 0.3s;
}

.follow-me-icons a:hover {
  transform: scale(1.2);
}

.follow-me-icons img {
  width: 24px;
  height: 24px;
  vertical-align: middle;
}
.back-button {
    position: absolute;
    top: 25px;
    left: 25px;
    background-color: var(--secondary-green); 
    color: var(--text-light);
    padding: 10px 20px; 
    border: none;
    border-radius: 10px; 
    font-size: 1em; 
    font-weight: 600; 
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    z-index: 10;
    box-shadow: 0 3px 6px var(--shadow-light);
}

.back-button:hover {
    background-color: #6fbfa4; 
    transform: translateY(-3px);
    box-shadow: 0 5px 10px var(--shadow-medium);
}

.back-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px var(--shadow-light);
}

/* Mobile-specific adjustments for very small screens */
@media (max-width: 480px) {
    .navigation-buttons button {
        font-size: 0.9em;
        padding: 10px 15px;
    }
    .back-button {
        padding: 6px 12px;
        font-size: 0.8em;
        top: 15px; 
        left: 15px; 
        border-radius: 8px;
    }
  }

  /* Popup overlay */
.popup {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

/* Popup box */
.popup-content {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  animation: popIn 0.3s ease-out;
  font-family: Arial, sans-serif;
}

/* Text */
.popup-content h2 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}
.popup-content p {
  font-size: 1rem;
  line-height: 1.4;
}

/* Buttons */
#popupCTA, #closePopup {
  display: inline-block;
  margin-top: 12px;
  padding: 14px 20px;
  width: 100%;
  max-width: 280px;
  font-size: 1.1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#popupCTA {
  background: #28a745;
  color: #fff;
}
#popupCTA:active {
  background: #218838;
}

#closePopup {
  background: #ff7b00;
  color: #fff;
}
#closePopup:active {
  background: #e56f00;
}

/* Animation */
@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Mobile full-width optimization */
@media (max-width: 480px) {
  .popup-content {
    width: 100%;
    border-radius: 0;
    max-width: none;
    height: auto;
  }
  .popup-content h2 {
    font-size: 1.2rem;
  }
  .popup-content p {
    font-size: 1rem;
  }
}
