/* =========================================================
   اختبار الجلسة الأولى | دبلوم التأسيس الرقمي — أسس OUSOS
   الألوان من هوية OUSOS المعتمدة (الأحمر والكحلي + امتداد النيون البنفسجي)
   ========================================================= */

:root {
  /* هوية */
  --ousos-red: #D2011B;
  --ousos-red-light: #E8001F;
  --ousos-navy: #011A51;
  --violet: #8A22C9;
  --violet-deep: #6A1BA8;
  --blue: #1570FF;
  --cyan: #00BDC4;
  --ground: #050720;
  --slate: #474B6B;
  --ghost: #AEB8E2;
  --line: #D5DAF0;

  /* سمة داكنة (افتراضية) */
  --bg: var(--ground);
  --text: #FFFFFF;
  --text-2: var(--ghost);
  --surface: rgb(255 255 255 / .055);
  --surface-2: rgb(255 255 255 / .09);
  --surface-hover: rgb(255 255 255 / .1);
  --border: rgb(174 184 226 / .18);
  --border-strong: rgb(174 184 226 / .34);
  --accent: var(--violet);
  --accent-ink: #FFFFFF;
  --focus: var(--cyan);
  --ok: var(--cyan);
  --ok-bg: rgb(0 189 196 / .12);
  --bad: #E8001F;
  --bad-bg: rgb(210 1 27 / .16);
  --shadow: 0 30px 60px -20px rgb(0 0 0 / .6), 0 0 0 1px rgb(255 255 255 / .04) inset;
  --glass-blur: 18px;
  --grad-primary: linear-gradient(135deg, #6A1BA8 0%, #8A22C9 45%, #B9011A 100%);
  --orb-violet: rgb(138 34 201 / .55);
  --orb-navy: rgb(21 112 255 / .32);
  --orb-red: rgb(210 1 27 / .3);

  --font-head: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-body: "Noto Naskh Arabic", "Noto Kufi Arabic", "Segoe UI", Tahoma, serif;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #FFFFFF;
  --text: var(--ousos-navy);
  --text-2: var(--slate);
  --surface: rgb(255 255 255 / .72);
  --surface-2: rgb(255 255 255 / .9);
  --surface-hover: #F4EAFB;
  --border: rgb(1 26 81 / .1);
  --border-strong: rgb(106 27 168 / .3);
  --accent: var(--violet-deep);
  --focus: var(--blue);
  --ok: #0A4FC4;
  --ok-bg: #E8F1FF;
  --bad: #B9011A;
  --bad-bg: rgb(210 1 27 / .08);
  --shadow: 0 24px 50px -24px rgb(1 26 81 / .28), 0 0 0 1px rgb(255 255 255 / .6) inset;
  --orb-violet: rgb(138 34 201 / .2);
  --orb-navy: rgb(21 112 255 / .14);
  --orb-red: rgb(210 1 27 / .1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
/* touch-action: manipulation يسمح بالتكبير بإصبعين ويلغي تأخير النقر المزدوج فقط */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; touch-action: manipulation; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0;
  overflow-x: clip; /* clip لا ينشئ حاوية تمرير، فلا يعيق التحريك بعد التكبير */
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }

.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;
}
.skip-link {
  position: absolute; inset-inline-start: 16px; top: -60px; z-index: 50;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 10px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- خلفية مضيئة ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); will-change: transform; }
.orb--violet { width: 56vmax; height: 56vmax; inset-inline-end: -18vmax; top: -22vmax; background: radial-gradient(circle, var(--orb-violet), transparent 65%); animation: drift 22s ease-in-out infinite alternate; }
.orb--navy { width: 50vmax; height: 50vmax; inset-inline-start: -20vmax; bottom: -24vmax; background: radial-gradient(circle, var(--orb-navy), transparent 65%); animation: drift 26s ease-in-out infinite alternate-reverse; }
.orb--red { width: 26vmax; height: 26vmax; inset-inline-start: 30%; top: 40%; background: radial-gradient(circle, var(--orb-red), transparent 70%); animation: drift 30s ease-in-out infinite alternate; }
.grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  opacity: .35;
}
@keyframes drift { to { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); } }

/* ---------- الشريط العلوي ---------- */
.topbar {
  width: min(1180px, 100% - 32px);
  margin: 16px auto 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-plate {
  flex: none;
  background: #FFFFFF;
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: 0 10px 30px -12px rgb(0 0 0 / .5);
}
.logo-plate img { width: 132px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.45; min-width: 0; }
.brand-title { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: .8rem; color: var(--text-2); }

.icon-btn {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background-color .2s, transform .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-moon { display: none !important; }
:root[data-theme="light"] .i-sun { display: none !important; }
:root[data-theme="light"] .i-moon { display: block !important; }

/* ---------- الهيكل ---------- */
.stage {
  flex: 1;
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
  padding-block: clamp(24px, 5vw, 56px) 32px;
  outline: none;
}
.screen { animation: none; }
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 14px;
  padding: 6px 14px;
  font-size: .85rem; font-weight: 600;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ousos-red); box-shadow: 0 0 0 4px rgb(210 1 27 / .2); }

/* ---------- الأزرار ---------- */
.btn {
  --h: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--h);
  padding: 0 22px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background-color .2s, border-color .2s, opacity .2s;
}
.btn--lg { --h: 58px; padding: 0 28px; font-size: 1.06rem; }
.btn--primary {
  color: #FFFFFF;
  background: var(--grad-primary);
  box-shadow: 0 14px 30px -12px rgb(138 34 201 / .75), 0 1px 0 rgb(255 255 255 / .25) inset;
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -12px rgb(138 34 201 / .9), 0 1px 0 rgb(255 255 255 / .25) inset; }
.btn--primary:active { transform: translateY(0) scale(.98); }
.btn--ghost { color: var(--text); background: var(--surface); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-arrow, .btn-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn--primary:hover .btn-arrow { transform: translateX(-3px); }
.btn-arrow { transition: transform .2s var(--ease); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- الترحيب ---------- */
.screen--welcome {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: clamp(24px, 5vw, 64px);
}
.display {
  margin: 0;
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  line-height: 1.3;
  font-weight: 800;
}
.display-sub {
  display: block;
  margin-top: 6px;
  font-size: .5em;
  font-weight: 700;
  background: linear-gradient(90deg, #F4EAFB, #E8001F);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
:root[data-theme="light"] .display-sub { background-image: linear-gradient(90deg, var(--violet-deep), var(--ousos-red)); }
.lede {
  margin: 18px 0 0;
  max-width: 54ch;
  font-family: var(--font-body);
  font-size: 1.12rem;
  line-height: 1.9;
  color: var(--text-2);
}
.facts { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 12px; }
.facts li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.facts strong { font-size: 1.4rem; font-weight: 800; }
.facts span { color: var(--text-2); font-size: .92rem; }
.hints { margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; font-family: var(--font-body); color: var(--text-2); }
.hints li { position: relative; padding-inline-start: 26px; }
.hints li::before {
  content: ""; position: absolute; inset-inline-start: 4px; top: .7em;
  width: 10px; height: 10px; border-radius: 3px; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--violet), var(--blue));
}
.resume-note { margin: 12px 0 0; color: var(--text-2); font-size: .92rem; }

/* مشهد ثلاثي الأبعاد */
.hero-visual { perspective: 1200px; display: grid; place-items: center; min-height: 380px; }
.hero-tilt {
  --rx: 8deg; --ry: -16deg;
  position: relative;
  width: min(440px, 100%);
  aspect-ratio: 1.15;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s var(--ease);
  animation: float 7s ease-in-out infinite;
}
@keyframes float { 50% { translate: 0 -10px; } }
.laptop { position: absolute; inset: 6% 6% 4%; transform-style: preserve-3d; }
.laptop-screen {
  position: absolute; inset: 0 4% 26%;
  padding: 10px;
  border-radius: 18px 18px 6px 6px;
  background: linear-gradient(160deg, #011A51, #050720);
  border: 1px solid rgb(174 184 226 / .25);
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / .7), 0 0 60px -10px rgb(138 34 201 / .5);
  transform: translateZ(20px);
}
.win {
  position: relative; height: 100%;
  border-radius: 10px; overflow: hidden;
  background: radial-gradient(120% 90% at 80% 0%, #8A22C9 0%, #6A1BA8 40%, #011A51 100%);
  display: flex; flex-direction: column;
}
.win-desktop { position: relative; flex: 1; padding: 10px; display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 22px; gap: 8px; }
.win-icon { width: 20px; height: 20px; border-radius: 6px; background: rgb(255 255 255 / .75); grid-column: 6; }
.win-icon:nth-child(2) { background: rgb(0 189 196 / .9); }
.win-icon:nth-child(3) { background: rgb(232 0 31 / .85); }
.win-window {
  position: absolute; inset: 18% 30% 14% 8%;
  border-radius: 8px;
  background: rgb(255 255 255 / .92);
  box-shadow: 0 14px 30px -10px rgb(0 0 0 / .5);
  display: flex; flex-direction: column; gap: 6px; padding: 0 0 10px;
  transform: translateZ(18px);
  animation: winPop 7s ease-in-out infinite;
}
@keyframes winPop { 50% { transform: translateZ(26px) translateY(-3px); } }
.win-bar { display: flex; justify-content: flex-start; gap: 4px; padding: 6px 8px; background: #E8F1FF; border-radius: 8px 8px 0 0; }
.win-bar i { width: 7px; height: 7px; border-radius: 50%; background: #AEB8E2; }
.win-line { height: 6px; margin-inline: 10px; border-radius: 4px; background: #D5DAF0; }
.w80 { width: 80%; } .w60 { width: 60%; } .w70 { width: 70%; }
.win-taskbar { height: 22px; display: flex; align-items: center; justify-content: center; gap: 6px; background: rgb(5 7 32 / .75); }
.win-taskbar span { width: 12px; height: 12px; border-radius: 4px; background: rgb(255 255 255 / .55); }
.win-taskbar .start { background: var(--blue); }
.win-taskbar .clock { width: 26px; margin-inline-start: auto; margin-inline-end: 8px; border-radius: 3px; height: 6px; }
.laptop-base {
  position: absolute; inset-inline: 0; bottom: 8%; height: 20%;
  border-radius: 6px 6px 22px 22px;
  background: linear-gradient(180deg, #474B6B, #050720);
  border: 1px solid rgb(174 184 226 / .25);
  transform: rotateX(62deg) translateZ(-6px);
  transform-origin: top center;
  box-shadow: 0 40px 50px -20px rgb(0 0 0 / .65);
  display: grid; place-items: center;
}
.touchpad { width: 30%; height: 42%; border-radius: 6px; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .12); }
.keycap {
  position: absolute;
  display: grid; place-items: center;
  min-width: 56px; height: 56px; padding: 0 12px;
  border-radius: 14px;
  font-family: "Segoe UI", var(--font-head);
  font-weight: 700; font-size: 1.05rem;
  color: #FFFFFF;
  background: linear-gradient(160deg, rgb(255 255 255 / .22), rgb(255 255 255 / .06));
  border: 1px solid rgb(255 255 255 / .28);
  box-shadow: 0 6px 0 rgb(5 7 32 / .55), 0 20px 30px -12px rgb(0 0 0 / .6);
  backdrop-filter: blur(10px);
  transform-style: preserve-3d;
}
.k1 { top: 2%; inset-inline-end: -2%; transform: translateZ(80px) rotate(-8deg); animation: bob 6s ease-in-out infinite; }
.k2 { top: 22%; inset-inline-end: -10%; transform: translateZ(110px) rotate(6deg); animation: bob 6s ease-in-out -2s infinite; }
.k3 { bottom: 18%; inset-inline-start: -6%; transform: translateZ(90px) rotate(-6deg); font-family: var(--font-head); animation: bob 6s ease-in-out -4s infinite; }
@keyframes bob { 50% { translate: 0 -12px; } }
.chip-card {
  position: absolute; bottom: 4%; inset-inline-end: 4%;
  width: 78px; height: 78px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #8A22C9, #1570FF);
  box-shadow: 0 20px 40px -14px rgb(21 112 255 / .8);
  transform: translateZ(120px) rotate(10deg);
  animation: bob 7s ease-in-out -1s infinite;
}
.chip-core {
  width: 46px; height: 46px; border-radius: 10px;
  display: grid; place-items: center;
  font-family: "Segoe UI", sans-serif; font-weight: 800; font-size: .8rem; color: #fff;
  border: 2px dashed rgb(255 255 255 / .55);
}
:root[data-theme="light"] .keycap { color: var(--ousos-navy); background: linear-gradient(160deg, #FFFFFF, #E8F1FF); border-color: var(--line); box-shadow: 0 6px 0 #AEB8E2, 0 20px 30px -12px rgb(1 26 81 / .3); }

/* ---------- شاشة الأسئلة ---------- */
.screen--quiz { max-width: 860px; margin: 0 auto; }
.quiz-head {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 22px 14px 18px;
  border-radius: 24px;
  margin-bottom: 22px;
}
.quiz-meta { display: flex; flex-direction: column; line-height: 1.5; min-width: 0; }
.count-label { font-weight: 800; font-size: clamp(1.15rem, 2.6vw, 1.4rem); }
.answered-line { font-weight: 600; color: var(--text); }
.answered-sub { font-size: .82rem; color: var(--text-2); }

/* المؤشر الدائري */
.pring {
  --ring-color: rgb(210 1 27);
  position: relative; flex: none;
  width: 104px; height: 104px;
  border-radius: 50%;
  transform-style: preserve-3d;
  background:
    radial-gradient(circle at 35% 28%, rgb(255 255 255 / .16), transparent 55%),
    radial-gradient(circle at 50% 60%, rgb(5 7 32 / .6), rgb(5 7 32 / .15) 70%);
  box-shadow:
    0 18px 30px -14px rgb(0 0 0 / .65),
    0 0 34px -10px var(--ring-color),
    inset 0 2px 1px rgb(255 255 255 / .14),
    inset 0 -6px 14px rgb(0 0 0 / .4);
}
:root[data-theme="light"] .pring {
  background: radial-gradient(circle at 35% 28%, #FFFFFF, #E8F1FF 75%);
  box-shadow: 0 16px 26px -14px rgb(1 26 81 / .45), 0 0 30px -12px var(--ring-color), inset 0 2px 1px #FFFFFF, inset 0 -6px 12px rgb(1 26 81 / .1);
}
.pring-svg { width: 100%; height: 100%; transform: rotate(0deg); overflow: visible; }
.pring-base { fill: none; stroke: rgb(0 0 0 / .35); stroke-width: 12; transform: translateY(1.5px); }
:root[data-theme="light"] .pring-base { stroke: rgb(1 26 81 / .08); }
.pring-track { fill: none; stroke: rgb(255 255 255 / .1); stroke-width: 10; }
:root[data-theme="light"] .pring-track { stroke: rgb(1 26 81 / .1); }
.pring-arc, .pring-glow {
  fill: none; stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 100 100; stroke-dashoffset: 100;
  transform: rotate(-90deg); transform-origin: 60px 60px;
}
.pring-arc { stroke: url(#pringGrad); }
.pring-glow { stroke-width: 12; opacity: .55; }
.pring-head { stroke: #FFFFFF; stroke-width: 2.4; opacity: 0; transition: opacity .3s; filter: drop-shadow(0 0 4px rgb(255 255 255 / .6)); }
.pring-center {
  position: absolute; inset: 0;
  display: flex; align-items: baseline; justify-content: center; padding-top: 30px;
  direction: ltr;
  font-family: "Segoe UI", var(--font-head);
  font-variant-numeric: tabular-nums;
}
.pring-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.pring-of { font-size: .95rem; font-weight: 600; color: var(--text-2); }

/* بطاقة السؤال بطبقات */
.card-stack { position: relative; perspective: 1400px; isolation: isolate; }
.card-layer {
  position: absolute; z-index: -1; inset-inline: 22px; bottom: -12px; height: 32px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}
.card-layer.layer-2 { inset-inline: 44px; bottom: -24px; opacity: .6; }
.q-card { position: relative; padding: clamp(20px, 4vw, 40px); transform-origin: center; background: color-mix(in srgb, var(--bg) 78%, transparent); }
.q-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q-legend { padding: 0; display: block; width: 100%; }
.topic-chip {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: .85rem; font-weight: 700;
  color: #F4EAFB;
  background: rgb(138 34 201 / .22);
  border: 1px solid rgb(138 34 201 / .45);
}
:root[data-theme="light"] .topic-chip { color: var(--violet-deep); background: #F4EAFB; border-color: rgb(106 27 168 / .25); }
.q-text {
  display: block;
  font-size: clamp(1.25rem, 3.2vw, 1.6rem);
  font-weight: 700;
  line-height: 1.75;
}
.options { display: grid; gap: 12px; margin-top: 24px; }
.option {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s, background-color .2s, transform .2s var(--ease), box-shadow .25s var(--ease);
}
.option:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.option-key {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-weight: 800;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background-color .2s, color .2s, border-color .2s;
}
.option-text { flex: 1; font-family: var(--font-body); font-size: 1.1rem; line-height: 1.7; font-weight: 500; }
.option-check {
  flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--border-strong);
  transition: background-color .2s, border-color .2s, transform .25s var(--ease);
}
.option-check svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .3s var(--ease) .05s; }
.option:has(input:checked) {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgb(138 34 201 / .26), rgb(21 112 255 / .12));
  box-shadow: 0 14px 30px -16px rgb(138 34 201 / .8), 0 0 0 1px var(--accent) inset;
}
:root[data-theme="light"] .option:has(input:checked) { background: linear-gradient(135deg, #F4EAFB, #E8F1FF); }
.option:has(input:checked) .option-key { background: var(--accent); border-color: var(--accent); color: #fff; }
.option:has(input:checked) .option-check { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.option:has(input:checked) .option-check svg { stroke-dashoffset: 0; }
.option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }

.q-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 40px; }
.dots { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.dot-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: "Segoe UI", var(--font-head);
  font-size: .85rem; font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  transition: all .2s var(--ease);
  position: relative;
}
.dot-btn::after { content: ""; position: absolute; inset: -6px; } /* منطقة لمس أكبر */
.dot-btn:hover { border-color: var(--border-strong); color: var(--text); }
.dot-btn.is-answered { color: var(--text); background: rgb(138 34 201 / .3); border-color: rgb(138 34 201 / .6); }
:root[data-theme="light"] .dot-btn.is-answered { background: #F4EAFB; border-color: rgb(106 27 168 / .35); color: var(--violet-deep); }
.dot-btn.is-current { color: #fff; background: var(--grad-primary); border-color: transparent; transform: translateY(-2px); box-shadow: 0 8px 18px -8px rgb(138 34 201 / .9); }

.submit-bar {
  margin-top: 20px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  border: 1px dashed var(--border-strong);
}
.submit-hint { margin: 0; color: var(--text-2); font-size: .95rem; }
.btn--submit { color: var(--text-2); background: var(--surface); border-color: var(--border); }
.btn--submit[aria-disabled="true"] { cursor: not-allowed; opacity: .7; }
.btn--submit.is-ready {
  color: #fff; background: var(--grad-primary); opacity: 1; cursor: pointer;
  box-shadow: 0 14px 30px -12px rgb(138 34 201 / .8);
  animation: ready 2.4s ease-in-out infinite;
}
@keyframes ready { 50% { box-shadow: 0 14px 34px -8px rgb(138 34 201 / .95), 0 0 0 6px rgb(138 34 201 / .14); } }

/* ---------- النتيجة ---------- */
.result-hero {
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  gap: clamp(20px, 5vw, 56px);
  padding: clamp(22px, 5vw, 48px);
}
.ring-wrap { position: relative; width: clamp(190px, 26vw, 250px); aspect-ratio: 1; perspective: 800px; }
.ring { width: 100%; height: 100%; filter: drop-shadow(0 18px 30px rgb(138 34 201 / .45)); }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 14; }
.ring-value {
  fill: none; stroke: url(#ringGrad); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 100 100; stroke-dashoffset: 100;
  transform: rotate(-90deg); transform-origin: 100px 100px;
}
.ring-center {
  position: absolute; inset: 16%;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / .14), transparent 60%), var(--surface);
  box-shadow: inset 0 2px 1px rgb(255 255 255 / .12), inset 0 -10px 20px rgb(0 0 0 / .25);
  direction: ltr;
  font-family: "Segoe UI", var(--font-head);
  font-variant-numeric: tabular-nums;
}
.ring-score { font-size: clamp(2.4rem, 5vw, 3.2rem); font-weight: 800; line-height: 1; }
.ring-total { font-size: .45em; color: var(--text-2); font-weight: 700; }
.ring-percent { margin-top: 6px; font-weight: 700; color: var(--text-2); }
.result-title { margin: 0; font-size: clamp(1.9rem, 4.4vw, 2.8rem); font-weight: 800; line-height: 1.35; }
.result-note { margin: 6px 0 0; font-family: var(--font-body); font-size: 1.1rem; color: var(--text-2); }
.result-stats { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.stat { min-width: 120px; padding: 10px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; line-height: 1.5; }
.stat strong { font-size: 1.5rem; font-weight: 800; font-family: "Segoe UI", var(--font-head); }
.stat span { font-size: .85rem; color: var(--text-2); }
.stat--ok strong { color: var(--ok); }
.stat--bad strong { color: var(--bad); }

.review { margin-top: 40px; }
.review-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.review-title { margin: 0; font-size: 1.5rem; font-weight: 800; outline: none; scroll-margin-top: 20px; }
.segmented { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.seg { min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 700; cursor: pointer; transition: all .2s; }
.seg.is-active { background: var(--surface-2); color: var(--text); box-shadow: 0 4px 12px -6px rgb(0 0 0 / .4); }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.review-item { padding: 20px 22px; border-radius: var(--r-md); border-inline-start: 4px solid var(--ok); }
.review-item.is-bad { border-inline-start-color: var(--bad); }
.review-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.review-num { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); font-family: "Segoe UI", var(--font-head); }
.review-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; color: var(--ok); background: var(--ok-bg); }
.review-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.is-bad .review-badge { color: var(--bad); background: var(--bad-bg); }
.review-topic { margin-inline-start: auto; font-size: .82rem; color: var(--text-2); }
.review-q { margin: 12px 0 10px; font-weight: 700; font-size: 1.08rem; line-height: 1.75; }
.review-answers { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ans { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 8px 12px; border-radius: 12px; font-family: var(--font-body); font-size: 1.02rem; }
.ans--correct { background: var(--ok-bg); }
.ans--wrong { background: var(--bad-bg); }
.ans-tag { font-family: var(--font-head); font-size: .78rem; font-weight: 700; padding: 0 8px; border-radius: 6px; }
.ans--correct .ans-tag { color: var(--ok); border: 1px solid currentColor; }
.ans--wrong .ans-tag { color: var(--bad); border: 1px solid currentColor; }
.ans-letter { font-family: var(--font-head); font-weight: 800; min-width: 1.6em; text-align: center; border-radius: 6px; background: var(--surface-2); }
.review-exp { margin: 12px 0 0; font-family: var(--font-body); color: var(--text-2); line-height: 1.9; }
.review-exp strong { font-family: var(--font-head); color: var(--text); font-weight: 700; }
.review-empty { text-align: center; color: var(--text-2); padding: 24px; }

.error-card { padding: 32px; text-align: center; max-width: 560px; margin: 40px auto; }
.noscript { text-align: center; padding: 24px; }

/* ---------- الحوار ---------- */
.sheet {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 40px 80px -20px rgb(0 0 0 / .7);
}
.sheet::backdrop { background: rgb(5 7 32 / .6); backdrop-filter: blur(6px); }
.sheet[open] { animation: sheetIn .35s var(--ease); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.sheet-inner { padding: 26px; background: linear-gradient(160deg, rgb(138 34 201 / .14), transparent 60%); }
.sheet h2 { margin: 0 0 8px; font-size: 1.35rem; }
.sheet p { margin: 0; font-family: var(--font-body); color: var(--text-2); line-height: 1.9; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* ---------- التذييل ---------- */
.footer {
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
  padding: 20px 0 28px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
  font-size: .85rem; color: var(--text-2);
  border-top: 1px solid var(--border);
}

/* ---------- الاستجابة ---------- */
@media (max-width: 900px) {
  .screen--welcome { grid-template-columns: 1fr; }
  .hero-visual { order: -1; min-height: 0; height: 250px; }
  .hero-tilt { width: min(320px, 76%); }
  .k2 { inset-inline-end: -4%; top: 30%; }
}
@media (max-width: 640px) {
  .topbar { margin-top: 12px; }
  .logo-plate { padding: 6px 8px; border-radius: 12px; }
  .logo-plate img { width: 120px; }
  .brand-sub { display: none; }
  .brand-title { font-size: .92rem; }
  .cta-row .btn { flex: 1 1 100%; }
  .facts { gap: 8px; }
  .facts li { padding: 8px 12px; gap: 6px; }
  .facts strong { font-size: 1.2rem; }
  .facts span { font-size: .82rem; }
  .quiz-head { gap: 14px; padding: 12px 14px; }
  .pring { width: 88px; height: 88px; }
  .pring-center { padding-top: 26px; }
  .pring-num { font-size: 1.7rem; }
  .answered-sub { display: none; }
  .q-nav { flex-wrap: wrap; margin-top: 36px; }
  .dots { order: -1; width: 100%; gap: 5px; flex-wrap: nowrap; }
  .dots li { flex: 1 1 0; max-width: 34px; }
  .dot-btn { width: 100%; height: 32px; font-size: .8rem; border-radius: 9px; }
  .dot-btn::after { inset: -6px -2px; }
  .q-nav .btn { flex: 1; }
  .option { min-height: 58px; padding: 10px 12px; gap: 12px; }
  .option-key { width: 36px; height: 36px; }
  .option-text { font-size: 1.04rem; }
  .submit-bar .btn { width: 100%; }
  .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .result-hero .eyebrow { margin-inline: auto; }
  .result-stats { justify-content: center; }
  .stat { min-width: 0; flex: 1; }
  .review-topic { margin-inline-start: 0; width: 100%; }
}
@media (max-width: 380px) {
  .card-layer { display: none; }
}

/* ---------- الحركة المخفّضة ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .orb { animation: none; }
  .hero-tilt { animation: none; }
}

/* نص الأخطاء الصغير: أبيض على إطار أحمر في الوضع الداكن لضمان التباين */
:root:not([data-theme="light"]) .is-bad .review-badge,
:root:not([data-theme="light"]) .ans--wrong .ans-tag { color: var(--text); box-shadow: inset 0 0 0 1px var(--bad); }
:root:not([data-theme="light"]) .ans--wrong .ans-tag { border-color: var(--bad); }

/* =========================================================
   منصة الاختبارات — إضافات لوحة الجلسات (لا تغيّر مكونات الاختبار)
   ========================================================= */
.top-actions { display: flex; align-items: center; gap: 10px; }
.btn--sm { --h: 48px; padding: 0 16px; font-size: .95rem; border-radius: 14px; }
.btn--sm .btn-icon { width: 18px; height: 18px; }

.screen--dashboard { display: grid; gap: 28px; }
.dash-hero {
  display: grid; grid-template-columns: 1.25fr .75fr; align-items: center;
  gap: clamp(20px, 4vw, 48px);
  padding: clamp(22px, 4.5vw, 48px);
}
.display--dash { font-size: clamp(1.9rem, 4.4vw, 3rem); }
.dash-meter { display: grid; justify-items: center; gap: 18px; }
.pring--xl { width: clamp(170px, 20vw, 210px); height: clamp(170px, 20vw, 210px); }
.pring--xl .pring-arc, .pring--xl .pring-glow { stroke-width: 9; }
.pring-center--stack { flex-direction: column; align-items: center; justify-content: center; padding-top: 0; gap: 2px; }
.pring-line { display: flex; align-items: baseline; }
.pring--xl .pring-num { font-size: clamp(2.6rem, 5vw, 3.2rem); }
.pring--xl .pring-of { font-size: 1.1rem; }
.pring-cap { direction: rtl; font-family: var(--font-head); font-size: .82rem; font-weight: 600; color: var(--text-2); }
.dash-stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.dash-stats li { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); line-height: 1.45; }
.dash-stats strong { font-size: 1.3rem; font-weight: 800; font-family: "Segoe UI", var(--font-head); }
.dash-stats span { font-size: .76rem; color: var(--text-2); }

.dash-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.dash-h2 { margin: 0; font-size: 1.5rem; font-weight: 800; }
.session-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px;
}
.s-card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  min-height: 112px; height: 100%;
  padding: 16px 18px;
  border-radius: var(--r-md);
  color: inherit; text-decoration: none;
  transition: transform .25s var(--ease), border-color .2s, box-shadow .3s var(--ease), background-color .2s;
}
.s-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 22px 40px -22px rgb(138 34 201 / .8); }
.s-card:active { transform: translateY(-1px) scale(.99); }
.s-num {
  flex: none;
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  font-family: "Segoe UI", var(--font-head); font-weight: 800; font-size: 1.15rem;
  color: #FFFFFF;
  background: var(--grad-primary);
  box-shadow: 0 10px 20px -10px rgb(138 34 201 / .9), inset 0 1px 0 rgb(255 255 255 / .25);
}
.s-card[data-tone="new"] .s-num { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.s-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.55; }
.s-unit { font-size: .78rem; font-weight: 600; color: var(--text-2); }
.s-title { font-weight: 700; font-size: 1.02rem; }
.s-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .82rem; color: var(--text-2); }
.s-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.s-card[data-tone="progress"] .s-dot { background: var(--accent); box-shadow: 0 0 0 3px rgb(138 34 201 / .25); }
.s-card[data-tone="done"] .s-dot { background: var(--blue); }
.s-card[data-tone="perfect"] .s-dot { background: var(--cyan); box-shadow: 0 0 0 3px rgb(0 189 196 / .25); }
.s-ring { position: relative; flex: none; width: 46px; height: 46px; display: grid; place-items: center; }
.mini-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.mini-track { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.mini-arc { fill: none; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 100 100; transition: stroke-dashoffset .8s var(--ease); }
.s-ring-num { position: relative; font-family: "Segoe UI", var(--font-head); font-weight: 800; font-size: .9rem; }
.dash-foot { display: flex; justify-content: center; padding-top: 8px; }

.lede-label { font-family: var(--font-head); font-weight: 700; color: var(--text); }
.best-note {
  display: inline-block; margin: 14px 0 0; padding: 6px 14px;
  border-radius: 12px; font-size: .9rem; font-weight: 600;
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
}
.cta-row--sub { margin-top: 12px; }

@media (max-width: 900px) {
  .dash-hero { grid-template-columns: 1fr; }
  .dash-meter { order: -1; }
}
@media (max-width: 640px) {
  .top-actions .btn--sm span { display: none; }
  .top-actions .btn--sm { padding: 0; width: 48px; }
  .dash-stats strong { font-size: 1.1rem; }
  .cta-row--sub .btn { flex: 1 1 100%; }
  .s-card { min-height: 96px; padding: 14px; gap: 12px; }
  .s-num { width: 44px; height: 44px; font-size: 1rem; border-radius: 13px; }
}
@media (max-width: 430px) {
  .brand-text { display: none; }
}
