/**
 * MIKA Academy — Duolingo-style design system (dark theme)
 */
:root {
  --bg-base: #F8FFFE;
  --bg-card: #FFFFFF;
  --bg-elevated: #F0FBF4;
  --bg-surface: #E8F8EE;
  --bg-overlay: rgba(248, 255, 254, 0.95);
  --orange: #27AE60;
  --orange-dark: #1E8449;
  --purple: #1E8449;
  --teal: #27AE60;
  --gold: #F9CA24;
  --green: #27AE60;
  --red: #C62828;
  --text-primary: #1A2E1A;
  --text-secondary: #3D5C3D;
  --text-muted: #5A7A5A;
  --font-arabic: 'Cairo', 'Tajawal', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

.mika-v93-theme,
.mika-v93-theme body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-arabic);
}

@keyframes mika-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes mika-slide-up { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes mika-pop { 0% { transform: scale(0.7); opacity: 0; } 65% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes mika-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes mika-ring-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: 0.7; } }
@keyframes mika-xp-fly { 0% { transform: translateY(0) translateX(-50%); opacity: 1; } 100% { transform: translateY(-80px) translateX(-50%); opacity: 0; } }
@keyframes mika-confetti-fall { 0% { transform: translateY(-20px) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }
@keyframes mika-star-pop { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1) rotate(0deg); } }
@keyframes mika-correct-flash { 0% { background: #10B98100; } 30% { background: #10B98130; } 100% { background: #10B98100; } }
@keyframes mika-wrong-flash { 0% { background: #EF444400; } 30% { background: #EF444430; } 100% { background: #EF444400; } }

.anim-float { animation: mika-float 3s ease-in-out infinite; }
.anim-pop { animation: mika-pop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards; }
.anim-shake { animation: mika-shake 0.5s ease-in-out; }
.anim-slide-up { animation: mika-slide-up 0.4s ease-out forwards; }
.anim-star-pop { animation: mika-star-pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards; }

.mika-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.btn-mika {
  width: 100%;
  padding: 15px 24px;
  border-radius: var(--radius-lg);
  border: none;
  border-bottom: 4px solid rgba(0, 0, 0, 0.25);
  color: white;
  font-weight: 900;
  font-size: 16px;
  font-family: var(--font-arabic);
  cursor: pointer;
  transition: transform 0.1s, border-bottom-width 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-mika:active { transform: translateY(3px); border-bottom-width: 1px; }
.btn-mika:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-option {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 2px solid #C8E6C9;
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 15px;
  font-family: var(--font-arabic);
  cursor: pointer;
  transition: all 0.15s;
  text-align: right;
}
.btn-option:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--bg-elevated);
  transform: translateY(-1px);
}
.btn-option.selected { border-color: var(--green); background: var(--primary-light); color: var(--green); }
.btn-option.correct { border-color: var(--green); background: rgba(16, 185, 129, 0.15); color: var(--green); animation: mika-correct-flash 0.5s ease-out; }
.btn-option.wrong { border-color: var(--red); background: rgba(239, 68, 68, 0.15); color: var(--red); animation: mika-wrong-flash 0.5s ease-out, mika-shake 0.5s ease-in-out; }

.progress-track {
  height: 14px;
  background: #E8F8EE;
  border: 1px solid #C8E6C9;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex: 1;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px currentColor;
}

.xp-fly-text {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-weight: 900;
  font-size: 2.2rem;
  z-index: 9999;
  pointer-events: none;
  animation: mika-xp-fly 1.2s ease-out forwards;
  font-family: var(--font-arabic);
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.8);
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: mika-confetti-fall 2s ease-in forwards;
  pointer-events: none;
  z-index: 9998;
}

.lesson-node-active {
  box-shadow: 0 0 0 4px var(--orange), 0 0 0 8px rgba(255, 107, 53, 0.3), 0 0 30px rgba(255, 107, 53, 0.4);
  animation: mika-ring-pulse 1.8s ease-in-out infinite;
}

/* ── Lesson Engine ── */
.mle-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  font-family: var(--font-arabic);
}
.mle-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid #C8E6C9;
}
.mle-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #C8E6C9;
  background: #F0FBF4;
  color: #1A1A1A;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.mle-stage-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.mle-stage-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.35;
  transition: all 0.2s;
}
.mle-stage-dot.is-current { opacity: 1; transform: scale(1.15); }
.mle-stage-dot.is-done { opacity: 0.65; }
.mle-stage-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #E8F8EE;
  border: 2px solid #C8E6C9;
}
.mle-stage-label {
  color: #1A1A1A;
  font-size: 12px;
  font-weight: 800;
}
.mle-stage-dot.is-current { opacity: 1; transform: scale(1.15); }
.mle-stage-dot.is-done { opacity: 0.85; }
.mle-stage-dot:not(.is-current):not(.is-done) { opacity: 0.55; }
.mle-body { flex: 1; overflow-y: auto; padding-bottom: 24px; background: #F8FFFE; }
.mle-panel { padding: 16px; max-width: 640px; margin: 0 auto; }
.mle-panel-center {
  padding: 24px;
  text-align: center;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.mle-card {
  padding: 20px;
  margin: 16px 0;
  border: 2px solid #C8E6C9;
  background: #FFFFFF;
}
.mle-title {
  color: #1A1A1A;
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1.35;
}
.mle-title--center { text-align: center; margin-bottom: 12px; }
.mle-title--xl { font-size: 28px; }
.mle-subtitle {
  color: #3D5C3D;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.65;
}
.mle-question {
  color: #1A1A1A;
  font-weight: 800;
  font-size: 17px;
  margin: 12px 0;
  line-height: 1.7;
}
.mle-hint {
  color: #3D5C3D;
  font-size: 15px;
  font-weight: 700;
  margin: 8px 0 16px;
  line-height: 1.6;
}
.mle-hint--center { text-align: center; }
.mle-hint--highlight {
  background: #FFFDE7;
  border: 2px solid #F9CA24;
  border-radius: 12px;
  padding: 10px 14px;
  color: #1A1A1A;
}
.mle-story-title {
  color: #1A1A1A;
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 8px;
}
.mle-story-text {
  color: #1A2E1A;
  line-height: 1.85;
  font-size: 16px;
  font-weight: 600;
}
.mle-illus {
  text-align: center;
  font-size: 56px;
  margin-bottom: 8px;
}
.mle-highlight {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid #C8E6C9;
}
.mle-tip-box {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 2px solid #C8E6C9;
  background: #FFFDE7;
}
.mle-tip-box--green { background: #E8F8EE; border-color: #27AE60; }
.mle-tip-text {
  color: #1A2E1A;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
  margin: 0;
}
.mle-tip-text--green { color: #1E8449; }
.mle-dot {
  height: 8px;
  border-radius: 99px;
}
.mle-mascot-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 0;
  margin-bottom: 12px;
}
.mle-mascot-emoji { font-size: 32px; }
.mle-speech-bubble {
  background: #FFFFFF;
  border: 2px solid #F9CA24;
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  padding: 10px 14px;
  max-width: 260px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.mle-speech-text {
  color: #1A1A1A;
  font-weight: 800;
  font-size: 14px;
  margin: 0;
  line-height: 1.55;
}
.mle-play-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}
.mle-play-btn {
  padding: 14px 18px;
  border-radius: 16px;
  border: 2px solid #27AE60;
  background: #FFFFFF;
  color: #1A1A1A;
  font-weight: 800;
  font-size: 16px;
  font-family: Cairo, sans-serif;
  cursor: pointer;
  min-width: 120px;
  line-height: 1.45;
  box-shadow: 0 2px 8px rgba(39,174,96,0.12);
  transition: all 0.15s;
}
.mle-play-btn:hover {
  background: #E8F8EE;
  transform: translateY(-1px);
}
.mle-play-btn.is-correct {
  background: #E8F8EE;
  border-color: #27AE60;
  color: #1E8449;
}
.mle-play-btn.is-wrong {
  background: #FFEBEE;
  border-color: #C62828;
  color: #B71C1C;
}
.mle-q-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 99px;
  color: #FFFFFF;
}
.mle-battle-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 12px 0;
}
.mle-battle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.mle-replay-btn {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 2px solid #27AE60;
  color: #1E8449;
  font-family: Cairo, sans-serif;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.mle-replay-btn.is-active { background: #E8F8EE; }
.mle-spark-media {
  margin-bottom: 16px;
  border-radius: 16px;
  border: 2px solid #C8E6C9;
  background: #FFFFFF;
  padding: 14px;
  box-shadow: 0 3px 14px rgba(39,174,96,0.1);
}
.mle-spark-media-label {
  color: #1A1A1A;
  font-weight: 900;
  font-size: 16px;
  margin: 0 0 10px;
}
.mle-spark-video-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #1A1A1A;
}
.mle-spark-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.mle-spark-listen-hint {
  color: #3D5C3D;
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 10px;
}
.mle-listen-bar {
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.mle-listen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: flex-start;
  background: #FFFFFF;
  border: 2px solid #27AE60;
  color: #1E8449;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: Cairo, Tajawal, sans-serif;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(30, 132, 73, 0.2);
  transition: transform 0.15s ease, background 0.15s ease;
}
.mle-listen-btn:hover { transform: translateY(-1px); background: #E8F8EE; }
.mle-listen-btn.is-active {
  background: #E8F8EE;
  box-shadow: none;
}
.mle-listen-ico { font-size: 18px; line-height: 1; }
.mle-stage-narrator-slot { width: 100%; }
.mle-story-actions {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  margin-top: 16px;
  padding: 12px 0 8px;
  background: linear-gradient(180deg, transparent, #F0FBF4 28%);
}
.mle-story-actions .btn-mika,
.mle-story-actions .btn-primary {
  width: 100%;
  box-shadow: 0 8px 24px rgba(30, 132, 73, 0.25);
}
body.mika-lesson-active #mika-wa-fixed {
  display: none !important;
}
.mle-spark-fallback-icon {
  text-align: center;
  font-size: 48px;
  margin: 8px 0;
}
.mle-spark-yt-link {
  display: block;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  background: #FFFDE7;
  border: 2px solid #F9CA24;
  color: #1A1A1A !important;
  font-weight: 800;
  text-decoration: none;
}
.mle-spark-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.mle-spark-option {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  text-align: right;
  font-family: Cairo, sans-serif;
  cursor: pointer;
  line-height: 1.5;
}
.mle-spark-explain {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #E8F8EE;
  border: 2px solid #27AE60;
  color: #1E8449;
  font-weight: 700;
  font-size: 14px;
}
.mle-spark-hook {
  background: #FFFDE7;
  border: 2px solid #F9CA24;
  border-radius: 12px;
  padding: 10px 12px;
}
.mle-input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid #C8E6C9;
  background: #FFFFFF;
  color: #1A1A1A;
  font-family: Cairo, sans-serif;
  font-weight: 700;
  font-size: 16px;
}
.mle-xp-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: #FFFDE7;
  border: 2px solid #F9CA24;
  color: #1A1A1A;
  font-weight: 900;
  font-size: 14px;
}
.mle-hearts { display: flex; gap: 2px; font-size: 18px; }
.mle-hearts .lost { filter: grayscale(1); opacity: 0.3; }

/* ── Snake Path v93 overlays ── */
.mika-v93-theme .snake-path-scroll {
  background: var(--bg-base) !important;
}
.mika-v93-theme .snake-stats-bar {
  background: var(--bg-overlay) !important;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.mika-v93-theme .snake-unit-banner {
  border-radius: var(--radius-xl) !important;
}
.mika-v93-theme .snake-node-circle.snake-node-current {
  box-shadow: 0 0 0 4px var(--orange), 0 0 30px rgba(255, 107, 53, 0.4) !important;
  animation: mika-ring-pulse 1.8s ease-in-out infinite;
}

/* Hudhud bubble v93 */
.hh-bubble-v93 {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  animation: mika-slide-up 0.4s ease-out;
}
.hh-bubble-v93.is-center { flex-direction: column; align-items: center; }
.hh-bubble-v93__img { object-fit: contain; filter: drop-shadow(0 4px 12px rgba(255, 107, 53, 0.35)); }
.hh-bubble-v93__speech {
  border-radius: 16px;
  padding: 12px 16px;
  max-width: 280px;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.6;
  font-family: var(--font-arabic);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
