/* ============================================================================
   LangHub — نافذة تحميل APK الاحترافية (apk-download-ui)
   طبقة مستقلة: تُحمَّل مع الصفحة وتتعامل مع الوضعين الداكن (الافتراضي)
   والفاتح (body.light-mode) تلقائياً، وتدعم RTL/LTR دون تغيير.
   v4: لوحة إرشادات التثبيت المصورة + تمرير النافذة في الشاشات القصيرة.
   ========================================================================== */

.apkd-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 12, 24, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  font-family: 'Cairo', system-ui, sans-serif;
}
.apkd-overlay.open { opacity: 1; visibility: visible; }

.apkd-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  /* v4: مع لوحة الإرشادات قد يتجاوز ارتفاع البطاقة الشاشات القصيرة */
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
  background: linear-gradient(160deg, #152036 0%, #0f172a 60%, #101b30 100%);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 26px;
  padding: 34px 28px 26px;
  text-align: center;
  color: #f1f5f9;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.03) inset;
  transform: translateY(16px) scale(.97);
  transition: transform .35s cubic-bezier(.34,1.4,.5,1);
  /* v5: overflow-x فقط حتى لا يلغي overflow-y:auto — سكرول البطاقة باللمس
     عند تجاوز الدليل ارتفاع الشاشة، مع بقاء قصّ هالة الزخرفة أفقياً */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.apkd-overlay.open .apkd-card { transform: translateY(0) scale(1); }

/* هالة خلفية خافتة */
.apkd-card::before {
  content: '';
  position: absolute;
  top: -90px; left: 50%;
  width: 320px; height: 200px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(245,158,11,.18), transparent 65%);
  pointer-events: none;
}

/* ===== الشعار + حلقة التقدم الدائرية ===== */
.apkd-logo-wrap {
  position: relative;
  width: 118px; height: 118px;
  margin: 0 auto 16px;
}
.apkd-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--apkd-ring-color, #f59e0b) calc(var(--apkd-progress, 0) * 1%), rgba(148, 163, 184, 0.18) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  transition: background .25s linear;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.35));
}
.apkd-logo {
  position: absolute; inset: 10px;
  border-radius: 50%;
  background: #0b1222;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.apkd-logo img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }

/* شارة الإكمال */
.apkd-badge {
  position: absolute;
  bottom: 2px; inset-inline-end: 2px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: none;
  align-items: center; justify-content: center;
  color: #fff; font-size: 17px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, .5), 0 0 0 4px #0f172a;
  animation: apkdPop .45s cubic-bezier(.34,1.6,.5,1);
}
.apkd-card.done .apkd-badge { display: flex; }
.apkd-card.done .apkd-ring {
  background: conic-gradient(#10b981 100%, rgba(148,163,184,.18) 0);
  filter: drop-shadow(0 0 10px rgba(16,185,129,.45));
}

/* ===== النصوص ===== */
.apkd-title { font-size: 1.22rem; font-weight: 800; margin: 2px 0 4px; }
.apkd-sub { font-size: .85rem; color: #94a3b8; min-height: 1.4em; margin-bottom: 16px; }
.apkd-card.done .apkd-sub { color: #6ee7b7; }

.apkd-percent {
  font-size: 2.1rem; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, #fbbf24, #f59e0b 60%, #e67e22);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
.apkd-card.done .apkd-percent {
  background: linear-gradient(135deg, #34d399, #059669);
  -webkit-background-clip: text; background-clip: text;
}

/* ===== شريط التقدم ===== */
.apkd-bar {
  height: 12px;
  background: rgba(148, 163, 184, 0.16);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}
.apkd-bar-fill {
  height: 100%; width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #e67e22, #f59e0b 55%, #fbbf24);
  background-size: 200% 100%;
  animation: apkdShimmer 1.6s linear infinite;
  transition: width .25s linear;
  box-shadow: 0 0 12px rgba(245, 158, 11, .45);
}
.apkd-card.done .apkd-bar-fill {
  background: linear-gradient(90deg, #059669, #10b981);
  animation: none;
  box-shadow: 0 0 12px rgba(16, 185, 129, .4);
}

/* ===== إحصاءات: حجم/سرعة/وقت ===== */
.apkd-stats {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.apkd-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: .74rem;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.apkd-chip i { color: #f59e0b; font-size: .72rem; }
.apkd-card.done .apkd-chip i { color: #10b981; }

/* ===== الأزرار ===== */
.apkd-actions { display: flex; flex-direction: column; gap: 10px; }
.apkd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: .95rem;
  padding: 13px 22px; border-radius: 15px;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s;
  text-decoration: none;
}
.apkd-btn:hover { transform: translateY(-2px); }
.apkd-btn:active { transform: translateY(0); }

.apkd-btn-primary {
  background: linear-gradient(135deg, #f59e0b, #e67e22);
  color: #1a1205;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}
.apkd-btn-primary:hover { box-shadow: 0 12px 30px rgba(245, 158, 11, 0.45); }

.apkd-btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}
.apkd-btn-success:hover { box-shadow: 0 12px 30px rgba(16, 185, 129, 0.45); }

.apkd-btn-ghost {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-weight: 600; font-size: .82rem;
  padding: 9px 18px; border-radius: 12px;
}
.apkd-btn-ghost:hover { color: #e2e8f0; border-color: rgba(148, 163, 184, 0.45); }

.apkd-hint { margin-top: 12px; font-size: .72rem; color: #64748b; line-height: 1.6; }

/* زر الإغلاق */
.apkd-close {
  position: absolute;
  top: 14px; inset-inline-end: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(148,163,184,.2);
  background: rgba(148,163,184,.08);
  color: #94a3b8;
  font-size: .85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.apkd-close:hover { color: #f1f5f9; background: rgba(148,163,184,.18); transform: rotate(90deg); }

/* حالة الخطأ */
.apkd-card.error .apkd-ring { background: conic-gradient(#ef4444 100%, rgba(148,163,184,.18) 0); filter: none; }
.apkd-card.error .apkd-percent {
  background: linear-gradient(135deg, #f87171, #dc2626);
  -webkit-background-clip: text; background-clip: text;
}
.apkd-card.error .apkd-bar-fill { background: #ef4444; animation: none; box-shadow: none; }

/* حركة أيقونة التحميل داخل الحالات */
.apkd-card.downloading .apkd-logo img { animation: apkdFloat 1.8s ease-in-out infinite; }

/* الحالة التقديرية (بلا Service Worker): شريط متنقل بلا أرقام مضللة */
.apkd-card.indeterminate .apkd-ring {
  background: conic-gradient(rgba(245,158,11,.9) calc(var(--apkd-progress,0)*1%), rgba(148,163,184,.18) 0);
  animation: apkdSpin 1.6s linear infinite;
}
.apkd-card.indeterminate .apkd-bar-fill {
  width: 38% !important;
  animation: apkdSlide 1.3s ease-in-out infinite alternate;
}
@keyframes apkdSpin { to { transform: rotate(360deg); } }
@keyframes apkdSlide { from { margin-inline-start: 0; } to { margin-inline-start: 62%; } }

/* ===== الوضع الفاتح ===== */
body.light-mode .apkd-overlay { background: rgba(226, 232, 240, 0.7); }
body.light-mode .apkd-card {
  background: linear-gradient(160deg, #ffffff 0%, #f8fafc 60%, #fefaf3 100%);
  border-color: rgba(245, 158, 11, 0.3);
  color: #0f172a;
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.18);
}
body.light-mode .apkd-logo { background: #fff; box-shadow: 0 2px 10px rgba(15,23,42,.06); }
body.light-mode .apkd-sub { color: #64748b; }
body.light-mode .apkd-card.done .apkd-sub { color: #059669; }
body.light-mode .apkd-bar { background: rgba(15, 23, 42, 0.08); }
body.light-mode .apkd-chip { background: rgba(15, 23, 42, 0.04); border-color: rgba(15, 23, 42, 0.08); color: #475569; }
body.light-mode .apkd-btn-ghost { color: #64748b; border-color: rgba(15, 23, 42, 0.15); }
body.light-mode .apkd-btn-ghost:hover { color: #0f172a; border-color: rgba(15, 23, 42, 0.3); }
body.light-mode .apkd-hint { color: #94a3b8; }
body.light-mode .apkd-close { color: #64748b; border-color: rgba(15,23,42,.12); background: rgba(15,23,42,.04); }
body.light-mode .apkd-close:hover { color: #0f172a; background: rgba(15,23,42,.08); }
body.light-mode .apkd-badge { box-shadow: 0 4px 14px rgba(16,185,129,.4), 0 0 0 4px #fff; }

/* ===== الشريط العائم: كم وصل التحميل فور فتح الموقع ===== */
.apkd-pill {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2900; /* تحت النافذة المنبثقة (3000) */
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: linear-gradient(135deg, #f59e0b, #e67e22);
  color: #1a1205;
  font-family: 'Cairo', system-ui, sans-serif;
  font-weight: 800;
  font-size: .8rem;
  padding: 11px 18px;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.4), 0 0 0 4px rgba(8, 12, 24, 0.25);
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: apkdPillIn .35s cubic-bezier(.34, 1.4, .5, 1);
  font-variant-numeric: tabular-nums;
}
.apkd-pill i { animation: apkdFloat 1.8s ease-in-out infinite; flex: none; }
.apkd-pill:hover { transform: translateX(-50%) translateY(-3px); box-shadow: 0 14px 34px rgba(245, 158, 11, 0.5), 0 0 0 4px rgba(8, 12, 24, 0.25); }
.apkd-pill-done {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4), 0 0 0 4px rgba(8, 12, 24, 0.25);
}
.apkd-pill-done i { animation: none; }
@keyframes apkdPillIn {
  from { transform: translateX(-50%) translateY(90px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
@media (max-width: 420px) {
  .apkd-pill { bottom: 14px; font-size: .74rem; padding: 10px 15px; }
}

/* ===== حركات ===== */
@keyframes apkdShimmer { 0% { background-position: 0% 0; } 100% { background-position: -200% 0; } }
@keyframes apkdPop { 0% { transform: scale(0); } 80% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes apkdFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

@media (max-width: 420px) {
  .apkd-card { padding: 26px 18px 20px; border-radius: 22px; }
  .apkd-logo-wrap { width: 100px; height: 100px; }
  .apkd-percent { font-size: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .apkd-card, .apkd-overlay, .apkd-bar-fill, .apkd-logo img { transition: none !important; animation: none !important; }
}

/* ============================================================================
   v4 — لوحة إرشادات التثبيت المصورة (بعد بدء التحميل على أندرويد)
   3 خطوات بمحاكاة CSS حية: إشعار تقدّم كروم ← إشعار الاكتمال بنبضة نقر ←
   نافذة المثبِّت، ثم تنبيه أن إذن «المصادر غير المعروفة» يُحفظ مرة واحدة.
   ========================================================================== */

.apkd-card::-webkit-scrollbar-track { background: transparent; }
.apkd-card::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 99px; }

/* ===== الحاوية ===== */
.apkd-guide {
  margin-top: 18px;
  text-align: start;
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  overflow: hidden;
}

/* ===== رأس اللوحة (زر طي/فتح) ===== */
.apkd-guide-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: #f1f5f9;
  text-align: start;
}
.apkd-guide-head:focus-visible {
  outline: 2px solid rgba(245, 158, 11, 0.6);
  outline-offset: -2px;
}
.apkd-guide-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: .85rem;
  font-weight: 800;
}
.apkd-guide-title i { color: #f59e0b; font-size: .82rem; }
.apkd-guide-badge {
  flex: none;
  font-size: .64rem;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}
.apkd-guide-caret {
  flex: none;
  width: 9px;
  height: 9px;
  border-top: 2.5px solid #94a3b8;
  border-right: 2.5px solid #94a3b8;
  transform: rotate(135deg); /* متجه للأسفل */
  transition: transform .3s ease;
  margin: 0 4px;
}
.apkd-guide.collapsed .apkd-guide-caret { transform: rotate(-45deg); }

/* ===== الطي السلس (شبكة الصفوف) ===== */
.apkd-guide-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .35s ease;
}
.apkd-guide.collapsed .apkd-guide-body { grid-template-rows: 0fr; }
.apkd-guide-content {
  overflow: hidden;
  min-height: 0;
  padding: 2px 14px 14px;
}

/* ===== الخطوات: خط زمني ===== */
.apkd-steps {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.apkd-step {
  position: relative;
  display: flex;
  gap: 12px;
  padding-block: 10px;
  animation: apkdStepIn .45s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(var(--i, 0) * .1s + .05s);
}
.apkd-step:not(:last-child)::after {
  content: '';
  position: absolute;
  inset-inline-start: 13px;
  top: 42px;
  bottom: -6px;
  width: 2px;
  background: linear-gradient(rgba(245, 158, 11, 0.45), rgba(245, 158, 11, 0.12));
}
.apkd-step-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f59e0b, #e67e22);
  color: #1a1205;
  font-weight: 800;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  position: relative;
  z-index: 1;
}
.apkd-step-body { flex: 1; min-width: 0; }
.apkd-step-title {
  font-size: .84rem;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1.6;
}
.apkd-step-desc {
  font-size: .72rem;
  color: #94a3b8;
  line-height: 1.75;
  margin-top: 6px;
}

/* ===== المحاكاة: إطار إشعار أندرويد ===== */
.apkd-mock {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  background: #0b1222;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-inline-start: 3px solid rgba(66, 133, 244, 0.7);
  border-radius: 14px;
  padding: 10px 12px;
  overflow: hidden;
}
body.light-mode .apkd-mock {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}
.apkd-mock-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.apkd-mock-txt b {
  font-size: .74rem;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apkd-mock-txt > span:not(.apkd-mock-bar) { font-size: .68rem; color: #94a3b8; }
body.light-mode .apkd-mock-txt b { color: #0f172a; }
body.light-mode .apkd-mock-txt > span:not(.apkd-mock-bar) { color: #64748b; }

/* شعار كروم مبسّط بـ CSS */
.apkd-mock-chrome {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #4285f4 0 37%, transparent 38%),
    conic-gradient(#ea4335 0 120deg, #34a853 120deg 240deg, #fbbc05 240deg 360deg);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.22);
}

/* الخطوة 1: شريط تقدّم حي */
.apkd-mock-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}
.apkd-mock-bar i {
  display: block;
  height: 100%;
  width: 45%;
  border-radius: 99px;
  background: linear-gradient(90deg, #4285f4, #34a853);
  animation: apkdMockBar 2.4s ease-in-out infinite;
}
.apkd-mock-pct {
  flex: none;
  font-size: .7rem;
  font-weight: 800;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}
body.light-mode .apkd-mock-pct { color: #475569; }

/* الخطوة 2: إشعار الاكتمال + نبضة نقر */
.apkd-mock-tap { border-inline-start-color: rgba(16, 185, 129, 0.8); }
.apkd-mock-chk {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .7rem;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.45);
}
.apkd-mock-ripple {
  position: absolute;
  inset: -1px;
  border: 2px solid rgba(16, 185, 129, 0.55);
  border-radius: 14px;
  pointer-events: none;
  animation: apkdRipple 1.9s ease-out infinite;
}
.apkd-mock-ripple.r2 { animation-delay: .95s; }

/* الخطوة 3: نافذة المثبِّت */
.apkd-mock-dialog {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  border-inline-start-color: rgba(245, 158, 11, 0.8);
}
.apkd-mock-dialog > b { font-size: .78rem; font-weight: 800; color: #e2e8f0; }
body.light-mode .apkd-mock-dialog > b { color: #0f172a; }
.apkd-mock-app {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .76rem;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.08);
  border-radius: 10px;
  padding: 7px 10px;
}
body.light-mode .apkd-mock-app { background: rgba(15, 23, 42, 0.05); color: #334155; }
.apkd-mock-applogo {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f59e0b, #e67e22);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}
.apkd-mock-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.apkd-mock-btns span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 800;
  padding: 7px 14px;
  border-radius: 99px;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
body.light-mode .apkd-mock-btns span { color: #64748b; border-color: rgba(15, 23, 42, 0.15); }
.apkd-mock-btns span.solid {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  animation: apkdBtnPulse 2.4s ease-in-out infinite;
}

/* ===== حالة الاكتمال: إبراز الخطوة 2 ===== */
.apkd-guide.done .apkd-step:nth-child(2) .apkd-step-num {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5);
}
.apkd-step-now {
  display: none;
  margin-top: 8px;
  align-items: center;
  gap: 7px;
  font-size: .74rem;
  font-weight: 800;
  color: #10b981;
}
.apkd-guide.done .apkd-step-now { display: inline-flex; }
.apkd-guide.done .apkd-mock-tap {
  border-color: rgba(16, 185, 129, 0.6);
  border-inline-start-color: rgba(16, 185, 129, 0.8);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.12);
}

/* ===== تنبيه «الإذن مرة واحدة» ===== */
.apkd-guide-note {
  margin-top: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 14px;
  padding: 10px 12px;
}
.apkd-guide-note > i {
  flex: none;
  margin-top: 3px;
  color: #fbbf24;
  font-size: .8rem;
}
.apkd-guide-note b {
  display: block;
  font-size: .76rem;
  color: #fbbf24;
  margin-bottom: 2px;
}
.apkd-guide-note span {
  display: block;
  font-size: .71rem;
  color: #cbd5e1;
  line-height: 1.7;
}
body.light-mode .apkd-guide {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.1);
}
body.light-mode .apkd-step-title { color: #0f172a; }
body.light-mode .apkd-step-desc { color: #64748b; }
body.light-mode .apkd-step:not(:last-child)::after {
  background: linear-gradient(rgba(245, 158, 11, 0.5), rgba(245, 158, 11, 0.15));
}
body.light-mode .apkd-guide-note { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.35); }
body.light-mode .apkd-guide-note b { color: #b45309; }
body.light-mode .apkd-guide-note span { color: #64748b; }

/* ===== الشريحة العائمة: إعادة فتح الدليل بعد إغلاق النافذة ===== */
.apkd-guide-chip {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: 2900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-family: 'Cairo', system-ui, sans-serif;
  font-weight: 800;
  font-size: .78rem;
  padding: 10px 16px;
  border-radius: 99px;
  cursor: pointer;
  opacity: 0;
  transition: transform .35s cubic-bezier(.34, 1.4, .5, 1), opacity .3s ease;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
}
.apkd-guide-chip.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
body.light-mode .apkd-guide-chip {
  background: #fff;
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

/* ===== حركات الدليل ===== */
@keyframes apkdStepIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes apkdMockBar {
  0% { width: 18%; }
  55% { width: 62%; }
  100% { width: 78%; }
}
@keyframes apkdRipple {
  0% { opacity: .8; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05, 1.16); }
}
@keyframes apkdBtnPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35); }
  50% { box-shadow: 0 4px 18px rgba(16, 185, 129, 0.65); }
}

@media (max-width: 420px) {
  .apkd-guide-chip { bottom: 14px; font-size: .72rem; padding: 9px 14px; }
  .apkd-guide-title { font-size: .8rem; }
  .apkd-guide-badge { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .apkd-step, .apkd-mock-bar i, .apkd-mock-ripple,
  .apkd-mock-btns span.solid, .apkd-guide-caret,
  .apkd-guide-body, .apkd-guide-chip {
    transition: none !important;
    animation: none !important;
  }
}
