/* ===========================
   CHAPTER PAGE STYLES
=========================== */

/* Chapter Hero */
.chapter-hero {
  position: relative;
  padding: 140px 20px 80px;
  text-align: center;
  overflow: hidden;
  z-index: 1;
}

.ch1-hero {
  background: linear-gradient(180deg, #1a0a2e 0%, #0b0920 100%);
}

.ch1-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(0, 229, 255, 0.2) 0%, transparent 50%);
}

.ch2-hero {
  background: linear-gradient(180deg, #2a1a0e 0%, #1a0f05 100%);
}

.ch2-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 50%, rgba(255, 127, 17, 0.2) 0%, transparent 50%);
}

.ch3-hero {
  background: linear-gradient(180deg, #1a2a0e 0%, #0f1a05 100%);
}

.ch3-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(6, 214, 160, 0.2) 0%, transparent 50%);
}

.chapter-badge {
  display: inline-block;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  padding: 8px 24px;
  border-radius: 50px;
  margin-bottom: 16px;
  animation: badge-pulse 2s ease-in-out infinite;
}

.ch1-hero .chapter-badge {
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #070714;
}

.ch2-hero .chapter-badge {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: #070714;
}

.ch3-hero .chapter-badge {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #070714;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(0, 229, 255, 0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(0, 229, 255, 0.5); }
}

.chapter-emoji {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: emoji-bounce 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
}

@keyframes emoji-bounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
}

.chapter-hero h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: white;
  margin-bottom: 12px;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.ch1-hero h1 {
  background: linear-gradient(135deg, var(--cyan), var(--yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ch2-hero h1 {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ch3-hero h1 {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chapter-hero p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 24px;
}

.chapter-stars {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.chapter-stars span {
  font-size: 2rem;
  animation: star-twinkle 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 214, 10, 0.5));
}

.chapter-stars span:nth-child(1) { animation-delay: 0s; }
.chapter-stars span:nth-child(2) { animation-delay: 0.3s; }
.chapter-stars span:nth-child(3) { animation-delay: 0.6s; }

@keyframes star-twinkle {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* Chapter Content */
.chapter-content {
  position: relative;
  padding: 60px 20px;
  background: var(--bg2);
  z-index: 1;
}

.content-container {
  max-width: 900px;
  margin: 0 auto;
}

/* Lesson Cards */
.lesson-card {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 24px;
  border: 2px solid;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lesson-card:hover {
  transform: translateY(-6px);
}

.lesson-cyan {
  border-color: rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.1);
}

.lesson-cyan:hover {
  box-shadow: 0 0 50px rgba(0, 229, 255, 0.2);
}

.lesson-yellow {
  border-color: rgba(255, 214, 10, 0.3);
  box-shadow: 0 0 30px rgba(255, 214, 10, 0.1);
}

.lesson-yellow:hover {
  box-shadow: 0 0 50px rgba(255, 214, 10, 0.2);
}

.lesson-pink {
  border-color: rgba(255, 45, 120, 0.3);
  box-shadow: 0 0 30px rgba(255, 45, 120, 0.1);
}

.lesson-pink:hover {
  box-shadow: 0 0 50px rgba(255, 45, 120, 0.2);
}

.lesson-purple {
  border-color: rgba(155, 93, 229, 0.3);
  box-shadow: 0 0 30px rgba(155, 93, 229, 0.1);
}

.lesson-purple:hover {
  box-shadow: 0 0 50px rgba(155, 93, 229, 0.2);
}

.lesson-orange {
  border-color: rgba(255, 127, 17, 0.3);
  box-shadow: 0 0 30px rgba(255, 127, 17, 0.1);
}

.lesson-orange:hover {
  box-shadow: 0 0 50px rgba(255, 127, 17, 0.2);
}

.lesson-green {
  border-color: rgba(6, 214, 160, 0.3);
  box-shadow: 0 0 30px rgba(6, 214, 160, 0.1);
}

.lesson-green:hover {
  box-shadow: 0 0 50px rgba(6, 214, 160, 0.2);
}

.lesson-icon {
  font-size: 3.5rem;
  flex-shrink: 0;
  animation: icon-wiggle 2s ease-in-out infinite;
}

@keyframes icon-wiggle {
  0%, 100% { transform: rotate(-5deg) scale(1); }
  50% { transform: rotate(5deg) scale(1.1); }
}

.lesson-text {
  flex: 1;
}

.lesson-text h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  color: white;
  margin-bottom: 12px;
}

.lesson-cyan .lesson-text h3 { color: #7ef6ff; }
.lesson-yellow .lesson-text h3 { color: #ffe85a; }
.lesson-pink .lesson-text h3 { color: #ff7aab; }
.lesson-purple .lesson-text h3 { color: #c49aff; }
.lesson-orange .lesson-text h3 { color: #ffb060; }
.lesson-green .lesson-text h3 { color: #5fffd8; }

.lesson-text p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.7;
  margin-bottom: 16px;
}

/* Color Showcase */
.color-showcase {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.color-dot {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  animation: color-pop 1s ease-in-out infinite alternate;
}

.cd-red { background: #ff4444; animation-delay: 0s; }
.cd-blue { background: #4488ff; animation-delay: 0.2s; }
.cd-yellow { background: #ffdd00; animation-delay: 0.4s; }
.cd-green { background: #44dd66; animation-delay: 0.6s; }
.cd-purple { background: #aa44ff; animation-delay: 0.8s; }
.cd-orange { background: #ff8844; animation-delay: 1s; }

@keyframes color-pop {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

/* Shape Showcase */
.shape-showcase {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.shape-item {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  border-radius: 12px;
  animation: shape-bounce 1.5s ease-in-out infinite;
}

.si-circle { 
  background: rgba(0, 229, 255, 0.2); 
  border: 2px solid var(--cyan);
  animation-delay: 0s;
}
.si-square { 
  background: rgba(255, 214, 10, 0.2); 
  border: 2px solid var(--yellow);
  animation-delay: 0.3s;
}
.si-triangle { 
  background: rgba(255, 45, 120, 0.2); 
  border: 2px solid var(--pink);
  animation-delay: 0.6s;
}
.si-star { 
  background: rgba(155, 93, 229, 0.2); 
  border: 2px solid var(--purple);
  animation-delay: 0.9s;
}

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

/* Match Game */
.match-game {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.match-item {
  font-size: 3rem;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  animation: match-pulse 1.2s ease-in-out infinite;
}

.mi-red { animation-delay: 0s; }
.mi-blue { animation-delay: 0.3s; }
.mi-yellow { animation-delay: 0.6s; }

@keyframes match-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Pair Showcase */
.pair-showcase {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pair-item {
  font-size: 2.5rem;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid rgba(255, 127, 17, 0.3);
  animation: pair-float 2s ease-in-out infinite;
}

.pair-item:nth-child(1) { animation-delay: 0s; }
.pair-item:nth-child(2) { animation-delay: 0.4s; }
.pair-item:nth-child(3) { animation-delay: 0.8s; }

@keyframes pair-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

/* Pattern Showcase */
.pattern-showcase {
  margin-top: 16px;
}

.pattern-item {
  display: flex;
  gap: 8px;
  font-size: 2.5rem;
}

.p-red { animation: pattern-pulse 1s ease-in-out infinite; }
.p-blue { animation: pattern-pulse 1s ease-in-out infinite 0.2s; }

@keyframes pattern-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Count Showcase */
.count-showcase {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.count-num {
  font-size: 2.5rem;
  padding: 8px 16px;
  background: rgba(255, 45, 120, 0.15);
  border-radius: 12px;
  border: 2px solid rgba(255, 45, 120, 0.3);
  animation: count-jump 1.5s ease-in-out infinite;
}

.count-num:nth-child(1) { animation-delay: 0s; }
.count-num:nth-child(2) { animation-delay: 0.15s; }
.count-num:nth-child(3) { animation-delay: 0.3s; }
.count-num:nth-child(4) { animation-delay: 0.45s; }
.count-num:nth-child(5) { animation-delay: 0.6s; }

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

/* Sequence Showcase */
.sequence-showcase {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.seq-item {
  width: 55px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  border-radius: 12px;
  animation: seq-float 2s ease-in-out infinite;
}

.seq-red {
  background: rgba(255, 68, 68, 0.2);
  border: 2px solid rgba(255, 68, 68, 0.4);
}

.seq-blue {
  background: rgba(68, 136, 255, 0.2);
  border: 2px solid rgba(68, 136, 255, 0.4);
}

.seq-question {
  background: rgba(255, 214, 10, 0.2);
  border: 2px solid rgba(255, 214, 10, 0.4);
  animation: seq-question 0.8s ease-in-out infinite;
}

.seq-red { animation-delay: 0s; }
.seq-blue { animation-delay: 0.25s; }
.seq-red { animation-delay: 0.5s; }
.seq-blue { animation-delay: 0.75s; }

@keyframes seq-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes seq-question {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.15) rotate(5deg); }
}

/* Completion Card */
.completion-card {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(155, 93, 229, 0.1));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 48px 32px;
  text-align: center;
  border: 2px solid rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 60px rgba(0, 229, 255, 0.15);
  margin-bottom: 32px;
}

.completion-icon {
  font-size: 5rem;
  margin-bottom: 16px;
  animation: completion-spin 3s linear infinite;
  filter: drop-shadow(0 0 20px rgba(255, 214, 10, 0.5));
}

@keyframes completion-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.completion-card h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--yellow), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.completion-card p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 24px;
}

.completion-stars {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}

.completion-stars span {
  font-size: 2.5rem;
  animation: star-celebrate 1s ease-in-out infinite;
  filter: drop-shadow(0 0 15px rgba(255, 214, 10, 0.6));
}

.completion-stars span:nth-child(1) { animation-delay: 0s; }
.completion-stars span:nth-child(2) { animation-delay: 0.1s; }
.completion-stars span:nth-child(3) { animation-delay: 0.2s; }
.completion-stars span:nth-child(4) { animation-delay: 0.3s; }
.completion-stars span:nth-child(5) { animation-delay: 0.4s; }

@keyframes star-celebrate {
  0%, 100% { transform: scale(1) rotate(-10deg); }
  50% { transform: scale(1.3) rotate(10deg); }
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  padding: 16px 36px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white;
  text-decoration: none;
  border-radius: 50px;
  box-shadow: 0 0 30px rgba(255, 45, 120, 0.4);
  transition: all 0.3s ease;
}

.btn-back-home:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 0 50px rgba(255, 45, 120, 0.6);
}

/* Chapter Navigation */
.chapter-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-prev, .nav-next {
  flex: 1;
}

.nav-next {
  text-align: right;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.nb-prev {
  background: rgba(155, 93, 229, 0.2);
  color: var(--purple);
  border: 2px solid rgba(155, 93, 229, 0.4);
}

.nb-prev:hover {
  background: rgba(155, 93, 229, 0.3);
  transform: translateX(-4px);
}

.nb-next {
  background: rgba(0, 229, 255, 0.2);
  color: var(--cyan);
  border: 2px solid rgba(0, 229, 255, 0.4);
}

.nb-next:hover {
  background: rgba(0, 229, 255, 0.3);
  transform: translateX(4px);
}

.nb-home {
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #070714;
  border: none;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

.nb-home:hover {
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.5);
  transform: translateY(-2px);
}

.nb-icon {
  font-size: 1.2rem;
}

.chapter-dots {
  display: flex;
  gap: 10px;
}

.ch-dot {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka One', cursive;
  font-size: 0.9rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.ch-dot.active {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: white;
  border-color: var(--cyan);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

/* Chapter Footer */
.chapter-footer {
  padding: 40px 20px;
  text-align: center;
  background: var(--bg3);
  border-top: 1px solid rgba(0, 229, 255, 0.12);
}

.footer-characters {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.footer-characters span {
  font-size: 2rem;
  animation: footer-char 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.footer-characters span:nth-child(1) { animation-delay: 0s; }
.footer-characters span:nth-child(2) { animation-delay: 0.3s; }
.footer-characters span:nth-child(3) { animation-delay: 0.6s; }
.footer-characters span:nth-child(4) { animation-delay: 0.9s; }
.footer-characters span:nth-child(5) { animation-delay: 1.2s; }

@keyframes footer-char {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}

.chapter-footer p {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.7);
}

/* ===========================
   RESPONSIVE CHAPTER STYLES
=========================== */

@media (max-width: 768px) {
  .chapter-hero { padding: 120px 16px 60px; }
  .chapter-emoji { font-size: 4rem; }
  .chapter-hero h1 { font-size: 1.8rem; }
  .chapter-hero p { font-size: 1rem; }
  
  .lesson-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 20px;
  }
  
  .lesson-icon { font-size: 2.8rem; margin-bottom: 8px; }
  .lesson-text h3 { font-size: 1.2rem; }
  
  .chapter-navigation {
    flex-direction: column;
    gap: 16px;
  }
  
  .nav-prev, .nav-next { width: 100%; text-align: center; }
  .nav-btn { width: 100%; justify-content: center; }
  
  .completion-card { padding: 32px 20px; }
  .completion-icon { font-size: 4rem; }
  .completion-card h2 { font-size: 1.6rem; }
}

@media (max-width: 600px) {
  .chapter-hero { padding: 100px 14px 50px; }
  .chapter-emoji { font-size: 3.5rem; }
  .chapter-badge { font-size: 0.85rem; padding: 6px 18px; }
  
  .lesson-card { padding: 20px 16px; margin-bottom: 16px; }
  .lesson-icon { font-size: 2.5rem; }
  .lesson-text h3 { font-size: 1.1rem; }
  .lesson-text p { font-size: 0.9rem; }
  
  .color-dot { width: 40px; height: 40px; }
  .shape-item { width: 50px; height: 50px; font-size: 2rem; }
  .match-item { font-size: 2.5rem; padding: 8px; }
  .pair-item { font-size: 2rem; padding: 10px 14px; }
  .pattern-item { font-size: 2rem; }
  .count-num { font-size: 2rem; padding: 6px 12px; }
  .seq-item { width: 45px; height: 45px; font-size: 1.8rem; }
  
  .completion-icon { font-size: 3.5rem; }
  .completion-stars span { font-size: 2rem; }
  .btn-back-home { font-size: 1rem; padding: 12px 28px; }
  
  .chapter-stars span { font-size: 1.6rem; }
  .footer-characters span { font-size: 1.6rem; }
  .chapter-footer p { font-size: 1rem; }
}
