body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  font-size: 17px;


  
  /* 🌈 الخلفية المتحركة */
  background: linear-gradient(
    135deg,
    #ff0000 0%,
    #ff7f00 16%,
    #ffff00 33%,
    #00ff00 50%,
    #0000ff 66%,
    #4b0082 83%,
    #9400d3 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 16s ease infinite;
}

/* 🌈 عنوان قوس قزح */
.rainbow-title {
  background: linear-gradient(
    90deg,
    #ff0000,
    #ff7f00,
    #ffff00,
    #00ff00,
    #0000ff,
    #4b0082,
    #9400d3
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbowText 3s linear infinite;
}

/* حركة للعنوان */
@keyframes rainbowText {
  to { background-position: 200% center; }
}
/* ✨ تأثير زر يلمع (Glow) */
.btn-glow {
  animation: glowPulse 1.8s ease-in-out infinite;
}

@keyframes glowPulse {
  0% {
    box-shadow: 0 0 0px rgba(251, 191, 36, 0.0);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.8);
    transform: translateY(-1px);
  }
  100% {
    box-shadow: 0 0 0px rgba(251, 191, 36, 0.0);
    transform: translateY(0);
  }
}
/* شريط التنقّل الرئيسي */
.main-nav {
  margin: 0 auto 1rem auto;
  max-width: 960px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.main-nav .nav-link {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 0.9rem;
  text-decoration: none;
  color: #111827;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.main-nav .nav-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  background: #f1f5f9;
}

.main-nav .nav-link.active {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  color: #052e16;
  border-color: transparent;
  font-weight: 600;
}


/* إعدادات عامة */
*,
*::before,
*::after {
  box-sizing: border-box;
}



/* هيكل التطبيق */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.logo-emoji {
  font-size: 1.8rem;
}

.logo-text {
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 1.15rem;
  color: #111827;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: #eef2ff;
  font-size: 0.8rem;
  color: #312e81;
}

.user-chip-name {
  font-weight: 600;
}

.user-logout-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0;
  color: #1d4ed8;
}

.user-logout-btn:hover {
  text-decoration: underline;
}


.level-badge {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  color: #064e3b;
  font-weight: 600;
}

.app-main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

.app-footer {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.85rem;
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

/* بطاقات عامة */
.card {
  background: #ffffff;
  border-radius: 1.1rem;
  padding: 1.3rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 22px rgba(148, 163, 184, 0.25);
}

.card-title {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.card-subtitle {
  color: #6b7280;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* عناوين الفقرات داخل الدرس */
.section-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ea580c; /* برتقالي */
  margin: 0 0 0.6rem 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* 🎫 صندوق اختيار الاسم (الحساب) */
.auth-card {
  max-width: 640px;
  margin: 0 auto 1.5rem;
  position: relative;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(circle at top left, rgba(252, 211, 77, 0.35), transparent 55%),
    radial-gradient(circle at bottom right, rgba(52, 211, 153, 0.35), transparent 55%),
    #ffffff;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(148, 163, 184, 0.25);
  pointer-events: none;
}

.auth-badge {
  position: absolute;
  top: 0.6rem;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  font-size: 0.8rem;
  color: #6b7280;
  pointer-events: none;
}

.auth-title {
  margin-top: 1.1rem;
}

.auth-subtitle {
  max-width: 480px;
  margin: 0.35rem auto 1rem;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
  margin-top: 0.25rem;
}

.auth-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.auth-input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  transform: translateY(-1px);
}

.auth-btn-main {
  white-space: nowrap;
  padding-inline: 1.3rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.35);
}

.auth-message {
  margin-top: 0.6rem;
  font-size: 0.86rem;
  min-height: 1.1em;
}


/* أزرار */
.btn {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.35rem;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    background 0.15s ease,
    border 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #064e3b;
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(34, 197, 94, 0.4);
}

.btn-secondary {
  background: #2563eb;
  color: #eff6ff;
}

.btn-secondary:hover {
  background: #1d4ed8;
}

.btn-ghost {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #111827;
}

.btn-ghost:hover {
  background: #f9fafb;
}

.btn-small {
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
}

/* صفحة البداية */
.landing-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.landing-emoji {
  font-size: 2.5rem;
}

.landing-title {
  font-size: 1.9rem;
  font-weight: 800;
}

.landing-highlight {
  color: #22c55e;
}

.landing-text {
  color: #4b5563;
  font-size: 1rem;
}

.landing-options {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}

.label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
}

.select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  outline: none;
}

/* قائمة الدروس */
.level-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.level-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.progress-badge {
  font-size: 0.9rem;
  color: #4b5563;
}

.lessons-grid {
  display: grid;
  gap: 0.8rem;
}

.lesson-card {
  position: relative;
  padding: 0.9rem 1rem;
  border-radius: 0.95rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition:
    transform 0.08s ease,
    box-shadow 0.12s ease,
    border 0.12s ease;
}

.lesson-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.35);
}

.lesson-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.lesson-subtitle {
  font-size: 0.88rem;
  color: #6b7280;
}

.lesson-chip-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.lesson-chip {
  font-size: 0.8rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
}

.lesson-badge-completed {
  background: #dcfce7;
  color: #15803d;
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* درس واحد */
.lesson-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lesson-header-bar {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.lesson-heading {
  font-size: 1.5rem;
  font-weight: 800;
}

.lesson-meta {
  font-size: 0.9rem;
  color: #6b7280;
}

/* بطاقة شاشة الدرس */
.lesson-step-card {
  margin-top: 0.5rem;
  background: #ffffff;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 8px 20px rgba(148, 163, 184, 0.22);
}

/* نصوص منظمة */
.scene-text {
  font-size: 1.05rem;
  line-height: 1.9;
  color: #374151;
  margin: 0.3rem 0;
}

/* الألمانية مميزة بلون كحلي غامق */
.de-text {
  color: #1d3f8b;
  font-weight: 800;
}

/* زر الصوت للجملة الألمانية */
.audio-btn {
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}

/* سطر شرح (ألماني + عربي) */
.expl-line {
  font-size: 1.05rem;
  margin: 0.3rem 0;
}

/* ملاحظات الشرح (تُقال في أي وقت، حتى الساعة...) */
.ex-note {
  color: #7c3aed;
  font-weight: 600;
  margin-right: 0.25rem;
}

/* جدول العبارات */
.phrases-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.phrases-table th,
.phrases-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.45rem 0.4rem;
}

.phrases-table th {
  text-align: right;
  color: #4f46e5;
  font-weight: 600;
}

/* Badges للملاحظات */
.note-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.8rem;
  margin: 0 0.15rem 0.15rem 0;
  white-space: nowrap;
}

.note-formal-badge {
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
}

.note-informal-badge {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
}

.note-friends-badge {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
}

.note-neutral-badge {
  background: #e5e7eb;
  color: #374151;
}

/* حوار */
.dialogue-line {
  display: flex;
  gap: 0.45rem;
  font-size: 1.05rem;
  align-items: flex-start;
  margin: 0.3rem 0;
}

.dialogue-speaker {
  min-width: 2.4rem;
}

/* ملخص */
.summary-list p {
  margin: 0.3rem 0;
  font-size: 1rem;
}

/* Quiz */
.quiz-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.quiz-card {
  border-radius: 0.9rem;
  padding: 0.75rem 0.8rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  position: relative;
}

.quiz-question-text {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.quiz-option-btn {
  width: 100%;
  text-align: right;
  justify-content: space-between;
}

.quiz-feedback {
  font-size: 0.86rem;
  margin-top: 0.25rem;
}


.feedback-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #f1f5f9;
}

.feedback-chip-correct {
  background: #ecfdf3;
  color: #166534;
}

.feedback-chip-wrong {
  background: #fef2f2;
  color: #b91c1c;
}

.feedback-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.quiz-feedback.correct {
  color: #16a34a;
}

.quiz-feedback.wrong {
  color: #dc2626;
}


/* تأثيرات صحيحة / خاطئة للكويز */
.quiz-card.quiz-correct-flash {
  background: #ecfdf3;
  border-color: #bbf7d0;
  box-shadow: 0 0 0 2px #bbf7d0;
}

.quiz-card.quiz-wrong-flash {
  background: #fef2f2;
  border-color: #fecaca;
  box-shadow: 0 0 0 2px #fecaca;
}

.quiz-option-btn.correct {
  background: #dcfce7;
  border-color: #16a34a;
}

.quiz-option-btn.wrong {
  background: #fee2e2;
  border-color: #dc2626;
}

/* طبقة خفيفة على الشاشة عند الصح/الخطأ */
body.screen-correct-flash::before,
body.screen-wrong-flash::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  animation: screenFlash 0.35s ease-out;
}

body.screen-correct-flash::before {
  background: rgba(34, 197, 94, 0.16); /* أخضر شفاف */
}

body.screen-wrong-flash::before {
  background: rgba(239, 68, 68, 0.16); /* أحمر شفاف */
}

@keyframes screenFlash {
  0% { opacity: 0; }
  40% { opacity: 1; }
  100% { opacity: 0; }
}

/* زر التلميح ونص التلميح */
.quiz-hint-row {
  margin-top: 0.45rem;
  display: flex;
  justify-content: flex-start;
}

.quiz-hint-text {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  line-height: 1.5;
  background: #fefce8;          /* أصفر فاتح */
  border-radius: 0.7rem;
  padding: 0.45rem 0.6rem;
  border: 1px dashed #facc15;   /* أصفر أغمق */
}

/* شريط التنقّل بين شاشات الدرس */
.lesson-nav-bar {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.step-indicator {
  font-size: 0.9rem;
  color: #4b5563;
}

/* Confetti (ألعاب نارية بدون إيموجيات) */
.confetti-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 16px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall 1.1s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-40px) rotate(0deg);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(80px) rotate(360deg);
    opacity: 0;
  }
}

/* Animations */
@keyframes shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.shake {
  animation: shake 0.25s linear;
}

@keyframes pop {
  0% { transform: scale(0.9); opacity: 0; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.pop {
  animation: pop 0.3s ease-out;
}

/* Responsive */
@media (max-width: 640px) {
  .app-main {
    padding: 0.8rem 0.6rem 1rem;
  }

  .card {
    padding: 1rem;
  }

  .lesson-heading {
    font-size: 1.3rem;
  }
}
/* نافذة اختيار اللغة */
.lang-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.lang-popup {
  background: #fff;
  color: #111;
  padding: 2rem;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 25px rgba(0,0,0,0.25);
  transform: scale(0.95);
  animation: popIn 0.35s ease-out forwards;
}

.lang-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.lang-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  background: #e0e7ff;
  transform: scale(1.05);
}

.lang-btn.selected {
  background: #2563eb;
  color: #fff;
  transform: scale(1.1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lang-popup-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.expl-block {
  background: #f9fafb;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  line-height: 1.9;
}

.expl-head {
  margin-bottom: 4px;
}

.expl-de {
  font-weight: 600;
  /* الكلاس de-text الموجود عندك أصلاً يعطي اللون الكحلي */
}

.expl-body {
  color: #111;
  font-size: 0.98rem;
  direction: rtl;
}

/* لو حاب تقلل المسافة بين الأسطر في الشرح العربي */
.expl-body div + div {
  margin-top: 2px;
}
.scene-block {
  background: #f9fafb;
  border-radius: 14px;
  padding: 10px 14px;
  margin: 8px 0;
  line-height: 1.9;
}

.scene-block-main {
  border-inline-start: 4px solid #6366f1; /* شريط جانبي للمشهد الرئيسي */
}

.scene-line {
  direction: rtl;
  font-size: 0.98rem;
}

/* مسافة بسيطة بين الأسطر داخل نفس المشهد */
.scene-line + .scene-line {
  margin-top: 3px;
}
.inner-title {
  color: #16a34a; /* أخضر لطيف */
  font-weight: 600;
}
/* العنوان الألماني داخل فقرة الشرح الذكي السريع */
.expl-de.de-text {
  color: #16a34a !important; /* أخضر */
  font-weight: 700;
}
/* شكل عام لأي عنوان داخلي */
.inner-title {
  font-weight: 600;
}

/* الشرح الذكي السريع → أخضر */
.expl-body .inner-title {
  color: #16a34a;
}

/* المعلومة اللغوية + الملخص السريع → أرجواني غامق */
.tip-body .inner-title,
.summary-body .inner-title {
  color: #7e22ce;
}
.tip-block,
.summary-block {
  background: #f9fafb;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  line-height: 1.9;
}

.tip-body,
.summary-body {
  direction: rtl;
  font-size: 0.98rem;
}

/* مسافة بسيطة بين أسطر الفقرة الواحدة */
.tip-body div + div,
.summary-body div + div {
  margin-top: 3px;
}
.expl-audio-btn {
  padding: 0.1rem 0.35rem;
  font-size: 0.8rem;
}
.expl-title-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}
.expl-body-text {
  margin: 0 0 0.8rem 0;
  line-height: 1.6;
}
/* لون خاص لعناوين الشرح الذكي السريع */
.de-text.expl-title-de {
  color: #1a9b4f !important; /* أخضر غامق لطيف */
  font-weight: 600;
}
/* 🔊 عنوان فرعي داخل الشرح الذكي السريع */
.de-text.expl-title-de {
  color: #1a9b4f;
  font-weight: 600;
}

/* زر الصوت الصغير في الشرح */
.expl-audio-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.1rem 0.3rem;
}

/* صف جملة ألمانية + ترجمتها */
.expl-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.expl-row-de {
  flex: 1;
  direction: ltr;
  text-align: left;
  color: #1e3a8a;
  font-weight: 600;
}

.expl-row-ar {
  flex: 1;
  direction: rtl;
  text-align: right;
  color: #111827;
  font-weight: 500;
}

/* سطور المقدمة فوق الجمل */
.expl-body-intro {
  margin: 0.4rem 0 0.2rem;
  font-weight: 600;
}
/* 🎬 المشهد التفاعلي - عرض الجمل الألمانية والعربية */
.scene-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 6px 10px;
  margin-bottom: 6px;
  background: #fff8f1; /* خلفية برتقالية فاتحة */
  border: 1px solid #fed7aa;
  border-radius: 8px;
}

.scene-row-de {
  flex: 1;
  direction: ltr;
  text-align: left;
  color: #b45309; /* برتقالي غامق */
  font-weight: 600;
}

.scene-row-ar {
  flex: 1;
  direction: rtl;
  text-align: right;
  color: #111827;
  font-weight: 500;
}

/* زر الصوت الصغير */
.scene-audio-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  font-size: 0.9rem;
}

/* العناوين الفرعية داخل المشهد */
.scene-subtitle {
  color: #ea0ce6; /* برتقالي */
  font-weight: 700;
  margin: 10px 0 6px;
  text-align: center;
  font-size: 1.05rem;
}
/* 🎬 المشهد التفاعلي: جملة ألمانية + ترجمتها */
.scene-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.scene-row-de {
  flex: 1;
  direction: ltr;
  text-align: left;
  color: #1e3a8a;
  font-weight: 600;
}

.scene-row-ar {
  flex: 1;
  direction: rtl;
  text-align: right;
  color: #111827;
  font-weight: 500;
}

.scene-audio-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  font-size: 0.9rem;
}

/* العناوين الفرعية في المشهد التفاعلي – برتقالية */
.scene-subtitle {
  text-align: center;
  margin: 10px 0 6px;
  color: #ea580c;
  font-weight: 700;
  font-size: 1.05rem;
}

/* جملة منفردة لا تملك ترجمة مرافقة */
.scene-body-text {
  margin: 4px 0;
}
.quiz-feedback {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 10px;
  color: white;
  font-weight: bold;
  z-index: 9999;
  font-size: 1.2rem;
}
.quiz-feedback.success { background-color: #22c55e; }
.quiz-feedback.error { background-color: #ef4444; }
/* 🎉 طبقة احتفال عند الإجابة الصحيحة */
.mega-success-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 9999;
  animation: mega-success-bg 0.9s ease-out forwards;
}

.mega-success-emoji {
  font-size: 4rem;
  animation: mega-pop 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.mega-success-text {
  margin-top: 0.4rem;
  font-size: 1.4rem;
  font-weight: 700;
  opacity: 0;
  animation: mega-text-fade 0.7s ease-out forwards;
}

.mega-success-hide {
  opacity: 0;
}

/* دوائر صغيرة تنفجر حول الزر */
.success-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #3b82f6);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 9998;
  animation: particle-burst 0.8s ease-out forwards;
}

/* 🔴 طبقة فلاش عند الخطأ */
.error-overlay {
  position: fixed;
  inset: 0;
  background: rgba(220, 38, 38, 0.18);
  pointer-events: none;
  z-index: 9999;
  animation: error-flash 0.5s ease-out forwards;
}

/* اهتزاز الشاشة كلها */
.shake-screen {
  animation: screen-shake 0.45s cubic-bezier(.36,.07,.19,.97);
}

/* أنيميشن الانفجار الخلفي */
@keyframes mega-success-bg {
  0% {
    background: rgba(15, 118, 110, 0);
    opacity: 0;
  }
  25% {
    background: radial-gradient(circle at center, rgba(34, 197, 94, 0.35), transparent 60%);
    opacity: 1;
  }
  100% {
    background: transparent;
    opacity: 0;
  }
}

@keyframes mega-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

@keyframes mega-text-fade {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  50% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes particle-burst {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) rotate(var(--angle)) translate(90px) scale(0.2);
    opacity: 0;
  }
}

/* فلاش أحمر لطيف */
@keyframes error-flash {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* اهتزاز شاشة */
@keyframes screen-shake {
  10%, 90% {
    transform: translateX(-2px);
  }
  20%, 80% {
    transform: translateX(4px);
  }
  30%, 50%, 70% {
    transform: translateX(-6px);
  }
  40%, 60% {
    transform: translateX(6px);
  }
}
.error-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
/* صندوق الرسالة تحت كل سؤال */
.quiz-feedback {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  min-height: 1.1em;
}

/* ✅ سطر الجواب الصحيح */
.quiz-feedback-answer {
  color: #15803d;
  background: #dcfce7;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ❌ رسالة الخطأ */
.quiz-feedback-wrong {
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  display: inline-flex;
  align-items: center;
}

/* 💡 التلميح */
.quiz-feedback-hint {
  color: #92400e;
  background: #fef3c7;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.view-fade-in {
  animation: viewFadeIn 0.25s ease-out;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.lesson-end-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.lesson-end-card {
  background: white;
  color: #111;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: fadeInUp 0.3s ease;
}

.lesson-stars {
  font-size: 2rem;
  margin: 1rem 0;
}

.lesson-end-buttons button {
  margin: 0.4rem;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.theme-toggle {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(255,255,255,0.2);
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 10000;
  padding: 5px 10px;
  border-radius: 8px;
  backdrop-filter: blur(5px);
  transition: transform 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}
/* 🌙 دارك مود بسيط وقوي */
:root[data-theme="dark"] body {
  background: #020617;
  color: #e5e7eb;
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .lesson-step-card,
:root[data-theme="dark"] .lesson-card,
:root[data-theme="dark"]
:root[data-theme="dark"] .lesson-title,
:root[data-theme="dark"] .lesson-heading,
:root[data-theme="dark"] .logo-text {
  color: #f9fafb;
}

:root[data-theme="dark"] .scene-row,
:root[data-theme="dark"] .expl-block,
:root[data-theme="dark"] .tip-block,
:root[data-theme="dark"] .summary-block,
:root[data-theme="dark"] .quiz-card {
  background: #020617;
  color: #e5e7eb;
  border-color: #1f2937;
}

:root[data-theme="dark"] .de-text {
  color: #bfdbfe;
}

:root[data-theme="dark"] .theme-toggle {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border: 1px solid #334155;
}

/* =========================
   🎬 حركات دخول لطيفة (Animations)
   ========================= */

/* 1) حركة دخول خفيفة من الأسفل مع شفافية */
@keyframes fadeInUp-soft {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 2) حركة دخول مع تكبير بسيط للبطاقات */
@keyframes card-pop-soft {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 3) نطبّق حركة لطيفة على كل .card جديدة تظهر في الصفحة */
.card {
  animation: card-pop-soft 0.28s ease-out;
}

/* 4) شاشة الدرس نفسها (الجزء الأبيض الكبير اللي يتغيّر بين الخطوات) */
.lesson-step-card {
  animation: fadeInUp-soft 0.28s ease-out;
}

/* 5) بطاقات الدروس في قائمة الدروس */
.lesson-card {
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    background-color 0.18s ease-out;
}

/* لما تمرّر الماوس على بطاقة درس */
.lesson-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

/* 6) انطباع ناعم عند الضغط على أي زر */
.btn:active {
  transform: scale(0.97);
}

/* نتأكد أن الأزرار في وضع عادي ترجع لحجمها الطبيعي */
.btn {
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s ease-out,
    background-color 0.12s ease-out;
}
/* =========================
   🎬 أنيميشن النوافذ المنبثقة (Popups)
   ========================= */

/* خلفية التعتيم تدخل بشفافية ناعمة */
@keyframes overlay-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* خلفية التعتيم تختفي بشفافية ناعمة */
@keyframes overlay-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* الصندوق الأبيض نفسه (النافذة) يطلع مع تكبير خفيف */
@keyframes popup-scale-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* وعند الإغلاق يصغر شوي ويختفي */
@keyframes popup-scale-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

/* نطبّق حركة الدخول على الـ overlay */
.lang-popup-overlay {
  animation: overlay-fade-in 0.22s ease-out;
}

/* وعند إضافة .fade-out من الـ JS نغيّر الأنيميشن */
.lang-popup-overlay.fade-out {
  animation: overlay-fade-out 0.22s ease-in forwards;
}

/* الصندوق الداخلي (النافذة) – حركة دخول */
.lang-popup {
  animation: popup-scale-in 0.22s ease-out;
}

/* وعند الإغلاق – حركة خروج */
.lang-popup-overlay.fade-out .lang-popup {
  animation: popup-scale-out 0.18s ease-in forwards;
}
/* =========================
   🎉 شاشة "أنهيت الدرس"
   ========================= */

.lesson-complete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55); /* خلفية غامقة خفيفة */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: overlay-fade-in 0.22s ease-out;
}

/* نستخدم نفس فكرة الـ fade-out مثل النوافذ المنبثقة */
.lesson-complete-overlay.fade-out {
  animation: overlay-fade-out 0.22s ease-in forwards;
}

.lesson-complete-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  max-width: 360px;
  width: calc(100% - 2rem);
  text-align: center;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
  animation: complete-pop 0.24s ease-out;
}

.lesson-complete-emoji {
  font-size: 2.2rem;
  margin-bottom: 0.4rem;
}

.lesson-complete-card h3 {
  margin: 0 0 0.4rem 0;
  font-size: 1.15rem;
}

.lesson-complete-card p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* حركة ظهور الكرت */
@keyframes complete-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
/* =========================
   📅 لوحة التقدّم الأسبوعية
   ========================= */
.weekly-progress {
  margin-top: 1.2rem;
  background: #f8fafc;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  text-align: center;
  animation: fadeInUp 0.3s ease-out;
}

.progress-title {
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.progress-days {
  display: flex;
  justify-content: space-around;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.progress-day {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.progress-day.done {
  background: #22c55e;
  color: white;
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.progress-summary {
  font-size: 0.9rem;
  color: #0f172a;
}

.progress-rewards {
  margin-top: 0.35rem;
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.progress-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.progress-badge.badge-first {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #c7d2fe;
}

.progress-badge.badge-week {
  background: #ecfdf3;
  color: #15803d;
  border-color: #bbf7d0;
}

/* =========================
   🏅 Toast لمكافآت التقدّم
   ========================= */
.reward-toast {
  position: fixed;
  bottom: 1rem;
  inset-inline-end: 1rem; /* يمين في اللغات من اليمين لليسار */
  background: #0f172a;
  color: #e5e7eb;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.55);
  font-size: 0.85rem;
  max-width: 260px;
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.25s ease-out,
    transform 0.25s ease-out;
}

.reward-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.reward-toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.reward-toast-text {
  opacity: 0.9;
  line-height: 1.4;
}
/* =========================
   🎓 زر امتحان نهاية المستوى
   ========================= */
.level-exam-box {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px dashed #cbd5f5;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.level-exam-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.level-exam-sub {
  font-size: 0.8rem;
  font-weight: 400;
  color: #4b5563;
}

.level-exam-btn.level-exam-locked {
  opacity: 0.75;
}
/* ======================
   🎓 واجهة امتحان المستوى
   ====================== */

.exam-card {
  animation: exam-fade-in 0.25s ease-out;
}

@keyframes exam-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.exam-progress {
  position: relative;
  margin-bottom: 0.75rem;
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.exam-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #3b82f6);
  transition: width 0.25s ease-out;
}

.exam-progress-label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #4b5563;
}

.exam-question-block {
  margin: 0.75rem 0;
}

.exam-question-de {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.exam-question-ar {
  font-size: 0.9rem;
  color: #4b5563;
}

.exam-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.exam-option-btn {
  width: 100%;
  text-align: left;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}

.exam-option-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.09);
}

.exam-option-selected {
  outline: 2px solid #6366f1;
}

.exam-option-correct {
  background-color: #dcfce7 !important;
  border-color: #22c55e !important;
}

.exam-option-wrong {
  background-color: #fee2e2 !important;
  border-color: #ef4444 !important;
}

.exam-feedback {
  min-height: 40px;
  font-size: 0.9rem;
  color: #111827;
}

.exam-expl {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #111827;
}

.exam-expl-ar {
  margin-top: 0.2rem;
  color: #4b5563;
}

.exam-bottom-bar {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.exam-result-card {
  text-align: center;
  animation: exam-result-pop 0.3s ease-out;
}

@keyframes exam-result-pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.exam-result-main {
  margin-top: 0.75rem;
}

.exam-result-percent span {
  font-size: 1.4rem;
  font-weight: 700;
  color: #16a34a;
}

.floating-card {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.rainbow-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(
    90deg,
    #ff0000,
    #ff7f00,
    #ffff00,
    #00ff00,
    #0000ff,
    #4b0082,
    #9400d3
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbowText 3s linear infinite;
}

@keyframes rainbowText {
  to { background-position: 200% center; }
}
.sparkle {
  display: inline-block;
  animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(1.5); }
}
.btn-primary,
.btn-secondary {
  animation: glowPulse 1.6s ease-in-out infinite;
}
/* ✨ تأثير Glow القوي */
.force-glow {
  animation: forceGlowPulse 1.6s ease-in-out infinite !important;
  box-shadow: 0 0 18px rgba(255, 255, 0, 0.9) !important;
}

@keyframes forceGlowPulse {
  0% {
    box-shadow: 0 0 0px rgba(255, 255, 0, 0.0);
  }
  50% {
    box-shadow: 0 0 22px rgba(255, 255, 0, 1);
  }
  100% {
    box-shadow: 0 0 0px rgba(255, 255, 0, 0.0);
  }
}
/* ✨ تأثير Glow قوي للزر */
.force-glow {
  animation: forceGlowPulse 1.6s ease-in-out infinite !important;
  box-shadow: 0 0 18px rgba(255, 255, 0, 0.9) !important;
}

@keyframes forceGlowPulse {
  0% {
    box-shadow: 0 0 0px rgba(255, 255, 0, 0.0);
  }
  50% {
    box-shadow: 0 0 22px rgba(255, 255, 0, 1);
  }
  100% {
    box-shadow: 0 0 0px rgba(255, 255, 0, 0.0);
  }
}

/* =========================
   🎮 شاشة LEVEL UP
   ========================= */
.levelup-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(251,191,36,0.18), rgba(15,23,42,0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(6px);
  animation: overlay-fade-in 0.25s ease-out;
}

.levelup-card {
  position: relative;
  background: #020617;
  border-radius: 24px;
  padding: 1.8rem 2.2rem;
  max-width: 360px;
  width: calc(100% - 2.5rem);
  text-align: center;
  color: #e5e7eb;
  box-shadow: 0 18px 45px rgba(0,0,0,0.7);
  overflow: hidden;
}

.levelup-glow {
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 0deg,
    #f97316,
    #22c55e,
    #3b82f6,
    #a855f7,
    #f97316
  );
  opacity: 0.5;
  filter: blur(30px);
  z-index: -1;
  animation: levelup-rotate 10s linear infinite;
}

.levelup-title {
  font-size: 1.4rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  opacity: 0.9;
}

.levelup-number {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  background: linear-gradient(90deg, #f97316, #22c55e, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.levelup-text {
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
  opacity: 0.95;
}

.levelup-btn {
  margin-top: 0.4rem;
}

/* أنيميشن دوران الهالة */
@keyframes levelup-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* إخفاء ناعم عند الإغلاق */
.levelup-hide {
  animation: overlay-fade-out 0.24s ease-in forwards;
}

/* حركة الخلفية */
@keyframes bg-rainbow-move {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
/* 🔥 زر نيون مضيء (btn-primary) */
.btn-primary {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(120deg, #22c55e, #16a34a, #4ade80);
  color: #022c22;
  box-shadow:
    0 0 12px rgba(34, 197, 94, 0.8),
    0 0 24px rgba(52, 211, 153, 0.7);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background-position 0.3s ease;
  background-size: 200% 200%;
}

/* هالة نيون خفيفة حوالين الزر */
.btn-primary::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: radial-gradient(circle at top left,
    rgba(255, 255, 255, 0.55),
    transparent 55%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* عند تمرير الماوس فوق الزر */
.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  background-position: 100% 0%;
  box-shadow:
    0 0 16px rgba(34, 197, 94, 0.9),
    0 0 32px rgba(52, 211, 153, 0.8);
}

.btn-primary:hover::before {
  opacity: 1;
}

/* عند الضغط */
.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 0 10px rgba(34, 197, 94, 0.7),
    0 0 20px rgba(52, 211, 153, 0.6);
}
/* 🎴 كروت الموقع – حركة خفيفة ومحترمة */
.card {
  border-radius: 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition:
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

/* ===================== أزرار نيون متوهّجة ===================== */

.btn-primary,
.btn-secondary {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  box-shadow:
    0 0 10px rgba(255,255,255,0.3),
    0 8px 20px rgba(15,23,42,0.45);
}

.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 0 16px rgba(255,255,255,0.55),
    0 10px 28px rgba(15,23,42,0.7);
}

/* هالة ضوئية خفيفة داخل الزر */
.btn-primary::after,
.btn-secondary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center,
    rgba(255,255,255,0.35),
    transparent 65%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.btn-primary:hover::after,
.btn-secondary:hover::after {
  opacity: 1;
}
/* ===================== تأثير ضغط الزر ===================== */

.btn:active {
  transform: scale(0.95) translateY(1px);
  box-shadow: 0 2px 8px rgba(15,23,42,0.5);
}
/* ===================== انتقال بين الشاشات ===================== */

.view-fade-in {
  animation: viewFadeSlide 0.28s ease-out;
}

@keyframes viewFadeSlide {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
/* 🌍 Language Choice Modal – new design */

.lang-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.lang-modal__backdrop {
  background:
    radial-gradient(circle at top, rgba(96,165,250,0.35), transparent 60%),
    radial-gradient(circle at bottom, rgba(244,114,182,0.35), transparent 60%),
    radial-gradient(circle at center, rgba(255,255,255,0.2), rgba(15,23,42,0.6));
}


.lang-modal__dialog {
  position: relative;
  width: min(90%, 640px);
  padding: 2.1rem 2.3rem 2rem;
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(15,23,42,0.92), rgba(15,23,42,0.95)),
    radial-gradient(circle at top left, rgba(255,255,255,0.08), transparent 55%);
  color: #f9fafb;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.8),
    0 0 0 1px rgba(148, 163, 184, 0.4);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: popIn 0.26s ease-out;
}

.lang-modal__icon {
  font-size: 2.2rem;
  margin-bottom: 0.3rem;
}

.lang-modal__step {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 0.35rem;
}

.lang-modal__title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.3rem;
}

.lang-modal__subtitle {
  font-size: 0.92rem;
  color: #d1d5db;
  margin-bottom: 1.3rem;
}

/* Buttons grid */
.lang-modal__buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem 0.9rem;
  width: 100%;
}

/* Language button */
.lang-btn {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f9fafb;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  box-shadow:
    0 8px 18px rgba(34, 197, 94, 0.45),
    0 0 0 1px rgba(15, 23, 42, 0.4);
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    filter 0.14s ease;
}

.lang-btn__flag {
  font-size: 1.25rem;
}

.lang-btn__label {
  white-space: nowrap;
}

.lang-btn__code {
  font-size: 0.68rem;
  opacity: 0.8;
}

/* ألوان مختلفة لكل لغة (اختياري) */
.lang-btn[data-lang="uk"] {
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
}
.lang-btn[data-lang="en"] {
  background: linear-gradient(135deg, #6366f1, #22c55e);
}
.lang-btn[data-lang="ar"] {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}
.lang-btn[data-lang="tr"] {
  background: linear-gradient(135deg, #f97316, #ec4899);
}
.lang-btn[data-lang="fa"] {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
}
.lang-btn[data-lang="ru"] {
  background: linear-gradient(135deg, #f97373, #ef4444);
}
.lang-btn[data-lang="af"] {
  background: linear-gradient(135deg, #22c55e, #22d3ee);
}

.lang-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 10px 24px rgba(15,23,42,0.9),
    0 0 0 1px rgba(248, 250, 252, 0.9);
  filter: brightness(1.05);
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* أنيميشن الخلفية والظهور */
@keyframes modalBackdropPulse {
  from {
    opacity: 0.9;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalPopIn {
  from {
    transform: scale(0.9) translateY(4px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* أنيميشن الاختفاء عند إضافة كلاس fade-out من JS */
.lang-modal.fade-out .lang-modal__content {
  animation: modalFadeOut 0.25s ease forwards;
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
  }
}
/* زر إعادة ضبط الموقع */
.reset-app-btn {
  margin-top: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fef2f2;
  box-shadow: 0 4px 12px rgba(248, 113, 113, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition:
    transform 0.1s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
}

.reset-app-btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 7px 18px rgba(248, 113, 113, 0.55);
  filter: brightness(1.05);
}

.reset-app-btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 3px 8px rgba(127, 29, 29, 0.7);
}
/* 🔰 شعار DeutschHero المتحرك */

.logo-svg {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

/* حركة الدرع – يهتز شوي ويكبر/يصغر مثل قلب سوبر هيرو */
.logo-svg .shield-group {
  transform-origin: center;
  transform-box: fill-box;
  animation: dh-float 4s ease-in-out infinite;
}

/* ممكن تزود السرعة أو تبطئها بتغيير 4s */
@keyframes dh-float {
  0% {
    transform: translateY(0) scale(1) rotate(-3deg);
  }
  25% {
    transform: translateY(-2px) scale(1.03) rotate(0deg);
  }
  50% {
    transform: translateY(0) scale(1.05) rotate(3deg);
  }
  75% {
    transform: translateY(-1px) scale(1.03) rotate(0deg);
  }
  100% {
    transform: translateY(0) scale(1) rotate(-3deg);
  }
}

/* وهج خفيف حوالي اللوغو */
.logo-svg .shield-border {
  filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.9));
}

/* نص DeutschHero – خفيف لمعة */
.logo .logo-text {
  font-weight: 800;
  letter-spacing: 0.03em;
  margin-inline-start: 0.4rem;
  color: #f9fafb;
  text-shadow: 0 0 6px rgba(15, 23, 42, 0.9);
  animation: dh-text-glow 3.5s ease-in-out infinite;
}

/* لو الهيدر أبيض عندك، غيّر اللون */
.app-header {
  background: rgba(15, 23, 42, 0.96); /* هيدر غامق أنيق */
  color: #f9fafb;
  border-bottom: 1px solid rgba(15, 23, 42, 0.7);
}

/* توهّج نص DeutschHero */
@keyframes dh-text-glow {
  0% {
    text-shadow: 0 0 4px rgba(250, 250, 250, 0.3);
  }
  50% {
    text-shadow: 0 0 14px rgba(250, 250, 250, 0.9);
  }
  100% {
    text-shadow: 0 0 4px rgba(250, 250, 250, 0.3);
  }
}
/* زر مشاركة الدرس */
.share-container {
  margin-top: 1.5rem;
  text-align: center;
}

.btn-share {
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  padding: 0.7rem 1.3rem;
  font-size: 0.95rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-share:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(6, 182, 212, 0.5);
}
.lesson-share-bar {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}
/* ============================= */
/* 🎨 نظام اللون الأساسي للموقع  */
/* ============================= */

:root {
  --accent: #4f46e5;        /* بنفسجي أزرق مرتب */
  --accent-strong: #4338ca; /* أغمق شوي للهُوفر */
  --accent-soft: #eef2ff;   /* خلفية ناعمة فاتحة */
}

/* زر رئيسي – موحد بكل الموقع */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  border: none;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
  transition:
    background-position 0.2s ease-out,
    transform 0.15s ease-out,
    box-shadow 0.15s ease-out;
  background-size: 200% 200%;
}

.btn-primary:hover {
  transform: translateY(-1px);
  background-position: 100% 0;
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

/* زر ثانوي – أبيض بحواف بنفسجية */
.btn-secondary {
  background: #ffffff;
  color: var(--accent);
  border: 1px solid rgba(79, 70, 229, 0.5);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  transition:
    background-color 0.15s ease-out,
    color 0.15s ease-out,
    box-shadow 0.15s ease-out,
    transform 0.12s ease-out;
}

.btn-secondary:hover {
  background: var(--accent-soft);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1);
}

/* الروابط في الموقع بلون البراند */
a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* شارة المستوى / شارة المستخدم لمسة خفيفة بالـ accent */
.level-badge {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.user-chip {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
/* ======================== */
/* 💚 إبراز حالة الدروس      */
/* ======================== */

.lesson-card {
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  padding: 0.9rem;
  background: #ffffff;
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    border-color 0.18s ease-out;
}

/* الدرس المنتهي */
.lesson-card.completed {
  background: #ecfdf5;              /* أخضر خفيييف */
  border-color: #6ee7b7;            /* أخضر فاتح */
  box-shadow: 0 4px 12px rgba(16,185,129,0.12);
}

/* الدرس الحالي */
.lesson-card.current {
  border-color: #34d399 !important; /* أخضر قوي */
  box-shadow: 0 0 0 3px rgba(52,211,153,0.35);
  transform: translateY(-2px);      /* بروز بسيط */
}

/* hover للجميع */
.lesson-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15,23,42,0.12);
}
/* ========================= */
/* 📱 تحسين العرض على الموبايل */
/* ========================= */

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .app-header {
    padding: 0.5rem 0.75rem;
  }

  .logo-text {
    font-size: 0.95rem;
  }

  .app-main {
    padding: 0.75rem 0.5rem 1rem;
  }

  /* شبكة الدروس: عمود واحد على الموبايل */
  .lessons-grid {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .lesson-card {
    padding: 0.8rem 0.85rem;
  }

  /* النافبار – أزرار ما تنخنق */
  .main-nav {
    gap: 0.35rem;
    padding: 0 0.4rem;
  }

  .main-nav .nav-link {
    flex: 1 1 calc(50% - 0.5rem);
    text-align: center;
    font-size: 0.85rem;
    padding: 0.35rem 0.6rem;
  }

  /* شارة المستخدم والمستوى أصغر شوي */
  .user-chip {
    font-size: 0.8rem;
    padding: 0.15rem 0.55rem;
  }

  .level-badge {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
  }

  /* أزرار داخل الكروت تملى العرض وتسهّل اللمس */
  .btn,
  .btn-primary,
  .btn-secondary {
    min-height: 2.4rem;
    font-size: 0.9rem;
  }

  .quiz-options {
    flex-direction: column;
  }

  .quiz-option-btn {
    width: 100%;
    justify-content: center;
  }
}
