/**
 * Mira Kids Interactive Games Stylesheet
 * Vibrant, cartoon-styled, squishy, accessible responsive layout for children
 */

:root {
  --kig-bg-gradient: linear-gradient(145deg, #f0fdf4, #e0f2fe, #fef9c3);
  --kig-card-bg: rgba(255, 255, 255, 0.95);
  --kig-primary: #059669;
  --kig-accent: #f59e0b;
  --kig-pink: #ec4899;
  --kig-purple: #8b5cf6;
  --kig-blue: #0284c7;
  --kig-font: 'Noto Sans Bengali', system-ui, -apple-system, sans-serif;
}

.kig-wrapper {
  max-width: 820px;
  margin: 0 auto;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--kig-bg-gradient);
  border-radius: 28px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
  overflow: hidden;
  border: 4px solid #fff;
  position: relative;
  font-family: var(--kig-font);
}

/* Themes */
.kig-wrapper.color-word { background: linear-gradient(145deg, #ccfbf1, #e0f2fe, #fef3c7); }
.kig-wrapper.color-drawing { background: linear-gradient(145deg, #fce7f3, #ffe4e6, #fef3c7); }
.kig-wrapper.color-memory { background: linear-gradient(145deg, #ede9fe, #ddd6fe, #fce7f3); }
.kig-wrapper.color-balloon { background: linear-gradient(145deg, #e0f2fe, #bae6fd, #e0e7ff); }
.kig-wrapper.color-math { background: linear-gradient(145deg, #dcfce7, #bbf7d0, #fef9c3); }
.kig-wrapper.color-star { background: linear-gradient(145deg, #fef3c7, #fde68a, #fce7f3); }
.kig-wrapper.color-odd { background: linear-gradient(145deg, #ecfccb, #d9f99d, #e0f2fe); }
.kig-wrapper.color-fruit { background: linear-gradient(145deg, #ffe4e6, #fecdd3, #fef3c7); }

/* Header */
.kig-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(255, 255, 255, 0.9);
}

.kig-btn-back {
  background: #fff;
  color: #334155;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  border: 2px solid #e2e8f0;
  transition: transform 0.2s, background 0.2s;
}
.kig-btn-back:hover {
  transform: scale(1.05);
  background: #f8fafc;
}

.kig-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.kig-icon { font-size: 2.2rem; }
.kig-title {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
}

.kig-progress-badge {
  background: #fbbf24;
  color: #78350f;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
  cursor: pointer;
  border: 2px solid #fff;
  transition: transform 0.2s;
}
.kig-progress-badge:hover { transform: scale(1.08); }

/* Progress Bar */
.kig-progress-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.kig-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6, #ec4899);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Stage Area */
.kig-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
}

.kig-card {
  background: var(--kig-card-bg);
  width: 100%;
  border-radius: 24px;
  padding: 2rem 1.6rem;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
  border: 3px solid #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  animation: kigCardPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes kigCardPop {
  0% { transform: scale(0.9) translateY(16px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.kig-bubble-lead {
  font-size: 1.15rem;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.kig-word-display {
  font-size: 2.8rem;
  font-weight: 800;
  color: #0284c7;
  text-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
  margin-bottom: 0.6rem;
  animation: kigBounce 2s ease-in-out infinite;
}

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

.kig-subtext {
  font-size: 1.2rem;
  color: #334155;
  font-weight: 700;
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.kig-hint {
  background: #fef3c7;
  color: #92400e;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 1.4rem;
  border: 1px dashed #f59e0b;
}

/* Options Grid */
.kig-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1.2rem;
  width: 100%;
  max-width: 680px;
}

.kig-opt-card {
  background: #fff;
  border: 3px solid #e2e8f0;
  border-radius: 20px;
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
}
.kig-opt-card:hover {
  transform: translateY(-5px) scale(1.03);
  border-color: #38bdf8;
  box-shadow: 0 14px 24px rgba(56, 189, 248, 0.2);
}
.kig-opt-card:active {
  transform: scale(0.96);
}

.kig-opt-icon {
  font-size: 2.6rem;
  line-height: 1;
}
.kig-opt-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
}

.kig-opt-card.correct {
  background: #dcfce7 !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.5) !important;
  animation: kigSuccessPulse 0.6s ease;
}
.kig-opt-card.wrong {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  animation: kigShake 0.45s ease;
}

@keyframes kigSuccessPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes kigShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Story Weaver Specifics */
.kig-story-icon { font-size: 3.5rem; margin-bottom: 0.5rem; }
.kig-story-box {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.6;
  background: #f8fafc;
  padding: 1.4rem;
  border-radius: 18px;
  border-left: 6px solid #8b5cf6;
  margin-bottom: 1.4rem;
  width: 100%;
}
.kig-story-options {
  grid-template-columns: 1fr;
}
.kig-story-opt {
  padding: 1.2rem;
  text-align: left;
  border-radius: 16px;
  align-items: flex-start;
}
.kig-story-opt .kig-opt-text {
  font-size: 1.18rem;
  line-height: 1.45;
}

/* Memory Train Specifics */
.kig-train-track {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1.2rem 0;
  transition: filter 0.4s;
}
.kig-train-wagon {
  background: #fff;
  border: 3px solid #f59e0b;
  padding: 0.8rem 1.2rem;
  border-radius: 16px;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(245, 158, 11, 0.2);
}
.kig-memory-msg {
  font-size: 1.2rem;
  color: #0369a1;
  font-weight: 800;
  margin: 0.8rem 0;
}
.kig-user-sequence {
  margin-top: 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #059669;
}
.kig-chip {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-weight: 800;
}
.kig-mem-btn.picked {
  opacity: 0.4;
  pointer-events: none;
}

/* Sound Guessing */
.kig-sound-play-btn {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  border: none;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 1rem 2rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(2, 132, 199, 0.35);
  margin-bottom: 1.2rem;
  font-family: inherit;
  transition: transform 0.2s;
}
.kig-sound-play-btn:hover { transform: scale(1.06); }

/* Riddles & Clues */
.kig-riddle-icon { font-size: 3rem; margin-bottom: 0.4rem; }
.kig-clue-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 1.2rem;
}
.kig-clue-item {
  background: #fffbeb;
  color: #b45309;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: left;
  border: 1px solid #fde68a;
}

/* Situation Game */
.kig-vertical-options {
  grid-template-columns: 1fr;
}
.kig-situation-opt {
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
}
.kig-situation-opt .kig-opt-text {
  font-size: 1.15rem;
  line-height: 1.45;
}
.kig-feedback-box {
  margin-top: 1.2rem;
  background: #eff6ff;
  color: #1e40af;
  padding: 1rem 1.4rem;
  border-radius: 16px;
  font-size: 1.15rem;
  font-weight: 700;
  border-left: 5px solid #3b82f6;
  width: 100%;
}

/* Simon Says */
.kig-simon-banner {
  background: #fdf2f8;
  color: #9d174d;
  font-size: 1.45rem;
  font-weight: 800;
  padding: 1.2rem 1.6rem;
  border-radius: 20px;
  border: 3px dashed #f472b6;
  margin-bottom: 1.2rem;
  line-height: 1.4;
}
.kig-simon-avatar { font-size: 4rem; margin-bottom: 1rem; }

/* True or False */
.kig-tf-grid {
  grid-template-columns: 1fr 1fr;
  max-width: 440px;
}
.kig-btn-true { border-color: #86efac; }
.kig-btn-false { border-color: #fca5a5; }

/* Category Quickfire */
.kig-timer-wrap {
  width: 100%;
  margin-bottom: 1rem;
}
.kig-timer-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: #dc2626;
  margin-bottom: 0.4rem;
}
.kig-timer-bar-bg {
  width: 100%;
  height: 8px;
  background: #fee2e2;
  border-radius: 999px;
  overflow: hidden;
}
.kig-timer-bar-fill {
  height: 100%;
  background: #ef4444;
  transition: width 1s linear;
}
.kig-quickfire-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.kig-qf-counter {
  margin-top: 1rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #059669;
}

/* Tongue Twisters */
.kig-twister-display {
  font-size: 1.8rem;
  font-weight: 800;
  color: #7c3aed;
  background: #f5f3ff;
  padding: 1.4rem;
  border-radius: 18px;
  margin-bottom: 1rem;
  border: 2px solid #ddd6fe;
}
.kig-twister-counter-wrap { margin-top: 1rem; }
.kig-twister-step-btn {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
  border: none;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 1rem 2rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(139, 92, 246, 0.35);
  font-family: inherit;
  transition: transform 0.2s;
}
.kig-twister-step-btn:active { transform: scale(0.95); }

/* Number Patterns */
.kig-pattern-track {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.2rem;
}
.kig-pattern-box {
  background: #fff;
  border: 3px solid #3b82f6;
  width: 65px;
  height: 65px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #1e293b;
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.2);
}
.kig-pattern-box.target {
  background: #fef08a;
  border-color: #eab308;
  color: #854d0e;
  animation: kigBounce 1.5s infinite;
}

/* Footer / Action Bar */
.kig-footer {
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-top: 2px solid rgba(255, 255, 255, 0.9);
}

.kig-voice-btn,
.kig-btn-level-pick {
  background: #fff;
  border: 2px solid #cbd5e1;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  color: #334155;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, background 0.2s;
}
.kig-voice-btn:hover,
.kig-btn-level-pick:hover {
  transform: scale(1.05);
  background: #f8fafc;
}

/* Victory Screen */
.kig-victory-card { padding: 3rem 1.6rem; }
.kig-victory-trophy { font-size: 5.5rem; margin-bottom: 0.5rem; animation: kigBounce 1.8s infinite; }
.kig-victory-title { font-size: 2.2rem; font-weight: 800; color: #059669; margin: 0 0 0.6rem; }
.kig-victory-desc { font-size: 1.3rem; color: #475569; margin-bottom: 1.2rem; }
.kig-stars-reward { font-size: 2.8rem; margin-bottom: 2rem; }
.kig-victory-btns { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.kig-btn-replay,
.kig-btn-next-game {
  padding: 0.9rem 1.8rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.kig-btn-replay {
  background: #fff;
  border: 2px solid #cbd5e1;
  color: #334155;
}
.kig-btn-next-game {
  background: #10b981;
  color: #fff;
  border: none;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

/* Level Modal */
.kig-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.kig-modal.hidden { display: none; }
.kig-modal-box {
  background: #fff;
  border-radius: 24px;
  padding: 2rem;
  width: 100%;
  max-width: 540px;
  max-height: 80vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
}
.kig-modal-box h2 { font-size: 1.6rem; margin-top: 0; color: #1e293b; }
.kig-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.8rem;
  margin: 1.5rem 0;
}
.kig-level-btn {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  padding: 0.75rem 0.5rem;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-family: inherit;
}
.kig-level-btn.active {
  background: #dcfce7;
  border-color: #10b981;
  color: #065f46;
}
.kig-modal-close {
  background: #f1f5f9;
  border: none;
  padding: 0.7rem 1.8rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  color: #475569;
  font-family: inherit;
}

/* Confetti */
.kg-confetti-particle {
  position: absolute;
  pointer-events: none;
  font-size: 1.8rem;
  animation: confettiFall 1.1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  z-index: 30;
}
@keyframes confettiFall {
  0% { transform: translate(0, 0) rotate(0deg) scale(0.5); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--dr)) scale(1.4); opacity: 0; }
}

/* Responsive */
@media (max-width: 600px) {
  .kig-wrapper { border-radius: 0; min-height: 100vh; border: none; }
  .kig-title { font-size: 1.15rem; }
  .kig-word-display { font-size: 2.2rem; }
  .kig-story-box { font-size: 1.18rem; padding: 1rem; }
  .kig-options-grid { grid-template-columns: 1fr; }
  .kig-tf-grid { grid-template-columns: 1fr 1fr; }
}
