/* شاشة الدرس — «ورق + استوديو» (نوفمبر ٢٠٢٦). كل القواعد محصورة تحت body.lx3. */
/* ══ شاشة الدرس — «ورق + استوديو» على الصفحة الحقيقية (محلّي: /_p/modules?lx=3) ══
   ورقة قراءة في الوسط · فهرس مرقّم يحمل كل الوحدات · شريط سفلي واحد فيه مكانك والأدوات والزر.
   الفاتح والداكن من نفس الملف، يتبعان زرّ الثيم الموجود في السايدبار (html.light).
   سلّم المسافات: ٤ · ٨ · ١٢ · ١٦ · ٢٤ · ٣٢ · ٤٨ · ٦٤. */

body.lx3 { --x-g: #0C0C0F; --x-s: #141417; --x-s2: #1B1B20; --x-line: #26262C; --x-ink: #F4F4F6; --x-body: #D2D2DA; --x-mut: #9A9AA6; --x-faint: #74747F;
  --x-vio: #A78BFA; --x-vioH: #B79CFF; --x-tint: rgba(167,139,250,.12); --x-tint2: rgba(167,139,250,.22); --x-on: #17102B; --x-bar: #101013;
  background: var(--x-g) !important; }
html.light body.lx3 { --x-g: #F4EFFD; --x-s: #FFFFFF; --x-s2: #F7F3FE; --x-line: #E7E0F7; --x-ink: #18181B; --x-body: #27272A; --x-mut: #52525B; --x-faint: #71717A;
  --x-vio: #6D28D9; --x-vioH: #7C3AED; --x-tint: #F4EFFD; --x-tint2: #DDD1F8; --x-on: #FFFFFF; --x-bar: #FFFFFF; }

body.lx3 #page-head, body.lx3 #lesson-progress, body.lx3 .to-top { display: none !important; }
body.lx3 #project-strip:empty, body.lx3 #book-strip:empty { display: none; }
/* الأزرار العائمة تبقى تعمل (يضغطها الشريط السفلي) لكنها ما تظهر فوق النص */
body.lx3 .tut-fab, body.lx3 .mb-fab { opacity: 0 !important; pointer-events: none !important; }
body.lx3 { padding-bottom: 0 !important; }

/* ═══ الشريط السفلي ═══ */
#lx3-bar { position: fixed; inset: auto 0 0 0; height: 56px; z-index: 60; display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--x-bar); border-top: 1px solid var(--x-line); font-size: 13.5px; font-weight: 700; color: var(--x-mut); }
#lx3-bar .pos { white-space: nowrap; font-variant-numeric: tabular-nums; }
#lx3-bar .rp { width: 160px; height: 5px; border-radius: 9px; background: var(--x-tint2); overflow: hidden; flex: none; }
#lx3-bar .rp i { display: block; height: 100%; width: 0; background: var(--x-vio); }
#lx3-bar .sp { flex: 1 1 0; min-width: 0; }
#lx3-bar .sp + .tl + .sp { flex: 1 1 0; }
@media (max-width: 1599px) { #lx3-bar .tl button span.t { display: none; } #lx3-bar .rp { width: 110px; } }
#lx3-bar .tl { display: flex; gap: 4px; }
#lx3-bar .tl button { height: 40px; min-width: 40px; padding: 0 10px; border-radius: 11px; display: inline-flex; align-items: center; gap: 7px; color: var(--x-mut);
  background: transparent; border: 0; cursor: pointer; font: inherit; position: relative; }
#lx3-bar .tl button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#lx3-bar .tl button:hover, #lx3-bar .tl button[aria-pressed="true"] { color: var(--x-vio); background: var(--x-tint); }
#lx3-bar .tl button[disabled] { opacity: .35; cursor: default; }
#lx3-bar .tl .n { font-size: 12px; min-width: 18px; padding: 1px 6px; border-radius: 99px; background: var(--x-tint2); color: var(--x-ink); }
#lx3-bar .tl .n:empty { display: none; }
#lx3-bar .nx { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--x-ink); }
#lx3-bar .nx small { color: var(--x-faint); font-weight: 500; margin-inline-end: 8px; font-size: 12.5px; }
#lx3-bar .nx[hidden] { display: none; }
#lx3-bar .lx-actions { gap: 8px; flex-wrap: nowrap; flex: none; }
#lx3-bar .lx-actions .lx-grow { display: none; }
#lx3-bar .lx-actions .btn { min-height: 40px !important; height: 40px; padding: 0 14px !important; border-radius: 11px; font-size: 13.5px !important; white-space: nowrap; box-shadow: none; }
#lx3-bar .lx-actions .btn-primary { background: var(--x-vio) !important; color: var(--x-on) !important; padding: 0 20px !important; font-weight: 800; border: 0; }
#lx3-bar .lx-actions .btn-secondary { background: transparent; border-color: transparent; color: var(--x-mut); }
#lx3-bar .lx-actions .btn-secondary:hover { color: var(--x-ink); background: var(--x-tint); }
#lx3-bar .lx-actions .btn[disabled] { opacity: .35; }
#lx3-bar button:focus-visible { outline: 2px solid var(--x-vio); outline-offset: 2px; }
body.lx3 #module-footer { display: none !important; }

@media (min-width: 1024px) {
  html[dir="rtl"] #lx3-bar { right: 260px; }
  html:not([dir="rtl"]) #lx3-bar { left: 260px; }
  body.lx3.focus-mode #lx3-bar { right: 0; left: 0; }

  /* ═══ الشبكة ═══ */
  body.lx3 #content-grid { display: grid !important; grid-template-columns: 312px minmax(0, 1fr); justify-content: stretch; align-items: start; }
  body.lx3 #content-grid:has(#lesson-rail.on) { grid-template-columns: 312px minmax(0, 1fr) 230px; }
  body.lx3.focus-mode #content-grid { display: block !important; }

  /* ═══ الفهرس ═══ */
  body.lx3 #outline-wrap { position: sticky; top: 0; height: calc(100vh - 56px) !important; padding: 24px 12px 24px !important;
    border-inline-end: 1px solid var(--x-line) !important; border-right-color: var(--x-line); background: transparent; }
  body.lx3 #lesson-rail { top: 0; height: calc(100vh - 56px) !important; padding: 32px 12px !important; }

  /* ═══ الورقة ═══ */
  body.lx3 #content-col { justify-self: center; width: calc(100% - 64px); max-width: 860px !important; margin: 32px 0 104px; padding: 0 0 56px !important;
    background: var(--x-s); border: 1px solid var(--x-line); border-radius: 26px; }
  body.lx3 #content-col > * { max-width: none; }
  body.lx3 #module-content { padding: 0 56px; }
  body.lx3 #content-col > :is(#project-strip, #book-strip) { margin: 24px 56px 0 !important; }
  body.lx3.focus-mode #content-col { margin: 48px auto 104px; padding-top: 0 !important; }
}

/* ── الفهرس: رأس، بحث، وحدات، ودروس مرقّمة ── */
body.lx3 #outline-wrap > p { font-size: 13px !important; font-weight: 700; color: var(--x-vio) !important; text-transform: none; padding: 0 10px; margin-bottom: 12px; }
body.lx3 #outline-search { height: 40px; border-radius: 12px; background: var(--x-s) !important; border-color: var(--x-line) !important; font-size: 13.5px !important; color: var(--x-ink); }
/* عمود مرن لا شبكة: عناصر الشبكة تتمدّد لعرض نصّها غير الملتفّ فتخرج من العمود وتنقصّ */
body.lx3 #outline-tree { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
body.lx3 #outline-tree > *, body.lx3 #outline-tree .lesson-item { min-width: 0; max-width: 100%; }
body.lx3 #outline-tree > * { margin: 0 !important; }
body.lx3 .outline-item { padding: 11px 10px !important; border-radius: 12px !important; gap: 10px !important; font-size: 14.5px !important; font-weight: 700; color: var(--x-mut) !important; background: transparent !important; }
body.lx3 .outline-item:hover { background: var(--x-tint) !important; }
body.lx3 .outline-item[class*="bg-primary"] { color: var(--x-ink) !important; font-weight: 800; }
body.lx3 .outline-item > span:first-child { width: 26px !important; height: 26px !important; font-size: 12.5px !important; font-weight: 800; border-color: var(--x-line); }
body.lx3 .outline-item[class*="bg-primary"] > span:first-child { background: var(--x-vio); border-color: var(--x-vio); color: var(--x-on) !important; }
body.lx3 .outline-item > span:last-child:not(.flex-1) { font-size: 12.5px !important; padding: 2px 8px; border-radius: 8px; background: var(--x-s2); border-color: transparent; color: var(--x-faint); }
/* دروس الوحدة الحالية */
body.lx3 #outline-tree > div { padding: 0 !important; margin: 0 0 8px !important; border: 0 !important; counter-reset: lx; }
body.lx3 #outline-tree > div > p { font-size: 12.5px !important; font-weight: 700; color: var(--x-faint) !important; text-transform: none; padding: 12px 10px 4px !important; margin: 0 !important; }
body.lx3 #mobile-lessons { counter-reset: lx; }
body.lx3 .lesson-item { counter-increment: lx; align-items: flex-start; gap: 10px !important; padding: 10px !important; border-radius: 12px !important; }
body.lx3 .lesson-item::before { content: counter(lx); flex: none; width: 26px; text-align: center; font-size: 13.5px; font-weight: 800; color: var(--x-faint); padding-top: 1px; font-variant-numeric: tabular-nums; }
body.lx3 .lesson-item > span:first-child { order: 3; margin-top: 2px; }
body.lx3 .lesson-item:hover { background: var(--x-tint) !important; }
body.lx3 .lesson-item[class*="bg-primary"] { background: var(--x-tint) !important; }
body.lx3 .lesson-item[class*="bg-primary"]::before { color: var(--x-vio); }
body.lx3 .lesson-item .lesson-title { font-size: 14.5px !important; line-height: 1.6 !important; color: var(--x-mut) !important; }
body.lx3 .lesson-item[class*="bg-primary"] .lesson-title { color: var(--x-ink) !important; font-weight: 700; }
body.lx3 .lesson-item .lesson-title + span { font-size: 12.5px !important; color: var(--x-faint) !important; margin-top: 2px; }

/* ── افتتاحية الدرس ── */
.lx3-hero { padding: 64px 0 28px; margin-bottom: 32px; border-bottom: 1px solid var(--x-line); }
.lx3-hero > * { max-width: 680px; margin-inline: auto !important; }
.lx3-hero .lx-crumb { font-size: 14.5px !important; font-weight: 700; color: var(--x-vio) !important; margin-bottom: 16px !important; display: block; white-space: normal; }
.lx3-hero .lx-crumb > span { color: inherit !important; max-width: none !important; white-space: normal; display: inline; unicode-bidi: plaintext; }
.lx3-hero .lx-title { font-size: clamp(32px, 3.4vw, 48px); line-height: 1.32; font-weight: 900; color: var(--x-ink); max-width: 680px; margin-bottom: 16px; }
.lx3-hero .lx-title em { font-style: normal; color: var(--x-vioH); }
.lx3-hero .lx-meta { display: flex; font-size: 14.5px; color: var(--x-mut); }

/* ── جسم الدرس: محور واحد ٦٨٠، والكتل العريضة بعرض الورقة ── */
body.lx3 [data-hl-root] { margin-top: 0 !important; }
body.lx3 [data-hl-root] > * { margin-inline: auto !important; max-width: min(100%, 680px) !important; }
body.lx3 [data-hl-root] > :is(figure, :has(table), :has(pre), :has(figure), :has(svg:not(.ic)), :has(video), :has(iframe)):not(.lx-callout) { max-width: 100% !important; }
body.lx3 [data-hl-root] > * + * { margin-top: 24px !important; }
body.lx3 [data-hl-root] > p { font-size: 18px; line-height: 2.08; color: var(--x-body) !important; }
body.lx3 [data-hl-root] > h3 { font-size: 26px; line-height: 1.45; font-weight: 900; color: var(--x-ink); padding-top: 0; margin-top: 48px !important; }
body.lx3 [data-hl-root] p { max-width: none; }
body.lx3 [data-hl-root] .lx-callout { border: 0; background: color-mix(in srgb, var(--c) 11%, transparent); border-radius: 18px; padding: 20px 22px; gap: 14px;
  grid-template-columns: 34px minmax(0, 1fr); font-size: 16.5px; line-height: 2; color: var(--x-body); }
body.lx3 [data-hl-root] .lx-callout .ic { width: 34px; height: 34px; border-radius: 11px; background: color-mix(in srgb, var(--c) 20%, transparent); }
body.lx3 [data-hl-root] .lx-callout.lx-info, body.lx3 [data-hl-root] .lx-callout.lx-src { --c: var(--x-vio); }
html.light body.lx3 [data-hl-root] .lx-callout.lx-info, html.light body.lx3 [data-hl-root] .lx-callout.lx-src { background: var(--x-tint); }
html.light body.lx3 [data-hl-root] .lx-callout.lx-info .ic, html.light body.lx3 [data-hl-root] .lx-callout.lx-src .ic { background: var(--x-tint2); }
/* ما بعد جسم الدرس (بطاقة PDF، ورقة الدرس، المراجع، الاختبار، التطبيق) على نفس المحور */
body.lx3 #module-content > :not(.lx3-hero):not([data-hl-root]) { max-width: 680px; margin-inline: auto; }

/* ── الجوال ── */
@media (max-width: 1023px) {
  body.lx3 #content-col { padding-bottom: 96px !important; }
  .lx3-hero { padding: 28px 0 22px; margin-bottom: 24px; }
  .lx3-hero .lx-title { font-size: 28px; }
  body.lx3 [data-hl-root] > p { font-size: 16.5px; line-height: 2; }
  body.lx3 [data-hl-root] > h3 { font-size: 21px; margin-top: 36px !important; }
  body.lx3 [data-hl-root] .lx-callout { font-size: 15.5px; padding: 16px; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
  body.lx3 #module-select { display: none; }
  body.lx3 #mobile-lessons-wrap { position: sticky; top: 64px; z-index: 45; margin: 0 -20px 0 !important; border-radius: 0 !important; border-inline: 0 !important; background: var(--x-g) !important; }
  body.lx3 #mobile-lessons-wrap > summary { min-height: 52px; position: relative; }
  body.lx3 #mobile-lessons-wrap .lx3-sum { display: grid; gap: 1px; text-align: start; min-width: 0; }
  body.lx3 #mobile-lessons-wrap .lx3-sum b { font-size: 14.5px; color: var(--x-ink); }
  body.lx3 #mobile-lessons-wrap .lx3-sum small { font-size: 12.5px; color: var(--x-mut); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
  body.lx3 #mobile-lessons-wrap[open] { position: fixed; inset: 16vh 0 56px 0; margin: 0 !important; z-index: 58; overflow-y: auto; border-radius: 22px 22px 0 0 !important;
    background: var(--x-s) !important; box-shadow: 0 -24px 70px rgba(0,0,0,.5); }
  #lx3-bar { padding: 0 10px; gap: 6px; }
  #lx3-bar .pos, #lx3-bar .rp, #lx3-bar .nx, #lx3-bar .sp:first-of-type { display: none; }
  #lx3-bar .tl button span.t { display: none; }
  #lx3-bar .lx-actions .btn-primary { padding: 0 14px !important; }
  #lx3-bar .lx-actions #prev-btn .nav-label { display: none; }
}
@media (pointer: coarse) { #lx3-bar .tl button, #lx3-bar .lx-actions .btn { min-height: 44px !important; height: 44px; min-width: 44px; } }

/* ── ضبط أحجام ما داخل الدرس: قوائم، جداول، اختبار، تطبيق عملي (كانت ١٣–١٤٫٥ على ورقة نصّها ١٨) ── */
body.lx3 [data-hl-root] li { font-size: 16px; line-height: 1.95; }
body.lx3 [data-hl-root] div p:not(.font-extrabold):not(.font-bold) { font-size: 16px; line-height: 1.95; }
body.lx3 [data-hl-root] th[class], body.lx3 [data-hl-root] td[class] { font-size: 15px; line-height: 1.8; padding-block: 14px; }
body.lx3 [data-hl-root] figcaption[class], body.lx3 [data-hl-root] > p[class*="text-xs"], body.lx3 [data-hl-root] > p[class*="text-[1"] { font-size: 14px; }
body.lx3 #quiz-wrap { display: grid; gap: 16px; }
body.lx3 #quiz-wrap > * { margin: 0 !important; }
body.lx3 #quiz-wrap p { font-size: 16.5px; line-height: 1.85; }
body.lx3 #quiz-wrap .quiz-opt { font-size: 15.5px; line-height: 1.8; padding: 14px 16px; border-radius: 14px; }
body.lx3 #module-content textarea, body.lx3 #module-content input[type="url"], body.lx3 #module-content input[type="text"] { font-size: 16px; line-height: 1.9; border-radius: 14px; }
/* عنوان مجموعة مكرّر لاسم الوحدة نفسها */
body.lx3 #outline-tree p.lx3-dup { display: none; }
/* الوحدات التالية: فاصل خفيف فوق كل وحدة بعد الأولى */
body.lx3 #outline-tree > .outline-item ~ .outline-item { margin-top: 2px !important; }
body.lx3 #outline-tree > div + .outline-item { margin-top: 10px !important; padding-top: 14px !important; border-top: 1px solid var(--x-line); border-radius: 0 0 12px 12px !important; }

/* أسماء الوحدات التالية: سطران بدل قصّها بثلاث نقاط */
body.lx3 .outline-item { align-items: flex-start !important; }
body.lx3 .outline-item .truncate { white-space: normal; overflow: hidden; text-overflow: clip; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.6; unicode-bidi: plaintext; text-align: start; }

@media (max-width: 1023px) {
  body.lx3 #content-col { padding-top: 0 !important; }
  .lx3-hero .lx-crumb { display: none !important; }          /* الشريط فوقه يقول نفس الشي */
  .lx3-hero { padding-top: 24px; }
  #lx3-bar .tl [data-a="fc"] { display: none; }               /* ٠ استخدام للتركيز على الجوال */
  #lx3-bar .lx-actions { flex: 1 1 auto; justify-content: flex-end; min-width: 0; }
  #lx3-bar .lx-actions #next-btn .nav-label { display: none; }
  #lx3-bar .lx-actions #next-btn.lx-main .nav-label, #lx3-bar .lx-actions #next-btn:not(.lx-quiet) .nav-label { display: inline; }
  #lx3-bar .lx-actions .btn { padding: 0 10px !important; }
  #lx3-bar .lx-actions .btn-primary { padding: 0 14px !important; flex: 0 1 auto; min-width: 0; }
}

/* ══════════ الجولة ٢: الأدوات فوق + ملء المساحة ══════════ */
/* الشريط السفلي صار للتنقّل فقط */
#lx3-bar { gap: 14px; }
#lx3-bar .nx { max-width: none; font-size: 14px; }
#lx3-bar .nx small { font-size: 12.5px; }

/* ── الشريط العلوي: مكانك + الأدوات الثلاث ── */
#lx3-top { position: sticky; top: 0; z-index: 50; height: 60px; display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: color-mix(in srgb, var(--x-g) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--x-line); font-size: 14px; font-weight: 700; color: var(--x-mut); }
#lx3-top .pos { white-space: nowrap; color: var(--x-ink); font-variant-numeric: tabular-nums; }
#lx3-top .rp { width: clamp(120px, 16vw, 280px); height: 5px; border-radius: 9px; background: var(--x-tint2); overflow: hidden; flex: none; }
#lx3-top .rp i { display: block; height: 100%; width: 0; background: var(--x-vio); }
#lx3-top .sp { flex: 1 1 0; }
body.lx3.focus-mode #lx3-top { position: fixed; inset: 0 0 auto 0; }
.tl { display: flex; gap: 6px; align-items: center; }
.tl button { height: 42px; padding: 0 14px 0 12px; border-radius: 13px; display: inline-flex; align-items: center; gap: 8px; color: var(--x-mut);
  background: var(--x-s); border: 1px solid var(--x-line); cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 700; }
.tl button .g { display: grid; place-items: center; width: 20px; height: 20px; color: var(--x-vio); }
.tl button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tl button:hover, .tl button[aria-pressed="true"] { color: var(--x-ink); border-color: var(--x-vio); background: var(--x-tint); }
.tl button[disabled] { opacity: .4; cursor: default; }
.tl button:focus-visible { outline: 2px solid var(--x-vio); outline-offset: 2px; }
.tl .n { font-size: 12px; min-width: 18px; padding: 1px 6px; border-radius: 99px; background: var(--x-tint2); color: var(--x-ink); }
.tl .n:empty { display: none; }
/* كل دقيقة ونص الأيقونات تلفّ لفّة وحدة، وحدة ورا الثانية — تذكير هادئ بوجودها */
@keyframes lx3-turn { 0%, 98.6% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
.tl button .g { animation: lx3-turn 90s cubic-bezier(.5, 0, .2, 1) infinite; }
.tl button:nth-child(2) .g { animation-delay: .22s; }
.tl button:nth-child(3) .g { animation-delay: .44s; }
@media (prefers-reduced-motion: reduce) { .tl button .g { animation: none; } }

/* ── العمود الجانبي: محطات الدرس + الدرس التالي ── */
#lx3-aside { display: none; }
#lx3-aside h4 { font-size: 13px; font-weight: 700; color: var(--x-vio); margin: 0 0 10px; padding: 0 12px; }
#lx3-aside nav { display: grid; gap: 2px; margin-bottom: 24px; }
#lx3-aside nav a { display: block; padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 1.65; color: var(--x-mut); text-decoration: none; border-inline-start: 2px solid transparent; }
#lx3-aside nav a:hover { color: var(--x-ink); background: var(--x-tint); }
#lx3-aside nav a.on { color: var(--x-ink); font-weight: 700; border-inline-start-color: var(--x-vio); background: var(--x-tint); border-start-start-radius: 0; border-end-start-radius: 0; }
#lx3-aside .nxc { display: grid; gap: 4px; padding: 16px; border-radius: 16px; border: 1px solid var(--x-line); background: var(--x-s); cursor: pointer; text-decoration: none; }
#lx3-aside .nxc[hidden], #lx3-aside .st[hidden] { display: none; }
#lx3-aside .nxc:hover { border-color: var(--x-vio); }
#lx3-aside .nxc small { font-size: 12.5px; font-weight: 700; color: var(--x-vio); }
#lx3-aside .nxc b { font-size: 15.5px; line-height: 1.6; color: var(--x-ink); }
#lx3-aside .nxc span { font-size: 12.5px; color: var(--x-faint); display: inline-flex; gap: 6px; align-items: center; }

@media (min-width: 1024px) {
  /* الشبكة تملأ العرض: الفهرس يكبر مع الشاشة، والورقة تاخذ كل الباقي بدل ما تطفو في فراغ */
  body.lx3 #content-grid { grid-template-columns: clamp(300px, 21vw, 400px) minmax(0, 1fr) !important; }
  body.lx3 #outline-wrap { top: 60px; height: calc(100vh - 116px) !important; }
  body.lx3 #content-col { justify-self: stretch; width: auto; max-width: none !important; margin: 28px 28px 96px; }
  body.lx3 #module-content { padding: 0 clamp(40px, 5vw, 96px); }
  body.lx3 #content-col > :is(#project-strip, #book-strip) { margin: 24px clamp(40px, 5vw, 96px) 0 !important; }
  body.lx3 #lesson-rail { display: none !important; }
  body.lx3.focus-mode #content-col { margin: 92px auto 96px; max-width: 980px !important; }
}
/* العمود الجانبي يظهر فقط لما يبقى للورقة عرض قراءة كامل (على ١٥٣٦ كان يخنق النص إلى ٥٢٠px) */
@media (min-width: 1700px) {
  body.lx3 #content-grid { grid-template-columns: clamp(300px, 21vw, 400px) minmax(0, 1fr) clamp(260px, 16vw, 320px) !important; }
  body.lx3 #content-col { margin-inline-end: 0; }
  body.lx3 #lx3-aside { display: block; position: sticky; top: 60px; height: calc(100vh - 116px); overflow: auto; padding: 32px 20px 24px; }
  body.lx3.focus-mode #lx3-aside { display: none; }
}
@media (min-width: 1500px) {
  /* الشاشة الكبيرة تستاهل نصّاً أكبر وعموداً أعرض */
  .lx3-hero > *, .lx3-hero .lx-title { max-width: 760px; }
  body.lx3 [data-hl-root] > * { max-width: min(100%, 760px) !important; }
  body.lx3 [data-hl-root] > :is(figure, :has(table), :has(pre), :has(figure), :has(svg:not(.ic)), :has(video), :has(iframe)):not(.lx-callout) { max-width: 100% !important; }
  body.lx3 #module-content > :not(.lx3-hero):not([data-hl-root]) { max-width: 760px; }
  body.lx3 [data-hl-root] > p { font-size: 19px; }
  body.lx3 [data-hl-root] .lx-callout { font-size: 17.5px; }
  body.lx3 .lesson-item .lesson-title, body.lx3 .outline-item { font-size: 15.5px !important; }
  body.lx3 .lesson-item .lesson-title + span { font-size: 13px !important; }
}
@media (max-width: 1023px) {
  #lx3-top { display: none; }
  #mobile-lessons-wrap > summary .tl { margin-inline-start: auto; gap: 4px; }
  #mobile-lessons-wrap > summary .tl button { width: 44px; height: 44px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  #mobile-lessons-wrap > summary .tl .t, #mobile-lessons-wrap > summary .tl [data-a="fc"] { display: none; }
  #mobile-lessons-wrap > summary > i, #mobile-lessons-wrap > summary > svg { display: none; }
  #lx3-bar .nx { display: none; }
}

/* وضع التركيز: زرّ «تركيز» في الشريط العلوي هو نفسه زرّ الخروج، فالزرّ القديم يختفي والعدّاد يتوسّط الشريط */
body.lx3 #focus-exit { display: none !important; }
body.lx3 #focus-timer { top: 12px; right: auto; left: 50%; transform: translateX(-50%); z-index: 61; }

/* ══════════ الجولة ٣: سَبْر مدار · زوم التركيز · «ملاحظاتي» ══════════ */
/* ── سَبْر: مدار حيّ في الطرف الأيسر ── */
.tl { gap: 8px; }
.tl .orb-btn { height: 48px; padding: 0 8px 0 16px; gap: 10px; border-radius: 16px; margin-inline-start: 6px;
  border-color: color-mix(in srgb, var(--x-vio) 45%, var(--x-line));
  background: linear-gradient(120deg, color-mix(in srgb, var(--x-vio) 16%, var(--x-s)), var(--x-s) 70%); position: relative; overflow: visible; }
.tl .orb-btn::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--a, 0deg), transparent 0 70%, var(--x-vio) 85%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: lx3-sweep 4.5s linear infinite; }
@property --a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes lx3-sweep { to { --a: 360deg; } }
.tl .orb-btn .orb { width: 40px; height: 40px; flex: none; overflow: visible; transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
.tl .orb-btn .ring { stroke: color-mix(in srgb, var(--x-vio) 55%, transparent); }
.tl .orb-btn .moon { fill: var(--x-ink); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--x-vio) 80%, transparent)); }
.tl .orb-btn .t { display: grid !important; text-align: start; line-height: 1.25; }
.tl .orb-btn .t b { font-size: 14px; font-weight: 800; color: var(--x-ink); }
.tl .orb-btn .t small { font-size: 11.5px; font-weight: 500; color: var(--x-faint); }
.tl .orb-btn:hover { border-color: var(--x-vio); background: var(--x-tint); }
.tl .orb-btn:hover .orb { transform: scale(1.12) rotate(-8deg); }
.tl button:not(.orb-btn) .g { transition: transform .35s cubic-bezier(.3,1.5,.5,1); }
.tl button:not(.orb-btn):hover .g { transform: translateY(-2px) scale(1.1); }
@media (max-width: 1599px) { .tl .orb-btn .t small { display: none; } }
@media (prefers-reduced-motion: reduce) { .tl .orb-btn::before { animation: none; opacity: 0; } }
@media (max-width: 1023px) {
  #mobile-lessons-wrap > summary .tl .orb-btn { width: auto; height: 44px; padding: 0 4px; border: 0; background: transparent; margin: 0; }
  #mobile-lessons-wrap > summary .tl .orb-btn::before, #mobile-lessons-wrap > summary .tl .orb-btn .t { display: none !important; }
  #mobile-lessons-wrap > summary .tl .orb-btn .orb { width: 36px; height: 36px; }
}

/* ── وضع التركيز: الكلام يكبر من ١٠٠٪ إلى ١١٥٪ ── */
body.lx3 #module-content { transition: zoom .5s cubic-bezier(.2,.7,.2,1); }
body.lx3.focus-mode #module-content { zoom: 1.15; }
@media (min-width: 1024px) { body.lx3.focus-mode #content-col { max-width: 1080px !important; } }
@media (prefers-reduced-motion: reduce) { body.lx3 #module-content { transition: none; } }

/* ── «دفتري» بشكل الصفحة الجديدة + «ملاحظاتي» ── */
body.lx3 .mb-dr .pn { width: min(480px, 100%); background: var(--x-s) !important; border-color: var(--x-line) !important; font-family: inherit; }
body.lx3 .mb-dr .hd { padding: 20px 22px; border-color: var(--x-line); align-items: center; }
body.lx3 .mb-dr .hd h3 { font-family: inherit; font-size: 19px; font-weight: 900; line-height: 1.4; color: var(--x-ink); display: grid; gap: 2px; }
body.lx3 .mb-dr .hd h3 small { font-size: 12.5px; font-weight: 500; color: var(--x-faint); }
body.lx3 .mb-dr .tabs { padding: 14px 22px 0; gap: 6px; }
body.lx3 .mb-dr .tabs button { font-family: inherit; font-size: 13px; font-weight: 800; padding: 11px 6px; border-radius: 12px; border-color: var(--x-line); color: var(--x-mut); }
body.lx3 .mb-dr .tabs button.on { background: var(--x-tint); color: var(--x-ink); border-color: var(--x-vio); }
body.lx3 .mb-dr .bd { padding: 16px 22px 28px; }
body.lx3 .mb-it { border-color: var(--x-line); background: var(--x-s2); }
.nb-compose { border: 1px solid var(--x-line); border-radius: 18px; background: var(--x-s2); padding: 12px; display: grid; gap: 10px; }
.nb-compose:focus-within { border-color: var(--x-vio); box-shadow: 0 0 0 3px color-mix(in srgb, var(--x-vio) 18%, transparent); }
.nb-in { width: 100%; resize: vertical; min-height: 96px; border: 0; outline: 0; background: transparent; color: var(--x-ink); font-family: inherit; font-size: 15.5px; font-weight: 500; line-height: 1.9; padding: 4px 6px; }
.nb-in::placeholder { color: var(--x-faint); }
.nb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nb-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.nb-tag, .nb-chip { --tc: var(--x-vio); font-family: inherit; font-size: 12.5px; font-weight: 700; line-height: 1; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--x-line); background: transparent; color: var(--x-mut); cursor: pointer; }
.nb-tag[aria-checked="true"] { background: color-mix(in srgb, var(--tc) 16%, transparent); border-color: var(--tc); color: var(--x-ink); }
.t-idea { --tc: #A78BFA; } .t-q { --tc: #60A5FA; } .t-key { --tc: #F59E0B; } .t-later { --tc: #34D399; }
html.light .t-idea { --tc: #6D28D9; } html.light .t-q { --tc: #1D4ED8; } html.light .t-key { --tc: #B45309; } html.light .t-later { --tc: #047857; }
.nb-chip { cursor: default; padding: 5px 10px; font-size: 12px; background: color-mix(in srgb, var(--tc) 14%, transparent); border-color: transparent; color: var(--x-ink); }
.nb-link { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--x-mut); cursor: pointer; }
.nb-link input { accent-color: var(--x-vio); width: 16px; height: 16px; }
.nb-sp { flex: 1; }
.nb-save, .nb-cancel { height: 40px; padding: 0 16px; border-radius: 12px; font-family: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer; border: 0; }
.nb-save { background: var(--x-vio); color: var(--x-on); display: inline-flex; gap: 8px; align-items: center; }
.nb-save kbd { font-family: inherit; font-size: 11px; font-weight: 600; opacity: .7; direction: ltr; }
.nb-cancel { background: transparent; color: var(--x-mut); }
.nb-bar { display: grid; gap: 10px; margin: 20px 0 12px; }
.nb-q { height: 40px; border-radius: 12px; border: 1px solid var(--x-line); background: var(--x-s2); color: var(--x-ink); padding: 0 12px; font-family: inherit; font-size: 14px; outline: 0; }
.nb-q:focus { border-color: var(--x-vio); }
.nb-f { display: flex; gap: 6px; flex-wrap: wrap; }
.nb-f button { font-family: inherit; font-size: 12.5px; font-weight: 700; line-height: 1; padding: 8px 12px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--x-mut); cursor: pointer; }
.nb-f button.on { background: var(--x-tint); color: var(--x-ink); border-color: var(--x-line); }
.nb-list { display: grid; gap: 10px; }
.nb-card { border: 1px solid var(--x-line); border-radius: 16px; background: var(--x-s2); padding: 14px 16px; animation: nb-in .3s ease both; }
.nb-card.pin { border-color: color-mix(in srgb, #F59E0B 55%, var(--x-line)); }
@keyframes nb-in { from { opacity: 0; transform: translateY(6px); } }
.nb-card header, .nb-card footer { display: flex; align-items: center; gap: 8px; }
.nb-when { font-size: 12px; color: var(--x-faint); }
.nb-card header button { margin-inline-start: auto; background: none; border: 0; cursor: pointer; font-size: 18px; color: #F59E0B; width: 32px; height: 32px; border-radius: 9px; }
.nb-card p { margin: 10px 0 12px; font-size: 15px; line-height: 1.95; color: var(--x-body); overflow-wrap: anywhere; }
.nb-card footer button { background: none; border: 0; cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 700; line-height: 1; color: var(--x-mut); padding: 6px 8px; border-radius: 8px; }
.nb-card footer button:hover { background: var(--x-tint); color: var(--x-ink); }
.nb-go { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--x-vio) !important; text-align: start; }
.nb-free { font-size: 12.5px; color: var(--x-faint); }
.nb-empty { text-align: center; padding: 30px 12px; color: var(--x-mut); font-size: 14px; line-height: 1.9; }
.nb-empty b { display: block; color: var(--x-ink); font-size: 16px; margin-bottom: 6px; }
.nb-compose button:focus-visible, .nb-f button:focus-visible, .nb-card button:focus-visible, .nb-tag:focus-visible { outline: 2px solid var(--x-vio); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .nb-card { animation: none; } }

.nb-local { font-size: 12px; color: var(--x-faint); }
.nb-msg { font-size: 12.5px; font-weight: 700; color: var(--x-mut); }
.nb-err { margin-bottom: 12px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.8; color: var(--x-ink); background: color-mix(in srgb, #F59E0B 14%, transparent); border: 1px solid color-mix(in srgb, #F59E0B 40%, transparent); }
.nb-save[disabled] { opacity: .6; cursor: default; }
/* اسم الدرس الطويل في ذيل البطاقة (سطر واحد) كان يفرض عرضه على الشبكة فيمطّ البطاقات خارج الدرج */
.nb-list { grid-template-columns: minmax(0, 1fr); }
.nb-card, .nb-compose, .nb-bar { min-width: 0; }
.nb-card footer > * { min-width: 0; }
.nb-go { flex: 0 1 auto; }
.mb-dr.nb-mode .bd { overflow-x: hidden; }
