/* gamification.css — لوحة "نقاطي وإنجازاتي"
   تعتمد كليًّا على متغيّرات base.css (--gold, --green, --navy, --paper, --ink, --line, --r, --shadow)
   لتتكيّف تلقائيًّا مع الوضع الليلي. تصميم متجاوب يبدأ من الجوّال (mobile-first). RTL. */

html[data-lang="en"] .gam-panel, html[data-lang="en"] .gam-panel .gam-head { direction: ltr; text-align: left; }
.gam-panel {
  direction: rtl;
  text-align: right;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg, 26px);
  box-shadow: var(--shadow);
  padding: 15px 14px;
  margin: 14px auto;
  max-width: 980px;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
}
.gam-panel.gam-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .5s var(--ease, ease), transform .5s var(--ease, ease);
}
/* شريط ذهبي علوي رفيع للهوية */
.gam-panel::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 4px;
  background: var(--gold-grad, var(--gold));
}

/* ===== الرأس ===== */
.gam-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.gam-eyebrow {
  display: block;
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .5px;
  color: var(--gold-dark, var(--gold));
  margin-bottom: 4px;
}
.gam-title {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
  margin: 0;
}
.gam-level-badge {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 10px 12px;
  border-radius: var(--r, 18px);
  background: var(--navy-grad, var(--navy));
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 42, 69, .28);
}
.gam-level-num {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
}
.gam-level-name {
  font-size: .74rem;
  font-weight: 700;
  margin-top: 4px;
  opacity: .92;
}

/* ===== النقاط + الرقائق ===== */
.gam-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.gam-points {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.gam-points-num {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--gold-dark, var(--gold));
}
.gam-points-lbl {
  font-size: .9rem;
  font-weight: 700;
  color: var(--ink-2, var(--ink));
}
.gam-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-inline-start: auto;
}
.gam-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--ink-2, var(--ink));
  background: var(--cream-2, transparent);
  white-space: nowrap;
}
.gam-chip-streak {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #F0A24B 0%, #D5564E 100%);
}
.gam-chip-streak.gam-chip-off {
  background: var(--cream-2, transparent);
  color: var(--muted, var(--ink-2));
  border-color: var(--line);
}
.gam-chip-done {
  color: #fff;
  border-color: transparent;
  background: var(--green-grad, var(--green));
}

/* ===== شريط التقدّم ===== */
.gam-progress {
  height: 12px;
  border-radius: 999px;
  background: var(--cream-2, var(--line));
  border: 1px solid var(--line);
  overflow: hidden;
}
.gam-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--gold-grad, var(--gold));
  transition: width 1s var(--ease, ease);
}
.gam-progress-note {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-2, var(--ink));
  margin-top: 8px;
}

/* ===== الشارات ===== */
.gam-badges-wrap { margin-top: 14px; }
.gam-badges-head {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: .92rem;
  color: var(--ink);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
/* الجوّال: صفّ أفقي مدمج قابل للتمرير (يوفّر ارتفاعاً كبيراً) */
.gam-badges-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.gam-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  padding: 11px 8px;
  flex: 0 0 auto;
  width: 104px;
  scroll-snap-align: start;
  border-radius: var(--r, 18px);
  border: 1px solid var(--line);
  background: var(--cream, var(--paper));
  transition: transform .25s var(--ease, ease), box-shadow .25s var(--ease, ease);
}
.gam-badge-desc { display: none; } /* يظهر على الشاشات الأكبر */
.gam-badge-ico {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.gam-badge-emoji {
  font-size: 1.7rem;
  line-height: 1;
}
.gam-badge-lock {
  position: absolute;
  inset-block-end: -2px;
  inset-inline-end: -2px;
  font-size: .8rem;
  filter: grayscale(1);
}
.gam-badge-title {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  font-size: .84rem;
  color: var(--ink);
}
.gam-badge-desc {
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-2, var(--ink));
}

/* مكتسبة: ألوان الهوية + توهّج ذهبي خفيف */
.gam-badge.is-earned {
  border-color: var(--gold-light, var(--gold));
  background:
    linear-gradient(180deg, rgba(196, 154, 63, .10), rgba(196, 154, 63, 0)) ,
    var(--paper);
  box-shadow: var(--shadow-sm);
}
.gam-badge.is-earned .gam-badge-ico {
  background: var(--gold-grad, var(--gold));
  box-shadow: var(--shadow-gold, 0 8px 18px rgba(168, 123, 40, .3));
}
.gam-badge.is-earned:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

/* مقفلة: رمادية باهتة */
.gam-badge.is-locked {
  opacity: .62;
}
.gam-badge.is-locked .gam-badge-ico {
  background: var(--cream-2, var(--line));
}
.gam-badge.is-locked .gam-badge-emoji {
  filter: grayscale(1);
  opacity: .7;
}
.gam-badge.is-locked .gam-badge-title {
  color: var(--ink-2, var(--ink));
}

/* ===== استجابة الجوّال أولًا → التوسّع للأكبر ===== */
@media (min-width: 560px) {
  .gam-panel { padding: 26px 24px; }
  .gam-title { font-size: 1.4rem; }
  .gam-points-num { font-size: 2.5rem; }
  .gam-badges-grid { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
  .gam-badge { width: auto; }
  .gam-badge-desc { display: block; }
  .gam-badge-ico { width: 52px; height: 52px; }
}
@media (min-width: 860px) {
  .gam-badges-grid { grid-template-columns: repeat(5, 1fr); }
}

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  .gam-panel,
  .gam-panel.gam-in,
  .gam-progress-bar,
  .gam-badge { transition: none; }
  .gam-panel { opacity: 1; transform: none; }
}
