/* ==========================================================================
   رسائل حوارية لغير المسلمين — التنسيقات
   البنية: 1) المتغيرات  2) الأساسيات  3) شريط التقدّم  4) صفحة البداية
           5) البطاقة  6) التنقّل  7) الشريط السفلي  8) القوائم والنوافذ
           9) التوجيهات  10) الوضع الداكن  11) التجاوب
   ========================================================================== */

/* 1) المتغيرات ----------------------------------------------------------- */
:root {
  --gold: #b99d59;
  --gold-hover: #c9ad66;
  --gold-ink: #8a6d2f;
  --gold-soft: rgba(185, 157, 89, .35);
  --gold-faint: rgba(185, 157, 89, .15);

  --navy: #1d2531;
  --navy-2: #222c3a;
  --navy-3: #243040;
  --navy-deep: #161d27;
  --navy-btn: #2b3341;

  --page: #efe8d8;
  --page-mobile: #e9e1cf;
  --card: #fdfbf5;
  --chrome: #f7f4ee;
  --paper: #fffdf8;
  --foot: #f9f5ec;

  --line: #e3dac6;
  --line-2: #ddd5c3;
  --line-3: #e7dfd0;
  --line-4: #cdc3ac;
  --line-5: #ece5d6;

  --ink: #1d2531;
  --text: #2b3240;
  --muted: #7d8494;
  --muted-2: #8c93a1;
  --muted-3: #5a5142;
  --muted-4: #9a8f78;
  --muted-5: #a9a294;
  --muted-6: #4a5162;

  --quran: #2f6b4a;
  --ref: #7d8494;
  --ok: #7fb069;
  --ok-bg: #e8f3e4;

  --font-ui: 'Thmanyah Sans', sans-serif;
  --font-display: 'Thmanyah Serif Display', 'Amiri', serif;
  --font-quran: 'Amiri', serif;
  --font-num: 'Noto Naskh Arabic', serif;

  --chrome-top: 48px;
  --chrome-bottom: 72px;
  --radius-card: 22px;
  --shadow-card: 0 12px 36px rgba(60, 50, 30, .12);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* 2) الأساسيات ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body.is-loading > :not(.intro) { visibility: hidden; }

a { color: var(--gold-ink); }
a:hover { color: #6e5624; }

button, input, textarea { font-family: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon-btn {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line-4); background: var(--chrome);
  transition: border-color .2s, background .2s, transform .18s;
}
.icon-btn svg { stroke: var(--gold-ink); }
.icon-btn:hover { border-color: var(--gold); }
.icon-btn.is-ok { background: var(--ok-bg); border-color: var(--ok); }

.chev {
  display: inline-block; width: 6px; height: 6px; flex: none;
  border-right: 1.5px solid var(--gold); border-bottom: 1.5px solid var(--gold);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s;
}
.is-open > .chev, .is-open .chev { transform: rotate(-135deg) translate(-2px, -2px); }

/* تلميحات الأزرار */
.tip { position: relative; }
.tip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--navy); color: var(--chrome);
  font: 12px/1.4 var(--font-ui); padding: 5px 10px; border-radius: 6px;
  white-space: nowrap; direction: rtl; unicode-bidi: plaintext;
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 5;
}
.tip:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.tip--start::after { left: 0; transform: translateX(0) translateY(4px); }
.tip--start:hover::after { transform: translateX(0) translateY(0); }
.tip--side::after { bottom: auto; top: 50%; left: calc(100% + 10px); transform: translateY(-50%) translateX(-4px); }
.tip--side:hover::after { transform: translateY(-50%) translateX(0); }
.tip--left::after { bottom: auto; top: 50%; left: auto; right: calc(100% + 10px); transform: translateY(-50%) translateX(4px); }
.tip--left:hover::after { transform: translateY(-50%) translateX(0); }
@media (hover: none) { .tip::after { display: none; } }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes swipe-l { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-22px); } }
@keyframes swipe-r { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(22px); } }

/* 3) شريط التقدّم ---------------------------------------------------------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  padding: 10px 20px; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.progress__segs {
  display: flex; gap: 4px; max-width: 720px; width: 100%; margin: 0 auto;
  pointer-events: auto;
}
.progress__segs button {
  flex: 1; height: 9px; border: none; border-radius: 5px; padding: 0;
  background: #cfc3a6; transition: background .2s;
}
.progress__segs button[aria-current="true"] { background: var(--gold); }
.progress__count {
  display: flex; justify-content: center; margin-top: 8px; user-select: none;
  font: 700 22px/1 var(--font-num); color: var(--gold); letter-spacing: 1px; direction: rtl;
}

/* 4) صفحة البداية ---------------------------------------------------------- */
.intro {
  position: fixed; inset: 0; z-index: 30;
  background: var(--navy); color: var(--chrome);
  display: flex; flex-direction: column; justify-content: safe center; align-items: center;
  padding: 64px 24px 14px; text-align: center;
  overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
}
.intro::-webkit-scrollbar { display: none; }
.intro > * { flex-shrink: 0; }

.ibar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: 80px;
  padding: 16px 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: rgba(29, 37, 49, .85); backdrop-filter: blur(8px);
}
.ibar__group { display: flex; align-items: center; gap: 16px; }
.ibar__logo { height: 52px; width: auto; filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.ibar__sep { width: 1px; height: 36px; background: var(--gold-soft); }
.ibar__qr {
  width: 40px; height: 40px; flex: none; display: block;
  background: var(--chrome); border-radius: 6px; object-fit: contain; cursor: pointer; opacity: .9;
}
.ibar__qr:hover { opacity: 1; }
.ibar__guide {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 15px; color: var(--gold); text-decoration: underline; text-underline-offset: 4px; white-space: nowrap;
}
.ibar__right { display: flex; align-items: center; gap: 10px; }
.ibar__burger {
  display: none; width: 40px; height: 40px; padding: 0; flex: none;
  border-radius: 50%; border: 1px solid rgba(185, 157, 89, .4); background: transparent;
  align-items: center; justify-content: center;
}
.ibar__burger svg { stroke: #d9c189; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(185, 157, 89, .4); background: transparent; color: #c9c0ae;
  border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 700; white-space: nowrap;
}
.pill--gold { border: none; background: var(--gold); color: var(--navy); padding: 8px 18px; transition: background .2s; }
.pill--gold:hover { background: var(--gold-hover); }
.mode-btn {
  width: 36px; height: 36px; padding: 0; flex: none; font-size: 16px;
  border-radius: 50%; border: 1px solid rgba(185, 157, 89, .4); background: transparent; color: #d9c189;
  display: inline-flex; align-items: center; justify-content: center; transition: background .2s;
}
.mode-btn:hover { background: var(--gold-faint); }

.intro__basm { font-family: var(--font-display); font-size: clamp(18px, 2.5vw, 24px); color: var(--gold); margin-bottom: clamp(20px, 4vh, 36px); }
.intro__title { font-family: var(--font-display); font-size: clamp(28px, 4.5vw, 52px); color: var(--chrome); margin: 0 0 clamp(16px, 3vh, 28px); line-height: 1.25; }
.intro__desc { font-size: clamp(15px, 1.6vw, 16px); color: var(--muted-5); line-height: 1.8; margin: 0 0 clamp(36px, 8vh, 80px); max-width: 520px; }
.intro__guide-m { display: none; margin-top: 26px; font-size: 15px; color: var(--gold); text-decoration: underline; text-underline-offset: 5px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; width: 100%; max-width: 960px; text-align: right; }
.step {
  position: relative; border: 1px solid var(--gold-soft); border-radius: 16px; padding: 22px 24px;
  display: flex; flex-direction: column; gap: 14px; background: rgba(255, 255, 255, .03);
  transition: border-color .3s, box-shadow .3s;
}
.step__label { display: flex; gap: 10px; align-items: center; color: var(--muted-2); font-size: 13px; }
.step__num {
  width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-weight: 700; transition: background .3s, color .3s;
}
.step--start {
  border: none; background: var(--gold); text-align: right; transition: background .2s;
}
.step--start:hover { background: var(--gold-hover); }
.step--start .step__label { color: var(--navy); opacity: .8; }
.step--start .step__num { border-color: var(--navy); color: var(--navy); }
.step__cta { color: var(--navy); font-size: 20px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.select-btn {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid rgba(185, 157, 89, .45); border-radius: 999px; padding: 10px 16px;
  background: transparent; color: var(--chrome); font-size: 16px; font-weight: 700; transition: border-color .2s;
}
.select-btn.is-open { border-color: var(--gold); }
.select-btn > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select-btn .chev { width: 8px; height: 8px; }

.size-group { display: flex; gap: 6px; flex-wrap: wrap; }
.size-btn {
  border: 1px solid #3a4453; background: transparent; color: #c9c0ae;
  border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 700;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.size-btn:hover { transform: translateY(-2px); border-color: var(--gold); background: rgba(185, 157, 89, .32); }
.size-btn:active { transform: translateY(0) scale(.97); }
.size-btn[aria-pressed="true"] { background: var(--navy-btn); color: var(--gold); border-color: var(--gold); }

/* القائمة المنبثقة (دين / لغة) */
.pop {
  position: absolute; z-index: 50; padding: 5px; text-align: right;
  background: var(--navy-3); border: 1px solid var(--gold-soft); border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; gap: 1px;
}
.pop--up { bottom: calc(100% + 8px); right: 0; left: 0; border-radius: 14px; z-index: 7; }
.pop--down { top: calc(100% + 8px); left: 0; width: 340px; max-width: calc(100vw - 32px); }
.pop--grid { display: grid; grid-template-columns: 1fr 1fr; }
.pop__title { font-size: 11px; color: var(--muted-4); padding: 6px 12px 2px; }
.pop__item {
  border: none; background: transparent; color: #c9c0ae; text-align: right;
  padding: 9px 12px; border-radius: 8px; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.pop__item:hover { background: var(--gold-faint); }
.pop__item[aria-selected="true"] { background: rgba(185, 157, 89, .22); color: var(--chrome); font-weight: 700; }
.pop__item .code { color: var(--muted-2); font-size: 12px; direction: ltr; }
.pop__item .check { color: var(--gold); font-size: 13px; }
.pop__item .check:empty { display: none; }

/* صفحة البداية بالوضع الفاتح */
.intro[data-theme="light"] { background: var(--chrome); color: var(--ink); }
.intro[data-theme="light"] .ibar { background: rgba(247, 244, 238, .88); border-bottom: 1px solid var(--line-5); }
.intro[data-theme="light"] .ibar__logo { filter: none; }
.intro[data-theme="light"] .ibar__sep { background: var(--line-2); }
.intro[data-theme="light"] .ibar__qr { border: 1px solid var(--line); }
.intro[data-theme="light"] .pill { border-color: var(--line-2); color: var(--muted-6); }
.intro[data-theme="light"] .pill--gold { border: none; background: var(--gold); color: var(--navy); }
.intro[data-theme="light"] .mode-btn, .intro[data-theme="light"] .ibar__burger { border-color: var(--line-2); color: var(--gold-ink); }
.intro[data-theme="light"] .ibar__burger svg { stroke: var(--gold-ink); }
.intro[data-theme="light"] .intro__title { color: var(--ink); }
.intro[data-theme="light"] .intro__desc { color: #5a6170; }
.intro[data-theme="light"] .step:not(.step--start) { background: var(--card); border-color: var(--line); }
.intro[data-theme="light"] .step__label { color: #6b7280; }
.intro[data-theme="light"] .select-btn { color: var(--ink); }
.intro[data-theme="light"] .size-btn { border-color: var(--line); color: var(--muted-3); }
.intro[data-theme="light"] .size-btn:hover { background: #ead9b3; }
.intro[data-theme="light"] .size-btn[aria-pressed="true"] { background: #f3ead6; color: var(--gold); border-color: var(--gold); }
.intro[data-theme="light"] .pop { background: var(--card); border-color: var(--line); box-shadow: 0 16px 36px rgba(29, 37, 49, .14); }
.intro[data-theme="light"] .pop__item { color: var(--muted-3); }
.intro[data-theme="light"] .pop__item[aria-selected="true"] { color: var(--ink); }
.intro[data-theme="light"] .drawer { background: var(--card); border-color: var(--line); box-shadow: -16px 0 40px rgba(0, 0, 0, .18); }
.intro[data-theme="light"] .drawer img { filter: none; }
.intro[data-theme="light"] .drawer__item { color: var(--ink); border-bottom-color: var(--line-5); }
.intro[data-theme="light"] .drawer__close { border-color: var(--line); }
.intro[data-theme="light"] .drawer svg { stroke: var(--gold-ink); }

/* 5) البطاقة --------------------------------------------------------------- */
.stage {
  height: 100dvh; overflow-y: auto; overflow-x: hidden;
  touch-action: pan-y; -webkit-overflow-scrolling: touch; cursor: grab;
  scrollbar-width: none;
}
.stage::-webkit-scrollbar { display: none; }
.stage.is-dragging { cursor: grabbing; }

.screen {
  position: relative; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: calc(var(--chrome-top) + 16px) 20px calc(var(--chrome-bottom) + 16px); background: var(--page);
}

.card {
  width: 100%; max-width: min(720px, calc(100vw - 2 * (clamp(20px, 6vw, 90px) + 72px)));
  max-height: calc(100dvh - var(--chrome-top) - var(--chrome-bottom) - 32px); min-height: 0;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid rgba(185, 157, 89, .28); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); overflow: hidden; user-select: none;
  transition: transform .5s var(--ease), opacity .5s ease;
}
.card.is-loaded { animation: fade-in 1s ease; }
.card.is-dragging { transition: none; }
.card.is-entering { animation: fade-in 1s ease; }

.card__head { flex-shrink: 0; padding: 28px 26px 0; position: relative; z-index: 2; background: var(--card); }
.card__title {
  font-family: var(--font-display); font-size: clamp(24px, 5.5vw, 34px); font-weight: 700;
  color: var(--ink); margin: 0 0 10px; text-align: center; text-wrap: balance;
}
.card__title--long { font-size: clamp(22px, 5vw, 31px); }
.card__rule { width: 56px; height: 3px; background: var(--gold); border-radius: 2px; margin: 0 auto; }
.card__fade { position: absolute; left: 0; right: 0; bottom: -30px; height: 30px; background: linear-gradient(var(--card), rgba(253, 251, 245, 0)); pointer-events: none; }

.card__scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; direction: ltr;
  padding: 16px 4px 24px 22px; margin: 0 6px 6px 0; touch-action: pan-y;
  scrollbar-width: thin; scrollbar-color: #d8cfbc transparent;
}
.card__scroll::-webkit-scrollbar { width: 4px; }
.card__scroll::-webkit-scrollbar-thumb { background: #d8cfbc; border-radius: 2px; }
.card__scroll::-webkit-scrollbar-track { background: transparent; }

.card__body { direction: rtl; padding: 0 18px 0 0; }
.card__body p { margin: 0; line-height: 2.1; color: var(--text); text-wrap: pretty; }
.card__body p + p { margin-top: 10px; }
.card__body[data-size="S"] p { font-size: clamp(18px, 4.5vw, 22px); text-align: center; }
.card__body[data-size="M"] p { font-size: 19px; }
.card__body[data-size="L"] p { font-size: 18px; }
.card__body .q { color: var(--quran); font-family: var(--font-quran); }
.card__body .ref { color: var(--ref); font-size: 15px; }

.card__foot {
  flex-shrink: 0; border-top: 1px solid rgba(60, 50, 30, .06); padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
.card__actions { display: flex; align-items: center; gap: 14px; }
.card__qr {
  width: 40px; height: 40px; display: block; border-radius: 4px; cursor: pointer;
  background: var(--chrome); border: 1px solid var(--line); object-fit: contain; opacity: .9;
}
.card__qr-wrap { display: inline-flex; line-height: 0; }

/* 6) التنقّل --------------------------------------------------------------- */
.edge {
  position: fixed; top: 0; bottom: 130px; z-index: 6; width: clamp(60px, 16vw, 220px);
  cursor: pointer; touch-action: manipulation;
}
.edge--next { left: 0; }
.edge--prev { right: 0; }

.side {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 9;
  background: transparent; border: none; padding: 8px; opacity: .9; transition: opacity .2s;
}
.side:hover { opacity: 1; }
.side--next { left: clamp(20px, 6vw, 90px); }
.side--prev { right: clamp(20px, 6vw, 90px); }
.side span {
  display: flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  border-radius: 50%; background: var(--paper); border: 1px solid var(--gold);
  box-shadow: 0 4px 14px rgba(29, 37, 49, .08); transition: transform .2s, box-shadow .2s;
}
.side:hover span { transform: scale(1.06); box-shadow: 0 6px 18px rgba(185, 157, 89, .25); }
.side svg { stroke: var(--gold); }
.side[disabled] { opacity: .35; pointer-events: none; }

.hint {
  position: fixed; inset: 0; z-index: 35; cursor: pointer;
  background: rgba(22, 29, 39, .86); backdrop-filter: blur(3px);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  animation: fade-in .3s ease;
}
.hint.is-on { display: flex; }
.hint.is-out { animation: fade-out .4s ease forwards; }
.hint__hands { display: flex; align-items: center; gap: 36px; }
.hint__hands > div:first-child { animation: swipe-r 1.4s ease-in-out infinite; }
.hint__hands > div:last-child { animation: swipe-l 1.4s ease-in-out infinite; }
.hint__hands img { width: 72px; height: auto; display: block; filter: invert(1) brightness(1.2) drop-shadow(0 6px 16px rgba(0, 0, 0, .4)); }
.hint__text { font-size: 18px; color: var(--chrome); text-align: center; line-height: 1.8; }
.hint__sub { font-size: 13px; color: var(--gold); }

/* 7) الشريط السفلي --------------------------------------------------------- */
.bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; padding: 12px;
  background: rgba(247, 244, 238, .97); border-top: 1px solid var(--line-3); backdrop-filter: blur(6px);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px;
}
.topnav {
  position: absolute; top: 0; bottom: 0; right: 24px; left: 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; pointer-events: none;
}
.topnav__group { display: flex; align-items: center; gap: 18px; pointer-events: auto; }
.topnav__group--ltr { direction: ltr; }
.topnav__sep { width: 1px; height: 28px; background: var(--line-2); }
.topnav__logo-link { display: flex; align-items: center; height: 40px; }
.topnav__logo { height: 38px; width: auto; opacity: .9; display: block; }
.topnav__tools { display: flex; align-items: center; gap: 10px; }
.topnav__tools--ltr { direction: ltr; }
.topnav__qr {
  width: 38px; height: 38px; display: block; border-radius: 4px; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); object-fit: contain; opacity: .9;
}
.topnav .icon-btn { border-color: var(--line-2); background: var(--paper); }
.icon-btn--wide { width: auto; border-radius: 999px; gap: 8px; padding: 0 9px 0 10px; }
.icon-btn--wide.is-open { border-color: var(--gold); }
.icon-btn--gold { border: none; background: var(--gold); transition: background .2s; }
.icon-btn--gold svg { stroke: var(--navy); }
.icon-btn--gold:hover { background: var(--gold-hover); }
.lang-code { font-size: 12px; font-weight: 700; color: var(--gold-ink); letter-spacing: .5px; }

.topnav .pop { bottom: calc(100% + 10px); background: var(--card); border-color: var(--line); box-shadow: 0 14px 30px rgba(60, 50, 30, .15); }
.topnav .pop--rel { right: 0; min-width: 200px; }
.topnav .pop--lang { left: 0; direction: rtl; }
.topnav .pop__item { color: var(--muted-3); font-size: 14px; padding: 8px 12px; }
.topnav .pop__item:hover { background: #f1ebdf; }
.topnav .pop__item[aria-selected="true"] { background: #f1ebdf; color: var(--ink); }
.topnav .pop__item .code { color: var(--muted-4); }

.len { order: 2; display: flex; justify-content: center; align-items: center; gap: 4px; }
.len__group {
  display: flex; align-items: center; gap: 4px; padding: 6px;
  background: rgba(255, 253, 248, .97); border: 1px solid var(--line-3); border-radius: 999px;
  box-shadow: 0 4px 14px rgba(60, 50, 30, .12);
}
.len__btn {
  border: 1px solid var(--line-3); background: transparent; color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 700; white-space: nowrap;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.len__btn:hover { transform: translateY(-2px); border-color: var(--gold); background: #ead9b3; color: var(--ink); }
.len__btn:active { transform: translateY(0) scale(.97); }
.len__btn[aria-pressed="true"] { background: #f3ead6; border-color: var(--gold); }

.bar__menu {
  display: none; position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid var(--line-4); background: var(--chrome);
  align-items: center; justify-content: center;
}
.bar__menu svg { stroke: var(--gold-ink); }
.bar__menu--mode { left: 12px; }
.bar__menu--open { right: 12px; }

/* 8) القوائم والنوافذ ------------------------------------------------------- */
.backdrop {
  position: fixed; inset: 0; z-index: 45; background: rgba(29, 37, 49, .45); backdrop-filter: blur(2px);
  animation: fade-in .2s ease;
}
.drawer {
  position: fixed; top: 0; bottom: 0; right: 0; z-index: 46; width: min(300px, 84vw);
  background: var(--card); box-shadow: -16px 0 40px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column; padding: 22px 20px; overflow-y: auto; text-align: right;
}
.drawer--intro { z-index: 56; width: min(300px, 85vw); background: var(--navy-2); border-left: 1px solid rgba(185, 157, 89, .3); box-shadow: -8px 0 30px rgba(0, 0, 0, .4); scrollbar-width: thin; scrollbar-color: rgba(185, 157, 89, .5) transparent; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.drawer__logo { height: 44px; width: auto; }
.drawer--intro .drawer__logo { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.drawer__close {
  width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.drawer__close svg { stroke: var(--gold-ink); }
.drawer--intro .drawer__close { border-color: rgba(185, 157, 89, .4); }
.drawer--intro .drawer__close svg { stroke: #d9c189; }
.drawer__item {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  border: none; background: transparent; color: var(--ink); text-decoration: none; text-align: right;
  padding: 13px 0; font-size: 16px; border-bottom: 1px solid var(--line-5);
}
.drawer--intro .drawer__item { color: var(--chrome); border-bottom-color: rgba(185, 157, 89, .18); }
.drawer__item .sub { color: var(--muted-4); font-size: 13px; }
.drawer__item .glyph { font-size: 16px; color: var(--gold); }
.drawer__item .chev { width: 7px; height: 7px; margin-inline-end: 4px; }
.drawer__sub { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; }
.drawer__sub--chips { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 10px 0; }
.drawer__sub .pop__item { color: var(--muted-3); }
.drawer__sub .pop__item[aria-selected="true"] { background: #f1ebdf; color: var(--ink); }
.drawer--intro .drawer__sub .pop__item[aria-selected="true"] { background: rgba(185, 157, 89, .22); color: var(--chrome); }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--muted-3);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap;
}
.chip[aria-selected="true"] { border-color: var(--gold); background: #f1ebdf; color: var(--ink); font-weight: 700; }
.drawer--intro .chip { border-color: var(--gold-soft); color: #c9c0ae; }
.drawer--intro .chip[aria-selected="true"] { background: rgba(185, 157, 89, .22); color: var(--chrome); }

.overlay {
  position: fixed; inset: 0; z-index: 70; padding: 20px;
  background: rgba(29, 37, 49, .6); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; animation: fade-in .2s ease;
}
.overlay--dim { background: rgba(29, 37, 49, .85); backdrop-filter: none; cursor: pointer; z-index: 60; }
.overlay--auth { background: rgba(29, 37, 49, .72); backdrop-filter: none; z-index: 80; }
.overlay--share { background: rgba(29, 37, 49, .55); backdrop-filter: blur(3px); z-index: 40; padding: 16px; }

.modal {
  width: 100%; max-width: 440px; padding: 24px; text-align: right;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.modal__head { display: flex; justify-content: space-between; align-items: center; }
.modal__title { margin: 0; font-family: var(--font-display); font-size: 22px; color: var(--ink); }
.modal__close { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: transparent; display: flex; align-items: center; justify-content: center; }
.modal__close svg { stroke: var(--gold-ink); }
.modal__meta { font-size: 13px; color: var(--muted-2); }
.modal__meta span { color: var(--gold-ink); }
.modal__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  font-size: 14px; color: var(--ink); background: var(--chrome); outline: none;
}
.field--ltr { direction: ltr; text-align: left; }
textarea.field { resize: vertical; padding: 12px 14px; font-size: 15px; line-height: 1.8; }
.modal__actions { display: flex; gap: 10px; }
.btn-gold { border: none; background: var(--gold); color: var(--navy); border-radius: 999px; padding: 10px 22px; font-size: 14px; font-weight: 700; transition: background .2s; }
.btn-gold:hover { background: var(--gold-hover); }
.btn-ghost { border: 1px solid var(--line); background: transparent; color: var(--muted-6); border-radius: 999px; padding: 10px 18px; font-size: 14px; }

.qr-box {
  background: var(--chrome); border-radius: 14px; padding: 24px; max-width: calc(100vw - 40px);
  display: flex; flex-direction: column; align-items: center; gap: 14px; cursor: default;
}
.qr-box img { width: 240px; height: 240px; max-width: 70vw; max-height: 70vw; object-fit: contain; }
.qr-box p { margin: 0; font-size: 14px; color: var(--muted-6); text-align: center; }

.share {
  width: 100%; max-width: 520px; max-height: 82dvh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line-3); border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.share__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #efe8da; font-size: 17px; font-weight: 700; color: var(--ink); }
.share__x { border: none; background: transparent; color: #a89a7c; font-size: 22px; line-height: 1; padding: 4px; }
.share__body { padding: 18px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.share__title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--ink); text-align: center; margin: 0 0 6px; }
.share__rule { width: 40px; height: 3px; background: var(--gold); border-radius: 2px; margin: 0 auto 14px; }
.share__text { margin: 0; font-size: 15px; line-height: 2; color: var(--text); white-space: pre-line; }
.share__foot { padding: 14px 20px 18px; border-top: 1px solid #efe8da; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.share__soc { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; }
.share__soc svg { fill: #fff; }
.share__soc--wa { background: #25D366; }
.share__soc--x { background: var(--navy); }
.share__soc--tg { background: #229ED9; }
.share__soc--fb { background: #1877F2; }
.share__sep { width: 1px; height: 28px; background: var(--line-3); }
.share__foot .icon-btn { width: 44px; height: 44px; }

.auth {
  width: min(400px, 100%); padding: 28px 26px; text-align: right;
  background: var(--card); color: var(--ink); border: 1px solid var(--gold-soft); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.auth--dark { background: var(--navy-2); color: var(--chrome); }
.auth__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.auth__tabs { display: flex; gap: 4px; background: rgba(185, 157, 89, .12); border-radius: 999px; padding: 4px; }
.auth__tab { border: none; border-radius: 999px; padding: 7px 16px; font-size: 14px; font-weight: 700; background: transparent; color: var(--gold); }
.auth__tab[aria-selected="true"] { background: var(--gold); color: var(--navy); }
.auth__close { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1px solid rgba(185, 157, 89, .4); background: transparent; display: flex; align-items: center; justify-content: center; }
.auth__close svg { stroke: var(--gold); }
.auth label { display: block; font-size: 13px; color: #6b7280; margin-bottom: 6px; }
.auth--dark label { color: var(--muted-5); }
.auth input {
  width: 100%; border: 1px solid var(--gold-soft); background: transparent; color: inherit;
  border-radius: 10px; padding: 11px 14px; font-size: 15px; margin-bottom: 14px; outline: none;
}
.auth input[dir="ltr"] { text-align: left; }
.auth__submit { width: 100%; margin-top: 8px; border: none; background: var(--gold); color: var(--navy); border-radius: 999px; padding: 12px; font-size: 15px; font-weight: 700; }
.auth__submit:hover { background: var(--gold-hover); }
.auth__foot { margin-top: 16px; font-size: 13px; color: #6b7280; text-align: center; }
.auth--dark .auth__foot { color: var(--muted-5); }
.auth__foot a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

/* 9) التوجيهات --------------------------------------------------------------- */
.guide {
  position: fixed; inset: 0; z-index: 60; background: var(--chrome);
  overflow-y: auto; overflow-x: hidden; animation: fade-in .25s ease; -webkit-overflow-scrolling: touch;
}
.guide__hero { position: relative; background: var(--navy); padding: 64px 40px 52px; text-align: center; overflow: hidden; }
.guide__ring { pointer-events: none; position: absolute; left: 50%; transform: translateX(-50%); border-radius: 50%; }
.guide__ring--1 { top: -160px; width: min(520px, 110vw); height: min(520px, 110vw); border: 1px solid rgba(185, 157, 89, .25); }
.guide__ring--2 { top: -220px; width: min(680px, 140vw); height: min(680px, 140vw); border: 1px solid rgba(185, 157, 89, .15); }
.guide__back { position: absolute; top: 22px; right: 32px; font-size: 14px; color: var(--gold); text-decoration: none; }
.guide__title { position: relative; font-family: var(--font-display); font-size: 40px; color: var(--chrome); margin: 0 auto 14px; line-height: 1.5; max-width: 760px; }
.guide__rule { width: 56px; height: 3px; background: var(--gold); border-radius: 2px; margin: 0 auto 20px; }
.guide__intro { position: relative; font-size: 18px; color: #c9c0ae; line-height: 2; margin: 0 auto; max-width: 560px; }
.guide__list { max-width: 720px; margin: 0 auto; padding: 16px 24px 60px; }
.guide__item { padding: 30px 0; border-bottom: 1px solid rgba(60, 50, 30, .08); display: grid; grid-template-columns: 56px 1fr; column-gap: 18px; }
.guide__num { font-family: var(--font-display); font-size: 34px; color: var(--gold); line-height: 1.1; }
.guide__h { font-family: var(--font-display); font-size: 22px; color: var(--ink); margin: 0 0 10px; line-height: 1.5; }
.guide__p { margin: 0; font-size: 18px; line-height: 2.1; color: var(--text); }
.guide__p + .guide__p { margin-top: 12px; }
.guide__cta { text-align: center; padding-top: 40px; }
.guide__cta button { border: 1px solid var(--gold); background: var(--gold); color: var(--navy); border-radius: 999px; padding: 16px 56px; font-size: 19px; font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }

/* 10) الوضع الداكن (صفحة الرسائل) -------------------------------------------- */
body[data-theme="dark"] { background: var(--navy-deep); }
[data-theme="dark"] .screen { background: var(--navy-deep); }
[data-theme="dark"] .progress__segs button { background: #3a4453; }
[data-theme="dark"] .progress__segs button[aria-current="true"] { background: var(--gold); }
[data-theme="dark"] .card, [data-theme="dark"] .card__head { background: var(--navy-2); border-color: rgba(185, 157, 89, .3); box-shadow: 0 12px 36px rgba(0, 0, 0, .4); }
[data-theme="dark"] .card__fade { background: linear-gradient(var(--navy-2), rgba(34, 44, 58, 0)); }
[data-theme="dark"] .card__title { color: var(--chrome); }
[data-theme="dark"] .card__body p { color: #e3dccd; }
[data-theme="dark"] .card__body .q { color: #8fcf9f; }
[data-theme="dark"] .card__body .ref { color: var(--muted-2); }
[data-theme="dark"] .card__scroll { scrollbar-color: #3a4453 transparent; }
[data-theme="dark"] .card__foot { border-top-color: rgba(185, 157, 89, .18); }
[data-theme="dark"] .card .icon-btn { background: var(--navy-btn); border-color: var(--gold-soft); }
[data-theme="dark"] .card .icon-btn.is-ok { background: rgba(127, 176, 105, .25); border-color: var(--ok); }
[data-theme="dark"] .card svg { stroke: #d9c189; }
[data-theme="dark"] .card__qr { opacity: 1; }
[data-theme="dark"] .side span { background: var(--navy-2); border-color: var(--gold-soft); }
[data-theme="dark"] .side svg { stroke: #d9c189; }
[data-theme="dark"] .bar { background: rgba(22, 29, 39, .97); border-top-color: rgba(185, 157, 89, .2); }
[data-theme="dark"] .len__group { background: var(--navy-2); border-color: rgba(185, 157, 89, .3); box-shadow: none; }
[data-theme="dark"] .len__btn { color: var(--chrome); border-color: rgba(185, 157, 89, .3); }
[data-theme="dark"] .len__btn:hover { background: rgba(185, 157, 89, .32); color: var(--chrome); }
[data-theme="dark"] .len__btn[aria-pressed="true"] { background: rgba(185, 157, 89, .22); border-color: var(--gold); }
[data-theme="dark"] .topnav .icon-btn { background: var(--navy-2); border-color: var(--gold-soft); }
[data-theme="dark"] .topnav svg { stroke: #d9c189; }
[data-theme="dark"] .lang-code { color: #d9c189; }
[data-theme="dark"] .icon-btn--gold { background: var(--gold); border: none; }
[data-theme="dark"] .icon-btn--gold svg { stroke: var(--navy); }
[data-theme="dark"] .topnav__logo { filter: invert(1) hue-rotate(180deg) brightness(1.05); }
[data-theme="dark"] .topnav__sep { background: rgba(185, 157, 89, .35); }
[data-theme="dark"] .bar__menu { background: var(--navy-2); border-color: var(--gold-soft); }
[data-theme="dark"] .bar__menu svg { stroke: #d9c189; }
[data-theme="dark"] .topnav .pop { background: var(--navy-3); border-color: var(--gold-soft); box-shadow: 0 14px 30px rgba(0, 0, 0, .5); }
[data-theme="dark"] .topnav .pop__item { color: #c9c0ae; }
[data-theme="dark"] .topnav .pop__item:hover { background: var(--gold-faint); }
[data-theme="dark"] .topnav .pop__item[aria-selected="true"] { background: rgba(185, 157, 89, .22); color: var(--chrome); }
[data-theme="dark"] .topnav .pop__title, [data-theme="dark"] .topnav .pop__item .code { color: var(--muted-2); }
[data-theme="dark"] .drawer:not(.drawer--intro) { background: var(--navy); }
[data-theme="dark"] .drawer:not(.drawer--intro) .drawer__item { color: var(--chrome); border-bottom-color: rgba(185, 157, 89, .18); }
[data-theme="dark"] .drawer:not(.drawer--intro) .drawer__logo { filter: invert(1) hue-rotate(180deg) brightness(1.05); }
[data-theme="dark"] .drawer:not(.drawer--intro) .drawer__close { border-color: var(--gold-soft); }
[data-theme="dark"] .drawer:not(.drawer--intro) svg { stroke: #d9c189; }
[data-theme="dark"] .drawer:not(.drawer--intro) .pop__item { color: #c9c0ae; }
[data-theme="dark"] .drawer:not(.drawer--intro) .pop__item[aria-selected="true"] { background: rgba(185, 157, 89, .22); color: var(--chrome); }
[data-theme="dark"] .drawer:not(.drawer--intro) .chip { color: #c9c0ae; border-color: var(--gold-soft); }
[data-theme="dark"] .drawer:not(.drawer--intro) .chip[aria-selected="true"] { background: rgba(185, 157, 89, .22); color: var(--chrome); }
[data-theme="dark"] .modal, [data-theme="dark"] .share { background: var(--navy-2); border-color: rgba(185, 157, 89, .3); }
[data-theme="dark"] .modal__title, [data-theme="dark"] .modal__meta, [data-theme="dark"] .share__head, [data-theme="dark"] .share__title, [data-theme="dark"] .share__text { color: #e3dccd; }
[data-theme="dark"] .share__head, [data-theme="dark"] .share__foot { border-color: rgba(185, 157, 89, .18); }
[data-theme="dark"] .modal .icon-btn, [data-theme="dark"] .share .icon-btn, [data-theme="dark"] .modal__close, [data-theme="dark"] .btn-ghost { background: var(--navy-btn); border-color: var(--gold-soft); color: var(--chrome); }
[data-theme="dark"] .modal svg, [data-theme="dark"] .share .icon-btn svg { stroke: #d9c189; }
[data-theme="dark"] .field { background: var(--navy); border-color: rgba(185, 157, 89, .3); color: var(--chrome); }
[data-theme="dark"] .field::placeholder { color: var(--muted-2); }
[data-theme="dark"] .guide { background: var(--navy-deep); }
[data-theme="dark"] .guide__h { color: var(--chrome); }
[data-theme="dark"] .guide__p { color: #e3dccd; }
[data-theme="dark"] .guide__item { border-bottom-color: rgba(185, 157, 89, .18); }

/* 11) التجاوب ------------------------------------------------------------------ */
@media (max-width: 1200px) {
  .side--next { left: 10px; }
  .side--prev { right: 10px; }
  .card { max-width: min(720px, calc(100vw - 150px)); }
}

@media (max-width: 991px) {
  .topnav { display: none; }
  .bar__menu { display: flex; }
}

@media (max-width: 768px) {
  /* صفحة البداية */
  .intro { padding: 112px 20px 24px; justify-content: flex-start; }
  .intro__title { margin-bottom: 12px; }
  .intro__basm { margin-bottom: 26px; }
  .intro__desc { margin-bottom: 34px; font-size: 14px; }
  .ibar { height: 72px; padding: 0 14px; gap: 8px; border-bottom: 1px solid rgba(185, 157, 89, .25); }
  .ibar__logo { height: 44px; }
  .ibar__sep { height: 30px; }
  .ibar__guide, .ibar__right { display: none; }
  .ibar__burger { display: flex; width: 44px; height: 44px; }
  .intro__guide-m { display: block; }
  .steps { grid-template-columns: 1fr; gap: 10px; max-width: 420px; }
  .step { padding: 12px 16px; gap: 8px; border-radius: 12px; }
  .step--start { flex-direction: row; align-items: center; justify-content: space-between; padding: 16px 20px; }
  .step--start .step__label { display: none; }
  .step--start .step__cta { flex: 1; font-size: 17px; }

  /* الرسائل */
  .progress__count { margin-top: 4px; font-size: 21px; }
  .screen { padding: calc(var(--chrome-top) + 12px) 0 calc(var(--chrome-bottom) + 12px); background: var(--page-mobile); }
  .card {
    width: calc(100vw - 24px); max-width: none; margin: 0 12px;
    max-height: calc(100dvh - var(--chrome-top) - var(--chrome-bottom) - 24px); border-radius: 14px;
    border: 1px solid var(--gold-soft); box-shadow: 0 14px 34px rgba(60, 50, 30, .18);
  }
  .card__title { font-size: 21px; }
  .card__fade { display: none; }
  .card__body p { text-align: center; }
  .card__foot { background: var(--foot); border-top: 1px solid var(--gold-faint); }
  .side, .edge { display: none; }
  .bar { padding: 8px 10px; gap: 6px; z-index: 20; }
  .progress { z-index: 20; }
  .len__group { padding: 4px; gap: 3px; box-shadow: none; }
  .len__btn { padding: 6px 12px; font-size: 16px; }

  /* التوجيهات */
  .guide__hero { padding: 64px 22px 40px; }
  .guide__back { top: 16px; right: 18px; }
  .guide__title { font-size: 27px; }
  .guide__intro { font-size: 15px; }
  .guide__item { grid-template-columns: 34px 1fr; column-gap: 12px; padding: 24px 0; }
  .guide__num { font-size: 26px; }
  .guide__h { font-size: 19px; }
  .guide__p { font-size: 16px; line-height: 2; }

  [data-theme="dark"] .screen { background: var(--navy-deep); }
  [data-theme="dark"] .card { background: var(--navy); border: 1px solid rgba(185, 157, 89, .3); }
  [data-theme="dark"] .card__head, [data-theme="dark"] .card__scroll { background: var(--navy-2); }
  [data-theme="dark"] .card__foot { background: var(--navy); }
}

@media (max-width: 520px) {
  .bar { gap: 16px; padding: 12px 60px; }
  .len { flex-basis: 100%; }
  .len__group { max-width: 100%; }
  .len__btn { padding: 9px 12px; font-size: 16px; }
}

@media (max-width: 400px) {
  .bar { padding: 10px 56px; }
  .len__group { padding: 3px; gap: 2px; }
  .len__btn { padding: 8px 9px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
