/* =========================
   VARIABLES
   ========================= */

:root{
  --color-primary: #a4e678;
  --color-secondary: #5fa8d3;
  --color-accent-dark: #ff5722;
  --color-accent: #ff9800;
  --color-bg: #f0f9ff;
  --color-white: #ffffff;
  --color-light: #fff8e1;
  --color-dark: #2c5282;
  --color-text: #334155;
  --color-subtext: #5d708d;
  --brand-gradient: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  --color-accent-dark-gradient: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  --shadow-soft: 0 4px 10px rgba(0,0,0,0.06);
  --shadow-medium: 0 6px 14px rgba(0,0,0,0.12);
  --shadow-strong: 0 12px 24px rgba(0,0,0,0.22);
  --cta-bg: linear-gradient(135deg, #ff9800, #ff5722);
  --cta-color: #fff;

/* Games page compatibility */
  --accent-pink: var(--color-accent-dark);
  --accent-green: var(--color-primary);
  --accent-violet: var(--color-secondary);
  --accent-cyan: var(--color-secondary);


/* Shadows */
  --shadow-soft: 0 4px 10px rgba(0,0,0,0.06);
  --shadow-medium: 0 6px 14px rgba(0,0,0,0.12);
  --shadow-strong: 0 12px 24px rgba(0,0,0,0.22);

  /* Books slider */
  --book-card-width: 190px;
  --book-card-height: 250px;
  --book-card-gap: 18px;
  --books-duration: 26s;   /* fallback, will be updated by JS */
  --books-speed: 90;       

  /* Put your hero image path here. Example: 'images/hero-bg.jpg' */
  --hero-url: "background.jpg";
}

/* =========================
   RESET & BASE
   ========================= */
*{box-sizing:border-box}
html,body{
  margin:0;
  padding:0;
  font-family:'Baloo Bhai 2', cursive, sans-serif;
  background:var(--color-bg);
  color:var(--color-text);
  max-width:100%;
  overflow-x:hidden;
}
h1,h2,h3{font-weight:700;margin:0}
img{display:block;max-width:100%}

/* =========================
   NAVBAR
   ========================= */
.navbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  padding:12px 22px;
  background:var(--brand-gradient);
  border-radius:0 0 20px 20px;
  box-shadow:0 3px 8px rgba(0,0,0,0.18);
   position: relative;
  z-index: 1002;
}
@media (max-width: 480px) {
  .navbar ul {
    width: 90%;
    right: 5%;
  }
}
.navbar .logo{display:flex;align-items:center;gap:12px}
.navbar .logo img{
  height:64px;
  width:auto;
  border-radius:10px;
  object-fit:cover;
  border:3px solid rgba(255,255,255,0.12);
}
.navbar .logo span{
  color:#fff;
  font-size:28px;
  font-weight:800;
}
.navbar ul{list-style:none;display:flex;gap:10px;margin:0;padding:0}
.navbar ul li a{
  color:#fff;text-decoration:none;padding:8px 14px;border-radius:18px;font-weight:700;
  transition:background .22s, transform .18s;
}
.navbar ul li a:hover{background:rgba(255,255,255,0.14);transform:translateY(-2px)}
.navbar ul li a.active{background:rgba(255,255,255,0.22)}

/* Hamburger menu button */
#menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 38px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1002;
}
#menu-toggle span {
  display: block;
  width: 26px;
  height: 4px;
  margin: 4px 0;
  background: #fff;
  border-radius: 2px;
  transition: 0.3s;
}
#menu-toggle.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
#menu-toggle.open span:nth-child(2) {
  opacity: 0;
}
#menu-toggle.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
  }
  #menu-toggle {
    display: flex;
  }
  .navbar ul {
    position: absolute;
    top: 64px;
    right: 18px;
    background: var(--brand-gradient);
    flex-direction: column;
    align-items: flex-start;
    width: 180px;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    padding: 12px 0;
    gap: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-16px);
    transition: opacity 0.25s, transform 0.25s;
    z-index: 1001;
  }
  .navbar ul.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .navbar ul li {
    width: 100%;
  }
  .navbar ul li a {
    display: block;
    width: 100%;
    padding: 12px 18px;
    border-radius: 0;
    font-size: 1.08em;
  }
}

/* =========================
   HERO (background image + overlay)
   ========================= */
/* NOTE: Update --hero-url in :root to point to your hero image file (e.g. "images/hero-bg.jpg") */
.hero{
  position:relative;
  margin:20px;
  border-radius:20px;
  overflow:hidden;
  padding:68px 20px;
  text-align:center;
  color:#fff;
  background: var(--color-primary) center/cover no-repeat;
  /* Use the variable if your browser supports url(var(--...)). If not, replace below with a direct URL:
     background-image: linear-gradient(...), url('images/hero-bg.jpg');
  */
  background-image:
    linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.08)),
    url('background.jpg');
  background-size: cover;
  background-position: center;
}
.hero > *{position:relative;z-index:1}
.hero h2{
  font-size:48px;margin-bottom:8px;
  animation: subtleBounce 3.5s ease-in-out infinite;
}
.hero p{font-size:20px;color:rgba(255,255,255,0.95)}

/* =========================
   SECTION HEADINGS
   ========================= */
.section{
  padding:20px 18px;
  max-width:1200px;
  margin: 0 auto 36px;
  text-align:center;
}
.section h2{
  font-size:34px;color:var(--color-accent-dark);
  position:relative;display:inline-block;margin-bottom:25px;
}
.section h2::after{
  content:"";position:absolute;left:50%;bottom:-8px;transform:translateX(-50%);
  width:56%;height:5px;border-radius:3px;background:var(--color-primary);
}
.section-subtitle{color:var(--color-subtext);margin-bottom:18px}

/* =========================
   FEATURES / GAMES CARDS
   ========================= */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:24px;margin-top:12px;
}
.card{
  background:var(--color-white);
  border-radius:18px;padding:22px;
  box-shadow:var(--shadow-medium);
  position:relative;overflow:hidden;
  transition:transform .35s ease, box-shadow .35s ease;
}
.card::before{
  content:"";
  position:absolute;inset:-50% -30% auto auto;width:240%;height:240%;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,0.08), transparent 12%),
    linear-gradient(90deg, rgba(164,230,120,0.10), rgba(95,168,211,0.10));
  transform:rotate(18deg);opacity:0;transition:opacity .38s ease;pointer-events:none;
}
.card:hover::before{opacity:1}
.card:hover{transform:translateY(-10px) scale(1.03);box-shadow:var(--shadow-strong);background: var(--brand-gradient);}
.card h3{font-size:20px;color:var(--color-primary);margin-bottom:8px;position:relative;z-index:1}
.card p{color:var(--color-text);line-height:1.6;position:relative;z-index:1}

/* single-run bounce for heading/text on hover (prevents disappearing) */
.card:hover h3,
.card:hover p{animation:miniBounce .6s ease 1;}

/* =========================
   BOOKS SLIDER (CSS-driven)
   ========================= */
/* ---------- CTA (Explore More) ---------- */
.cta-button {
  display: inline-block;
  padding: 14px 34px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--cta-color);
  background: var(--cta-bg);
  border-radius: 99px;
  margin-top: 25px;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}

.cta-button::before {
  content: "";
  position: absolute;
  left: -80%;
  top: 0;
  width: 50%;
  height: 100%;
  transform: skewX(-25deg);
  background: rgba(255,255,255,0.35);
  transition: left .7s ease;
  pointer-events: none;
}
.cta-button:hover::before {
  left: 130%;
}
.cta-button:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0,0,0,0.26);
}

@media (max-width:480px) {
  .cta-button {
    padding: 12px 22px;
    font-size: .95rem;
  }
}

/* ---------- Books slider ---------- */
.books-slider {
  overflow: hidden;
  position: relative;
  padding: 10px 8px;
  width: 100%;
}

.books-slider-track {
  display: flex;
  gap: var(--book-card-gap);
  align-items: center;
  width: max-content;
  animation: scrollBooks var(--books-duration) linear infinite;
  will-change: transform;
}

.books-slider:hover .books-slider-track {
  animation-play-state: paused;
}

.book-card {
  flex: 0 0 auto;
  width: var(--book-card-width);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  padding: 8px;
  transition: transform .25s ease;
  overflow: hidden;
}

.book-card img {
  width: 100%;
  height: var(--book-card-height);
  object-fit: cover;
  border-radius: 8px;
}

.book-card:hover {
  transform: scale(1.05);
}

@media (max-width:768px) {
  :root {
    --book-card-width: 150px;
    --book-card-height: 210px;
  }
}

@keyframes scrollBooks {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.insights-grid{display:grid;gap:18px;max-width:1000px;margin:0 auto}
.insight-card{
  display:flex;gap:18px;align-items:flex-start;background:var(--color-white);
  border-radius:14px;padding:16px;box-shadow:var(--shadow-soft);
  border:1px solid rgba(226,232,240,0.85);transition:transform .22s ease;
}
.insight-card:hover{transform:translateY(-6px)}
.insight-left{
  display:flex;align-items:center;gap:12px;flex-shrink:0;transition:all .28s ease;
}
.insight-image-container{
  width:120px;height:120px;border-radius:50%;overflow:hidden;border:4px solid var(--color-primary);
  display:flex;align-items:center;justify-content:center;background:linear-gradient(180deg,#fff,#f6f6f6);
}
.insight-image{width:100%;height:100%;object-fit:cover;transition:transform .4s ease}
.insight-left:hover .insight-image{transform:scale(1.08)}
/* collapsed panel */
.insight-description-panel{
  max-width:0;max-height:0;overflow:hidden;padding:0;background:var(--color-light);
  color:var(--color-text);border-radius:10px;border:1px solid rgba(226,232,240,0.95);
  transition:max-width .38s cubic-bezier(.2,.8,.2,1), max-height .35s ease, padding .28s ease;
  box-sizing:border-box;flex-shrink:0;pointer-events:none;
}
/* expand when hovering the left block (image + hidden panel container) */
.insight-left:hover .insight-description-panel{
  max-width:320px;max-height:320px;padding:12px 14px;pointer-events:auto;
}
/* nudge content while left panel is open (visual spacing) */
.insight-left:hover ~ .insight-content{transform:translateX(6px);transition:transform .28s ease}
/* reverse layout nudging */
.insight-card.reverse .insight-left:hover ~ .insight-content{transform:translateX(-6px);transition:transform .28s ease}
.insight-content{flex:1;min-width:180px;transition:transform .28s ease}
.insight-content h3{font-size:20px;color:#2c5282;margin-bottom:6px}
.insight-quote{font-style:italic;color:var(--color-subtext);margin:0;line-height:1.6}
.insight-card.reverse{flex-direction:row-reverse}
.insight-card.reverse .insight-left{flex-direction:row-reverse}

/* Mobile fallback: stack & always show panel */
@media (max-width:768px){
  .insight-card{flex-direction:column;align-items:center;text-align:center}
  .insight-left{flex-direction:column;align-items:center}
  .insight-description-panel{max-width:100% !important;max-height:1000px;padding:12px 14px;pointer-events:auto}
  .insight-left:hover ~ .insight-content{transform:none}
  .insight-card.reverse{flex-direction:column}
}

/* =========================
   NEWSLETTER
   ========================= */
.newsletter{
  background:var(--brand-gradient);
  color:#fff;padding:36px 18px;border-radius:18px;margin:20px;
  text-align:center;box-shadow:var(--shadow-medium);
}
.newsletter h2{margin-bottom:8px;font-size:22px}
.newsletter p{color:rgba(255,255,255,0.9);margin-bottom:12px}
.newsletter input{
  padding:12px;border-radius:28px;border:none;width:260px;max-width:86%;
  margin-right:10px;text-align:center;
}
.newsletter button{
  padding:12px 22px;border-radius:28px;border:none;background:var(--color-accent-dark-gradient);
  color:#fff;font-weight:800;cursor:pointer;box-shadow:0 8px 20px rgba(0,0,0,0.18);
  transition:transform .18s ease;
}
.newsletter button:hover{transform:translateY(-4px)}
@media (max-width:480px){
  .newsletter input{display:block;margin:12px auto 8px;width:92%}
  .newsletter button{display:block;margin:6px auto}
}

/* =========================
   FOOTER
   ========================= */
.footer{
  background:linear-gradient(90deg,var(--color-primary),var(--color-secondary));
  color:#fff;padding:36px 18px;border-radius:18px 18px 0 0;margin-top:24px;
}
.footer-container{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:18px;border-bottom:1px solid rgba(255,255,255,0.08);padding-bottom:18px;margin-bottom:12px;
}
.footer-column h2{color:#fff;font-size:18px;margin-bottom:10px}
.footer-column p, .footer-column a, .footer-column li{color:rgba(255,255,255,0.9);text-decoration:none}
.footer-column ul{list-style:none;padding:0;margin:0}
.social-links{display:flex;gap:10px;flex-wrap:wrap}
.footer-bottom{text-align:center;color:rgba(255,255,255,0.9);font-size:14px;margin-top:12px}

/* =========================
   BOOKS PAGE GRID (books.html)
   ========================= */
.all-books{padding:60px 18px;background:var(--color-bg)}
.all-books .section-title{font-size:28px;color:var(--color-accent-dark);margin-bottom:6px}
.all-books .section-subtitle{color:var(--color-subtext);margin-bottom:40px}
/* BOOKS PAGE GRID — show exactly 4 cards on large screens */
.books-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* exactly 4 columns on desktop/laptop */
  gap: 28px;
  justify-items: center;
  justify-content: center;   /* centers the grid if fewer than 4 items */
  max-width: 1100px;
  margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(3, 1fr); /* 3 columns on medium screens */
  }
}

@media (max-width: 768px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
  }
}

@media (max-width: 480px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 cards per row on mobile */
    gap: 18px; /* slightly smaller gap for small screens */
  }

  .book-card {
    max-width: 100%; /* allow cards to fit neatly in two columns */
    padding: 8px;
  }

  .book-card img {
    height: 260px; /* slightly smaller for mobile fit */
  }
}


.book-card {
  width: 100%;
  max-width: 240px; /* Increased from 180px → more width */
  background: var(--color-white);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform .25s ease, box-shadow .25s ease;
}

.book-card img {
  width: 100%;
  height: 320px; /* Increased from 250px → more height */
  object-fit: cover;
  border-radius: 12px;
}

.book-card .download-btn {
  margin-top: 14px;
  background: var(--color-accent-dark-gradient);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 22px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .18s ease;
  font-size: 1rem;
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-medium);
}

.book-card .download-btn:hover {
  transform: scale(1.05);
}


/* =========================
   FUN ANIMATIONS & HELPERS
   ========================= */
@keyframes miniBounce{0%{transform:translateY(0)}40%{transform:translateY(-8px)}100%{transform:translateY(0)}}
@keyframes subtleBounce{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
@keyframes wiggle{0%{transform:rotate(0)}25%{transform:rotate(3deg)}75%{transform:rotate(-3deg)}100%{transform:rotate(0)}}
@keyframes glowPulse{0%,100%{box-shadow:0 0 12px rgba(255,193,7,0.5)}50%{box-shadow:0 0 30px rgba(255,87,34,0.7)}}
@keyframes fadeZoom{0%{opacity:0;transform:scale(.95)}100%{opacity:1;transform:scale(1)}}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width:1024px){
  .hero h2{font-size:40px}
  .hero p{font-size:18px}
  .navbar .logo img{height:56px}
}
@media (max-width:768px){
  .navbar{padding:10px 14px}
  .navbar ul{gap:6px}
  .navbar .logo img{height:52px}
  .hero{padding:42px 14px;margin:14px;border-radius:14px}
  .hero h2{font-size:30px}
  .section{padding:26px 12px}
  .card{padding:16px;border-radius:12px}
  .books-slider-track{animation-duration:34s}
}
@media (max-width:420px){
  .navbar .logo img{height:42px}
  .hero h2{font-size:24px}
  .books-slider-track{animation-duration:40s}
}



/* =========================
   GAME PAGE STYLES
   ========================= */
/* =========================
   GAME WRAPPER
========================= */
#game-wrapper {
  max-width: 1200px;
  margin: 120px auto 40px auto; /* space for navbar */
  padding: 20px;
}

.section-title {
  font-size: 2rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 20px;
  color: var(--color-text);
}

/* =========================
   PLAYER PANEL
========================= */
.player-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 25px auto;
  padding: 12px 25px;
  background: linear-gradient(135deg, #ffcc80, #ff8a65, #ff7043);
  border-radius: 50px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  transition: transform 0.3s ease;
  max-width: fit-content;
}

.player-panel:hover {
  transform: scale(1.07);
}

#score-container::before {
  content: "P ";
  font-size: 1.5rem;
}


#player-avatar-container {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff3e0;
  border: 3px solid #ff7043;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #ff7043;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* =========================
   GAME MODES
========================= */
.game-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.game-mode-btn {
  padding: 10px 18px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  background: var(--color-light);
  transition: all 0.3s;
}

.game-mode-btn.active {
  background: var(--color-accent);
  color: white;
}

/* =========================
   GAME BOARD
========================= */
.game-board {
  background: linear-gradient(160deg, #ffe082, #ffab91, #ffccbc);
  padding: 30px;
  margin-top: 25px;
  border-radius: 30px;
  min-height: 350px;
  border: 4px solid #ff7043;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  font-family: 'Baloo Bhai 2', cursive;
  font-size: 1.2rem;
  color: #4e342e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transition: transform 0.3s, box-shadow 0.3s;
  text-align: center;
}

.game-board:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.3);
}

/* Inputs inside games */
.game-board input {
  padding: 12px 18px;
  border-radius: 20px;
  border: 3px solid #ff7043;
  font-size: 1.1rem;
  margin: 12px 0;
  text-align: center;
  box-shadow: inset 2px 2px 6px rgba(0,0,0,0.1);
}

/* Buttons inside games */
.game-board button {
  margin: 8px;
  padding: 10px 20px;
  border-radius: 30px;
  border: none;
  background: #ff7043;
  color: white;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.game-board button:hover {
  background: #ff5722;
  transform: scale(1.1);
}


/* =========================
   MODALS
========================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--color-light);
  padding: 20px;
  border-radius: 16px;
  max-width: 400px;
  text-align: center;
  border-top: 6px solid var(--color-primary);
}

/* =========================
   BUTTONS
========================= */
button {
  cursor: pointer;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  border: none;
  font-weight: bold;
}

.btn-secondary {
  background: var(--color-secondary);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  border: none;
  font-weight: bold;
}

.btn-danger {
  background: var(--color-accent-dark);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  border: none;
}

.btn-warning {
  background: var(--color-secondary);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  border: none;
}

.btn-neutral {
  background: var(--color-neutral);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  border: none;
}

/* Feedback Messages */
#feedback, #puzzle-feedback, #pattern-feedback, #math-feedback {
  margin-top: 12px;
  font-weight: bold;
  font-size: 1.2rem;
}

/* Correct */
.correct {
  color: #2e7d32;
  animation: bounce 0.6s;
}

/* Wrong */
.wrong {
  color: #c62828;
  animation: shake 0.5s;
}

/* Hint */
.hint {
  color: #1565c0;
  font-style: italic;
}


/* =========================
   DRAG & DROP
========================= */
.draggable {
  cursor: pointer;
  background: #ffcc80;
  font-weight: bold;
  color: #4e342e;
  border-radius: 15px;
  border: 3px solid #ff7043;
  transition: transform 0.2s ease;
}

.draggable:hover {
  transform: scale(1.1);
}

.drop-zone {
  border: 2px dashed var(--color-neutral);
  min-height: 60px;
  padding: 10px;
  border-radius: 12px;
}

.drop-zone.drag-over {
  background: rgba(100, 149, 237, 0.2);
}

/* =========================
   ANIMATIONS
========================= */
@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.5s;
}

