/* ============================================================
   guide.css — الدليل الإرشادي التفاعلي (تجربة ملء الشاشة)
   هوية: أخضر #1D6652/#2f7b64 + ذهبي #e0a23b + رملي #edf3d7
   تخطيط الخطوة: لقطة يسار-أعلى | عمود أزرار+شرح يمين-أعلى | فوتر أسفل
   نظام تتبع بصري: .g-tracked + data-gid
   ============================================================ */

:root {
  --g-bg: #edf3d7;
  --g-bg-deep: #1d6652;
  --g-bg-soft: #f4f8eb;
  /* ═══ الإعداد الموحّد الوحيد لشفافية كل الأسطح (هيدر + فوتر + أزرار) ═══
     عدّل هذا السطر فقط — ينعكس على الجميع. (0.55 = واضح شفاف، 1 = أبيض كامل) */
  --g-surface: rgba(255, 255, 255, 0.45);
  --g-line: rgba(29, 102, 82, 0.14);
  --g-line-strong: rgba(29, 102, 82, 0.28);
  --g-text: #1a1a1a;
  --g-text-inv: #ffffff;
  --g-muted: #5a6b66;
  --g-brand: #2f7b64;
  --g-brand-deep: #1d6652;
  --g-brand-soft: #edf3d7;
  /* ═══ الإعداد الموحّد لوميض التفاعل: لون واحد بدرجة شفافية واحدة ═══ */
  --g-gold: rgba(224, 161, 59, 0.55);
  --g-gold-soft: #fde8c8;
  --g-shadow: 0 24px 60px rgba(29, 102, 82, 0.18);
  --g-shadow-soft: 0 8px 24px rgba(29, 102, 82, 0.10);
  --g-radius: 20px;
  --g-radius-sm: 14px;
  --g-safe-top: env(safe-area-inset-top, 0px);
  --g-safe-bottom: env(safe-area-inset-bottom, 0px);
  --g-side-w: 160px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "DIN Next Arabic", "Tajawal", "IBM Plex Sans Arabic", system-ui, sans-serif;
  background: var(--g-bg-deep);
  color: var(--g-text);
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── حاوية المحرك: تملأ الشاشة كاملة، لا هيدر فوقها ── */
.g-app {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(140% 90% at 25% -20%, rgba(47, 123, 100, 0.35) 0%, transparent 55%),
    radial-gradient(120% 80% at 75% 120%, rgba(224, 162, 59, 0.12) 0%, transparent 50%),
    var(--g-bg);
}

/* ============================================================
   نظام التتبع البصري (يعطّل بالإنتاج: TRACK=false)
   ============================================================ */
.g-tracked {
  position: relative;
  outline: 2px dashed rgba(224, 162, 59, 0.55) !important;
  outline-offset: 2px;
}
.g-tracked::before {
  content: attr(data-gid);
  position: absolute;
  top: -10px;
  inset-inline-start: 2px;
  z-index: 999;
  background: #e0a23b;
  color: #1a1a1a;
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  pointer-events: none;
  line-height: 1.4;
  letter-spacing: 0.3px;
}

/* ============================================================
   Landing
   ============================================================ */
.guide-landing {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.5rem;
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.guide-landing .g-hero-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.guide-landing .g-hero-mark img { width: 40px; height: 40px; }
.guide-landing .g-hero-mark strong { font-size: 1.5rem; color: var(--g-brand-deep); }
.guide-landing h1 {
  font-size: clamp(1.3rem, 5vw, 1.85rem);
  line-height: 1.3;
  color: var(--g-text);
  margin-bottom: 0.6rem;
}
.guide-landing .g-subtitle {
  font-size: 0.92rem;
  color: var(--g-muted);
  max-width: 480px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}
.g-entries {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 380px;
}
.g-entry {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: var(--g-radius);
  padding: 1.1rem 1.25rem;
  text-align: start;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--g-shadow-soft);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}
.g-entry:hover, .g-entry:active {
  transform: translateY(-1px);
  box-shadow: var(--g-shadow);
  border-color: var(--g-brand);
}
.g-entry .g-entry-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 6px;
  background: var(--g-brand-soft);
  color: var(--g-brand-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.g-entry .g-entry-body h2 { font-size: 1.05rem; margin-bottom: 0.2rem; color: var(--g-text); }
.g-entry .g-entry-body p { font-size: 0.82rem; color: var(--g-muted); line-height: 1.4; }

/* مبدّل اللغة (بعد النقل داخل الواجهة) */
.g-lang-switcher { position: relative; display: inline-flex; }
.g-lang-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--g-surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231d6652' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 10px 6px;
  background-position: left 0.6rem center;
  border: 1px solid var(--g-line-strong);
  color: var(--g-brand-deep);
  border-radius: 999px;
  padding: 0.3rem 1.6rem 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: start;
}
.g-lang-select:hover { border-color: var(--g-brand); }
.g-lang-select:focus-visible { outline: 2px solid var(--g-brand); outline-offset: 1px; }
.g-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--g-surface);
  border: 1px solid var(--g-line-strong);
  color: var(--g-brand-deep);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.g-lang-btn:hover { border-color: var(--g-brand); }
.g-lang-btn [data-language-current] { font-weight: 700; }
.g-lang-popup {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  background: var(--g-surface);
  color: var(--g-text);
  border-radius: var(--g-radius-sm);
  box-shadow: var(--g-shadow);
  padding: 0.85rem;
  min-width: 220px;
  z-index: 100;
  border: 1px solid var(--g-line);
}
.g-lang-popup[hidden] { display: none; }
.g-lang-popup .language-popup-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.6rem; padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--g-line);
}
.g-lang-popup .language-popup-title { font-size: 0.9rem; }
.g-lang-popup .language-current-caption { font-size: 0.72rem; color: var(--g-muted); }
.g-lang-popup .language-popup-current { color: var(--g-brand-deep); font-size: 0.85rem; }
.g-lang-popup .language-status { font-size: 0.75rem; color: var(--g-muted); margin-bottom: 0.5rem; }
.g-lang-popup .language-options { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; }
.g-lang-popup .language-option {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.55rem 0.7rem; border: none; background: none;
  border-radius: 6px; cursor: pointer; font-family: inherit;
  font-size: 0.85rem; color: var(--g-text); text-align: start; width: 100%;
}
.g-lang-popup .language-option:hover { background: var(--g-brand-soft); }
.g-lang-popup .language-option.is-active { background: var(--g-brand-soft); color: var(--g-brand-deep); font-weight: 600; }
.g-lang-popup .language-code { font-size: 0.7rem; opacity: 0.5; }

/* ============================================================
   Paths list
   ============================================================ */
.g-paths-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
}
.g-paths-head { flex-shrink: 0; text-align: center; margin-bottom: 0.85rem; }
.g-paths-head h2 { font-size: 1.2rem; color: var(--g-brand-deep); margin-bottom: 0.2rem; }
.g-paths-head p { color: var(--g-muted); font-size: 0.82rem; }
.g-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--g-brand-deep);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}
.g-paths-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}
.g-paths-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}
.g-path-card {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: var(--g-radius-sm);
  padding: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--g-shadow-soft);
  display: block;
  text-decoration: none;
  color: inherit;
}
.g-path-card:hover, .g-path-card:active {
  transform: translateY(-1px);
  box-shadow: var(--g-shadow);
  border-color: var(--g-brand);
}
.g-path-card .g-path-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--g-brand-deep);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.g-path-card h3 { font-size: 0.9rem; color: var(--g-text); margin-bottom: 0.15rem; line-height: 1.3; }
.g-path-card .g-path-sub { font-size: 0.72rem; color: var(--g-muted); line-height: 1.35; }

/* ============================================================
   Step view — لقطة يسار-أعلى | عمود أزرار+شرح يمين-أعلى
   ============================================================ */
.g-step-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(0.5rem + var(--g-safe-top)) 0 0;   /* فراغ أفقي = 0: القراءة تبدأ من حافة الإطار يميناً ويساراً (قرار 2026-09-29) */
}

/* منطقة العمل: flex-direction: row مع direction ltr داخلها دائماً
   (اللقطة تُثبَّت يساراً فيزيائياً في كل اللغات) */
.g-work {
  flex: 1;
  min-height: 0;
  display: flex;
  direction: ltr;           /* فيزيائي: اللقطة أول عنصر = أقصى اليسار */
  gap: 0;                   /* فراغ 0 بين الإطار وعمود القراءة (قرار 2026-09-29) */
  align-items: stretch;
  position: relative;       /* مرجع لطبقة التعليقات العائمة g-tt-layer */
}
.g-narr-text, .g-narration { direction: inherit; }
/* عمود القراءة: اتجاهه بحسب اللغة ( rtl للعربي) — لا يرث ltr الفيزيائي من g-work
   (إصلاح: النصوص العربية كانت تُرسم LTR) */
.g-app[dir="rtl"] .g-side { direction: rtl; }
.g-app[dir="ltr"] .g-side { direction: ltr; }
/* لافتة hotspot فوق اللقطة: اتجاهها بحسب اللغة (داخل g-work ltr الفيزيائي) */
.g-app[dir="rtl"] .g-hotspot .g-hotspot-label,
.g-app[dir="rtl"] .g-tt-layer .tooltip-content,
.g-app[dir="rtl"] .g-phone-screen .guide-tooltip-box .tooltip-content { direction: rtl; unicode-bidi: isolate; }

/* منطقة اللقطة (أقصى اليسار، تملأ) */
.g-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;   /* اللقطة ملتصقة باليسار-أعلى */
  position: relative;
  /* ? حاوية بقياس ثابت من التخطيط: يقيس الإطار عرضه منها (cqw/cqh) ليحافظ على نسبة اللقطة */
  container-type: size;
}
.g-phone-frame {
  position: relative;
  --g-phone-max: 280px;
  --g-phone-pad: 5px;
  /* ? العرض = الأصغر بين: الحد الأقصى، عرض المنطقة، والعرض الذي يجعل الارتفاع يتسع للّقطة كاملة
     — فيبقى الإطار بنسبة لقطة الآيفون (1242×2688) ولا تُقصّ الصورة يميناً ويساراً */
  width: 100%;
  width: min(var(--g-phone-max), 100cqw, (100cqh - 2 * var(--g-phone-pad)) * 1242 / 2688 + 2 * var(--g-phone-pad));
  height: auto;
  background: #0a0a0a;
  border-radius: 28px;
  padding: var(--g-phone-pad);
  box-shadow: var(--g-shadow), 0 0 0 1px rgba(255,255,255,0.05);
}
.g-phone-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 1242 / 2688;   /* نسبة اللقطات نفسها — الإحداثيات % تطابق الصورة تماماً */
  border-radius: 23px;   /* داخلي = خارجي (28) − حشو الإطار (5) — يخفي زوايا الصورة خلف الكيرف */
  overflow: hidden;
  background: #fff;
}
.g-phone-screen img.g-screen-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}
.g-phone-frame::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 15%;
  height: 16px;
  background: #0a0a0a;
  border-radius: 0 0 12px 12px;
  z-index: 5;
}

/* عمود اليمين: [لغة + شعار عودة] ثم الشرح */
.g-side {
  flex-shrink: 0;
  width: var(--g-side-w);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-items: stretch;
}

/* السطر الأول: مبدّل اللغة + زر الشعار (زرين لكل سطر) */
.g-side-firstrow {
  flex-shrink: 0;
  display: flex;
  gap: 0.3rem;
  align-items: stretch;
}
.g-side-firstrow > .g-lang-switcher { flex: 1; min-width: 0; }
.g-side-firstrow > .g-lang-switcher .g-lang-btn { width: 100%; justify-content: center; }
.g-home-btn {
  flex-shrink: 0;
  width: 40px;
  padding: 0.2rem;
  border-radius: 6px;
  border: 1px solid var(--g-line-strong);
  background: var(--g-brand-soft);
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  overflow: hidden;
}
.g-home-btn .g-home-logo {
  width: 100%;
  height: auto;
  display: block;
}
.g-home-btn:hover { background: var(--g-gold-soft); border-color: var(--g-gold); }

/* صندوق الشرح (تحت الأزرار — قد يظهر جزء منه فوق اللقطة) */
.g-narration {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: var(--g-radius-sm);
  padding: 0.6rem 0.7rem;
  box-shadow: var(--g-shadow-soft);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-shrink: 0;
  width: 100%;              /* يملأ العمود كاملاً — النص يبدأ من حافة الإطار (فراغ 0) */
}
.g-narration .g-narr-text { flex: 1; min-width: 0; }
.g-narration .g-step-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--g-brand-deep);
  margin-bottom: 0.15rem;
  line-height: 1.3;
}
.g-narration p {
  font-size: 0.74rem;
  color: var(--g-text);
  line-height: 1.5;
}
.g-audio-btn {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--g-line-strong);
  background: var(--g-brand-soft);
  color: var(--g-brand-deep);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: background 0.15s;
}
.g-audio-btn:hover { background: var(--g-brand); color: #fff; }
.g-audio-btn.playing { background: var(--g-brand); color: #fff; }

/* مبدّل اللغة داخل العمود */
.g-lang-switcher { align-self: stretch; }
.g-lang-switcher .g-lang-btn { width: 100%; justify-content: center; }

/* ── طبقة التعليقات العائمة: تغطي منطقة العمل كاملة (خارج إطار اللقطة) ── */
.g-tt-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

/* ── صندوق تعليق عائم (tooltip) — نصف شفاف يُظهر ما تحته بوضوح ── */
.g-tt-layer .guide-tooltip-box {
  position: absolute;
  max-width: 46%;
  background: rgba(255, 255, 255, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(224, 162, 59, 0.45);
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  box-shadow: var(--g-shadow-soft);
  pointer-events: none;
}
.g-tt-layer .tooltip-content {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--g-text);
  text-align: start;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
.g-tt-layer .tooltip-content strong { color: var(--g-brand-deep); }

/* خط المؤشر SVG (ذهبي شفاف، متقطع) */
.g-tt-line-svg { pointer-events: none; }

/* tooltip مُخفى مبدئياً — يظهر عند نقر hotspot مرتبط ويختفي بعد 5 ثوانٍ */
.g-tt-layer .guide-tooltip-box.g-tt-hidden { display: none; }

/* أثناء الصورة المؤقتة (tempImage): تُخفى نقاط الإطار القديم وتعليقاته وخطوطه
   فلا تطفو فوق الشاشة الجديدة — يبقى فقط التعليق المكشوف لهذا النقر (g-tt-keep) */
.g-phone-screen.g-temp-active .g-hotspot { display: none; }
.g-work.g-temp-active .g-tt-line-svg { display: none; }
.g-work.g-temp-active .g-tt-layer .guide-tooltip-box:not(.g-tt-keep) { display: none; }

/* ── صندوق تعليق عائم (tooltip) — يطفو فوق اللقطة حسب موضع JSON ── */
.guide-tooltip-box {
  position: absolute;
  z-index: 12;
  max-width: 82%;
  background: rgba(255, 255, 255, 0.45);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(29, 102, 82, 0.35);
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
  box-shadow: var(--g-shadow-soft);
  pointer-events: none;
  transform: translate(0, 0);   /* موضع حر من JSON (x/y نسب) */
}
.guide-tooltip-box .tooltip-content {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--g-text);
  text-align: start;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
.guide-tooltip-box .tooltip-content strong { color: var(--g-brand-deep); }

/* ── Hotspots ── */
.g-hotspot {
  position: absolute;
  z-index: 10;
  cursor: pointer;
  border: none;
  background: var(--g-gold);
  border-radius: 50%;
  width: 16px; height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(224, 161, 59, 0.09), 0 1px 5px rgba(0,0,0,0.12);
  transition: transform 0.15s;
}
.g-hotspot:hover, .g-hotspot:active { transform: translate(-50%, -50%) scale(1.15); }
.g-hotspot:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.g-hotspot::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1.5px solid rgba(224, 161, 59, 0.155);   /* ألطف — شفافية زادت 20%+ عن 0.56 */
  animation: g-pulse 1.8s ease-out infinite;
}
@keyframes g-pulse {
  0% { transform: scale(1); opacity: 0.35; }
  100% { transform: scale(2.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .g-hotspot::after { animation: none; opacity: 0; } }
.g-hotspot .g-hotspot-label {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--g-brand-deep);
  color: #fff;
  padding: 0.3rem 0.5rem;
  border-radius: 7px;
  font-size: 0.68rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.g-hotspot:hover .g-hotspot-label,
.g-hotspot:active .g-hotspot-label { opacity: 1; }

/* ── Clip overlay ── */
.g-clip {
  position: absolute;
  z-index: 8;
  border-radius: 6px;
  overflow: hidden;
  transform: translate(-50%, -50%);
  box-shadow: var(--g-shadow-soft);
  background: #000;
}
.g-clip video, .g-clip img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ── Placeholder ── */
.g-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #edf3d7, #f4f8eb);
  color: var(--g-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem;
}
.g-placeholder .g-ph-icon { font-size: 2rem; opacity: 0.5; }
.g-placeholder .g-ph-name { font-size: 0.65rem; opacity: 0.55; direction: ltr; word-break: break-all; }

/* ============================================================
   الفوتر: مسارات مقترحة (صف منفصل) + أزرار (سطر واحد)
   ============================================================ */
/* ============================================================
   Modern Footer & Navigation UI
   ============================================================ */

.g-footer {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
  padding-bottom: calc(0.5rem + var(--g-safe-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  /* خلفية زجاجية مع ضبابية — نفس شفافية الهيدر (المستخدم يعاين بالمتغيّر) */
  background: var(--g-surface);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid var(--g-line, rgba(0, 0, 0, 0.08));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03);
  user-select: none;
}

/* ── الروابط السريعة (Crosslinks) ── */
.g-crosslinks { flex-shrink: 0; }
.g-crosslinks:empty { display: none; }

.g-xlink-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 2px 4px 2px;
}
.g-xlink-row::-webkit-scrollbar { display: none; }

.g-xlink {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 99px; /* شكل كبسولة عصري */
  background: var(--g-surface);
  color: var(--g-brand-deep, #1d6652);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--g-line, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}
.g-xlink:hover {
  border-color: var(--g-brand, #258d71);
  background: var(--g-brand-soft, #edf7f4);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}
.g-xlink:active {
  transform: scale(0.96);
}

/* ── صف عناصر التحكم والأزرار ── */
.g-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.g-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--g-line-strong, #cbd5e1);
  background: var(--g-surface);
  color: var(--g-text, #0f172a);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  min-width: 76px;
  -webkit-tap-highlight-color: transparent;
}

.g-ctrl-btn:hover:not(:disabled) {
  border-color: var(--g-brand, #258d71);
  color: var(--g-brand, #258d71);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.g-ctrl-btn:active:not(:disabled) {
  transform: scale(0.95);
  box-shadow: none;
}

.g-ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
  box-shadow: none;
}

/* زر العمل الأساسي (Primary) */
.g-ctrl-btn.primary {
  background: var(--g-brand-deep, #1d6652);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(29, 102, 82, 0.25);
}

.g-ctrl-btn.primary:hover:not(:disabled) {
  background: var(--g-brand, #258d71);
  color: #ffffff;
  box-shadow: 0 5px 15px rgba(29, 102, 82, 0.35);
}

/* ── شريط التقدّم بالتصميم العصري (Step Progress) ── */
.g-step-progress {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.5rem;
  border: 1px solid var(--g-line, #e2e8f0);
  border-radius: 6px;
  background: var(--g-surface);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.g-step-progress .g-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px; /* يتحول لمستطيل دائم الانحناء عند التفعيل */
  background: rgba(29, 102, 82, 0.18);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  font-size: 0;
  line-height: 0;
}

.g-step-progress .g-dot:hover {
  transform: scale(1.6);
  background: rgba(29, 102, 82, 0.45);
}
.g-step-progress .g-dot.active:hover,
.g-step-progress .g-dot.done:hover {
  transform: none;
}

/* النقطة النشطة تتوسع أفقياً لتصبح كبسولة متفاعلة */
.g-step-progress .g-dot.active {
  background: var(--g-gold, #d97706);
  width: 18px;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.g-step-progress .g-dot.done {
  background: var(--g-brand, #258d71);
}

/* ── ترقيم الصفحات في الفوتر (موضوع·صفحة) — بلا رفع ارتفاع ── */
.g-step-progress .g-page-no {
  margin-inline-start: auto;
  padding-inline-start: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--g-brand, #258d71);
  white-space: nowrap;
  direction: ltr;
}

.g-step-progress .g-page-no::before {
  content: '';
}

/* ── حالة التحميل والخطأ (Loading & Error) ── */
.g-loading {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--g-text-muted, rgba(255, 255, 255, 0.85));
  font-size: 0.9rem;
  font-weight: 500;
  gap: 0.75rem;
}

.g-loading::after {
  content: '';
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--g-gold, #f59e0b);
  border-radius: 50%;
  animation: g-spin 0.75s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

@keyframes g-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .g-loading::after { animation: none; }
}

.g-error {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.88rem;
  font-weight: 500;
}

/* ============================================================
   Responsive (استجابة الشاشات)
   ============================================================ */

@media (min-width: 760px) {
  .g-step-view, .guide-landing, .g-paths-view {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
  }
  .g-side { width: 200px; }
  .g-phone-frame { --g-phone-max: 260px; }
  .g-narration p { font-size: 0.82rem; }
}

@media (min-width: 600px) and (max-width: 759px) {
  .g-side { width: 170px; }
  .g-phone-frame { --g-phone-max: 240px; }
}

/* الشاشات الصغيرة والجوالات */
@media (max-width: 599px) {
  :root { --g-side-w: 118px; }
  .g-footer { padding: 0.4rem 0.5rem; }
  .g-step-view { padding: calc(0.35rem + var(--g-safe-top, 0px)) 0.35rem 0; }
  .g-phone-frame { --g-phone-max: 100cqw; }
  .g-narration { padding: 0.5rem 0.55rem; }
  .g-narration p { font-size: 0.7rem; line-height: 1.4; }
  .g-narration .g-step-title { font-size: 0.75rem; }
  .g-audio-btn { width: 28px; height: 28px; font-size: 0.75rem; }
  
  .g-controls { gap: 0.35rem; }
  .g-ctrl-btn {
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
    min-width: 58px;
    border-radius: 6px;
  }
  
  .g-step-progress {
    padding: 0.4rem 0.25rem;
    gap: 4px;
    border-radius: 6px;
  }
  .g-step-progress .g-dot {
    width: 5px;
    height: 5px;
  }
  .g-step-progress .g-dot.active {
    width: 12px;
  }
  .g-step-progress .g-page-no {
    font-size: 0.62rem;
    padding-inline-start: 5px;
  }
}

@media (max-height: 600px) and (min-width: 600px) {
  .g-side { width: 160px; }
  .g-phone-frame { --g-phone-max: 200px; }
  .g-narration p { font-size: 0.75rem; }
}

.g-app .language-toggle svg { display: block; }
/* ============================================================
   الواجهة — شاشة واحدة بلا تمرير: ترحيب مضغوط، صفّ مسارات فوق الهاتف
   وصفّ تحته، وخطوط من تبويبات الهاتف إلى مساراتها
   ============================================================ */
.guide-home {
  --g-tab-sahifati: #2f7b64;
  --g-tab-supervision: #d8952a;
  --g-tab-profile: #4f78a3;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.4rem, 1.6vh, 0.9rem);
  padding: calc(0.6rem + var(--g-safe-top)) 16px calc(0.5rem + var(--g-safe-bottom));
  overflow: hidden;
}

.g-home-intro {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
}
.g-home-brand { display: flex; align-items: center; gap: 0.45rem; }
.g-home-mark { width: 30px; height: 30px; }
.g-home-intro h1 {
  font-size: clamp(1.3rem, 4.6vw, 1.9rem);
  line-height: 1.2;
  color: var(--g-brand-deep);
}
.g-home-tagline {
  font-size: clamp(0.82rem, 2.3vw, 0.98rem);
  color: var(--g-muted);
  line-height: 1.5;
}
.g-home-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
}
.g-home-cta {
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.42rem 1.15rem;
  border-radius: 999px;
  border: 1.5px solid var(--g-brand-deep);
  background: var(--g-brand-deep);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.g-home-cta:hover { transform: translateY(-1px); box-shadow: var(--g-shadow-soft); }
.g-home-cta.is-ghost { background: transparent; color: var(--g-brand-deep); }
.g-home-cta.is-ghost:hover { background: var(--g-surface); }
.g-home-cta:focus-visible, .g-home-path:focus-visible, .g-home-link:focus-visible {
  outline: 2px solid var(--g-brand);
  outline-offset: 3px;
}

/* ── المسرح يأخذ كل ما بقي من الارتفاع: صفّ · هاتف · صفّ ── */
.g-home-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  gap: clamp(0.7rem, 2.6vh, 1.6rem);
}
.g-home-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  /* ? فوق الهاتف (يبدأ الخط من زرّ التبويب ظاهراً) وتحت الأزرار */
  z-index: 2;
}
.g-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 6 6;
  opacity: 0.8;
  animation: g-line-flow 1.6s linear infinite;
}
.g-line.is-sahifati { stroke: var(--g-tab-sahifati); }
.g-line.is-supervision { stroke: var(--g-tab-supervision); }
.g-line.is-profile { stroke: var(--g-tab-profile); }
.g-line-dot { stroke: #fff; stroke-width: 2.5; }
.g-line-dot.is-sahifati { fill: var(--g-tab-sahifati); }
.g-line-dot.is-supervision { fill: var(--g-tab-supervision); }
.g-line-dot.is-profile { fill: var(--g-tab-profile); }
@keyframes g-line-flow { to { stroke-dashoffset: -24; } }
@media (prefers-reduced-motion: reduce) { .g-line { animation: none; } }

.g-home-phone {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  pointer-events: none;
}
.g-home-phone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 24px 32px rgba(29, 102, 82, 0.18));
}

/* صفّ أفقي واحد بعرض الهاتف المرسوم، يبدأ من اليمين (جهة التبويبات) */
.g-home-row {
  position: relative;
  z-index: 3;
  width: min(100%, var(--g-phone-w, 100%));
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
}
.g-home-path {
  font: inherit;
  flex: 0 1 auto;
  min-width: 0;
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.45rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--g-line);
  border-top: 3px solid var(--g-tab, var(--g-brand));
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}
.g-home-row.is-bottom .g-home-path { border-top-width: 1px; border-bottom: 3px solid var(--g-tab, var(--g-brand)); }
.g-home-path.is-sahifati { --g-tab: var(--g-tab-sahifati); }
.g-home-path.is-supervision { --g-tab: var(--g-tab-supervision); }
.g-home-path.is-profile { --g-tab: var(--g-tab-profile); }
.g-home-path:hover { transform: translateY(-2px); box-shadow: var(--g-shadow-soft); }
.g-home-path strong { font-size: 0.92rem; color: var(--g-text); white-space: nowrap; }
.g-home-path span { font-size: 0.72rem; color: var(--g-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-home-path.is-done strong::after { content: ' ✓'; color: var(--g-tab); }

.g-home-foot {
  flex-shrink: 0;
  display: flex;
  gap: 1.1rem;
  justify-content: center;
}
.g-home-link {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--g-brand-deep);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--g-line-strong);
}
.g-home-link:hover { text-decoration-color: var(--g-brand); }

/* ── الشاشات الضيقة: الأزرار تتقاسم العرض، والوصف الصغير يُخفى ── */
@media (max-width: 600px) {
  .g-home-row { width: 100%; gap: 0.35rem; }
  .g-home-path { flex: 1 1 0; padding: 0.4rem 0.5rem; text-align: center; align-items: center; }
  .g-home-path strong { font-size: 0.8rem; white-space: normal; line-height: 1.25; }
  .g-home-path span { display: none; }
  .g-home-row.is-top { padding-inline-end: 34%; }
}

/* ============================================================
   وحدات FAQ — صندوق المحطة + الخاتمة الإجبارية + محطة FAQ
   (accordion: details/summary — الإجابة عند اختيار السؤال)
   ============================================================ */
.g-faq-box {
  margin-top: 0.8rem;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  width: 100%;
}
.g-fb-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--g-brand-deep);
  margin-bottom: 0.45rem;
}
/* سؤال واحد مباشرة في القائمة — بلا إطارات: فاصل عرضي بين الأسئلة فقط */
.g-faq-item {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  background: transparent;
  border-bottom: 1px solid var(--g-line);
  overflow: visible;
}
/* الفاصل بين الأسئلة — آخر سؤال بلا فاصل سُفلي */
.g-faq-item:last-child { border-bottom: none; }
.g-faq-item summary {
  list-style: none;
  cursor: pointer;
  display: inline;              /* السؤال نص متصل: المثلث يلتصق بآخر كلمة */
  padding: 0.55rem 0;
  /* حجم موحّد مع الشرح (g-narration p = 0.74rem) — السؤال بولد */
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--g-text);
  -webkit-tap-highlight-color: transparent;
}
.g-faq-item summary .g-fq { display: inline; }
.g-faq-item summary::-webkit-details-marker { display: none; }
/* المثلث: مباشرة بعد آخر كلمة، بلا حجز فراغ */
.g-faq-item summary .chev {
  display: inline-block;
  transition: transform 0.18s;
  color: var(--g-muted);
  font-size: 0.7rem;
  width: auto;
  margin-inline-start: 0.3rem;
  vertical-align: baseline;
}
/* الإجابة: منبثقة أسفل السؤال، بحافة سؤاله نفسه (فراغ 0 يميناً ويساراً) */
.g-faq-item[open] summary .chev { transform: rotate(180deg); }
.g-faq-item .g-fa {
  padding: 0.15rem 0 0.55rem;
  /* نفس حجم خط الشرح — الإجابة لايت */
  font-size: 0.74rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--g-text-muted, var(--g-muted, rgba(60,60,60,0.75)));
  white-space: pre-line;
}
.g-faq-jump {
  display: inline-flex;
  margin-top: 0.45rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--g-brand);
  background: var(--g-brand-soft);
  color: var(--g-brand-deep);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.g-faq-jump:hover { background: var(--g-brand); color: #fff; }

/* خاتمة المسار الإجبارية */
.g-faq-closure {
  padding: 1.1rem 1rem calc(1rem + var(--g-safe-bottom, 0px));
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
.g-fc-head { text-align: center; margin-bottom: 0.85rem; }
.g-fc-head h2 { font-size: 1.1rem; color: var(--g-brand-deep); margin-bottom: 0.2rem; }
.g-fc-head p { font-size: 0.8rem; color: var(--g-muted); }
.g-faq-after {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}
.g-faq-other {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: none;
  background: var(--g-brand-deep);
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.g-faq-lib {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--g-line-strong);
  color: var(--g-brand-deep);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

/* محطة FAQ داخل الرحلة + بحث */
.g-faq-station {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(0.6rem + var(--g-safe-top)) 1rem 0.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.g-fs-head { flex-shrink: 0; text-align: center; margin-bottom: 0.7rem; }
.g-fs-head h2 { font-size: 1.1rem; color: var(--g-brand-deep); margin-bottom: 0.2rem; }
.g-fs-head p { font-size: 0.78rem; color: var(--g-muted); }
.g-faq-list { max-width: 640px; width: 100%; margin: 0 auto; }
.g-faq-search {
  width: 100%;
  max-width: 480px;
  margin: 0.8rem auto 0.4rem;
  display: block;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--g-line-strong);
  background: var(--g-surface);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--g-text);
  outline: none;
}
.g-faq-search:focus { border-color: var(--g-brand); }
.g-faq-search-results { max-width: 640px; width: 100%; margin: 0.4rem auto; }
.g-faq-none { font-size: 0.78rem; color: var(--g-muted); text-align: center; padding: 0.6rem; }
