/* Kids Learning Games — Premium Joyful Styles */

:root {
  --kg-bg-gradient: linear-gradient(165deg, #1e1b4b 0%, #312e81 40%, #0f172a 100%);
  --kg-card-bg: rgba(255, 255, 255, 0.08);
  --kg-card-border: rgba(255, 255, 255, 0.16);
  --kg-accent-pink: #f43f5e;
  --kg-accent-yellow: #fbbf24;
  --kg-accent-green: #10b981;
  --kg-accent-blue: #38bdf8;
  --kg-accent-purple: #a855f7;
  --kg-text-light: #ffffff;
  --kg-text-muted: #cbd5e1;
}

body.theme-kids-learning {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--kg-bg-gradient);
  color: var(--kg-text-light);
  font-family: 'Noto Sans Bengali', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.kg-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px 80px;
  box-sizing: border-box;
}

/* Header & Navigation */
.kg-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 14px;
}

.kg-nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kg-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform 0.15s, background 0.15s;
}

.kg-back-btn:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.2);
}

.kg-title {
  font-size: clamp(1.1rem, 3.8vw, 1.45rem);
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fff 40%, #fde047 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.kg-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kg-pill {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kg-pill.star-pill {
  color: #fde047;
  border-color: rgba(253, 224, 71, 0.35);
}

/* Mode Switcher Tabs */
.kg-modes {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px;
  border-radius: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.kg-mode-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--kg-text-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(0.85rem, 3vw, 1rem);
  padding: 10px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kg-mode-btn.active {
  background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.45);
  transform: translateY(-1px);
}

/* Category Filters */
.kg-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scrollbar-width: none;
}
.kg-categories::-webkit-scrollbar {
  display: none;
}

.kg-cat-chip {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.kg-cat-chip.active {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.4);
  font-weight: 800;
}

/* Featured Speaker / Active Banner */
.kg-speaker-box {
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kg-speaker-box.speaking {
  border-color: #38bdf8;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
}

.kg-speaker-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kg-speaker-avatar {
  font-size: 2.6rem;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
  animation: gentleBob 2.5s infinite ease-in-out;
}

.kg-speaker-texts h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

.kg-speaker-texts p {
  margin: 3px 0 0;
  font-size: 0.95rem;
  color: #94a3b8;
  font-weight: 600;
}

.kg-voice-repeat-btn {
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transition: transform 0.15s, background 0.15s;
}

.kg-voice-repeat-btn:active {
  transform: scale(0.9);
}

/* Words Grid */
.kg-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
}

@media (min-width: 540px) {
  .kg-word-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }
}

.kg-word-card {
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 16px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.15s, background 0.15s;
}

.kg-word-card:active {
  transform: scale(0.92) translateY(4px);
}

.kg-word-card.anim-pop {
  animation: squishyBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.kg-word-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s;
}

.kg-word-card:hover .kg-word-icon {
  transform: scale(1.15) rotate(4deg);
}

.kg-word-main {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.kg-word-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  margin-top: 4px;
}

/* Balloon Pop Game Arena */
.kg-balloon-arena {
  position: relative;
  min-height: 480px;
  background: radial-gradient(circle at 50% 30%, rgba(56, 189, 248, 0.15), transparent 70%), rgba(15, 23, 42, 0.7);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  box-sizing: border-box;
}

.kg-balloon-prompt {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #fbbf24;
  padding: 12px 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fde047;
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.25);
  z-index: 10;
  margin-bottom: 20px;
}

.kg-balloon-prompt .speaker-icon {
  cursor: pointer;
  font-size: 1.4rem;
  animation: pulse 1.5s infinite;
}

.kg-balloon-stage {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 360px;
}

.kg-balloon {
  position: absolute;
  width: 105px;
  height: 130px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  box-shadow: inset -6px -6px 12px rgba(0, 0, 0, 0.2), 0 10px 25px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s;
  animation: floatUp 4.5s infinite linear;
}

.kg-balloon::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid inherit;
}

.kg-balloon-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.kg-balloon-text {
  font-size: 0.95rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  margin-top: 2px;
}

.kg-balloon.b-red { background: linear-gradient(135deg, #f43f5e, #be123c); }
.kg-balloon.b-blue { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.kg-balloon.b-green { background: linear-gradient(135deg, #34d399, #059669); }
.kg-balloon.b-yellow { background: linear-gradient(135deg, #fbbf24, #d97706); }
.kg-balloon.b-purple { background: linear-gradient(135deg, #c084fc, #7e22ce); }

/* Sentence Train Styles */
.kg-train-scene {
  background: rgba(15, 23, 42, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  padding: 20px 16px 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.kg-sentence-target {
  text-align: center;
  margin-bottom: 20px;
}

.kg-target-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
}

.kg-target-text {
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 800;
  color: #fde047;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  border: 1px solid rgba(253, 224, 71, 0.3);
}

/* Train Visual Track */
.kg-train-track {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  overflow-x: auto;
  padding: 20px 10px 14px;
  border-bottom: 4px dashed #64748b;
  min-height: 120px;
  scrollbar-width: none;
}

.kg-train-engine {
  flex-shrink: 0;
  font-size: 3.8rem;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
  animation: trainChug 0.6s infinite alternate ease-in-out;
}

.kg-train-wagon {
  flex-shrink: 0;
  min-width: 100px;
  height: 70px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 3px dashed rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: #94a3b8;
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kg-train-wagon.filled {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 3px solid #6ee7b7;
  color: #fff;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
  transform: translateY(-4px);
}

/* Word Blocks to Pick */
.kg-word-palette {
  margin-top: 24px;
  text-align: center;
}

.kg-palette-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 12px;
}

.kg-palette-blocks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.kg-word-block {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: 2px solid #a5b4fc;
  color: #fff;
  padding: 12px 20px;
  border-radius: 18px;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 0 #3730a3, 0 8px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
}

.kg-word-block:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #3730a3;
}

.kg-word-block.used {
  opacity: 0.3;
  pointer-events: none;
  filter: grayscale(0.8);
}

/* Action Bar */
.kg-action-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.kg-btn-main {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s;
}

.kg-btn-main:active {
  transform: scale(0.95);
}

.kg-btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.kg-btn-ghost:active {
  background: rgba(255, 255, 255, 0.2);
}

/* Celebration Overlay / Modal */
.kg-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.kg-modal-card {
  width: min(420px, 100%);
  background: linear-gradient(160deg, #1e1b4b, #312e81);
  border: 3px solid #fbbf24;
  border-radius: 32px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kg-modal-badge {
  font-size: 4rem;
  margin-bottom: 10px;
  animation: badgeDance 1s infinite alternate ease-in-out;
}

.kg-modal-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 8px;
}

.kg-modal-desc {
  font-size: 1rem;
  color: #cbd5e1;
  margin: 0 0 24px;
}

/* Animations */
@keyframes squishyBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.18, 0.82); }
  70% { transform: scale(0.92, 1.08); }
  100% { transform: scale(1); }
}

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

@keyframes trainChug {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

@keyframes modalPop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes badgeDance {
  0% { transform: rotate(-8deg) scale(1); }
  100% { transform: rotate(8deg) scale(1.1); }
}

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