/* ============================================================================
   app.css — نظام الواجهة (Premium · Ethereal Glass بالأسود والذهبي).

   المبادئ:
   • Double-Bezel: كل بطاقة صفيحة زجاجية داخل إطار — حلقة خارجية شفافة
     ثم لبّ داخلي بحافة ضوء علوية. بلا عناصر DOM إضافية (طبقات box-shadow).
   • حركة نابضية فقط (--ease-spring)، وعلى transform/opacity فقط (GPU).
   • backdrop-filter على العناصر الثابتة/اللاصقة فقط (الشريط، التنبيه).
   • كل شيء يحترم prefers-reduced-motion.
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; background: var(--color-bg); color: var(--text);
  font-family: var(--font-ar); font-size: var(--fs-base); line-height: 1.75;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ── الخلفية: توهّج ذهبي ضبابي + حبيبات ناعمة — طبقتان ثابتتان لا تتحركان مع التمرير ── */
body::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -2; pointer-events: none;
  background:
    radial-gradient(40vmax 34vmax at 85% 8%, rgba(var(--gold-rgb), 0.13), transparent 62%),
    radial-gradient(36vmax 30vmax at 8% 72%, rgba(var(--gold-rgb), 0.07), transparent 60%),
    radial-gradient(60vmax 50vmax at 50% 120%, rgba(var(--ink-rgb), 0.04), transparent 70%),
    var(--color-bg);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes ambient { to { transform: translate3d(-3vmax, 2vmax, 0) scale(1.06); } }

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast) var(--ease-spring); }
a:hover { color: var(--accent-hover); }
::selection { background: var(--gold-glow); color: var(--text); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
[hidden] { display: none !important; }

/* ── الشريط العائم (Floating Island) ── */
.topbar {
  position: sticky; top: 12px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  width: min(100% - 24px, 72rem); min-height: 58px; margin: 12px auto 0; padding: 8px 10px 8px 18px;
  border-radius: var(--radius-pill); background: var(--glass); border: 1px solid var(--hairline);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-soft);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); }
.brand img { width: 34px; height: 34px; transition: transform var(--dur) var(--ease-spring); }
.brand:hover img { transform: rotate(-8deg) scale(1.06); }
.brand span { font-weight: 600; letter-spacing: 0.22em; font-size: var(--fs-sm); }
.topbar-end { display: flex; align-items: center; gap: var(--sp-2); }
.skip-link {
  position: fixed; inset-block-start: 8px; inset-inline-start: 16px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius-pill); background: var(--text); color: var(--color-bg);
  font-weight: 600; text-decoration: none; transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.site-nav { display: none; align-items: center; gap: 4px; }
.site-nav a, .nav-menu nav a {
  min-height: 44px; display: inline-flex; align-items: center; padding-inline: 12px;
  color: var(--text-muted); text-decoration: none; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 500;
}
.site-nav a:hover, .site-nav a:focus-visible, .nav-menu nav a:hover, .nav-menu nav a:focus-visible {
  color: var(--text); background: rgba(var(--ink-rgb), 0.05);
}
.site-nav .nav-cta, .nav-menu nav .nav-cta {
  background: var(--d7-gold); color: var(--d7-black); padding-inline: 18px;
}
.site-nav .nav-cta:hover, .site-nav .nav-cta:focus-visible, .nav-menu nav .nav-cta:hover, .nav-menu nav .nav-cta:focus-visible {
  background: var(--d7-gold-soft); color: var(--d7-black);
}
.nav-menu { position: relative; }
.nav-menu summary {
  min-width: 48px; min-height: 44px; display: grid; place-items: center; gap: 2px; padding: 4px 10px;
  border-radius: var(--radius-pill); cursor: pointer; color: var(--text); font-size: 0.6875rem; list-style: none;
}
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary > span:first-child, .nav-menu summary > span:first-child::before, .nav-menu summary > span:first-child::after {
  display: block; width: 20px; height: 1px; background: currentColor; content: "";
}
.nav-menu summary > span:first-child { position: relative; }
.nav-menu summary > span:first-child::before { position: absolute; transform: translateY(-6px); }
.nav-menu summary > span:first-child::after { position: absolute; transform: translateY(6px); }
.nav-menu[open] summary > span:first-child { background: transparent; }
.nav-menu[open] summary > span:first-child::before { transform: rotate(45deg); }
.nav-menu[open] summary > span:first-child::after { transform: rotate(-45deg); }
.nav-menu nav {
  position: absolute; inset-block-start: calc(100% + 10px); inset-inline-end: 0; width: min(19rem, calc(100vw - 32px));
  display: grid; gap: 4px; padding: 10px; border: 1px solid var(--hairline-strong); border-radius: var(--radius-lg);
  background: rgba(var(--surface-lo-rgb), 0.98); box-shadow: var(--shadow-soft);
}
.nav-menu nav a { justify-content: flex-start; }
@media (min-width: 980px) {
  .site-nav { display: flex; }
  .nav-menu { display: none; }
}
.who {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: var(--radius-pill);
  background: var(--gold-wash); border: 1px solid var(--gold-hairline); font-size: var(--fs-sm); color: var(--text);
}
.who .avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--d7-gold); color: var(--d7-black); font-weight: 700; font-size: 0.8rem;
}

main.page { width: 100%; max-width: 42rem; margin: 0 auto; padding: var(--sp-5) var(--gutter) var(--sp-7); }

/* ── توقيع الجهة المطوّرة: هادئ بلون التذييل، والاسم يضيء ذهبياً عند المرور ── */
.credit {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px;
  border-radius: var(--radius-pill); text-decoration: none; font-family: var(--font-en); font-size: var(--fs-xs);
  color: var(--text-muted); letter-spacing: 0.02em; unicode-bidi: isolate;
  transition: color var(--dur-fast) var(--ease-spring), background var(--dur-fast) var(--ease-spring);
}
.credit-by { opacity: 0.75; }
.credit-name { font-weight: 600; color: var(--text); transition: color var(--dur-fast) var(--ease-spring); }
.credit-arrow { opacity: 0.6; transition: transform var(--dur) var(--ease-spring), opacity var(--dur-fast) var(--ease-spring); }
.credit:hover { color: var(--text-muted); background: var(--gold-wash); }
.credit:hover .credit-name { color: var(--accent); }
.credit:hover .credit-arrow { opacity: 1; transform: translate(2px, -2px); }

/* نص لقارئ الشاشة فقط */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── العرض ثنائي اللغة (§3) ── */
.bi { display: block; }
.bi > [lang="en"] {
  display: block; direction: ltr; text-align: left; color: var(--text-muted);
  font-family: var(--font-en); font-size: 0.84em; line-height: 1.55; margin-top: 0.2em; letter-spacing: 0.005em;
}
.bi-inline > span { unicode-bidi: isolate; }
.bi-inline > [lang="en"] { display: inline; font-size: 0.86em; color: var(--text-muted); font-family: var(--font-en); }
.bi-inline > [lang="ar"]::after { content: " | "; color: var(--text-muted); opacity: 0.6; }
.center .bi > [lang="en"], .center.bi > [lang="en"] { text-align: center; }

h1, h2, h3 { line-height: 1.3; margin: 0 0 var(--sp-3); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); color: var(--text); }
h1 > .bi > [lang="ar"], h1 > .bi:first-child > [lang="ar"] { color: var(--text); }
h2 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--sp-3); }

/* ── الشارة الصغيرة فوق العناوين (Eyebrow Pill) ── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: var(--sp-3);
  padding: 5px 12px; border-radius: var(--radius-pill); border: 1px solid var(--gold-hairline);
  background: var(--gold-wash); color: var(--accent); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.04em;
}
/* العربية والإنجليزية في الشارة: مرنة بفاصل نقطة، كل جزء معزول اتجاهياً */
.eyebrow .bi { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.eyebrow .bi > span { unicode-bidi: isolate; }
.eyebrow .bi > [lang="en"] {
  display: inline; margin: 0; font-size: 0.92em; color: var(--accent); opacity: 0.7;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.eyebrow .bi > [lang="ar"]::after { content: "·"; margin-inline-start: 8px; opacity: 0.5; }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ── البطاقة: Double-Bezel بطبقات ظل (حلقة خارجية + لبّ زجاجي) ── */
.card {
  position: relative; margin: var(--bezel-pad) var(--bezel-pad) calc(var(--sp-4) + var(--bezel-pad));
  padding: var(--sp-4); border-radius: var(--radius-core);
  background: linear-gradient(180deg, rgba(var(--surface-hi-rgb), 0.72), rgba(var(--surface-lo-rgb), 0.72));
  box-shadow:
    var(--inner-highlight),
    0 0 0 1px var(--hairline),
    0 0 0 var(--bezel-pad) rgba(var(--ink-rgb), 0.025),
    0 0 0 calc(var(--bezel-pad) + 1px) var(--hairline),
    0 30px 60px -30px rgba(var(--shadow-rgb), calc(0.6 * var(--shadow-k)));
}
.card.accent {
  background: linear-gradient(180deg, rgba(var(--warm-hi-rgb), 0.55), rgba(var(--warm-lo-rgb), 0.7));
  box-shadow:
    var(--inner-highlight),
    0 0 0 1px var(--gold-hairline),
    0 0 0 var(--bezel-pad) var(--gold-wash),
    0 0 0 calc(var(--bezel-pad) + 1px) rgba(var(--gold-rgb), 0.18),
    var(--shadow-gold);
}
.muted { color: var(--text-muted); }
.note {
  position: relative; padding: var(--sp-3) var(--sp-4); margin: var(--sp-4) 0; border-radius: var(--radius-lg);
  background: rgba(var(--ink-rgb), 0.025); border: 1px solid var(--hairline);
  color: var(--text-muted); font-size: var(--fs-sm);
}
.note::before {
  content: ""; position: absolute; inset-block: 14px; inset-inline-start: 0; width: 2px; border-radius: 2px;
  background: linear-gradient(var(--accent), transparent);
}

/* ── الأزرار: كبسولة + أيقونة داخل دائرة (Button-in-Button) ── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 52px; padding: 8px 10px 8px 22px; border-radius: var(--radius-pill);
  border: 0; background: linear-gradient(180deg, var(--d7-gold-soft), var(--d7-gold));
  color: var(--d7-black); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 30px -10px var(--gold-glow);
  transition: transform var(--dur-fast) var(--ease-press), box-shadow var(--dur) var(--ease-spring), filter var(--dur) var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
}
.btn:not(:has(.btn-icon)) { padding-inline: 24px; }
.btn:hover { color: var(--d7-black); filter: brightness(1.04); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 16px 40px -12px rgba(var(--gold-rgb), 0.45); }
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: grayscale(0.4); }
.btn .bi > [lang="en"] { color: inherit; opacity: 0.72; text-align: center; font-size: 0.78em; margin-top: 0; }
.btn-icon {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(11, 11, 13, 0.12); transition: transform var(--dur) var(--ease-spring);
}
.btn:hover .btn-icon { transform: translateX(-3px) translateY(-1px) scale(1.06); }
[dir="ltr"] .btn:hover .btn-icon { transform: translateX(3px) translateY(-1px) scale(1.06); }
.btn.ghost {
  background: rgba(var(--ink-rgb), 0.03); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
}
.btn.ghost:hover { background: var(--gold-wash); box-shadow: inset 0 0 0 1px var(--gold-hairline); color: var(--accent); }
.btn.ghost .btn-icon { background: rgba(var(--ink-rgb), 0.06); }
.btn.block { width: 100%; justify-content: space-between; }
.btn.block:not(:has(.btn-icon)) { justify-content: center; }

/* ── الحقول: كبسولة داخل إطار ── */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; margin-bottom: var(--sp-2); font-weight: 500; font-size: var(--fs-sm); }
.field input, .field textarea, .field select {
  width: 100%; min-height: 54px; padding: 14px 18px; border-radius: var(--radius-lg);
  border: 0; background: rgba(var(--surface-lo-rgb), 0.55); color: var(--text); font: inherit;
  box-shadow: inset 0 0 0 1px var(--hairline-strong), inset 0 2px 6px rgba(var(--shadow-rgb), calc(0.35 * var(--shadow-k)));
  transition: box-shadow var(--dur) var(--ease-spring), background var(--dur) var(--ease-spring);
}

/* قائمة الخيارات المنسدلة يرسمها المتصفح نافذةً مستقلة: خلفية الـselect نصف
   الشفافة تُركَّب فوق الأبيض، فيصير النص العاجي في الداكن على خلفية فاتحة ولا
   يُقرأ. لون صريح ومعتم للخيارات يحسم ذلك في الثيمين ولكل select في الموقع. */
select { color-scheme: inherit; }
select option, select optgroup { background-color: var(--surface); color: var(--text); }
select option:checked { background-color: var(--d7-gold); color: var(--d7-black); }
select option:disabled { color: var(--text-muted); }
.field textarea { min-height: 128px; resize: vertical; line-height: 1.7; }
.field input:hover, .field textarea:hover { box-shadow: inset 0 0 0 1px var(--gold-hairline), inset 0 2px 6px rgba(var(--shadow-rgb), calc(0.35 * var(--shadow-k))); }
.field input:focus, .field textarea:focus {
  outline: none; background: rgba(var(--surface-lo-rgb), 0.75);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--gold-wash), inset 0 2px 6px rgba(var(--shadow-rgb), calc(0.35 * var(--shadow-k)));
}
.field .error { color: var(--accent-hover); font-size: var(--fs-sm); margin-top: var(--sp-2); min-height: 0; }
.field .error:empty { display: none; }

.check {
  display: flex; gap: 14px; align-items: flex-start; margin-bottom: var(--sp-2); padding: 12px 14px;
  border-radius: var(--radius-lg); cursor: pointer; transition: background var(--dur) var(--ease-spring);
}
.check:hover { background: rgba(var(--ink-rgb), 0.03); }
.check input {
  appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin-top: 0.2em;
  border-radius: 8px; background: rgba(var(--surface-lo-rgb), 0.6); box-shadow: inset 0 0 0 1px var(--hairline-strong);
  display: grid; place-items: center; cursor: pointer; transition: all var(--dur) var(--ease-spring);
}
.check input::after {
  content: ""; width: 11px; height: 6px; border: 2px solid var(--d7-black); border-top: 0; border-inline-end: 0;
  transform: rotate(-45deg) scale(0); transition: transform var(--dur) var(--ease-press); margin-top: -2px;
}
.check input:checked { background: var(--accent); box-shadow: 0 0 0 4px var(--gold-wash); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.counter { text-align: left; direction: ltr; font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; margin-top: var(--sp-1); }

/* ── الأسئلة ── */
.step-label { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-2); font-variant-numeric: tabular-nums; }
.progress { position: relative; height: 4px; background: rgba(var(--ink-rgb), 0.06); border-radius: 4px; overflow: hidden; margin-bottom: var(--sp-5); }
.progress > span {
  display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--d7-gold-deep), var(--d7-gold-soft));
  box-shadow: 0 0 14px var(--gold-glow); transition: width var(--dur-slow) var(--ease-spring);
}
.progress-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: var(--sp-5); }
.progress-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(var(--ink-rgb), 0.1); transition: all var(--dur) var(--ease-spring); }
.progress-dots i.done { background: var(--d7-gold-deep); }
.progress-dots i.now { width: 26px; border-radius: 6px; background: var(--accent); box-shadow: 0 0 12px var(--gold-glow); }

.options { display: grid; gap: 12px; margin: var(--sp-4) 0; }
.option {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; text-align: start;
  padding: 18px 18px 18px 20px; min-height: 64px; border: 0; border-radius: var(--radius-lg);
  background: rgba(var(--surface-lo-rgb), 0.7); color: var(--text); font: inherit; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--hairline), var(--inner-highlight);
  transition: transform var(--dur-fast) var(--ease-press), box-shadow var(--dur) var(--ease-spring), background var(--dur) var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
}
.option::before {
  content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--hairline-strong); transition: all var(--dur) var(--ease-spring);
}
.option > .bi { flex: 1; }
.option:hover { background: rgba(var(--surface-hi-rgb), 0.85); box-shadow: inset 0 0 0 1px var(--gold-hairline), var(--inner-highlight); }
.option:active { transform: scale(0.985); }
.option[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(var(--warm-hi-rgb), 0.7), rgba(var(--warm-hi-rgb), 0.8));
  box-shadow: inset 0 0 0 1px var(--accent), 0 12px 32px -16px var(--gold-glow);
}
.option[aria-pressed="true"]::before { background: var(--accent); box-shadow: inset 0 0 0 5px var(--color-bg), 0 0 0 1.5px var(--accent), 0 0 14px var(--gold-glow); }

.nav-row { display: flex; gap: 12px; justify-content: space-between; margin-top: var(--sp-5); }
.nav-row .btn { flex: 1; }
.scale { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .scale { grid-template-columns: repeat(4, 1fr); } }
.scale .option { flex-direction: column; align-items: flex-start; min-height: 88px; }

/* ── المؤقت: حلقة ذهبية ── */
.timer {
  position: sticky; top: 84px; z-index: 20; display: flex; align-items: center; justify-content: center; gap: var(--sp-4);
  margin: 0 auto var(--sp-5); padding: 10px 22px 10px 12px; width: max-content; border-radius: var(--radius-pill);
  background: var(--glass-strong); border: 1px solid var(--gold-hairline);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: var(--shadow-gold);
}
.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: rgba(var(--ink-rgb), 0.08); }
.ring .bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; filter: drop-shadow(0 0 6px var(--gold-glow)); }
.timer .clock { font-family: var(--font-en); font-size: 2rem; font-weight: 600; color: var(--accent); direction: ltr; font-variant-numeric: tabular-nums; line-height: 1; }
.timer.urgent { animation: pulse 1.6s var(--ease-spring) infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--gold-wash), var(--shadow-gold); } }

.checklist { list-style: none; padding: 0; margin: 0; counter-reset: c; }
.checklist li { counter-increment: c; display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--hairline); align-items: flex-start; }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before {
  content: counter(c); flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold-wash); box-shadow: inset 0 0 0 1px var(--gold-hairline);
  color: var(--accent); display: grid; place-items: center; font-size: var(--fs-sm); font-family: var(--font-en);
}

/* ── أرقام النتيجة ── */
.result-hero { text-align: center; padding: var(--sp-5) 0 var(--sp-4); }
.result-hero .mark { width: 72px; height: 72px; margin: 0 auto var(--sp-3); display: block; filter: drop-shadow(0 8px 24px var(--gold-glow)); }
.result-hero h1 { font-size: var(--fs-2xl); }
.result-hero h1 [lang="ar"] { background: linear-gradient(180deg, var(--d7-gold-soft), var(--d7-gold-deep)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-hero .bi > [lang="en"] { text-align: center; }
.pair { display: grid; gap: 0; }
@media (min-width: 560px) { .pair { grid-template-columns: 1fr 1fr; } }
.pair .card h2 { font-size: var(--fs-xl); margin: 0; }

/* ── الحالات ── */
.center { text-align: center; }
.spinner {
  width: 44px; height: 44px; margin: var(--sp-5) auto; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 60%, var(--accent));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
  animation: spin 0.9s var(--ease-spring) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* ── الرسائل: ثلاثة أنواع بلغة واحدة في كل مكان (ثابتة، مؤقتة، نافذة) ──
   success ذهبي بعلامة ✓ · info محايد بدائرة i · error بلون النص وحدّ أقوى ومثلث.
   لا أحمر ولا برغندي (§26) — الخطأ يتميّز بالتباين والأيقونة لا باللون. */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; margin-bottom: var(--sp-3); border-radius: var(--radius-lg); font-size: var(--fs-sm);
  background: rgba(var(--ink-rgb), 0.03); box-shadow: inset 0 0 0 1px var(--hairline-strong);
}
.alert-body { flex: 1; min-width: 0; display: grid; gap: var(--sp-3); }
.alert-body > .bi { line-height: 1.7; }
.alert-icon {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text-muted); background: rgba(var(--ink-rgb), 0.06);
}
.alert.success { background: var(--gold-wash); box-shadow: inset 0 0 0 1px var(--gold-hairline); }
.alert.success .alert-icon { background: var(--d7-gold); color: var(--d7-black); }
.alert.error { background: rgba(var(--ink-rgb), 0.06); box-shadow: inset 0 0 0 1px var(--text-muted), inset 4px 0 0 var(--text); }
[dir="rtl"] .alert.error { box-shadow: inset 0 0 0 1px var(--text-muted), inset -4px 0 0 var(--text); }
.alert.error .alert-icon { background: var(--text); color: var(--color-bg); }
.alert.error, .alert.error .bi { color: var(--text); }
.error-card { display: grid; justify-items: start; gap: var(--sp-2); }
.error-card > p { margin: 0; }
.error-card .alert-icon { background: var(--text); color: var(--color-bg); }

/* التنبيهات المؤقتة: مكدّس أسفل الشاشة في المنتصف */
.toasts {
  position: fixed; inset-inline: 0; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 70;
  display: grid; justify-items: center; gap: 8px; padding-inline: 12px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; width: min(100%, 26rem);
  padding: 10px 10px 10px 14px; border-radius: var(--radius-lg); font-size: var(--fs-sm); color: var(--text);
  background: var(--glass-strong); box-shadow: 0 0 0 1px var(--hairline-strong), var(--shadow-soft);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  animation: toast-in var(--dur) var(--ease-out-expo);
}
[dir="rtl"] .toast { padding: 10px 14px 10px 10px; }
.toast.out { animation: toast-out 220ms var(--ease-exit) forwards; }
.toast-text { flex: 1; min-width: 0; line-height: 1.6; }
.toast-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(var(--ink-rgb), 0.08); color: var(--text-muted); }
.toast.success { box-shadow: 0 0 0 1px var(--gold-hairline), var(--shadow-gold); }
.toast.success .toast-icon { background: var(--d7-gold); color: var(--d7-black); }
.toast.error { box-shadow: 0 0 0 1px var(--text-muted), var(--shadow-soft); }
.toast.error .toast-icon { background: var(--text); color: var(--color-bg); }
.toast-close {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 0; background: none; color: var(--text-muted); transition: background var(--dur-fast) var(--ease-spring), color var(--dur-fast) var(--ease-spring);
}
.toast-close:hover { background: rgba(var(--ink-rgb), 0.06); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ── النوافذ (confirm / alert / prompt) ── */
.dlg {
  width: min(100% - 32px, 26rem); max-width: none; padding: 0; border: 0; border-radius: var(--radius-xl);
  color: var(--text); background: linear-gradient(180deg, rgba(var(--surface-hi-rgb), 0.98), rgba(var(--surface-lo-rgb), 0.98));
  box-shadow: var(--inner-highlight), 0 0 0 1px var(--hairline-strong), 0 40px 90px -30px rgba(0, 0, 0, 0.6);
}
.dlg[open] { animation: dlg-in 320ms var(--ease-out-expo); }
.dlg::backdrop { background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: scrim-fade 320ms var(--ease-out-expo); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes scrim-fade { from { opacity: 0; } }
.dlg-form { display: grid; justify-items: center; gap: 10px; padding: var(--sp-5) var(--sp-4) var(--sp-4); text-align: center; }
.dlg-icon {
  width: 52px; height: 52px; margin-bottom: 4px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent); background: var(--gold-wash); box-shadow: inset 0 0 0 1px var(--gold-hairline), 0 0 0 6px var(--gold-wash);
}
.dlg-icon.danger { color: var(--color-bg); background: var(--text); box-shadow: 0 0 0 6px rgba(var(--ink-rgb), 0.08); }
.dlg-title { margin: 0; font-size: var(--fs-lg); font-weight: 700; }
.dlg-msg { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.7; }
.dlg-msg p { margin: 0; }
.dlg-field { width: 100%; margin: 6px 0 0; text-align: start; }
.dlg-actions { display: flex; gap: 10px; width: 100%; margin-top: var(--sp-3); }
.dlg-actions .btn { flex: 1; min-height: 48px; padding-inline: 16px; }

/* ── الأزرار: أحجام وأنواع إضافية ── */
.btn.sm { min-height: 38px; padding: 6px 16px; font-size: var(--fs-sm); }
.btn.sm:not(:has(.btn-icon)) { padding-inline: 16px; }
/* فعل خطِر لا يُعاد (استرداد، حذف): بلون النص بدل الذهبي — تباين عالٍ بلا أحمر */
.btn.danger { background: var(--text); color: var(--color-bg); box-shadow: 0 10px 30px -12px rgba(var(--shadow-rgb), calc(0.8 * var(--shadow-k))); }
.btn.danger:hover { color: var(--color-bg); filter: none; background: var(--text-muted); }
.btn.ghost.danger { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--text-muted); }
.btn.ghost.danger:hover { background: var(--text); color: var(--color-bg); box-shadow: none; }
/* حالة التحميل */
.btn.is-busy { justify-content: center; gap: 10px; cursor: progress; }
.btn.is-busy:disabled { opacity: 0.85; filter: none; }
.btn-spin {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; opacity: 0.8;
  animation: spin 0.7s linear infinite;
}
/* زر أيقونة دائري واحد لكل الواجهة (الثيم، اللغة، شريط الإدارة) */
.icon-btn, .theme-btn, .lang-btn, .adm-icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: var(--text-muted); background: none; border: 1px solid var(--hairline-strong); text-decoration: none; font: inherit;
  transition: color var(--dur-fast) var(--ease-spring), border-color var(--dur-fast) var(--ease-spring), background var(--dur-fast) var(--ease-spring);
}
.icon-btn:hover, .theme-btn:hover, .lang-btn:hover, .adm-icon-btn:hover { color: var(--accent); border-color: var(--gold-hairline); background: var(--gold-wash); }
.icon-btn:disabled, .adm-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Skeleton Loading: هيكل الشاشة القادمة بدل دوّامة فارغة ── */
.skeleton { display: grid; gap: 14px; padding-top: var(--sp-4); }
.sk {
  border-radius: var(--radius); background: rgba(var(--ink-rgb), 0.05); position: relative; overflow: hidden;
}
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(100%);
  background: linear-gradient(90deg, transparent, rgba(var(--gold-rgb), 0.08), transparent);
  animation: shimmer 1.6s var(--ease-spring) infinite;
}
@keyframes shimmer { to { transform: translateX(-100%); } }
.sk.line { height: 14px; }
.sk.title { height: 34px; width: 70%; }
.sk.short { width: 40%; }
.sk.block { height: 64px; border-radius: var(--radius-lg); }
.sk.pill { height: 52px; border-radius: var(--radius-pill); }

/* ── الظهور عند الدخول (Reveal) — يضيف core.js الصنف in بالـIntersectionObserver ── */
.reveal { opacity: 0; transform: translateY(24px); filter: blur(6px);
  transition: opacity var(--dur-slow) var(--ease-out-expo), transform var(--dur-slow) var(--ease-out-expo), filter var(--dur-slow) var(--ease-out-expo);
  transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.in { opacity: 1; transform: none; filter: none; }



@media (min-width: 768px) {
  :root { --gutter: 24px; }
  main.page { padding-top: var(--sp-6); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; filter: none; }
}

/* عنوان السؤال: أكبر وأهدأ — السؤال هو البطل */
.question-title { font-size: var(--fs-xl); line-height: 1.45; margin-bottom: var(--sp-4); }
.question-title .bi > [lang="en"] { font-size: 0.62em; font-weight: 400; margin-top: 0.5em; }
.pair .card .eyebrow { margin-bottom: var(--sp-2); }

/* ── مبدّل اللغة: كبسولة صغيرة في الشريط ── */
.lang-switch {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--hairline-strong); color: var(--text); text-decoration: none; font-size: var(--fs-sm);
  transition: border-color var(--dur-fast) var(--ease-spring), color var(--dur-fast) var(--ease-spring), background var(--dur-fast) var(--ease-spring);
}
.lang-switch:hover { border-color: var(--gold-hairline); color: var(--accent); background: var(--gold-wash); }

/* الأسهم الاتجاهية تنعكس في الإنجليزية (LTR): «التالي» يشير يميناً */
[dir="ltr"] .icon-dir { transform: scaleX(-1); }
[dir="ltr"] .btn:hover .btn-icon { transform: translateX(3px) translateY(-1px) scale(1.06); }

/* ── مبدّل الثيم: يظهر زر «إلى الفاتح» في الداكن والعكس — CSS يقرّر بلا JS.
   شكل الزر نفسه من .icon-btn الموحّد أعلاه. ── */
.topbar-tools { display: flex; align-items: center; gap: 4px; }
.theme-toggle { display: inline-flex; }
.theme-btn svg { transition: transform var(--dur) var(--ease-spring); }
.theme-btn:hover svg { transform: rotate(20deg); }
.to-light { display: grid; }
.to-dark { display: none; }
:root[data-theme="light"] .to-light { display: none; }
:root[data-theme="light"] .to-dark { display: grid; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .to-light { display: none; }
  :root:not([data-theme]) .to-dark { display: grid; }
}
.site-nav + .topbar-tools { margin-inline-start: 4px; }
/* ── زر اللغة: يعرض «ع» أو «EN» (الشكل من .icon-btn الموحّد) ── */
.lang-btn { font-size: 1.05rem; font-weight: 700; line-height: 1; }
.lang-btn[lang="en"] { font-family: var(--font-en); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; }
.icon-btn:focus-visible, .lang-btn:focus-visible, .theme-btn:focus-visible, .adm-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* انتقال ناعم للألوان لحظة التبديل فقط (يضيفه core.js ثم يزيله) */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color 420ms var(--ease-spring), color 420ms var(--ease-spring), border-color 420ms var(--ease-spring), fill 420ms var(--ease-spring) !important;
}

/* ── النماذج: تلميح تحت الحقل، وبطاقات اختيار (راديو) بدل قائمة منسدلة ── */
.field-hint { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--text-muted); }
.check-hint { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.6; }
fieldset.choices { border: 0; padding: 0; margin: 0 0 var(--sp-4); display: grid; gap: 10px; }
fieldset.choices legend { padding: 0; margin-bottom: var(--sp-2); font-weight: 500; font-size: var(--fs-sm); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  display: grid; gap: 2px; padding: 14px 16px 14px 44px; border-radius: var(--radius-lg);
  background: rgba(var(--surface-lo-rgb), 0.55); box-shadow: inset 0 0 0 1px var(--hairline-strong);
  transition: box-shadow var(--dur-fast) var(--ease-spring), background var(--dur-fast) var(--ease-spring);
}
[dir="rtl"] .choice-body { padding: 14px 44px 14px 16px; }
.choice-body::before {
  content: ""; position: absolute; top: 18px; inset-inline-start: 16px; width: 16px; height: 16px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--text-muted); transition: box-shadow var(--dur-fast) var(--ease-spring);
}
.choice-body b { font-weight: 600; }
.choice-body small { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.6; }
.choice:hover .choice-body { box-shadow: inset 0 0 0 1px var(--gold-hairline); }
.choice input:checked + .choice-body { background: var(--gold-wash); box-shadow: inset 0 0 0 1.5px var(--accent); }
.choice input:checked + .choice-body::before { box-shadow: inset 0 0 0 5px var(--accent); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--focus-ring); outline-offset: 3px; }

/* ── الانضمام بمقعد مؤسسي ── */
.join-seat {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: var(--sp-3);
  padding: 12px 16px; border-radius: var(--radius-lg); background: var(--gold-wash); box-shadow: inset 0 0 0 1px var(--gold-hairline);
  font-size: var(--fs-sm);
}
.join-free {
  margin-inline-start: auto; padding: 2px 10px; border-radius: var(--radius-pill);
  background: var(--d7-gold); color: var(--d7-black); font-size: var(--fs-xs); font-weight: 700;
}
.code-input { font-family: var(--font-en); letter-spacing: 0.12em; text-transform: uppercase; }
.org-req-points { margin-bottom: var(--sp-4); }
.org-req-points { list-style: none; padding: 0; display: grid; gap: 10px; }
.org-req-points li { display: flex; align-items: center; gap: 12px; }
.org-req-points .tick {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-wash); color: var(--accent); box-shadow: inset 0 0 0 1px var(--gold-hairline);
}
.join-seat .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--d7-gold); color: var(--d7-black); }
