/* =========================================================
   بوابة الفيزياء — ملف التنسيقات (تصميم "المخطط الهندسي")
   ---------------------------------------------------------
   الفكرة: ورق مخططات أزرق بشبكة خفيفة، وخطوط بيضاء رفيعة،
   ولون تمييز واحد فقط (الأصفر) يُستخدم للنتائج والعناصر النشطة.

   معاني الألوان (لا تُستخدم لغير معناها):
     --signal  أصفر  ← النتيجة، الإجابة، الزر الرئيسي، العنصر النشط
     --pos     وردي  ← الشحنة الموجبة (+)
     --neg     سماوي ← الشحنة السالبة (−)
     --ok/--bad      ← الإجابة الصحيحة / الخاطئة والتحذير فقط

   الترتيب: المتغيرات ← الأساسيات ← الشريط والقوائم ← القائمة الجانبية (الجوال)
            ← الصفحة الرئيسية ← لوحة الدرس ← الاختبار ← المعادلات
            ← مكونات الدروس ← الجداول ← الأشكال ← المحاكيات
            ← معاني كلاسات الألوان والأدوات المساعدة ← الشاشات الصغيرة
   ========================================================= */

/* =========================================================
   الألوان: لوحتان لكل مظهر (ليلي/نهاري). ستّ لوحات بلونين متناسقين، يختار الطالب منها (js/theme.js)
   --d-*  ألوان المظهر الليلي للوحة المختارة، و--l-* ألوان المظهر النهاري.
   في المظهر النهاري تصير الصفحة فاتحة، وتبقى الأشكال والمحاكيات «شاشات مخبر» داكنة بألوان اللوحة نفسها
   (الجزر: ISL)، فكل الرسوم تبقى واضحة كما صُممت. و:root يبقى داكناً لأن المحاكيات ثلاثية الأبعاد تقرأ ألوانها منه
   ========================================================= */
:root {
    /* اللوحة الافتراضية: كحلي وذهبي */
    --d-bg: #0B2747; --d-bg-deep: #081D36; --d-sheet: #0E3155; --d-screen: #071A30;
    --d-signal: #FFC53D; --d-signal-hover: #FFD46E; --d-signal-ink: #0B2747; --d-signal-soft: rgba(255, 197, 61, 0.11);
    --d-hover-sheet: #123A63;
    --l-bg: #E9EEF4; --l-bg-deep: #FFFFFF; --l-sheet: #FFFFFF; --l-screen: #F2F5F9;
    --l-ink: #0B2035; --l-ink-soft: #33475D; --l-ink-muted: #56687C;
    --l-signal: #8F5F00; --l-signal-hover: #774E00; --l-signal-ink: #FFFFFF; --l-signal-soft: rgba(196, 134, 12, 0.13);
    --l-hover-sheet: #F1F5FA;
    --l-tint: 16, 38, 66;     /* لون الخطوط والشبكة في النهاري (RGB) */
    --d-signal-rgb: 255, 197, 61; --l-signal-rgb: 143, 95, 0;   /* لون التمييز بصيغة RGB للشفافيات: rgba(var(--signal-rgb), 0.4) */

    /* الخطوط (Fonts) */
    --font-display: 'Reem Kufi', 'Tajawal', sans-serif;
    --font-body: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Tajawal', ui-monospace, Menlo, monospace;

    /* المقاسات */
    --nav-h: 60px;
    --radius: 3px;
    --sheet-w: 1600px;        /* لوحة الدرس تملأ عرض الشاشة حتى هذا الحد */
}
:root[data-palette="teal"] {
    --d-signal-rgb: 46, 196, 182; --l-signal-rgb: 10, 111, 102;
    --d-bg: #0B2530; --d-bg-deep: #081C24; --d-sheet: #102F3B; --d-screen: #061820;
    --d-signal: #2EC4B6; --d-signal-hover: #5ED6CB; --d-signal-ink: #062027; --d-signal-soft: rgba(46, 196, 182, 0.12); --d-hover-sheet: #15394A;
    --l-bg: #E6F0F1; --l-ink: #08222B; --l-ink-soft: #2E4A54; --l-ink-muted: #516A73;
    --l-signal: #0A6F66; --l-signal-hover: #085A53; --l-signal-soft: rgba(46, 196, 182, 0.14); --l-hover-sheet: #F0F7F7; --l-tint: 10, 50, 60;
}
:root[data-palette="olive"] {
    --d-signal-rgb: 233, 196, 106; --l-signal-rgb: 122, 90, 12;
    --d-bg: #10281F; --d-bg-deep: #0C1E17; --d-sheet: #153327; --d-screen: #091912;
    --d-signal: #E9C46A; --d-signal-hover: #F1D48E; --d-signal-ink: #10281F; --d-signal-soft: rgba(233, 196, 106, 0.12); --d-hover-sheet: #1B3E30;
    --l-bg: #E9EFEA; --l-ink: #0E241B; --l-ink-soft: #33493F; --l-ink-muted: #566B60;
    --l-signal: #7A5A0C; --l-signal-hover: #634909; --l-signal-soft: rgba(196, 150, 40, 0.14); --l-hover-sheet: #F1F6F2; --l-tint: 20, 55, 40;
}
:root[data-palette="indigo"] {
    --d-signal-rgb: 255, 138, 101; --l-signal-rgb: 184, 58, 14;
    --d-bg: #1B1838; --d-bg-deep: #14122A; --d-sheet: #221E45; --d-screen: #110F25;
    --d-signal: #FF8A65; --d-signal-hover: #FFA88B; --d-signal-ink: #1B1838; --d-signal-soft: rgba(255, 138, 101, 0.12); --d-hover-sheet: #2A2654;
    --l-bg: #ECEBF4; --l-ink: #16132E; --l-ink-soft: #3B3757; --l-ink-muted: #5E5A78;
    --l-signal: #B83A0E; --l-signal-hover: #9A300B; --l-signal-soft: rgba(255, 120, 80, 0.14); --l-hover-sheet: #F4F3FA; --l-tint: 40, 32, 90;
}
:root[data-palette="char"] {
    --d-signal-rgb: 255, 159, 28; --l-signal-rgb: 163, 72, 10;
    --d-bg: #16181D; --d-bg-deep: #101216; --d-sheet: #1D2026; --d-screen: #0D0F12;
    --d-signal: #FF9F1C; --d-signal-hover: #FFB54F; --d-signal-ink: #16181D; --d-signal-soft: rgba(255, 159, 28, 0.12); --d-hover-sheet: #262A31;
    --l-bg: #EDEDEE; --l-ink: #15171B; --l-ink-soft: #3B3F47; --l-ink-muted: #5D626B;
    --l-signal: #A3480A; --l-signal-hover: #873B08; --l-signal-soft: rgba(255, 140, 20, 0.14); --l-hover-sheet: #F5F5F6; --l-tint: 30, 32, 38;
}
:root[data-palette="wine"] {
    --d-signal-rgb: 242, 197, 155; --l-signal-rgb: 147, 68, 32;
    --d-bg: #2A1219; --d-bg-deep: #200E13; --d-sheet: #33171F; --d-screen: #1B0B10;
    --d-signal: #F2C59B; --d-signal-hover: #F7D7B8; --d-signal-ink: #2A1219; --d-signal-soft: rgba(242, 197, 155, 0.12); --d-hover-sheet: #3E1C26;
    --l-bg: #F3ECED; --l-ink: #2A1016; --l-ink-soft: #4E333A; --l-ink-muted: #73565D;
    --l-signal: #934420; --l-signal-hover: #7A381A; --l-signal-soft: rgba(210, 120, 70, 0.14); --l-hover-sheet: #FAF5F5; --l-tint: 70, 20, 32;
}

/* المظهر الليلي: الصفحة كلها، وفي النهاري «جزر» الأشكال والمحاكيات */
:root,
html[data-theme="light"] :is(.figure, .sim-panel, [data-sim], .s3-host, .mo-fig, .lx-stage, .lv-board) {
    /* الورق والأسطح */
    --bg: var(--d-bg);              /* ورق المخطط */
    --bg-deep: var(--d-bg-deep);    /* الشريط العلوي والقوائم */
    --sheet: var(--d-sheet);        /* لوحة الدرس */
    --screen: var(--d-screen);      /* شاشات المحاكيات ومساحات الرسم */
    --hover-sheet: var(--d-hover-sheet);
    --inset: rgba(3, 14, 28, 0.38);
    --raise: rgba(255, 255, 255, 0.035);
    --hover: rgba(255, 255, 255, 0.06);

    /* الخطوط والشبكة */
    --line: rgba(214, 228, 243, 0.16);
    --line-strong: rgba(214, 228, 243, 0.36);
    --grid-minor: rgba(150, 190, 235, 0.06);
    --grid-major: rgba(150, 190, 235, 0.11);

    /* الحبر */
    --ink: #EAF1F8;
    --ink-soft: #C3D2E2;
    --ink-muted: #95ADC6;

    /* التمييز والمعاني */
    --signal: var(--d-signal);
    --signal-hover: var(--d-signal-hover);
    --signal-ink: var(--d-signal-ink);
    --signal-soft: var(--d-signal-soft);
    --signal-rgb: var(--d-signal-rgb);
    --pos: #FF8A80;
    --neg: #7CC7FF;
    --ok: #5FD39A;
    --bad: #FF7B7B;
    --ok-rgb: 95, 211, 154;     /* للشفافيات: rgba(var(--ok-rgb), 0.12) */
    --bad-rgb: 255, 123, 123;

    --shadow: 0 18px 40px rgba(2, 10, 22, 0.45);

    /* شبكة المخطط (طبقتان: مربعات صغيرة وكبيرة) */
    --grid-page:
        linear-gradient(var(--grid-major) 1px, transparent 1px) 0 0 / 120px 120px,
        linear-gradient(90deg, var(--grid-major) 1px, transparent 1px) 0 0 / 120px 120px,
        linear-gradient(var(--grid-minor) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px) 0 0 / 24px 24px;
    --grid-fine:
        linear-gradient(var(--grid-minor) 1px, transparent 1px) 0 0 / 16px 16px,
        linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px) 0 0 / 16px 16px;
    color-scheme: dark;
}
html[data-theme="light"] :is(.figure, .sim-panel, [data-sim], .s3-host, .mo-fig, .lx-stage, .lv-board) { color: var(--ink); }
/* لون التمييز داخل الرسوم والمختبرات ذهبي ثابت في كل اللوحات: شرح الدروس والمحاكيات يذكر عناصرها بألوانها
   («الخط الأصفر»، «الزر الأصفر»، «العمود الأصفر»…)، فلا تتغير بتغيير اللوحة. وألوان الواجهة خارجها تتبع اللوحة المختارة.
   (ملاحظة صاحب المنصة، 20 تشرين الثاني 2026، بعد أن صار «ليلي وفيروزي» الافتراضي: «أين الإطار الأصفر؟») */
:is(.figure, .sim-panel, [data-sim], .s3-host, .mo-fig, .lx-stage, .lv-board) {
    --d-signal: #FFC53D; --d-signal-hover: #FFD46E; --d-signal-ink: #0B2747; --d-signal-soft: rgba(255, 197, 61, 0.11); --d-signal-rgb: 255, 197, 61;
    --signal: #FFC53D; --signal-hover: #FFD46E; --signal-ink: #0B2747; --signal-soft: rgba(255, 197, 61, 0.11); --signal-rgb: 255, 197, 61;
}

/* المظهر النهاري: ورق فاتح بحبر داكن، بألوان اللوحة نفسها */
html[data-theme="light"] body {
    --bg: var(--l-bg);
    --bg-deep: var(--l-bg-deep);
    --sheet: var(--l-sheet);
    --screen: var(--l-screen);
    --hover-sheet: var(--l-hover-sheet);
    --inset: rgba(var(--l-tint), 0.05);
    --raise: rgba(var(--l-tint), 0.025);
    --hover: rgba(var(--l-tint), 0.06);
    --line: rgba(var(--l-tint), 0.15);
    --line-strong: rgba(var(--l-tint), 0.32);
    --grid-minor: rgba(var(--l-tint), 0.045);
    --grid-major: rgba(var(--l-tint), 0.08);
    --ink: var(--l-ink);
    --ink-soft: var(--l-ink-soft);
    --ink-muted: var(--l-ink-muted);
    --signal: var(--l-signal);
    --signal-hover: var(--l-signal-hover);
    --signal-ink: var(--l-signal-ink);
    --signal-soft: var(--l-signal-soft);
    --signal-rgb: var(--l-signal-rgb);
    --pos: #C62828;
    --neg: #1565C0;
    --ok: #1B7F4C;
    --bad: #C62828;
    --ok-rgb: 27, 127, 76;
    --bad-rgb: 198, 40, 40;
    --shadow: 0 18px 40px rgba(var(--l-tint), 0.14);
    --grid-page:
        linear-gradient(var(--grid-major) 1px, transparent 1px) 0 0 / 120px 120px,
        linear-gradient(90deg, var(--grid-major) 1px, transparent 1px) 0 0 / 120px 120px,
        linear-gradient(var(--grid-minor) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px) 0 0 / 24px 24px;
    --grid-fine:
        linear-gradient(var(--grid-minor) 1px, transparent 1px) 0 0 / 16px 16px,
        linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px) 0 0 / 16px 16px;
    color-scheme: light;
}

/* =========================================================
   الأساسيات
   ========================================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
    background: var(--grid-page), var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
body.drawer-open { overflow: hidden; }

::selection { background: rgba(var(--signal-rgb), 0.35); color: inherit; }

/* خط العناوين (Reem Kufi) مسافاته بين الكلمات ضيقة، فنوسعها قليلاً */
.hero-text, .index-title, .lesson-title, .quiz-header h2, .drawer-title, :where(.lesson-content) h3 { word-spacing: 0.2em; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* =========================================================
   الشريط العلوي والقوائم المنسدلة
   ========================================================= */
nav {
    position: fixed; top: 0; right: 0; left: 0; z-index: 1000;
    height: var(--nav-h);
    display: flex; justify-content: center; align-items: stretch;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--line);
}
.nav-container { display: flex; align-items: stretch; gap: 2px; list-style: none; height: 100%; }
.nav-item { position: relative; display: flex; }
.nav-link {
    position: relative; display: flex; align-items: center; gap: 8px;
    padding: 0 14px; color: var(--ink-soft); text-decoration: none;
    font-weight: 500; font-size: 0.98rem; white-space: nowrap;
    transition: color 0.15s, background-color 0.15s;
}
.nav-link::after {   /* خط سفلي يظهر عند المرور ويصبح أصفر للعنصر النشط */
    content: ""; position: absolute; right: 10px; left: 10px; bottom: -1px; height: 2px;
    background: var(--ink-muted); transform: scaleX(0); transition: transform 0.2s ease;
}
.nav-item:hover > .nav-link { color: var(--ink); background: var(--hover); }
.nav-item:hover > .nav-link::after { transform: scaleX(1); }
.nav-link.active { color: var(--ink); }
.nav-link.active::after { transform: scaleX(1); background: var(--signal); }
.nav-link svg { flex-shrink: 0; }

/* رابط الرئيسية: خط فاصل يميّزه عن الفصول */
.nav-home { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line); }

/* شاشات الحاسوب الأصغر: مسافات أضيق لكي يتسع الشريط لعشرة عناصر */
@media (max-width: 1400px) {
    .nav-link { padding: 0 10px; font-size: 0.9rem; }
    .nav-home { margin-left: 4px; padding-left: 4px; }
}

/* القائمة الأولى (أقسام الفصل) */
.dropdown {
    position: absolute; top: 100%; right: 0; width: 240px;
    background: var(--bg-deep); border: 1px solid var(--line-strong); border-top-color: var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 8px; box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}
.nav-item:hover .dropdown {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}
.dropdown-heading {
    font-size: 0.78rem; font-weight: 600; color: var(--ink-muted);
    padding: 2px 8px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.has-submenu { position: static; }   /* القائمة الفرعية تُحاذى مع أعلى القائمة الأولى */
.dropdown-item {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    color: var(--ink-soft); text-decoration: none; padding: 8px 10px; margin: 2px 0;
    border-radius: 2px; font-size: 0.9rem; transition: background-color 0.15s, color 0.15s;
}
.dropdown-item:hover { color: var(--ink); background: var(--hover); }
.dd-label { display: inline-flex; align-items: center; gap: 8px; }
.arrow { font-size: 0.65em; color: var(--ink-muted); transition: transform 0.15s; }
/* القائمة الفرعية تُفتح بكلاس open (يتحكم به js/app.js) بدلاً من :hover لمنع التبديل العرضي */
.has-submenu.open > .dropdown-item { color: var(--ink); background: var(--hover); box-shadow: inset -2px 0 0 var(--signal); }
.has-submenu.open .arrow { color: var(--signal); transform: translateX(-3px); }

/* الأقسام غير الجاهزة بعد */
.soon-badge {
    font-size: 0.68rem; line-height: 1.5; font-weight: 500; color: var(--ink-muted);
    border: 1px dashed var(--line-strong); border-radius: 2px; padding: 0 6px; white-space: nowrap;
}
.has-submenu.is-soon > .dropdown-item, .dropdown-item[data-soon] { color: var(--ink-muted); }
.has-submenu.is-soon .sub-dropdown-item { color: var(--ink-muted); }
.has-submenu.is-soon .sub-dropdown-item:hover { color: var(--ink-soft); border-right-color: var(--line-strong); }

/* القائمة الثانية (المواضيع) */
.sub-dropdown {
    position: absolute; top: -1px; right: 100%;
    width: 380px; max-height: calc(100vh - var(--nav-h) - 24px); overflow-y: auto;
    background: var(--bg-deep); border: 1px solid var(--line-strong); border-radius: var(--radius);
    padding: 8px; box-shadow: var(--shadow);
    opacity: 0; visibility: hidden;
    transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}
.has-submenu.open .sub-dropdown { opacity: 1; visibility: visible; transition: opacity 0.15s ease, visibility 0s; }
.sub-dropdown-heading {
    font-size: 0.78rem; font-weight: 600; color: var(--ink-muted);
    padding: 2px 8px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.sub-dropdown-item {
    display: block; color: var(--ink-soft); text-decoration: none;
    padding: 7px 12px; margin: 2px 0; border-radius: 2px;
    font-size: 0.9rem; line-height: 1.6; border-right: 2px solid transparent;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.sub-dropdown-item:hover { color: var(--ink); background: var(--hover); border-right-color: var(--signal); }
.sub-dropdown-item.sub-item {   /* موضوع فرعي: يتفرع بخط متقطع كمخطط شجري */
    margin-right: 14px; padding-right: 12px; font-size: 0.84rem;
    color: var(--ink-muted); border-right: 1px dashed var(--line-strong);
}
.sub-dropdown-item.sub-item:hover { color: var(--ink); border-right: 1px solid var(--signal); }
/* في القسم الجاهز جزئياً: المواضيع المتاحة أوضح، وغير المتاحة باهتة */
.sub-dropdown-item[data-lesson] { color: var(--ink); font-weight: 500; }
.sub-dropdown-item[data-soon] { color: var(--ink-muted); }
.sub-dropdown-item.sub-item[data-lesson] { color: var(--ink-soft); font-weight: 400; }
.sub-dropdown-item.current { color: var(--signal); border-right-color: var(--signal); }

/* القائمة الفرعية تفتح لليمين عندما لا تتسع لها الشاشة على اليسار */
.has-submenu.open-right .sub-dropdown { right: auto; left: 100%; }
.has-submenu.open-right .arrow { transform: scaleX(-1); }
.has-submenu.open-right.open .arrow { transform: scaleX(-1) translateX(-3px); }

/* لوحة المفاتيح: التنقل بزر Tab يفتح القوائم */
.nav-item:has(:focus-visible) .dropdown { opacity: 1; visibility: visible; transform: none; transition: none; }
.has-submenu:has(:focus-visible) .sub-dropdown { opacity: 1; visibility: visible; transition: none; }

/* إغلاق القوائم مؤقتاً بعد اختيار درس */
nav.menus-closed .dropdown, nav.menus-closed .sub-dropdown { display: none; }

/* زر "الفصول" (يظهر على الشاشات الصغيرة فقط) */
.nav-toggle {
    display: none; align-items: center; gap: 8px;
    background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius);
    color: var(--ink); font-weight: 600; font-size: 0.92rem; padding: 0 14px; height: 38px;
}
.nav-toggle:hover { background: var(--hover); }

/* =========================================================
   القائمة الجانبية للجوال
   ========================================================= */
.drawer-backdrop {
    position: fixed; inset: 0; z-index: 1100; background: rgba(3, 12, 24, 0.6);
    opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0s linear 0.2s;
}
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1200;
    width: min(88vw, 380px); display: flex; flex-direction: column;
    background: var(--bg-deep); border-left: 1px solid var(--line-strong);
    transform: translateX(100%); visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
body.drawer-open .drawer { transform: none; visibility: visible; transition: transform 0.25s ease, visibility 0s; }
body.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; transition: opacity 0.2s, visibility 0s; }
.drawer-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    height: var(--nav-h); padding: 0 16px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.drawer-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.drawer-close {
    width: 38px; height: 38px; display: grid; place-items: center;
    background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink);
}
.drawer-body { overflow-y: auto; padding: 8px 0 24px; flex: 1; overscroll-behavior: contain; }
.dr-chapter { border-bottom: 1px solid var(--line); }
.dr-chapter > summary {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    cursor: pointer; list-style: none; font-weight: 600; color: var(--ink-soft);
}
.dr-chapter > summary::-webkit-details-marker { display: none; }
.dr-chapter > summary::after { content: "+"; margin-right: auto; font-family: var(--font-mono); color: var(--ink-muted); }
.dr-chapter[open] > summary::after { content: "−"; }
.dr-chapter[open] > summary { color: var(--ink); }
.dr-num { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-muted); min-width: 22px; }
.dr-chapter.is-ready .dr-num { color: var(--signal); }
.dr-topics { list-style: none; padding: 0 16px 14px; }
.dr-topic {
    display: block; padding: 9px 12px; color: var(--ink-soft); text-decoration: none;
    font-size: 0.92rem; line-height: 1.6; border-right: 2px solid var(--line); border-radius: 0 2px 2px 0;
}
a.dr-topic:hover, a.dr-topic:active { color: var(--ink); background: var(--hover); }
.dr-topic.sub { margin-right: 14px; font-size: 0.86rem; border-right-style: dashed; color: var(--ink-muted); }
.dr-topic.current { color: var(--signal); border-right-color: var(--signal); background: var(--signal-soft); }
.dr-topic.is-soon { color: var(--ink-muted); }
.dr-soon-note { padding: 0 16px 14px; color: var(--ink-muted); font-size: 0.85rem; }
.dr-note { margin: 16px 16px 0; padding: 12px; font-size: 0.85rem; color: var(--ink-muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* =========================================================
   الصفحة الرئيسية
   ========================================================= */
.home { display: block; padding-top: var(--nav-h); }

.hero {
    max-width: 1180px; margin: 0 auto; padding: 72px 32px 80px;
    display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center;
}
.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 0.9rem; font-weight: 600; color: var(--ink-muted); margin-bottom: 18px;
}
.hero-eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--signal); }
.hero-text {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.15; color: var(--ink); margin: 0 0 18px;
}
.hero-sub { font-size: 1.2rem; line-height: 1.85; color: var(--ink-soft); max-width: 34ch; margin-bottom: 32px; }
.hero-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; }

.hero-stats { display: flex; margin-top: 36px; border-top: 1px solid var(--line); padding-top: 18px; gap: 0; }
.hero-stats > div { flex: 1; padding-left: 16px; display: flex; flex-direction: column; justify-content: space-between; }   /* الأرقام على خط واحد وإن التفّ عنوان أحدها */
.hero-stats > div + div { padding-right: 16px; border-right: 1px solid var(--line); }
.hero-stats dt { font-size: 0.82rem; color: var(--ink-muted); }
.hero-stats dd { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 500; color: var(--ink); line-height: 1.3; }

/* رسم المتسعة الهندسي */
.hero-drawing { margin: 0; position: relative; }
.hero-drawing svg { display: block; width: 100%; height: auto; overflow: visible; direction: ltr; }
.hero-drawing figcaption {
    display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 10px;
    border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--ink-muted);
}
.hero-drawing figcaption span:first-child { font-family: var(--font-mono); }
.hd-plate { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.hd-hatch-fill { fill: url(#hd-hatch); pointer-events: none; }
.hd-hatch-line { stroke: var(--ink-muted); stroke-width: 1; }
.hd-wire { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; }
.hd-terminal { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; }
.hd-field { fill: none; stroke: var(--signal); stroke-width: 1.4; }
.hd-fringe { fill: none; stroke: var(--signal); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: 0.75; }
.hd-arrowhead { fill: var(--signal); }
.hd-dim { fill: none; stroke: var(--ink-muted); stroke-width: 1; }
.hd-dim-head { fill: var(--ink-muted); }
.hd-center { fill: none; stroke: var(--ink-muted); stroke-width: 0.8; stroke-dasharray: 14 4 2 4; opacity: 0.7; }
.hd-text { fill: var(--ink-soft); font-family: var(--font-mono); font-size: 14px; }
.hd-var { fill: var(--ink); font-family: 'Times New Roman', serif; font-style: italic; font-size: 19px; }
.hd-pos { fill: var(--pos); font-family: var(--font-mono); font-size: 17px; font-weight: 500; }
.hd-neg { fill: var(--neg); font-family: var(--font-mono); font-size: 17px; font-weight: 500; }
.hd-box { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1; }
.hd-formula { fill: var(--ink); font-family: 'Times New Roman', serif; font-size: 17px; }
.hd-formula .i { font-style: italic; }

/* ظهور الرسم مرة واحدة عند التحميل */
.hd-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: hd-draw 1.1s ease-out forwards; animation-delay: var(--d, 0s); }
.hd-fade { opacity: 0; animation: hd-fade 0.6s ease-out forwards; animation-delay: var(--d, 0s); }
@keyframes hd-draw { to { stroke-dashoffset: 0; } }
@keyframes hd-fade { to { opacity: 1; } }

/* البحث */
.search-container { position: relative; width: 100%; max-width: 520px; display: flex; align-items: center; }
.search-input {
    width: 100%; height: 54px; padding: 0 18px 0 54px;
    background: var(--inset); border: 1px solid var(--line-strong); border-radius: var(--radius);
    color: var(--ink); font-family: var(--font-body); font-size: 1.05rem; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--ink-muted); }
.search-input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(var(--signal-rgb), 0.16); }
.search-btn {
    position: absolute; left: 6px; width: 42px; height: 42px; display: grid; place-items: center;
    background: transparent; border: none; border-radius: 2px; color: var(--ink-soft);
}
.search-btn:hover { color: var(--signal); background: var(--hover); }
.search-results {
    position: absolute; top: calc(100% + 6px); right: 0; left: 0; z-index: 20;
    background: var(--bg-deep); border: 1px solid var(--line-strong); border-radius: var(--radius);
    padding: 6px; max-height: 320px; overflow-y: auto; display: none; box-shadow: var(--shadow);
}
.search-results.show { display: block; }
.search-result {
    display: block; width: 100%; text-align: right; background: transparent; border: none;
    border-right: 2px solid transparent; color: var(--ink); font-size: 1rem;
    padding: 9px 12px; border-radius: 2px; transition: background-color 0.15s;
}
.search-result:hover, .search-result:focus { background: var(--hover); border-right-color: var(--signal); outline: none; }
.search-result small { display: block; color: var(--ink-muted); font-size: 0.8rem; }
.search-empty { color: var(--ink-muted); padding: 10px 12px; }

/* فهرس الفصول */
.chapter-index { max-width: 1180px; margin: 0 auto; padding: 0 32px 96px; }
.index-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.index-title { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; }
.index-note { color: var(--ink-muted); font-size: 0.9rem; }
.index-list {   /* شبكة لوحات: الفواصل خطوط بعرض 1px */
    list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
    background: var(--line); border: 1px solid var(--line);
}
.index-cell {
    display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 148px;
    padding: 20px 22px; background: var(--bg); color: var(--ink-soft); text-decoration: none;
    position: relative; transition: background-color 0.15s;
}
.ix-num { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-muted); }
.ix-chapter { font-size: 0.85rem; color: var(--ink-muted); }
.ix-name { font-size: 1.2rem; font-weight: 700; color: var(--ink-soft); line-height: 1.5; }
.ix-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--ink-muted); }
.ix-status { font-size: 0.75rem; border: 1px dashed var(--line-strong); border-radius: 2px; padding: 0 8px; white-space: nowrap; }
a.index-cell { background: var(--sheet); color: var(--ink); }
a.index-cell::before { content: ""; position: absolute; top: -1px; right: -1px; left: -1px; height: 3px; background: var(--signal); }
a.index-cell .ix-num, a.index-cell .ix-status { color: var(--signal); }
a.index-cell .ix-name { color: var(--ink); }
a.index-cell .ix-status { border: 1px solid var(--signal); }
a.index-cell:hover { background: var(--hover-sheet); }
a.index-cell:hover .ix-status { background: var(--signal); color: var(--signal-ink); }

/* =========================================================
   لوحة الدرس
   ========================================================= */
#learning-area {
    display: none; min-height: 100vh;
    padding: calc(var(--nav-h) + 40px) 24px 64px;
    animation: fadeIn 0.35s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.lesson-panel {   /* إطار مزدوج مثل حدود لوحة الرسم الهندسي */
    position: relative;   /* للعلامة المائية .wm (js/account.js) */
    max-width: var(--sheet-w); margin: 6px auto 30px;
    background: var(--sheet); border: 1px solid var(--line-strong);
    outline: 1px solid var(--line); outline-offset: 5px;
    padding: 44px 52px; box-shadow: var(--shadow);
}

/* مربع العنوان (مثل جدول بيانات اللوحة) */
.title-block { border: 1px solid var(--line-strong); margin-bottom: 40px; }
.lesson-title {
    font-family: var(--font-display); font-weight: 700; font-size: 2.1rem; line-height: 1.45;
    color: var(--ink); padding: 18px 22px;
}
.tb-row { display: grid; grid-template-columns: 1fr 1.6fr auto; border-top: 1px solid var(--line-strong); }
.tb-cell { padding: 8px 14px; min-width: 0; }
.tb-cell + .tb-cell { border-right: 1px solid var(--line-strong); }
.tb-label { display: block; font-size: 0.72rem; color: var(--ink-muted); line-height: 1.6; }
.tb-value { display: block; font-size: 0.95rem; font-weight: 600; color: var(--ink-soft); line-height: 1.6; }
.tb-sheet .tb-value { white-space: nowrap; }
.tb-sheet .tb-value { font-family: var(--font-mono); color: var(--ink); direction: ltr; text-align: right; }
.tb-sheet .tb-value > [dir="rtl"] { font-family: var(--font-body); font-weight: 600; letter-spacing: normal; }   /* نص عربي في خانة الموضوع (setPosition في js/app.js) */
.tb-ruler { display: flex; gap: 3px; padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.tb-ruler span { flex: 1; height: 6px; border: 1px solid var(--line-strong); border-radius: 1px; }
.tb-ruler .done { background: var(--ink-muted); border-color: var(--ink-muted); }
.tb-ruler .current { background: var(--signal); border-color: var(--signal); }
.tb-ruler .soon { border-style: dashed; }

/* تبويبا الموضوع تحت مربع العنوان: «شرح وتبسيط» و«سين جيم» (ملتصقان بأسفل المربع) */
.section-tabs { display: flex; flex-wrap: wrap; margin: -41px 0 40px; border: 1px solid var(--line-strong); border-top: none; }
.section-tabs[hidden] { display: none; }
.st-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; font-weight: 600; font-size: 0.95rem; color: var(--ink-soft); text-decoration: none; border-left: 1px solid var(--line); }
a.st-tab:hover { color: var(--ink); background: var(--hover); }
.st-tab.active { background: var(--signal); color: var(--signal-ink); }
.st-tab.is-soon { color: var(--ink-muted); cursor: default; }
.st-tab small { font-size: 0.75rem; font-weight: 500; border: 1px dashed var(--line-strong); padding: 0 6px; border-radius: 2px; }
.st-count { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; opacity: 0.8; }

/* :where تجعل هذه القواعد بأقل أولوية، فتتغلب عليها كلاسات الألوان والمكونات */
.lesson-content { font-size: 1.125rem; line-height: 1.95; color: var(--ink-soft); margin-bottom: 40px; }
:where(.lesson-content) h3 {
    font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; line-height: 1.5;
    color: var(--ink); margin: 28px 0 12px;
}
:where(.lesson-content) h4 { font-size: 1.15rem; font-weight: 700; color: var(--ink); line-height: 1.6; }
:where(.lesson-content) h5 { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
:where(.lesson-content) b, :where(.lesson-content) strong { color: var(--ink); font-weight: 700; }
:where(.lesson-content) ul, :where(.lesson-content) ol { padding-right: 24px; margin-bottom: 20px; }
:where(.lesson-content) p { margin-bottom: 15px; }
:where(.lesson-content) li::marker { color: var(--ink-muted); }

.lesson-actions {
    display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap;
    border-top: 1px solid var(--line-strong); padding-top: 28px;
}

/* الأزرار */
.btn-action {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 46px; padding: 10px 20px; border-radius: var(--radius);
    font-family: var(--font-body); font-size: 1rem; font-weight: 600; line-height: 1.5;
    text-decoration: none; cursor: pointer; border: 1px solid transparent;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-action[hidden] { display: none; }
.btn-primary, .btn-quiz { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.btn-primary:hover, .btn-quiz:hover:not(:disabled) { background: var(--signal-hover); border-color: var(--signal-hover); }
.btn-next, .btn-prev { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-next:hover, .btn-prev:hover { border-color: var(--ink-soft); background: var(--hover); }
.btn-prev { color: var(--ink-soft); }
.btn-secondary { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn-secondary:hover { background: var(--hover); color: var(--ink); }
.btn-secondary[hidden] { display: none; }

/* =========================================================
   الاختبار
   ========================================================= */
#quiz-area { display: none; }
.quiz-header {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
    padding-bottom: 16px; margin-bottom: 28px; border-bottom: 1px solid var(--line-strong);
}
.quiz-header h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; line-height: 1.3; }
.quiz-lesson { font-size: 0.9rem; color: var(--ink-muted); margin-top: 4px; }
.quiz-progress { font-size: 0.9rem; font-weight: 600; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.question-text { font-size: 1.35rem; font-weight: 600; line-height: 1.8; color: var(--ink); margin-bottom: 24px; }

@counter-style abjad { system: alphabetic; symbols: "أ" "ب" "ج" "د" "هـ" "و"; suffix: ""; }
.options-grid { display: grid; gap: 10px; counter-reset: option; }
.option-btn {
    display: flex; align-items: center; gap: 14px; width: 100%;
    background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius);
    color: var(--ink-soft); padding: 13px 16px; font-size: 1.08rem; line-height: 1.7; text-align: right;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.option-btn::before {   /* ترقيم الخيارات: أ ب ج د */
    counter-increment: option; content: counter(option, abjad);
    flex-shrink: 0; width: 30px; height: 30px; display: grid; place-items: center;
    border: 1px solid var(--line-strong); border-radius: 2px; font-size: 0.9rem; font-weight: 600; color: var(--ink-muted);
}
.option-btn:hover:not(:disabled) { border-color: var(--ink-soft); background: var(--hover); color: var(--ink); }
.option-btn:disabled { cursor: default; }
.option-btn.correct { border-color: var(--ok); background: rgba(var(--ok-rgb), 0.1); color: var(--ink); }
.option-btn.correct::before { border-color: var(--ok); background: var(--ok); color: var(--signal-ink); }
.option-btn.wrong { border-color: var(--bad); background: rgba(var(--bad-rgb), 0.1); color: var(--ink); }
.option-btn.wrong::before { border-color: var(--bad); background: var(--bad); color: var(--signal-ink); }
.explanation-box {
    margin-top: 22px; padding: 16px 18px; border-radius: var(--radius);
    font-size: 1.05rem; line-height: 1.8; color: var(--ink-soft); display: none; animation: fadeIn 0.25s ease-out;
}
.explanation-box b { display: inline-block; margin-bottom: 2px; }
.explanation-box.show-correct { display: block; background: rgba(var(--ok-rgb), 0.08); border-right: 3px solid var(--ok); }
.explanation-box.show-correct b { color: var(--ok); }
.explanation-box.show-wrong { display: block; background: rgba(var(--bad-rgb), 0.08); border-right: 3px solid var(--bad); }
.explanation-box.show-wrong b { color: var(--bad); }
.quiz-navigation {
    margin-top: 28px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    border-top: 1px solid var(--line-strong); padding-top: 22px;
}
.nav-buttons-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* رسالة منبثقة (Toast) */
.toast {
    position: fixed; bottom: 28px; left: 50%; z-index: 2000; max-width: calc(100vw - 32px);
    transform: translateX(-50%) translateY(12px);
    background: var(--bg-deep); color: var(--ink); border: 1px solid var(--line-strong);
    border-right: 3px solid var(--signal); border-radius: var(--radius);
    padding: 12px 20px; font-size: 0.98rem; line-height: 1.7; box-shadow: var(--shadow);
    opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* «نسخة جديدة من المنصة» (js/news.js، 23 تشرين الثاني 2026): شريط ثابت أسفل الشاشة حتى يحدّث الطالب الصفحة أو يؤجله */
.up-bar { position: fixed; z-index: 1900; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    width: min(620px, calc(100vw - 24px)); display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; justify-content: space-between;
    padding: 10px 14px; background: var(--bg-deep); color: var(--ink); border: 1px solid var(--line-strong);
    border-inline-start: 4px solid var(--signal); border-radius: var(--radius); box-shadow: var(--shadow); animation: upIn 0.3s ease-out; }
.up-bar[hidden] { display: none; }
.up-t { margin: 0; flex: 1 1 260px; font-size: 0.95rem; line-height: 1.6; }
.up-acts { display: flex; align-items: center; gap: 8px; }
.up-acts .btn-action { padding-block: 6px; }
.up-later { font: inherit; font-size: 0.9rem; cursor: pointer; color: var(--ink-soft); background: none; border: 0; padding: 6px 8px; text-decoration: underline; }
@keyframes upIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }
body.has-upbar .toast { bottom: 120px; }
body.has-upbar .chat-fab { bottom: 110px; }
/* لا يغطي أزرار الدرس الحي ولا المكالمة ولا المساعد على الجوال؛ يظهر بعد إغلاقها. وبجانب لوحة المساعد على الشاشة العريضة */
body.xp-open .up-bar, body.lv-open .up-bar, body.chat-lock .up-bar { display: none; }
body.chat-open:not(.chat-lock) .up-bar { left: calc(50% + 210px); width: min(620px, calc(100vw - 444px)); }
@media (prefers-reduced-motion: reduce) { .up-bar { animation: none; } }
@media print { .up-bar { display: none !important; } }

/* =========================================================
   المعادلات (KaTeX)
   ========================================================= */
.katex { direction: ltr; unicode-bidi: isolate; font-size: 1.05em; }
:is(h3, h4) .katex { white-space: nowrap; }   /* المعادلة القصيرة في العنوان لا تنقسم بين سطرين */
.katex-display { margin: 0.6em 0; overflow-x: auto; overflow-y: hidden; padding: 2px 4px; direction: ltr; }   /* ltr: المعادلة العريضة تُمرَّر أفقياً بدل أن يُقص طرفها الأيمن، والحشوة الجانبية تستوعب بروز الأدلة السفلية */
.eq { color: var(--ink); }                   /* معادلة مستقلة في سطرها */
.eq.lg { font-size: 1.25em; }
.formula-box {                               /* القانون الرئيسي داخل إطار مزدوج */
    color: var(--ink); background: var(--inset);
    border: 1px solid var(--line-strong); outline: 1px solid var(--line); outline-offset: 3px;
    border-radius: 2px; padding: 10px 26px;
    width: max-content; max-width: calc(100% - 8px); margin: 24px auto; font-size: 1.35em;
}
.formula-box .katex-display { margin: 0; }
.formula-box.law-box { width: auto; max-width: 900px; font-size: 1.12rem; line-height: 1.9; text-align: center; padding: 14px 24px; }   /* نص قانون (كلمات لا معادلة) */
.law { color: var(--ink); margin: 0 10px; } /* قانون داخل السطر */
.en { white-space: nowrap; unicode-bidi: isolate; direction: ltr; }   /* مصطلح إنجليزي داخل نص عربي: لا ينقسم بين سطرين */
.ref { white-space: nowrap; }                                          /* مرجع شكل مثل 12-a (يضيفه app.js تلقائياً) */
.val { color: var(--ink); border-bottom: 1.5px solid rgba(var(--signal-rgb), 0.75); padding-bottom: 1px; } /* قيمة معطاة */

/* =========================================================
   مكونات الدروس
   (كلاسات accent-* مقبولة في المحتوى لكنها تُعرض بنمط موحّد هادئ)
   ========================================================= */

/* قائمة القواعد المرقمة في بداية كل درس */
.rule-list { list-style: none; padding: 0; margin-bottom: 0; }
:where(.lesson-content) .rule-list { padding-right: 0; }
.rule-list > li { padding: 14px 0; border-top: 1px dashed var(--line); }
.rule-list > li:first-child { border-top: none; padding-top: 0; }
.rule-title { display: block; color: var(--ink); font-weight: 700; font-size: 1.12rem; margin-bottom: 4px; }
.rule-list.divided { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line-strong); }
.rule-list > li.highlight {
    background: var(--signal-soft); border: none; border-right: 3px solid var(--signal);
    padding: 14px 16px; margin: 6px 0; border-radius: 0 2px 2px 0;
}
.inner-list { margin-top: 8px; color: var(--ink-soft); }

/* شرح على اليمين ومحاكي على اليسار */
.lesson-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 20px; }

/* مخطط شجري: عنصر رئيسي يتفرع إلى فرعين (مثل: قوة لورنتز ← القوة الكهربائية + المغناطيسية) */
.tree { margin: 28px 0 32px; text-align: center; }
.tree-root {
    position: relative; display: inline-block; padding: 8px 22px;
    background: var(--inset); border: 1px solid var(--line-strong); border-radius: 2px;
    font-weight: 700; color: var(--ink);
}
.tree-root::after { content: ""; position: absolute; top: 100%; left: 50%; height: 18px; border-left: 1px solid var(--line-strong); }
.tree-branches { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 36px; text-align: right; }
.tree-branches::before { content: ""; position: absolute; top: -18px; right: 25%; left: 25%; border-top: 1px solid var(--line-strong); }
.tree-branches > * { position: relative; margin: 0; }
.tree-branches > *::before { content: ""; position: absolute; bottom: 100%; right: 50%; height: 17px; border-right: 1px solid var(--line-strong); }
.tree-branches.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tree-branches.three::before { right: 16.66%; left: 16.66%; }

/* مخطط تدفق عمودي: خطوات متتالية بأسهم، ويمكن أن يتفرع ثم يلتقي
   <div class="flow"> .flow-step ... .flow-fork .flow-split(خطوتان) .flow-merge .flow-step </div> */
.flow { display: flex; flex-direction: column; align-items: center; margin: 28px 0 32px; }
.flow-step {
    position: relative; width: min(100%, 420px); padding: 10px 16px; text-align: center;
    background: var(--inset); border: 1px solid var(--line-strong); border-radius: 2px; color: var(--ink); line-height: 1.8;
}
.flow > .flow-step + .flow-step { margin-top: 28px; }
.flow > .flow-step + .flow-step::before { content: ""; position: absolute; bottom: 100%; left: 50%; height: 28px; border-left: 1px solid var(--line-strong); }
.flow > .flow-step:not(:first-child)::after, .flow-split > .flow-step::after {
    content: ""; position: absolute; top: -7px; left: calc(50% - 5px);
    border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--line-strong);
}
.flow-step.result { border-color: var(--signal); background: var(--signal-soft); font-weight: 700; }
.flow-fork, .flow-merge { position: relative; width: min(100%, 760px); height: 28px; }
.flow-fork::before { content: ""; position: absolute; top: 0; left: 50%; height: 14px; border-left: 1px solid var(--line-strong); }
.flow-fork::after { content: ""; position: absolute; top: 14px; left: 25%; right: 25%; height: 14px; border: 1px solid var(--line-strong); border-bottom: none; }
.flow-merge::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 14px; border: 1px solid var(--line-strong); border-top: none; }
.flow-merge::after { content: ""; position: absolute; top: 14px; left: 50%; height: 14px; border-left: 1px solid var(--line-strong); }
.flow-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; width: min(100%, 760px); }
.flow-split > .flow-step { width: 100%; }
/* مساران متوازيان بخطوات متقابلة (مثل مخطط حل مسائل العازل): .flow.two ثم .flow-split.rows
   العناصر بالترتيب صفاً صفاً (يمين ثم يسار)، فتتساوى ارتفاعات الخطوات المتقابلة */
.flow-split.rows { row-gap: 24px; }
.flow-split.rows > .flow-step:nth-child(n+3)::before { content: ""; position: absolute; bottom: 100%; left: 50%; height: 24px; border-left: 1px solid var(--line-strong); }
.flow-step.branch { border-color: var(--signal); background: var(--signal-soft); font-weight: 700; }
.flow-step .fs-t { display: block; color: var(--ink-soft); font-size: 0.92em; margin-bottom: 2px; }
.flow-step .fs-up { font-size: 0.85em; color: var(--signal); font-weight: 700; }
.flow-step .fs-l { display: block; line-height: 1.5; padding: 3px 0; }
.flow-step .fs-l + .fs-l { margin-top: 4px; }

/* حلقة مغلقة (تغذية راجعة): خطوات متتالية ثم سهم يعود من الأخيرة إلى الأولى
   <div class="cycle"> أربع .flow-step </div>  (و class="cycle three" لثلاث خطوات) */
.cycle { position: relative; display: flex; gap: 36px; margin: 28px 0 32px; padding-bottom: 30px; }
.cycle > .flow-step { flex: 1; width: auto; }   /* بلا flex داخل الخطوة: حتى لا ينفصل النص عن المعادلة */
.cycle > .flow-step + .flow-step::before { content: ""; position: absolute; top: 50%; left: 100%; width: 36px; border-top: 1px solid var(--line-strong); }
.cycle > .flow-step + .flow-step::after {
    content: ""; position: absolute; top: calc(50% - 5px); left: 100%;
    border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 7px solid var(--line-strong);
}
.cycle::before { content: ""; position: absolute; bottom: 8px; left: 12%; right: 12%; height: 22px; border: 1px solid var(--line-strong); border-top: none; }
.cycle::after {
    content: ""; position: absolute; bottom: 23px; right: calc(12% - 5px);
    border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid var(--line-strong);
}
.cycle.three::before { left: 16%; right: 16%; }
.cycle.three::after { right: calc(16% - 5px); }

/* أعمدة متجاورة لأي عناصر (بطاقات مثلاً): تتحول لعمود واحد تلقائياً على الشاشات الضيقة */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 24px; margin-bottom: 28px; }
.cols > * { margin-bottom: 0; }
.cols.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.lc-cycle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lc-cycle > .fig-panel { min-width: 0; }
.lc-cycle svg { width: 100%; max-width: 150px; height: auto; margin-inline: auto; display: block; }
@media (max-width: 700px) { .lc-cycle { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* عناوين الأقسام */
/* :where(h3) يبقي الأولوية منخفضة لكي تعمل معها أدوات الهوامش مثل mt-0 و mt-lg */
:where(h3).section { margin: 32px 0 18px; }
:where(h3).divider { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line-strong); }
:where(h3).underlined { margin-top: 30px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }

/* بطاقة شرح */
.card {
    background: var(--raise); border: 1px solid var(--line);
    border-right: 2px solid var(--line-strong);
    border-radius: var(--radius); padding: 24px; margin-bottom: 28px;
}
.card > h4, .card > h3 { color: var(--ink); margin: 0 0 14px; font-size: 1.22rem; }
.card > h3 { font-size: 1.35rem; }
.card.compact { padding: 18px; margin-bottom: 0; }
.card ul:last-child, .card p:last-child { margin-bottom: 0; }

/* خطوات حل المثال: خط عمودي يربط المراحل */
.steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }   /* minmax(0) يمنع المعادلات الطويلة من توسيع العمود */
.steps.wide-gap { gap: 28px; }
.step {
    position: relative; background: var(--raise);
    border: 1px solid var(--line); border-right: 2px solid var(--ink-muted);
    border-radius: var(--radius); padding: 16px 20px;
}
.step.roomy { padding: 22px 24px; }
.step > h4 { color: var(--ink); margin: 0 0 10px; font-size: 1.12rem; }
.step.roomy > h4 { font-size: 1.25rem; margin-bottom: 14px; }
.step h5 { color: var(--ink); margin: 20px 0 8px; font-size: 1.05rem; }
.step h5:first-of-type { margin-top: 10px; }

/* نص المسألة */
.problem {
    background: var(--inset); padding: 20px 22px; border-radius: var(--radius);
    border: 1px solid var(--line); border-right: 2px solid var(--ink-soft); margin-bottom: 22px;
}
.problem > p:first-child { font-size: 1.1rem; line-height: 1.95; color: var(--ink); }
.problem ol { margin-right: 20px; color: var(--ink-soft); line-height: 1.9; margin-bottom: 20px; }
.problem ol:last-child { margin-bottom: 0; }

/* صندوق إبراز (ملاحظة / إجابة) */
.callout {
    background: var(--signal-soft); border-right: 3px solid var(--signal);
    padding: 14px 18px; border-radius: 0 2px 2px 0; margin: 20px 0; color: var(--ink);
}
.callout-title { color: var(--signal); font-weight: 700; }
.callout.thin { border-right-width: 2px; }
.callout.warn { background: rgba(var(--bad-rgb), 0.07); border-right-color: var(--bad); }   /* تحذير: نتيجة مستحيلة أو خاطئة */
.callout.warn .callout-title { color: var(--bad); }

/* إجابة مخفية تظهر عند الضغط (للأسئلة وفكّر) */
.reveal { margin-top: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.reveal > summary { display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; list-style: none; color: var(--signal); font-weight: 600; }
.reveal > summary::-webkit-details-marker { display: none; }
.reveal > summary::before { content: "+"; font-family: var(--font-mono); }
.reveal[open] > summary::before { content: "−"; }
.reveal > :not(summary) { padding: 0 14px; }
.reveal > :last-child:not(summary) { padding-bottom: 12px; margin-bottom: 0; }

/* قسم «سين جيم» */
.qa-intro { margin-bottom: 28px; }
.qa-lead { color: var(--ink-soft); line-height: 1.9; margin: 0 0 16px; }
.qa-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.qa-tools .sp-modes { margin: 0; flex: 0 1 420px; }
.qa-n { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; opacity: 0.75; }
.qa-toggle { min-height: 40px; padding: 8px 16px; }
.qa-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.qa-item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raise); padding: 18px 20px; }
.qa-item[hidden] { display: none; }
.qa-item.is-min { border-right: 3px solid var(--signal); }
.qa-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; }
.qa-num { font-family: var(--font-mono); font-weight: 600; color: var(--signal); margin-left: 4px; }
.qa-tag { font-size: 0.8rem; font-weight: 600; color: var(--ink); padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 2px; }
.qa-badge { font-size: 0.78rem; line-height: 1.7; padding: 1px 8px; border-radius: 2px; }
.qa-badge.min { color: var(--signal); background: var(--signal-soft); border: 1px solid rgba(var(--signal-rgb), 0.35); }
.qa-badge.book { color: var(--ink-muted); border: 1px dashed var(--line-strong); }
.qa-q { color: var(--ink); font-weight: 600; line-height: 1.95; }
.qa-opts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 6px 16px; font-weight: 500; }
.qa-opts li { color: var(--ink-soft); }
.qa-opt-l { font-family: var(--font-mono); color: var(--ink-muted); margin-left: 4px; }
.qa-alt { color: var(--ink-muted); font-size: 0.88rem; line-height: 1.8; margin: 8px 0 0; }
.qa-answer { margin-top: 12px; }
.qa-a { color: var(--ink-soft); line-height: 1.9; }
.qa-a > :first-child { margin-top: 12px; }
.qa-a ol, .qa-a ul { margin-bottom: 0; }
.qa-a .figure { margin: 12px auto; }
.qa-a .table-wrap { margin: 12px 0; }
.qa-empty { color: var(--ink-muted); text-align: center; padding: 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* الحل المشروح خطوة بخطوة (أجوبة «سين جيم» الحسابية والفكرية) */
.sol > * + * { margin-top: 14px; }
.sol-answer {
    display: table; margin: 0; padding: 6px 14px; color: var(--ink); font-weight: 600;
    background: var(--signal-soft); border: 1px solid rgba(var(--signal-rgb), 0.4); border-right: 3px solid var(--signal); border-radius: 2px;
}
.sol-answer-l { color: var(--signal); margin-left: 6px; }
.sol-opt { font-family: var(--font-mono); font-weight: 600; }
.sol-given { margin: 0; padding: 2px 12px 2px 0; border-right: 2px solid var(--line-strong); color: var(--ink-soft); }
.sol-given b, .sol-part { color: var(--ink); }
.sol-part { margin: 0; font-weight: 700; padding-bottom: 6px; border-bottom: 1px dashed var(--line-strong); }
.sol-part + .sol-steps, .sol-part + .figure { margin-top: 12px; }
.sol-steps { list-style: none; margin: 0; padding: 0; counter-reset: sol-st; display: flex; flex-direction: column; gap: 12px; }
.sol { counter-reset: sol-st; }                 /* ترقيم الخطوات متصل في الحل كله حتى مع تقسيمه إلى أجزاء */
.sol .sol-steps { counter-reset: none; }
.sol-steps > li { counter-increment: sol-st; position: relative; padding-right: 36px; min-height: 26px; }
.sol-steps > li::before {
    content: counter(sol-st); position: absolute; right: 0; top: 4px; width: 24px; height: 24px;
    display: grid; place-items: center; border: 1px solid var(--signal); border-radius: 50%;
    color: var(--signal); background: var(--raise); font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; line-height: 1;
}
.sol-steps > li:not(:last-child)::after {   /* خط رفيع يصل أرقام الخطوات */
    content: ""; position: absolute; right: 12px; top: 30px; bottom: -10px; border-right: 1px solid var(--line-strong);
}
.sol-steps > li > p { margin: 0; }
.sol p .katex { white-space: nowrap; }   /* لا تنكسر المعادلة القصيرة داخل السطر بين سطرين */
.sol-steps b { color: var(--ink); }
.sol-steps .katex-display { margin: 0.35em 0 0; }
.sol-tip { margin: 0; padding: 8px 12px; border: 1px dashed rgba(var(--signal-rgb), 0.5); border-radius: 2px; font-size: 0.95em; }
.sol-tip b { color: var(--signal); }
.sol .figure { margin: 12px auto 0; }
/* صناديق المسألة المفصّلة: المعطيات والمطلوب والجواب النهائي، وتلوين معادلة الناتج */
.sol-kw { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.sol-box { margin: 0; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--inset); }
.sol-box-h { margin: 0 0 6px; font-weight: 700; color: var(--ink); font-size: 0.92em; }
.sol-box-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; color: var(--ink-soft); }
.sol-box-list > li { position: relative; padding-right: 14px; }
.sol-box-list .katex { white-space: nowrap; }   /* لا تنقسم الكمية مع وحدتها بين سطرين */
.sol-box-list > li::before { content: ""; position: absolute; right: 2px; top: 0.75em; width: 5px; height: 5px; border-radius: 50%; background: var(--signal); }
.sol-box.final { border-color: rgba(var(--signal-rgb), 0.45); border-right: 3px solid var(--signal); background: var(--signal-soft); }
.sol-box.final .sol-box-h { color: var(--signal); }
.sol-box.final .sol-box-list { color: var(--ink); font-weight: 600; }
.eq.res { color: var(--signal); }
/* صناديق شرح المسألة: نفهم المسألة، وخطة الحل (القوانين ولماذا)، وماذا تعني النتيجة */
.sol-note { padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--raise); }
.sol-note > p:not(.sol-box-h) { margin: 0; }
.sol-note.understand { border-right: 3px solid var(--ink-muted); }
.sol-note.plan { border-right: 3px solid var(--pos); }
.sol-note.meaning { border-right: 3px solid var(--ok); }
.sol-plan { margin: 0; padding-right: 20px; display: flex; flex-direction: column; gap: 6px; }
.sol-plan .katex, .sol-note .katex { white-space: nowrap; }
.sol-warn { border-color: rgba(255, 107, 107, 0.55); }
.sol-warn b { color: var(--bad); }

/* قسم «أسئلة الفصل»: أسئلة نهاية الفصل ومسائله بترقيم الكتاب */
.chq-group + .chq-group { margin-top: 40px; }
.chq-group[hidden] { display: none; }
.chq-title {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
    margin: 0 0 16px; padding-bottom: 10px; border-bottom: 2px solid var(--signal);
    color: var(--ink); font-size: 1.2rem;
}
.chq-title small { color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; }
.chq-parts { list-style: none; margin: 4px 0 0; padding: 0; }
.chq-part { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.chq-part[hidden] { display: none; }
.chq-pn {
    font-family: var(--font-mono); font-weight: 700; color: var(--signal);
    min-width: 26px; padding: 0 6px; text-align: center; line-height: 1.7;
    border: 1px solid var(--signal); border-radius: 2px;
}
.qa-badge.topic { color: var(--ink-soft); border: 1px solid var(--line); text-decoration: none; }
.qa-badge.topic:hover, .qa-badge.topic:focus-visible { color: var(--signal); border-color: var(--signal); }

/* قسم «بنك المسائل» (25 تشرين الثاني 2026): مسائل الفصل في مجموعات متشابهة، ولكل مجموعة قوانينها */
.bk-group { margin-top: 36px; scroll-margin-top: calc(var(--nav-h) + 16px); border-radius: var(--radius); }
.bk-group[hidden] { display: none; }
.bk-gh {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
    margin: 0 0 10px; padding-bottom: 10px; border-bottom: 2px solid var(--signal);
    color: var(--ink); font-size: 1.15rem;
}
.bk-gh small { color: var(--ink-muted); font-size: 0.82rem; font-weight: 500; }
.bk-gn { font-family: var(--font-mono); font-size: 0.85rem; color: var(--signal); border: 1px solid rgba(var(--signal-rgb), 0.45); padding: 0 6px; border-radius: 2px; }
.bk-gt { flex: 1 1 220px; min-width: 0; }
.bk-note { margin: 0 0 8px; color: var(--ink-soft); line-height: 1.85; }
/* «ملاحظات هامة» قبل نوع مسائلها (27 تشرين الثاني 2026): مفتوحة، ويطويها الطالب إن شاء */
.bk-notes { margin-top: 36px; border: 1px solid rgba(var(--signal-rgb), 0.45); border-radius: var(--radius); background: var(--raise); padding: 10px 14px; }
.bk-notes[hidden] { display: none; }
.bk-notes > summary { cursor: pointer; font-weight: 700; color: var(--signal); font-size: 1.05rem; }
.bk-notes + .bk-group { margin-top: 22px; }
.bk-notes-in { margin-top: 12px; }
.bk-nq { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.bk-nq-h { font-weight: 700; color: var(--ink); margin: 0 0 6px; }
.bk-nq-list { margin: 0; padding-inline-start: 22px; display: grid; gap: 12px; }
.bk-nq-q { margin: 0 0 4px; }
.bk-nq-opts { list-style: arabic-indic; margin: 0 0 6px; padding-inline-start: 22px; color: var(--ink-soft); }
.bk-laws { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 14px; font-size: 0.88rem; }
.bk-laws-h { color: var(--ink-muted); }
.bk-law { color: var(--ink-soft); border: 1px solid var(--line-strong); border-radius: 2px; padding: 1px 8px; text-decoration: none; line-height: 1.7; }
.bk-law:hover, .bk-law:focus-visible { color: var(--signal); border-color: var(--signal); }
.bk-index { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; background: var(--raise); }
.bk-index summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.bk-index summary small { color: var(--ink-muted); font-family: var(--font-mono); }
.bk-index-list { list-style: none; margin: 10px 0 2px; padding: 0; display: grid; gap: 2px; }
.bk-index-list button {
    display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: start;
    background: transparent; border: 0; border-radius: 2px; color: var(--ink-soft);
    font: inherit; font-size: 0.92rem; line-height: 1.6; padding: 4px 6px; cursor: pointer;
}
.bk-index-list button:hover, .bk-index-list button:focus-visible { background: var(--hover); color: var(--ink); }
.bk-index-list button span:nth-child(2) { flex: 1; min-width: 0; }
.bk-index-list small { color: var(--ink-muted); font-family: var(--font-mono); }
.qa-bank-link { margin: 14px 0 0; padding: 8px 12px; border-right: 3px solid var(--signal); background: var(--signal-soft); color: var(--ink-soft); line-height: 1.8; border-radius: 2px; }
.qa-bank-link a { color: var(--signal); font-weight: 700; text-decoration: none; }
.qa-bank-link a:hover { text-decoration: underline; }
.lw-foot { margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-size: 0.9rem; }
.lw-bank { color: var(--signal); text-decoration: none; font-weight: 600; }
.lw-bank:hover { text-decoration: underline; }
.qa-q .figure { margin: 14px auto 0; font-weight: 400; }
.chq-panels { gap: 12px; }
.chq-panels > .fig-panel { flex: 1 1 140px; min-width: 120px; }
.chq-panels .fig-caption { margin-top: 8px; font-family: var(--font-mono); }
.dr-chq {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin: 6px 16px 14px; padding: 10px 12px; text-decoration: none; font-weight: 600; color: var(--ink);
    background: var(--signal-soft); border: 1px solid rgba(var(--signal-rgb), 0.45); border-radius: var(--radius);
}
.dr-chq small { color: var(--ink-muted); font-family: var(--font-mono); font-weight: 400; font-size: 0.78rem; }
.dr-chq.current { border-color: var(--signal); box-shadow: inset -3px 0 0 var(--signal); }
.dropdown-item.current .dd-label { color: var(--signal); }
.dr-tabs { margin: 8px 16px 12px; }
.dr-tabs .sp-mode { padding: 8px 4px; font-size: 0.92rem; }

/* قسم «محاكيات»: المحاكي مع شرحه وقراءته المباشرة ومناقشة نتائجه
   على الحاسوب: الشرح يميناً والمحاكي يساراً ثابتاً في مكانه أثناء القراءة (مثل الدروس) */
.sg-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 22px; }
.sg-chips-label { font-size: 0.82rem; color: var(--ink-muted); margin-left: 6px; }
.sg-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
    font-size: 0.85rem; line-height: 1.7; color: var(--ink-soft); text-decoration: none;
    border: 1px solid var(--line-strong); border-radius: 2px;
}
a.sg-chip:hover, a.sg-chip:focus-visible { color: var(--ink); background: var(--hover); }
.sg-chip.current { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 700; }
.sg-chip-n { font-family: var(--font-mono); font-size: 0.76rem; opacity: 0.8; }
.sg-idea, .sg-summary { line-height: 1.95; }
.sg-idea { margin: 0 0 28px; }
.sg-shared { margin: -16px 0 24px; font-size: 0.92rem; color: var(--ink-muted); line-height: 1.9; }
.sg-shared a { color: var(--signal); }
.sg-summary { margin: 36px 0 0; }
.sg-idea .callout-title, .sg-summary .callout-title { display: block; margin-bottom: 4px; }
.sg-idea .eq { margin-top: 6px; }

.sg-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.sg-layout.is-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.sg-text { grid-column: 1; grid-row: 1; min-width: 0; }
.sg-sim-col {
    grid-column: 2; grid-row: 1; min-width: 0;
    position: sticky; top: calc(var(--nav-h) + 16px); z-index: 3;
    max-height: calc(100vh - var(--nav-h) - 32px); overflow-y: auto; scrollbar-width: thin;
    display: flex; flex-direction: column; gap: 14px;
}
.sg-sim-col .sim-panel { position: static; margin: 0; }
/* محاكيات عريضة (الفصل الثاني، layout: 'top'): المحاكي وقراءته في الأعلى بعرض الصفحة، والشرح تحتهما */
.sg-layout.is-top { grid-template-columns: minmax(0, 1fr); }
.sg-layout.is-top .sg-sim-col { grid-column: 1; grid-row: 1; position: static; max-height: none; overflow: visible; }
.sg-layout.is-top .sg-text { grid-column: 1; grid-row: 2; }
@media (min-width: 1101px) {
    .sg-layout.is-top .sg-sim-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; gap: 20px; }
}
/* مختبرات الفصل السادس (layout: 'full'): المختبر بتخطيطه «شاشة واحدة» (.lx) بعرض الصفحة كله، ثم قراءته المباشرة، ثم الشرح */
.sg-layout.is-full { grid-template-columns: minmax(0, 1fr); }
.sg-layout.is-full .sg-sim-col { grid-column: 1; grid-row: 1; position: static; max-height: none; overflow: visible; }
.sg-layout.is-full .sg-text { grid-column: 1; grid-row: 2; }

/* القراءة المباشرة تحت المحاكي */
.sg-live { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--inset); padding: 14px 16px; }
.sg-live-title {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 12px;
    font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: var(--signal);
}
.sg-live-title small { font-size: 0.76rem; font-weight: 500; color: var(--ink-muted); }
.sg-live-body { font-size: 0.98rem; line-height: 1.85; color: var(--ink-soft); }
.sg-live-body > * + * { margin-top: 10px; }
.sg-live-body .sol-steps { gap: 10px; }
.sg-live-body .katex-display { margin: 0.25em 0 0; }
.sg-vals { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 112px), 1fr)); gap: 6px; margin: 0; }
.sg-vals > div { min-width: 0; padding: 4px 9px; background: var(--raise); border: 1px solid var(--line); border-radius: 2px; }
.sg-vals dt { font-size: 0.76rem; line-height: 1.6; color: var(--ink-muted); }
.sg-vals dd { margin: 0; text-align: right; font-family: var(--font-mono); font-weight: 500; font-size: 0.95rem; color: var(--ink); overflow-wrap: anywhere; }
.sg-vals .sig dd { color: var(--signal); }
.sg-vals .bad { border-color: rgba(var(--bad-rgb), 0.5); }
.sg-vals .bad dd { color: var(--bad); }
.sg-say { margin: 0; }
.sg-say.ok { color: var(--ok); }
.sg-say.bad { color: var(--ink); padding: 8px 12px; background: rgba(var(--bad-rgb), 0.08); border-right: 3px solid var(--bad); }
.sg-say.hint { color: var(--ink-muted); font-size: 0.9rem; }

/* أقسام الشرح: كيف تستعمل، مناقشة النتائج، جرّب وتوقّع، حدود المحاكي */
.sg-sec + .sg-sec { margin-top: 36px; }
.sg-h {
    display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding-bottom: 8px;
    border-bottom: 1px solid var(--line-strong);
}
.sg-h-n {
    flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 2px;
    background: var(--signal); color: var(--signal-ink); font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600;
}
.sg-lead { color: var(--ink-muted); margin: -4px 0 12px; font-size: 0.95em; }
.sg-use { margin: 0; }
.sg-use > div { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 2fr); gap: 2px 16px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.sg-use > div:first-child { padding-top: 0; }
.sg-use dt { color: var(--ink); font-weight: 700; }
.sg-use dd { margin: 0; }
.sg-results, .sg-try { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.sg-results { counter-reset: sg-r; }
.sg-results > li {
    counter-increment: sg-r; position: relative; padding: 14px 52px 14px 16px;
    background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius);
}
.sg-results > li::before {
    content: counter(sg-r); position: absolute; top: 14px; right: 14px; width: 26px; height: 26px;
    display: grid; place-items: center; border: 1px solid var(--signal); border-radius: 50%;
    color: var(--signal); font-family: var(--font-mono); font-size: 0.85rem; line-height: 1;
}
.sg-res-t { margin: 0 0 4px; font-size: 1.08rem; line-height: 1.7; color: var(--ink); }
.sg-see { margin: 6px 0 0; }
.sg-why { margin-top: 6px; }
.sg-k { font-weight: 700; color: var(--signal); margin-left: 4px; }
.sg-why .katex-display, .sg-try-a .katex-display { margin: 0.3em 0; }
.sg-why .table-wrap { margin: 10px 0; }
.sg-table { font-size: 0.92rem; }
.sg-table td, .sg-table th { text-align: center; }
.sg-try { counter-reset: sg-t; }
.sg-try > li { counter-increment: sg-t; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.sg-try-q::before { content: "تجربة " counter(sg-t) ": "; color: var(--signal); font-weight: 700; }
.sg-try-q { color: var(--ink); }
.sg-try .reveal { margin-top: 10px; }
.sg-try-a { padding-bottom: 4px; }
.sg-limits { margin: 0; padding-right: 20px; }
.sg-limits li + li { margin-top: 8px; }
.sg-limits li::marker { color: var(--ink-muted); }
.sg-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 0; font-size: 0.9rem; color: var(--ink-muted); }

/* لغز / تحدي: إطار متقطع */
.puzzle {
    position: relative; background: transparent;
    border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 24px; margin-top: 40px;
}
.puzzle.soft-glow, .puzzle.no-glow { /* أسماء قديمة: لم يعد هناك توهج */ }
:where(.puzzle) .puzzle-title { color: var(--ink); margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
h4.puzzle-title { font-size: 1.25rem; }
.puzzle-icon { font-size: 1.35rem; }

/* بطاقة عريضة (نص + محاكي) */
.feature-card {
    background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; margin-bottom: 30px;
    display: flex; flex-wrap: wrap; gap: 30px; align-items: center;
}
.feature-text { flex: 1; min-width: min(100%, 300px); }
.feature-text > h3 { margin: 0 0 14px; font-size: 1.4rem; }

/* بلاطات متجاورة (حالات / قوانين) */
.tiles { display: flex; gap: 18px; flex-wrap: wrap; margin: 30px 0; }
.tiles.flush { margin-top: 0; }
.tile {
    flex: 1; min-width: min(100%, 250px); background: var(--raise);
    border: 1px solid var(--line); border-top: 2px solid var(--ink-muted);
    border-radius: var(--radius); padding: 20px;
}
.tile > h3, .tile > h4 { color: var(--ink); margin: 0 0 10px; font-size: 1.22rem; }
.tile.slim { background: var(--raise); }
.tile.side { min-width: min(100%, 200px); padding: 14px 16px; border: 1px solid var(--line); border-right: 2px solid var(--ink-muted); }
.tile.side > b:first-child { color: var(--ink); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; margin-bottom: 40px; }
.tile-grid.wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 22px; }
.tile-icon { font-size: 2.2rem; text-align: center; margin-bottom: 12px; }
.tile-grid .tile > h3 { font-size: 1.22rem; margin-bottom: 14px; }
.tile-grid .tile.centered > h3 { text-align: center; }
.tile-grid .tile p, .tile-grid .tile li { color: var(--ink-soft); line-height: 1.85; font-size: 1.05rem; }
.tile ul.disc { list-style: disc; margin-right: 20px; padding: 0; }
.tile ul.plain { list-style: none; padding: 0; line-height: 1.85; }
.tile ul.plain li { margin-bottom: 8px; }

/* قائمة صناديق (أهداف / حالات) */
.box-list { list-style: none; padding: 0; line-height: 1.85; margin-bottom: 0; }
:where(.lesson-content) .box-list { padding-right: 0; }
.box-list > li { margin-bottom: 12px; background: var(--raise); border: 1px solid var(--line); padding: 14px 16px; border-radius: var(--radius); }
.box-list > li:last-child { margin-bottom: 0; }
.box-list > li[class*="accent-"] { border-right: 2px solid var(--ink-muted); }
.box-list.spaced > li { margin-bottom: 22px; }
.box-list.lit > li { margin-bottom: 10px; }
.box-title { color: var(--ink); font-weight: 700; font-size: 1.1rem; }
.box-title.lg { font-size: 1.18rem; }

/* قوائم عامة */
.plain-list { list-style: none; padding: 0; line-height: 1.85; }
:where(.lesson-content) .plain-list, :where(.lesson-content) .law-list { padding-right: 0; }
.spaced-list { margin-right: 20px; line-height: 1.85; margin-bottom: 15px; }
.disc-list { list-style: disc; margin-right: 20px; color: var(--ink-soft); line-height: 1.85; }
.law-list { list-style: none; padding: 0; line-height: 2; margin-bottom: 0; }
.law-list > li { margin-bottom: 10px; }
.law-list > li:last-child { margin-bottom: 0; }
.circle-list { list-style: circle; margin-right: 20px; color: var(--ink-soft); margin-top: 5px; margin-bottom: 0; }
.inner-list.indent { margin-right: 20px; }

/* عناصر صغيرة مساعدة */
.pill {
    display: inline-block; color: var(--ink); background: var(--inset); border: 1px solid var(--line-strong);
    padding: 4px 14px; border-radius: 2px; margin: 0 10px; font-size: 1.2em;
}
.eq-line { display: inline-block; margin-top: 5px; color: var(--ink); }
.dark-box { background: var(--inset); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius); margin-top: 20px; text-align: center; }
.dark-box.tight { padding: 10px; }
.dark-box.left { text-align: right; }
.banner { background: var(--inset); border: 1px solid var(--line); color: var(--ink); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 20px; }
.formula-pair { background: var(--inset); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius); margin-top: 10px; color: var(--ink); }
.formula-pair > div + div { margin-top: 12px; }
.math-row { text-align: center; margin-top: 15px; background: var(--inset); border: 1px solid var(--line); padding: 10px; border-radius: var(--radius); color: var(--ink); font-size: 1.15em; }
.check-note { color: var(--ink-muted); font-size: 0.9rem; text-align: center; margin: 15px 0 0; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.table-note { margin-top: -15px; margin-bottom: 30px; }

/* صناديق صغيرة متجاورة */
.mini-row { display: flex; gap: 16px; flex-wrap: wrap; }
.mini { flex: 1; min-width: min(100%, 220px); background: var(--inset); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius); }
.mini.center { text-align: center; padding: 10px; }
.mini.edge { border-right: 2px solid var(--ink-muted); padding: 18px; min-width: min(100%, 250px); }
.mini h5 { color: var(--ink); margin-bottom: 10px; font-size: 1.08rem; }
.mini ul { list-style: none; padding: 0; color: var(--ink-soft); line-height: 1.85; margin: 0; }

/* صندوق حساب */
.calc { display: flex; flex-direction: column; align-items: center; background: var(--inset); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius); margin-top: 15px; }
.calc-label { color: var(--ink-muted); font-size: 0.9rem; }
.boxed-result { text-align: center; padding: 10px; background: var(--inset); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.alert-box { text-align: center; padding: 14px; border-radius: var(--radius); margin-top: 15px; border: 1px dashed var(--bad); background: rgba(var(--bad-rgb), 0.06); }

/* =========================================================
   الجداول: خلايا بحدود كاملة مثل جداول المخططات
   ========================================================= */
.table-wrap { overflow-x: auto; margin-bottom: 30px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; text-align: right; font-size: 1.02rem; }
.data-table.nowrap-math .katex { white-space: nowrap; }   /* مدى قيم مثل 100 − 600 V لا ينقسم */
.data-table thead tr { background: var(--inset); }
.data-table th, .data-table td { border: 1px solid var(--line); }
.data-table tr > :first-child { border-right: none; }
.data-table tr > :last-child { border-left: none; }
.data-table thead tr:first-child > * { border-top: none; }
.data-table tbody tr:last-child > * { border-bottom: none; }
.data-table thead th { border-bottom: 1px solid var(--line-strong); }
:where(.data-table) th { padding: 12px 14px; color: var(--ink); font-weight: 700; }
.data-table td { padding: 12px 14px; color: var(--ink-soft); }
.data-table td small { display: block; color: var(--ink-muted); font-size: 0.85rem; }
.data-table th small { display: block; font-size: 0.8rem; font-weight: 500; color: var(--ink-muted); }
.data-table td.key { font-weight: 700; color: var(--ink); background: rgba(255, 255, 255, 0.02); }
.data-table .note { font-size: 0.95rem; }

/* =========================================================
   الأشكال التوضيحية (SVG): مساحة رسم بشبكة دقيقة
   ========================================================= */
.figure {
    background: var(--grid-fine), var(--screen);
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    padding: 20px; margin-bottom: 25px; text-align: center;
}
.figure svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.fig-board { background: transparent; }
.fig-row { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }
.fig-row > .fig-panel { flex: 1; min-width: min(100%, 250px); }
.fig-row.tight { gap: 12px; }
.fig-row.tight > .fig-panel { min-width: min(100%, 90px); }   /* رسوم صغيرة متجاورة داخل بطاقة */
.fig-row.tight.two > .fig-panel { min-width: min(100%, 170px); }   /* رسمان: متجاوران على الشاشة العريضة، وأحدهما فوق الآخر على الجوال */
.fig-row.panels > .figure { flex: 1; min-width: min(100%, 300px); margin-bottom: 0; }
.fig-subtitle { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 10px; line-height: 1.6; }
.fig-subtitle .tag { color: var(--ink-muted); font-family: var(--font-mono); }
.fig-caption {
    display: inline-block; margin-top: 16px; padding: 2px 12px;
    border: 1px solid var(--line-strong); border-radius: 2px;
    color: var(--ink); font-weight: 600; font-size: 0.95rem;
}
.fig-note { color: var(--ink-muted); font-size: 0.85rem; margin-top: 6px; }
.problem .figure { margin-top: 20px; }
.problem .figure:last-child { margin-bottom: 0; }

/* عناصر الرسم داخل SVG */
.wire { stroke: var(--ink-soft); stroke-width: 2; fill: none; }
.wire.light { stroke: var(--ink); }
.wire.cyan { stroke: var(--signal); }
.plate-pos { stroke: var(--pos); stroke-width: 4; }
.plate-neg { stroke: var(--neg); stroke-width: 4; }
.plate-plain { stroke: var(--ink); stroke-width: 4; }
.bat-pos { stroke: var(--ink); stroke-width: 4; }
.bat-neg { stroke: var(--ink-muted); stroke-width: 3; }
.bat-thin { stroke: var(--ink); stroke-width: 2; }
.bat-thick { stroke: var(--ink); stroke-width: 5; }
.halo { paint-order: stroke; stroke: var(--screen); stroke-width: 4px; stroke-linejoin: round; }
.dielectric { fill: rgba(var(--signal-rgb), 0.8); }
.dielectric.cyan { fill: rgba(var(--signal-rgb), 0.16); stroke: var(--signal); }
.t-label { fill: var(--ink); font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.t-ar { fill: var(--ink-soft); font-family: var(--font-body); font-size: 12px; }
.t-amber { fill: var(--signal); }
.t-red { fill: var(--pos); }                 /* إشارات الشحنة الموجبة */
.t-cyan { fill: var(--neg); }                /* إشارات الشحنة السالبة */
.t-label.t-red { fill: var(--signal); }      /* قيمة (مثل ΔV) وليست شحنة */
.t-muted { fill: var(--ink-muted); }
.t-dark { fill: var(--signal-ink); }
.meter-face { fill: var(--bg-deep); stroke: var(--ink-muted); stroke-width: 3; }
.meter-arc { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-dasharray: 2 3; }
.meter-needle { stroke: var(--signal); stroke-width: 2; stroke-linecap: round; }
.bulb { fill: rgba(var(--signal-rgb), 0.16); stroke: var(--signal); stroke-width: 2; }
.bulb-filament { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.resistor { fill: var(--screen); stroke: var(--ink); stroke-width: 1.5; }
/* عناصر رسم عامة للأشكال الجديدة */
.fig-line { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.fig-solid { fill: var(--screen); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.fig-thin { fill: none; stroke: var(--ink-muted); stroke-width: 1; }
.fig-accent { fill: none; stroke: var(--signal); stroke-width: 2; }
.fig-field { fill: none; stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 3 2; }
.fig-arrowhead { fill: var(--ink-soft); }
/* متجهات وقوى وجسيمات (الفصل الثاني) */
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }   /* تعريفات الأسهم المشتركة لأشكال الدرس */
.fig-vec { stroke: var(--ink); stroke-width: 2; fill: none; }               /* السرعة */
.fig-vec.soft { stroke: var(--ink-soft); }                                   /* المجال B */
.fig-force { stroke: var(--signal); stroke-width: 2.5; fill: none; }        /* القوة */
.fig-fieldline { stroke: var(--ink-muted); stroke-width: 1.2; fill: none; } /* خطوط المجال */
.fig-path { stroke: var(--ink-soft); stroke-width: 1.8; stroke-dasharray: 6 4; fill: none; }  /* مسار الجسيم */
.ah-ink { fill: var(--ink); }
.ah-soft { fill: var(--ink-soft); }
.ah-muted { fill: var(--ink-muted); }
.ah-signal { fill: var(--signal); }
.q-pos { fill: var(--screen); stroke: var(--pos); stroke-width: 2; }
.q-neg { fill: var(--screen); stroke: var(--neg); stroke-width: 2; }
.t-vec { fill: var(--ink); font-family: 'Times New Roman', serif; font-weight: 700; font-style: italic; font-size: 16px; }
.t-vec.sig { fill: var(--signal); }
.t-sub { font-size: 11px; }
.fig-tag { fill: var(--screen); stroke: var(--line-strong); stroke-width: 1; }
.fig-tag.sig { stroke: var(--signal); }
.fig-display { fill: #04101F; stroke: var(--line-strong); stroke-width: 1; }
.fig-digits { fill: var(--ink-muted); font-family: var(--font-mono); font-size: 18px; font-weight: 500; }
.fig-digits.on { fill: var(--signal); }
.mag-n { fill: rgba(234, 241, 248, 0.16); }
.fig-area { fill: rgba(var(--signal-rgb), 0.14); stroke: var(--ink); stroke-width: 2.5; }   /* سطح (مساحة) مظلل */
.fig-wind { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; }      /* لفات ملف */
.fig-needle { stroke: var(--signal); stroke-width: 2.5; stroke-linecap: round; }   /* مؤشر جهاز قياس */
.fig-needle.zero { stroke: var(--ink-soft); }
.fig-needle.ghost { stroke-dasharray: 3 3; opacity: 0.6; }
.fig-dot { fill: var(--ink-muted); }                                        /* مجال نحو خارج الصفحة */
.fig-shade { fill: rgba(var(--signal-rgb), 0.1); }                              /* مساحة مظللة (تتراكب فتغمق) */
.area-vec { stroke-width: 2.6; }                                            /* متجه المساحة */
.bind-vec { stroke: var(--signal); stroke-width: 4; fill: none; }          /* المجال المغناطيسي المحتث */
.eddy { fill: none; stroke: var(--signal); stroke-width: 1.6; }            /* مسار تيار دوامي */
.eddy.thin { stroke-width: 1.1; opacity: 0.75; }
.plate-sheet { fill: rgba(234, 241, 248, 0.1); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }   /* صفيحة فلزية رقيقة */
.pend-plate { fill: rgba(234, 241, 248, 0.18); stroke: var(--ink); stroke-width: 1.5; }   /* صفيحة بندول */
.slot { fill: var(--bg-deep); }                                             /* شق في صفيحة مقطعة */
.curve-phi { fill: none; stroke: var(--ink-soft); stroke-width: 2; }       /* منحنى الفيض */
.curve-emf { fill: none; stroke: var(--signal); stroke-width: 2.4; }       /* منحنى القوة الدافعة أو التيار */
.avg-line { stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 2 4; }   /* خط القيمة المتوسطة */
.q-dot { fill: var(--signal); }                                            /* علامة على أحد جانبي الملف */
.force-dot { fill: var(--signal); }                                       /* قوة نحو خارج الصفحة */
.core-cyl { fill: rgba(234, 241, 248, 0.07); stroke: var(--ink-muted); stroke-width: 1; }   /* قلب أسطواني لملف */
.head-core { fill: none; stroke: var(--ink-muted); stroke-width: 8; stroke-linejoin: round; opacity: 0.8; }   /* قلب رأس قراءة */
.water { fill: rgba(150, 190, 235, 0.16); }                                 /* ماء داخل إناء */
.pot-base { fill: rgba(234, 241, 248, 0.3); stroke: var(--ink); stroke-width: 1.5; }   /* قاعدة إناء معدني */
.glass-pot { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 5 3; }   /* إناء زجاجي */
.cooktop { fill: rgba(234, 241, 248, 0.08); stroke: var(--ink-muted); stroke-width: 1; }   /* السطح العلوي للطباخ */
.core-bar { fill: var(--ink-muted); opacity: 0.55; }                     /* قلب حديدي داخل ملف */
.coil-ring { fill: rgba(var(--signal-rgb), 0.08); stroke: var(--ink); stroke-width: 4; }   /* ملف دائري مائل */
.coil-band { fill: var(--screen); stroke: var(--ink-soft); stroke-width: 1.5; }   /* ملف ملفوف على قلب */
.closed-surface { fill: rgba(var(--signal-rgb), 0.06); stroke: var(--signal); stroke-width: 1.8; stroke-dasharray: 6 4; }
.rain { stroke: var(--ink-muted); stroke-width: 1.6; stroke-linecap: round; }
.rain.hit { stroke: var(--signal); }
.rain-frame { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }

/* =========================================================
   المحاكيات (المحتوى يولده js/sims.js)
   مثل "أجهزة قياس": شاشة داكنة بشبكة، وأرقام بخط ثابت العرض
   ========================================================= */
.sim-panel, .sim-wide, .sim-inline, .sim-showcase {
    background: var(--grid-fine), var(--screen);
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    padding: 24px; text-align: center;
}
.sim-panel { position: sticky; top: calc(var(--nav-h) + 20px); z-index: 3; }   /* فوق الرسوم المتحركة (.mo-fig) التي تمر تحته */
.lesson-content > .sim-panel { position: static; }   /* محاكٍ بعرض الدرس (لا بجانب نص): لا يُثبَّت، وإلا غطّى بقية الدرس كلها أثناء التمرير */
.sim-wide { margin: 40px 0; }
.sim-inline { flex: 1; min-width: min(100%, 280px); padding: 20px; }
.sim-showcase { margin: 40px auto; max-width: 600px; padding: 28px; }

.sim-title {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    color: var(--ink); font-weight: 700;
    font-size: 1.05rem; line-height: 1.6; margin-bottom: 20px;
}
.sim-title::before {   /* مؤشر "جهاز يعمل" */
    content: ""; width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%;
    background: var(--signal); box-shadow: 0 0 0 3px rgba(var(--signal-rgb), 0.18);
}
.sim-title.center { text-align: center; }
.sim-label { color: var(--ink-soft); font-size: 0.98rem; display: block; margin-bottom: 10px; }
.sim-label .sim-range { display: block; margin: 12px auto 0; }
.sim-range { width: 90%; }
.sim-caption { color: var(--ink-muted); font-size: 0.88rem; margin-top: 14px; line-height: 1.8; }
.sim-note { color: var(--ink-muted); font-size: 0.82rem; margin: 0; line-height: 1.8; }
.sim-meters { display: flex; justify-content: space-around; gap: 8px; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.sim-meters span { font-size: 0.85rem; color: var(--ink-muted); }
.sim-meters b, .sim-readout { direction: ltr; unicode-bidi: isolate; font-family: var(--font-mono); font-weight: 500; font-size: 1.2rem; color: var(--ink); }

/* شريط التمرير الموحد لكل المحاكيات */
:is(.sim-panel, .sim-wide, .sim-inline, .sim-showcase) input[type="range"] {
    -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer;
    accent-color: var(--signal);
}
:is(.sim-panel, .sim-wide, .sim-inline, .sim-showcase) input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--line-strong); border-radius: 2px; }
:is(.sim-panel, .sim-wide, .sim-inline, .sim-showcase) input[type="range"]::-moz-range-track { height: 4px; background: var(--line-strong); border-radius: 2px; }
:is(.sim-panel, .sim-wide, .sim-inline, .sim-showcase) input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px;
    background: var(--signal); border: 3px solid var(--screen); border-radius: 50%; box-shadow: 0 0 0 1px var(--signal);
}
:is(.sim-panel, .sim-wide, .sim-inline, .sim-showcase) input[type="range"]::-moz-range-thumb {
    width: 12px; height: 12px; background: var(--signal); border: 3px solid var(--screen); border-radius: 50%; box-shadow: 0 0 0 1px var(--signal);
}
:is(.sim-panel, .sim-wide, .sim-inline, .sim-showcase) input[type="range"]:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }

/* محاكي التجاذب (درس 1-2) */
.pa-stage { display: flex; justify-content: center; align-items: center; gap: 44px; margin: 24px 0; position: relative; height: 180px; }
.pa-plate {
    width: 22px; height: 100%; border-radius: 2px; display: flex; flex-direction: column;
    justify-content: space-evenly; align-items: center; font-family: var(--font-mono); font-weight: 500;
    transition: background-color 0.2s ease;
}
.pa-plate.pos { border: 2px solid var(--pos); color: var(--pos); font-size: 1.2rem; }
.pa-plate.neg { border: 2px solid var(--neg); color: var(--neg); font-size: 1.4rem; }
.pa-field { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 44px; height: 140px; display: flex; flex-direction: column; justify-content: space-evenly; opacity: 0; transition: opacity 0.2s ease; }
.pa-line { height: 1.5px; background: var(--signal); width: 100%; position: relative; }
.pa-line span { position: absolute; right: -6px; top: -10px; color: var(--signal); font-size: 0.8rem; }

/* محاكي الخزانات (درس 1-3) */
.wt-stage { display: flex; justify-content: space-around; align-items: flex-end; height: 190px; margin-bottom: 20px; border-bottom: 2px solid var(--line-strong); padding-bottom: 6px; }
.wt-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.wt-tank { height: 130px; border: 2px solid var(--ink-muted); border-top: none; position: relative; display: flex; align-items: flex-end; background: var(--raise); border-radius: 0 0 2px 2px; overflow: hidden; }
.wt-tank.narrow { width: 24px; }   /* عرض الخزانين بنسبة 1:5 مثل نسبة سعتيهما في المحاكي */
.wt-tank.wide { width: 120px; }
.wt-water {   /* تظليل مائل مثل "المقطع" في الرسم الهندسي */
    width: 100%; height: 0%; border-top: 2px solid var(--ink);
    background: repeating-linear-gradient(-45deg, rgba(195, 210, 226, 0.5) 0 2px, rgba(195, 210, 226, 0.12) 2px 7px);
    transition: height 0.2s ease-out;
}
.wt-name { margin-top: 10px; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); line-height: 1.6; }

/* محاكي الاستقطاب (درس 1-4) */
.dp-stage { display: flex; justify-content: space-between; align-items: center; margin: 32px 0; position: relative; height: 180px; padding: 0 20px; }
.dp-plate { width: 20px; height: 100%; border-radius: 2px; display: flex; flex-direction: column; justify-content: space-evenly; align-items: center; font-family: var(--font-mono); font-weight: 500; }
.dp-plate.pos { background: rgba(255, 138, 128, 0.14); border: 2px solid var(--pos); color: var(--pos); }
.dp-plate.neg { background: rgba(124, 199, 255, 0.14); border: 2px solid var(--neg); color: var(--neg); }
.dp-slab { width: 120px; height: 140px; background: rgba(var(--signal-rgb), 0.05); border: 1px dashed var(--line-strong); border-radius: 2px; display: flex; flex-direction: column; justify-content: space-evenly; align-items: center; position: relative; }
.dp-atom { width: 40px; height: 30px; background: var(--raise); border: 1px solid var(--ink-muted); border-radius: 50%; display: flex; justify-content: space-between; align-items: center; padding: 0 5px; font-family: var(--font-mono); transition: width 0.3s ease; }
.dp-electron { color: var(--neg); font-weight: 600; transition: transform 0.3s; }
.dp-nucleus { color: var(--pos); font-weight: 600; transition: transform 0.3s; }
.dp-arrow { position: absolute; height: 2px; }
.dp-arrow.original { top: -30px; left: 10px; width: 100px; background: var(--ink-soft); }
.dp-arrow.induced { bottom: -30px; left: 50%; width: 0; background: var(--signal); transition: width 0.3s, left 0.3s; }
.dp-arrow .head { position: absolute; top: -11px; font-size: 0.9rem; }
.dp-arrow.original .head { left: -6px; color: var(--ink-soft); }
.dp-arrow.induced .head { right: -6px; color: var(--signal); }
.dp-arrow .name { position: absolute; font-size: 0.78rem; white-space: nowrap; }
.dp-arrow.original .name { top: -24px; left: 20px; color: var(--ink-soft); }
.dp-arrow.induced .name { top: 8px; left: -10px; color: var(--signal); }

/* محاكي العوامل الثلاثة (درس 1-5) */
.cf-stage { display: flex; justify-content: center; align-items: center; position: relative; height: 180px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 2px; background: rgba(0, 0, 0, 0.18); overflow: hidden; }
.cf-dielectric {   /* العازل: تظليل مائل بلون التمييز، شفافيته تتبع k */
    position: absolute; width: 60px; height: 80px; opacity: 0; transition: all 0.2s;
    background: repeating-linear-gradient(-45deg, rgba(var(--signal-rgb), 0.8) 0 2px, rgba(var(--signal-rgb), 0.14) 2px 7px);
}
.cf-plate { position: absolute; width: 10px; height: 80px; border-radius: 1px; transition: all 0.2s; }
.cf-plate.pos { left: 30%; background: var(--pos); }
.cf-plate.neg { right: 30%; background: var(--neg); }
.cf-controls { text-align: right; font-size: 0.92rem; }
.cf-controls label { display: block; margin-bottom: 6px; color: var(--ink-soft); }
.cf-controls input { width: 100%; margin-bottom: 10px; }
.cf-total { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.cf-total span { font-size: 0.88rem; color: var(--ink-muted); }
.cf-total b { font-size: 1.8rem; color: var(--signal); }

/* محاكي التوالي والتوازي (درس 1-6) */
.sp-body { display: flex; gap: 20px; align-items: stretch; }
.sp-controls { flex: 1; min-width: 0; background: var(--raise); border: 1px solid var(--line); padding: 18px; border-radius: var(--radius); text-align: right; }
.sp-modes { display: flex; margin-bottom: 20px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 3px; gap: 3px; }
.sp-mode { flex: 1; padding: 8px; background: transparent; color: var(--ink-soft); font-weight: 600; border: none; border-radius: 2px; transition: background-color 0.15s, color 0.15s; }
.sp-mode:hover { color: var(--ink); background: var(--hover); }
.sp-mode.active, .sp-mode.active:hover { background: var(--signal); color: var(--signal-ink); }
.sp-controls label { color: var(--ink-soft); font-size: 0.9rem; display: block; }
.sp-controls input { width: 100%; margin-bottom: 2px; }
.sp-value { text-align: left; font-family: var(--font-mono); font-weight: 500; direction: ltr; color: var(--ink); margin-bottom: 12px; }
.sp-screen { flex: 2; min-width: 0; position: relative; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.sp-diagram { width: 100%; max-width: 380px; }
.sp-diagram svg { display: block; width: 100%; height: auto; direction: ltr; overflow: visible; }
.sp-wire { fill: none; stroke: var(--ink-muted); stroke-width: 2; stroke-linejoin: round; }
.sp-bat { stroke: var(--ink); stroke-width: 2; }
.sp-bat.short { stroke-width: 4; }
.sp-plate { stroke: var(--ink); stroke-width: 3.5; }
.sp-q { fill: none; stroke-width: 1.6; stroke-linecap: round; }   /* إشارات الشحنة على صفيحتي المتسعة: عددها يتناسب مع Q */
.sp-q.pos { stroke: var(--pos); }
.sp-q.neg { stroke: var(--neg); }
.sp-name { fill: var(--ink-soft); font-family: var(--font-mono); font-size: 12px; }
.sp-val { fill: var(--ink); font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
.sp-cap.over .sp-plate { stroke: var(--bad); }
.sp-cap.over .sp-val { fill: var(--bad); }
.sp-warning { display: none; order: -1; width: 100%; margin-bottom: 14px; background: var(--bad); color: #3A0B0B; padding: 8px 14px; border-radius: 2px; font-weight: 700; font-size: 0.92rem; line-height: 1.6; }
.sp-warning.show { display: block; }

/* محاكي تراكم الطاقة (درس 1-7) */
.ce-graph { width: 200px; height: 150px; border-left: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); position: relative; margin: 0 auto 32px auto; }
.ce-graph-inner { width: 100%; height: 100%; position: absolute; bottom: 0; left: 0; }
.ce-fill { position: absolute; bottom: 0; left: 0; width: 0%; height: 0%; background: repeating-linear-gradient(-45deg, rgba(var(--signal-rgb), 0.7) 0 2px, rgba(var(--signal-rgb), 0.22) 2px 6px); clip-path: polygon(0 100%, 100% 0, 100% 100%); transition: width 0.2s, height 0.2s; }
.ce-axis-x { position: absolute; bottom: -26px; left: 50%; transform: translateX(-50%); color: var(--ink-soft); font-size: 0.85rem; white-space: nowrap; }
.ce-axis-y { position: absolute; left: -38px; top: 50%; transform: translateY(-50%) rotate(-90deg); color: var(--ink-soft); font-size: 0.85rem; white-space: nowrap; }
.ce-readout { margin-top: 15px; background: var(--inset); border: 1px solid var(--line); padding: 10px; border-radius: var(--radius); }
.ce-readout .row { display: flex; justify-content: space-around; margin-bottom: 6px; font-size: 0.9rem; color: var(--ink-soft); }
.ce-readout b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.ce-readout .m-pe { color: var(--signal); }

/* محاكي المتسعة الدوارة (درس 1-8) */
.rc-dial { position: relative; width: 160px; height: 80px; margin: 0 auto 30px auto; overflow: hidden; }
.rc-half { position: absolute; bottom: -80px; left: 0; width: 160px; height: 160px; border-radius: 50%; clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%); }
.rc-half.fixed { background: repeating-linear-gradient(0deg, rgba(195, 210, 226, 0.3) 0 2px, transparent 2px 8px); border: 2px solid var(--ink-soft); }
.rc-half.rotor { background: repeating-linear-gradient(90deg, rgba(var(--signal-rgb), 0.5) 0 2px, transparent 2px 8px); border: 2px solid var(--signal); transform-origin: center center; transform: rotate(-180deg); transition: transform 0.1s linear; }
.rc-axle { position: absolute; bottom: -6px; left: 74px; width: 12px; height: 12px; background: var(--ink); border-radius: 50%; z-index: 5; }
.rc-readout { margin-top: 15px; background: var(--inset); border: 1px solid var(--line); padding: 10px; border-radius: var(--radius); color: var(--ink-soft); }
.rc-readout b { font-size: 1.3rem; font-weight: 500; color: var(--signal); font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; }

/* محاكي دائرة RC (درس 1-9) */
.rcc-body { display: flex; gap: 20px; flex-wrap: wrap; }
.rcc-controls { flex: 1; min-width: min(100%, 250px); background: var(--raise); border: 1px solid var(--line); padding: 18px; border-radius: var(--radius); text-align: right; }
.rcc-controls label { font-size: 0.9rem; display: block; margin-bottom: 2px; color: var(--ink-soft); }
.rcc-controls input { width: 100%; margin-bottom: 12px; }
.rcc-buttons { display: flex; gap: 10px; margin-top: 8px; }
.rcc-buttons button { flex: 1; padding: 10px; font-weight: 700; border-radius: var(--radius); border: 1px solid transparent; transition: background-color 0.15s, border-color 0.15s; }
.rcc-charge { background: var(--signal); color: var(--signal-ink); }
.rcc-charge:hover { background: var(--signal-hover); }
.rcc-buttons .rcc-discharge { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.rcc-buttons .rcc-discharge:hover { background: var(--hover); }
.rcc-screen { flex: 2; min-width: min(100%, 300px); background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; justify-content: center; gap: 20px; text-align: right; }
.rcc-bar-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.rcc-bar-head .sim-readout { font-size: 1rem; }
.rcc-track { width: 100%; height: 14px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.rcc-bar { width: 0%; height: 100%; transition: width 0.05s linear; }
.rcc-bar.v-bar { background: var(--signal); }
.rcc-bar.i-bar { background: var(--ink-soft); }
.rcc-fig { width: 100%; height: auto; display: block; }
.rcc-tank { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
.rcc-water { fill: rgba(124, 199, 255, 0.45); }
.rcc-pipe { fill: rgba(124, 199, 255, 0.45); stroke: var(--ink-soft); stroke-width: 1; }
.rcc-curve { fill: none; stroke: var(--signal); stroke-width: 2; }
.rcc-taul { stroke: var(--ink-muted); stroke-width: 1; }
.rcc-dot { fill: var(--signal); stroke: var(--screen); stroke-width: 1.5; }

/* محاكي قوة لورنتز (درس 2-2) */
.lf-body, .fc-body { display: flex; gap: 20px; align-items: stretch; text-align: right; }
.lf-controls, .fc-controls { flex: 1; min-width: 0; background: var(--raise); border: 1px solid var(--line); padding: 18px; border-radius: var(--radius); }
.lf-controls label, .fc-controls label { color: var(--ink-soft); font-size: 0.9rem; display: block; }
.lf-controls input, .fc-controls input[type="range"] { width: 100%; margin-bottom: 2px; }
.lf-fire { width: 100%; margin-top: 4px; padding: 9px; background: transparent; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); font-weight: 600; }
.lf-fire:hover { background: var(--hover); }
.lf-screen, .fc-screen { flex: 2; min-width: 0; display: flex; flex-direction: column; gap: 12px; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.lf-screen svg, .fc-screen svg { display: block; width: 100%; height: auto; direction: ltr; }
.lf-bfield, .lf-plate { transition: opacity 0.2s; }
.lf-axis { stroke: var(--line-strong); stroke-dasharray: 4 5; }
.lf-trail { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lf-dot { fill: var(--screen); stroke-width: 2.5; }
.lf-dot.pos { stroke: var(--pos); }
.lf-dot.neg { stroke: var(--neg); }
.lf-sign { font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.lf-sign.pos { fill: var(--pos); }
.lf-sign.neg { fill: var(--neg); }
.lf-force { stroke: var(--signal); stroke-width: 2.5; }
.lf-flabel { fill: var(--signal); font-family: 'Times New Roman', serif; font-weight: 700; font-style: italic; font-size: 14px; }
.lf-readout, .fc-readout { display: flex; justify-content: space-around; gap: 8px; flex-wrap: wrap; color: var(--ink-muted); font-size: 0.9rem; }
.lf-readout b, .fc-readout b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); direction: ltr; unicode-bidi: isolate; }
.lf-status, .fc-status { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.92rem; line-height: 1.8; color: var(--ink-soft); }
.lf-status.balanced { color: var(--signal); }

/* محاكي الحث الكهرومغناطيسي (درس 2-3) */
.fc-controls .fc-check { display: flex; align-items: center; gap: 8px; margin: 6px 0 14px; cursor: pointer; }
.fc-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--signal); }
.fc-buttons { display: flex; gap: 10px; }
.fc-buttons button { flex: 1; padding: 10px; font-weight: 700; border-radius: var(--radius); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); transition: background-color 0.15s; }
.fc-buttons button:hover { background: var(--hover); }
.fc-buttons .fc-primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.fc-buttons .fc-primary:hover { background: var(--signal-hover); }
.fc-scale { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; }
.fc-tick { stroke: var(--ink-muted); stroke-width: 1; }
.fc-needle { stroke: var(--signal); stroke-width: 2.5; stroke-linecap: round; }
.fc-pivot { fill: var(--ink); }
.fc-magnet { cursor: grab; touch-action: none; }
.fc-magnet.dragging { cursor: grabbing; }
.fc-core { transition: opacity 0.2s; }
.fc-flux { flex: 1; min-width: 120px; height: 10px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; align-self: center; }
.fc-flux > span { display: block; height: 100%; width: 0; background: var(--ink-soft); }
.fc-readout > span { display: flex; align-items: center; gap: 8px; }

/* مختبر الفيض (درس 2-4) */
.fx-field { transition: opacity 0.15s; }
.fx-loop { fill: var(--signal); stroke: var(--ink); stroke-width: 3; }
.fx-loop.back { stroke-dasharray: 6 4; }
.fx-turn { fill: none; stroke: var(--ink); stroke-width: 1.2; opacity: 0.75; }   /* لفات الحلقة الإضافية (N) */
.fx-turn.back { stroke-dasharray: 4 3; }
.fx-axis { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 8 3 2 3; }
.fx-frame { fill: rgba(0, 0, 0, 0.15); stroke: var(--line); }
.fx-zero { stroke: var(--line-strong); stroke-dasharray: 3 4; }
.fx-phi { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linejoin: round; }
.fx-emf { fill: none; stroke: var(--signal); stroke-width: 2.2; stroke-linejoin: round; }
.fx-legend-phi { fill: var(--ink-soft); font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: 15px; }
.fx-legend-emf { fill: var(--signal); font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: 15px; }
.fx-reset { width: 100%; margin-top: 8px; padding: 9px; background: transparent; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); font-weight: 600; }
.fx-reset:hover { background: var(--hover); }

/* محاكي الساق على السكة والمصباح (درس 2-6) */
.rg-glow { fill: var(--signal); transition: opacity 0.1s; }
.rg-flow { fill: none; stroke: var(--signal); stroke-width: 2.5; stroke-dasharray: 6 12; stroke-linecap: round; }
.rg-table { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.rg-table > div { grid-column: span 2; }
.rg-table > .eq-pair { grid-column: span 3; }
.rg-table > div, .sim-table > div { background: var(--inset); border: 1px solid var(--line); border-radius: 2px; padding: 6px 10px; font-size: 0.85rem; color: var(--ink-muted); }
.rg-table b, .sim-table b { display: block; font-family: var(--font-mono); font-weight: 500; font-size: 1.05rem; color: var(--ink); direction: ltr; text-align: right; }
.rg-table .eq-pair b { color: var(--signal); }

/* محاكي الفيض المغناطيسي (درس 2-8) */
.fm-line { stroke: var(--ink-muted); stroke-width: 1.2; }
.fm-line.hit { stroke: var(--signal); stroke-width: 1.6; }
.fm-ring { fill: rgba(234, 241, 248, 0.08); stroke: var(--ink); stroke-width: 2.5; }
.fm-proj { fill: var(--signal-soft); stroke: var(--ink); stroke-width: 2; }
.fm-dot { fill: var(--ink-muted); }
.fm-dot.hit { fill: var(--signal); }
.fm-bracket { fill: none; stroke: var(--signal); stroke-width: 1.5; }

/* محاكيا الحث الذاتي والحث المتبادل (درسا 2-15 و2-17) */
.si-neon { fill: rgba(255, 140, 90, 0.15); stroke: var(--ink); stroke-width: 1.5; }
.si-neon-glow { fill: #FF8A5C; }
.si-spark { fill: var(--signal); }
.mc-needle { stroke: var(--signal); stroke-width: 2.5; stroke-linecap: round; }

/* محاكيا المجال الكهربائي المحتث ومختبر التطبيقات (درسا 2-18 و2-19) */
.ie-faint { opacity: 0.5; }
.ia-nylon { stroke: var(--ink-muted); stroke-dasharray: 2 3; }

/* محاكي بندولي التيارات الدوامة (درس 2-11) */
.ep-heat { fill: var(--signal); opacity: 0; pointer-events: none; }
.ep-eddy { opacity: 0; }
.ep-field { transition: opacity 0.3s; }

/* محاكي "الكون الخيالي" (درس 2-7) */
.lz-law { margin: -8px 0 16px; font-size: 0.9rem; color: var(--ink-muted); }
.lz-law b { color: var(--signal); font-family: var(--font-mono); font-weight: 700; }
.lz-glow { fill: none; stroke: var(--signal); stroke-width: 9; }
.sim-table { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sim-table b.ok, .lz-ok { color: var(--ok); }
.sim-table b.bad, .lz-bad { color: var(--bad); }
.lz-energy { display: flex; flex-direction: column; gap: 6px; }
.lz-bar { position: relative; height: 16px; background: var(--inset); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.lz-bar > span { position: absolute; top: 0; bottom: 0; width: 0; }
.lz-bar > .lz-ke { right: 0; background: var(--ink-soft); }
.lz-bar > .lz-q { background: var(--signal); }
.lz-bar > .lz-e0 { position: absolute; top: 0; bottom: 0; width: 0; border-right: 2px dashed var(--ink); }
.lz-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.82rem; color: var(--ink-muted); }
.lz-legend i { display: inline-block; width: 10px; height: 10px; margin-left: 6px; vertical-align: -1px; }
.lz-legend i.k { background: var(--ink-soft); }
.lz-legend i.q { background: var(--signal); }
.lz-legend i.e0 { width: 0; height: 12px; border-right: 2px dashed var(--ink); margin-left: 8px; }

/* محاكي لوحة المفاتيح (درس 1-10) */
.kb-mech { position: relative; width: 120px; height: 160px; margin: 0 auto; border-bottom: 3px solid var(--line-strong); }
.kb-key { position: absolute; top: 0; left: 20px; width: 80px; height: 45px; background: var(--bg-deep); color: var(--ink); font-family: var(--font-mono); font-size: 1.4rem; font-weight: 500; line-height: 43px; text-align: center; border-radius: var(--radius) var(--radius) 0 0; border: 1px solid var(--line-strong); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35); user-select: none; touch-action: none; transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1); }
.kb-stem { position: absolute; top: 45px; left: 52px; width: 16px; height: 35px; background: var(--ink-muted); transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1); }
.kb-plate-top { position: absolute; top: 80px; left: 10px; width: 100px; height: 7px; background: var(--neg); border-radius: 1px; transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1); }
.kb-plate-bottom { position: absolute; top: 120px; left: 10px; width: 100px; height: 7px; background: var(--pos); border-radius: 1px; }
.kb-signal { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); color: var(--signal); font-weight: 700; font-size: 1.05rem; opacity: 0; transition: opacity 0.2s; white-space: nowrap; }
/* الساق تنزل مع المفتاح والصفيحة العلوية، فلا تغطي حرف المفتاح عند الضغط */
.kb-mech.pressed .kb-key, .kb-mech.pressed .kb-stem, .kb-mech.pressed .kb-plate-top { transform: translateY(25px); }
.kb-mech.pressed .kb-signal { opacity: 1; }
.kb-status { margin-top: 25px; font-size: 1rem; font-weight: 600; color: var(--ink-muted); background: var(--inset); border: 1px solid var(--line); padding: 10px; border-radius: var(--radius); transition: color 0.15s, border-color 0.15s; }
.kb-status.active { color: var(--signal); border-color: rgba(var(--signal-rgb), 0.55); }

/* =========================================================
   قسم «خريطة القوانين» (js/laws.js): مخطط رابط ← بطاقات ← مرشد اختيار القانون ← الوحدات
   الأصفر هنا للعنصر النشط والنتيجة فقط، والأحمر لعنوان «انتبه»
   ========================================================= */
.lw-hero { display: grid; gap: 18px; margin-bottom: 8px; }
.lw-intro { margin: 0; }
.lw-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.lw-stats > div { padding: 10px 14px; display: flex; flex-direction: column-reverse; gap: 2px; }
.lw-stats > div + div { border-right: 1px solid var(--line); }
.lw-stats dd { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 500; color: var(--ink); line-height: 1.2; }
.lw-stats dt { font-size: 0.85rem; color: var(--ink-muted); }
.lw-jump { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.lw-jump button {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-align: right;
    background: var(--inset); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius);
    font-weight: 600; font-size: 0.98rem; cursor: pointer; transition: border-color 0.15s, background-color 0.15s;
}
.lw-jump button span { font-family: var(--font-mono); color: var(--signal); font-size: 0.85rem; }
.lw-jump button:hover, .lw-jump button:focus-visible { border-color: var(--signal); background: var(--hover); }

.lw-sec { margin-top: 52px; scroll-margin-top: calc(var(--nav-h) + 16px); }
.lw-h {
    display: flex; align-items: center; gap: 12px; margin: 0 0 10px; padding-bottom: 12px;
    border-bottom: 2px solid var(--signal); font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; color: var(--ink); line-height: 1.4;
}
.lw-hn { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 500; color: var(--signal-ink); background: var(--signal); padding: 1px 8px; border-radius: 2px; }
.lw-lead { color: var(--ink-soft); margin: 0 0 22px; }

/* المخطط الرابط: محطات على خط واحد (يمين الصفحة) */
.lw-metro { list-style: none; margin: 0; padding: 0; }
:where(.lesson-content) .lw-metro { padding-right: 0; }
.lw-stop { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 16px; padding-bottom: 30px; scroll-margin-top: calc(var(--nav-h) + 16px); }
.lw-stop::before { content: ""; position: absolute; right: 21px; top: 38px; bottom: 0; border-right: 2px solid var(--line-strong); }
.lw-stop:last-child { padding-bottom: 0; }
.lw-stop:last-child::before { display: none; }
.lw-stop-dot {
    width: 38px; height: 38px; display: grid; place-items: center; position: relative; z-index: 1;
    border: 2px solid var(--signal); border-radius: 50%; background: var(--sheet);
    font-family: var(--font-mono); font-weight: 500; color: var(--signal); font-size: 1.05rem;
}
.lw-stop-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 38px; }
:where(.lesson-content) .lw-stop-t { margin: 0; font-size: 1.3rem; }
.lw-ask { font-size: 0.9rem; color: var(--ink); border: 1px dashed var(--line-strong); padding: 2px 10px; border-radius: 2px; background: var(--raise); }
.lw-ask::before { content: "؟ "; color: var(--signal); font-weight: 700; }
.lw-stop-note { margin: 8px 0 12px; color: var(--ink-soft); font-size: 1rem; }
.lw-next { margin: 14px 0 0; font-size: 0.95rem; color: var(--ink-muted); }
.lw-next::before { content: "↓ "; color: var(--signal); font-weight: 700; }

.lw-nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.lw-nodes + .lw-nodes, .lw-cols + .lw-nodes, .lw-nodes + .lw-cols { margin-top: 12px; }
.lw-node {
    display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; min-width: 0; text-align: right;
    background: var(--inset); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius);
    font: inherit; cursor: pointer; transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.lw-node:hover, .lw-node:focus-visible { border-color: var(--signal); background: var(--hover); }
.lw-node-tag { font-size: 0.86rem; line-height: 1.5; color: var(--ink-muted); }
.lw-node-f { direction: ltr; text-align: center; font-size: 1.04rem; line-height: 1.6; overflow: hidden; }
.lw-nodes.lw-mini { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.lw-nodes.lw-mini .lw-node { padding: 6px 10px; gap: 2px; background: transparent; border-style: dashed; }
.lw-nodes.lw-mini .lw-node-f { font-size: 0.92rem; }
/* سلسلة: قوانين متتالية بينها أسهم (السهم يشير إلى اليسار، اتجاه القراءة) */
.lw-nodes.chain { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.lw-nodes.chain > .lw-node { flex: 1 1 190px; }
.lw-arr { flex: 0 0 18px; align-self: center; height: 12px; position: relative; }
.lw-arr::before { content: ""; position: absolute; inset: 5px 4px 5px 0; border-top: 2px solid var(--line-strong); }
.lw-arr::after { content: ""; position: absolute; left: 0; top: 1px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 7px solid var(--line-strong); }
.lw-nodes.chain.v { flex-direction: column; flex-wrap: nowrap; }
.lw-nodes.chain.v > .lw-node { flex: none; }
.lw-nodes.chain.v > .lw-arr, .lw-nodes.chain.v > .lw-arr { flex: 0 0 14px; width: 12px; height: 14px; }
.lw-nodes.chain.v > .lw-arr::before { inset: 0 5px 4px 5px; border-top: none; border-right: 2px solid var(--line-strong); }
.lw-nodes.chain.v > .lw-arr::after { left: 1px; top: auto; bottom: -2px; border-right: 5px solid transparent; border-left: 5px solid transparent; border-top: 7px solid var(--line-strong); border-bottom: none; }
.lw-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.lw-col { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 12px; }
:where(.lesson-content) .lw-col-h { margin: 0 0 10px; font-size: 1.02rem; color: var(--ink); text-align: center; }

@keyframes lw-flash { 0% { box-shadow: 0 0 0 0 rgba(var(--signal-rgb), 0.7); } 100% { box-shadow: 0 0 0 14px rgba(var(--signal-rgb), 0); } }
.lw-flash { animation: lw-flash 1.1s ease-out 2; }
.lw-node.lw-flash { border-color: var(--signal); }

/* بطاقات القوانين */
.lw-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.lw-fbtn, .lw-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; min-height: 34px;
    background: transparent; color: var(--ink-soft); border: 1px solid var(--line-strong); border-radius: 2px;
    font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.lw-fbtn:hover, .lw-chip:hover { color: var(--ink); background: var(--hover); }
.lw-fbtn.active, .lw-fbtn.active:hover { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.lw-group { margin-top: 30px; scroll-margin-top: calc(var(--nav-h) + 16px); }
.lw-group[hidden] { display: none; }
.lw-gh {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 0 0 14px; padding-bottom: 8px;
    border-bottom: 1px solid var(--line-strong); font-size: 1.15rem; font-weight: 700; color: var(--ink);
}
:where(.lesson-content) .lw-gh { font-family: var(--font-body); font-size: 1.15rem; margin: 0 0 14px; }
.lw-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.lw-card { position: relative; padding: 16px 18px; background: var(--raise); border: 1px solid var(--line-strong); border-radius: var(--radius); scroll-margin-top: calc(var(--nav-h) + 16px); min-width: 0; }
.lw-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.lw-num { font-family: var(--font-mono); font-size: 0.85rem; color: var(--signal); border: 1px solid rgba(var(--signal-rgb), 0.45); padding: 0 6px; border-radius: 2px; }
:where(.lesson-content) .lw-name { margin: 0; font-size: 1.12rem; flex: 1 1 200px; }
.lw-tomap { margin-inline-start: auto; background: transparent; border: 1px dashed var(--line-strong); color: var(--ink-muted); font: inherit; font-size: 0.8rem; padding: 1px 8px; border-radius: 2px; cursor: pointer; }
.lw-tomap:hover, .lw-tomap:focus-visible { color: var(--signal); border-color: var(--signal); }
.lw-formula {
    margin: 14px auto 12px; padding: 4px 14px; width: max-content; max-width: 100%;
    background: var(--inset); border: 1px solid var(--line-strong); outline: 1px solid var(--line); outline-offset: 3px; border-radius: 2px;
    color: var(--ink); font-size: 1.18em;
}
.lw-formula .katex-display { margin: 0.35em 0; }
.lw-say { margin: 0 0 12px; }
.lw-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0 24px; }
.lw-block { margin-top: 10px; }
:where(.lesson-content) .lw-block h5 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 0.95rem; color: var(--ink); }
.lw-block h5::before { content: ""; width: 7px; height: 7px; background: var(--ink-muted); border-radius: 1px; }
.lw-notes h5 { color: var(--bad); }
:where(.lesson-content) .lw-notes h5 { color: var(--bad); }
.lw-notes h5::before { background: var(--bad); }
:where(.lesson-content) .lw-block ul { margin: 0; padding-right: 20px; font-size: 1rem; line-height: 1.85; }
.lw-syms dl, .lw-syms > dl { margin: 0; display: grid; gap: 2px; font-size: 0.98rem; }
.lw-sym { display: flex; gap: 10px; align-items: baseline; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.lw-sym:last-child { border-bottom: none; }
.lw-sym dt { flex: 0 0 auto; min-width: 54px; text-align: center; color: var(--ink); }
.lw-sym dd { margin: 0; flex: 1; color: var(--ink-soft); }
.lw-u { display: inline-block; font-size: 0.85em; color: var(--ink-muted); border: 1px solid var(--line); padding: 0 6px; border-radius: 2px; margin-inline-start: 4px; }
.lw-alts { display: flex; flex-wrap: wrap; gap: 8px; }
.lw-alt-f { direction: ltr; padding: 3px 10px; background: var(--inset); border: 1px solid var(--line); border-radius: 2px; color: var(--ink); max-width: 100%; overflow-x: auto; }
.lw-ex { margin-top: 14px; }
.lw-ex-q { margin: 6px 0 4px; }
.lw-ex-q .katex { white-space: nowrap; }   /* عدد مثل 4×10⁻³ لا ينقسم بين سطرين */
.lw-ex-l .katex-display, .lw-ex-r .katex-display { margin: 0.25em 0; }
.lw-ex-r .katex { color: var(--signal); }

/* مرشد اختيار القانون */
.lw-fd { padding: 18px; background: var(--inset); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.lw-fd-step + .lw-fd-step { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
:where(.lesson-content) .lw-fd-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 10px; font-size: 1.05rem; }
.lw-fd-h small { color: var(--ink-muted); font-weight: 500; font-size: 0.85rem; }
.lw-fd-n { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--signal); color: var(--signal); font-family: var(--font-mono); font-size: 0.85rem; }
.lw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lw-chip { font-weight: 500; }
.lw-chip-s { direction: ltr; color: var(--ink); }
.lw-chip-n { font-size: 0.84rem; }
.lw-chip.sit { font-weight: 600; }
.lw-chip.on { background: var(--signal-soft); border-color: var(--signal); color: var(--ink); }
.lw-chip.sit.on, .lw-chip.want.on { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.lw-chip.want.on .lw-chip-s, .lw-chip.sit.on .lw-chip-s { color: var(--signal-ink); }
.lw-chip:disabled { opacity: 0.35; cursor: default; }
.lw-chip.add { border-style: dashed; }
.lw-fd-hint { margin: 10px 0 0; font-size: 0.95rem; color: var(--ink-muted); }
.lw-fd-hint[hidden] { display: none; }
.lw-fd-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.lw-fd-btn { padding: 6px 14px; background: transparent; color: var(--signal); border: 1px solid var(--signal); border-radius: 2px; font: inherit; font-weight: 600; font-size: 0.92rem; cursor: pointer; }
.lw-fd-btn:hover { background: var(--signal-soft); }
.lw-fd-btn.ghost { color: var(--ink-muted); border-color: var(--line-strong); }
.lw-fd-btn[hidden] { display: none; }
.lw-fd-out { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-strong); }
.lw-out-h { margin: 0 0 10px; color: var(--ink); font-weight: 700; }
.lw-out-h small { color: var(--ink-muted); font-weight: 500; margin-inline-start: 6px; }
.lw-out-msg { margin: 0 0 10px; }
:where(.lesson-content) .lw-rels { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lw-rels li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.lw-rel-f { direction: ltr; color: var(--ink); max-width: 100%; }
.lw-ex-n { margin: 0; color: var(--ink-soft); }
.lw-miss { font-size: 0.88rem; color: var(--ink-muted); }
.lw-from { background: none; border: none; padding: 0; font: inherit; font-size: 0.85rem; color: var(--ink-muted); text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.lw-from:hover, .lw-from:focus-visible { color: var(--signal); }
:where(.lesson-content) .lw-path { list-style: none; padding: 0; margin: 0; }
.lw-pstep { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding-bottom: 14px; }
.lw-pstep::before { content: ""; position: absolute; right: 14px; top: 30px; bottom: 0; border-right: 1px dashed var(--line-strong); }
.lw-pstep:last-child::before { display: none; }
.lw-pn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--sheet); border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 0.9rem; color: var(--ink); }
.lw-pbody { min-width: 0; }
.lw-ph { margin: 2px 0 0; }
.lw-ph small { color: var(--ink-muted); }
.lw-pf .katex-display { margin: 0.3em 0; }
.lw-pstep:last-child .lw-pn { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.lw-done { margin-top: 6px; padding: 10px 14px; background: var(--signal-soft); border-right: 3px solid var(--signal); border-radius: 0 2px 2px 0; }
.lw-done b { color: var(--signal); }
:where(.lesson-content) .lw-done ul { margin: 6px 0 0; padding-right: 20px; font-size: 0.98rem; }
.lw-units td:first-child { direction: ltr; text-align: center; color: var(--ink); }

@media (min-width: 1200px) {
    .lw-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .lw-jump { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lw-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
    .lw-h { font-size: 1.25rem; }
    .lw-stats dd { font-size: 1.3rem; }
    .lw-stats > div { padding: 8px 10px; }
    .lw-stop { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
    .lw-stop::before { right: 15px; top: 32px; }
    .lw-stop-dot { width: 30px; height: 30px; font-size: 0.9rem; }
    .lw-stop-head { min-height: 30px; }
    :where(.lesson-content) .lw-stop-t { font-size: 1.15rem; }
    .lw-nodes, .lw-nodes.lw-mini { grid-template-columns: minmax(0, 1fr); }
    .lw-nodes.lw-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* السلسلة تصبح عمودية والسهم يشير إلى الأسفل */
    .lw-nodes.chain { flex-direction: column; flex-wrap: nowrap; }
    .lw-nodes.chain > .lw-node { flex: none; }
    .lw-nodes.chain > .lw-arr { flex: 0 0 14px; width: 12px; height: 14px; }
    .lw-nodes.chain > .lw-arr::before { inset: 0 5px 4px 5px; border-top: none; border-right: 2px solid var(--line-strong); }
    .lw-nodes.chain > .lw-arr::after { left: 1px; top: auto; bottom: -2px; border-right: 5px solid transparent; border-left: 5px solid transparent; border-top: 7px solid var(--line-strong); border-bottom: none; }
    .lw-card { padding: 14px 12px; }
    .lw-formula { font-size: 1.05em; padding: 2px 10px; }
    .lw-fd { padding: 14px 12px; }
}

/* =========================================================
   معاني كلاسات الألوان والأدوات المساعدة
   (تبقى في آخر الملف لتتغلب على الألوان الافتراضية للمكونات)
   ---------------------------------------------------------
   الكلاسات القديمة في المحتوى تُترجم إلى معنى بدل لون:
     c-red / c-green / c-amber   ← تمييز ونتيجة (أصفر)
     c-cyan / c-purple / c-white ← نص أساسي
     c-light / c-soft            ← نص ثانوي
     c-muted                     ← ملاحظة خافتة
   العناوين والجداول والتسميات تبقى محايدة دائماً.
   ========================================================= */
.c-red, .c-green, .c-amber { color: var(--signal); }
.c-cyan, .c-purple, .c-white { color: var(--ink); }
.c-light, .c-soft { color: var(--ink-soft); }
.c-muted { color: var(--ink-muted); }
:is(h1, h2, h3, h4, h5, th, td, label, .fig-caption, .fig-subtitle, .puzzle-title):is(.c-red, .c-green, .c-amber, .c-cyan, .c-purple) { color: var(--ink); }

.center { text-align: center; }
.nowrap { white-space: nowrap; }   /* عبارة قصيرة لا تنقسم بين سطرين */
.italic { font-style: italic; }
.bold   { font-weight: 700; }
.small  { font-size: 0.9rem; }
.tiny   { font-size: 0.85rem; }
.big    { font-size: 1.1rem; }
.mt-0   { margin-top: 0; }
.mt-sm  { margin-top: 10px; }
.mt     { margin-top: 20px; }
.mt-lg  { margin-top: 40px; }
.mb-0   { margin-bottom: 0; }
.mb-sm  { margin-bottom: 10px; }
.mb-md  { margin-bottom: 15px; }
.mb     { margin-bottom: 20px; }
.mb-lg  { margin-bottom: 30px; }

/* =========================================================
   الشاشات الصغيرة
   ========================================================= */

/* =========================================================
   العرض العريض (1200px فأكثر): الدرس يملأ عرض الشاشة
   والمكونات تتوزع على أعمدة بدل أن تتراص فوق بعضها
   ========================================================= */
@media (min-width: 1200px) {
    .lesson-content { font-size: 1.16rem; }
    .lesson-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 44px; }

    /* خطوات الحل: عمودان، والخطوة الأخيرة المنفردة تأخذ السطر كاملاً */
    .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .steps > :last-child:nth-child(odd) { grid-column: 1 / -1; }

    /* المسألة: النص والمطاليب يميناً، والشكل بجانبها يساراً */
    .problem:has(> .figure) {
        display: grid; grid-template-columns: minmax(0, 1fr) fit-content(55%);   /* الشكل بعرضه الطبيعي */
        grid-template-rows: auto auto auto 1fr; column-gap: 32px; align-items: start;
    }
    .problem:has(> .figure) > * { grid-column: 1; }
    .problem:has(> .figure) > .figure { grid-column: 2; grid-row: 1 / -1; margin: 0; }

    /* القوائم الموضوعة مباشرة في الدرس: عمودان */
    .lesson-content > .rule-list:has(> li + li), .lesson-content > .box-list:has(> li + li) {   /* عند وجود عنصرين فأكثر */
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; row-gap: 12px;
    }
    .lesson-content > .box-list.three-up:has(> li + li) { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* ثلاثة عناصر قصيرة في سطر واحد */
    .lesson-content > .rule-list > li:nth-child(2) { border-top: none; padding-top: 0; }
    .lesson-content > .box-list > li { margin-bottom: 0; }

    /* الاختبار: الخيارات في شبكة 2×2 */
    .options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* الحاسوب الصغير والأجهزة اللوحية: قائمة جانبية بدل القوائم المنسدلة */
@media (max-width: 1100px) {
    nav { justify-content: space-between; align-items: center; padding: 0 16px; }
    .nav-container { height: 100%; }
    .nav-item:not(.nav-home) { display: none; }
    .nav-home { margin: 0; padding: 0; border: none; }
    .nav-home .nav-link { padding: 0 6px; }
    .nav-toggle { display: inline-flex; }
}
@media (min-width: 1101px) {
    .drawer, .drawer-backdrop { display: none; }
}

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: 36px; min-height: 0; padding: 40px 24px 56px; }
    .hero-drawing { max-width: 520px; width: 100%; margin: 0 auto; }
    .hero-sub { max-width: none; }
    .search-container { max-width: none; }
    .chapter-index { padding: 0 24px 72px; }
    .index-list { grid-template-columns: repeat(2, 1fr); }

    #learning-area { padding: calc(var(--nav-h) + 24px) 16px 48px; }
    .lesson-panel { padding: 32px 28px; }
    .lesson-grid { grid-template-columns: 1fr; gap: 24px; }
    .sim-panel { position: static; }
    /* قسم «محاكيات»: عمود واحد، المحاكي وقراءته أولاً ثم الشرح */
    .sg-layout, .sg-layout.is-wide { grid-template-columns: 1fr; gap: 28px; }
    .sg-sim-col, .sg-text { grid-column: auto; grid-row: auto; }
    .sg-sim-col { position: static; max-height: none; overflow: visible; }
    .tb-row { grid-template-columns: 1fr auto; }
    .tb-brand { display: none; }
    .tb-cell + .tb-cell { border-right: none; }
    .tb-row .tb-sheet { border-right: 1px solid var(--line-strong); }

    /* التفرع الثلاثي يصبح عمودياً: الأعمدة الثلاثة أضيق من معادلاتها */
    .tree-branches.three { grid-template-columns: 1fr; gap: 14px; margin-top: 18px; }
    .tree-branches.three::before, .tree-branches.three > *::before { display: none; }

    /* الحلقة المغلقة تصبح عمودية، وسهم العودة على الجانب الأيسر */
    .cycle { flex-direction: column; gap: 28px; padding-bottom: 0; padding-left: 30px; }
    .cycle > .flow-step + .flow-step::before { top: auto; bottom: 100%; left: 50%; width: 0; height: 28px; border-top: none; border-left: 1px solid var(--line-strong); }
    .cycle > .flow-step + .flow-step::after {
        top: -7px; left: calc(50% - 5px);
        border-top: 7px solid var(--line-strong); border-bottom: none; border-left: 5px solid transparent; border-right: 5px solid transparent;
    }
    .cycle::before, .cycle.three::before { top: 11%; bottom: 11%; left: 8px; right: auto; width: 22px; height: auto; border: 1px solid var(--line-strong); border-right: none; }
    .cycle::after, .cycle.three::after {
        top: calc(11% - 5px); bottom: auto; left: 23px; right: auto;
        border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 7px solid var(--line-strong); border-right: none;
    }
}

@media (max-width: 600px) {
    :root { --nav-h: 56px; }
    body { font-size: 0.97rem; }
    .hero { padding: 28px 16px 44px; gap: 28px; }
    .hero-eyebrow { font-size: 0.82rem; margin-bottom: 12px; }
    .hero-sub { font-size: 1.05rem; margin-bottom: 24px; }
    .hero-actions .btn-action { width: 100%; }
    .hero-stats { margin-top: 28px; }
    .hero-stats > div { padding-left: 8px; }
    .hero-stats > div + div { padding-right: 10px; }
    .hero-stats dt { font-size: 0.74rem; }
    .hero-stats dd { font-size: 1.3rem; }
    .hero-drawing figcaption { flex-direction: column; gap: 2px; }
    .chapter-index { padding: 0 16px 56px; }
    .index-title { font-size: 1.4rem; }
    .index-head { flex-direction: column; gap: 2px; }
    .index-list { grid-template-columns: 1fr; }
    .index-cell { min-height: 0; padding: 16px; }

    #learning-area { padding: calc(var(--nav-h) + 12px) 10px 40px; }
    .lesson-panel { padding: 22px 16px; outline: none; margin-top: 0; }
    .title-block { margin-bottom: 28px; }
    .section-tabs { margin: -29px 0 28px; }
    .st-tab { flex: 1; justify-content: center; padding: 9px 10px; }
    .qa-item { padding: 14px; }
    .qa-tools .sp-modes { flex: 1 1 100%; }
    .qa-toggle { width: 100%; }
    .qa-a .katex-display > .katex { font-size: 0.95em; }   /* أصغر قليلاً على الجوال لتتسع خطوات الحل */
    .sol-steps > li { padding-right: 32px; }
    .sol-answer { display: block; }
    .sg-results > li { padding: 12px; }
    .sg-results > li::before { position: static; float: right; margin: 2px 0 2px 10px; }
    .sg-use > div { grid-template-columns: 1fr; }
    .sg-chips { gap: 6px 5px; }
    .sg-chips-label { flex: 1 1 100%; margin: 0; }
    .sg-chip:not(.current) .sg-chip-t { display: none; }
    .sg-chip:not(.current) .sg-chip-n { font-size: 0.85rem; opacity: 1; }
    .sg-chip { padding: 3px 9px; }
    .sg-live { padding: 12px; }
    .sg-live-body .katex-display > .katex, .sg-why .katex-display > .katex, .sg-try-a .katex-display > .katex { font-size: 0.95em; }
    .sg-try > li { padding: 12px; }
    .lesson-title { font-size: 1.55rem; padding: 14px 14px; }
    .tb-cell { padding: 7px 12px; }
    .tb-ruler { padding: 8px 12px 10px; }
    .lesson-content { font-size: 1.05rem; line-height: 1.9; }
    :where(.lesson-content) h3 { font-size: 1.25rem; }
    :where(.lesson-content) ul, :where(.lesson-content) ol { padding-right: 18px; }
    .card, .step, .step.roomy, .problem, .puzzle, .feature-card { padding: 16px; }
    .formula-box { font-size: 1.15em; padding: 8px 14px; }
    .figure { padding: 14px 10px; }
    .sim-panel, .sim-wide, .sim-inline, .sim-showcase { padding: 16px 12px; }
    .sp-body { flex-direction: column; }
    .lf-body, .fc-body { flex-direction: column; }
    .tree-branches, .tree-branches.three { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
    .flow-split { grid-template-columns: 1fr; gap: 14px; }
    .flow-fork::after, .flow-merge::before { display: none; }
    .flow-fork::before, .flow-merge::after { top: 0; height: 100%; }
    .flow-split > .flow-step::after { display: none; }
    /* المساران المتقابلان يبقيان جنباً إلى جنب على الجوال (المقارنة هي الغاية) */
    .flow.two .flow-split { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; row-gap: 24px; }
    .flow.two .flow-fork::after, .flow.two .flow-merge::before { display: block; }
    .flow.two .flow-fork::before { top: 0; height: 14px; }
    .flow.two .flow-merge::after { top: 14px; height: 14px; }
    .flow.two .flow-split > .flow-step::after { display: block; }
    .flow.two .flow-split > .flow-step { padding: 8px 6px; font-size: 0.92rem; }
    .sim-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tree-branches::before, .tree-branches > *::before, .tree-root::after { display: none; }
    .sp-screen { padding: 12px; }
    .rcc-screen { min-width: 0; }
    .dp-stage { padding: 0 4px; }
    .dp-slab { width: 100px; }
    .data-table { font-size: 0.92rem; }
    :where(.data-table) th, .data-table td { padding: 10px; }

    .lesson-actions { flex-direction: column; align-items: stretch; }
    .lesson-actions .btn-action { width: 100%; }
    .lesson-actions .btn-quiz { order: -1; }
    .quiz-header h2 { font-size: 1.45rem; }
    .question-text { font-size: 1.15rem; }
    .option-btn { font-size: 1rem; padding: 11px 12px; }
    .quiz-navigation { flex-direction: column-reverse; align-items: stretch; }
    .quiz-navigation > div, .nav-buttons-group { width: 100%; }
    .nav-buttons-group { flex-direction: column-reverse; }
    .quiz-navigation .btn-action { width: 100%; }
}

/* تقليل الحركة لمن يفضّل ذلك */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    .hd-draw { stroke-dashoffset: 0; }
    .hd-fade { opacity: 1; }
}

/* جزيء عازل (دايبول) في رسوم درس 1-4 */
.dipole { fill: rgba(var(--signal-rgb), 0.14); stroke: var(--ink-soft); stroke-width: 1.2; }

/* الجواب الكلامي المبسّط في «سين جيم» و«أسئلة الفصل»: الفكرة ببساطة ← الشرح خطوة بخطوة ← الجواب النموذجي */
.va { display: flex; flex-direction: column; gap: 14px; }
.va-sec { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; background: var(--raise); line-height: 1.95; }
.va-h { margin: 0 0 8px; font-weight: 700; color: var(--ink); }
.va-h small { font-weight: 400; color: var(--ink-muted); font-size: 0.85em; }
.va-idea { border-right: 3px solid var(--signal); }
.va-model { border-right: 3px solid var(--ink-soft); background: var(--inset); }
.va-body > :last-child, .va-steps > li > :last-child { margin-bottom: 0; }
/* داخل الأجوبة: عنصر mb-0 ليس الأخير (قائمة يتبعها استنتاج مثلاً) يحتفظ بمسافة تحته */
.va-body > .mb-0:not(:last-child), .qa-a > .mb-0:not(:last-child), .va-steps > li > .mb-0:not(:last-child) { margin-bottom: 10px; }
.va-steps { margin: 0; padding-right: 22px; }
.va-steps > li { margin-bottom: 8px; }
.va-steps > li:last-child { margin-bottom: 0; }
.va-steps .katex-display { margin: 0.3em 0; }
/* الفكرة ببساطة والشرح خطوة بخطوة مطويّان تحت الجواب النموذجي: الطالب يفتحهما بالضغط */
.va-sec.va-more { padding: 0; }
.va-more > summary.va-h { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; margin: 0; padding: 10px 16px 10px 40px; cursor: pointer; list-style: none; border-radius: var(--radius); }
.va-more > summary .va-mt, .va-more > summary small { white-space: nowrap; }
.va-more > summary::-webkit-details-marker { display: none; }
.va-more > summary::after { content: "+"; position: absolute; left: 16px; top: 10px; font-family: var(--font-mono); font-weight: 700; color: var(--signal); }
.va-more[open] > summary::after { content: "−"; }
.va-more[open] > summary small { display: none; }
.va-more > summary:hover, .va-more > summary:focus-visible { color: var(--signal); }
.va-more > summary:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.va-more[open] > summary.va-h { padding-bottom: 6px; }
.va-more > .va-body { padding: 0 16px 12px; }
.va-more > .va-steps { padding: 0 38px 12px 16px; }
@media (max-width: 600px) {
    .va-more > summary.va-h { padding: 10px 12px 10px 34px; }
    .va-more > summary::after { left: 12px; }
    .va-more > .va-body { padding: 0 12px 10px; }
    .va-more > .va-steps { padding: 0 30px 10px 12px; }
}
@media (max-width: 600px) {
    .va { gap: 10px; }
    .va-sec { padding: 10px 12px; }
    .va-model { padding: 10px 8px; }
    .va-steps { padding-right: 18px; }
}

/* =========================================================
   محاكيات الفصل الثالث (التيار المتناوب) — js/sims-ac.js
   الفولطية بالأصفر، والتيار بالسماوي، والقدرة بالوردي
   ========================================================= */
.ac-v { fill: none; stroke: var(--signal); stroke-width: 2.4; stroke-linejoin: round; }
.ac-i { fill: none; stroke: var(--neg); stroke-width: 2.2; stroke-linejoin: round; }
.ac-p { fill: none; stroke: var(--pos); stroke-width: 2; stroke-linejoin: round; }
.ac-parea.pos { fill: rgba(255, 138, 128, 0.2); }
.ac-parea.neg { fill: rgba(124, 199, 255, 0.16); }
.ac-circle { fill: none; stroke: var(--line-strong); stroke-dasharray: 3 4; }
.ac-arc { fill: none; stroke: var(--ink-muted); stroke-width: 1.4; }
.ac-arc.sig { stroke: var(--signal); }
.ac-rot { fill: none; stroke: var(--ink-muted); stroke-width: 1.4; }
.ac-proj { stroke-width: 1; stroke-dasharray: 3 4; }
.ac-proj.v { stroke: var(--signal); opacity: 0.7; }
.ac-proj.i { stroke: var(--neg); opacity: 0.7; }
.ac-vec-v { stroke: var(--signal); stroke-width: 3.2; }
.ac-vec-i { stroke: var(--neg); stroke-width: 3; }
.ac-vec-r { stroke: var(--ink); stroke-width: 3; }
.ac-vec-x { stroke: var(--pos); stroke-width: 3; }
.ac-vec-s { stroke: var(--ink-soft); stroke-width: 2.4; }
.ac-dot-v { fill: var(--signal); }
.ac-dot-i { fill: var(--neg); }
.ac-dot-p { fill: var(--pos); }
.ac-cursor { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.ac-tri { fill: var(--signal-soft); stroke: none; }
.ac-band { fill: rgba(var(--signal-rgb), 0.08); }
.ah-cyan { fill: var(--neg); }
.ah-pink { fill: var(--pos); }
.ah-soft { fill: var(--ink-soft); }
.t-ac { font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: 16px; fill: var(--ink); }
.t-ac.t-v, .t-label.t-v { fill: var(--signal); }
.t-ac.t-i, .t-label.t-i { fill: var(--neg); }
.t-ac.t-p, .t-label.t-p { fill: var(--pos); }
.t-ac.t-muted { fill: var(--ink-muted); }
.ac-pair { display: flex; flex-wrap: wrap; gap: 10px; }
.ac-pair > svg { flex: 1 1 250px; min-width: 0; }
.fc-controls .fc-buttons + .fc-buttons { margin-top: 8px; }
.fc-controls .fc-buttons { margin-top: 10px; }
.ac-pair > svg.ac-side { flex: 0 1 190px; margin-inline: auto; }
.rh-glow { fill: var(--pos); opacity: 0.2; }
.rh-bar { fill: var(--pos); }
.rh-dc { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 6 4; }
.rl-meter { fill: var(--screen); stroke: var(--ink); stroke-width: 1.5; }
.sim-table b.ar { font-family: var(--font-body); font-weight: 700; direction: rtl; text-align: right; }
.rn-faint { fill: none; stroke: var(--ink-muted); stroke-width: 1.2; opacity: 0.6; }

/* =========================================================
   الفصل الرابع (الموجات الكهرومغناطيسية): أشكال الدروس ومحاكيات js/sims-em.js
   المجال الكهربائي E بالأصفر، والمجال المغناطيسي B بالسماوي
   ========================================================= */
.em-e { fill: none; stroke: var(--signal); stroke-width: 2.2; stroke-linejoin: round; }
.em-b { fill: none; stroke: var(--neg); stroke-width: 2; stroke-linejoin: round; }
.em-e-thin { stroke: var(--signal); stroke-width: 1.2; opacity: 0.75; fill: none; }
.em-b-thin { stroke: var(--neg); stroke-width: 1.1; opacity: 0.7; fill: none; }
.em-e-vec { stroke: var(--signal); stroke-width: 4; }
.em-b-vec { stroke: var(--neg); stroke-width: 4; }
.em-b-mark { fill: var(--screen); stroke: var(--neg); stroke-width: 1.4; }
.em-b-dot { fill: var(--neg); }
.em-b-x { stroke: var(--neg); stroke-width: 1.4; }
.em-rod { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.em-rod.p { stroke: var(--pos); }
.em-rod.n { stroke: var(--neg); }
.em-ray { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; }
.em-ray.sig { stroke: var(--signal); }
.em-spark { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linejoin: round; }
.em-gap { fill: var(--screen); stroke: none; }
.em-earth { fill: rgba(150, 190, 235, 0.08); stroke: var(--ink-soft); stroke-width: 1.5; }
.em-iono { fill: rgba(var(--signal-rgb), 0.06); stroke: var(--line-strong); stroke-width: 1.2; stroke-dasharray: 5 4; }
.em-iono.f { fill: rgba(124, 199, 255, 0.07); }
.em-band { stroke: var(--screen); stroke-width: 1; }
.em-band.b1 { fill: rgba(124, 199, 255, 0.42); }
.em-band.b2 { fill: rgba(124, 199, 255, 0.3); }
.em-band.b3 { fill: rgba(255, 138, 128, 0.32); }
.em-band.vis { fill: none; }
.em-band.b5 { fill: rgba(190, 150, 255, 0.32); }
.em-band.b6 { fill: rgba(214, 228, 243, 0.26); }
.em-band.b7 { fill: rgba(214, 228, 243, 0.16); }
.em-band-t { fill: var(--ink); font-weight: 700; }
.em-msg { fill: none; stroke: var(--ink-soft); stroke-width: 2; }
.em-car { fill: none; stroke: var(--ink-muted); stroke-width: 1.2; }
.em-mod { fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-linejoin: round; }
.em-env { fill: none; stroke: var(--ink-soft); stroke-width: 1.2; stroke-dasharray: 4 4; }
.em-box { fill: var(--screen); stroke: var(--ink); stroke-width: 1.5; }
.em-box.sig { stroke: var(--signal); }
.em-v-dist { fill: none; stroke: var(--signal); stroke-width: 2; }
.em-i-dist { fill: none; stroke: var(--neg); stroke-width: 2; }
.em-e-text { color: var(--signal); }
.em-b-text { color: var(--neg); }

/* =========================================================
   طبقة التدريس (الفصل الرابع): دورة التعلم الخماسية 5E
   tl-journey: رحلة الإشارة (منظِّم متقدّم) — tl-hook: سؤال البداية والعودة إليه
   tl-idea: الفكرة في جملة — tl-poe: توقّع ثم جرّب (أزرار راديو بلا JavaScript)
   tl-amap: التشبيه المنظَّم وحدوده — tl-myth: خطأ شائع — tl-life: من حياتك — tl-memo: حيلة للحفظ
   ========================================================= */
.tl-k { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; color: var(--signal-ink); background: var(--signal); padding: 2px 10px; border-radius: 2px; margin-bottom: 10px; }
.tl-journey { border: 1px solid var(--line); border-radius: var(--radius); background: var(--inset); padding: 14px 14px 10px; margin: 0 0 22px; }
.tl-j-title { font-size: 0.86rem; font-weight: 700; color: var(--ink-muted); margin-bottom: 10px; }
.tl-journey ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; counter-reset: tl; }
.tl-journey li { counter-increment: tl; position: relative; }
.tl-journey li span.tl-st { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-muted); text-decoration: none; font-size: 0.8rem; font-weight: 600; line-height: 1.3; text-align: center; height: 100%; }
.tl-journey li span.tl-st::before { content: counter(tl); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); }
.tl-journey li.is-on span.tl-st { color: var(--ink); border-color: var(--signal); background: var(--signal-soft); }
.tl-journey li.is-on span.tl-st::before { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.tl-here { margin: 10px 0 0; font-size: 0.95rem; color: var(--ink-soft); line-height: 1.8; }
.tl-here b { color: var(--signal); }
@media (max-width: 700px) { .tl-journey ol { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 400px) { .tl-journey li span.tl-st { padding-inline: 0; font-size: 0.76rem; } }   /* كلمة طويلة مثل «المغناطيس» كانت أعرض من خانتها بـ 2px على شاشة 360px */

.tl-hook { border: 1px dashed var(--signal); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 22px; background: rgba(var(--signal-rgb), 0.04); }
.tl-hook .tl-q { font-size: 1.14rem; font-weight: 600; color: var(--ink); line-height: 1.9; margin: 0 0 6px; }
.tl-hook .tl-note { margin: 0; font-size: 0.9rem; color: var(--ink-muted); }
.tl-hook.tl-back { border-style: solid; border-color: var(--ok); background: rgba(var(--ok-rgb), 0.05); margin-top: 30px; }
.tl-hook.tl-back .tl-k { background: var(--ok); }
.tl-hook.tl-back .tl-q { font-size: 1rem; color: var(--ink-soft); }
.tl-hook.tl-back p:last-child { margin-bottom: 0; }

.tl-idea { display: flex; gap: 12px; align-items: baseline; border-right: 3px solid var(--signal); padding: 4px 14px 4px 0; margin: 0 0 26px; }
.tl-idea b { flex: none; color: var(--signal); font-size: 0.9rem; }
.tl-idea p { margin: 0; font-size: 1.08rem; color: var(--ink); line-height: 1.85; }
@media (max-width: 600px) { .tl-idea { flex-direction: column; gap: 2px; } }

.tl-poe { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--raise); padding: 16px 18px; margin: 0 0 18px; }
.tl-poe .tl-q { color: var(--ink); font-weight: 600; line-height: 1.9; margin: 0 0 12px; }
.tl-poe input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tl-poe label { display: flow-root; padding: 10px 14px; margin: 0 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; color: var(--ink-soft); line-height: 1.7; transition: background-color 0.15s, border-color 0.15s; }
.tl-poe label:hover { background: var(--hover); color: var(--ink); }
.tl-poe input:focus-visible + label { outline: 2px solid var(--signal); outline-offset: 2px; }
.tl-poe:has(input:checked) input.ok + label { border: 2px solid var(--ok); padding: 9px 13px; background: rgba(var(--ok-rgb), 0.14); color: var(--ink); }
.tl-poe input.no:checked + label { border: 2px solid var(--bad); padding: 9px 13px; background: rgba(var(--bad-rgb), 0.1); color: var(--ink); }
/* شارة في طرف الخيار: «✓ الجواب الصحيح» و«✗ اختيارك» */
.tl-poe:has(input:checked) input.ok + label::after, .tl-poe input.no:checked + label::after {
    float: inline-end; margin-inline-start: 10px; padding: 1px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; line-height: 1.7; }
.tl-poe:has(input:checked) input.ok + label::after { content: '✓ الجواب الصحيح'; color: var(--ok); border: 1px solid var(--ok); background: var(--sheet); }
.tl-poe input.no:checked + label::after { content: '✗ اختيارك'; color: var(--bad); border: 1px solid var(--bad); background: var(--sheet); }
.tl-poe .tl-fb, .tl-poe .tl-why { display: none; }
.tl-poe .tl-fb { font-weight: 700; margin: 12px 0 4px; }
.tl-poe .tl-fb.ok { color: var(--ok); }
.tl-poe .tl-fb.no { color: var(--bad); }
.tl-poe input.ok:checked ~ .tl-fb.ok, .tl-poe input.no:checked ~ .tl-fb.no, .tl-poe input:checked ~ .tl-why { display: block; }
.tl-poe .tl-why { color: var(--ink-soft); line-height: 1.85; }
.tl-poe .tl-why p { margin: 0 0 6px; }
.tl-poe .tl-go { display: block; margin-top: 6px; color: var(--signal); font-weight: 600; }
.tl-poe .tl-wait { margin: 6px 0 0; font-size: 0.88rem; color: var(--ink-muted); }
.tl-poe input:checked ~ .tl-wait { display: none; }

.tl-amap { border: 1px solid var(--line); border-right: 3px solid var(--neg); border-radius: var(--radius); background: var(--raise); padding: 16px 18px; margin: 22px 0; }
.tl-amap .tl-k { background: var(--neg); }
.tl-amap > h4 { margin: 0 0 8px; color: var(--ink); font-size: 1.15rem; }
.tl-amap > p { color: var(--ink-soft); line-height: 1.9; }
.tl-amap .table-wrap { margin: 12px 0; }
.tl-amap .data-table th:first-child { width: 42%; }
.tl-amap .tl-limit { margin: 0; padding: 10px 14px; background: var(--inset); border-radius: var(--radius); color: var(--ink-soft); line-height: 1.85; }
.tl-amap .tl-limit b { color: var(--signal); }

.tl-myth { border: 1px solid var(--line); border-right: 3px solid var(--bad); border-radius: var(--radius); background: var(--raise); padding: 16px 18px; margin: 22px 0; }
.tl-myth .tl-k { background: var(--bad); color: #2a0b0b; }
.tl-myth .tl-wrong, .tl-myth .tl-right { position: relative; padding-right: 28px; margin: 0 0 8px; line-height: 1.85; }
.tl-myth .tl-wrong { color: var(--ink-muted); }
.tl-myth .tl-right { color: var(--ink); font-weight: 600; }
.tl-myth .tl-wrong::before, .tl-myth .tl-right::before { position: absolute; right: 0; top: 0; font-weight: 700; font-family: var(--font-mono); }
.tl-myth .tl-wrong::before { content: "✗"; color: var(--bad); }
.tl-myth .tl-right::before { content: "✓"; color: var(--ok); }
.tl-myth .tl-why2 { margin: 0; color: var(--ink-soft); font-size: 0.97rem; line-height: 1.85; }
.tl-myth + .tl-myth { margin-top: -10px; }

.tl-life { margin: 22px 0; }
.tl-life-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 10px; }
.tl-life-grid > div { border: 1px solid var(--line); border-top: 2px solid var(--ok); border-radius: var(--radius); padding: 12px 14px; background: var(--raise); }
.tl-life-grid b { display: block; color: var(--ink); margin-bottom: 4px; }
.tl-life-grid span { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.75; }
.tl-life .tl-k { background: var(--ok); }

.tl-memo { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 14px 18px; margin: 22px 0; background: var(--inset); color: var(--ink-soft); line-height: 1.9; }
.tl-memo .tl-k { background: var(--ink-soft); }
.tl-memo p:last-child { margin-bottom: 0; }
.tl-memo b { color: var(--ink); }

.tl-map { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; counter-reset: tlm; }
.tl-map li { counter-increment: tlm; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--raise); }
.tl-map li::before { content: counter(tlm); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--signal); color: var(--signal-ink); font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem; }
.tl-map b { color: var(--ink); }
.tl-map span { color: var(--ink-soft); line-height: 1.8; }
.tl-map a { color: var(--signal); font-size: 0.9rem; margin-inline-start: 4px; white-space: nowrap; unicode-bidi: isolate; }
.tl-mapbox { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raise); padding: 16px 18px 6px; margin: 0 0 26px; }
.tl-mapbox > p { color: var(--ink-soft); line-height: 1.85; }
.tl-mapbox .tl-map { margin-bottom: 16px; }
.tl-mapbox .tl-memo { margin: 0 0 12px; }

/* =========================================================
   مسار التعلم (1): بطاقة «الخطوة التالية» في آخر كل صفحة
   ns-main: الخطوة الطبيعية التالية بضغطة واحدة، وns-chip: بدائل قريبة
   ========================================================= */
.next-step { margin: 0 0 32px; padding: 20px 22px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--inset); }
.next-step[hidden] { display: none; }
.ns-done { display: flex; align-items: baseline; gap: 8px; margin: 0 0 14px; color: var(--ink-soft); font-size: 1rem; line-height: 1.7; }
.ns-done b { color: var(--ink); font-weight: 700; }
.ns-tick { color: var(--ok); font-weight: 700; flex-shrink: 0; }
.ns-main {
    display: flex; align-items: center; gap: 16px; padding: 14px 20px;
    border-radius: var(--radius); background: var(--signal); color: var(--signal-ink);
    text-decoration: none; transition: background-color 0.15s;
}
.ns-main:hover { background: var(--signal-hover); }
.ns-main:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.ns-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ns-k { font-size: 0.8rem; font-weight: 700; opacity: 0.75; }
.ns-t { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; line-height: 1.55; }
.ns-meta { font-size: 0.9rem; font-weight: 500; opacity: 0.85; line-height: 1.6; }
.ns-arrow { font-size: 1.25rem; flex-shrink: 0; }
.ns-main + .ns-main { margin-top: 10px; }   /* نهاية الفصل: أسئلة الفصل، ثم اختبار الفصل */
.ns-more { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.ns-or { font-size: 0.9rem; color: var(--ink-muted); margin-inline-end: 4px; }
.ns-chip {
    display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 6px 14px;
    border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink-soft);
    text-decoration: none; font-size: 0.93rem; font-weight: 600; line-height: 1.5;
}
.ns-chip:hover { color: var(--ink); background: var(--hover); border-color: var(--ink-muted); }

/* =========================================================
   مسار التعلم (2): شريط الأقسام الذكي — نسخة مثبتة من تبويبات الموضوع تحت الشريط العلوي
   مخفية عند النزول للقراءة، وتنزلق من تحت الشريط العلوي عند السحب للأعلى (is-shown)
   ========================================================= */
:root { --tf-h: 46px; }
.tabs-float {
    position: fixed; top: var(--nav-h); right: 0; left: 0; z-index: 990;
    background: var(--bg-deep); border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 8px 18px rgba(2, 10, 22, 0.35);
    transform: translateY(-110%); visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
.tabs-float.is-shown { transform: none; visibility: visible; transition: transform 0.22s ease; }
.tf-inner { max-width: var(--sheet-w); margin: 0 auto; padding: 0 30px; display: flex; align-items: stretch; gap: 18px; min-height: var(--tf-h); }
.tf-topic { flex: 1 1 auto; min-width: 0; align-self: center; font-weight: 700; color: var(--ink); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-tabs { display: flex; align-items: stretch; flex-shrink: 0; }
.tf-tab {
    display: inline-flex; align-items: center; gap: 6px; padding: 0 14px;
    color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.93rem; white-space: nowrap;
    border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
a.tf-tab:hover { color: var(--ink); background: var(--hover); }
.tf-tab.active { color: var(--signal); border-bottom-color: var(--signal); }
.tf-short { display: none; }
/* المحاكي المثبت (على الشاشات العريضة فقط) يترك مكان الشريط حين يظهر */
@media (min-width: 901px) {
    .tf-on .sim-panel { top: calc(var(--nav-h) + var(--tf-h) + 20px); }
    /* العمود المثبت وحده (لا «المحاكي فوق» ولا «المختبر بعرض الصفحة»): تحديد ارتفاع عمود غير مثبت يجعل قراءته
       تفيض فوق الشرح الذي تحته (ملاحظة صاحب المنصة، 20 تشرين الثاني 2026: صفحات مختبرات الفصول 6 و7 و9) */
    .tf-on .sg-layout:not(.is-top):not(.is-full) .sg-sim-col { top: calc(var(--nav-h) + var(--tf-h) + 16px); max-height: calc(100vh - var(--nav-h) - var(--tf-h) - 32px); }
}
@media (max-width: 900px) {
    .tf-inner { padding: 0 16px; }
    .tf-topic { display: none; }
    .tf-tabs { flex: 1; justify-content: center; }
}
@media (max-width: 600px) {
    .next-step { padding: 16px 14px; margin-bottom: 26px; }
    .ns-main { padding: 12px 14px; gap: 10px; }
    .ns-t { font-size: 1.06rem; }
    .ns-or { flex: 1 1 100%; }
    .ns-chip { flex: 1 1 auto; }
    .tf-inner { padding: 0 4px; gap: 0; }
    .tf-tabs { justify-content: space-between; }
    .tf-tab { flex: 1 1 auto; justify-content: center; padding: 0 4px; font-size: 0.86rem; }
    .tf-full { display: none; }
    .tf-short { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
    .tabs-float, .tabs-float.is-shown { transition: none; }
}

/* جداول الأجوبة في «سين جيم» و«أسئلة الفصل» على الجوال: حشوة أصغر حتى تتسع الأعمدة ضمن عرض الشاشة */
@media (max-width: 600px) {
    .qa-a .data-table th, .qa-a .data-table td { padding: 8px 6px; }
}

/* =========================================================
   الفصل الخامس (البصريات الفيزيائية): أدوات التبسيط وألوان الأشكال
   tl-words: «كلمات الدرس ببساطة» — المصطلح ومعناه بكلمات يومية
   tl-cra: شارة درجة الفهم في عناوين الشرح: نرى (الظاهرة) ← نرسم (الصورة) ← نحسب (القانون)
   op-*: الضوء في الأشكال (الأشعة وجبهات الموجة بالأصفر، والموجة الثانية بالسماوي)
   ========================================================= */
.tl-words { border: 1px solid var(--line); border-radius: var(--radius); background: var(--raise); padding: 14px 16px 6px; margin: 0 0 26px; }
.tl-words .tl-k { background: var(--neg); }
.tl-words dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 8px 18px; margin: 0; }
.tl-words dl > div { padding: 6px 0 8px; border-bottom: 1px dashed var(--line); }
.tl-words dt { color: var(--ink); font-weight: 700; margin-bottom: 2px; }
.tl-words dd { margin: 0; color: var(--ink-soft); line-height: 1.8; font-size: 0.98rem; }
.tl-cra { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; padding: 0 10px; height: 28px; margin-inline-end: 8px; border-radius: 14px; font-family: var(--font-body); font-size: 0.85rem; font-weight: 700; vertical-align: middle; border: 1px solid; }
.tl-cra.see { color: var(--ok); border-color: var(--ok); }
.tl-cra.draw { color: var(--neg); border-color: var(--neg); }
.tl-cra.calc { color: var(--signal); border-color: var(--signal); }
.op-ray { stroke: var(--signal); stroke-width: 2; fill: none; stroke-linecap: round; }
.op-ray.b { stroke: var(--neg); }
.op-ray.p { stroke: var(--pos); }
.op-ray.thin { stroke-width: 1.3; }
.op-front { stroke: var(--signal); stroke-width: 1.6; fill: none; opacity: 0.85; }
.op-front.b { stroke: var(--neg); }
.op-trough { stroke: var(--ink-muted); stroke-width: 1.2; fill: none; stroke-dasharray: 4 4; opacity: 0.8; }
.op-barrier { fill: var(--ink-muted); opacity: 0.55; }
.op-screen { fill: rgba(234, 241, 248, 0.06); stroke: var(--ink-soft); stroke-width: 1.4; }
.op-glass { fill: rgba(124, 199, 255, 0.12); stroke: var(--ink-muted); stroke-width: 1; }
.op-film { fill: rgba(124, 199, 255, 0.22); stroke: var(--neg); stroke-width: 1.2; }
.op-dash { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 3; }
.op-bright { fill: var(--signal); }
.op-dot-b { fill: var(--signal); }
.op-dot-d { fill: var(--screen); stroke: var(--ink-muted); stroke-width: 1.2; }

/* =========================================================
   طريقة «الغوص» في دروس الفصل الخامس (dv-*):
   على السطح (اللغز) ← نغوص (نفكك المفاهيم قاعدةً قاعدة) ← في القاع (الفكرة الكبيرة)
   ← نصعد (نقرأ كلام الكتاب ونترجمه) ← على الشاطئ (نثبّت للامتحان)
   ========================================================= */
.dv-gauge { margin: 0 0 24px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: linear-gradient(180deg, rgba(124, 199, 255, 0.05), rgba(3, 14, 28, 0.35)); }
.dv-gauge ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dv-gauge li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px 4px; border-radius: 2px; }
.dv-gauge .dv-ic { font-size: 1.4rem; line-height: 1.3; }
.dv-gauge b { color: var(--ink); font-size: 0.92rem; }
.dv-gauge small { color: var(--ink-muted); font-size: 0.76rem; line-height: 1.55; }
.dv-gauge .dv-surface { background: rgba(124, 199, 255, 0.06); }
.dv-gauge .dv-down { background: rgba(124, 199, 255, 0.11); }
.dv-gauge .dv-bottom { background: rgba(124, 199, 255, 0.18); }
.dv-gauge .dv-up { background: rgba(124, 199, 255, 0.11); }
.dv-gauge .dv-shore { background: rgba(var(--signal-rgb), 0.09); }
@media (max-width: 640px) {
    .dv-gauge ol { grid-template-columns: 1fr; }
    .dv-gauge li { flex-direction: row; flex-wrap: wrap; text-align: right; gap: 2px 8px; padding: 6px 10px; }
    .dv-gauge small { flex-basis: 100%; padding-right: 32px; }
}
.dv-h .dv-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; vertical-align: middle; color: var(--ink); }
.dv-h.dv-surface .dv-tag { background: rgba(124, 199, 255, 0.14); }
.dv-h.dv-down .dv-tag { background: rgba(124, 199, 255, 0.24); }
.dv-h.dv-bottom .dv-tag { background: rgba(124, 199, 255, 0.36); }
.dv-h.dv-up .dv-tag { background: rgba(var(--ok-rgb), 0.24); }
.dv-h.dv-shore .dv-tag { background: rgba(var(--signal-rgb), 0.22); }
.dv-brick { margin: 18px 0; border: 1px solid var(--line-strong); border-right: 3px solid var(--neg); border-radius: var(--radius); background: var(--raise); padding: 14px 16px; }
.dv-bh { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; margin-bottom: 8px; }
.dv-n { flex: none; font-size: 0.78rem; font-weight: 700; color: var(--screen); background: var(--neg); padding: 2px 8px; border-radius: 2px; }
.dv-bh h4 { margin: 0; color: var(--ink); font-size: 1.06rem; }
.dv-bb > :last-child { margin-bottom: 0; }
.dv-bb .figure { margin-top: 12px; margin-bottom: 12px; }
.dv-check { margin-top: 12px; }
.dv-chat { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.dv-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; }
.dv-msg p { margin: 0; }
.dv-s { align-self: flex-start; background: rgba(124, 199, 255, 0.09); border: 1px solid rgba(124, 199, 255, 0.35); border-top-right-radius: 3px; }
.dv-t { align-self: flex-end; background: rgba(var(--signal-rgb), 0.07); border: 1px solid rgba(var(--signal-rgb), 0.35); border-top-left-radius: 3px; }
.dv-who { display: block; font-size: 0.78rem; font-weight: 700; margin-bottom: 2px; }
.dv-s .dv-who { color: var(--neg); }
.dv-t .dv-who { color: var(--signal); }
.dv-book { margin: 16px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dv-book h4 { grid-column: 1 / -1; margin: 0; color: var(--ink); }
.dv-bq, .dv-bp { padding: 10px 14px; border-radius: 2px; }
.dv-bq { background: var(--inset); border: 1px solid var(--line-strong); }
.dv-bq p { color: var(--ink-soft); }
.dv-bp { background: rgba(var(--ok-rgb), 0.06); border: 1px solid rgba(var(--ok-rgb), 0.4); }
.dv-bq p, .dv-bp p { margin: 0; }
.dv-bl { display: block; font-size: 0.78rem; font-weight: 700; margin-bottom: 4px; color: var(--ink-muted); }
.dv-bp .dv-bl { color: var(--ok); }
@media (max-width: 700px) { .dv-book { grid-template-columns: 1fr; } }
.dv-exam { margin: 22px 0; padding: 14px 16px; border: 1px solid var(--signal); border-radius: var(--radius); background: rgba(var(--signal-rgb), 0.04); }
.dv-exam ul { margin: 0; padding-right: 20px; display: flex; flex-direction: column; gap: 6px; }
.nm-exam .nm-exhint { margin: 4px 0 10px; font-size: 0.88rem; color: var(--ink-muted); }
.nm-exam .nm-exq summary { cursor: pointer; list-style: none; }
.nm-exam .nm-exq summary::-webkit-details-marker { display: none; }
.nm-exam .nm-exq summary::after { content: ' ▾ الجواب'; font-size: 0.8rem; color: var(--signal); white-space: nowrap; }
.nm-exam .nm-exq[open] summary::after { content: ' ▴'; }
.nm-exam .nm-exa { margin: 6px 0 4px; padding: 6px 10px; border-inline-start: 2px solid var(--signal); }
.nm-bqw .nm-bqsrc { margin-top: 2px; }
.nm-bqw .nm-bqsrc summary { cursor: pointer; list-style: none; }
.nm-bqw .nm-bqsrc summary::-webkit-details-marker { display: none; }
.nm-bqw .nm-bqsrc summary::after { content: ' ▾ اعرضها'; font-size: 0.8rem; color: var(--signal); }
.nm-bqw .nm-bqsrc[open] summary::after { content: ' ▴'; }
.dv-fun { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; padding: 10px 14px; border-radius: var(--radius); background: rgba(255, 138, 128, 0.07); border: 1px dashed rgba(255, 138, 128, 0.5); }
.dv-fun p { margin: 0; }
.dv-fun .dv-fi { font-size: 1.3rem; line-height: 1.5; }
.dv-fun b { color: var(--pos); }
/* الرسوم المتحركة الصغيرة في القواعد (SMIL داخل SVG) */
.dv-fan { fill: var(--ink-soft); }
.dv-fan.me { fill: var(--signal); }
.dv-body { stroke: var(--ink-soft); stroke-width: 3; stroke-linecap: round; }
.dv-body.me { stroke: var(--signal); }
.dv-foot-r { fill: var(--signal); }
.dv-foot-l { fill: var(--neg); }
.dv-ring { fill: none; stroke: var(--ok); stroke-width: 2; }
.dv-ring.bad { stroke: var(--pos); }
.dv-brick .katex, .dv-book .katex, .dv-chat .katex, .dv-exam .katex { white-space: nowrap; }   /* المعادلة القصيرة لا تنقسم بين سطرين */
/* جواب «اختبر فهمك»، والحل الرقمي المرتب calc(): خطوات مرقمة، كل معادلة في سطر مستقل، والناتج مميز، ثم «المعنى» */
.dv-ans { padding: 0 14px 10px; }
.dv-ans > :last-child { margin-bottom: 0; }
.dv-ans > p + p, .dv-ans > p + .dv-calc, .dv-ans > .dv-calc + p { margin-top: 8px; }
.dv-calc { display: grid; gap: 8px; margin: 6px 0 2px; }
.dv-cs { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 0 10px; align-items: start; }
.dv-ci { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); border: 1px solid var(--line-strong); background: var(--inset); }
.dv-cb { min-width: 0; }
.dv-cl { margin: 1px 0 0; font-weight: 700; color: var(--ink-soft); line-height: 1.6; }
.dv-ce { overflow-x: auto; }
.dv-ce .katex-display { margin: 4px 0 0; }
.dv-cr .dv-ci { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.dv-cr .dv-ce { border: 1px solid var(--signal); border-radius: var(--radius); background: var(--signal-soft); padding: 2px 8px; margin-top: 4px; }
.dv-cr .dv-ce .katex-display { margin: 2px 0; }
.dv-cn { margin: 2px 0 0; line-height: 1.8; }
@media (max-width: 640px) {
    /* على الهاتف: القاعدة أضيق حشواً، والرسم داخلها يمتد إلى حافتيها، كي لا تصغر كتابة الأشكال العريضة */
    .dv-brick { padding: 12px 10px; }
    .dv-bb .figure { margin-inline: -8px; padding-inline: 4px; }
}

/* =========================================================
   المشاهد ثلاثية الأبعاد (js/sims-3d.js) والجولة الموجهة «خطوة بخطوة»
   ========================================================= */
.s3-host { position: relative; }
.s3-wrap { position: relative; height: var(--s3-h, 360px); max-height: 70vh; border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: radial-gradient(120% 90% at 50% 35%, rgba(124, 199, 255, 0.08), transparent 60%), var(--screen); overflow: hidden; }
@media (max-width: 600px) { .s3-wrap { height: min(var(--s3-h, 360px), 78vw); } }
.s3-canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.s3-canvas:active { cursor: grabbing; }
.s3-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.s3-label { position: absolute; left: 0; top: 0; padding: 1px 6px; border-radius: 2px; font-size: 0.8rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
    color: var(--ink); background: rgba(7, 26, 48, 0.72); border: 1px solid var(--line); }
.s3-label.sig { color: var(--signal); border-color: rgba(var(--signal-rgb), 0.45); }
.s3-label.cy { color: #7CC7FF; border-color: rgba(124, 199, 255, 0.45); }
.s3-label.pk { color: #FF9EC8; border-color: rgba(255, 126, 182, 0.45); }
.s3-label.ok { color: var(--ok); border-color: rgba(var(--ok-rgb), 0.45); }
.s3-label.plain { background: none; border: none; }
.s3-tools { position: absolute; bottom: 8px; left: 8px; display: flex; gap: 3px; }
.s3-tools button { width: 28px; height: 28px; padding: 0; border-radius: 2px; border: 1px solid var(--line-strong); background: rgba(7, 26, 48, 0.8); color: var(--ink); font-size: 0.95rem; line-height: 1; cursor: pointer; }
.s3-tools button:hover, .s3-tools button:focus-visible { border-color: var(--signal); color: var(--signal); }
.s3-hint { position: absolute; top: 6px; right: 10px; left: 10px; margin: 0; font-size: 0.72rem; color: var(--ink-muted); pointer-events: none; text-align: right; }
@media (max-width: 600px) { .s3-hint { display: none; } .s3-tools button { width: 26px; height: 26px; font-size: 0.85rem; } }
.s3-loading, .s3-fail { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--ink-muted); font-size: 0.9rem; }
.s3-host > .s3-fail { position: static; min-height: 120px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.s3-steps { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--raise); }
.s3-sbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.s3-sbar button { white-space: nowrap; padding: 6px 12px; border-radius: 2px; border: 1px solid var(--line-strong); background: var(--inset); color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; }
.s3-sbar .s3-next { border-color: var(--signal); color: var(--signal); }
.s3-sbar button:disabled { opacity: 0.4; cursor: default; }
.s3-count { font-size: 0.85rem; color: var(--ink-muted); font-weight: 600; white-space: nowrap; }
@media (max-width: 600px) { .s3-sbar button { padding: 5px 9px; font-size: 0.85rem; } .s3-count { font-size: 0.78rem; } }
.s3-dots { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.s3-dots button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--inset); color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.75rem; cursor: pointer; padding: 0; }
.s3-dots button.done { color: var(--ink); border-color: var(--ok); }
.s3-dots button.on { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 700; }
.s3-card { margin-top: 8px; }
.s3-t { margin: 0 0 4px; font-size: 1rem; color: var(--signal); }
.s3-d { margin: 0; line-height: 1.9; }

/* الفصل السادس: شريط رحلة من 12 محطة، و«تجربة فكرية» (مختبر الخيال) */
.tl-journey.tl-j12 ol { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 700px) { .tl-journey.tl-j12 ol { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tl-think { margin: 18px 0; padding: 14px 16px; border: 1px solid rgba(178, 140, 255, 0.45); border-right: 3px solid #B28CFF; border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(178, 140, 255, 0.08), rgba(178, 140, 255, 0.02)); }
.tl-think .tl-k { background: #B28CFF; color: #160c2e; }
.tl-think h4 { margin: 6px 0 6px; color: var(--ink); }
.tl-think > p:last-child, .tl-think > ol:last-child, .tl-think > ul:last-child { margin-bottom: 0; }
@media (max-width: 400px) { .tl-journey.tl-j12 li span.tl-st { font-size: 0.7rem; } }
.tl-journey.tl-j10 ol { grid-template-columns: repeat(5, minmax(0, 1fr)); }   /* الفصل السابع: 10 محطات في صفين */
@media (max-width: 700px) { .tl-journey.tl-j10 ol { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; } }
@media (max-width: 400px) { .tl-journey.tl-j10 li span.tl-st { font-size: 0.62rem; } }   /* «الترانزستور» في خانة من خمس على شاشة 360px */   /* «الكهروضوئية» في شريط الفصل السادس (12 محطة، 4 أعمدة) */
.tl-journey.tl-j15 ol { grid-template-columns: repeat(5, minmax(0, 1fr)); }   /* الفصل الثامن: 15 محطة في ثلاثة صفوف */
@media (max-width: 700px) { .tl-journey.tl-j15 ol { gap: 4px; } }
@media (max-width: 400px) { .tl-journey.tl-j15 li span.tl-st { font-size: 0.62rem; } }   /* «الهيدروجين» و«المنظومات» في خانة من خمس على شاشة 360px */
/* ---------- تخطيط موحّد لمختبرات الفصل السادس (.lx): المشهد والقراءات وأدوات التحكم في شاشة واحدة ----------
   .lx > .lx-view  (.lx-stage = المشهد + .lx-hud القراءات السريعة، ثم .lx-more رسم ثانٍ اختياري، ثم .lx-status، ثم .lx-note)
       > .lx-side  (.lx-tour الجولة، ثم .lx-ctl أدوات التحكم، ثم .lx-table جدول القراءات الكامل)
   - الحاسوب (≥1000px): عمودان؛ عمود المشهد ثابت أثناء التمرير، فكل أداة تحكم تُرى مع المشهد ونتيجتها.
   - الهاتف واللوحي: عمود واحد؛ المشهد مع قراءاته السريعة مثبّت أعلى الشاشة، والجولة والشرح والأدوات تمر تحته.
     إن ظهر رسم ثانٍ (.lx-more داخل .lx-stage) فإنه يأخذ مكان المشهد في الجزء المثبّت حتى يُخفى. */
.lx { --lx-h: clamp(180px, 34vh, 280px); display: flex; flex-direction: column; gap: 12px; text-align: right; }
@supports (height: 1svh) { .lx { --lx-h: clamp(180px, 34svh, 280px); } }
@supports (height: 1svh) { @media (max-width: 640px) { .lx { --lx-h: clamp(170px, 32svh, 270px); } } }
.lx-view, .lx-side { display: contents; }
.lx { overflow-anchor: none; }   /* لا «تثبيت تمرير» تلقائي: تغيّر طول نص الحالة أو الجولة لا يحرّك الصفحة تحت يد الطالب */
.lx-hud[hidden], .lx-hud > span[hidden] { display: none; }
.lx-stage { position: relative; }
.lx .s3-wrap { height: var(--lx-h); max-height: none; }
.lx-hud { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 6px; }
.lx-hud > span { display: inline-block; padding: 1px 8px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--inset); color: var(--ink-muted); font-size: 0.78rem; line-height: 1.8; white-space: nowrap; }
.lx-hud b { margin-right: 6px; font-family: var(--font-mono); font-weight: 600; font-size: 0.86rem; color: var(--ink); direction: ltr; unicode-bidi: isolate; }
.lx-hud b.ar { font-family: var(--font-body); font-weight: 700; direction: rtl; }
.lx-hud b.ar bdi { font-family: var(--font-mono); }   /* أرقام بأسس (10⁴) داخل قيمة عربية */
.lx-hud > span[hidden] { display: none; }
.lx-hud b.hot { color: var(--signal); }
.lx-hud b.ok { color: var(--ok); }
.lx-hud b.bad { color: var(--bad); }
.lx-more[hidden] { display: none; }
.lx-x { display: inline-block; margin-inline-start: 8px; padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--inset);
    color: var(--ink-soft); font: inherit; font-size: 0.78rem; cursor: pointer; }
.lx-x:hover, .lx-x:focus-visible { border-color: var(--signal); color: var(--signal); }
.lx .fc-status { margin: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raise); }
.lx-note { margin: 0; font-size: 0.8rem; color: var(--ink-muted); line-height: 1.7; }
.lx .s3-steps { margin: 0; }
.lx .s3-d { font-size: 0.94rem; line-height: 1.85; }
.lx .s3-d bdi, .lx .fc-status bdi { white-space: nowrap; }   /* معادلة قصيرة مثل p = h/λ لا تنقسم بين سطرين */
.lx .fc-controls { padding: 14px; }
.lx-table.sim-table { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.lx-table.sim-table > div { padding: 5px 9px; }
.lx-table.sim-table b { font-size: 0.98rem; overflow-wrap: anywhere; }
/* شريط تمرير مضغوط: العنوان وقيمته في سطر واحد، والشريط تحتهما */
.lx-sl { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 10px; margin-bottom: 8px; }
.lx-sl > label { grid-column: 1; grid-row: 1; margin: 0; }
.lx-sl > .sp-value { grid-column: 2; grid-row: 1; margin: 0; color: var(--signal); font-size: 0.92rem; white-space: nowrap; }
.lx-sl > input[type="range"] { grid-column: 1 / -1; grid-row: 2; margin: 2px 0 0; }
.lx-sl > :not(label):not(.sp-value):not(input) { grid-column: 1 / -1; }
.lx-h { margin: 12px 0 6px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 0.8rem; font-weight: 700; color: var(--ink-muted); }
.lx-h:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.lx-2d > svg, .lx-2d > canvas { display: block; width: 100%; height: auto; max-height: var(--lx-h); margin-inline: auto; }
.lx-sw { display: none; }
@media (max-width: 999px) {
    .lx-sw { display: flex; gap: 4px; margin: 0 0 6px; }
    .lx-sw button { flex: 1; height: 30px; line-height: 1; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--inset); color: var(--ink-soft);
        font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
    .lx-sw button.on { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
    .lx-stage:not([data-v="more"]) > .lx-more.lx-alt { display: none; }
    .lx-stage[data-v="more"] > .lx-more.lx-alt { top: 42px; }   /* 6px حشوة + 30px المبدّل + 6px */
}
@media (max-width: 640px) {
    .lx { --lx-h: clamp(170px, 32vh, 270px); }
    .lx-hud { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
    .lx-hud > span { display: block; padding: 0 6px; font-size: 0.72rem; }   /* الاسم يميناً والقيمة يساراً (الاسم قد يكون نصاً و<bdi> معاً) */
    .lx-hud b { float: left; margin-right: 4px; font-size: 0.8rem; }
    .lx-hud > .lx-wide { grid-column: 1 / -1; }   /* قيمة طويلة (مثل 2.6×10⁻³⁴ kg·m/s) تأخذ سطراً كاملاً */
}
@media (max-width: 999px) {
    .lx-view > *, .lx-side > * { order: 5; }   /* عنصر بلا كلاس ترتيب: بعد أدوات التحكم (لا يقفز فوق المشهد المثبّت) */
    .lx-stage { order: 1; position: sticky; top: var(--nav-h); z-index: 4; margin-inline: -12px; padding: 6px 12px 7px; background: var(--screen);
        border-bottom: 1px solid var(--line-strong); box-shadow: 0 12px 14px -12px rgba(0, 0, 0, 0.75); }
    .lx-tour { order: 2; } .lx-status { order: 3; } .lx-ctl { order: 4; } .lx-table { order: 5; } .lx-note { order: 6; } .lx-after { order: 7; }
    .lx-stage > .lx-more:not([hidden]) { position: absolute; z-index: 3; top: 6px; left: 12px; right: 12px; height: var(--lx-h); overflow: auto;
        display: flex; flex-direction: column; justify-content: center; padding: 6px; background: var(--screen); border: 1px solid var(--line-strong); border-radius: var(--radius); }
    .lx-stage > .lx-more svg { max-height: calc(var(--lx-h) - 44px); width: 100%; }
}
@media (min-width: 641px) and (max-width: 999px) { .lx { --lx-h: clamp(220px, 38vh, 380px); } .lx-stage { margin-inline: -24px; padding-inline: 24px; } .lx-stage > .lx-more:not([hidden]) { left: 24px; right: 24px; } }
@media (max-width: 999px) {   /* شريط الأقسام العائم يظهر عند السحب للأعلى: ينزل المشهد المثبّت تحته */
    .lx-stage { transition: top 0.22s ease; }
    .tf-on .lx-stage { top: calc(var(--nav-h) + var(--tf-h)); }
}
@media (max-width: 999px) and (max-height: 560px) { .lx-stage { position: relative; } }   /* هاتف أفقي: لا مساحة لتثبيت المشهد */
@media (min-width: 1000px) {
    .lx { --lx-h: clamp(260px, calc(100vh - var(--nav-h) - 300px), 470px); display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
    .lx-view { display: flex; flex-direction: column; gap: 10px; min-width: 0; position: sticky; top: calc(var(--nav-h) + 12px);
        max-height: calc(100vh - var(--nav-h) - 24px); overflow-y: auto; scrollbar-width: thin; }
    .lx-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
    .lx-stage:has(> .lx-more:not([hidden])) .s3-wrap { height: calc(var(--lx-h) * 0.62); }
    .lx-stage > .lx-more { margin-top: 8px; }
    .lx-stage > .lx-more svg { max-height: calc(var(--lx-h) * 0.5); }
    .tf-on .lx-view { top: calc(var(--nav-h) + var(--tf-h) + 12px); max-height: calc(100vh - var(--nav-h) - var(--tf-h) - 24px); }
}

/* =========================================================
   حركة الرسوم (js/fig-motion.js): الرسم يتحرك حركته الفيزيائية عند مرور المؤشر عليه (وعلى الهاتف: لمسة تشغّل ولمسة توقف)
   ========================================================= */
.mo-fig { position: relative; }
.mo-fig:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.mo-only { visibility: hidden; }
.mo-fig.is-playing .mo-only { visibility: visible; }
/* العلامة تجلس على الحافة العليا للرسم (نصفها فوق الإطار) فلا تغطي شيئاً من الرسم نفسه */
.mo-badge { position: absolute; top: -10px; left: 10px; z-index: 2; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--screen);
    color: var(--ink-muted); font-size: 0.7rem; line-height: 1.8; pointer-events: none; transition: opacity 0.2s; }
.mo-fig.is-playing .mo-badge { color: var(--signal); border-color: rgba(var(--signal-rgb), 0.45); }
@media (hover: hover) and (pointer: fine) { .mo-fig.is-playing .mo-badge { opacity: 0; } }
.mo-badge--icon { top: -10px; left: 6px; width: 20px; height: 20px; padding: 0; text-align: center; line-height: 18px; font-size: 0.68rem; }
@media (max-width: 640px) { .mo-badge:not(.mo-badge--icon) { font-size: 0.66rem; } }
@media (prefers-reduced-motion: reduce) { .mo-badge { display: none; } }


/* new method (شرح وتبسيط): shared components */
.nm-card { border: 1px solid var(--line-strong); border-right: 3px solid var(--signal); border-radius: var(--radius); background: var(--inset); padding: 14px 18px; margin: 0 0 22px; line-height: 1.9; color: var(--ink-soft); }
.nm-card b { color: var(--ink); }
.nm-card p { margin: 0 0 10px; }
.nm-card ol { margin: 0 0 12px; padding-right: 22px; display: flex; flex-direction: column; gap: 4px; }
.nm-card .nm-how { margin: 0; padding-top: 10px; border-top: 1px dashed var(--line); }
.nm-card ol:last-child { margin-bottom: 0; }
.nm-pn { display: inline-block; font-size: 0.78rem; font-weight: 700; color: var(--screen); background: var(--neg); padding: 2px 8px; border-radius: 2px; margin-left: 8px; vertical-align: 3px; font-family: var(--font-body); }
.nm-done { margin: 8px 0 0; padding: 8px 14px; color: var(--ok); background: rgba(var(--ok-rgb), 0.06); border: 1px solid rgba(var(--ok-rgb), 0.35); border-radius: var(--radius); font-weight: 600; line-height: 1.8; }
.nm-bq { margin: 14px 0 0; padding: 10px 14px; border: 1px solid var(--signal); border-radius: 2px; background: rgba(var(--signal-rgb), 0.05); }
.nm-bql { display: block; font-size: 0.8rem; font-weight: 700; color: var(--signal); margin-bottom: 4px; }
.nm-bq p { margin: 0 0 6px; color: var(--ink); line-height: 1.9; }
.nm-bq p:last-child { margin-bottom: 0; }
.nm-bqa .nm-bqq { margin: 0 0 8px; padding-bottom: 7px; border-bottom: 1px dashed var(--signal); color: var(--ink); font-size: 0.95rem; line-height: 1.8; }
.nm-bqa .nm-bqq b { color: var(--signal); }
.nm-bqw .nm-bqans { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--signal) 12%, transparent); border-inline-start: 3px solid var(--signal); color: var(--ink); line-height: 1.9; }
.nm-bqw .nm-bqans b { color: var(--signal); }
.nm-bqw .nm-bqans-blk .table-wrap { margin-bottom: 6px; background: var(--sheet); }
.nm-bqw .nm-bqans-blk .table-wrap b { color: inherit; }
.nm-bqw .nm-bqans-blk > :last-child { margin-bottom: 0; }
@media (max-width: 640px) {   /* الجدول داخل إطارين: نضيّق الحواشي لئلا يصير أعرض من الشاشة */
    .nm-bqw .nm-bqans-blk { padding: 8px 5px 6px; }
    .nm-bqw .nm-bqans-blk .data-table { font-size: 0.88rem; }
    .nm-bqw .nm-bqans-blk .data-table th, .nm-bqw .nm-bqans-blk .data-table td { padding: 6px 5px; }
}
.nm-fold { margin-top: 10px; }
.nm-fold > summary { color: var(--ink-soft); font-size: 0.93rem; }
.nm-fold > div > :last-child { margin-bottom: 0; }
.nm-math > summary { color: var(--neg); }
.nm-warn { margin: 12px 0 0; padding: 8px 12px; border-right: 3px solid var(--signal); background: var(--signal-soft); border-radius: 2px; line-height: 1.9; color: var(--ink-soft); }
.nm-warn b { color: var(--ink); }
.nm-words { text-align: center; font-size: 1.06rem; padding: 8px 10px; margin: 6px 0 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--inset); color: var(--ink); }
.nm-chain { margin: 10px 0 12px; padding: 0; list-style: none; counter-reset: nm; display: flex; flex-direction: column; gap: 6px; }
.nm-chain > li { counter-increment: nm; position: relative; padding: 8px 46px 8px 12px; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); line-height: 1.85; color: var(--ink-soft); }
.nm-chain > li::before { content: counter(nm); position: absolute; right: 10px; top: 9px; width: 24px; height: 24px; line-height: 24px; text-align: center; border-radius: 50%; background: var(--neg); color: var(--screen); font-weight: 700; font-size: 0.85rem; font-family: var(--font-mono); }
.nm-chain > li b { color: var(--ink); }
.nm-tag { margin: 6px 0 12px; font-size: 0.9rem; color: var(--ink-muted); }
.nm-tag.key { color: var(--signal); font-weight: 600; }
.nm-ex { direction: ltr; text-align: center; margin: 4px 0 12px; }
.nm-ld td, .nm-ld th { text-align: center; padding: 6px 5px; font-size: 0.88rem; }
.nm-deep { margin-top: 30px; }
.nm-deep h4 { margin-top: 18px; }
/* new method css: chapter 5 */
/* 2-5: جدول القسمة الطويلة داخل جواب «اختبر فهمك» أضيق قليلاً على الهاتف */
.m41n-ld .data-table th, .m41n-ld .data-table td { padding: 8px 5px; }
/* new method css: chapter 9 */
/* ----- 8_0 «1-9 مقدمة»: رسوم الدرس ومختبر النواة (atom-zoom-lab) ----- */
/* النيوكليونات بعرف الفصل التاسع (كـ m82-p وm82-n): البروتون أحمر عليه +، والنيوترون رمادي بلا علامة؛ والإلكترون سماوي (سالب) */
.m80-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m80-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m80-hl { fill: rgba(255, 255, 255, 0.2); pointer-events: none; }
.m80-plus { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m80-e { fill: #7CC7FF; }
.m80-nuc { fill: #F2685A; stroke: #FFC4BC; stroke-width: 1; }
.t-ar.m80-tp { fill: #FF9A8E; font-weight: 700; }
.t-ar.m80-tn { fill: #C3CEDA; font-weight: 700; }
.m80-orb { fill: none; stroke: rgba(124, 199, 255, 0.5); stroke-width: 1.2; }
.m80-orb2 { fill: none; stroke: rgba(124, 199, 255, 0.32); stroke-width: 1; stroke-dasharray: 3 4; }
.m80-thom { fill: rgba(255, 138, 128, 0.16); stroke: rgba(255, 138, 128, 0.6); stroke-width: 1.2; }
.t-label.m80-tplus { fill: #FF9A8E; }
/* المفاعل والسحابة */
.m80-ground { stroke: var(--ink-muted); stroke-width: 1.4; }
.m80-dome { fill: #D9E1EA; stroke: #FFFFFF; stroke-width: 1; }
.m80-bld { fill: #AEBBCB; }
.m80-tower { fill: #9AAABD; stroke: #C9D4E0; stroke-width: 1; }
.m80-steamS { fill: none; stroke: rgba(235, 242, 250, 0.55); stroke-width: 5; stroke-linecap: round; }
.m80-steam { fill: rgba(235, 242, 250, 0.6); }
.m80-lamp { fill: var(--signal); filter: drop-shadow(0 0 4px var(--signal)); }
.m80-lampb { fill: var(--ink-muted); }
.m80-stem { fill: #D9773E; }
.m80-base { fill: rgba(217, 119, 62, 0.45); }
.m80-cap { fill: #E8914A; }
.m80-cap2 { fill: #FFC46B; }
.m80-cap3 { fill: rgba(140, 70, 40, 0.55); }
.m80-flash { fill: rgba(255, 236, 170, 0.55); }
/* مركبات اليورانيوم والإشعاع */
.m80-rock { fill: #A9B84E; stroke: #E2EA98; stroke-width: 1.2; stroke-linejoin: round; }
.m80-rock2 { fill: rgba(240, 250, 170, 0.35); }
.m80-dish { fill: none; stroke: var(--ink-muted); stroke-width: 2; stroke-linecap: round; }
.m80-ray { fill: none; stroke: rgba(214, 240, 120, 0.7); stroke-width: 1.6; stroke-dasharray: 5 4; }
.m80-rp { fill: #D6F078; }
.t-ar.m80-tray { fill: #D6F078; font-weight: 700; }
/* مسار الزمن */
.m80-tl { stroke: var(--ink-muted); stroke-width: 1.6; }
.m80-tlp { fill: var(--signal); }
.m80-fld { fill: rgba(var(--signal-rgb), 0.1); stroke: var(--signal); stroke-width: 1.2; }
.m80-fldi { fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* المختبر */
.m80-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m80-main { background: radial-gradient(circle at 50% 50%, rgba(124, 199, 255, 0.05), transparent 70%); }
.m80-markl { stroke: var(--signal); stroke-width: 1; stroke-dasharray: 3 3; }
.t-ar.m80-tmk { fill: var(--signal); }
.t-ar.m80-zt { fill: var(--ink-muted); }
.m80-ray .m80-rayp { fill: none; stroke: #D6F078; stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 0 3px #D6F078); }
.m80-foil { fill: rgba(var(--signal-rgb), 0.06); stroke: rgba(var(--signal-rgb), 0.3); stroke-width: 1; stroke-dasharray: 4 4; }
.m80-rat { fill: none; stroke: rgba(150, 190, 235, 0.18); stroke-width: 1; }
.m80-alpha { fill: #FF8AB6; stroke: #FFD0E2; stroke-width: 0.8; }
.m80-trail { fill: none; stroke: rgba(255, 138, 182, 0.55); stroke-width: 1.3; stroke-linejoin: round; }
.m80-trail.dv { stroke: rgba(var(--signal-rgb), 0.8); stroke-width: 1.6; }
.m80-trail.bk { stroke: #FFC53D; stroke-width: 2.2; }
.t-ar.m80-ta { fill: #FF8AB6; font-weight: 700; }
.fc-controls .fc-buttons.m80-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m80-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.fc-controls .fc-buttons.m80-two button { flex: 1 1 45%; }
.fc-controls .fc-buttons.m80-els5 button { flex: 1 1 30%; }
.fc-controls .fc-buttons.m80-btns button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m80-lab .lx-table.sim-table > .m80-w { grid-column: 1 / -1; }
.m80-lab .lx-table.sim-table b.ar { font-family: var(--font-body); font-weight: 700; direction: rtl; text-align: right; }
/* ----- 8_1 «2-9 تركيب النواة وخصائصها»: رسوم الدرس ومختبر النواة (nucleus-build-lab) ----- */
/* النيوكليونات بعرف الفصل التاسع (كـ m82-p وm82-n): البروتون أحمر عليه +، والنيوترون رمادي بلا علامة */
.m81-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m81-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m81-hl { fill: rgba(255, 255, 255, 0.2); pointer-events: none; }
.m81-plus { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m81-nb { fill: rgba(242, 104, 90, 0.06); stroke: rgba(255, 196, 188, 0.45); stroke-width: 1; stroke-dasharray: 4 3; }
.t-ar.m81-tp { fill: #FF9A8E; font-weight: 700; }
.t-ar.m81-tn { fill: #C3CEDA; font-weight: 700; }
.m81-brace { fill: none; stroke: var(--signal); stroke-width: 1.4; }
.t-label.m81-nsym { fill: var(--ink); font-family: var(--font-body); font-weight: 600; }
.t-label.m81-big { fill: var(--ink); font-family: var(--font-body); font-weight: 700; }
.t-label.m81-bigA, .t-ar.m81-tA { fill: var(--signal); font-weight: 700; }
.t-label.m81-bigZ, .t-ar.m81-tZ { fill: #FF9A8E; font-weight: 700; }
/* استطارة جسيمات ألفا */
.m81-au { fill: #F2685A; stroke: #FFC4BC; stroke-width: 1.2; }
.t-label.m81-plusd { fill: #3A0C08; font-weight: 700; }
.m81-alpha { fill: #FF8AB6; stroke: #FFD0E2; stroke-width: 0.8; }
.m81-path { fill: none; stroke-width: 1.4; stroke-dasharray: 5 4; }
.m81-pa { stroke: rgba(255, 138, 182, 0.6); }
.m81-pd { stroke: rgba(var(--signal-rgb), 0.75); }
.m81-pb { stroke: var(--signal); stroke-width: 1.8; }
.t-ar.m81-ta { fill: #FF8AB6; font-weight: 700; }
.t-ar.m81-tdv { fill: rgba(var(--signal-rgb), 0.9); }
/* الشكل (7) */
.m81-dash { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.m81-c { fill: var(--signal); }
/* معادلات الفيرمي (نص عربي مع صيغة) */
.m81-eq, .m81-eqs p { text-align: center; margin: 4px 0 10px; }
.m81-eqs { margin: 4px 0 6px; }
/* المختبر */
.m81-svg, .m81-csvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m81-rl { stroke: var(--signal); stroke-width: 2; }
.m81-dim { stroke: var(--signal); stroke-width: 1.2; }
.t-label.m81-rt { fill: var(--signal); font-weight: 700; }
.m81-sb { stroke: var(--ink-muted); stroke-width: 2; }
.t-label.m81-sA { fill: var(--signal); font-family: var(--font-body); font-weight: 700; }
.t-label.m81-sZ { fill: #FF9A8E; font-family: var(--font-body); font-weight: 700; }
.t-label.m81-sX { fill: var(--ink); font-family: var(--font-body); font-weight: 700; }
.t-ar.m81-nm { fill: var(--ink); font-weight: 700; }
.t-ar.m81-cnt { fill: var(--ink-soft); }
.t-label.m81-eqA { fill: var(--ink-soft); }
.m81-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.m81-gl { stroke: rgba(150, 190, 235, 0.1); stroke-width: 1; }
.m81-ax { stroke: var(--ink-muted); stroke-width: 1.4; }
.m81-curve { fill: none; stroke: #7CC7FF; stroke-width: 2.2; }
.m81-bk { fill: var(--ink-muted); }
.m81-cur { stroke: var(--signal); stroke-width: 1; stroke-dasharray: 3 3; }
.m81-now { fill: var(--signal); stroke: #FFF0B8; stroke-width: 1.2; }
.t-label.m81-nowt { fill: var(--signal); font-weight: 700; }
.fc-controls .fc-buttons.m81-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m81-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.fc-controls .fc-buttons.m81-btns button:disabled { opacity: 0.4; cursor: not-allowed; }
.fc-controls .fc-buttons.m81-four button { flex: 1 1 45%; }
.fc-controls .fc-buttons.m81-pre button { flex: 1 1 45%; }
.fc-controls .fc-buttons.m81-li button { flex: 1 1 28%; font-size: 1rem; }
.fc-controls .fc-buttons.m81-btns button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m81-lab .lx-table.sim-table > .m81-w { grid-column: 1 / -1; }
.m81-lab .lx-table.sim-table b.ar { font-family: var(--font-body); font-weight: 700; direction: rtl; text-align: right; }
/* الحاسوب: النواة فوق منحني نصف القطر في عمود المشهد، وكلاهما مع القراءات ضمن الشاشة */
@media (min-width: 1000px) {
    .m81-lab .m81-main > svg { max-height: calc(var(--lx-h) * 0.56); }
    .m81-lab .m81-chart svg { max-height: calc(var(--lx-h) * 0.44); }
    .m81-lab .lx-stage > .m81-chart { margin-top: 4px; }
}
/* الهاتف: حين يختار الطالب «منحني نصف القطر» يحل المنحني محل النواة في الجزء المثبّت */
@media (max-width: 999px) {
    .m81-lab .lx-stage[data-v="more"] > .m81-main { display: none; }
    .m81-lab .lx-stage[data-v="more"] > .m81-chart.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
    .m81-lab .lx-stage > .m81-chart svg { max-height: var(--lx-h); }
}
/* 8-9 مخاطر وفوائد الاشعاع النووي: رسوم الدرس ومختبر الوقاية (rad-safety-lab). الإشعاع النووي برتقالي (لون أشعة كاما في الفصل)،
   والإلكترون سماوي، والمصدر المشع نجمة حمراء عليها علامة الإشعاع، والحاجز رصاصي رمادي، والمنطقة الآمنة صفراء باهتة */
.m810-star { fill: #F2685A; stroke: #FFC4BC; stroke-width: 1; stroke-linejoin: round; }
.m810-trek { fill: #3A0C08; }
.m810-tre { fill: var(--signal); }
.m810-gam { fill: none; stroke: #FFB347; stroke-width: 2; stroke-linecap: round; }
.m810-gamh { fill: #FFB347; }
.m810-path { stroke: rgba(255, 179, 71, 0.28); stroke-width: 1; stroke-dasharray: 3 4; }
.m810-mot { stroke: var(--ink-muted); stroke-width: 1.1; stroke-dasharray: 3 3; }
.m810-man, .m810-man circle, .m810-man path { fill: #7F93AA; }
.m810-mans circle, .m810-mans path { fill: #C3D2E2; }
.m810-sky { fill: rgba(3, 10, 22, 0.55); }
.m810-starlet { fill: #EAF1F8; opacity: 0.8; }
.m810-ground { fill: #4A3A2C; }
.m810-rock { fill: #6E5A47; stroke: #8E7660; stroke-width: 1; }
.m810-rockh { fill: #6E5A47; stroke: #FFB347; stroke-width: 1.4; }
.m810-hot { fill: #FFB347; }
.m810-dev { fill: #3F5068; stroke: var(--ink-muted); stroke-width: 1; }
.m810-bed { fill: #8C9BAE; }
.m810-leg { stroke: #8C9BAE; stroke-width: 3; }
.m810-blanket { fill: #3F8A5C; stroke: #6CC08C; stroke-width: 1; }
.m810-skin { fill: #E8C9A0; stroke: #A27B5A; stroke-width: 1; }
.m810-arch { fill: none; stroke: #C3D2E2; stroke-width: 6; stroke-linecap: round; }
.m810-beam { stroke: rgba(255, 179, 71, 0.55); stroke-width: 1.4; }
.m810-head { fill: #EAF1F8; stroke: #3F5068; stroke-width: 1; }
.m810-target { fill: #FFB347; }
.m810-cell { fill: rgba(242, 167, 160, 0.08); stroke: rgba(242, 167, 160, 0.55); stroke-width: 1.5; }
.m810-orb { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.m810-nucl { fill: #F2685A; stroke: #FFC4BC; stroke-width: 1; }
.m810-e { fill: #7CC7FF; }
.m810-hole { fill: none; stroke: #7CC7FF; stroke-width: 1.2; stroke-dasharray: 2 2; }
.t-ar.m810-cy { fill: #7CC7FF; }
.t-ar.m810-red { fill: #FF8A80; }
.t-ar.m810-ok { fill: var(--ok); }
.t-ar.m810-bad { fill: var(--bad); }
.m810-safe { fill: rgba(255, 220, 90, 0.16); stroke: rgba(255, 220, 90, 0.4); stroke-width: 1; }
.m810-arc { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.m810-axis { stroke: var(--ink-soft); stroke-width: 1.4; }
.m810-tick { stroke: var(--ink-soft); stroke-width: 1.2; }
.m810-band { fill: rgba(242, 104, 90, 0.22); stroke: rgba(242, 104, 90, 0.5); stroke-width: 1; }
.m810-disc { fill: #F2EDE4; stroke: #8C9BAE; stroke-width: 1; }
.m810-rarr { stroke: #FF7EB6; stroke-width: 3; }
.m810-wall { fill: #5B6573; stroke: #AEB8C4; stroke-width: 1.2; }
.m810-lead { stroke: var(--ink-muted); stroke-width: 1; }
.m810-clock { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
.m810-ctick { fill: var(--ink-soft); }
.m810-hand { stroke: var(--signal); stroke-width: 1.8; stroke-linecap: round; }
.m810-tray { fill: rgba(var(--ok-rgb), 0.12); stroke: #5FD39A; stroke-width: 2; }
.m810-berry { fill: #E8413A; stroke: #FF8A80; stroke-width: 0.6; }
.m810-berryb { fill: #7A3A3E; stroke: #9C6A6A; stroke-width: 0.6; }
.m810-leaf { fill: #4CB06A; }
.m810-leafb { fill: #6E7A50; }
.m810-seed { fill: #FFE08A; }
.m810-mold { fill: rgba(240, 244, 248, 0.75); }
.m810-space { fill: #050E1C; stroke: var(--line); stroke-width: 1; }
.m810-dish { fill: #C3D2E2; stroke: #EAF1F8; stroke-width: 1; }
.m810-strut { stroke: #D9B45A; stroke-width: 2; }
.m810-body { fill: #D9B45A; stroke: #F2D68A; stroke-width: 1; }
.m810-water { fill: rgba(38, 112, 176, 0.35); stroke: var(--line); stroke-width: 1; }
.m810-hull { fill: #24405E; stroke: #7CA6CF; stroke-width: 1.2; }
.m810-prop { fill: #AEB8C4; }
.m810-bub { fill: none; stroke: #BFE3FF; stroke-width: 1; }

/* المختبر: الوقاية من الإشعاع النووي الخارجي */
.m810-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m810-floor { stroke: var(--ink-muted); stroke-width: 1.4; }
.m810-pot { fill: #3A3F47; stroke: #AEB8C4; stroke-width: 1; }
.m810-ray { fill: #FFB347; }
.m810-rayb { fill: #FFB347; opacity: 0.55; }
.m810-hit { fill: none; stroke: #FF7B7B; stroke-width: 2; }
.m810-dial { fill: rgba(255, 255, 255, 0.03); stroke: var(--ink-soft); stroke-width: 1.4; }
.m810-fill { fill: rgba(var(--signal-rgb), 0.28); }
.m810-meter { fill: rgba(255, 255, 255, 0.04); stroke: var(--line-strong); stroke-width: 1; }
.m810-mbar { fill: #FF7B7B; }
.fc-controls .fc-buttons.m810-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m810-btns button { flex: 1 1 45%; padding: 7px 4px; font-size: 0.84rem; min-width: 0; line-height: 1.25; }
.m810-lab .lx-table .m810-w { grid-column: 1 / -1; }
.m810-log { margin: 0; padding: 0; list-style: none; font-size: 0.82rem; }
.m810-log li { padding: 2px 0; border-bottom: 1px dashed var(--line); }
.m810-log li:last-child { border-bottom: 0; }
.m810-log em { font-style: normal; font-weight: 700; color: var(--signal); }
/* 3-9 طاقة الربط النووية: رسوم الدرس ومختبر الميزان (binding-energy-lab) — البروتون أحمر عليه +، والنيوترون رمادي مزرق،
   والقوة النووية صفراء، والتنافر الكهربائي وردي، والطاقة المتحررة موجة صفراء فاتحة */
.m82-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m82-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m82-pt { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m82-hl { stroke: var(--signal); stroke-width: 2.6; }
.m82-att { stroke: var(--signal); stroke-width: 2.6; fill: none; }
.m82-rep { stroke: var(--pos); stroke-width: 1.7; fill: none; }
.m82-repd { stroke: var(--pos); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.7; }
.m82-en { fill: none; stroke: #FFF0B8; stroke-width: 2; stroke-linecap: round; }
.m82-enh { fill: #FFF0B8; }
.m82-str { stroke: var(--ink-muted); stroke-width: 1; }
.m82-pan { fill: #6E7C8E; stroke: var(--ink-soft); stroke-width: 1; }
.m82-beam { stroke: var(--ink-soft); stroke-width: 4; stroke-linecap: round; }
.m82-stand { fill: #8C6A4A; stroke: #C9A27A; stroke-width: 1.2; stroke-linejoin: round; }
.m82-pivot { fill: #C9A27A; stroke: var(--screen); stroke-width: 1.5; }
.m82-grid { stroke: rgba(150, 190, 235, 0.1); stroke-width: 1; }
.m82-ax { stroke: var(--ink-muted); stroke-width: 1.4; }
.m82-curve { fill: none; stroke: #6FB8F0; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.m82-dot { fill: var(--ink); stroke: var(--screen); stroke-width: 1; }
.m82-arr { fill: none; stroke: var(--signal); stroke-width: 2; stroke-dasharray: 6 4; }
.m82-mv { fill: var(--signal); }
.m82-svg, .m82-csvg { direction: ltr; user-select: none; -webkit-user-select: none; }
/* المختبر */
.m82-sel { stroke: var(--signal); stroke-width: 2; stroke-dasharray: 4 3; fill: none; }
.m82-selc { fill: var(--signal); stroke: var(--screen); stroke-width: 1.5; }
.m82-band { fill: rgba(var(--signal-rgb), 0.07); }
.m82-strip { fill: rgba(255, 255, 255, 0.025); stroke: var(--line); stroke-width: 1; }
.m82-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m82-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m82-btns button { padding: 6px 4px; font-size: 0.84rem; min-width: 0; line-height: 1.25; }
.fc-controls .fc-buttons.m82-nucs button { flex: 1 1 30%; }
.fc-controls .fc-buttons.m82-two button { flex: 1 1 45%; }
.m82-nucs button small { display: block; font-size: 0.7rem; color: var(--ink-muted); }
.m82-nucs button.fc-primary small { color: inherit; }
.m82-lab .lx-table .m82-w { grid-column: 1 / -1; }
/* الحاسوب: الميزان فوق المنحني في عمود المشهد */
@media (min-width: 1000px) {
    .m82-lab .m82-main > svg { max-height: calc(var(--lx-h) * 0.62); }
    .m82-lab .m82-chart svg { max-height: calc(var(--lx-h) * 0.45); }
    .m82-lab .lx-stage > .m82-chart { margin-top: 4px; }
}
/* الهاتف: حين يختار الطالب «المنحني» يحل محل الميزان في الجزء المثبّت */
@media (max-width: 999px) {
    .m82-lab .lx-stage[data-v="more"] > .m82-main { display: none; }
    .m82-lab .lx-stage[data-v="more"] > .m82-chart.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
    .m82-lab .lx-stage > .m82-chart svg { max-height: var(--lx-h); }
}
.m82-att2 { stroke-width: 3.4; }
/* 4-9 الانحلال الاشعاعي: رسوم الدرس ومختبر «رف النوى» (radio-decay-lab). البروتون أحمر عليه + والنيوترون رمادي (اصطلاح الفصل كما في m82-)،
   وجسيمة بيتا السالبة سماوية والموجبة وردية، وأشعة كاما برتقالية، والنواة غير المستقرة تحيط بها حلقة متقطعة صفراء في المختبر */
.m83-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m83-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m83-pt { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m83-beta { fill: #7CC7FF; }
.m83-pos { fill: #FF7EB6; }
.m83-gam { fill: none; stroke: #FFB347; stroke-width: 2; stroke-linecap: round; }
.m83-gamh { fill: #FFB347; }
.m83-mot { stroke: var(--ink-muted); stroke-width: 1.2; stroke-dasharray: 3 3; fill: none; }
.m83-nl text { fill: var(--ink); font-family: 'Times New Roman', serif; }
.m83-nl.t-amber text { fill: var(--signal); }
.t-ar.m83-ok, .t-label.m83-ok { fill: var(--ok); }
.t-ar.m83-bad { fill: var(--bad); }
.m83-div { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 4; }
.m83-table { stroke: var(--ink-muted); stroke-width: 2; }
.m83-pencil { fill: #F2C14E; stroke: #A27B1E; stroke-width: 1; }
.m83-pline { stroke: #C99A2E; stroke-width: 1; }
.m83-wood { fill: #E8C9A0; stroke: #A27B1E; stroke-width: 0.8; }
.m83-lead { fill: #3A3F47; }
.m83-eraser { fill: #FF8FA3; stroke: #C9566C; stroke-width: 0.8; }
.m83-ring { fill: none; stroke: var(--signal); stroke-width: 1.4; stroke-dasharray: 4 4; }
.m83-halo { fill: rgba(255, 179, 71, 0.16); stroke: rgba(255, 179, 71, 0.7); stroke-width: 1.2; }
.m83-flash { fill: none; stroke: #FFFFFF; stroke-width: 1.6; }
.m83-nlg { fill: var(--ink); font-family: 'Times New Roman', serif; font-style: italic; }
.m83-bar { stroke: var(--ink); stroke-width: 1.2; }
.t-ar.m83-big { fill: var(--signal); font-weight: 700; }

/* المختبر */
.m83-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.fc-controls .fc-buttons.m83-shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m83-shelf button { padding: 5px 2px; font-size: 0.8rem; line-height: 1.3; min-width: 0; }
.m83-shelf button bdi { display: block; font-family: 'Times New Roman', serif; font-size: 1.02rem; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.m83-shelf button small { display: block; font-weight: 500; font-size: 0.7rem; color: var(--ink-muted); }
.m83-shelf button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m83-shelf button.on small { color: var(--signal); }
.fc-controls .fc-buttons.m83-one { margin: 0 0 6px; }
.fc-controls .fc-buttons.m83-one button { padding: 8px 6px; font-size: 0.86rem; }
.m83-lab .lx-table .m83-w { grid-column: 1 / -1; }
.m83-lab .lx-hud b.h-n { font-family: 'Times New Roman', serif; font-size: 1rem; }
@media (max-width: 400px) { .fc-controls .fc-buttons.m83-shelf button { font-size: 0.74rem; } .m83-shelf button bdi { font-size: 0.95rem; } }
/* 1-4-9 انحلال الفا: رسوم الدرس ومختبر «انحلال الفا» (alpha-decay-lab). البروتون أحمر عليه + والنيوترون رمادي (اصطلاح الفصل كما في m82-) (كما في درس الانحلال الاشعاعي)،
   وفي رسم المثال (4) الراديوم أخضر والرادون أزرق وجسيمة الفا حمراء كما في الكتاب؛ والميزان صورة طاقة الانحلال */
.m84-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m84-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m84-pt { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m84-mot { stroke: var(--ink-muted); stroke-width: 1.2; stroke-dasharray: 3 3; fill: none; }
.m84-nl text { fill: var(--ink); font-family: 'Times New Roman', serif; }
.m84-nl.m84-dark text { fill: #0B2747; font-weight: 700; }
.m84-sym { fill: var(--ink); font-family: 'Times New Roman', serif; font-style: italic; }
.m84-sym.t-amber { fill: var(--signal); }
.m84-shell { fill: rgba(255, 255, 255, 0.04); stroke: var(--ink-muted); stroke-width: 1.2; }
.m84-arw { stroke: #7CC7FF; stroke-width: 2.2; fill: none; }
.m84-dn { stroke: var(--ink-muted); stroke-width: 1.6; }
.m84-ra { fill: #6FCF6F; stroke: #B9F0B9; stroke-width: 1; }
.m84-rn { fill: #6FA8FF; stroke: #BBD5FF; stroke-width: 1; }
.m84-al { fill: #FF5C5C; stroke: #FFB3B3; stroke-width: 1; }
.m84-stand { fill: #2A3F5C; stroke: var(--line-strong); stroke-width: 1; }
.m84-base { stroke: var(--ink-muted); stroke-width: 2.4; }
.m84-beam { stroke: #C9D6E3; stroke-width: 4; stroke-linecap: round; }
.m84-piv { fill: var(--signal); }
.m84-str { stroke: var(--ink-muted); stroke-width: 1; }
.m84-pan { fill: rgba(201, 214, 227, 0.18); stroke: #C9D6E3; stroke-width: 1.2; }
.t-ar.m84-ok { fill: var(--ok); }
.t-ar.m84-bad { fill: var(--bad); }

/* معادلة الكتاب بأسماء حدودها (داخل إطار عبارة الكتاب) */
.m84-eq { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 4px 6px;
    margin: 6px 0 10px; padding: 10px 8px; border-radius: var(--radius); background: rgba(255, 170, 90, 0.12); text-align: center; }
.m84-eqc { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.m84-eqs { font-size: 1.2rem; }
.m84-eqo { padding-top: 4px; font-size: 1.1rem; }
.m84-eql { direction: rtl; font-size: 0.8rem; line-height: 1.5; color: var(--ink-soft); }

/* علاقة طاقة الانحلال داخل إطار الكتاب: مظللة كما في الكتاب */
.nm-ex.m84-law { padding: 8px 6px; border-radius: var(--radius); background: rgba(190, 230, 120, 0.12); font-size: 1.12rem; }
/* الحساب العمودي باليد (الجمع والطرح) */
.m84-cols { display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: center; margin: 6px 0 10px; }
.m84-col { font-family: var(--font-mono); font-size: 0.98rem; line-height: 1.55; white-space: pre; direction: ltr; text-align: right; color: var(--ink); }
.m84-col span { display: block; }
.m84-col .m84-ln { border-top: 1px solid var(--ink-muted); }
.m84-col .m84-res { color: var(--signal); }

/* المختبر */
.m84-ring { fill: none; stroke: var(--signal); stroke-width: 1.4; stroke-dasharray: 4 4; }
.m84-varw { stroke: #7CC7FF; stroke-width: 2.2; }
.m84-ahp { fill: #7CC7FF; }
.t-ar.m84-phase { fill: var(--ink); font-weight: 700; }
.t-ar.m84-phase.m84-bad { fill: var(--bad); }
.m84-svg, .m84-bsvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m84-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m84-pre { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m84-pre button { padding: 5px 2px; font-size: 0.8rem; line-height: 1.3; min-width: 0; }
.m84-pre button bdi { display: block; font-family: 'Times New Roman', serif; font-size: 1.02rem; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.m84-pre button small { display: block; font-weight: 500; font-size: 0.7rem; color: var(--ink-muted); }
.m84-pre button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m84-pre button.on small { color: var(--signal); }
.fc-controls .fc-buttons.m84-one { margin: 0 0 6px; }
.fc-controls .fc-buttons.m84-one button { padding: 8px 6px; font-size: 0.86rem; }
.m84-lab .lx-table .m84-w { grid-column: 1 / -1; }
.m84-lab .lx-hud b.h-d { font-family: 'Times New Roman', serif; font-size: 1rem; }
.m84-steps { margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raise); }
.m84-steps h5 { margin: 0 0 6px; font-size: 0.86rem; color: var(--ink-muted); }
.m84-steps ol { margin: 0; padding-inline-start: 20px; }
.m84-steps li { margin: 3px 0; font-size: 0.9rem; line-height: 1.7; }
.m84-steps bdi { font-family: var(--font-mono); font-size: 0.86rem; white-space: nowrap; }
.m84-steps .ok { color: var(--ok); font-weight: 700; }
.m84-steps .bad { color: var(--bad); font-weight: 700; }
@media (min-width: 1000px) {
    .m84-lab .m84-main > svg { max-height: calc(var(--lx-h) * 0.56); }
    .m84-lab .m84-chart svg { max-height: calc(var(--lx-h) * 0.5); }
    .m84-lab .lx-stage > .m84-chart { margin-top: 4px; }
}
@media (max-width: 999px) {
    .m84-lab .lx-stage[data-v="more"] > .m84-main { display: none; }
    .m84-lab .lx-stage[data-v="more"] > .m84-chart.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
    .m84-lab .lx-stage > .m84-chart svg { max-height: var(--lx-h); }
}
@media (max-width: 400px) { .fc-controls .fc-buttons.m84-pre button { font-size: 0.74rem; } .m84-steps bdi { white-space: normal; } }
/* 2-4-9 انحلال بيتا: رسوم الدرس (f85_) ومختبر النواة (beta-lab). البروتون أحمر عليه «+» والنيوترون رمادي (ألوان الفصل كله)،
   والإلكترون سماوي كما في المنصة كلها، والبوزترون بنفسجي، والنيوترينو برتقالي، ومضاد النيوترينو أخضر */
.m85-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m85-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m85-pt, .m85l-pt { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m85l-b { stroke-width: 0.9; }
.m85l-lb { stroke-width: 1.2; }
.m85-em, .m85l-em { fill: #7CC7FF; stroke: #CFEAFF; stroke-width: 1; }
.m85-ep, .m85l-ep { fill: #C58CFF; stroke: #E9D6FF; stroke-width: 1; }
.m85-nu, .m85l-nu { fill: #FFB347; }
.m85-anu, .m85l-anu { fill: #6EE7A8; }
.t-label.m85-sg, .t-label.m85l-sg { fill: var(--signal-ink); font-weight: 700; }
.m85-bar, .m85l-bar { stroke: var(--ink); stroke-width: 1.3; }
.m85-arr { stroke: var(--ink-muted); stroke-width: 2.2; }
.m85-sep { stroke: var(--line); stroke-width: 1; }
.m85-trk { stroke: rgba(124, 199, 255, 0.55); stroke-width: 1.4; stroke-dasharray: 6 4; }
.m85-trkp { stroke: rgba(197, 140, 255, 0.6); stroke-width: 1.4; stroke-dasharray: 6 4; }
.m85-zoomc { fill: none; stroke: var(--signal); stroke-width: 1.6; stroke-dasharray: 5 4; }
.m85-orb { fill: none; stroke: var(--ink-muted); stroke-width: 1.1; stroke-dasharray: 4 4; }
.m85-cap { fill: none; stroke: #7CC7FF; stroke-width: 1.4; stroke-dasharray: 3 3; }
.t-label.m85-top { fill: var(--signal); font-weight: 600; }
.t-label.m85-bot { fill: #7CC7FF; font-weight: 600; }
.t-label.m85-ok { fill: var(--ok); font-weight: 700; }
.m85-row { fill: var(--inset); stroke: var(--line); stroke-width: 1; }
.m85-rowt { stroke: rgba(var(--signal-rgb), 0.45); }
.m85-rowb { stroke: rgba(124, 199, 255, 0.45); }
.m85-tab td, .m85-tab th { vertical-align: middle; }
/* المختبر */
.m85l-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m85l-orb { fill: none; stroke: var(--ink-muted); stroke-width: 1.1; stroke-dasharray: 4 4; }
.m85l-ring { fill: none; stroke: var(--signal); stroke-width: 2.2; }
.m85l-lensc { fill: rgba(7, 26, 48, 0.9); stroke: var(--signal); stroke-width: 1.4; }
.m85l-lensl { stroke: rgba(var(--signal-rgb), 0.45); stroke-width: 1; stroke-dasharray: 3 3; }
.t-ar.m85l-lt { fill: var(--signal); }
.t-label.m85l-lbt { fill: var(--signal-ink); font-weight: 700; }
.t-ac.m85l-tag { fill: var(--ink); }
.t-label.m85l-op { fill: var(--ink-soft); }
.t-label.m85l-unk { fill: var(--signal); }
.t-label.m85l-new { fill: var(--signal); }
.t-label.m85l-st { fill: var(--signal); }
.t-label.m85l-sb { fill: #7CC7FF; }
.t-ar.m85l-name { fill: var(--ink-soft); }
.fc-controls .fc-buttons.m85l-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m85l-btns button { padding: 7px 4px; font-size: 0.86rem; min-width: 0; }
.fc-controls .fc-buttons.m85l-pre button { flex: 1 1 22%; }
.fc-controls .fc-buttons.m85l-two button { flex: 1 1 45%; }
.m85l-pre button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m85l-pre bdi { font-family: var(--font-mono); }
.m85l-guess { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 8px; }
.m85l-gs { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 2px; background: var(--inset); font-size: 0.8rem; color: var(--ink-muted); }
.m85l-gs span { flex: 1 1 auto; min-width: 0; }
.m85l-gs button { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--raise); color: var(--ink); font: inherit; font-size: 1rem; cursor: pointer; }
.m85l-gs button:hover, .m85l-gs button:focus-visible { border-color: var(--signal); color: var(--signal); }
.m85l-gs b { min-width: 30px; text-align: center; font-family: var(--font-mono); font-size: 0.95rem; color: var(--signal); }
.m85l-lab .lx-table .m85l-w { grid-column: 1 / -1; }
@media (max-width: 400px) { .m85l-guess { grid-template-columns: 1fr; } }
/* 3-4-9 انحلال كاما: رسوم الدرس (f86_) ومختبر النواة (gamma-lab). البروتون أحمر عليه «+» والنيوترون رمادي (ألوان الفصل كله)،
   وأشعة كاما خط متموج برتقالي ذهبي كما في الشكل (16-b)، وسلّم طاقة النواة كسلّم الطاقة في الفصل الثامن */
.m86-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m86-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m86-pt { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m86-cone { fill: rgba(200, 210, 225, 0.16); stroke: rgba(200, 210, 225, 0.45); stroke-width: 1; }
.m86-gw { fill: none; stroke: #FFC857; stroke-width: 1.8; stroke-linejoin: round; }
.m86-gw2 { fill: none; stroke: #FFB347; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.m86-faint { opacity: 0.45; }
.t-label.m86-gt { fill: #FFC857; font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; }
.m86-glow { fill: rgba(255, 200, 87, 0.12); stroke: rgba(255, 200, 87, 0.55); stroke-width: 1.4; stroke-dasharray: 4 3; }
.m86-sep { stroke: var(--line); stroke-width: 1; }
.m86-rec { stroke: #7CC7FF; stroke-width: 3; }
.m86-garr { stroke: #FFB347; stroke-width: 2; }
.m86-rail { stroke: var(--ink-muted); stroke-width: 2.4; }
.m86-rung { stroke: var(--ink); stroke-width: 3; }
.m86-rung2 { stroke: var(--ink-muted); stroke-width: 1.4; stroke-dasharray: 3 3; }
.m86-axis { stroke: var(--ink-muted); stroke-width: 1.2; }
.m86-drop { stroke: var(--signal); stroke-width: 1.8; stroke-dasharray: 5 4; }
.m86-dot { fill: var(--signal); stroke: #FFF3CF; stroke-width: 1.2; }
.m86-eq { width: auto; margin: 0 auto; border-collapse: collapse; }
.m86-eq td { padding: 2px 6px; text-align: center; vertical-align: middle; border: 0; }
.m86-eq .m86-eql td { font-size: 0.78rem; line-height: 1.5; color: var(--ink-soft); vertical-align: top; direction: rtl; }
@media (max-width: 400px) { .m86-eq td { padding: 2px 3px; } .m86-eq .m86-eql td { font-size: 0.72rem; } }
/* المختبر */
.m86l-svg, .m86l-rsvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m86l-glow { fill: rgba(255, 200, 87, 0); stroke: rgba(255, 200, 87, 0); stroke-width: 1.4; stroke-dasharray: 4 3; transition: fill 0.3s, stroke 0.3s; }
.m86l-ng.ex .m86l-glow { fill: rgba(255, 200, 87, 0.12); stroke: rgba(255, 200, 87, 0.6); }
.m86l-jit.on { animation: m86l-shake 0.45s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes m86l-shake { 0% { transform: translate(0, 0); } 25% { transform: translate(1.4px, -1px); } 50% { transform: translate(-1.2px, 1.2px); } 75% { transform: translate(1px, 1.3px); } 100% { transform: translate(0, 0); } }
@media (prefers-reduced-motion: reduce) { .m86l-jit.on { animation: none; } }
.m86l-rec { stroke: #7CC7FF; stroke-width: 3; }
.m86l-ahp { fill: #7CC7FF; }
.m86l-wave { fill: none; stroke: #FFB347; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.t-ac.m86l-gt { fill: #FFC857; }
.m86l-rail { stroke: var(--ink-muted); stroke-width: 2.4; }
.m86l-rung { stroke: var(--ink); stroke-width: 3; }
.m86l-gap { stroke: var(--signal); stroke-width: 1.6; stroke-dasharray: 4 3; }
.t-ac.m86l-et { fill: var(--signal); }
.m86l-dot { fill: var(--signal); stroke: #FFF3CF; stroke-width: 1.2; }
.t-label.m86l-op { fill: var(--ink-soft); }
.t-label.m86l-ex, .t-ar.m86l-exw { fill: var(--signal); }
.t-ar.m86l-okw { fill: var(--ok); }
.t-label.m86l-st { fill: var(--signal); }
.t-label.m86l-sb { fill: #7CC7FF; }
.m86l-rbg { fill: rgba(255, 255, 255, 0.04); stroke: var(--line-strong); stroke-width: 1; }
.m86l-xb { fill: rgba(230, 236, 244, 0.28); }
.m86l-tk { stroke: var(--ink-muted); stroke-width: 1; }
.t-label.m86l-tkt { fill: var(--ink-muted); }
.m86l-mk { stroke: var(--signal); stroke-width: 2; }
.m86l-mkh { fill: var(--signal); }
.t-label.m86l-mkt { fill: var(--signal); }
.m86l-rul svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m86l-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m86l-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.fc-controls .fc-buttons.m86l-two button { flex: 1 1 45%; }
.fc-controls .fc-buttons.m86l-pre button { flex: 1 1 30%; }
.m86l-btns button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m86l-btns bdi { font-family: var(--font-mono); }
.m86l-lab .lx-table .m86l-w { grid-column: 1 / -1; }
@media (min-width: 1000px) {
    .m86l-lab .m86l-main > svg { max-height: calc(var(--lx-h) * 0.7); }
    .m86l-lab .lx-stage > .m86l-rul { margin-top: 4px; }
    .m86l-lab .m86l-rul svg { max-height: calc(var(--lx-h) * 0.3); }
}
@media (max-width: 999px) {
    .m86l-lab .lx-stage[data-v="more"] > .m86l-main { display: none; }
    .m86l-lab .lx-stage[data-v="more"] > .m86l-rul.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
}
/* 5-9 التفاعلات النووية: رسوم الدرس ومختبر «مسرّع القذائف» (reaction-lab). اصطلاح الفصل: البروتون أحمر عليه + والنيوترون رمادي؛
   والأعداد العلوية (الكتلية) صفراء والسفلية (الذرية) سماوية؛ وفي رسوم الأشعة: الفا وردية حمراء، وبيتا السالبة سماوية، وكاما صفراء */
.m87-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m87-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m87-pt { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m87-nl text { fill: var(--ink); font-family: 'Times New Roman', serif; }
.m87-nl.m87-hl .m87-A { fill: var(--signal); font-weight: 700; }
.m87-nl.m87-hl .m87-Z { fill: var(--neg); font-weight: 700; }
.m87-op { fill: var(--ink-soft); font-family: var(--font-mono); font-size: 20px; }
.m87-rarr { stroke: #FF6B5E; stroke-width: 4; stroke-linecap: round; }
.m87-rarh { fill: #FF6B5E; }
.m87-hit { fill: rgba(var(--signal-rgb), 0.22); stroke: var(--signal); stroke-width: 1.6; }
.m87-gs { fill: var(--signal); font-family: 'Times New Roman', serif; font-style: italic; font-size: 19px; }
.m87-gw { fill: none; stroke: var(--signal); stroke-width: 2.2; stroke-linecap: round; }
.m87-gh { fill: var(--signal); }
.m87-sum { font-family: var(--font-mono); font-size: 15px; font-weight: 600; }
.m87-sum.m87-a { fill: var(--signal); }
.m87-sum.m87-z { fill: var(--neg); }
.m87-ga { fill: rgba(var(--signal-rgb), 0.2); stroke: var(--signal); stroke-width: 1.4; }
.m87-gx { fill: rgba(133, 151, 173, 0.32); stroke: #C9D6E3; stroke-width: 1.2; }
.m87-let { fill: var(--ink); font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; font-size: 16px; }
.m87-sym { fill: var(--signal); font-family: 'Times New Roman', serif; font-style: italic; font-size: 15px; }
.m87-str { stroke: var(--ink-muted); stroke-width: 1; }
.m87-pan { fill: rgba(201, 214, 227, 0.18); stroke: #C9D6E3; stroke-width: 1.2; }
.m87-pl { fill: var(--ink); font-family: 'Times New Roman', serif; font-style: italic; font-size: 13px; }
.m87-stand { fill: #2A3F5C; stroke: var(--line-strong); stroke-width: 1; }
.m87-beam { stroke: #C9D6E3; stroke-width: 4; stroke-linecap: round; }
.m87-piv { fill: var(--signal); }
.m87-paper { fill: rgba(255, 255, 255, 0.06); stroke: #E6EEF6; stroke-width: 1; }
.m87-al { fill: #A9B6C4; stroke: #D9E2EC; stroke-width: 0.8; }
.m87-pb { fill: #4E5B6A; stroke: #8796A6; stroke-width: 0.8; }
.m87-ra { fill: none; stroke: #FF8A80; stroke-width: 2.4; }
.m87-rb { fill: none; stroke: #7CC7FF; stroke-width: 2.4; }
.m87-rg { fill: none; stroke: var(--signal); stroke-width: 2.4; }
.m87-faint { opacity: 0.4; stroke-dasharray: 5 4; }
.m87-adot { fill: #FF8A80; }
.m87-bdot { fill: #7CC7FF; }
.m87-gdot { fill: var(--signal); }
.t-label.m87-ta { fill: #FF8A80; font-family: 'Times New Roman', serif; font-style: italic; }
.t-label.m87-tb { fill: #7CC7FF; font-family: 'Times New Roman', serif; font-style: italic; }
.t-label.m87-tg { fill: var(--signal); font-family: 'Times New Roman', serif; font-style: italic; }
.m87-field { fill: rgba(124, 199, 255, 0.05); stroke: #7CC7FF; stroke-width: 1.2; stroke-dasharray: 5 4; }
.m87-x { fill: #7CC7FF; font-family: var(--font-mono); font-size: 14px; }
.m87-lead { fill: #1B232D; stroke: #8796A6; stroke-width: 1; }
.m87-src { fill: var(--signal); }
.m87-path { fill: none; stroke: var(--ink-muted); stroke-width: 1.3; stroke-dasharray: 4 4; }
.m87-rep { stroke: var(--pos); stroke-width: 2; fill: none; }

/* معادلة الكتاب بأسماء حدودها (داخل إطار عبارة الكتاب، وفي حل المثال (5)) */
.m87-eq { display: grid; align-items: start; gap: 4px 4px; margin: 6px 0 10px; padding: 10px 6px; border-radius: var(--radius);
    background: rgba(255, 170, 90, 0.12); text-align: center; }
.m87-eq7 { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); }
.m87-eqc { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.m87-eqs { font-size: 1.15rem; }
.m87-eqo { padding-top: 4px; font-size: 1.05rem; }
.m87-eql { direction: rtl; font-size: 0.76rem; line-height: 1.45; color: var(--ink-soft); overflow-wrap: normal; word-break: normal; }
/* الشاشة الضيقة: لا تُقطع كلمة في وسطها؛ تنتقل الحدود إلى سطر ثانٍ بعد السهم أو الإشارة عند الحاجة */
@media (max-width: 560px) {
    .m87-eq, .m87-eq7 { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 8px 6px; }
    .m87-eqc { flex: 0 1 auto; max-width: 7.6em; }
    .m87-eqo { flex: 0 0 auto; }
}
.nm-ex.m87-law { padding: 8px 4px; border-radius: var(--radius); background: rgba(190, 230, 120, 0.12); font-size: 0.94rem; }
/* الحساب العمودي باليد (الجمع والطرح) */
.m87-cols { display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: center; margin: 6px 0 10px; }
.m87-col { font-family: var(--font-mono); font-size: 0.96rem; line-height: 1.55; white-space: pre; direction: ltr; text-align: right; color: var(--ink); }
.m87-col span { display: block; }
.m87-col .m87-ln { border-top: 1px solid var(--ink-muted); }
.m87-col .m87-res { color: var(--signal); font-weight: 600; }
/* جدول الجسيمات الشائعة في المعادلات */
.data-table.m87-parts th, .data-table.m87-parts td { padding: 6px 4px; text-align: center; font-size: 0.86rem; }
/* المختبر: مسرّع القذائف (reaction-lab) */
.m87-svg, .m87-bsvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m87-tube { fill: #2A3F5C; stroke: var(--line-strong); stroke-width: 1; }
.fc-controls .fc-buttons.m87-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m87-btns button { padding: 6px 4px; font-size: 0.84rem; min-width: 0; line-height: 1.25; }
.fc-controls .fc-buttons.m87-rxs button { flex: 1 1 30%; }
.fc-controls .fc-buttons.m87-two button { flex: 1 1 45%; }
.fc-controls .fc-buttons.m87-one button { flex: 1 1 100%; }
.m87-rxs button small { display: block; font-size: 0.7rem; color: var(--ink-muted); }
.m87-rxs button.fc-primary small { color: inherit; }
.m87-lab .lx-table .m87-w { grid-column: 1 / -1; }
/* الحاسوب: المشهد فوق ميزان الكتل في عمود المشهد */
@media (min-width: 1000px) {
    .m87-lab .m87-main > svg { max-height: calc(var(--lx-h) * 0.62); }
    .m87-lab .m87-bal svg { max-height: calc(var(--lx-h) * 0.42); }
    .m87-lab .lx-stage > .m87-bal { margin-top: 4px; }
}
/* الهاتف: حين يختار الطالب «ميزان الكتل» يحل محل المشهد في الجزء المثبّت */
@media (max-width: 999px) {
    .m87-lab .lx-stage[data-v="more"] > .m87-main { display: none; }
    .m87-lab .lx-stage[data-v="more"] > .m87-bal.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
    .m87-lab .lx-stage > .m87-bal svg { max-height: var(--lx-h); }
}
.m87-lab .lx-table b.m87-nu { font-family: 'Times New Roman', serif; font-weight: 600; font-size: 1.12rem; direction: ltr; unicode-bidi: isolate; }

/* جدول الجسيمات: صف الكرات وحيلة الحفظ */
.data-table.m87-parts tr.m87-balls td { padding: 2px 4px 6px; }
.m87-bsv { display: block; margin: 0 auto; }
.m87-trick { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 10px 12px; margin: 10px 0 12px; background: rgba(255, 255, 255, 0.03); }
.m87-trick ul { margin: 0; padding-inline-start: 1.2em; }
.m87-trick li { margin-bottom: 4px; }
/* 6-9 الانشطار النووي: رسوم الدرس ومختبر الانشطار والتفاعل المتسلسل (fission-chain-lab) — البروتون أحمر عليه +، والنيوترون رمادي مزرق
   (كما في m82-p وm82-n)، والطاقة المتحررة وميض أصفر، وقضبان السيطرة زرقاء، والكرافيت داكن */
.m88-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.8; }
.m88-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.8; }
.m88-pt { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m88-arr { stroke: var(--ink-muted); stroke-width: 1.3; fill: none; }
.m88-esc { stroke: var(--ink-muted); stroke-width: 1.3; stroke-dasharray: 5 4; fill: none; }
.m88-arrn { stroke: var(--pos); stroke-width: 1.8; fill: none; }
.m88-step { fill: #4EA3E0; }
.m88-flash { fill: #FFE27A; stroke: #FFB648; stroke-width: 1.2; stroke-linejoin: round; }
.m88-burst { fill: rgba(255, 226, 122, 0.28); stroke: rgba(255, 182, 72, 0.6); stroke-width: 0.8; }
.m88-glow { fill: rgba(255, 226, 122, 0.35); }
.m88-fragdot { fill: #C77E78; stroke: #FFC4BC; stroke-width: 0.8; }
.m88-rod { fill: #4E86C2; stroke: #9CC5EE; stroke-width: 1; }
.m88-dot { fill: var(--signal); }
/* الشكل (23) */
.m88-night { fill: #05070B; }
.m88-hz { fill: #E8761E; }
.m88-fire1 { fill: #C8321E; }
.m88-fire2 { fill: #F08A24; }
.m88-fire3 { fill: #FFE45C; }
/* الشكل (24) */
.m88-brickrow { fill: #1E2228; stroke: #59616C; stroke-width: 1; }
.m88-joint { stroke: #59616C; stroke-width: 1; }
.m88-fsq { fill: #EDEFF2; }
.m88-fdot { fill: #E2483B; }
/* الشكل (25-a) و(25-b) */
.m88-ground { stroke: var(--ink-muted); stroke-width: 1.4; }
.m88-tower { fill: #9AAABD; stroke: #C9D4E0; stroke-width: 1; }
.m88-cloud { fill: rgba(235, 242, 250, 0.55); }
.m88-steam { fill: rgba(235, 242, 250, 0.6); }
.m88-elw { fill: none; stroke: var(--signal); stroke-width: 1.4; stroke-dasharray: 3 3; opacity: 0.8; }
.m88-dome { fill: rgba(150, 190, 235, 0.06); stroke: var(--ink-soft); stroke-width: 1.4; }
.m88-pipe { fill: none; stroke: #6E8BA8; stroke-width: 4; stroke-linejoin: round; }
.m88-hotp { stroke: #B5655A; }
.m88-cw { fill: none; stroke: #4E86C2; stroke-width: 3; }
.m88-vessel { fill: #2E4F70; stroke: #9CC5EE; stroke-width: 1.2; }
.m88-fuel { fill: #0B0D10; stroke: #8597AD; stroke-width: 0.6; }
.m88-crod { stroke: #CFE3F7; stroke-width: 2; }
.m88-sg { fill: #35607F; stroke: #9CC5EE; stroke-width: 1.2; }
.m88-utube { fill: none; stroke: #CFE3F7; stroke-width: 1.4; }
.m88-pump { fill: #E0B040; stroke: #FFE27A; stroke-width: 1; }
.m88-turb { fill: #C9B26A; stroke: #FFE27A; stroke-width: 1; }
.m88-spoke { stroke: #5A4A18; stroke-width: 1.6; }
.m88-shaft { stroke: var(--ink-soft); stroke-width: 3; }
.m88-gen { fill: #8F9BA8; stroke: #D6E0EB; stroke-width: 1; }
.m88-pylon { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
.m88-bld { fill: #4FA37A; stroke: #9BE0BC; stroke-width: 0.8; }
.m88-cond { fill: #35607F; stroke: #9CC5EE; stroke-width: 1.2; }
/* المختبر */
.m88-svg, .m88-csvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m88-u { fill: #B8645B; stroke: #F2A79F; stroke-width: 1; }
.m88-uin { fill: #8597AD; opacity: 0.85; }
.m88-gone { fill: none; stroke: rgba(242, 104, 90, 0.25); stroke-width: 1; stroke-dasharray: 2 3; }
.m88-pos { fill: #FF9A8E; stroke: #FFE0DB; stroke-width: 0.8; }
.m88-ring { fill: none; stroke: #FFE27A; stroke-width: 2; }
.m88-boom { fill: rgba(255, 214, 110, 0.0); pointer-events: none; }
.m88-rep { stroke: var(--pos); stroke-width: 1.8; fill: none; }
.m88-bar { fill: var(--signal); }
.m88-bar2 { fill: #6FB8F0; }
.m88-bar3 { fill: #F2685A; }
.m88-ax { stroke: var(--ink-muted); stroke-width: 1.2; }
.m88-strip { fill: rgba(255, 255, 255, 0.025); stroke: var(--line); stroke-width: 1; }
.m88-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m88-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m88-btns button { padding: 6px 4px; font-size: 0.84rem; min-width: 0; line-height: 1.25; flex: 1 1 30%; }
.fc-controls .fc-buttons.m88-two button { flex: 1 1 45%; }
.fc-controls .fc-buttons.m88-four button { flex: 1 1 20%; }
.m88-btns button small { display: block; font-size: 0.7rem; color: var(--ink-muted); direction: ltr; }
.m88-btns button.fc-primary small { color: inherit; }
.m88-lab .lx-table .m88-w { grid-column: 1 / -1; }
@media (min-width: 1000px) {
    .m88-lab .m88-main > svg { max-height: calc(var(--lx-h) * 0.66); }
    .m88-lab .m88-chart svg { max-height: calc(var(--lx-h) * 0.4); }
    .m88-lab .lx-stage > .m88-chart { margin-top: 4px; }
}
@media (max-width: 999px) {
    .m88-lab .lx-stage[data-v="more"] > .m88-main { display: none; }
    .m88-lab .lx-stage[data-v="more"] > .m88-chart.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
    .m88-lab .lx-stage > .m88-chart svg { max-height: var(--lx-h); }
}
.t-label.m88-blab { fill: #0B1420; font-weight: 700; }
/* 7-9 الاندماج النووي: رسوم الدرس ومختبر الاندماج (fusion-lab) — البروتون أحمر عليه +، والنيوترون رمادي مزرق، والبوزترون بنفسجي،
   والنيوترينو برتقالي، وأشعة كاما صفراء؛ والتنافر الكهربائي وردي، والطاقة المتحررة موجة صفراء فاتحة، ولحظة الاندماج نجمة صفراء */
.m89-p { fill: #F2685A; stroke: #FFC4BC; stroke-width: 0.9; }
.m89-n { fill: #8597AD; stroke: #D6E0EB; stroke-width: 0.9; }
.m89-pt { fill: #3A0C08; font-family: var(--font-mono); font-weight: 700; pointer-events: none; }
.m89-ep { fill: #C58CFF; stroke: #E9D6FF; stroke-width: 1; }
.t-label.m89-gt { fill: #FFC857; font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; }
.t-label.m89-nut { fill: #FFB347; font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; }
.m89-en { fill: none; stroke: #FFF0B8; stroke-width: 2; stroke-linecap: round; }
.m89-enh { fill: #FFF0B8; }
.m89-star { fill: #FFE35A; stroke: #FFB800; stroke-width: 1; stroke-linejoin: round; }
.m89-star-s { stroke-width: 0.6; }
.m89-rep { stroke: var(--pos); stroke-width: 2.2; fill: none; }
/* الميزان */
.m89-str { stroke: var(--ink-muted); stroke-width: 1; }
.m89-pan { fill: #6E7C8E; stroke: var(--ink-soft); stroke-width: 1; }
.m89-beam { stroke: var(--ink-soft); stroke-width: 4; stroke-linecap: round; }
.m89-stand { fill: #8C6A4A; stroke: #C9A27A; stroke-width: 1.2; stroke-linejoin: round; }
.m89-pivot { fill: #C9A27A; stroke: var(--screen); stroke-width: 1.5; }
/* الشمس */
.m89-ray { stroke: #FFD36B; stroke-width: 2; stroke-linecap: round; opacity: 0.8; }
.m89-core { fill: #FFF6CF; opacity: 0.85; stroke: #FFE08A; stroke-width: 1.4; stroke-dasharray: 3 3; }
.m89-inset { fill: rgba(var(--signal-rgb), 0.05); stroke: rgba(var(--signal-rgb), 0.45); stroke-width: 1; }
.m89-conn { fill: none; stroke: rgba(var(--signal-rgb), 0.5); stroke-width: 1; stroke-dasharray: 3 3; }
/* القنبلة */
.m89-sky { fill: rgba(3, 14, 28, 0.55); }
.m89-ground { stroke: #8C6A4A; stroke-width: 2; }
/* حالات المادة */
.m89-box { fill: rgba(255, 255, 255, 0.03); stroke: var(--line-strong); stroke-width: 1; }
.m89-atom { fill: rgba(124, 199, 255, 0.18); stroke: #7CC7FF; stroke-width: 1; }
.m89-atn { fill: #F2685A; }
.m89-el { fill: #7CC7FF; }
/* التوكاماك */
.m89-tk { fill: rgba(40, 56, 78, 0.82); stroke: #5A6E88; stroke-width: 1.2; fill-rule: evenodd; }
.m89-pl { fill: none; stroke: #FF7A3D; stroke-width: 16; opacity: 0.45; }
.m89-pl2 { fill: none; stroke: #FFD08A; stroke-width: 4; opacity: 0.9; }
.m89-hel { fill: none; stroke: #FF5A4A; stroke-width: 1.1; opacity: 0.9; }
.m89-coil { fill: none; stroke: #4FA3FF; stroke-width: 3.2; }
/* مخطط المفاعل الاندماجي */
.m89-blk { fill: rgba(46, 160, 160, 0.2); stroke: #3FBFBF; stroke-width: 1.2; }
.m89-dome { fill: rgba(255, 140, 80, 0.12); stroke: #FF9A5A; stroke-width: 1.6; }
.m89-li { fill: none; stroke: #E0546A; stroke-width: 1.4; stroke-dasharray: 5 3; }
.m89-pipe { fill: none; stroke: #E0546A; stroke-width: 2.4; }
.m89-pipe2 { fill: none; stroke: var(--ink-muted); stroke-width: 1.6; }
.m89-big { stroke: #E0546A; stroke-width: 5; }
.m89-bigh { fill: #E0546A; }
.t-ar.m89-red { fill: #FF8A8A; }
/* دورة الكاربون */
.m89-cyc { fill: none; stroke: var(--ink-muted); stroke-width: 1.3; }
.m89-cin { stroke: var(--ink-muted); stroke-width: 1; }
.m89-trace { fill: var(--signal); opacity: 0.85; }

/* المختبر */
.m89l-svg, .m89l-rsvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m89l-band { fill: #FF7A3D; }
.m89l-hole { fill: var(--screen); }
.m89l-wall { fill: none; stroke-width: 8; }
.m89l-fl { fill: none; stroke: rgba(124, 199, 255, 0.4); stroke-width: 1; stroke-dasharray: 4 5; }
.m89l-mag line { stroke: #4FA3FF; stroke-width: 5; stroke-linecap: round; }
.m89l-rep { stroke: var(--pos); stroke-width: 2.2; fill: none; }
.m89l-spark { fill: #FFE7A0; }
.m89l-flash { fill: rgba(255, 227, 90, 0.18); }
.m89l-plab { font-family: var(--font-mono); font-weight: 700; fill: var(--signal); paint-order: stroke; stroke: var(--screen); stroke-width: 3px; }
.m89l-hl { fill: rgba(var(--signal-rgb), 0.14); }
.m89l-more svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m89l-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m89l-btns button { flex: 1 1 22%; padding: 6px 4px; font-size: 0.84rem; min-width: 0; line-height: 1.25; }
.m89l-lab .lx-table .m89l-w { grid-column: 1 / -1; }
/* الحاسوب: الحاوية فوق لوحة التفاعل في عمود المشهد */
@media (min-width: 1000px) {
    .m89l-lab .m89l-main > svg { max-height: calc(var(--lx-h) * 0.68); }
    .m89l-lab .lx-stage > .m89l-more { margin-top: 4px; }
    .m89l-lab .m89l-more svg { max-height: calc(var(--lx-h) * 0.3); }
}
/* الهاتف: حين يختار الطالب «التفاعل» تحل لوحته محل الحاوية في الجزء المثبّت */
@media (max-width: 999px) {
    .m89l-lab .lx-stage[data-v="more"] > .m89l-main { display: none; }
    .m89l-lab .lx-stage[data-v="more"] > .m89l-more.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
    .m89l-lab .lx-stage > .m89l-more svg { max-height: var(--lx-h); }
}
/* dive lesson css: chapter 6 */
/* ---------- درس 1-6: «خريطة العوالم» (worlds-lab) ورسوم الدرس ---------- */
.m50-map { display: block; direction: ltr; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.m50-map .m50-probe { cursor: grab; touch-action: none; outline: none; }
.m50-map .m50-probe:focus-visible circle:nth-child(2) { stroke: var(--ink); }
.m50-map .m50-dot { cursor: pointer; }
.m50-fade { transition: opacity 0.45s; }
.m50-status b { color: var(--ink); }
.m50-lw { font-style: normal; }
.m50-table.sim-table b { font-size: 0.98rem; overflow-wrap: anywhere; }
.m50-win { display: block; width: 100%; height: auto; margin: 0 auto; direction: ltr; }
.m50-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 4px; }
.m50-chips button { padding: 6px 4px; font: inherit; font-size: 0.82rem; line-height: 1.35; border-radius: var(--radius); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; transition: background-color 0.15s; min-width: 0; }
.m50-chips button:hover { background: var(--hover); }
.m50-chips button.fc-primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 700; }
.m50-ctl .fc-buttons button { padding: 8px 6px; }
/* رسوم الدرس وجداوله */
.m50-tpk { fill: #FF9EC8; }
.m50-quad th, .m50-quad td { text-align: center; vertical-align: middle; }
.m50-quad td small { display: block; color: var(--ink-muted); font-size: 0.8rem; margin-top: 2px; }
.m50-quad .m50-c1 { color: #5FD39A; font-weight: 700; }
.m50-quad .m50-c2 { color: #7CC7FF; font-weight: 700; }
.m50-quad .m50-c3 { color: #FF8FC0; font-weight: 700; }
.m50-quad .m50-c4 { color: #C3A6FF; font-weight: 700; }
/* الحاسوب: الخريطة فوق «النافذة» في عمود المشهد؛ نحدّ عرض كل منهما (فيتبعه ارتفاعه) ليبقى العمود كله مع القراءات وسطر الحالة ضمن الشاشة،
   ويصغران قليلاً حين يضيق العمود (1024px) لأن سطر الحالة يطول فيه */
@media (min-width: 1000px) {
    .m50-main, .m50-wbox { container-type: inline-size; }
    .m50-lx .lx-2d > svg.m50-map { max-height: none; max-width: calc(min(var(--lx-h) * 0.84, 58cqw) * 340 / 308); }
    .m50-lx .lx-stage > .lx-more svg.m50-win { max-height: none; max-width: calc(min(var(--lx-h) * 0.31, 22cqw) * 340 / 124); }
}
/* الهاتف: الحجم والسرعة في سطر، وكل من الساعة والفيزياء المطلوبة في سطر كامل (lx-wide) */
@media (max-width: 640px) {
    /* ثلاثة أسطر من القراءات ومبدّل العرض: نقصّر الخريطة قليلاً ليبقى الجزء المثبّت دون نصف الشاشة تقريباً */
    .lx.m50-lx { --lx-h: clamp(165px, 31vh, 262px); }
    .m50-lw { display: none; }   /* «السرعة» تُختصر إلى v حتى تتسع القيمة الطويلة (0.999999991c) في نصف سطر */
    .m50-chips { gap: 4px; }
    .m50-chips button { font-size: 0.76rem; padding: 5px 2px; }
}
/* الهاتف و«الحركة والساعتان» ظاهرة: طبقة النافذة تبدأ عند 40px (ثابت مشترك) بينما تبدأ الخريطة تحت شريط المبدّل عند 45px تقريباً،
   فنزيد ارتفاع الطبقة قليلاً حتى لا يطل أسفل الخريطة من تحتها */
@media (max-width: 999px) { .m50-lx .lx-stage[data-v="more"] > .lx-more.lx-alt { height: calc(var(--lx-h) + 5px); } }
/* القراءات السريعة (مؤقتاً حتى يُصلح في style.css): القيمة LTR فـ margin-inline-start يقع على يسارها، أما الفراغ المطلوب فبينها وبين الاسم على يمينها */
@media (min-width: 641px) { .lx-hud.m50-hud b { margin-left: 0; margin-right: 6px; } }
/* ---------- 2-6 مختبر الجسم الأسود (blackbody-lab) ---------- */
.m51-chart { background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px 4px; }
.m51-chart svg { display: block; width: 100%; height: auto; direction: ltr; }
.m51-hide { display: none !important; }
.m51-presets { flex-wrap: wrap; gap: 6px; margin: 2px 0 12px; }
.m51-presets button { flex: 1 1 30%; min-width: 0; padding: 7px 4px; font-size: 0.85rem; line-height: 1.35; }
.m51-presets.m51-four button { flex-basis: 45%; }
.m51-presets small { display: block; font-family: var(--font-mono); font-weight: 400; font-size: 0.72rem; opacity: 0.8; direction: ltr; }
.fc-controls .m51-view { margin: 0 0 10px; }
.m51-view button { padding: 8px 6px; font-size: 0.9rem; }
.m51-lab { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }
.m51-sw { display: inline-block; width: 0.95em; height: 0.95em; border-radius: 2px; border: 1px solid var(--line-strong); vertical-align: -0.12em; margin-inline-end: 6px; }
.m51-g-spec, .m51-g-lad { margin-bottom: 4px; }
.m51-t-spec bdi, .m51-t-lad bdi { white-space: nowrap; }
/* على الحاسوب العريض: الجسم والمنحني جنباً إلى جنب في عمود المشهد (المنحني بمقياسه الطبيعي تقريباً فتُقرأ كتاباته)، والقراءات السريعة تحتهما؛
   وعلى الحاسوب الأضيق يبقى التخطيط الموحد (المنحني تحت الجسم) لأن نصف العمود يضيق عنهما */
@media (min-width: 1240px) {
    .lx-stage.m51-duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 8px; align-items: center; }
    .lx-stage.m51-duo > .lx-hud { grid-column: 1 / -1; }
    .lx-stage.m51-duo > .lx-more { margin-top: 0; }
    .lx .lx-stage.m51-duo .s3-wrap { height: calc(var(--lx-h) * 0.66); }
    .lx-stage.m51-duo > .lx-more svg { max-height: calc(var(--lx-h) * 0.66 - 12px); }
}
/* الحاسوب الأضيق (المنحني تحت الجسم): نصغّرهما قليلاً حتى يتسع عمود المشهد للقراءات وسطر الحالة دون تمرير داخلي */
@media (min-width: 1000px) and (max-width: 1239px) {
    .lx .lx-stage.m51-duo .s3-wrap { height: calc(var(--lx-h) * 0.56); }
    .lx-stage.m51-duo > .lx-more svg { max-height: calc(var(--lx-h) * 0.48); }
}
/* الهاتف: درجة الحرارة ظاهرة أصلاً في لافتة المشهد وعلى المنحني وبجانب الشريط، فنخفي رقاقتها ونعطي الشدة (أطول قيمة) سطراً كاملاً */
@media (max-width: 640px) {
    .lx-hud > .m51-hT { display: none; }
    .lx-hud > .m51-hI { grid-column: 1 / -1; }
}
/* 3-6 الظاهرة الكهروضوئية: رسوم الدرس ومختبر الخلية الكهروضوئية (photo-lab) */
.m52-metal { fill: rgba(170, 186, 206, 0.22); stroke: var(--ink-soft); stroke-width: 1.5; }
.m52-metal.dark { fill: rgba(8, 18, 32, 0.9); stroke: var(--ink-muted); }
.m52-glass { fill: rgba(124, 199, 255, 0.07); stroke: var(--ink-soft); stroke-width: 1.4; }
.m52-ring-c { fill: none; stroke: var(--ink-soft); stroke-width: 3; }
.m52-anode { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.m52-cath { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.m52-pin { stroke: var(--ink-soft); stroke-width: 3; fill: none; stroke-linecap: round; }
.m52-el { fill: var(--screen); stroke: var(--neg); stroke-width: 1.5; }
.m52-ev { stroke: var(--neg); stroke-width: 2; fill: none; }
.m52-ph { fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-linejoin: round; }
.m52-photon { stroke: var(--signal); stroke-width: 5; stroke-linecap: round; }
.m52-meter { fill: var(--signal); stroke: var(--ink); stroke-width: 1.2; }
.m52-hi { fill: none; stroke: var(--signal); stroke-width: 2.6; }
.m52-lo { fill: none; stroke: var(--neg); stroke-width: 2.4; }
.m52-line { stroke: var(--pos); stroke-width: 2.6; fill: none; }
.m52-line.dash { stroke-width: 2; stroke-dasharray: 3 4; }
.m52-bell { fill: rgba(var(--signal-rgb), 0.22); stroke: var(--signal); stroke-width: 1.8; }
.m52-bell-rim { fill: var(--signal); stroke: var(--signal); stroke-width: 2.4; }
.m52-pp { fill: #F4F7FB; stroke: var(--ink-muted); stroke-width: 1; }
.m52-steel { fill: #9AA7B6; stroke: var(--ink); stroke-width: 1.5; }
.m52-ring { fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-linecap: round; }
.m52-sun { fill: var(--signal); }
.m52-sunray { stroke: var(--signal); stroke-width: 2; stroke-linecap: round; }
.m52-panel { fill: #1D3E73; stroke: var(--ink-soft); stroke-width: 1.5; }
.m52-grid { stroke: rgba(214, 228, 243, 0.45); stroke-width: 1; }
.m52-lamp { fill: var(--ink-soft); }
.m52-glow { fill: rgba(var(--signal-rgb), 0.22); }
.m52-lens { fill: rgba(124, 199, 255, 0.12); stroke: var(--ink-soft); stroke-width: 1.5; }
.m52-px { fill: var(--signal); }

/* «تذكر» من الكتاب: ثلاث حالات */
.m52-rem { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--raise); }
.m52-rem-row { display: grid; grid-template-columns: 70px 18px minmax(0, 1fr); align-items: center; gap: 6px; margin-top: 8px; }
.m52-rem-c { border: 1px solid var(--neg); border-radius: 2px; padding: 3px 4px; text-align: center; background: var(--inset); }
.m52-rem-a { color: var(--ink-muted); text-align: center; }
.m52-rem-r { border: 1px solid rgba(var(--signal-rgb), 0.5); border-radius: 2px; padding: 4px 8px; background: var(--signal-soft); line-height: 1.7; }
.m52-rem-n { margin: 10px 0 0; font-size: 0.9rem; color: var(--ink-soft); }

/* الجدول (1-6) */
.m52-tab { margin: 10px 0 12px; }
.m52-tab-cap { margin: 0 0 6px; font-weight: 700; color: var(--ink-soft); text-align: center; }
.m52-tab .data-table td, .m52-tab .data-table th { text-align: center; padding: 5px 4px; }
.m52-tab .data-table td:first-child { text-align: right; }
.m52-tab.ext .data-table { font-size: 0.92rem; }
.m52-tab tr.m52-hl td { background: var(--signal-soft); }
.m52-tab td.m52-uv, .m52-tab-note .m52-uv { color: #C7A6FF; font-weight: 700; }
.m52-tab td.m52-vis, .m52-tab-note .m52-vis { color: var(--ok); font-weight: 700; }
.m52-tab-note { margin: 6px 0 0; font-size: 0.88rem; color: var(--ink-muted); line-height: 1.7; }

/* المختبر */
.m52-metals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 0 0 4px; }
.m52-metals button { padding: 5px 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; font-size: 0.78rem; line-height: 1.35; cursor: pointer; min-width: 0; }
.m52-metals button b { display: block; font-weight: 700; white-space: nowrap; }
.m52-metals button small { display: block; font-family: var(--font-mono); color: var(--ink-muted); direction: ltr; font-size: 0.72rem; }
.m52-metals button:hover { background: var(--hover); }
.m52-metals button.on { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.m52-metals button.on small { color: var(--signal-ink); }
.m52-col { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 0.85rem; color: var(--ink-soft); }
.m52-sw { width: 26px; height: 12px; border-radius: 2px; border: 1px solid var(--line-strong); flex: none; }
.m52-sub { margin: 2px 0 0; font-size: 0.8rem; color: var(--ink-muted); }
.fc-controls .fc-buttons.m52-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.fc-controls .fc-buttons.m52-btns button { padding: 7px 4px; font-size: 0.82rem; min-width: 0; }
.m52-chart svg { display: block; width: 100%; max-width: 470px; margin: 0 auto; height: auto; direction: ltr; }
.m52-chart-cap .lx-x { vertical-align: middle; }
.m52-chart[hidden] { display: none; }
.m52-gal { display: block; height: 8px; margin-top: 5px; border-radius: 2px; background: var(--inset); border: 1px solid var(--line); overflow: hidden; }
.m52-gal i { display: block; height: 100%; width: 0; background: var(--signal); transition: width 0.25s; }
.sim-table b.m52-off { color: var(--ink-muted); font-family: var(--font-body); direction: rtl; font-size: 0.95rem; }
.m52-cur { stroke: var(--signal); stroke-width: 2.6; fill: none; }
.m52-half { stroke: var(--neg); stroke-width: 2; fill: none; stroke-dasharray: 5 4; }
.m52-dot { fill: var(--signal); stroke: var(--screen); stroke-width: 1.5; }
.m52-dot.off { fill: var(--screen); stroke: var(--signal); stroke-width: 2; }
.m52-trail { fill: var(--pos); opacity: 0.8; }
.m52-oth { stroke: var(--ink-muted); stroke-width: 1; opacity: 0.55; fill: none; }
.m52-axis { stroke: var(--ink-soft); stroke-width: 1.4; fill: none; }
.m52-gridl { stroke: var(--line); stroke-width: 1; }
@media (max-width: 640px) {
    .m52-metals { gap: 4px; }
    .m52-metals button { font-size: 0.7rem; padding: 5px 0; }
    .m52-rem-row { grid-template-columns: 62px 14px minmax(0, 1fr); }
}
.sim-table .m52-gcell { grid-column: 1 / -1; }
.m52-chart-cap { margin: 0 0 4px; font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); line-height: 1.6; text-align: center; }
/* القاعدة 11: جدول تقابل الرموز، و«ثلاث معلومات نقرؤها من الخط» */
.m52-map { margin: 4px 0 14px; }
.m52-map .data-table td, .m52-map .data-table th { text-align: center; padding: 6px 8px; }
.m52-map .data-table td:last-child { text-align: right; }
.m52-read3 { margin: 0 22px 12px 0; padding: 0; color: var(--ink-soft); line-height: 1.95; }
.m52-read3 > li { margin-bottom: 10px; padding-right: 4px; }
.m52-read3 > li::marker { color: var(--signal); font-weight: 700; }
.m52-read3 .formula-box { margin: 8px auto; }
/* ⁦4-6⁩ الجسيمات (الدقائق) والموجات: رسوم الدرس ومختبر duality-lab */
.m53-cyl { fill: rgba(var(--signal-rgb), 0.16); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.m53-cyl-top { fill: rgba(var(--signal-rgb), 0.34); stroke: var(--ink); stroke-width: 1.5; }
.m53-wall { fill: rgba(234, 241, 248, 0.07); stroke: var(--ink-soft); stroke-width: 1.2; }
.m53-shadow { fill: rgba(3, 14, 28, 0.9); stroke: var(--ink-muted); stroke-width: 1; }
/* بلا WebGL: لوح الشاشة نفسه رسماً مسطحاً مكان المشهد */
.m53-scene:has(> canvas.m53-flat) > .s3-fail { min-height: 0; padding: 6px 10px; font-size: 0.78rem; }   /* رسالة مختصرة فوق اللوح المسطح */
.m53-scene > canvas.m53-flat { display: block; width: 100%; height: auto; max-height: var(--lx-h); object-fit: contain; margin: 8px auto 0; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.m53-rtl { direction: rtl; text-align: right; font-family: var(--font-body); }
.lx-sl > .sp-value.m53-rtl { text-align: left; }
.m53-count { margin: 8px 0 0; font-size: 0.88rem; font-weight: 700; color: var(--signal); }
.fc-controls .fc-buttons.m53-btns { flex-wrap: wrap; gap: 6px; margin: 0; }
.fc-controls .fc-buttons.m53-btns button { flex: 1 1 auto; padding: 8px 10px; font-size: 0.86rem; white-space: nowrap; }
.m53-rh { margin: 0 0 -6px; font-size: 0.9rem; color: var(--ink-soft); font-weight: 700; }
.m53-table b { font-size: 0.95rem; overflow-wrap: anywhere; }
.m53-table b small { font-size: 0.8em; color: var(--ink-soft); }
.m53-swatch { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 50%; vertical-align: -0.1em; margin-inline-start: 6px; border: 1px solid var(--line-strong); }
.m53-table .m53-f { display: block; direction: ltr; text-align: right; white-space: nowrap; font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft); margin-top: 2px; }
/* الحاسوب: الجهاز عريض، فلا نجعل المشهد أقرب إلى المربع حين يضيق عموده (1024px): ارتفاعه لا يزيد على 72% من عرضه */
@media (min-width: 1000px) { .m53-scene { container-type: inline-size; } .lx .m53-scene .s3-wrap { height: min(var(--lx-h), 72cqw); } }
/* القراءات السريعة (مؤقتاً حتى يُصلح في style.css): القيمة LTR فـ margin-inline-start يقع على يسارها، أما الفراغ المطلوب فبينها وبين الاسم على يمينها */
@media (min-width: 641px) { .lx-hud.m53-hud b { margin-left: 0; margin-right: 6px; } }
/* 5-6 الموجات المادية: مختبر دي برولي (debroglie-lab) */
.m54-pick { flex-wrap: wrap; }
.m54-pick button { flex: 1 1 28%; min-width: 0; padding: 8px 4px; }
.fc-controls .m54-pick + .m54-sub { margin-top: 8px; }
.m54-sub { margin: 4px 0 12px; font-size: 0.85rem; color: var(--ink-muted); }
.m54-sub bdi { font-family: var(--font-mono); color: var(--ink); }
.lx-sl > .m54-sub { margin: 4px 0 0; }
.m54-ml { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }
.fc-controls .m54-mode { margin: 6px 0 12px; }
.m54-modebox[hidden], .m54-pre[hidden], .m54-sub[hidden] { display: none; }
.m54-mode button, .m54-pre button { padding: 8px 4px; }
.fc-controls .m54-pre { margin-top: 6px; }
/* سلّم الأطوال: بعد أدوات التحكم مباشرة، فيُرى مع شريط الانطلاق (والمشهد وقراءاته مثبّتة) */
.m54-scale { padding: 10px 12px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(0, 0, 0, 0.18); }
.m54-cap { margin: 0 0 4px; font-size: 0.85rem; color: var(--ink-soft); line-height: 1.7; }
.m54-bar { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; direction: ltr; overflow: visible; }
.m54-lab sup, .m54-tour sup { font-size: 0.68em; line-height: 0; vertical-align: 0.55em; }
@media (max-width: 999px) { .m54-scale { order: 4; } }
/* الهاتف: طول الموجة والزخم قيمتان طويلتان (بالصيغة العلمية) فلكل منهما سطر */
@media (max-width: 640px) { .lx-hud > .m54-hw { grid-column: 1 / -1; } }
@media (max-width: 380px) { .m54-lw { display: none; } }   /* «λ ÷ ذرة» على أضيق الهواتف */
/* ⁦6-6⁩ مختبر «ألف صورة لإلكترون ذرة الهيدروجين» (cloud-lab) في التخطيط الموحد .lx:
   مخطط الأبعاد رسم ثانٍ ظاهر دائماً (.lx-alt)، واللوحة الثانية (الرزمة الموجية) تأخذ مكانه عند الطلب */
.m55-lx .fc-buttons { flex-wrap: wrap; gap: 8px; }
.m55-lx .fc-buttons + .fc-buttons { margin-top: 8px; }
.m55-lx .fc-buttons + .lx-sl, .m55-lx .lx-sl + .fc-buttons { margin-top: 10px; }
.m55-lx .fc-buttons button { flex: 1 1 0; min-width: 0; padding: 7px 4px; font-size: 0.88rem; line-height: 1.45; }
.m55-lx .fc-buttons button:disabled { opacity: 0.45; cursor: default; }
@media (max-width: 400px) { .m55-lx .fc-buttons button { padding: 7px 2px; font-size: 0.8rem; } }
.m55-lx .m55-go { border-color: var(--signal); color: var(--signal); }
.m55-lx .fc-check { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--ink-soft); font-size: 0.88rem; cursor: pointer; }
.m55-lx .lx-hud[hidden] { display: none; }
.m55-lx .lx-hud b { margin: 0 6px 0 0; }   /* القيمة اتجاهها ltr: «margin-inline-start» المشتركة تقع على جهتها اليسرى، فتلتصق القيمة بالاسم */
.m55-sub { margin: 2px 0 0; font-size: 0.8rem; color: var(--ink-muted); }
.m55-hist, .m55-psi { display: block; width: 100%; height: auto; direction: ltr; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line); border-radius: var(--radius); }
.m55-cap { margin: 0 0 4px; font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); line-height: 1.6; text-align: center; }
.m55-cap .lx-x { vertical-align: middle; }
.m55-flow { margin: 0 0 16px; padding-inline-start: 22px; line-height: 2; }
@media (max-width: 999px) {
    /* لا مرساة تمرير داخل المختبر: الحالة قبل الجولة في ترتيب الصفحة وبعدها على الشاشة، والمشهد المثبّت قد يطول؛ فلو ثبّت المتصفح عنصراً
       تحتهما لقفزت الصفحة عند كل خطوة من الجولة وانزلق زر «التالي» تحت المشهد */
    .m55-lx { overflow-anchor: none; }
    .m55-lx .lx-stage > .lx-more .m55-hist, .m55-lx .lx-stage > .lx-more .m55-psi { border: 0; background: none; }
    /* اللوحة الثانية تغطي المبدّل والمشهد معاً (المبدّل يعيد الذرة أو المخطط) */
    .m55-lx .lx-stage > .m55-psiv:not([hidden]) { height: calc(var(--lx-h) + 34px); }
    .m55-lx .lx-stage > .m55-psiv svg { max-height: calc(var(--lx-h) - 8px); }
}
@media (min-width: 1000px) {
    /* اللوحة الثانية أطول من مخطط الأبعاد: يصغر المشهد قليلاً ما دامت ظاهرة، فيبقى عمود المشهد كله في الشاشة */
    .m55-lx .lx-stage:has(> .m55-psiv:not([hidden])) .s3-wrap { height: calc(var(--lx-h) * 0.52); }
    .m55-lx .lx-stage > .m55-histv svg { max-height: calc(var(--lx-h) * 0.42); }
}
/* ---------- درس 7-6: مختبر الخيال «مجهر هايزنبرك» في التخطيط الموحد .lx، واللوحة الثانية (الرزمة الموجية) رسم يظهر عند الطلب ---------- */
.m56-lx .lx-hud[hidden] { display: none; }
.m56-lx .lx-hud b { margin: 0 6px 0 0; }   /* القيمة اتجاهها ltr: «margin-inline-start» المشتركة تقع على جهتها اليسرى، فتلتصق القيمة بالاسم */
.m56-lx .fc-buttons.m56-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.m56-lx .fc-buttons.m56-btns button { flex: 1 1 0; min-width: 0; padding: 7px 4px; font-size: 0.86rem; line-height: 1.45; }
.m56-lx .fc-check { margin: 0 0 2px; }
.m56-lx .fc-buttons.m56-b4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1000px) and (max-width: 1199px), (max-width: 480px) { .m56-lx .fc-buttons.m56-b4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.m56-pk > .lx-h:first-child { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.m56-cmp { grid-column: 1 / -1; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--inset); font-size: 0.88rem; line-height: 1.9; color: var(--ink-soft); }
.m56-cmp b { color: var(--ok); }
.m56-hl { outline: 2px solid var(--signal); outline-offset: 3px; }
.lx-hud > span.m56-hl { outline-offset: 1px; }
.m56-lead { margin: 0 0 8px; font-size: 0.82rem; line-height: 1.8; color: var(--ink-muted); }
.m56-cap { margin: 0 0 4px; font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); line-height: 1.6; text-align: center; }
.m56-cap .lx-x { vertical-align: middle; }
.m56-comp { fill: none; stroke-width: 1.2; opacity: 0.9; }
.m56-psi { fill: none; stroke: var(--signal); stroke-width: 1.5; stroke-linejoin: round; }
.m56-env { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.m56-pd { fill: rgba(255, 138, 128, 0.18); stroke: var(--pos); stroke-width: 1.6; stroke-linejoin: round; }
.m56-bar { stroke: var(--ink); stroke-width: 1.6; }
.m56-ok { fill: var(--ok); }
.m56-pksvg { display: block; width: 100%; height: auto; direction: ltr; margin: 0 auto; }
@media (max-width: 999px) {
    /* لا مرساة تمرير داخل المختبر: الحالة قبل الجولة في ترتيب الصفحة وبعدها على الشاشة، والمشهد المثبّت قد يطول؛ فلو ثبّت المتصفح عنصراً
       تحتهما لقفزت الصفحة عند كل خطوة من الجولة وانزلق زر «التالي» تحت المشهد */
    .m56-lx { overflow-anchor: none; }
}
/* اللوحة الثانية رسم طويل (الموجات ثم مجموعها ثم توزيع الزخم): تحت مشهد مصغّر تصير كتابتها أصغر من أن تُقرأ،
   فعلى الحاسوب العريض تظهر بجانب المشهد (والمشهد بارتفاعه كاملاً)، وعلى الأضيق تأخذ مكانه،
   وعلى الهاتف يطول الجزء المثبّت قليلاً ما دامت ظاهرة */
@media (min-width: 1000px) {
    .m56-lx .lx-stage > .m56-pkv { margin-top: 0; }
}
@media (min-width: 1200px) {
    .m56-lx .lx-stage:has(> .m56-pkv:not([hidden])) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; align-items: center; }
    .m56-lx .lx-stage:has(> .m56-pkv:not([hidden])) > .lx-hud { grid-column: 1 / -1; }
    .m56-lx .lx-stage:has(> .m56-pkv:not([hidden])) .s3-wrap { height: var(--lx-h); }
    .m56-lx .lx-stage > .m56-pkv svg { max-height: calc(var(--lx-h) - 34px); }
}
@media (min-width: 1000px) and (max-width: 1199px) {   /* العمود أضيق من أن يتسع للاثنين: تأخذ اللوحة مكان المشهد كما على الهاتف حتى تُغلق */
    .m56-lx .lx-stage:has(> .m56-pkv:not([hidden])) > .m56-stage { display: none; }
    .m56-lx .lx-stage > .m56-pkv svg { max-height: calc(var(--lx-h) * 0.8); }
}
@media (max-width: 640px) {
    .m56-lx .lx-stage:has(> .m56-pkv:not([hidden])) .s3-wrap, .m56-lx .lx-stage > .m56-pkv:not([hidden]) { height: calc(var(--lx-h) + 32px); }
    .m56-lx .lx-stage > .m56-pkv svg { max-height: calc(var(--lx-h) - 12px); }
}
/* 8-6 النظرية النسبية: مختبر «كرة في قطار» (frames-lab) — التخطيط في .lx (style.css) */
.fc-controls .fc-buttons.m57-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m57-btns button { padding: 8px 4px; font-size: 0.86rem; min-width: 0; }
.lx-ctl .fc-check { margin: 4px 0 6px; font-size: 0.9rem; }
.sim-table .m57-relc { grid-column: 1 / -1; }
.sim-table b.m57-rel { font-size: 0.9rem; text-align: left; }
@media (max-width: 400px) { .m57-scene .s3-label { font-size: 0.7rem; padding: 0 4px; } }
.m57-nw { white-space: nowrap; }
/* 9-6 فرضيتا اينشتين: مختبر «مركبة تطلق ضوءاً وكرة» (lightspeed-lab) — التخطيط في .lx (style.css) */
.fc-controls .fc-buttons.m58-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m58-btns button { padding: 8px 4px; font-size: 0.86rem; min-width: 0; }
.m58-scene ~ .lx-hud .m58-off { opacity: 0.4; }
.lx-ctl .fc-check { margin: 4px 0 8px; font-size: 0.9rem; }
.m58-wrap { background: var(--inset); }
.m58-tab { font-size: 0.88rem; }
.m58-tab th, .m58-tab td { padding: 7px 8px; vertical-align: middle; }
.m58-tab thead th { font-size: 0.8rem; color: var(--ink-soft); text-align: center; line-height: 1.5; }
.m58-tab tbody th { font-size: 0.85rem; text-align: right; line-height: 1.5; }
.m58-tab td { text-align: center; }
.m58-tab td b { display: block; font-family: var(--font-mono); font-weight: 600; font-size: 1rem; color: var(--ink); }
.m58-tab td small { margin-top: 2px; font-size: 0.74rem; line-height: 1.5; }
.m58-tab tr.m58-off { opacity: 0.35; }
.m58-nw { display: inline-block; white-space: nowrap; }
@media (max-width: 400px) {
    .m58-tab th, .m58-tab td { padding: 6px 4px; }
    .m58-scene .s3-label { font-size: 0.7rem; padding: 0 4px; }
}
/* ---------- 10-6 تحويلات لورنتز: جدول قيم γ الطويلة في الدرس، ومختبر lorentz-lab ---------- */
.m59-long { font-family: var(--font-mono); font-size: 0.86rem; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.fc-controls .fc-buttons.m59-pre { flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.fc-controls .fc-buttons.m59-pre button { flex: 1 1 28%; padding: 7px 4px; font-size: 0.86rem; min-width: 0; }
.m59-pre button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m59-curve, .m59-scene { touch-action: pan-y; }
.m59-hit { cursor: ew-resize; }
.m59-cap { margin: 0; font-size: 0.8rem; line-height: 1.7; color: var(--ink-muted); }
.m59-books { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.m59-bk { background: var(--inset); border: 1px solid var(--line); border-right: 3px solid var(--ink-muted); border-radius: 2px; padding: 6px 10px; font-size: 0.82rem; color: var(--ink-muted); }
.m59-bk.m59-s { border-right-color: var(--signal); }
.m59-bk.m59-l { border-right-color: var(--neg); }
.m59-bk.m59-off, .lx-hud > span.m59-off { opacity: 0.35; }
.m59-bh { display: block; font-weight: 700; color: var(--ink-soft); margin-bottom: 2px; }
.m59-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.m59-v { font-family: var(--font-mono); font-size: 0.98rem; color: var(--ink); direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.m59-stw { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--screen); }
.m59-stw[hidden] { display: none; }
.m59-stw svg { display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto; }
.m59-tbl { grid-template-columns: 1.5fr 1fr 1fr; }
.m59-tbl > .m59-w:last-child { grid-column: 1 / -1; }
/* الدفاتر الثلاثة بعضها تحت بعض (عمود الأدوات أضيق من أن تتسع فيه جنباً إلى جنب): «أين؟» و«متى؟» في سطر واحد */
.m59-lx .m59-books { grid-template-columns: 1fr; gap: 6px; }
.m59-lx .m59-bk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.m59-lx .m59-bh { grid-column: 1 / -1; }
@media (max-width: 600px) {
    .m59-lx .m59-bk { display: block; padding: 5px 9px; }
    .m59-tbl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .m59-tbl > .m59-w { grid-column: span 2; }
}
/* الرسمان في عمود المشهد على الحاسوب: المنحنى فوق مشهد الصاروخ، وكلاهما مع القراءات وسطر الحالة ضمن ارتفاع الشاشة */
@media (min-width: 1000px) {
    .m59-main, .m59-sc { container-type: inline-size; }   /* حين يضيق العمود (1024px) يصغر الرسمان قليلاً ليبقى سطر الحالة الطويل ضمن الشاشة */
    .m59-lx .lx-2d > svg { max-height: min(calc(var(--lx-h) * 0.62), 50cqw); }
    .m59-lx .lx-stage > .lx-more svg { max-height: min(calc(var(--lx-h) * 0.42), 33cqw); width: 100%; }
}
/* الهاتف: الرسم المختار في المبدّل يظهر وحده في مكانه
   (لا نغطي المنحنى بطبقة بارتفاع ‎--lx-h‎ لأن المنحنى أقصر منها فتغطي الطبقة القراءات تحته) */
@media (max-width: 999px) {
    .m59-lx .lx-stage[data-v="more"] > .lx-2d { display: none; }
    .m59-lx .lx-stage[data-v="more"] > .lx-more.lx-alt { position: static; height: auto; padding: 0; border: 0; background: none; display: block; }
}
/* القراءات السريعة (مؤقتاً حتى يُصلح في style.css): القيمة LTR فـ margin-inline-start يقع على يسارها، أما الفراغ المطلوب فبينها وبين الاسم على يمينها */
@media (min-width: 641px) { .lx-hud.m59-hud b { margin-left: 0; margin-right: 6px; } }
/* درس 11-6: مختبر النسبية (relativity-lab) — التخطيط في .lx (style.css) */
.m510-pre { margin: 0 0 8px; gap: 6px; }
.fc-controls .m510-pre { margin-top: 0; }
.m510-pre button { padding: 7px 2px; font-family: var(--font-mono); font-weight: 600; min-width: 0; }
.fc-controls .fc-buttons.m510-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m510-btns button { padding: 8px 4px; font-size: 0.86rem; min-width: 0; }
.lx-ctl .m510-trichk { margin: 4px 0 6px; font-size: 0.9rem; }
.m510-hud > span[hidden] { display: none; }
.m510-proof .figure { margin-inline: 0; }   /* رسم داخل «لمن يحب البرهان» لا يمتد خارج حدوده على الجوال */
/* درس 12-6 تكافؤ الكتلة والطاقة: مختبر «حوّل قطعة من المادة إلى طاقة» (js/sims-modern.js: emc2-lab) — التخطيط في .lx (style.css) */
.fc-controls .fc-buttons.m511-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.m511-btns button { flex: 1 1 28%; min-width: 0; padding: 8px 6px; font-size: 0.86rem; }
.lx-ctl .fc-check { margin: 4px 0 6px; font-size: 0.9rem; }
.m511-sub { margin: 2px 0 0; font-size: 0.78rem; color: var(--ink-muted); }
.m511-fnote { margin: 0; font-size: 0.78rem; }
.m511-fine { color: var(--ink-muted); font-size: 0.88em; }
.m511-table.sim-table > div { line-height: 1.6; }
.m511-table.sim-table b { font-family: var(--font-body); font-weight: 700; font-size: 1rem; }
.m511-scene ~ .lx-hud b.ar bdi { font-family: var(--font-mono); font-weight: 600; }   /* الأس (⁴) بخط الأرقام لا بخط النص العربي */
@media (max-width: 640px) { .lx-hud > .m511-hh { grid-column: 1 / -1; } }   /* مدة البيت قد تطول (3.24×10⁻⁵ ثانية): سطر كامل على الهاتف */

/* dive lesson css: chapter 7 */
/* ---------- درس 1-7: مقدمة — رسوم الدرس (الشكل 1، الأهداف، المصطلحات) ومختبر «من الجهاز إلى الذرة» (chip-zoom-lab) ---------- */
.m60-pcb { fill: #1E5A3C; stroke: #2E7A52; stroke-width: 1.5; }
.m60-trace { fill: none; stroke: #C9A45C; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.m60-can { fill: #AEB8C4; stroke: #E6ECF2; stroke-width: 1.2; }
.m60-can-top { fill: #CBD3DC; stroke: #8E99A6; stroke-width: 1; }
.m60-res { fill: #D9C39A; stroke: #8C7350; stroke-width: 1; }
.m60-cap-r { fill: #C8463C; stroke: #7A2620; stroke-width: 1; }
.m60-cap-b { fill: #3C6FC8; stroke: #22427A; stroke-width: 1; }
.m60-cap-cyl { fill: #2F5FB0; stroke: #9DB8E8; stroke-width: 1.2; }
.m60-scope { fill: rgba(205, 214, 224, 0.14); stroke: var(--ink-soft); stroke-width: 1.5; }
.m60-screen { fill: #12305A; stroke: var(--ink-muted); stroke-width: 1.2; }
.m60-grid { stroke: rgba(160, 200, 255, 0.28); stroke-width: 1; }
.m60-wave { fill: none; stroke: #9DFF8A; stroke-width: 2; }
.m60-spot { fill: #E8FFE0; stroke: #9DFF8A; stroke-width: 2; }
.m60-knob { fill: var(--screen); stroke: var(--ink-soft); stroke-width: 1.4; }
.m60-knob-l { stroke: var(--ink-soft); stroke-width: 1.4; }
.m60-btn { fill: rgba(234, 241, 248, 0.22); stroke: var(--ink-muted); stroke-width: 1; }
.m60-cable { fill: none; stroke: var(--ink-muted); stroke-width: 3.5; stroke-linecap: round; }
.m60-handle { fill: none; stroke: var(--ink-muted); stroke-width: 3; stroke-linecap: round; }

/* الأهداف السلوكية */
.m60-goals { margin: 10px 0 14px; padding: 12px 14px 10px; border: 1px solid rgba(var(--signal-rgb), 0.35); border-radius: var(--radius); background: var(--signal-soft); }
.m60-goals-h { margin: 0 0 8px; font-weight: 700; color: var(--ink); }
.m60-goals ol { margin: 0; padding-inline-start: 24px; display: grid; gap: 3px; }
.m60-goals li { color: var(--ink-soft); line-height: 1.75; }
.m60-goals li > span { margin-inline-end: 8px; }
.m60-goals li > a { color: var(--signal); font-family: var(--font-mono); font-size: 0.88rem; white-space: nowrap; unicode-bidi: isolate; }
/* المصطلحات وجداول الدرس */
.m60-terms .data-table { font-size: 0.95rem; }
.m60-terms th:nth-child(3), .m60-terms td:nth-child(3) { text-align: center; white-space: nowrap; }
.m60-terms td:nth-child(2) { text-align: left; }
.m60-terms .en { white-space: normal; }
@media (max-width: 640px) { .m60-terms .data-table, .m60-devs .data-table { font-size: 0.86rem; } .m60-terms th, .m60-terms td, .m60-devs th, .m60-devs td { padding: 6px 5px; } }
.m60-terms td a { color: var(--signal); font-family: var(--font-mono); font-size: 0.9rem; }
.m60-devs .data-table, .m60-size .data-table { font-size: 0.95rem; }
.m60-devs td:first-child { font-weight: 700; color: var(--ink); }
.m60-size td:nth-child(2), .m60-size td:nth-child(3), .m60-size th:nth-child(2), .m60-size th:nth-child(3) { text-align: center; }

/* المختبر */
.m60-zsvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m60-zbg { fill: #08182C; }
.m60-zframe { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.m60-flow { fill: none; stroke-linecap: round; }
.m60-tgt { fill: none; stroke: var(--signal); stroke-width: 1.6; stroke-dasharray: 4 3; }
.m60-wall { fill: #0D2340; }
.m60-table { fill: #4A3424; }
.m60-radio { fill: #7A4E32; stroke: #C79A6E; stroke-width: 2; }
.m60-ant { stroke: var(--ink-soft); stroke-width: 2.4; stroke-linecap: round; }
.m60-ant-tip { fill: var(--ink-soft); }
.m60-grille { fill: #E2D2B4; stroke: #9C7B55; stroke-width: 1.5; }
.m60-hole { fill: #6B4A30; }
.m60-dial { fill: #F1E6C8; stroke: #9C7B55; stroke-width: 1.2; }
.m60-tick { stroke: #5A4632; stroke-width: 1; }
.m60-needle { stroke: #D2382E; stroke-width: 2; }
.m60-cut { fill: #071A12; stroke: var(--signal); stroke-width: 1; stroke-dasharray: 3 3; }
.m60-snd { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; }
.m60-dark { fill: #08182C; }
.m60-leg { stroke: #C3CCD6; stroke-width: 4; stroke-linecap: round; }
.m60-hdr { fill: #C7CFD8; stroke: #EEF3F8; stroke-width: 1.2; }
.m60-hdr-side { fill: #8994A1; stroke: none; }
.m60-glass { fill: #DDEBF5; stroke: #9FB4C6; stroke-width: 1; }
.m60-post { fill: #F2D06B; stroke: #A88A2C; stroke-width: 0.8; }
.m60-bond { fill: none; stroke: #F2C14E; stroke-width: 1.3; }
.m60-die { fill: #5E5A7A; stroke: #C8C2EA; stroke-width: 0.8; }
.m60-die-s { fill: #3C3952; }
.m60-lead { stroke: var(--ink-muted); stroke-width: 1; }
.m60-nreg { fill: #26476E; stroke: #6F9AD0; stroke-width: 1.2; }
.m60-nreg2 { fill: #3A6AA8; stroke: #9CC4F2; stroke-width: 1; }
.m60-preg { fill: #7A3E46; stroke: #E09AA4; stroke-width: 1; }
.m60-metal { fill: #C9D3DD; stroke: #F2F6FA; stroke-width: 1; }
.m60-dot { fill: #F2C14E; }
.m60-here line { stroke: var(--signal); stroke-width: 1.6; }
.m60-here circle { fill: var(--signal); }
.m60-bondl { stroke: rgba(150, 175, 205, 0.45); stroke-width: 1.2; }
.m60-be { fill: #7CC7FF; }
.m60-si { fill: #8E9AA8; stroke: #DCE3EA; stroke-width: 1.2; }
.m60-sit { fill: #0B1A2C; font-weight: 700; }
.m60-lbl { fill: rgba(8, 24, 44, 0.88); stroke: var(--line-strong); stroke-width: 1; }
.m60-shell { fill: none; stroke: rgba(150, 175, 205, 0.55); stroke-width: 1.2; }
.m60-shell.val { stroke: var(--signal); stroke-width: 2.2; }
.m60-el { fill: #7CC7FF; stroke: #071A30; stroke-width: 1; }
.m60-el.val { stroke: var(--signal); stroke-width: 1.8; }
.m60-nuc { fill: #FFB35C; stroke: #FFE0B3; stroke-width: 1.2; }
.m60-sbg { fill: rgba(5, 16, 30, 0.82); }
.m60-sl { stroke: var(--ink); stroke-width: 2; }
.m60-st { fill: var(--ink); }
.m60-rbg { fill: var(--inset); stroke: var(--line); stroke-width: 1; }
.m60-axis { stroke: var(--ink-muted); stroke-width: 1.2; }
.m60-rdot { fill: var(--ink-soft); }
.m60-ptr path { fill: var(--signal); }
.m60-ptr line { stroke: var(--signal); stroke-width: 2; }
.m60-ptrt { fill: var(--signal); font-weight: 700; }
.m60-lv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 0 0 10px; }
.m60-lv button { padding: 6px 4px; font: inherit; font-size: 0.82rem; line-height: 1.35; border-radius: var(--radius); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; min-width: 0; }
.m60-lv button:hover { background: var(--hover); }
.m60-lv button.fc-primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 700; }
.m60-go button { padding: 8px 6px; }
.m60-table.sim-table .m60-wide { grid-column: 1 / -1; }
.m60-table.sim-table b.ar { font-size: 0.95rem; line-height: 1.7; }
@media (max-width: 640px) { .m60-lv button { font-size: 0.76rem; padding: 5px 2px; } }
.m60-n { white-space: nowrap; }
/* ---------- درس 2-7: المدارات الالكترونية ومستويات الطاقة — رسوم الدرس ومختبر «الذرة وسُلّم طاقتها» (levels-lab) ---------- */
.m61-el { fill: #7CC7FF; stroke: #071A30; stroke-width: 1; }
.m61-el.val { stroke: var(--signal); stroke-width: 1.8; }
.m61-minus { fill: #071A30; font-weight: 700; }
.m61-pr { fill: #FF8A80; stroke: #FFD0CB; stroke-width: 0.8; }
.m61-nt { fill: #8E9AA8; stroke: #DCE3EA; stroke-width: 0.8; }
.m61-plus { fill: #3A0E0A; font-weight: 700; }
.m61-frame { fill: rgba(255, 179, 92, 0.05); stroke: var(--line-strong); stroke-width: 1; }
.m61-zone { fill: rgba(200, 215, 235, 0.06); }
.m61-orb1 { fill: none; stroke: #C0566A; stroke-width: 2; }
.m61-orb2 { fill: none; stroke: rgba(var(--signal-rgb), 0.55); stroke-width: 12; }
.m61-shell { fill: none; stroke: rgba(150, 175, 205, 0.55); stroke-width: 1.2; }
.m61-shell.val { stroke: var(--signal); stroke-width: 2.2; }
.m61-nuc { fill: #FFB35C; stroke: #FFE0B3; stroke-width: 1.2; }
.m61-row > .fig-panel { min-width: min(100%, 150px); }
.m61-bar { fill: rgba(255, 138, 128, 0.75); }
.m61-bar.val { fill: var(--signal); }
.m61-zero { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 5 4; }
.m61-lvl { stroke: var(--ink-soft); stroke-width: 1.6; }
.m61-gnd { stroke: #FF6B5E; stroke-width: 3.2; }
.m61-up { stroke: var(--signal); stroke-width: 2.4; }

/* المختبر */
.m61-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m61-bg { fill: #08182C; stroke: var(--line-strong); stroke-width: 1; }
.m61-ah-ink { fill: var(--ink-soft); }
.m61-ah-sig { fill: var(--signal); }
.m61-ah-mu { fill: var(--ink-muted); }
.m61-ah-bad { fill: var(--bad); }
.m61-ax { stroke: var(--ink-soft); stroke-width: 1.3; }
.m61-ll { stroke: rgba(150, 175, 205, 0.8); stroke-width: 2.4; stroke-linecap: round; }
.m61-ll.val { stroke: var(--signal); }
.m61-ll.sel { stroke-width: 4; }
.m61-sh { fill: none; stroke: rgba(150, 175, 205, 0.5); stroke-width: 1.2; }
.m61-sh.val { stroke: var(--signal); stroke-width: 2.2; }
.m61-e { fill: #7CC7FF; stroke: #071A30; stroke-width: 1; }
.m61-e.val { stroke: var(--signal); stroke-width: 1.8; }
.m61-e.sel { stroke: #FF8A80; stroke-width: 2.2; }
.m61-pull { stroke: #FF8A80; stroke-linecap: round; opacity: 0.9; }
.m61-flyA, .m61-fly, .m61-fly2, .m61-eb, .m61-ea { fill: #7CC7FF; stroke: #DFF2FF; stroke-width: 1.2; }
.m61-freez { fill: rgba(var(--ok-rgb), 0.08); }
.m61-lv { stroke: var(--ink-soft); stroke-width: 1.6; }
.m61-gap { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.m61-orb { fill: none; stroke: rgba(150, 175, 205, 0.35); stroke-width: 1; stroke-dasharray: 3 3; }
.m61-orb.on { stroke: var(--ink-soft); stroke-dasharray: none; stroke-width: 1.4; }
.m61-garr { stroke: var(--signal); stroke-width: 2.6; }
.m61-garr.bad { stroke: var(--bad); stroke-dasharray: 4 3; }
.m61-gtx { fill: var(--signal); font-weight: 700; }
.m61-gtx.bad { fill: var(--bad); }
.m61-x { fill: var(--bad); font-weight: 700; }
.m61-atoms, .m61-ns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin: 0 0 8px; }
.m61-ns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.m61-shells { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 6px; }
.m61-atoms button, .m61-ns button, .m61-shells button, .m61-qb button { padding: 6px 6px; font: inherit; font-size: 0.84rem; line-height: 1.35; border-radius: var(--radius); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; min-width: 0; }
.m61-shells button { flex: 1 1 auto; }
.m61-atoms button:hover, .m61-ns button:hover, .m61-shells button:hover { background: var(--hover); }
.m61-atoms button.fc-primary, .m61-ns button.fc-primary, .m61-shells button.fc-primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 700; }
.m61-qb { margin: 0 0 4px; flex-wrap: wrap; }
.m61-qb button { flex: 1 1 auto; font-size: 0.8rem; }
.m61-mode button { padding: 8px 6px; }
.m61-table.sim-table .m61-wide { grid-column: 1 / -1; }
.m61-table.sim-table b.ar { font-size: 0.95rem; line-height: 1.7; }
.m61-n { white-space: nowrap; }
@media (max-width: 640px) { .m61-atoms button, .m61-ns button, .m61-shells button { font-size: 0.78rem; padding: 5px 3px; } }
.m61-mode button, .m61-ca .fc-buttons button, .m61-cb .fc-buttons button { padding: 7px 6px; font-size: 0.88rem; line-height: 1.45; }
.m61-ca, .m61-cb { margin-top: 12px; }
/* ---------- درس 3-7: الموصلات والعوازل وأشباه الموصلات — رسوم الدرس و«مختبر الرقاقة» (conduct-lab) ---------- */
.m62-e { fill: #7CC7FF; }
.m62-eb { fill: rgba(124, 199, 255, 0.62); }
.m62-at { fill: #8E99A6; stroke: rgba(234, 241, 248, 0.35); stroke-width: 0.8; }
.m62-at.cu { fill: #C98A5E; }
.m62-at.gl { fill: #8FB3C9; opacity: 0.85; }
.m62-slab { fill: rgba(170, 186, 206, 0.07); stroke: var(--line-strong); stroke-width: 1.2; }
.m62-plus { fill: rgba(255, 107, 107, 0.28); stroke: #FF6B6B; stroke-width: 1.4; }
.m62-minus { fill: rgba(78, 168, 255, 0.28); stroke: #4EA8FF; stroke-width: 1.4; }
.t-label.m62-tp, .t-ar.m62-tp { fill: #FF6B6B; font-weight: 700; }
.t-label.m62-tn, .t-ar.m62-tn { fill: #4EA8FF; font-weight: 700; }
.t-label.m62-ti { fill: var(--signal); font-weight: 700; }
/* سلك الشاحن */
.m62-plug { fill: #3A4A5E; stroke: var(--ink-soft); stroke-width: 1.2; }
.m62-pin { stroke: var(--ink-soft); stroke-width: 3; stroke-linecap: round; }
.m62-pin2 { stroke: var(--ink-muted); stroke-width: 1.6; }
.m62-jacket { fill: #4A5D73; stroke: var(--ink-soft); stroke-width: 1.2; }
.m62-cut { fill: rgba(7, 26, 48, 0.78); stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.m62-core { fill: #8A5634; stroke: #C98A5E; stroke-width: 1; }
.m62-phone { fill: #0E2440; stroke: var(--ink-soft); stroke-width: 1.5; }
.m62-screen { fill: rgba(124, 199, 255, 0.06); stroke: var(--line); stroke-width: 1; }
.m62-chip { fill: #2B3644; stroke: var(--ink-soft); stroke-width: 1.2; }
/* الذرة في الموصل والعازل */
.m62-orb { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.m62-cloud { fill: rgba(124, 199, 255, 0.07); stroke: var(--line); stroke-width: 1; }
.m62-nuc { fill: var(--signal); stroke: var(--ink); stroke-width: 1; }
/* قطعة المقاومة النوعية */
.m62-bar { fill: rgba(201, 138, 94, 0.22); stroke: var(--ink-soft); stroke-width: 1.4; }
.m62-bar-top { fill: rgba(201, 138, 94, 0.32); stroke: var(--ink-soft); stroke-width: 1.2; }
.m62-bar-end { fill: rgba(var(--signal-rgb), 0.3); stroke: var(--signal); stroke-width: 1.4; }
/* مسطرة المقاومة النوعية: الموصلات أخضر، وأشباه الموصلات كهرماني، والعوازل أحمر */
.m62-bc { fill: rgba(var(--ok-rgb), 0.55); }
.m62-bs { fill: rgba(var(--signal-rgb), 0.5); }
.m62-bi { fill: rgba(var(--bad-rgb), 0.5); }
.m62-bq { fill: rgba(149, 173, 198, 0.14); stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 2; }
.t-ar.m62-bt { fill: var(--ink); font-weight: 700; }
.m62-mk { fill: var(--ink); }
.m62-mk path { fill: var(--ink); }

/* المختبر */
.m62-sc { direction: ltr; }
.m62-w { fill: none; stroke: var(--ink-soft); stroke-width: 1.8; }
.m62-flow { fill: none; stroke: #7CC7FF; stroke-width: 3.6; stroke-linecap: round; stroke-dasharray: 0.01 12; animation: m62-run 1s linear infinite; }
@keyframes m62-run { from { stroke-dashoffset: 12; } to { stroke-dashoffset: 0; } }
.m62-paused .m62-flow { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .m62-flow { animation: none; } }
.m62-amm { fill: var(--signal); stroke: var(--ink); stroke-width: 1.2; }
.m62-glow { fill: #FFD25A; opacity: 0; filter: blur(2px); }
.m62-bulb { fill: rgba(255, 255, 255, 0.06); stroke: var(--ink-soft); stroke-width: 1.4; }
.m62-bulb.on { fill: rgba(255, 226, 140, 0.85); stroke: var(--signal); }
.m62-fil { stroke: var(--ink-muted); stroke-width: 1.2; fill: none; }
.m62-disp { fill: #04101F; stroke: var(--line-strong); stroke-width: 1; }
.t-ar.m62-dt, .t-label.m62-dt { fill: var(--signal); font-family: var(--font-mono); }
.m62-bp { stroke: #FF6B6B; stroke-width: 2.4; }
.m62-bn { stroke: #4EA8FF; stroke-width: 5; }
.m62-conv line { stroke: var(--signal); stroke-width: 2.2; }
.m62-conv path { fill: var(--signal); }
.m62-lx .lx-hud i { font-style: normal; }
.m62-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 0 0 4px; }
.m62-pick1, .m62-pick2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m62-pick button { padding: 7px 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; font-size: 0.84rem; line-height: 1.35; cursor: pointer; min-width: 0; }
.m62-pick button bdi { font-family: var(--font-mono); color: var(--ink-muted); font-size: 0.78rem; }
.m62-pick button:hover { background: var(--hover); }
.m62-pick button.fc-primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 700; }
.m62-pick button.fc-primary bdi { color: var(--signal-ink); }
.fc-controls .fc-buttons.m62-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.fc-controls .fc-buttons.m62-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.m62-table.sim-table b.ar { font-family: var(--font-body); direction: rtl; }
/* جدول المقارنة في الدرس */
.m62-cmp .data-table td, .m62-cmp .data-table th { vertical-align: top; }
.m62-cmp .data-table td:first-child { font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) {
    .m62-pick { gap: 4px; }
    .m62-pick button { font-size: 0.76rem; padding: 6px 1px; }
}
/* نصوص الدرس */
.m62-aside { color: var(--ink-muted); font-size: 0.9em; }
.m62-ol { margin: 0 0 10px; padding-inline-start: 22px; line-height: 1.9; }
.m62-ol li { margin-bottom: 4px; }
.m62-src { margin: 8px 0 0; font-size: 0.88rem; color: var(--ink-muted); }
/* ---------- درس 4-7: حزم الطاقة في المواد الصلبة — رسوم الدرس و«مختبر الرقاقة» (bands-lab) ----------
   حزمة التكافؤ كهرمانية، وحزمة التوصيل فيروزية، والثغرة فارغة؛ الإلكترون نقطة سماوية، والمكان الفارغ دائرة وردية مفرغة */
.m63-e { fill: #7CC7FF; }
.m63-hole { fill: none; stroke: #FF7A9A; stroke-width: 1.6; }
.m63-at { fill: #8E99A6; stroke: rgba(234, 241, 248, 0.4); stroke-width: 0.9; }
.m63-vb { fill: rgba(255, 179, 71, 0.26); stroke: #FFB347; stroke-width: 1.3; }
.m63-cb { fill: rgba(64, 201, 190, 0.18); stroke: #40C9BE; stroke-width: 1.3; }
.m63-gapz { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.m63-strC { stroke: rgba(64, 201, 190, 0.6); stroke-width: 1.2; }
.m63-strV { stroke: rgba(255, 179, 71, 0.6); stroke-width: 1.2; }
.m63-gapl { stroke: var(--neg); stroke-width: 1.4; }
.m63-lvl { stroke: var(--ink); stroke-width: 2; }
.m63-lvl.thin { stroke: rgba(64, 201, 190, 0.85); stroke-width: 1; }
.m63-ovl { stroke: #E879C6; stroke-width: 3; }
.m63-fanU { fill: none; stroke: rgba(64, 201, 190, 0.85); stroke-width: 1.3; }
.m63-fanL { fill: none; stroke: rgba(255, 179, 71, 0.9); stroke-width: 1.3; }
.m63-dash { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 3; }
.m63-cut { stroke: var(--signal); stroke-width: 2; stroke-dasharray: 5 4; }
.m63-try { stroke: var(--ink-muted); stroke-width: 1.4; stroke-dasharray: 3 3; }
.m63-try.ok { stroke: var(--ok); }
.m63-ghost { fill: none; stroke: #7CC7FF; stroke-width: 1.4; stroke-dasharray: 2 2; }
.m63-ghost.ok { stroke: var(--ok); }
.t-label.m63-tx { fill: var(--bad); font-weight: 700; }
.t-label.m63-tok { fill: var(--ok); font-weight: 700; }
.m63-pk { fill: none; stroke: var(--signal); stroke-width: 2.2; stroke-linecap: round; }
.t-ar.m63-tgap { fill: var(--neg); font-weight: 700; }
.t-label.m63-tgap { fill: var(--neg); }
.t-ar.m63-tov { fill: #E879C6; font-weight: 700; }
.t-ar.m63-tb { fill: var(--ink-soft); }
.m63-row3 { flex-wrap: nowrap; gap: 8px; }
.m63-row3 > .fig-panel { min-width: 0; flex: 1 1 0; }
@media (max-width: 640px) {
    .m63-row3 { gap: 4px; }
    .m63-row3 .fig-caption { font-size: 0.78rem; }
}

/* المختبر */
.m63-sc { direction: ltr; }
.m63-mode { display: flex; gap: 4px; margin: 0 0 6px; }
.m63-mode button { flex: 1; height: 30px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--inset); color: var(--ink-soft);
    font: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer; }
.m63-mode button.fc-primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.m63-ax { stroke: var(--ink-soft); stroke-width: 1.4; }
.m63-ax-h { fill: var(--ink-soft); }
.m63-gp { stroke: var(--neg); stroke-width: 1.4; }
.m63-gp-h { fill: var(--neg); }
.m63-r0 { stroke: var(--ink); stroke-width: 1.4; }
.m63-fu { fill: none; stroke: rgba(64, 201, 190, 0.9); stroke-width: 1.4; }
.m63-fl { fill: none; stroke: rgba(255, 179, 71, 0.95); stroke-width: 1.4; }
.m63-fu.thin, .m63-fl.thin { stroke-width: 0.7; opacity: 0.8; }
.m63-fu-fill { fill: rgba(64, 201, 190, 0.16); }
.m63-fl-fill { fill: rgba(255, 179, 71, 0.2); }
.m63-cutl { stroke: var(--signal); stroke-width: 1.8; stroke-dasharray: 5 4; }
.t-label.m63-tcut { fill: var(--signal); }
.m63-lv { stroke: var(--ink-soft); stroke-width: 1.3; }
.m63-pkh { fill: none; stroke: #FF9F5A; stroke-width: 2; stroke-linecap: round; }
.m63-pkl { fill: none; stroke: var(--signal); stroke-width: 2.2; stroke-linecap: round; }
.m63-pkl-h { fill: var(--signal); stroke: none; }
.m63-pkf { stroke: var(--pos); stroke-width: 2.2; }
.m63-pkf-h { fill: var(--pos); stroke: none; }
.t-label.m63-pkf-t { fill: var(--pos); stroke: none; }
.t-ar.m63-ft { font-weight: 700; fill: var(--ink-muted); }
.t-ar.m63-ft.ok { fill: var(--ok); }
.t-ar.m63-ft.bad { fill: var(--bad); }
.m63-sub { margin: 4px 0 4px; font-size: 0.8rem; color: var(--ink-muted); }
.m63-seg { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
.m63-seg button { flex: 1 1 0; min-width: 0; padding: 6px 3px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink);
    font: inherit; font-size: 0.82rem; line-height: 1.35; cursor: pointer; }
.m63-seg button bdi { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-muted); }
.m63-seg button:hover { background: var(--hover); }
.m63-seg button.fc-primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 700; }
.m63-seg button.fc-primary bdi { color: var(--signal-ink); }
.fc-controls .fc-buttons.m63-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.fc-controls .fc-buttons.m63-btns button { padding: 8px 4px; font-size: 0.86rem; min-width: 0; }
.m63-table.sim-table b.ar { font-family: var(--font-body); direction: rtl; }
.m63-lx .fc-status b { color: var(--ink); }
@media (max-width: 640px) {
    .m63-mode button { font-size: 0.78rem; }
    .m63-seg button { font-size: 0.76rem; padding: 6px 1px; }
}
/* نصوص الدرس */
.m63-ol { margin: 0 0 10px; padding-inline-start: 22px; line-height: 1.9; }
.m63-ol li { margin-bottom: 4px; }
.m63-pink li, .m63-pinkq { color: #FF9CC8; }
.m63-tab .data-table td, .m63-tab .data-table th { text-align: center; }
.m63-tab .data-table td:first-child { text-align: right; font-weight: 700; }
.m63-sep { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
/* ---------- درس 5-7: أشباه الموصلات النقية — «مختبر الرقاقة» (intrinsic-lab) ومحرك البلورة المسطّحة (يستعمله مختبر 6-7 أيضاً) ورسوم الدرس ---------- */
.m64-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
/* الدائرة الخارجية والبطارية */
.m64-wire { fill: none; stroke: var(--ink-soft); stroke-width: 2; }
.m64-circ line { stroke: var(--ink); stroke-width: 2.4; }
.m64-circ line.long { stroke-width: 2.4; }
.m64-circ.off .m64-wire, .m64-circ.off line { opacity: 0.28; }
.m64-circ.off .m64-bp, .m64-circ.off .m64-bm { opacity: 0.35; }
.m64-bp { fill: #FF7B7B; font-weight: 700; }
.m64-bm { fill: #6EA8FF; font-weight: 700; }
.m64-plus { fill: #FF7B7B; font-weight: 700; }
.m64-minus { fill: #6EA8FF; font-weight: 700; }
.m64-ef { fill: none; stroke: #7CC7FF; stroke-width: 3.6; stroke-linecap: round; stroke-dasharray: 0.01 14; }
.m64-iarr { fill: var(--signal); }
.m64-iI { fill: var(--signal); font-weight: 700; }
.m64-plate { fill: #8A97A8; stroke: var(--ink-soft); stroke-width: 1; }
.m64-fl { stroke: #FF7A9A; stroke-width: 1.2; stroke-dasharray: 5 5; opacity: 0.55; }
.m64-fE { fill: #FF7A9A; font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; }
/* الذرات والأواصر والحوامل */
.m64-gl { stroke: rgba(195, 210, 226, 0.13); stroke-width: 9; stroke-linecap: round; }
.m64-gl.m64-stub { stroke: rgba(195, 210, 226, 0.08); }
.m64-gl.imp { stroke: rgba(255, 179, 92, 0.12); }
.m64-be { fill: #C3D2E2; }
.m64-be.m64-stubd { opacity: 0.45; }
.m64-atom { fill: #4E5C6D; stroke: #93A5B9; stroke-width: 1.4; }
.m64-atom.d { fill: #FFB35C; stroke: #FFD9A8; }
.m64-atom.a { fill: #B48CFF; stroke: #DCCBFF; }
.m64-sym { fill: #EAF1F8; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; }
.m64-atom.d + .m64-sym, .m64-atom.a + .m64-sym { fill: #0B2747; }
.m64-ion circle { fill: #FFB35C; stroke: var(--screen); stroke-width: 1.2; }
.m64-ion text { fill: #0B2747; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.m64-ion.a circle { fill: #B48CFF; }
.m64-fe { fill: #7CC7FF; stroke: rgba(124, 199, 255, 0.35); stroke-width: 4; }
.m64-fe.b { stroke-width: 2.5; }
.m64-tr { stroke: rgba(124, 199, 255, 0.55); stroke-width: 2; stroke-dasharray: 2 3; }
.m64-hole { fill: var(--screen); stroke: #FF7A9A; stroke-width: 2; }
.m64-hole.bound { stroke-dasharray: 2.5 2; stroke-width: 2.4; r: 5.6px; fill: rgba(255, 122, 154, 0.14); }
.m64-hole.b { fill: #3B2C18; stroke-width: 1.8; }
.m64-spark { fill: none; stroke-width: 2.2; }
.m64-spark.heat { stroke: #FFB35C; }
.m64-spark.rec { stroke: #7CC7FF; }
.m64-trail { fill: none; stroke: #FF7A9A; stroke-width: 2; stroke-dasharray: 4 3; opacity: 0.85; stroke-linejoin: round; }
.m64-trk { fill: none; stroke: var(--signal); stroke-width: 2; }
/* مخطط الحزم تحت البلورة */
.m64-ax { stroke: var(--ink-muted); stroke-width: 1.4; }
.m64-cb { fill: rgba(69, 196, 184, 0.24); stroke: #45C4B8; stroke-width: 1.2; }
.m64-vb { fill: rgba(232, 163, 61, 0.30); stroke: #E8A33D; stroke-width: 1.2; }
.m64-vbe { fill: #C9A06A; }
.m64-fermi { stroke: #9CC3FF; stroke-width: 1.6; stroke-dasharray: 1.5 3; stroke-linecap: round; }
.m64-lev { stroke-width: 2; stroke-dasharray: 7 4; }
.m64-dlev { stroke: #FFB35C; }
.m64-alev { stroke: #B48CFF; }
.m64-bst { fill: var(--screen); stroke-width: 1.6; }
.m64-bst.d { stroke: #FFB35C; }
.m64-bst.a { stroke: #B48CFF; }
.m64-bst.a.ion { fill: #B48CFF; }
.m64-bsg { fill: #FFD9A8; font-family: var(--font-mono); font-size: 9px; font-weight: 700; }
.m64-bst.a.ion + .m64-bsg { fill: #0B2747; }
/* أدوات المختبر */
.fc-controls .fc-buttons.m64-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m64-btns button { padding: 7px 4px; font-size: 0.82rem; min-width: 0; }
.m64-tot { grid-column: 1 / -1; }
.m64-bar { display: flex; height: 9px; margin-top: 6px; border-radius: 2px; background: var(--inset); border: 1px solid var(--line); overflow: hidden; direction: ltr; }
.m64-bar i { display: block; height: 100%; width: 0; transition: width 0.3s; }
.m64-bar .m64-be2 { background: #7CC7FF; }
.m64-bar .m64-bh2 { background: #FF7A9A; }

/* ---------- رسوم الدرس ---------- */
.m64-orb { fill: none; stroke: #E8C05A; stroke-width: 1.6; }
.m64-orb.soft { stroke-opacity: 0.5; }
.m64-at { fill: #4E5C6D; stroke: #93A5B9; stroke-width: 1.4; }
.m64-at4 { fill: #EAF1F8; font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.m64-ve { fill: #FF8FB0; }
.m64-ve.c { fill: #7CC7FF; }
.m64-bandC { fill: rgba(69, 196, 184, 0.24); stroke: #45C4B8; stroke-width: 1.2; }
.m64-bandV { fill: rgba(232, 163, 61, 0.30); stroke: #E8A33D; stroke-width: 1.2; }
.m64-bandI { fill: rgba(149, 173, 198, 0.16); stroke: var(--ink-muted); stroke-width: 1; }
.m64-nuc { fill: #6E8FB0; stroke: var(--ink-soft); stroke-width: 1; }
.m64-heat { fill: none; stroke: #FFB35C; stroke-width: 1.8; stroke-linecap: round; }
.m64-fhole { fill: var(--screen); stroke: #FF7A9A; stroke-width: 2; }
.m64-ftail { fill: none; stroke: #FF8FB0; stroke-width: 2.4; stroke-linecap: round; opacity: 0.7; }
.m64-pair { fill: none; stroke: var(--ink-soft); stroke-width: 1.2; stroke-dasharray: 4 3; }
.m64-ferm { stroke: #9CC3FF; stroke-width: 2; stroke-dasharray: 2 4; stroke-linecap: round; }
.m64-lvlE { stroke: #45C4B8; stroke-width: 1.6; }
.m64-lvlF { stroke: #E8A33D; stroke-width: 1.6; }
.m64-tag { fill: rgba(var(--signal-rgb), 0.10); stroke: rgba(var(--signal-rgb), 0.55); stroke-width: 1; }
.m64-field { stroke: #FF7A9A; stroke-width: 2.4; }
.m64-chair { fill: #3A4A5E; stroke: var(--ink-muted); stroke-width: 1.2; }
.m64-chair.empty { fill: none; stroke: #FF7A9A; stroke-width: 1.8; stroke-dasharray: 3 2; }
.m64-head { fill: #FFC9A6; }
.m64-body { fill: #6EA8FF; }
.m64-cmp td:first-child { font-weight: 700; color: var(--ink); }
.m64-cmp .data-table td, .m64-cmp .data-table th { text-align: center; }
.m64-cmp .data-table td:first-child { text-align: right; }
.m64-red { margin: 14px 0; padding: 12px 14px; border: 1.5px solid #FF7B7B; border-radius: var(--radius); background: rgba(var(--bad-rgb), 0.06); }
.m64-red p { margin: 0; color: #FFB3B3; font-weight: 600; line-height: 1.9; }
.m64-red ol { margin: 6px 0 0; padding-inline-start: 22px; color: #FFD0D0; }
/* ---------- درس 6-7: أشباه الموصلات المُطَعَّمة — «مختبر الرقاقة» (doping-lab، يستعمل محرك البلورة وأنماط .m64- من درس 5-7) ورسوم الدرس ---------- */
.m65-dops { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 0 0 10px; }
.m65-dops button { padding: 6px 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; font-size: 0.78rem; line-height: 1.35; cursor: pointer; min-width: 0; }
.m65-dops button b { display: block; font-weight: 700; }
.m65-dops button b bdi { font-family: var(--font-mono); }
.m65-dops button small { display: block; color: var(--ink-muted); font-size: 0.68rem; }
.m65-dops button:hover { background: var(--hover); }
.m65-dops button.on { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.m65-dops button.on small { color: var(--signal-ink); }
.m65-dops button[data-d="Sb"] { border-color: rgba(255, 179, 92, 0.6); }
.m65-dops button[data-d="B"], .m65-dops button[data-d="Al"], .m65-dops button[data-d="In"] { border-color: rgba(180, 140, 255, 0.55); }
.m65-wide { grid-column: 1 / -1; }
.m65-lx input[type="range"]:disabled { opacity: 0.4; }
@media (max-width: 640px) {
    .m65-dops { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* رسوم الدرس */
.m65-at { fill: #4E5C6D; stroke: #93A5B9; stroke-width: 1.4; }
.m65-at.d { fill: #FFB35C; stroke: #FFD9A8; }
.m65-at.a { fill: #B48CFF; stroke: #DCCBFF; }
.m65-at4 { fill: #EAF1F8; font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.m65-at4.d, .m65-at4.a { fill: #0B2747; }
.m65-orb { fill: none; stroke: #E8C05A; stroke-width: 1.5; stroke-opacity: 0.6; }
.m65-orb.d { stroke: #FFB35C; stroke-opacity: 1; stroke-width: 1.8; }
.m65-orb.a { stroke: #B48CFF; stroke-opacity: 1; stroke-width: 1.8; }
.m65-ve { fill: #C3D2E2; }
.m65-fe { fill: #7CC7FF; stroke: rgba(124, 199, 255, 0.35); stroke-width: 3; }
.m65-ho { fill: var(--screen); stroke: #FF7A9A; stroke-width: 2; }
.m65-tail { fill: none; stroke: #7CC7FF; stroke-width: 2.4; stroke-linecap: round; opacity: 0.55; stroke-dasharray: 3 4; }
.m65-badge { stroke: var(--screen); stroke-width: 1.2; }
.m65-badge.d { fill: #FFB35C; }
.m65-badge.a { fill: #B48CFF; }
.m65-bt { fill: #0B2747; font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.m65-cb { fill: rgba(69, 196, 184, 0.22); stroke: #45C4B8; stroke-width: 1.2; }
.m65-vb { fill: rgba(232, 163, 61, 0.26); stroke: #E8A33D; stroke-width: 1.2; }
.m65-lev { stroke-width: 2.4; stroke-dasharray: 8 4; }
.m65-lev.d { stroke: #FFB35C; }
.m65-lev.a { stroke: #B48CFF; }
.m65-ferm { stroke: #9CC3FF; stroke-width: 2; stroke-dasharray: 2 4; stroke-linecap: round; }
.m65-lf { fill: #9CC3FF; }
.m65-ld { fill: #FFB35C; }
.m65-la { fill: #C9AEFF; }
.m65-banner.n { fill: rgba(69, 140, 200, 0.28); stroke: #6EA8FF; }
.m65-banner.p { fill: rgba(255, 140, 110, 0.22); stroke: #FF9A80; }
.m65-bn { fill: var(--signal); font-weight: 700; }
/* «تذكر» من الكتاب، وجدول المقارنة */
.m65-rem { margin: 14px 0; padding: 12px 14px; border: 1px solid rgba(180, 140, 255, 0.55); border-radius: var(--radius); background: rgba(180, 140, 255, 0.08); }
.m65-rem h5 { margin: 0 0 6px; color: #C9AEFF; font-size: 1rem; }
.m65-rem p { margin: 0 0 6px; }
.m65-rem ul { margin: 0; padding-inline-start: 20px; }
.m65-rem li { margin: 3px 0; }
.m65-cmp .data-table td, .m65-cmp .data-table th { text-align: center; }
.m65-cmp .data-table td:first-child { text-align: right; font-weight: 700; color: var(--ink); }
.m65-n { color: #8CC0FF; }
.m65-p { color: #FFB09A; }
/* 7-7 الثنائي pn: رسوم الدرس ومختبر الرقاقة (junction-lab) — إلكترون سماوي، فجوة وردية مفرغة، أيون موجب برتقالي، أيون سالب بنفسجي */
.m66-e { fill: #7CC7FF; }
.m66-h { fill: none; stroke: #FF7A9A; stroke-width: 1.8; }
.m66-ip circle { fill: rgba(255, 179, 92, 0.16); stroke: #FFB35C; stroke-width: 1.4; }
.m66-ip text { fill: #FFB35C; font-family: var(--font-mono); font-weight: 700; }
.m66-in circle { fill: rgba(180, 140, 255, 0.16); stroke: #B48CFF; stroke-width: 1.4; }
.m66-in text { fill: #B48CFF; font-family: var(--font-mono); font-weight: 700; }
.m66-p { fill: rgba(255, 150, 90, 0.11); }
.m66-n { fill: rgba(110, 170, 255, 0.11); }
.m66-xt { fill: none; stroke: var(--ink-muted); stroke-width: 1.3; }
.m66-cap { fill: #7D8A9B; stroke: var(--ink-muted); stroke-width: 1; }
.m66-lead { stroke: #B9C4D2; stroke-width: 2.4; }
.m66-leg { stroke: #B9C4D2; stroke-width: 1.6; stroke-linecap: round; }
.m66-jn { stroke: var(--ink-soft); stroke-width: 1.2; stroke-dasharray: 4 3; }
.m66-dep { fill: rgba(225, 235, 248, 0.1); stroke: rgba(225, 235, 248, 0.45); stroke-width: 1; stroke-dasharray: 3 3; }
.m66-fld { stroke: #FF6B6B; stroke-width: 1.8; }
.m66-fah { fill: #FF6B6B; }
.m66-ev { stroke: #7CC7FF; stroke-width: 2; fill: none; }
.m66-hv { stroke: #FF7A9A; stroke-width: 2; fill: none; }
.m66-burst { fill: none; stroke: #FFE6A0; stroke-width: 2; }
.m66-ground { fill: rgba(150, 190, 235, 0.12); stroke: var(--ink-soft); stroke-width: 2; stroke-linejoin: round; }
/* مفتاح الرموز (HTML) */
.m66-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin: 10px 0 14px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--inset); font-size: 0.9rem; color: var(--ink-soft); }
.m66-key span { display: inline-flex; align-items: center; gap: 6px; }
.m66-key svg { flex: none; }

/* المختبر */
.m66-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m66-lab .m66-ion { opacity: 0.3; transition: opacity 0.35s; }
.m66-lab .m66-ion.on { opacity: 1; }
.m66-lab .m66-ion.on circle { stroke-width: 2; }
.m66-lab.m66-noions .m66-ion:not(.on) { opacity: 0; }
.m66-edge { stroke: rgba(225, 235, 248, 0.32); stroke-width: 1; stroke-dasharray: 2 4; }
.m66-svg:not(.m66-has) .m66-edge { opacity: 0; }
.m66-dlab { transition: opacity 0.3s; }
.m66-base { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 4; }
.m66-hill { fill: none; stroke: #7CC7FF; stroke-width: 2.2; stroke-linejoin: round; }
.m66-hdim { stroke: var(--signal); stroke-width: 1.4; }
.m66-vlab { fill: var(--signal); }
.m66-pdot { fill: #7CC7FF; stroke: var(--screen); stroke-width: 1.5; }
.fc-controls .fc-buttons.m66-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.fc-controls .fc-buttons.m66-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.fc-controls .fc-buttons.m66-btns button:disabled { opacity: 0.45; cursor: default; }
/* 8-7 فولطية الانحياز للثنائي pn: رسوم الدرس ومختبر الرقاقة (bias-lab) */
.m67-e { fill: #7CC7FF; }
.m67-h { fill: none; stroke: #FF7A9A; stroke-width: 1.8; }
.m67-ip circle { fill: rgba(255, 179, 92, 0.16); stroke: #FFB35C; stroke-width: 1.3; }
.m67-ip text { fill: #FFB35C; font-family: var(--font-mono); font-weight: 700; }
.m67-in circle { fill: rgba(180, 140, 255, 0.16); stroke: #B48CFF; stroke-width: 1.3; }
.m67-in text { fill: #B48CFF; font-family: var(--font-mono); font-weight: 700; }
.m67-p { fill: rgba(255, 150, 90, 0.11); }
.m67-n { fill: rgba(110, 170, 255, 0.11); }
.m67-xt { fill: none; stroke: var(--ink-muted); stroke-width: 1.3; }
.m67-cap { fill: #7D8A9B; stroke: var(--ink-muted); stroke-width: 1; }
.m67-jn { stroke: var(--ink-soft); stroke-width: 1.2; stroke-dasharray: 4 3; }
.m67-dep { fill: rgba(225, 235, 248, 0.1); stroke: rgba(225, 235, 248, 0.45); stroke-width: 1; stroke-dasharray: 3 3; }
.m67-res { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.m67-tp { fill: #FF8A80; }
.m67-tn { fill: #7CC7FF; }
.m67-bp { fill: rgba(255, 107, 107, 0.2); stroke: #FF8A80; stroke-width: 1.4; }
.m67-bn { fill: rgba(80, 140, 255, 0.2); stroke: #7CC7FF; stroke-width: 1.4; }
.m67-tri { fill: #FF8A80; stroke: #FF8A80; stroke-width: 1.2; stroke-linejoin: round; }
.m67-bar { stroke: #7CC7FF; stroke-width: 3.2; }
.m67-wp { stroke: #FF8A80; stroke-width: 2.4; }
.m67-wn { stroke: #7CC7FF; stroke-width: 2.4; }
.m67-cur { stroke: var(--signal); stroke-width: 2.6; fill: none; }
.m67-cur.thin { stroke-width: 1.8; }
.m67-ev { stroke: #7CC7FF; stroke-width: 2; fill: none; }
.m67-hv { stroke: #FF7A9A; stroke-width: 2; fill: none; }
.m67-ivf { fill: none; stroke: var(--signal); stroke-width: 2.4; stroke-linejoin: round; }
.m67-ivr { fill: none; stroke: var(--signal); stroke-width: 2.4; stroke-linejoin: round; }
.m67-grid { stroke: rgba(150, 190, 235, 0.09); stroke-width: 1; }
.m67-vm { fill: #12355E; stroke: var(--ink-muted); stroke-width: 1.4; }
.m67-symtab td, .m67-symtab th { text-align: center; vertical-align: middle; }

/* المختبر */
.m67-svg, .m67-csvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m67-lab .m67-ion { opacity: 0.28; transition: opacity 0.3s; }
.m67-lab .m67-ion.on { opacity: 1; }
.m67-lab .m67-ion.on circle { stroke-width: 1.9; }
.m67-we { fill: #7CC7FF; opacity: 0.85; }
.m67-amm { fill: var(--signal); stroke: var(--ink); stroke-width: 1.2; }
.m67-curm { fill: none; stroke: var(--signal); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.m67-burst { fill: none; stroke: #FFE6A0; stroke-width: 2; }
.m67-fb { stroke: #FF6B6B; stroke-width: 2.4; }
.m67-fah { fill: #FF6B6B; }
.m67-fa { stroke: #5FD39A; stroke-width: 2.4; }
.m67-aah { fill: #5FD39A; }
.m67-fbl { fill: #FF8A80; }
.m67-fal { fill: #5FD39A; }
.m67-sub { margin: -4px 0 10px; font-size: 0.82rem; color: var(--ink-muted); }
.m67-cap-t { margin: 0 0 4px; font-size: 0.8rem; color: var(--ink-soft); text-align: center; }
.m67-gl { stroke: rgba(150, 190, 235, 0.1); stroke-width: 1; }
.m67-ax { stroke: var(--ink-muted); stroke-width: 1.4; }
.m67-v0 { stroke: var(--signal); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; }
.m67-simple { fill: none; stroke: var(--signal); stroke-width: 2.6; stroke-linejoin: round; }
.m67-real { fill: none; stroke: #7CC7FF; stroke-width: 2; stroke-dasharray: 5 4; }
.m67-dot { fill: #FFFFFF; stroke: var(--signal); stroke-width: 2.5; }
.m67-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m67-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m67-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
/* الحاسوب: الدائرة فوق المنحني في عمود المشهد؛ نحدّ ارتفاع كل منهما ليبقى العمود كله مع القراءات وسطر الحالة ضمن الشاشة */
@media (min-width: 1000px) {
    .m67-lab .m67-main > svg { max-height: calc(var(--lx-h) * 0.62); }
    .m67-lab .m67-chart svg { max-height: calc(var(--lx-h) * 0.46); }
    .m67-lab .lx-stage > .m67-chart { margin-top: 4px; }
}
/* الهاتف: حين يختار الطالب «المنحني» يحلّ محل الدائرة في الجزء المثبّت (بارتفاعه الطبيعي)، وتبقى القراءات السريعة تحته ظاهرة */
@media (max-width: 999px) {
    .m67-lab .lx-stage[data-v="more"] > .m67-main { display: none; }
    .m67-lab .lx-stage[data-v="more"] > .m67-chart.lx-more { position: static; height: auto; margin: 0; }
}
/* 9-7 بعض أنواع الثنائيات: رسوم الدرس ومختبر الثنائيات الأربعة (diodes-lab) */
/* البلورة: المنطقة p دافئة، المنطقة n باردة، منطقة الاستنزاف فاتحة بحد منقّط */
.m68-p { fill: rgba(255, 150, 90, 0.17); }
.m68-n { fill: rgba(100, 165, 255, 0.17); }
.m68-dep { fill: rgba(234, 241, 248, 0.06); stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 4 3; }
.m68-box { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
.m68-metal { fill: #9AA7B6; stroke: var(--ink-soft); stroke-width: 1; }
.m68-el { fill: #7CC7FF; }
.m68-ho { fill: var(--screen); stroke: #FF7A9A; stroke-width: 1.8; }
.m68-ip { fill: #FFB35C; }
.m68-in { fill: #B48CFF; }
.m68-ion-t { fill: #0B2747; font-family: var(--font-mono); font-weight: 700; font-size: 12px; }
.m68-fld { stroke: #FF7A9A; stroke-width: 1.6; fill: none; }
.m68-atom { fill: #5B6B7D; stroke: var(--ink-muted); stroke-width: 1; }
.m68-atom-t { fill: var(--ink); font-family: var(--font-mono); font-weight: 700; font-size: 10px; }
.m68-bond { fill: var(--ink-soft); }
.m68-heat { fill: none; stroke: #FF8A50; stroke-width: 1.6; stroke-linecap: round; }
.m68-flash { fill: none; stroke: var(--signal); stroke-width: 2; }
/* عناصر الدوائر */
.m68-bp { stroke: #FF7A7A; stroke-width: 2.4; }            /* القطب الموجب: خط طويل رفيع أحمر */
.m68-bn { stroke: #7CC7FF; stroke-width: 5.5; }            /* القطب السالب: خط قصير سميك أزرق */
.m68-dsym { fill: var(--ink); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.m68-dbar { stroke: var(--ink); stroke-width: 2.6; }
.m68-res { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.m68-coil { fill: none; stroke: #FFB35C; stroke-width: 1.8; }
.m68-core { stroke: var(--ink-soft); stroke-width: 2; }
.m68-gnd { stroke: var(--ink-soft); stroke-width: 1.6; }
.m68-term { fill: var(--screen); stroke: var(--ink-soft); stroke-width: 1.4; }
.m68-meter { fill: var(--screen); stroke: var(--ink); stroke-width: 1.5; }
.m68-needle { stroke: var(--signal); stroke-width: 2.2; stroke-linecap: round; }
.m68-lamp { fill: #6E7C8C; stroke: var(--ink-soft); stroke-width: 1; }
.m68-beam { fill: rgba(255, 220, 110, 0.24); }
.m68-ph { fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-linejoin: round; }
.m68-lt { stroke: #FF7A7A; stroke-width: 2; }
.m68-cur { stroke: var(--signal); stroke-width: 2.2; fill: none; }
.m68-inw { fill: none; stroke: #4FB8FF; stroke-width: 2; stroke-linejoin: round; }
.m68-outw { fill: none; stroke: #5FD39A; stroke-width: 2.2; stroke-linejoin: round; }
.m68-sun { fill: var(--signal); }
.m68-ray { stroke: var(--signal); stroke-width: 2; stroke-linecap: round; }
.m68-bulb { fill: rgba(var(--signal-rgb), 0.16); stroke: var(--ink-soft); stroke-width: 1.4; }
.m68-fil { fill: none; stroke: var(--signal); stroke-width: 1.4; }
.m68-glow { fill: rgba(var(--signal-rgb), 0.3); }
.m68-cell { fill: #1D3E73; stroke: var(--ink-soft); stroke-width: 1.2; }
.m68-cgrid { stroke: rgba(214, 228, 243, 0.4); stroke-width: 1; }
.m68-seg-off { fill: rgba(234, 241, 248, 0.06); stroke: var(--ink-muted); stroke-width: 1; }
.m68-seg-on { fill: #FF4FA0; stroke: #FF9CCB; stroke-width: 1; }
.m68-scope { fill: #04121F; stroke: var(--line-strong); stroke-width: 1; }
.m68-gridl { stroke: rgba(124, 199, 255, 0.14); stroke-width: 1; }
.m68-zero { stroke: rgba(234, 241, 248, 0.35); stroke-width: 1; stroke-dasharray: 3 3; }
.m68-cond { fill: rgba(var(--ok-rgb), 0.16); }

/* جداول الدرس */
.m68-tab .data-table td, .m68-tab .data-table th { vertical-align: middle; }
.m68-tab .data-table td:first-child { font-weight: 700; color: var(--ink); }
.m68-tab .data-table td.m68-c { text-align: center; font-family: var(--font-mono); direction: ltr; }

/* المختبر */
.m68-lx [hidden] { display: none !important; }
.m68-lx .lx-2d > svg { direction: ltr; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.m68-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0 0 4px; }
.m68-tabs button, .m68-digits button { padding: 7px 4px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink);
    font: inherit; font-size: 0.86rem; font-weight: 700; line-height: 1.35; cursor: pointer; min-width: 0; }
.m68-tabs button:hover, .m68-digits button:hover { background: var(--hover); }
.m68-tabs button.on, .m68-digits button.on { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.m68-tabs bdi { font-family: var(--font-mono); font-weight: 600; }
.m68-digits { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 0 0 6px; direction: ltr; }
.m68-digits button { font-family: var(--font-mono); font-size: 0.95rem; padding: 5px 0; }
.fc-controls .fc-buttons.m68-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m68-btns button { flex: 1 1 40%; padding: 7px 4px; font-size: 0.82rem; min-width: 0; }
.m68-sub { margin: 2px 0 6px; font-size: 0.8rem; color: var(--ink-muted); line-height: 1.6; }
.m68-lx input[type="range"]:disabled { opacity: 0.4; }
.m68-col { display: inline-block; width: 22px; height: 11px; margin-inline-start: 6px; vertical-align: middle; border: 1px solid var(--line-strong); border-radius: 2px; }
@media (max-width: 640px) {
    .m68-tabs button { font-size: 0.8rem; padding: 6px 2px; }
    .fc-controls .fc-buttons.m68-btns button { font-size: 0.78rem; }
}
/* ---------- 10-7 الترانزستور: رسوم الدرس ومختبر transistor-lab ---------- */
/* البلورات: p دافئ و n بارد؛ شدة اللون تدل على نسبة الشوائب (hi عالية، lo قليلة) */
.m69-p { fill: rgba(255, 138, 128, 0.17); stroke: var(--ink-soft); stroke-width: 1.4; }
.m69-p.hi { fill: rgba(255, 138, 128, 0.3); }
.m69-n { fill: rgba(124, 199, 255, 0.17); stroke: var(--ink-soft); stroke-width: 1.4; }
.m69-n.lo { fill: rgba(124, 199, 255, 0.1); }
.m69-p.lo { fill: rgba(255, 138, 128, 0.1); }
.m69-n.hi { fill: rgba(124, 199, 255, 0.3); }
.m69-dep { fill: rgba(4, 12, 24, 0.5); stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 2; }
.m69-hole { fill: var(--screen); stroke: #FF7A9A; stroke-width: 1.6; }
.m69-el { fill: #7CC7FF; }
.m69-flash { fill: none; stroke: var(--signal); stroke-width: 2; }
.m69-cur { stroke: var(--signal); stroke-width: 2.2; fill: none; }
.m69-term { fill: var(--screen); stroke: var(--ink); stroke-width: 1.4; }
.m69-tr { fill: rgba(var(--signal-rgb), 0.08); stroke: var(--ink); stroke-width: 1.5; }
.m69-bar { stroke: var(--ink); stroke-width: 3.6; stroke-linecap: round; fill: none; }
.m69-leg { stroke: var(--ink); stroke-width: 1.9; fill: none; }
.m69-ah { fill: var(--ink); }
.m69-res { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.m69-src { fill: var(--screen); stroke: var(--ink); stroke-width: 1.5; }
.t-label.m69-plus { fill: var(--pos); font-weight: 700; }
.t-label.m69-minus { fill: var(--neg); font-weight: 700; }
.m69-cap { fill: #8A97A8; stroke: var(--ink-muted); stroke-width: 1; }
.m69-band { fill: none; stroke: rgba(var(--signal-rgb), 0.22); stroke-width: 14; stroke-linecap: butt; }
.m69-band.thin { stroke-width: 2.4; stroke: rgba(var(--signal-rgb), 0.45); }
.m69-di { fill: var(--ink); stroke: var(--ink); stroke-width: 1; stroke-linejoin: round; }
.m69-dibar { stroke: var(--ink); stroke-width: 2.6; }
.m69-scr { fill: #0B2A4A; stroke: var(--line-strong); stroke-width: 1.2; }
.m69-grid { stroke: rgba(214, 228, 243, 0.16); stroke-width: 1; }
.m69-trace { fill: none; stroke: #F4F7FB; stroke-width: 2.2; stroke-linejoin: round; }

/* جدول المقارنة بين المضخمين، وجدول الأرباح */
.m69-cmp th, .m69-cmp td { text-align: center; vertical-align: middle; }
.m69-cmp td:first-child { font-weight: 700; color: var(--ink); }

/* ---------- المختبر ---------- */
.m69-lx svg { direction: ltr; }
.m69-scene, .m69-scope { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.m69-scene .m69-wire { stroke: var(--ink-soft); stroke-width: 2; fill: none; }
.m69-scene .m69-curv { font-family: var(--font-mono); font-size: 12.5px; fill: var(--signal); }
.m69-scene .m69-region { transition: fill 0.3s; }
.m69-scene .m69-hlr, .m69-scene .m69-hlb { fill: none; stroke: var(--signal); stroke-width: 2; stroke-dasharray: 5 4; opacity: 0; transition: opacity 0.3s; }
.m69-scene[data-hl="regions"] .m69-hlr, .m69-scene[data-hl="bias"] .m69-hlb { opacity: 1; }
.m69-scope .m69-tin { fill: none; stroke: #F4F7FB; stroke-width: 2; stroke-linejoin: round; }
.m69-scope .m69-tout { fill: none; stroke: var(--signal); stroke-width: 2.2; stroke-linejoin: round; }
.m69-scope .m69-mk { stroke: var(--screen); stroke-width: 1.5; }
.m69-scope .m69-mk.in { fill: #F4F7FB; }
.m69-scope .m69-mk.out { fill: var(--signal); }
.m69-scope .m69-zero { stroke: rgba(214, 228, 243, 0.35); stroke-width: 1; }
.fc-controls .fc-buttons.m69-seg { gap: 6px; margin: 0 0 6px; }
.fc-controls .fc-buttons.m69-seg button { flex: 1 1 40%; padding: 7px 4px; font-size: 0.9rem; min-width: 0; }
.fc-controls .fc-buttons.m69-pre { flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.fc-controls .fc-buttons.m69-pre button { flex: 1 1 28%; padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.m69-seg button.on, .m69-pre button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m69-sub { margin: 2px 0 0; font-size: 0.78rem; color: var(--ink-muted); line-height: 1.6; }
.m69-tbl .m69-w { grid-column: 1 / -1; }
/* الرسمان في عمود المشهد على الحاسوب: البلورات والدائرة فوق شاشتي راسم الذبذبات، وكلاهما مع القراءات وسطر الحالة ضمن ارتفاع الشاشة */
@media (min-width: 1000px) {
    .m69-main, .m69-sc { container-type: inline-size; }
    .m69-lx .lx-2d > svg { max-height: min(calc(var(--lx-h) * 0.7), 57cqw); }
    .m69-lx .lx-stage > .lx-more svg { max-height: min(calc(var(--lx-h) * 0.4), 30cqw); width: 100%; }
}
/* الهاتف: الرسم المختار في المبدّل يظهر وحده في مكانه */
@media (max-width: 999px) {
    .m69-lx .lx-stage[data-v="more"] > .lx-2d { display: none; }
    .m69-lx .lx-stage[data-v="more"] > .lx-more.lx-alt { position: static; height: auto; padding: 0; border: 0; background: none; display: block; }
    .m69-lx .lx-stage > .lx-more svg { max-height: var(--lx-h); }
}
@media (min-width: 641px) { .lx-hud.m69-hud b { margin-left: 0; margin-right: 6px; } }

/* dive lesson css: chapter 8 */
/* ---------- درس 1-8: مقدمة — رسوم الدرس (صفحة الفصل، نماذج الذرة، البصمات، الأهداف، المصطلحات) ومختبر «الغاز المتوهج» (glow-lab) ---------- */
.m70-n { white-space: nowrap; }
.m70-e { fill: #7CC7FF; }
.m70-nuc { fill: #FF8A3D; stroke: #FFD2A8; stroke-width: 1.2; }
.t-label.m70-nt { fill: #3A1600; font-weight: 700; }
.m70-orb { fill: none; stroke: rgba(150, 175, 205, 0.5); stroke-width: 1.1; }
/* صفحة الفصل */
.m70-photo { fill: #050D18; stroke: var(--line); stroke-width: 1; }
.m70-white { fill: none; stroke: #FFFFFF; stroke-width: 3; stroke-linecap: round; }
.m70-prism { fill: rgba(200, 225, 255, 0.16); stroke: rgba(220, 235, 255, 0.85); stroke-width: 1.4; stroke-linejoin: round; }
.m70-inray { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 2.4; }
.m70-ray { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.m70-film { fill: #0B1118; stroke: #3B4A5C; stroke-width: 1; }
.m70-xr { fill: none; stroke: rgba(225, 235, 248, 0.22); stroke-width: 1.2; stroke-dasharray: 3 4; }
.m70-skin { fill: rgba(150, 165, 185, 0.32); }
.m70-bone { fill: rgba(236, 242, 250, 0.9); }
.m70-xtube { fill: rgba(200, 220, 240, 0.18); stroke: #C9D6E4; stroke-width: 1.4; }
.m70-xspot { fill: #E8EEF6; }
.m70-head { fill: #8E99A6; stroke: #D8DFE7; stroke-width: 1.2; }
.m70-head2 { fill: #5C6672; }
.m70-metal { fill: #6E7884; stroke: #B9C3CE; stroke-width: 1.2; }
.m70-seam { stroke: #1D232A; stroke-width: 2.4; }
.m70-beam { stroke: #FF4D4D; stroke-width: 2.4; }
.m70-beamg { stroke: rgba(255, 77, 77, 0.3); stroke-width: 8; stroke-linecap: round; }
.m70-hot { fill: #FFF6D8; stroke: #FFC53D; stroke-width: 2; }
.m70-spark { stroke: #FFD27A; stroke-width: 1.6; stroke-linecap: round; }
.m70-sparkd { fill: #FFE7A8; }
/* نماذج الذرة */
.m70-dalton { fill: #8A7A66; stroke: #C9B79C; stroke-width: 1.4; }
.m70-shine { fill: rgba(255, 255, 255, 0.18); }
.m70-thom { fill: rgba(255, 120, 120, 0.2); stroke: #FF8A80; stroke-width: 1.4; }
.t-label.m70-plus { fill: #FF8A80; font-weight: 700; }
.t-label.m70-minus { fill: #0B2747; font-weight: 700; }
.m70-row4 > .fig-panel { min-width: min(100%, 140px); flex: 1 1 140px; }
.m70-row3 > .fig-panel { min-width: min(100%, 160px); flex: 1 1 160px; }
.m70-row4 .fig-caption, .m70-row3 .fig-caption { font-size: 0.85rem; }
/* البصمات */
.m70-strip { fill: #03080F; stroke: var(--line-strong); stroke-width: 0.8; }
/* الأهداف السلوكية والمصطلحات والجداول */
.m70-goals { margin: 10px 0 14px; padding: 12px 14px 10px; border: 1px solid rgba(var(--signal-rgb), 0.35); border-radius: var(--radius); background: var(--signal-soft); }
.m70-goals-h { margin: 0 0 8px; font-weight: 700; color: var(--ink); }
.m70-goals ol { margin: 0; padding-inline-start: 24px; display: grid; gap: 3px; }
.m70-goals li { color: var(--ink-soft); line-height: 1.75; }
.m70-goals li > span { margin-inline-end: 8px; }
.m70-goals li > a { color: var(--signal); font-family: var(--font-mono); font-size: 0.88rem; white-space: nowrap; unicode-bidi: isolate; margin-inline-end: 4px; }
.m70-terms .data-table { font-size: 0.95rem; }
.m70-terms th:nth-child(3), .m70-terms td:nth-child(3) { text-align: center; white-space: nowrap; }
.m70-terms td:nth-child(2) { text-align: left; }
.m70-terms .en { white-space: normal; }
.m70-terms td a { color: var(--signal); font-family: var(--font-mono); font-size: 0.9rem; }
.m70-models .data-table { font-size: 0.93rem; }
.m70-models td:first-child { font-weight: 700; color: var(--ink); white-space: nowrap; }
@media (max-width: 640px) {
    .m70-terms .data-table, .m70-models .data-table { font-size: 0.85rem; }
    .m70-terms th, .m70-terms td, .m70-models th, .m70-models td { padding: 6px 5px; }
}

/* المختبر */
.m70-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m70-psu { fill: #12305A; stroke: var(--ink-muted); stroke-width: 1.2; }
.t-label.m70-vtxt { fill: var(--signal); font-weight: 600; }
.t-label.m70-tn { fill: #7CC7FF; font-weight: 700; }
.t-label.m70-tp { fill: #FF8A80; font-weight: 700; }
.m70-glass { fill: rgba(190, 215, 240, 0.07); stroke: rgba(220, 235, 250, 0.75); stroke-width: 1.6; }
.m70-tglow { opacity: 0; transition: fill 0.3s; }
.m70-elec { fill: #9AA6B4; stroke: #DCE3EA; stroke-width: 0.8; }
.m70-flash { fill: #FFFFFF; }
.m70-mag { fill: none; stroke: var(--signal); stroke-width: 1.4; stroke-dasharray: 3 2; }
.m70-magl { stroke: rgba(var(--signal-rgb), 0.45); stroke-width: 1; stroke-dasharray: 3 3; }
.m70-zbg { fill: #061325; }
.m70-zring { fill: none; stroke: var(--signal); stroke-width: 1.4; }
.m70-zorb { fill: none; stroke: rgba(150, 175, 205, 0.32); stroke-width: 1; }
.m70-zglow { opacity: 0; }
.m70-ze { fill: #7CC7FF; stroke: #DFF1FF; stroke-width: 1; }
.m70-zfree { fill: #7CC7FF; opacity: 0; }
.m70-zph { color: #FFFFFF; }
.m70-phw { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.m70-pha { fill: currentColor; }
.m70-lbeam { stroke-width: 5; stroke-linecap: round; opacity: 0; }
.m70-prismL { fill: rgba(200, 225, 255, 0.14); stroke: rgba(220, 235, 255, 0.8); stroke-width: 1.2; stroke-linejoin: round; }
.m70-svg .m70-ray { stroke-width: 1; }
.t-label.m70-nmt { fill: var(--ink-soft); }
.m70-mkp { stroke: #FFFFFF; stroke-width: 0.8; }
.fc-controls .fc-buttons.m70-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m70-btns button { flex: 1 1 30%; padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.m70-sel { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--ink-soft); font-size: 0.9rem; }
.m70-sel select { flex: 1; min-width: 0; padding: 5px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--inset); color: var(--ink); font: inherit; font-size: 0.88rem; }
/* ---------- درس 2-8: مستويات الطاقة وأنموذج بور — رسوم الدرس (الأشكال 1–6، المنحدر والدرج، سلّم الطاقة) ومختبر «من ذرة رذرفورد إلى ذرة بور» (bohr-lab) ---------- */
.m71-e { fill: #7CC7FF; stroke: #DFF1FF; stroke-width: 0.8; }
.m71-nuc { fill: #FF8A3D; stroke: #FFD2A8; stroke-width: 1.2; }
.t-label.m71-nt { fill: #3A1600; font-weight: 700; }
.m71-ph { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.m71-sph { fill: rgba(90, 150, 230, 0.13); stroke: rgba(150, 195, 255, 0.55); stroke-width: 1.2; }
.m71-orb { fill: none; stroke: rgba(150, 190, 240, 0.6); stroke-width: 1.2; }
.m71-orb3 { fill: none; stroke: rgba(200, 215, 235, 0.55); stroke-width: 1.3; }
.m71-spiral { fill: none; stroke: rgba(150, 190, 240, 0.55); stroke-width: 1.3; }
.m71-ghost { fill: rgba(124, 199, 255, 0.35); }
.m71-vg { stroke: var(--ink-muted); stroke-width: 1.3; stroke-dasharray: 3 2; }
.m71-v { stroke: var(--signal); stroke-width: 2.4; }
.m71-a { stroke: var(--pos); stroke-width: 2.4; }
.m71-v6 { stroke: var(--pos); stroke-width: 2.4; }
.m71-f { stroke: var(--neg); stroke-width: 2.4; }
.t-label.m71-tpk { fill: var(--pos); font-weight: 700; }
.mo-fig.is-playing .m71-hp { visibility: hidden; }   /* أسماء الأسهم التي تدور مع الإلكترون تُخفى أثناء الحركة */
.m71-strip { fill: #03080F; stroke: var(--line-strong); stroke-width: 0.8; }
.m71-ramp { fill: rgba(150, 175, 205, 0.18); stroke: var(--ink-muted); stroke-width: 1.4; stroke-linejoin: round; }
.m71-ball { fill: var(--signal); stroke: #FFF1C4; stroke-width: 1.2; }
.t-label.m71-tn { fill: #9CC8FF; font-style: italic; }
.m71-lvl { stroke: #D9B45C; stroke-width: 2; }
.m71-gnd { stroke: #D9B45C; stroke-width: 3; }
.m71-zero { stroke: var(--ink-muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.m71-glowc { fill: rgba(var(--signal-rgb), 0.28); stroke: rgba(var(--signal-rgb), 0.7); stroke-width: 1.4; }
.m71-slot { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; }
.m71-big { stroke-width: 1.4; }
.m71-up, .m71-dn { stroke: var(--signal); stroke-width: 2; }
.m71-dash { fill: none; stroke: var(--ink-muted); stroke-width: 1.3; stroke-dasharray: 5 4; }
.m71-rad { stroke: rgba(149, 173, 198, 0.55); stroke-width: 1; stroke-dasharray: 3 3; }
.m71-sw { fill: none; stroke: #7CC7FF; stroke-width: 2.2; }
.m71-row3 > .fig-panel { min-width: min(100%, 110px); flex: 1 1 110px; }
.m71-cmp td:first-child, .m71-post td:first-child { font-weight: 700; color: var(--ink); }
.m71-post td:first-child { text-align: center; font-family: var(--font-mono); }
.m71-sym td:first-child, .m71-sym th:first-child, .m71-sym td:last-child, .m71-sym th:last-child { text-align: center; white-space: nowrap; }
@media (max-width: 640px) { .m71-cmp .data-table, .m71-post, .m71-sym { font-size: 0.86rem; } .m71-post th, .m71-post td, .m71-cmp th, .m71-cmp td { padding: 6px 5px; } }

/* المختبر */
.m71-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m71-aglow { fill: rgba(var(--signal-rgb), 0.22); stroke: rgba(var(--signal-rgb), 0.55); stroke-width: 1.2; }
.m71-lorb { fill: none; stroke: rgba(170, 195, 225, 0.38); stroke-width: 1; }
.m71-spg { fill: none; stroke: rgba(150, 190, 240, 0.22); stroke-width: 1; }
.m71-rph, .m71-pin, .m71-pout { color: #FFFFFF; }
.m71-lpw { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.m71-lpa { fill: currentColor; }
.m71-boom { fill: rgba(255, 220, 140, 0.35); stroke: #FFC53D; stroke-width: 2; }
.m71-le { fill: #7CC7FF; stroke: #E6F4FF; stroke-width: 1.2; }
.m71-zl { stroke: var(--ink-muted); stroke-width: 1.1; stroke-dasharray: 4 3; }
.m71-ll { stroke: #D9B45C; stroke-width: 1.8; }
.m71-ll.g { stroke-width: 3; }
.m71-lup, .m71-ldn { stroke: var(--signal); stroke-width: 2; }
.m71-mk { fill: var(--signal); }
.m71-ld { fill: #7CC7FF; stroke: #E6F4FF; stroke-width: 1; }
.m71-ax { stroke: var(--ink-muted); stroke-width: 1.3; }
.m71-ecurve { fill: none; stroke: #FF8A80; stroke-width: 2.6; stroke-linejoin: round; }
.m71-frm { fill: var(--signal); }
.m71-mid { stroke: var(--line-strong); stroke-width: 1; }
.m71-box { fill: rgba(255, 255, 255, 0.03); stroke: var(--line-strong); stroke-width: 1; transition: fill 0.4s; }
.m71-box.uv.on { fill: rgba(185, 160, 255, 0.28); stroke: #B9A0FF; }
.m71-box.ir.on { fill: rgba(168, 66, 63, 0.35); stroke: #D06A66; }
.m71-box.flash { animation: m71-flash 0.9s ease-out; }
@keyframes m71-flash { 0% { fill: rgba(255, 255, 255, 0.75); } 100% { } }
@media (prefers-reduced-motion: reduce) { .m71-box.flash { animation: none; } }
.fc-controls .fc-buttons.m71-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m71-btns button { flex: 1 1 30%; padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.fc-controls .fc-buttons.m71-btns button:disabled { opacity: 0.5; cursor: default; }
.m71-cr { margin: 4px 0 6px; }
.m71-rs { width: 100%; padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.m71-rs:hover { background: var(--hover); }
.m71-sub { margin: -4px 0 8px; font-size: 0.82rem; color: var(--ink-muted); }
.lx-hud .hk1, .lx-hud .hk2, .lx-hud .hk3, .lx-hud .hk4, .lx-hud .hk5 { color: inherit; }
/* 3-8 طيف ذرة الهيدروجين: رسوم الدرس ومختبر hydrogen-lab */
.m72-lv { stroke: var(--ink-soft); stroke-width: 1.6; }
.m72-lv.g { stroke: var(--ink); stroke-width: 2.4; }
.m72-zero { stroke: var(--ink-muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.m72-e { fill: #7CC7FF; }
.m72-ring { fill: none; stroke: #7CC7FF; stroke-width: 1.6; opacity: 0.75; }
.m72-nuc { fill: #FF7A45; stroke: #FFB35C; stroke-width: 1; }
.m72-orb { fill: none; stroke: var(--ink-muted); stroke-width: 1; opacity: 0.65; }
.m72-dash { stroke: var(--ink-muted); stroke-width: 1.4; stroke-dasharray: 4 3; fill: none; }
.m72-ph { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.m72-need { stroke: var(--signal); stroke-width: 1.4; fill: none; }
.m72-well { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linejoin: round; }
.m72-rail { stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; }
.m72-rung { stroke: var(--ink-soft); stroke-width: 1.6; }
.m72-base { stroke: var(--ink-muted); stroke-width: 1; }
.m72-sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-left: 4px; }
.m72-tab td, .m72-tab th, .m72-etab td, .m72-etab th { text-align: center; vertical-align: middle; }


/* المختبر */
.m72-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m72-lab .m72-lv { stroke-width: 1.4; }
.m72-lab .m72-lv.g { stroke-width: 2.2; }
.m72-lab .m72-lv.on { stroke: var(--signal); }
.m72-strip { fill: #050B14; stroke: var(--line-strong); stroke-width: 1; }
.m72-tk { stroke: var(--ink-muted); stroke-width: 1; }
.m72-cur { fill: var(--signal); }
.fc-controls .fc-buttons.m72-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m72-btns button { padding: 6px 4px; font-size: 0.84rem; min-width: 0; flex: 1 1 auto; }
.fc-controls .fc-buttons.m72-btns button:disabled { opacity: 0.35; cursor: not-allowed; }
.m72-lab .lx-table b bdi { font-family: var(--font-mono); }
@media (max-width: 640px) {
    .m72-tab td, .m72-tab th, .m72-etab td, .m72-etab th { padding: 8px 6px; font-size: 0.92rem; }
}
.m72-nw { white-space: nowrap; }
/* 4-8 الأطياف: رسوم الدرس ومختبر spectroscope-lab */
.m73-dark { fill: #03070D; stroke: var(--line-strong); stroke-width: 0.8; }
.m73-sun { fill: #FFD66B; stroke: #FFB020; stroke-width: 1.2; }
.m73-sunr { stroke: #FFD66B; stroke-width: 2; stroke-linecap: round; }
.m73-white { stroke: #FFFFFF; stroke-width: 3; opacity: 0.9; }
.m73-glass { fill: rgba(150, 210, 255, 0.16); stroke: rgba(190, 225, 255, 0.85); stroke-width: 1.4; stroke-linejoin: round; }
.m73-screen { stroke: var(--ink-soft); stroke-width: 3; }
.m73-box { fill: #2A3A4E; stroke: var(--ink-muted); stroke-width: 1.2; }
.m73-disp { fill: #1A0A0A; stroke: var(--ink-muted); stroke-width: 0.8; }
.m73-sock { fill: #E04848; }
.m73-sock.b { fill: #222; stroke: var(--ink-muted); }
.m73-tube { fill: rgba(200, 225, 255, 0.08); stroke: rgba(200, 225, 255, 0.7); stroke-width: 1.3; }
.m73-el { stroke: var(--ink-soft); stroke-width: 2.4; }
.m73-bar { fill: var(--ink-soft); }
.m73-coll { fill: rgba(124, 199, 255, 0.12); stroke: var(--ink-soft); stroke-width: 1.2; }
.m73-table { fill: rgba(var(--signal-rgb), 0.05); stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.m73-tick { stroke: var(--ink-muted); stroke-width: 1; }
.m73-eye { fill: #F4F7FA; stroke: var(--ink-muted); }
.m73-bulb { fill: rgba(255, 226, 168, 0.18); stroke: #FFE2A8; stroke-width: 1.3; }
.m73-cap { fill: #7D8A9B; }
.m73-fil { fill: none; stroke: #FFC53D; stroke-width: 2; stroke-linejoin: round; }
.m73-atom { fill: #FF8AD8; }
.m73-tab td, .m73-tab th { vertical-align: middle; }
@media (max-width: 640px) {
    .m73-tab td, .m73-tab th { padding: 8px 6px; font-size: 0.92rem; }
}

/* المختبر */
.m73-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m73-lab .m73-beam { stroke-width: 6; opacity: 0.22; stroke-linecap: round; }
.m73-lab .m73-beamf { stroke-width: 2.4; opacity: 0.95; }
.m73-lab .m73-fl { stroke-dasharray: 4 6; stroke-linecap: round; animation: m73-flow 0.8s linear infinite; }
.m73-lab .m73-ef { stroke: #7CC7FF; stroke-width: 2.8; stroke-dasharray: 0.01 7; animation: m73-flow 0.9s linear infinite; }
@keyframes m73-flow { to { stroke-dashoffset: -10; } }
.m73-lab .m73-gas { animation: m73-glow 2.4s ease-in-out infinite; }
@keyframes m73-glow { 50% { opacity: 0.72; } }
.m73-lab.m73-pause .m73-fl, .m73-lab.m73-pause .m73-ef, .m73-lab.m73-pause .m73-gas { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .m73-lab .m73-fl, .m73-lab .m73-ef, .m73-lab .m73-gas { animation: none; } }
.m73-lab .m73-bulb { fill: rgba(255, 226, 168, 0.05); stroke: var(--ink-muted); stroke-width: 1.2; }
.m73-lab .m73-bulb.on { fill: rgba(255, 226, 168, 0.3); stroke: #FFE2A8; }
.m73-lab .m73-fil { stroke: var(--ink-muted); stroke-width: 1.6; }
.m73-lab .m73-fil.on { stroke: #FFD66B; stroke-width: 2.2; }
.m73-led { fill: #3A2222; stroke: var(--ink-muted); stroke-width: 0.8; }
.m73-led.on { fill: #5FD39A; }
.m73-dv { fill: #FF6B6B; }
.m73-eyebg { fill: #02050A; }
.m73-eyer { fill: none; stroke: var(--ink-soft); stroke-width: 2; }
.m73-cross { stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.8; }

.m73-xm, .m73-xm2 { fill: var(--signal); }
.fc-controls .fc-buttons.m73-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m73-btns button { padding: 6px 4px; font-size: 0.84rem; min-width: 0; flex: 1 1 auto; }
.fc-controls .fc-buttons.m73-btns button:disabled { opacity: 0.4; cursor: not-allowed; }
.m73-nw { white-space: nowrap; }
/* ---------- 5-8 انواع الاطياف: رسوم الدرس (f74_) ومختبر الأطياف (spectra-lab) ---------- */
/* الشاشة والطيف: شاشة سوداء، وشريط الطيف بألوان أطواله الموجية */
.m74-scr { fill: #02060C; }
.m74-scrbox { fill: #02060C; stroke: var(--line-strong); stroke-width: 1; }
.m74-frame { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.m74-dark { fill: #02060C; opacity: 0.9; }
/* المقعد الضوئي: حاجز الشق، الموشور الزجاجي، الحزمة، المروحة الملونة */
.m74-plate { fill: #5E6E82; stroke: var(--ink-muted); stroke-width: 1; }
.m74-stand { stroke: var(--ink-muted); stroke-width: 2; }
.m74-beam { stroke: rgba(255, 244, 214, 0.5); stroke-width: 2; }
.m74-glass { fill: rgba(150, 205, 255, 0.18); stroke: rgba(190, 225, 255, 0.75); stroke-width: 1.4; stroke-linejoin: round; }
.m74-wedge, .m74-fan { fill: rgba(255, 255, 255, 0.07); stroke: rgba(255, 255, 255, 0.22); stroke-width: 0.8; }
/* المصادر: نجمة متوهجة، بخار متوهج (برتقالي)، بخار غير متوهج (أزرق باهت)، أنبوبة تفريغ */
.m74-star { fill: #FFD84D; stroke: #FFB020; stroke-width: 1; }
.m74-starc { fill: #FFF6C8; }
.m74-hot { fill: rgba(255, 120, 60, 0.5); stroke: #FF8A50; stroke-width: 1.2; }
.m74-cool, .m74-vap { fill: rgba(150, 200, 255, 0.14); stroke: rgba(170, 215, 255, 0.65); stroke-width: 1.2; }
.m74-atom { fill: #9FB4CC; }
.m74-atom.hot { fill: #FFE0B0; }
.m74-tube, .m74-tglass { fill: none; stroke: rgba(234, 241, 248, 0.6); stroke-width: 1.4; }
.m74-tubeg { fill: rgba(224, 123, 216, 0.75); }
.m74-elec, .m74-tel { fill: #8A97A8; }
.m74-src, .m74-ac { fill: var(--screen); stroke: var(--ink); stroke-width: 1.4; }
/* الذرة: النواة برتقالية، الإلكترون سماوي، المستويات خطوط أفقية */
.m74-ring { fill: none; stroke-width: 2.2; }
.m74-ring.g { stroke: var(--ink-muted); }
.m74-nuc { fill: #FF7043; stroke: #FFB199; stroke-width: 1; }
.m74-e { fill: #7CC7FF; }
.m74-kick { fill: none; stroke: var(--signal); stroke-width: 1.6; }
.m74-lvl { stroke: var(--ink-soft); stroke-width: 2; }
.m74-lvl.thin { stroke-width: 1; opacity: 0.7; }
.m74-jump { stroke-width: 2.2; }
.m74-bandf { fill: rgba(var(--signal-rgb), 0.1); }
.m74-same { stroke: var(--signal); stroke-width: 1.2; stroke-dasharray: 3 3; }
.m74-tab td, .m74-tab th { vertical-align: middle; }
.m74-ol { margin: 0 0 0.6rem; padding-inline-start: 1.4rem; }
.m74-ol li { margin-bottom: 4px; }

/* ---------- مختبر الأطياف ---------- */
.m74-svg, .m74-asvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m74-lab [hidden] { display: none !important; }
.m74-bulb { fill: rgba(255, 246, 214, 0.16); stroke: rgba(234, 241, 248, 0.6); stroke-width: 1.3; }
.m74-coil { fill: none; stroke: #FFF2C0; stroke-width: 2; stroke-linejoin: round; filter: drop-shadow(0 0 3px #FFD27A); }
.m74-base { fill: #8A97A8; }
.m74-tglow { opacity: 0.8; }
.m74-sun { fill: #FFD447; filter: drop-shadow(0 0 6px rgba(255, 200, 80, 0.6)); }
.m74-atm { fill: rgba(255, 180, 90, 0.14); stroke: rgba(255, 190, 110, 0.4); stroke-width: 1; }
.m74-scrbar { fill: #02060C; stroke: var(--line-strong); stroke-width: 1; }
.m74-sbox { fill: #02060C; stroke: var(--line-strong); stroke-width: 1; }
.m74-ph path { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m74-at { fill: #9FB4CC; }
.m74-ag { fill: #FFE6A0; }
.m74-fl { fill: #FFFFFF; }
.m74-sttl { fill: var(--ink-muted); }
.m74-cl1, .m74-cl2 { fill: #EAF1F8; paint-order: stroke; stroke: #02060C; stroke-width: 3px; }
.m74-fltxt { fill: #FFFFFF; font-family: var(--font-mono); font-size: 9px; font-weight: 700; paint-order: stroke; stroke: #02060C; stroke-width: 2.5px; }
.m74-lv { stroke: var(--ink-soft); stroke-width: 1.6; }
.m74-lv.thin { stroke-width: 0.8; opacity: 0.6; }
.m74-brk { fill: none; stroke: var(--ink-muted); stroke-width: 1.2; }
.m74-tr { stroke-width: 2.2; opacity: 0.45; transition: opacity 0.2s, stroke-width 0.2s; }
.m74-tr.on { opacity: 1; stroke-width: 3.4; }
.m74-tr.uv { stroke: #8E7CC3; stroke-dasharray: 4 3; opacity: 0.6; }
.m74-tr + .m74-trh { fill: none; stroke-width: 2; opacity: 0.6; }
.m74-tr.on + .m74-trh { opacity: 1; }
.m74-bandr { fill: rgba(var(--signal-rgb), 0.09); }
.m74-aph path { fill: none; stroke-width: 2; stroke-linecap: round; }
.m74-cap { margin: 0 0 4px; font-size: 0.76rem; color: var(--ink-soft); text-align: center; line-height: 1.6; }
.m74-atomv svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.m74-sub { margin: -2px 0 8px; font-size: 0.8rem; color: var(--ink-muted); }
.fc-controls .fc-buttons.m74-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m74-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.fc-controls .fc-buttons.m74-two button { flex: 1 1 45%; }
.fc-controls .fc-buttons.m74-gas button { flex: 1 1 14%; font-family: var(--font-mono); }
.m74-lab .lx-table .m74-w { grid-column: 1 / -1; }
/* الحاسوب: المقعد والطيف فوق «داخل الذرة» في عمود المشهد، وكلاهما مع القراءات وسطر الحالة ضمن الشاشة */
@media (min-width: 1000px) {
    .m74-lab .m74-main > svg { max-height: calc(var(--lx-h) * 0.64); }
    .m74-lab .m74-atomv svg { max-height: calc(var(--lx-h) * 0.42); }
    .m74-lab .lx-stage > .m74-atomv { margin-top: 4px; }
}
/* الهاتف: «داخل الذرة» يحل محل المقعد في الجزء المثبّت حين يختاره الطالب */
@media (max-width: 999px) {
    .m74-lab .lx-stage[data-v="more"] > .m74-main { display: none; }
    .m74-lab .lx-stage[data-v="more"] > .m74-atomv.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
    .m74-lab .lx-stage > .m74-atomv svg { max-height: calc(var(--lx-h) - 40px); }
}
/* ---------- 6-8 الأشعة السينية: رسوم الدرس (f75_) ومختبر الأنبوبة (xray-lab) ---------- */
/* الإلكترونات سماوية، والأشعة السينية رمادية بيضاء، والنواة برتقالية، والهدف نحاسي اللون */
.m75-e { fill: #7CC7FF; }
.m75-ea { stroke: #7CC7FF; stroke-width: 1.6; }
.m75-glass { fill: rgba(150, 205, 255, 0.07); stroke: rgba(190, 225, 255, 0.6); stroke-width: 1.5; }
.m75-anode { fill: #8C6A4A; stroke: #C9A27A; stroke-width: 1.2; stroke-linejoin: round; }
.m75-face { fill: #C9A27A; }
.m75-tface { stroke: #FFD27A; stroke-width: 2.4; }
.m75-lead { fill: none; stroke: var(--ink-soft); stroke-width: 1.6; }
.m75-fil { fill: none; stroke: #FF9F43; stroke-width: 3; filter: drop-shadow(0 0 3px #FF9F43); }
.m75-xray { fill: none; stroke: #E6ECF4; stroke-width: 1.6; opacity: 0.85; }
.m75-ruler { fill: rgba(255, 255, 255, 0.04); stroke: var(--line-strong); stroke-width: 1; }
.m75-xb { fill: rgba(230, 236, 244, 0.28); }
.m75-uvb { fill: rgba(142, 124, 195, 0.35); }
.m75-area { fill: rgba(255, 107, 90, 0.32); }
.m75-curve { fill: none; stroke: #FF7B6B; stroke-width: 2.2; stroke-linejoin: round; }
.m75-cv { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.m75-c1 { stroke: #7CC7FF; fill: #7CC7FF; }
.m75-c2 { stroke: #5FD39A; fill: #5FD39A; }
.m75-c3 { stroke: #FFC53D; fill: #FFC53D; }
polyline.m75-c1, polyline.m75-c2, polyline.m75-c3, line.m75-c1, line.m75-c2, line.m75-c3 { fill: none; }
.m75-ax { stroke: var(--ink-muted); stroke-width: 1.4; }
.m75-gl { stroke: rgba(150, 190, 235, 0.1); stroke-width: 1; }
.m75-lmin { stroke: var(--signal); stroke-width: 1.4; stroke-dasharray: 4 3; }
.m75-path { fill: none; stroke: rgba(124, 199, 255, 0.45); stroke-width: 1.4; stroke-dasharray: 4 4; }
.m75-nuc { fill: #FF7043; stroke: #FFB199; stroke-width: 1; }
.m75-nucg { fill: rgba(255, 112, 67, 0.12); stroke: rgba(255, 112, 67, 0.35); stroke-width: 1; stroke-dasharray: 3 3; }
.m75-shell { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.8; }
.m75-hole { fill: none; stroke: var(--signal); stroke-width: 1.4; stroke-dasharray: 2 2; }
.m75-metal { fill: #6E7C8E; stroke: var(--ink-muted); stroke-width: 1; }
.m75-src { fill: #3A4A5E; stroke: var(--ink-muted); stroke-width: 1.2; }
.m75-tissue { fill: rgba(255, 170, 150, 0.16); stroke: rgba(255, 170, 150, 0.5); stroke-width: 1.2; }
.m75-bone { fill: #E8E2D0; stroke: #FFFFFF; stroke-width: 1; }
.m75-ray { stroke: rgba(230, 236, 244, 0.3); stroke-width: 1.2; stroke-dasharray: 3 4; }
.m75-film { fill: #1B2430; stroke: var(--line-strong); stroke-width: 1; }
.m75-filmb { fill: #E8EEF6; }
.m75-bagb { fill: rgba(255, 120, 60, 0.22); stroke: #FF9A5C; stroke-width: 1.6; }
.m75-bagh { fill: none; stroke: #FF9A5C; stroke-width: 4; stroke-linejoin: round; }
.m75-obj { fill: rgba(255, 190, 120, 0.3); stroke: #FFC08A; stroke-width: 1.2; }
.m75-obj.hi { fill: rgba(255, 235, 200, 0.7); }
.m75-objl { stroke: #FFE6C8; stroke-width: 1.6; }
.m75-tube { fill: rgba(150, 205, 255, 0.08); stroke: rgba(190, 225, 255, 0.6); stroke-width: 1.4; }
.m75-graph { fill: #3A3F47; stroke: var(--ink-muted); stroke-width: 1.2; }
.m75-tab td, .m75-tab th { vertical-align: middle; }

/* ---------- مختبر الأنبوبة ---------- */
.m75-svg, .m75-csvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m75-window { stroke: #BFE3FF; stroke-width: 4; opacity: 0.7; }
.m75-cup { fill: none; stroke: #8A97A8; stroke-width: 3; }
.m75-coil { fill: none; stroke: #FF9F43; stroke-width: 2.4; stroke-linejoin: round; filter: drop-shadow(0 0 3px #FF9F43); }
.m75-hot { fill: #FF6A2A; filter: drop-shadow(0 0 4px #FF6A2A); }
.m75-fin { stroke: #8C6A4A; stroke-width: 3; }
.m75-le { fill: #7CC7FF; }
.m75-lph path, .m75-lsph path { fill: none; stroke: #E6ECF4; stroke-width: 1.8; stroke-linecap: round; }
.m75-lph.ch path, .m75-lsph.ch path { stroke: #FFF0B8; }
.m75-lheat { fill: #FF9F43; }
.m75-lensc { fill: rgba(7, 26, 48, 0.88); stroke: var(--signal); stroke-width: 1.4; }
.m75-lensl { fill: none; stroke: rgba(var(--signal-rgb), 0.45); stroke-width: 1; stroke-dasharray: 3 3; }
.m75-lt2 { fill: var(--signal); }
.m75-saved { fill: none; stroke: #7CC7FF; stroke-width: 1.8; stroke-dasharray: 5 4; }
.m75-lminS { stroke: #7CC7FF; stroke-width: 1.2; stroke-dasharray: 3 3; }
.m75-svl { fill: #7CC7FF; }
.m75-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m75-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m75-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.fc-controls .fc-buttons.m75-two button { flex: 1 1 45%; }
.fc-controls .fc-buttons.m75-pre button { flex: 1 1 30%; }
.m75-pre button.on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.m75-lab .lx-table .m75-w { grid-column: 1 / -1; }
/* الحاسوب: الأنبوبة فوق منحني الطيف في عمود المشهد، وكلاهما مع القراءات وسطر الحالة ضمن الشاشة */
@media (min-width: 1000px) {
    .m75-lab .m75-main > svg { max-height: calc(var(--lx-h) * 0.6); }
    .m75-lab .m75-chart svg { max-height: calc(var(--lx-h) * 0.48); }
    .m75-lab .lx-stage > .m75-chart { margin-top: 4px; }
}
/* الهاتف: حين يختار الطالب «الطيف» يحل المنحني محل الأنبوبة في الجزء المثبّت */
@media (max-width: 999px) {
    .m75-lab .lx-stage[data-v="more"] > .m75-main { display: none; }
    .m75-lab .lx-stage[data-v="more"] > .m75-chart.lx-more { position: static; height: auto; margin: 0; padding: 0; border: 0; background: none; display: block; }
    .m75-lab .lx-stage > .m75-chart svg { max-height: var(--lx-h); }
}
/* 7-8 تأثير كومبتن: رسوم الدرس ومختبر الاستطارة (compton-lab) — فوتون الأشعة السينية أبيض رمادي، والإلكترون سماوي، والهدف كرافيت رمادي */
.m76-xr { fill: none; stroke: #E6EDF5; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m76-xr.mv { stroke-width: 2.6; }
.m76-xrh { fill: #E6EDF5; }
.m76-e { fill: #7CC7FF; }
.m76-tg { fill: var(--screen); stroke: var(--ink); stroke-width: 1.6; }
.m76-dash { fill: none; stroke: var(--ink-muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.m76-arc { fill: none; stroke: var(--signal); stroke-width: 1.5; }
.m76-flash { fill: none; stroke: #FFE6A0; stroke-width: 2; }
.m76-bw { fill: #F4F7FB; stroke: #9AA7B8; stroke-width: 1.2; }
.m76-bw.ghost { fill: none; stroke: #C3D2E2; stroke-dasharray: 3 3; }
.m76-br { fill: #FF8A80; stroke: #FFB3AC; stroke-width: 1.2; }
.m76-cell { fill: rgba(255, 255, 255, 0.02); stroke: var(--line); stroke-width: 1; }
.m76-grid { stroke: rgba(150, 190, 235, 0.1); stroke-width: 1; }
.m76-curve { fill: none; stroke: var(--signal); stroke-width: 2.6; stroke-linejoin: round; }
.m76-dot { fill: #FFFFFF; stroke: var(--signal); stroke-width: 2.2; }
.m76-barx { fill: rgba(230, 237, 245, 0.85); }
.m76-barv { fill: #5FD39A; }
.m76-plus { fill: var(--signal); }
.m76-ebar { fill: rgba(230, 237, 245, 0.85); }
.m76-kbar { fill: #7CC7FF; }

/* المختبر */
.m76-svg, .m76-gsvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m76-gr { fill: #39414D; stroke: #6B7686; stroke-width: 1.2; }
.m76-c { fill: #59636F; }
.m76-prot { fill: none; stroke: rgba(150, 190, 235, 0.28); stroke-width: 1.2; stroke-dasharray: 2 4; }
.m76-tick { stroke: rgba(150, 190, 235, 0.45); stroke-width: 1.2; }
.m76-det { fill: #4C5A6B; stroke: var(--ink-soft); stroke-width: 1.2; }
.m76-path { fill: none; stroke: rgba(230, 237, 245, 0.3); stroke-width: 1.2; stroke-dasharray: 4 4; }
.m76-epath { fill: none; stroke: rgba(124, 199, 255, 0.45); stroke-width: 1.2; stroke-dasharray: 4 4; }
.m76-pv { stroke-width: 3; stroke-linecap: round; fill: none; }
.m76-pv.pin, .m76-pv.pout { stroke: var(--signal); }
.m76-pv.pe { stroke: #7CC7FF; }
.m76-pah { fill: var(--signal); }
.m76-pah.e { fill: #7CC7FF; }
.m76-cap-t { margin: 0 0 4px; font-size: 0.8rem; color: var(--ink-soft); text-align: center; }
.m76-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m76-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m76-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
@media (min-width: 1000px) {
    .m76-lab .m76-main > svg { max-height: calc(var(--lx-h) * 0.76); }
    .m76-lab .m76-chart svg { max-height: calc(var(--lx-h) * 0.32); }
    .m76-lab .lx-stage > .m76-chart { margin-top: 4px; }
}
@media (max-width: 999px) {
    .m76-lab .lx-stage[data-v="more"] > .m76-main { display: none; }
    .m76-lab .lx-stage[data-v="more"] > .m76-chart.lx-more { position: static; height: auto; margin: 0; }
}
/* 8-8 الليزر والميزر: رسوم الدرس ومختبر الحروف (maser-laser-lab) — الذرة المتهيجة تتوهج، وضوء ليزر الياقوت أحمر، والموجات الدقيقة رمادية زرقاء (غير مرئية) */
.m77-tile { fill: rgba(255, 255, 255, 0.04); stroke: var(--line-strong); stroke-width: 1.2; }
.m77-tile.diff { fill: rgba(var(--signal-rgb), 0.1); stroke: var(--signal); }
.m77-L { fill: #FF6B6B; font-weight: 700; }
.m77-atombox { fill: rgba(255, 255, 255, 0.03); stroke: var(--line); stroke-width: 1; }
.m77-lv { stroke: var(--ink-soft); stroke-width: 2; }
.m77-el { fill: #7CC7FF; }
.m77-glow { fill: rgba(255, 170, 80, 0.16); stroke: rgba(255, 190, 110, 0.45); stroke-width: 1; }
.m77-tube { fill: rgba(255, 120, 120, 0.05); stroke: var(--line-strong); stroke-width: 1.2; }
.m77-atom { fill: #6B7686; stroke: #95A3B5; stroke-width: 1.2; }
.m77-atom.on { fill: #FFB35C; stroke: #FFE0A8; }
.m77-r0 { fill: #4A5D7A; } .m77-r1 { fill: #6E86A8; } .m77-r2 { fill: #8E5A5A; } .m77-r4 { fill: #7A5AA8; } .m77-r5 { fill: #9AA7B8; }
.m77-mk { stroke-width: 1.4; } .m77-mk.m77-tmaser, .m77-mkd.m77-tmaser { stroke: #9FB4CC; fill: #9FB4CC; } .m77-mk.m77-tlaser, .m77-mkd.m77-tlaser { stroke: #FF6B6B; fill: #FF6B6B; }
.t-ar.m77-tmaser { fill: #BFD0E4; } .t-ar.m77-tlaser { fill: #FF8A80; }
.m77-brace { fill: none; stroke: var(--signal); stroke-width: 1.4; }
.m77-node { fill: var(--screen); stroke: var(--signal); stroke-width: 2; }

/* المختبر */
.m77-svg, .m77-ssvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m77-ltile { fill: rgba(255, 255, 255, 0.04); stroke: var(--line-strong); stroke-width: 1.2; transition: fill 0.2s, stroke 0.2s; }
.m77-ltile.on { fill: rgba(var(--signal-rgb), 0.18); stroke: var(--signal); stroke-width: 2; }
.m77-lt { fill: var(--ink); font-family: var(--font-mono); font-weight: 700; }
.m77-lt.first { fill: #FF6B6B; }
.m77-mir { fill: #C9D3DE; stroke: #EEF3F8; stroke-width: 1; }
.m77-mir.part { fill: rgba(201, 211, 222, 0.45); stroke-dasharray: 3 2; }
.m77-ph { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.m77-ring { fill: none; stroke: #FFE6A0; stroke-width: 1.8; }
.m77-beam { stroke-width: 6; stroke-linecap: round; opacity: 0.35; }
.m77-wtxt tspan.on { fill: var(--signal); font-weight: 700; }
.m77-cap-t { margin: 0 0 4px; font-size: 0.8rem; color: var(--ink-soft); text-align: center; }
.m77-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.fc-controls .fc-buttons.m77-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m77-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.fc-controls .fc-buttons.m77-let { direction: ltr; }
.fc-controls .fc-buttons.m77-let button { font-family: var(--font-mono); font-weight: 700; font-size: 1rem; min-width: 0; padding: 6px 2px; }
@media (min-width: 1000px) {
    .m77-lab .m77-main > svg { max-height: calc(var(--lx-h) * 0.7); }
    .m77-lab .m77-chart svg { max-height: calc(var(--lx-h) * 0.3); }
    .m77-lab .lx-stage > .m77-chart { margin-top: 4px; }
}
@media (max-width: 999px) {
    .m77-lab .lx-stage[data-v="more"] > .m77-main { display: none; }
    .m77-lab .lx-stage[data-v="more"] > .m77-chart.lx-more { position: static; height: auto; margin: 0; }
}
.m77-phrase { margin: 4px 0 12px; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; direction: ltr; font-family: var(--font-mono); font-size: 0.92rem; color: var(--signal); overflow-wrap: anywhere; }
.m77-tab td, .m77-tab th { text-align: center; vertical-align: middle; }
.m77-en { unicode-bidi: isolate; direction: ltr; }   /* عبارة إنجليزية طويلة داخل نص عربي: تنقسم بين سطرين عند الحاجة */
.lx-table.sim-table b.r-full { overflow-wrap: normal; word-break: normal; font-size: 0.8rem; direction: ltr; text-align: left; }
/* 9-8 خصائص أشعة الليزر: رسوم الدرس ومختبر الخصائص (props-lab) — المصباح الاعتيادي أصفر دافئ، والليزر بلون طوله الموجي */
.m78-pane { fill: #0F3A2C; stroke: var(--line); stroke-width: 1; }
.m78-pane.wine { fill: #3A1630; }
.m78-wv { fill: none; stroke: #FFD34D; stroke-width: 2; stroke-linecap: round; }
.m78-bulbf { fill: rgba(255, 211, 77, 0.22); stroke: #FFD34D; stroke-width: 1.6; }
.m78-arr { stroke: #E9EEF4; stroke-width: 1.6; fill: none; }
.m78-lboxf { fill: #F2D9B8; stroke: #C9A97E; stroke-width: 1; }
.m78-earth { fill: #2E6FB5; stroke: #8EC0F0; stroke-width: 1.2; }
.m78-moonf { fill: #B9BFC8; stroke: #E4E8EE; stroke-width: 1; }
.m78-ospot { fill: rgba(255, 211, 77, 0.18); stroke: #FFD34D; stroke-width: 1.4; stroke-dasharray: 4 3; }
.m78-cone2 { fill: rgba(255, 211, 77, 0.08); stroke: rgba(255, 211, 77, 0.45); stroke-width: 1; }
.m78-hand { fill: #2B2F36; stroke: #59606B; stroke-width: 1.2; }
.m78-grid { stroke: rgba(150, 190, 235, 0.1); stroke-width: 1; }

/* المختبر */
.m78-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m78-lane { fill: rgba(255, 255, 255, 0.025); stroke: var(--line); stroke-width: 1; }
.m78-bulb { fill: rgba(255, 211, 77, 0.25); stroke: #FFD34D; stroke-width: 1.6; }
.m78-fil { fill: none; stroke: #FFE9A0; stroke-width: 1.4; }
.m78-cap { fill: #7D8A9B; }
.m78-lbox { fill: #F2D9B8; stroke: #C9A97E; stroke-width: 1; }
.m78-prism { fill: rgba(190, 220, 255, 0.14); stroke: #BFD6EE; stroke-width: 1.4; stroke-linejoin: round; }
.m78-beam { stroke: #FFF6D8; stroke-width: 3; opacity: 0.8; }
.m78-lbeam { stroke-width: 2.4; opacity: 0.9; }
.m78-lray { stroke-width: 2; opacity: 0.9; }
.m78-scr { fill: #05101E; stroke: var(--line-strong); stroke-width: 1; }
.m78-w { fill: none; stroke-width: 1.6; opacity: 0.85; }
.m78-res { fill: none; stroke: #FFE9A0; stroke-width: 2.4; stroke-linejoin: round; }
.m78-axis { stroke: var(--ink-muted); stroke-width: 1; opacity: 0.6; }
.m78-ray { stroke: #FFE9A0; stroke-width: 1.5; }
.m78-cone { fill: rgba(255, 211, 77, 0.07); stroke: rgba(255, 211, 77, 0.35); stroke-width: 1; }
.m78-moon { fill: rgba(185, 191, 200, 0.18); stroke: #C9D0DA; stroke-width: 1.2; stroke-dasharray: 4 3; }
.m78-spot.o { fill: rgba(255, 211, 77, 0.22); stroke: #FFD34D; stroke-width: 1.2; }
.m78-spot.o.dim { fill: rgba(255, 211, 77, 0.12); }
.m78-mark { fill: none; stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 2 2; }
.m78-star { stroke: #FFFFFF; stroke-width: 1.5; }
.m78-glare { stroke-width: 1.4; opacity: 0.8; }
.m78-ibar.o { fill: #FFD34D; }
.m78-ibar.l { fill: #FF8A80; }
.m78-dot { visibility: hidden; }
.lx-hud .m78-hl { font-style: normal; }
.m78-tl { display: inline; }
.fc-controls .fc-buttons.m78-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m78-btns button { padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
@media (min-width: 1000px) {
    .m78-lab .m78-main > svg { max-height: calc(var(--lx-h) * 0.98); }
}
/* 10-8 الية عمل الليزر: رسوم الدرس (f79_…) ومختبر الفوتون (emission-lab) */
/* المستويات خطوط أفقية، والإلكترون نقطة سماوية، والذرة المتهيجة تتوهج، والفوتون موجة ملونة بلون طوله الموجي */
.m79-lv { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.m79-lv.thin { stroke-width: 1.8; }
.m79-e { fill: #7CC7FF; }
.m79-e.ghost { fill: none; stroke: #7CC7FF; stroke-width: 1.4; stroke-dasharray: 2 2; opacity: 0.7; }
.m79-wv { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.m79-wv.thick { stroke-width: 2.6; }
.m79-box { fill: none; stroke: var(--ink-muted); stroke-width: 1.2; }
.m79-cell { fill: rgba(120, 160, 220, 0.06); stroke: var(--ink-muted); stroke-width: 1.2; }
.m79-big { fill: rgba(255, 179, 92, 0.85); stroke: var(--ink-soft); stroke-width: 1.2; }
.m79-step { fill: #F2994A; }
.m79-step-t { fill: var(--signal-ink); font-family: var(--font-body); font-weight: 700; }
.m79-ax { fill: rgba(255, 140, 90, 0.2); stroke: #FF8A5C; stroke-width: 1.6; }
.m79-ax.cold { fill: rgba(255, 255, 255, 0.03); stroke: var(--ink-muted); stroke-width: 1.2; }
.m79-axt { fill: var(--ink); font-family: 'Times New Roman', serif; font-style: italic; font-weight: 700; }
.m79-halo { opacity: 0.55; }
.m79-up-f { stroke: var(--signal); stroke-width: 2.2; fill: none; }
.m79-brace { fill: none; stroke: var(--ink-muted); stroke-width: 1.2; }
.m79-ok { fill: var(--ok); }
.m79-bad { fill: var(--bad); }
.m79-tab td, .m79-tab th { vertical-align: middle; }
.m79-en { margin: 0 0 10px; text-align: center; font-family: var(--font-mono); font-size: 0.9rem; color: var(--ink); }
.m79-lab bdi { white-space: nowrap; }
@media (max-width: 480px) { .m79-tab th, .m79-tab td { padding-inline: 5px; font-size: 0.86rem; } }

/* المختبر */
.m79-svg { direction: ltr; user-select: none; -webkit-user-select: none; --m79-ph: rgb(255, 60, 0); }
.m79-atom { fill: rgba(255, 255, 255, 0.025); stroke: var(--ink-muted); stroke-width: 1.2; }
.m79-glow { opacity: 0; transition: opacity 0.35s; }
.m79-one.is-ex .m79-glow { opacity: 1; }
.m79-dim { stroke: var(--ink-muted); stroke-width: 1; }
.m79-dh { fill: var(--ink-muted); }
.m79-up, .m79-dn { stroke: var(--signal); stroke-width: 2.4; transition: opacity 0.3s; }
.m79-ah { fill: var(--signal); }
.m79-ev { fill: var(--signal); font-weight: 700; transition: opacity 0.4s; }
.m79-hd { stroke: none; }
.m79-ray { stroke-width: 1.2; stroke-dasharray: 3 5; opacity: 0.4; }
.m79-med { fill: rgba(120, 160, 220, 0.05); stroke: var(--ink-muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.m79-axis { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 7 5; opacity: 0.55; }
.m79-a .c { fill: rgba(255, 255, 255, 0.03); stroke: var(--ink-muted); stroke-width: 1; }
.m79-a .gl { fill: var(--m79-ph); opacity: 0; transition: opacity 0.3s; }
.m79-a.on .gl { opacity: 0.5; }
.m79-a.on .c { stroke: var(--ink-soft); }
.m79-a line { stroke: var(--ink-soft); stroke-width: 1.2; }
.m79-a .du, .m79-a .dd { fill: #7CC7FF; }
.m79-a .du { opacity: 0; }
.m79-a.on .du { opacity: 1; }
.m79-a.on .dd { opacity: 0; }
.m79-burst { fill: none; stroke: #FFE6A0; stroke-width: 2; }
.m79-burst.dim { stroke: var(--ink-muted); }
.m79-hl { font-style: normal; }
.m79-lab .fc-buttons.m79-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.m79-lab .fc-buttons.m79-btns button { padding: 7px 6px; font-size: 0.84rem; min-width: 0; }
.m79-lab .fc-buttons.m79-btns button[hidden], .m79-lab .lx-sl[hidden], .m79-lab .fc-check[hidden], .m79-lab .fc-buttons[hidden] { display: none; }
/* 11-8 توزيع بولتزمان والتوزيع المعكوس: رسوم الدرس (f710_…) ومختبر بولتزمان (boltzmann-lab) */
.m710-lv { stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.m710-lv.green { stroke: #5FD39A; }
.m710-lv3 { stroke: var(--ink-muted); stroke-width: 1.6; stroke-dasharray: 6 4; }
.m710-at { fill: #FF8A5C; }
.m710-at.cold { fill: #FF8A5C; opacity: 0.9; }
.m710-ax { stroke: var(--ink-muted); stroke-width: 1.4; fill: none; }
.m710-ah { fill: var(--ink-muted); }
.m710-bar { fill: var(--ink); opacity: 0.85; }
.m710-bar.inv { fill: var(--signal); opacity: 1; }
.m710-curve, .m710-curve8 { fill: none; stroke: #7CC7FF; stroke-width: 1.8; stroke-dasharray: 5 4; }
.m710-sep { stroke: var(--line); stroke-width: 1; }
.m710-pump { stroke: #B48CFF; stroke-width: 3; }
.m710-pah { fill: #B48CFF; }
.m710-pt { fill: #B48CFF; font-weight: 700; }
.m710-fast { stroke: var(--ink-muted); stroke-width: 1.4; stroke-dasharray: 3 3; }
.m710-ph { fill: none; stroke: rgb(255, 60, 0); stroke-width: 1.8; stroke-linecap: round; }
.m710-l8 { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.m710-en { fill: #FF8A80; }
.m710-c8 { fill: var(--ink-soft); }
.m710-cell { fill: rgba(255, 255, 255, 0.03); stroke: var(--ink-muted); stroke-width: 1.2; }
.m710-svg, .m710-csvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m710-cap { margin: 0 0 4px; font-size: 0.8rem; color: var(--ink-soft); text-align: center; }
.m710-gl { stroke: rgba(150, 190, 235, 0.1); stroke-width: 1; }
.m710-c1 { fill: none; stroke: var(--signal); stroke-width: 2.4; stroke-linejoin: round; }
.m710-c2 { fill: none; stroke: #7CC7FF; stroke-width: 2; stroke-dasharray: 5 4; }
.m710-tc1 { fill: var(--signal); }
.m710-tc2 { fill: #7CC7FF; }
.m710-one { stroke: var(--bad); stroke-width: 1.4; stroke-dasharray: 6 4; }
.m710-tone { fill: var(--bad); }
.m710-room { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.m710-dot { fill: #FFFFFF; stroke: var(--signal); stroke-width: 2.5; }
.m710-dot.hot { fill: var(--signal); stroke: #FFFFFF; stroke-width: 1.5; }
.m710-chart svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.m710-hl { font-style: normal; }
.m710-lab bdi { white-space: nowrap; }
.m710-lab .fc-buttons.m710-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.m710-lab .fc-buttons.m710-btns button { padding: 7px 6px; font-size: 0.84rem; min-width: 0; }
.m710-lab [data-show][hidden] { display: none; }
.m710-tab td, .m710-tab th { text-align: center; vertical-align: middle; }
@media (max-width: 480px) { .m710-tab th, .m710-tab td { padding-inline: 5px; font-size: 0.86rem; } }
/* الحاسوب: المستويات فوق المخطط في عمود المشهد */
@media (min-width: 1000px) {
    .m710-lab .m710-main > svg { max-height: calc(var(--lx-h) * 0.64); }
    .m710-lab .m710-chart svg { max-height: calc(var(--lx-h) * 0.4); }
    .m710-lab .lx-stage > .m710-chart { margin-top: 4px; }
}
/* الهاتف: «المخطط» يحل محل المستويات في الجزء المثبّت */
@media (max-width: 999px) {
    .m710-lab .lx-stage[data-v="more"] > .m710-main { display: none; }
    .m710-lab .lx-stage[data-v="more"] > .m710-chart.lx-more { position: static; height: auto; margin: 0; }
}
/* 12-8 مكونات جهاز الليزر: رسوم الدرس */
.m711-ph { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m711-train { fill: none; stroke-width: 1.3; stroke-linejoin: round; }
.m711-a0 { fill: #7D93AE; }
.m711-ax { fill: #FFB35C; }
.m711-halo { fill: rgba(255, 179, 92, 0.24); }
.m711-halo2 { fill: rgba(255, 210, 140, 0.45); }
.m711-mir { fill: #C9D3DE; stroke: #EAF1F8; stroke-width: 1; }
.m711-mirp { fill: rgba(201, 211, 222, 0.3); stroke: #C9D3DE; stroke-width: 1.3; stroke-dasharray: 4 3; }
.m711-med { fill: rgba(235, 70, 90, 0.42); stroke: #FF8A80; stroke-width: 1.2; }
.m711-med36 { fill: rgba(200, 214, 232, 0.13); stroke: var(--ink-muted); stroke-width: 1; }
.m711-rod { fill: rgba(255, 92, 130, 0.2); stroke: rgba(255, 150, 175, 0.75); stroke-width: 1.2; }
.m711-rod2 { fill: rgba(200, 214, 232, 0.1); stroke: var(--ink-muted); stroke-width: 1.1; }
.m711-glass { fill: rgba(170, 205, 255, 0.06); stroke: var(--ink-muted); stroke-width: 1.3; }
.m711-pbox { fill: #E3B03A; stroke: var(--signal); stroke-width: 1.2; }
.m711-parr { fill: rgba(var(--signal-rgb), 0.62); stroke: var(--signal); stroke-width: 1; stroke-linejoin: round; }
.m711-hollow { fill: none; stroke: var(--signal); stroke-width: 1.3; stroke-linejoin: round; }
.m711-axis { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 6 4; }
.m711-lev { stroke: var(--ink); stroke-width: 2; }
.m711-lamp { fill: none; stroke: #DCE7FF; stroke-width: 2.4; stroke-linecap: round; }
.m711-lampb { fill: none; stroke: rgba(220, 231, 255, 0.32); stroke-width: 2.2; stroke-linecap: round; }
.m711-lab .m711-lampb { stroke: rgba(220, 231, 255, 0.2); stroke-width: 1.6; }
.m711-lampf { fill: none; stroke: #FFFFFF; stroke-width: 4.2; stroke-linecap: round; }
.m711-tube { fill: rgba(220, 231, 255, 0.12); stroke: #DCE7FF; stroke-width: 1.6; }
.m711-tubef { fill: #F4F8FF; }
.m711-term { fill: var(--ink-soft); }
.m711-el { fill: #A9B7C8; stroke: var(--ink-soft); stroke-width: 0.8; }
.m711-e { fill: #7CC7FF; }
.m711-ev { stroke: #7CC7FF; stroke-width: 2; fill: none; }
.m711-hv { fill: var(--inset); stroke: var(--ink-muted); stroke-width: 1.2; }
.m711-ray { stroke: #FF3B3B; stroke-width: 2; }
.m711-pipe { fill: none; stroke: var(--ink-muted); stroke-width: 1.4; }
.m711-ra { fill: #C8F06A; }
.m711-rb { fill: #EAF1F8; }
.m711-burst { fill: #FFE07A; stroke: #FFF4CF; stroke-width: 0.8; }
.t-label.m711-tp, .t-ar.m711-tp { fill: #FF8A80; font-weight: 700; }
.t-label.m711-tn, .t-ar.m711-tn { fill: #7CC7FF; font-weight: 700; }
.t-ar.m711-tw { fill: #FFFFFF; font-weight: 700; }
.t-ar.m711-tdk { fill: #2B2000; font-weight: 700; }
.m711-ol { margin: 0 0 14px; padding-inline-start: 22px; line-height: 1.95; }
.m711-ol li { margin-bottom: 4px; }
.m711-cmp td, .m711-cmp th { vertical-align: middle; }
/* 12-8 مختبر الفوتون: ركّب ليزراً (build-laser-lab) — ثلاث طبقات فوق بعضها: SVG خلفي، ولوح canvas، وSVG أمامي */
.m711-box { position: relative; width: 100%; max-width: calc(var(--lx-h) * 380 / 236); aspect-ratio: 380 / 236; margin-inline: auto; }
.m711-box > svg, .m711-box > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; direction: ltr; user-select: none; -webkit-user-select: none; }
.m711-box > .m711-front { pointer-events: none; }
.m711-chartbox { position: relative; width: 100%; max-width: calc(var(--lx-h) * 0.36 * 380 / 128); aspect-ratio: 380 / 128; margin-inline: auto; }
.m711-chartbox > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.m711-cap-t { margin: 0 0 4px; font-size: 0.78rem; color: var(--ink-soft); text-align: center; }
.m711-mir0 { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.6; }
.m711-empty { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 5 4; }
.m711-dye { fill: rgba(255, 170, 60, 0.16); }
.m711-gas { fill: rgba(255, 120, 90, 0.07); }
.m711-sheet { fill: rgba(80, 230, 90, 0.22); transition: opacity 0.3s; }
.m711-plbox { fill: #1E5B2E; stroke: #5FD39A; stroke-width: 1.2; }
.m711-lab .m711-lf { opacity: 0.32; stroke-width: 1.8; }
.m711-lab .m711-lf.lit { opacity: 0.62; stroke: #F4F8FF; animation: m711-flick 0.9s steps(3) infinite; }
@keyframes m711-flick { 0% { opacity: 0.62; } 33% { opacity: 0.38; } 66% { opacity: 0.55; } 100% { opacity: 0.62; } }
@media (prefers-reduced-motion: reduce) { .m711-lab .m711-lf.lit { animation: none; } }
.lx-ctl .fc-buttons.m711-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.lx-ctl .fc-buttons.m711-btns.m711-one { grid-template-columns: minmax(0, 1fr); }
.lx-ctl .fc-buttons.m711-btns button { padding: 6px 4px; font-size: 0.86rem; line-height: 1.4; min-width: 0; }
@media (min-width: 1000px) {
    .m711-lab .lx-stage .m711-box { max-width: calc(var(--lx-h) * 0.6 * 380 / 236); }
}
@media (max-width: 999px) {
    .m711-lab .lx-stage > .m711-more .m711-chartbox { max-width: calc((var(--lx-h) - 64px) * 380 / 128); }
}
/* 13-8 منظومات مستويات الليزر: رسوم الدرس (الألوان كما في الشكلين 38 و39) */
.m712-lev { stroke: var(--ink); stroke-width: 2.2; }
.m712-pump { stroke: #5B8CFF; stroke-width: 4; }
.m712-pump-h { fill: #5B8CFF; }
.m712-fast { stroke: #F2913A; stroke-width: 4; }
.m712-fast-h { fill: #F2913A; }
.m712-las { stroke: #FF4747; stroke-width: 4; }
.m712-las-h { fill: #FF4747; }
.m712-ph { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.m712-heat { fill: none; stroke: #F2913A; stroke-width: 1.8; stroke-linejoin: round; }
.m712-e { fill: #7CC7FF; }
.m712-eg { fill: rgba(124, 199, 255, 0.28); }
.m712-a0 { fill: #7D93AE; }
.m712-ax { fill: #FFB35C; }
.m712-halo { fill: rgba(255, 179, 92, 0.25); }
.m712-ax2 { stroke: var(--ink-muted); stroke-width: 1.2; }
.m712-bu { fill: #FFB35C; }
.m712-bl { fill: #7D93AE; }
.m712-bo { fill: rgba(150, 175, 205, 0.45); }
.m712-cmp td, .m712-cmp th { vertical-align: middle; }
.m712-ol { margin: 0 0 14px; padding-inline-start: 22px; line-height: 1.95; }
.m712-ol li { margin-bottom: 4px; }
/* 13-8 مختبر الفوتون: منظومات المستويات (levels-system-lab) — SVG ثابت تحته لوح canvas للذرات والفوتونات */
.m712-box { position: relative; width: 100%; max-width: calc(var(--lx-h) * 400 / 250); aspect-ratio: 400 / 250; margin-inline: auto; }
.m712-box > svg, .m712-box > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; direction: ltr; user-select: none; -webkit-user-select: none; }
.m712-chartbox { position: relative; width: 100%; max-width: calc(var(--lx-h) * 0.36 * 380 / 150); aspect-ratio: 380 / 150; margin-inline: auto; }
.m712-chartbox > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.m712-cap-t { margin: 0 0 4px; font-size: 0.78rem; color: var(--ink-soft); text-align: center; }
.lx-ctl .fc-buttons.m712-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.lx-ctl .fc-buttons.m712-btns.m712-one { grid-template-columns: minmax(0, 1fr); }
.lx-ctl .fc-buttons.m712-btns button { padding: 6px 4px; font-size: 0.86rem; line-height: 1.4; min-width: 0; }
@media (min-width: 1000px) {
    .m712-lab .lx-stage .m712-box { max-width: calc(var(--lx-h) * 0.6 * 400 / 250); }
}
@media (max-width: 999px) {
    .m712-lab .lx-stage > .m712-more .m712-chartbox { max-width: calc((var(--lx-h) - 64px) * 380 / 150); }
}
.m712-bar0 { stroke: var(--line-strong); stroke-width: 1; }
.t-ar.m712-tpump { fill: #7FA6FF; font-weight: 700; }
/* 14-8 انواع الليزر: رسوم الدرس ومختبر أنواع الليزر (laser-types-lab) */
/* المرآتان: العاكسة كلياً فضية، والعاكسة جزئياً شبه شفافة بحد متقطع */
.m713-mf { fill: #C9D3DE; stroke: #F2F6FA; stroke-width: 0.8; }
.m713-mp { fill: rgba(201, 211, 222, 0.38); stroke: #C9D3DE; stroke-width: 1; stroke-dasharray: 3 2; }
/* الأوساط الفعالة */
.m713-ruby { fill: rgba(224, 40, 80, 0.3); stroke: #FF5C7A; stroke-width: 1.3; }
.m713-ndc { fill: rgba(190, 160, 255, 0.16); stroke: #C8B4FF; stroke-width: 1.3; }
.m713-host { fill: rgba(234, 241, 248, 0.3); }
.m713-cr { fill: #FF4D6A; }
.m713-tube { fill: rgba(150, 200, 255, 0.07); stroke: rgba(200, 225, 250, 0.7); stroke-width: 1.4; }
.m713-he { fill: #B8C4D2; }
.m713-ne { fill: #FF9A4D; }
.m713-dyec { fill: rgba(255, 150, 70, 0.18); stroke: #FFB27A; stroke-width: 1.3; }
.m713-mol { fill: #FF8C5A; opacity: 0.85; }
.m713-flowc { fill: rgba(170, 220, 160, 0.07); stroke: rgba(200, 235, 190, 0.6); stroke-width: 1.3; }
.m713-p { fill: rgba(255, 150, 90, 0.17); }
.m713-n { fill: rgba(100, 165, 255, 0.17); }
.m713-act { fill: rgba(255, 90, 90, 0.32); }
.m713-chip { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
.m713-face { stroke: #E3EAF2; stroke-width: 3.2; }
.m713-facep { stroke: rgba(227, 234, 242, 0.55); stroke-width: 3; stroke-dasharray: 3 2; }
.m713-metal { fill: #9AA7B6; }
/* الجسيمات والإلكترونات والفجوات */
.m713-e, .m713-el { fill: #7CC7FF; }
.m713-hole { fill: none; stroke: #FF7A9A; stroke-width: 1.8; }
.m713-burst { fill: #FFE6A0; }
.m713-kr { fill: rgba(120, 200, 255, 0.25); stroke: #8FD0FF; stroke-width: 1.5; }
.m713-f { fill: rgba(170, 255, 140, 0.25); stroke: #A8F08C; stroke-width: 1.5; }
.m713-glow { fill: rgba(190, 150, 255, 0.28); stroke: #B28CFF; stroke-width: 1.2; stroke-dasharray: 3 2; }
.m713-d, .m713-dd { fill: #E8EEF5; }
.m713-fl { fill: #C8F07A; }
.m713-dglow { fill: rgba(255, 236, 150, 0.32); }
.m713-o { fill: #FF7B7B; }
.m713-c { fill: #8D98A6; }
.m713-ng { fill: rgba(120, 200, 255, 0.3); stroke: #8FD0FF; stroke-width: 1.3; }
.m713-hal { fill: rgba(170, 255, 140, 0.35); stroke: #A8F08C; stroke-width: 1.2; }
.m713-react { fill: #B9C9DA; }
/* أجزاء الأجهزة */
.m713-lv { stroke: var(--ink); stroke-width: 2; }
.m713-dn { stroke: #FF7A9A; stroke-width: 2; }
.m713-lamp { fill: none; stroke: #FFF2B8; stroke-width: 2.2; }
.m713-lampb { fill: none; stroke: rgba(255, 242, 184, 0.32); stroke-width: 2; }
.m713-flash { fill: rgba(255, 250, 220, 0.35); }
.m713-lglow { fill: rgba(255, 248, 210, 0.42); }
.m713-box { fill: #12355E; stroke: var(--ink-muted); stroke-width: 1.3; }
.m713-elec { fill: #9AA7B6; stroke: var(--ink-soft); stroke-width: 1; }
.m713-plate { fill: #9AA7B6; }
.m713-spark { fill: none; stroke: #9FDBFF; stroke-width: 1.6; stroke-linejoin: round; }
.m713-prism { fill: rgba(200, 230, 255, 0.18); stroke: #DCEBFA; stroke-width: 1.4; }
.m713-pipe { fill: none; stroke: var(--ink-muted); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.5; }
.m713-noz { fill: #7D8A9B; }
.m713-axis { stroke: rgba(234, 241, 248, 0.18); stroke-width: 1; stroke-dasharray: 4 4; }
/* جدول الأنواع الستة: يتسع لشاشة الهاتف */
.m713-tab th, .m713-tab td { padding: 9px 8px; vertical-align: middle; }
@media (max-width: 480px) { .m713-tab th, .m713-tab td { padding: 7px 5px; font-size: 0.86rem; } }

/* ---------- المختبر ---------- */
.m713-lab [hidden] { display: none !important; }
.m713-svg, .m713-ssvg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m713-pa .m713-halo { fill: rgba(255, 236, 150, 0.5); opacity: 0; transition: opacity 0.15s; }
.m713-pa.ex .m713-halo { opacity: 1; }
.m713-kr .m713-core { fill: #FF4D6A; }
.m713-kn .m713-core { fill: #B79BFF; }
.m713-pa.ex .m713-core { fill: #FFF1B0; }
.m713-neon { fill: #FF9A4D; }
.m713-dmol { fill: #FF8C5A; }
.m713-site { fill: rgba(255, 140, 140, 0.55); }
.m713-pa .m713-bond { display: none; }
.m713-pa.ex .m713-bond { display: inline; }
.m713-pa.ex .m713-apart { display: none; }
.m713-phg .w { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.m713-phg .hd { fill: currentColor; }
.m713-out { fill: none; stroke-width: 3; stroke-dasharray: 9 5; stroke-linecap: round; }
.m713-out.inv { stroke-dasharray: 4 5; }
.m713-uv { fill: rgba(165, 123, 255, 0.35); }
.m713-ir { fill: rgba(192, 71, 90, 0.3); }
.m713-tk { stroke: var(--ink-muted); stroke-width: 1; }
.m713-cap { margin: 0 0 2px; font-size: 0.8rem; color: var(--ink-soft); text-align: center; }
.m713-spec svg { display: block; width: 100%; height: auto; margin-inline: auto; }
.m713-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 4px; }
.m713-tabs button { padding: 7px 3px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; font-size: 0.84rem; cursor: pointer; }
.m713-tabs button:hover { background: var(--hover); }
.m713-tabs button.on { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.fc-controls .fc-buttons.m713-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m713-btns button { flex: 1 1 30%; padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
.m713-btns bdi { font-family: var(--font-mono); }
/* الحاسوب: الجهاز فوق شريط الطيف في عمود المشهد */
@media (min-width: 1000px) {
    .m713-lab .m713-main > svg { max-height: calc(var(--lx-h) * 0.66); }
    .m713-lab .m713-spec svg { max-height: calc(var(--lx-h) * 0.26); }
    .m713-lab .lx-stage > .m713-spec { margin-top: 2px; }
}
/* الهاتف: «شريط الطيف» يحل محل الجهاز في الجزء المثبّت حين يختاره الطالب */
@media (max-width: 999px) {
    .m713-lab .lx-stage[data-v="more"] > .m713-main { display: none; }
    .m713-lab .lx-stage[data-v="more"] > .m713-spec.lx-more { position: static; height: auto; margin: 0; }
    .m713-tabs button, .fc-controls .fc-buttons.m713-btns button { font-size: 0.8rem; }
}
/* 15-8 بعض تطبيقات الليزر: رسوم الدرس ومختبر التطبيقات (laser-apps-lab) */
.m714-dev { fill: #12355E; stroke: var(--ink-muted); stroke-width: 1.3; }
.m714-lens { fill: rgba(200, 230, 255, 0.22); stroke: #DCEBFA; stroke-width: 1.2; }
.m714-board { fill: rgba(60, 140, 90, 0.45); stroke: #6FBF8E; stroke-width: 1.1; }
.m714-comp { fill: #3B4E66; stroke: var(--ink-soft); stroke-width: 1; }
.m714-hot { fill: #C2533A; stroke: #FFB27A; stroke-width: 1.2; }
.m714-spot { fill: #FFF6D8; }
.m714-sp { fill: #FFE6A0; }
.m714-torch { fill: #7D8A9B; stroke: var(--ink-soft); stroke-width: 1; }
.m714-flame { fill: rgba(255, 150, 50, 0.85); stroke: #FFD27A; stroke-width: 1.2; }
.m714-heat { fill: rgba(255, 120, 40, 0.3); }
.m714-ok { fill: var(--ok); }
.m714-bad { fill: var(--bad); }
.m714-head { fill: #9AA7B6; stroke: var(--ink-soft); stroke-width: 1.2; }
.m714-ring { stroke: #6E7B8B; stroke-width: 2; }
.m714-metal { fill: #8F9CAB; stroke: #C9D3DE; stroke-width: 1.2; }
.m714-metalend { fill: #A9B5C3; stroke: #C9D3DE; stroke-width: 1.2; }
.m714-strip { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1.4; }
.m714-flash { fill: #FFFBEA; }
.m714-ray { fill: none; stroke: #FFF2B8; stroke-width: 1.6; stroke-linecap: round; }
.m714-hair { fill: rgba(170, 120, 70, 0.35); stroke: #C79A6A; stroke-width: 1.5; }
.m714-holec { fill: #071A30; stroke: #FFB27A; stroke-width: 1; }
.m714-wall { fill: rgba(150, 190, 235, 0.08); stroke: var(--ink-muted); stroke-width: 1; }
.m714-floor { fill: rgba(150, 190, 235, 0.04); stroke: var(--ink-muted); stroke-width: 1; }
.m714-deck { fill: none; stroke: var(--ink-soft); stroke-width: 4; stroke-linecap: round; }
.m714-staff { stroke: #E8EEF5; stroke-width: 2.4; stroke-dasharray: 3 2; }
.m714-earth { fill: rgba(70, 140, 230, 0.35); stroke: #7CC7FF; stroke-width: 1.4; }
.m714-moon { fill: #C9CFD8; stroke: #EEF2F6; stroke-width: 1; }
.m714-crater { fill: rgba(80, 90, 105, 0.35); }
.m714-chim { fill: #5C6878; stroke: var(--ink-muted); stroke-width: 1; }
.m714-plume { fill: rgba(170, 180, 195, 0.22); stroke: rgba(200, 210, 222, 0.35); stroke-width: 1; }
.m714-mol { fill: #7CC7FF; }
.m714-tower { stroke: var(--ink-muted); stroke-width: 2.4; }
.m714-mf { fill: #C9D3DE; stroke: #F2F6FA; stroke-width: 0.8; }
.m714-absf { fill: #FFE6A0; }
.m714-plate { fill: rgba(200, 220, 240, 0.25); stroke: #DCEBFA; stroke-width: 1.2; }
.m714-grey { fill: rgba(200, 205, 212, 0.5); }
.m714-bright { fill: #F4F7FA; }
.m714-dark { fill: #1A2533; stroke: var(--ink-muted); stroke-width: 1; }
.m714-ow { fill: none; stroke: #FF6B6B; stroke-width: 2; }
.m714-rw { fill: none; stroke: #FFD27A; stroke-width: 1.6; stroke-dasharray: 4 3; }
.m714-split { stroke: #DCEBFA; stroke-width: 3; opacity: 0.7; }
.m714-mir { stroke: #C9D3DE; stroke-width: 4; }
.m714-obj { fill: none; stroke: #8FD0FF; stroke-width: 1.6; stroke-linejoin: round; }
.m714-fr { stroke: #FFE0E0; stroke-width: 1.6; }
.m714-virt { fill: none; stroke: #FFD27A; stroke-width: 1.8; stroke-dasharray: 4 3; stroke-linejoin: round; }
.m714-eye path, .m714-eye { fill: #EAF1F8; stroke: var(--ink-muted); stroke-width: 1; }
.m714-eye circle { fill: #0B2747; }
.m714-photo { fill: rgba(255, 255, 255, 0.04); stroke: var(--ink-muted); stroke-width: 1.2; }
.m714-tab th, .m714-tab td { padding: 9px 8px; vertical-align: middle; }
@media (max-width: 480px) { .m714-tab th, .m714-tab td { padding: 7px 5px; font-size: 0.86rem; } }

/* ---------- المختبر ---------- */
.m714-lab [hidden] { display: none !important; }
.m714-svg { direction: ltr; user-select: none; -webkit-user-select: none; }
.m714-ti, .m714-ti.m714-front { fill: #8F9CAB; stroke: #C9D3DE; stroke-width: 1.1; }
.m714-rub { fill: rgba(224, 40, 80, 0.45); stroke: #FF7A94; stroke-width: 1.1; }
.m714-dia { fill: rgba(190, 235, 255, 0.28); stroke: #E6F7FF; stroke-width: 1.1; }
.m714-front { filter: brightness(0.82); }
.m714-side { filter: brightness(0.66); }
.m714-seam { stroke: #071A30; stroke-width: 1.4; stroke-dasharray: 5 3; }
.m714-kerf { stroke: #071A30; stroke-linecap: round; }
.m714-bead { stroke: #FFC88A; stroke-linecap: round; }
.m714-heatg { fill: rgba(255, 120, 40, 0.45); }
.m714-heatg.melt { fill: rgba(255, 245, 210, 0.95); }
.m714-nb { fill: #3B4E66; stroke: var(--ink-soft); stroke-width: 1; }
.m714-nb.hot { fill: #C2533A; stroke: #FFB27A; }
.m714-inset { fill: rgba(3, 14, 28, 0.5); stroke: var(--line-strong); stroke-width: 1; }
.m714-chan { fill: #071A30; }
.m714-board2 { fill: #E8EEF5; opacity: 0.85; }
.m714-tick { stroke: #0B2747; stroke-width: 1.2; }
.m714-lampc { fill: rgba(255, 210, 100, 0.16); stroke: rgba(255, 210, 100, 0.35); stroke-width: 1; }
.m714-pulse { fill: #FFE0E0; stroke: #FF6B6B; stroke-width: 1.5; }
.m714-meterf { fill: none; stroke: var(--ink-muted); stroke-width: 1; }
.m714-meter { fill: #FF8A80; }
.m714-gh .m714-mol { fill: #7CC7FF; }
.m714-gc .m714-mol { fill: #B9C4D0; }
.m714-gp .m714-mol { fill: #F2D45C; }
.m714-mols .m714-mol.fl { fill: #FFF6D8; r: 4.5; }
.m714-phg .w { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.m714-phg .hd { fill: currentColor; }
.m714-hray { fill: none; stroke: #FF6B6B; stroke-width: 1.8; }
.m714-hray.thin { stroke-width: 1; opacity: 0.55; }
.m714-spread { fill: rgba(255, 107, 107, 0.2); }
.m714-dot { fill: #FFE0E0; }
.m714-fog { fill: #C9CFD8; }
.m714-refc { fill: rgba(255, 107, 107, 0.15); }
.m714-sight { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 4; }
.m714-pupil { fill: #0B2747; }
.m714-photof { fill: rgba(255, 255, 255, 0.05); stroke: var(--ink-muted); stroke-width: 1.2; }
.m714-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0 0 4px; }
.m714-tabs button { padding: 7px 3px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--ink); font: inherit; font-size: 0.86rem; cursor: pointer; }
.m714-tabs button:hover { background: var(--hover); }
.m714-tabs button.on { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.fc-controls .fc-buttons.m714-btns { flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.fc-controls .fc-buttons.m714-btns button { flex: 1 1 30%; padding: 7px 4px; font-size: 0.84rem; min-width: 0; }
@media (min-width: 1000px) { .m714-lab .m714-main > svg { max-height: calc(var(--lx-h) * 0.86); } }
@media (max-width: 999px) { .m714-tabs button, .fc-controls .fc-buttons.m714-btns button { font-size: 0.8rem; } }

/* =========================================================
   قسم «اختبارات» (js/exam.js): ورقة بنمط الوزاري، عدّ تنازلي، درجة من 100، إرشاد، أجوبة
   ========================================================= */
.ex { display: flex; flex-direction: column; gap: 18px; }
.ex-intro { font-size: 1.08rem; color: var(--ink); margin-bottom: 14px; }
.ex-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line-strong); border-radius: var(--radius); margin: 0 0 14px; }
.ex-stats > div { padding: 10px 14px; display: flex; flex-direction: column-reverse; gap: 2px; }
.ex-stats > div + div { border-right: 1px solid var(--line); }
.ex-stats dd { margin: 0; font-family: var(--font-mono); font-size: 1.6rem; font-weight: 500; color: var(--ink); line-height: 1.2; }
.ex-stats dd small { font-family: var(--font-body); font-size: 0.85rem; color: var(--ink-muted); }
.ex-stats dt { font-size: 0.85rem; color: var(--ink-muted); }
.ex-plan { margin: 0 0 14px; padding-inline-start: 1.3em; display: grid; gap: 6px; }
.ex-plan small { color: var(--ink-muted); }
.ex-how { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 12px 14px; background: var(--raise); margin-bottom: 12px; }
.ex-warn { color: var(--signal); font-weight: 600; }
.ex-rec { color: var(--ink-soft); }
.ex-go { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); min-width: 220px; font-size: 1.1rem; }
.ex-go:hover { background: var(--signal-hover); }

.ex-bar {
    position: sticky; top: calc(var(--nav-h) + 6px); z-index: 50;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 8px 12px; background: var(--bg-deep); border: 1px solid var(--line-strong); border-radius: var(--radius);
    box-shadow: 0 8px 18px rgba(2, 10, 22, 0.35);
}
.ex-timer { font-size: 1.1rem; color: var(--ink); }
.ex-timer b { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 600; letter-spacing: 0.04em; }
.ex-bar.is-low .ex-timer b { color: var(--signal); }
.ex-bar.is-out .ex-timer b { color: var(--bad); }
.ex-prog { color: var(--ink-muted); font-size: 0.92rem; flex: 1 1 auto; }
.ex-submit { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); min-height: 40px; padding: 6px 16px; }
.ex-submit:hover { background: var(--signal-hover); }
.ex-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.ex-ghost:hover { background: var(--hover); border-color: var(--ink-soft); }

.ex-paper { display: flex; flex-direction: column; gap: 22px; }
.ex-sec { border-top: 1px solid var(--line-strong); padding-top: 14px; }
.ex-sh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-family: var(--font-display); font-size: 1.35rem; margin: 0 0 4px; }
.ex-sh small { font-family: var(--font-body); font-size: 0.9rem; color: var(--ink-muted); font-weight: 600; white-space: nowrap; }
.ex-st { color: var(--ink-soft); margin-bottom: 12px; }
.ex-list, .ex-parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.ex-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--raise); }
.ex-item.is-ok { border-color: rgba(var(--ok-rgb), 0.55); }
.ex-item.is-bad { border-color: rgba(var(--bad-rgb), 0.55); }
.ex-ih { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ex-ih:empty { display: none; }
.ex-n { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--inset); border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 0.85rem; }
.ex-mk { font-size: 0.82rem; color: var(--ink-muted); border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px; white-space: nowrap; }
.ex-mk.ok { color: var(--ok); border-color: rgba(var(--ok-rgb), 0.5); }
.ex-mk.bad { color: var(--bad); border-color: rgba(var(--bad-rgb), 0.5); }
.ex-src { font-size: 0.78rem; color: var(--ink-muted); border: 1px dashed var(--line-strong); border-radius: 20px; padding: 1px 8px; }
.ex-src.src-min { color: var(--signal); border-color: rgba(var(--signal-rgb), 0.45); }
.ex-q { font-size: 1.05rem; line-height: 1.8; color: var(--ink); margin-bottom: 10px; }
.ex-opts { display: grid; gap: 8px; }
.ex-opt {
    display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; cursor: pointer;
    border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--inset); color: var(--ink-soft);
    transition: border-color 0.15s, background-color 0.15s;
}
.ex-opt:hover { border-color: var(--ink-soft); background: var(--hover); color: var(--ink); }
.ex-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ex-ol { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 0.9rem; color: var(--ink-soft); }
.ex-ot { flex: 1 1 auto; min-width: 0; line-height: 1.7; }
.ex-opt:has(input:checked) { border-color: var(--signal); background: var(--signal-soft); color: var(--ink); }
.ex-opt:has(input:checked) .ex-ol { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.ex-opt:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.ex-opt:has(input:disabled) { cursor: default; }
.ex-opt.is-right { border-color: var(--ok); background: rgba(var(--ok-rgb), 0.1); color: var(--ink); }
.ex-opt.is-right .ex-ol { background: var(--ok); border-color: var(--ok); color: var(--signal-ink); }
.ex-opt.is-wrong { border-color: var(--bad); background: rgba(var(--bad-rgb), 0.1); color: var(--ink); }
.ex-opt.is-wrong .ex-ol { background: var(--bad); border-color: var(--bad); color: var(--signal-ink); }
.ex-otag { flex: 0 0 auto; align-self: center; font-size: 0.78rem; font-weight: 700; border-radius: 20px; padding: 1px 8px; white-space: nowrap; }
.ex-otag.ok { color: var(--ok); border: 1px solid rgba(var(--ok-rgb), 0.5); }
.ex-otag.bad { color: var(--bad); border: 1px solid rgba(var(--bad-rgb), 0.5); }

.ex-prob .ex-q { border-inline-start: 3px solid var(--signal); padding-inline-start: 12px; }
.ex-parts { counter-reset: part; }
.ex-part { counter-increment: part; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--inset); }
.ex-part.is-ok { border-color: rgba(var(--ok-rgb), 0.55); }
.ex-part.is-bad { border-color: rgba(var(--bad-rgb), 0.55); }
.ex-ph { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ex-pl { color: var(--ink); line-height: 1.7; }
.ex-pl::before { content: counter(part) ". "; font-family: var(--font-mono); color: var(--ink-muted); }
.ex-num-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ex-num, .ex-exp {
    font-family: var(--font-mono); font-size: 1.1rem; color: var(--ink); background: var(--screen);
    border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px; direction: ltr; text-align: left;
}
.ex-num { width: 9.5em; max-width: 100%; }
.ex-exp { width: 4.6em; }
.ex-num:focus, .ex-exp:focus { outline: 2px solid var(--signal); outline-offset: 1px; border-color: var(--signal); }
.ex-num-row.is-invalid .ex-num, .ex-num-row.is-invalid .ex-exp { border-color: var(--bad); }
.ex-x { font-family: var(--font-mono); color: var(--ink-soft); }
.ex-unit { color: var(--ink-soft); }
.ex-cmp { margin: 8px 0 0; color: var(--ink-soft); font-size: 0.95rem; }
.ex-part.is-bad .ex-cmp { color: var(--ink); }
.ex-foot { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; font-size: 0.95rem; }
.ex-empty { color: var(--bad); margin-bottom: 4px; }
.ex-why { color: var(--ink-soft); margin-bottom: 4px; }
.ex-links { margin: 0; color: var(--ink-muted); }
.ex-link { color: var(--signal); text-decoration: none; border-bottom: 1px dashed rgba(var(--signal-rgb), 0.5); margin-inline-end: 10px; }
.ex-link:hover { color: var(--signal-hover); }
.ex-end { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.ex-submit-end { min-height: 50px; font-size: 1.08rem; }
.ex-confirm { border: 1px solid var(--signal); border-radius: var(--radius); background: var(--signal-soft); padding: 12px 14px; }
.ex-confirm p { margin: 0 0 10px; color: var(--ink); }
.ex-cbtns { display: flex; gap: 10px; flex-wrap: wrap; }
.ex-cbtns .btn-action:first-child { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }

.ex-result { display: flex; flex-direction: column; gap: 12px; }
.ex-timeup { color: var(--signal); font-weight: 700; }
.ex-score { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ex-big { font-family: var(--font-mono); line-height: 1; }
.ex-big b { font-size: 4rem; font-weight: 600; color: var(--signal); }
.ex-big small { font-size: 1.5rem; color: var(--ink-muted); }
.ex-grade { font-family: var(--font-display); font-size: 1.6rem; color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 4px 14px; }
.ex-adv { font-size: 1.08rem; color: var(--ink); margin: 0; }
.ex-time { color: var(--ink-muted); margin: 0; }
.ex-table { max-width: 720px; }
.ex-table th, .ex-table td { text-align: center; }
.ex-h { font-family: var(--font-display); font-size: 1.35rem; margin: 10px 0 0; }
.ex-lead { color: var(--ink-soft); margin: 0; }
.ex-weaks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ex-weak { border: 1px solid var(--line-strong); border-inline-start: 4px solid var(--bad); border-radius: var(--radius); padding: 10px 14px; background: var(--raise); }
.ex-wh { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ex-wt { font-weight: 700; color: var(--ink); }
.ex-wl { font-family: var(--font-mono); color: var(--bad); white-space: nowrap; direction: ltr; }
.ex-wd { margin: 4px 0; color: var(--ink-soft); }
.ex-wa { margin: 0; }
.ex-strong { color: var(--ink-soft); }
.ex-again { display: flex; gap: 10px; flex-wrap: wrap; }
.ex-again .btn-action:first-child { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.ex-review { display: flex; flex-direction: column; gap: 18px; }
.ex-review[hidden] { display: none; }
.ex-all { display: flex; flex-direction: column; gap: 18px; }
body.ex-running #next-step, body.ex-running .lesson-actions { display: none !important; }
@media (max-width: 640px) {
    .ex-item, .ex-part { padding: 10px; }
    .ex-opt { padding: 8px 9px; gap: 8px; }
    .ex-big b { font-size: 3.2rem; }
    .ex-stats dd { font-size: 1.3rem; }
    .ex-bar { gap: 8px; padding: 6px 8px; }
    .ex-prog { font-size: 0.85rem; }
    .ex-num { width: 6.6em; font-size: 1.05rem; padding: 7px 8px; }
    .ex-exp { width: 3.6em; font-size: 1.05rem; padding: 7px 6px; }
    .ex-num-row { gap: 6px; }
    .ex-table th, .ex-table td { padding: 6px 4px; font-size: 0.85rem; }
    .ex-opt { flex-wrap: wrap; }
    .ex-otag { order: 3; margin-inline-start: 34px; }
}

/* =========================================================
   الحسابات والاشتراك (js/account.js) — النسخة المنشورة فقط
   ========================================================= */
/* القفل على روابط الأجزاء التي لا يفتحها الحساب الحالي */
.is-locked::after { content: "🔒"; font-size: 0.72em; margin-inline-start: 6px; opacity: 0.75; font-weight: 400; }
.search-result.is-locked::after { content: none; }
.ns-main.is-locked::after { content: none; }
.ns-main.is-locked .ns-t::after { content: "🔒"; font-size: 0.72em; margin-inline-start: 6px; opacity: 0.75; }

/* زر الحساب في الشريط العلوي */
.nav-acc .nav-acc-link { gap: 6px; color: var(--ink); }
.nav-acc .nav-acc-link svg { flex: none; }
.nav-acc .nav-acc-link.is-sub { color: var(--signal); }
.nav-acc .nav-acc-link span { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* البطاقات والنماذج */
.acc-wrap { display: grid; gap: 20px; max-width: 560px; margin: 8px auto 0; }
.acc-card {
    background: var(--raise); border: 1px solid var(--line-strong); border-radius: var(--radius);
    padding: 22px 22px 18px; display: grid; gap: 14px;
}
.acc-h { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); margin: 0; }
.acc-lead { color: var(--ink-soft); margin: 0; line-height: 1.8; }
.acc-field { display: grid; gap: 6px; }
.acc-label { font-weight: 600; color: var(--ink); }
.acc-field input {
    width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 1.05rem;
    color: var(--ink); background: var(--inset); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.acc-field input[dir="ltr"] { text-align: left; font-family: var(--font-mono); letter-spacing: 0.04em; }
.acc-field input:focus { outline: 2px solid var(--signal); outline-offset: 1px; border-color: var(--signal); }
.acc-hint { color: var(--ink-muted); font-size: 0.85rem; }
.acc-check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 0.92rem; cursor: pointer; justify-self: start; }
.acc-check input { width: 18px; height: 18px; accent-color: var(--signal); }
.acc-err { margin: 0; padding: 10px 12px; border: 1px solid var(--bad); border-right-width: 4px; color: var(--ink); background: rgba(var(--bad-rgb), 0.08); border-radius: var(--radius); line-height: 1.7; }
.acc-err:focus { outline: none; }
.acc-submit { width: 100%; }
.acc-submit:disabled { opacity: 0.7; cursor: progress; }
.acc-alt { margin: 0; color: var(--ink-soft); line-height: 1.8; }
.acc-alt a, .acc-hero a:not(.btn-action), .acc-state a { color: var(--signal); }
.acc-note { margin: 0; color: var(--ink-muted); font-size: 0.88rem; line-height: 1.7; }
.acc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.acc-me { display: grid; gap: 10px; margin: 0; }
.acc-me div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.acc-me dt { color: var(--ink-muted); }
.acc-me dd { margin: 0; font-weight: 600; color: var(--ink); }
.acc-state { margin: 0; padding: 10px 12px; border-right: 4px solid var(--line-strong); background: var(--inset); line-height: 1.8; color: var(--ink-soft); }
.acc-state.ok { border-right-color: var(--ok); color: var(--ink); }

/* بطاقة الاشتراك */
.acc-sub { border-color: var(--signal); box-shadow: inset 0 3px 0 var(--signal); }
.acc-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; color: var(--ink-soft); line-height: 1.7; }
.acc-price { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--signal); }
.acc-period { margin: 0; color: var(--ink); line-height: 1.8; }
/* خطة التسويق (25 تشرين الثاني 2026): عرض الإطلاق ومقاعده، وضمان الاسترداد، وموعد الدعم */
.acc-offer {
    margin: 0; padding: 10px 14px; border: 1px solid rgba(var(--signal-rgb), 0.55); border-radius: var(--radius);
    background: var(--signal-soft); color: var(--ink); line-height: 1.8; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline;
}
.acc-offer-t { font-weight: 700; }
.acc-offer-n { font-size: 0.9rem; font-weight: 700; color: var(--signal); white-space: nowrap; }
.acc-hero-offer { margin-top: 10px; }
.acc-guarantee, .acc-support { margin: 0; color: var(--ink-soft); line-height: 1.8; font-size: 0.95rem; }
.acc-guarantee b { color: var(--ok); }
.adm-founder { align-self: end; padding-bottom: 10px; }
.acc-wa { background: #25D366; color: #06331c; border-color: #25D366; width: 100%; }
.acc-wa:hover { background: #3ee07b; }
.acc-warn { margin: 0; color: var(--bad); }
.acc-steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; color: var(--ink-muted); font-size: 0.9rem; line-height: 1.7; }

/* صفحات «للمشتركين» و«سجّل دخولك» */
.acc-gate { max-width: 560px; margin: 8px auto 20px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.acc-gate p { margin: 0; color: var(--ink-soft); line-height: 1.85; }
.acc-gate-icon { font-size: 2.2rem; line-height: 1; }
.acc-gate-h { font-family: var(--font-display); font-size: 1.35rem; color: var(--ink); margin: 0; }
.acc-gate .acc-actions { justify-content: center; }
.acc-gate + .acc-sub { max-width: 560px; margin: 0 auto; }
.acc-free { width: 100%; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.acc-free-l { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.acc-free-l a { color: var(--ink); text-decoration: none; border: 1px solid var(--line-strong); padding: 6px 12px; border-radius: var(--radius); }
.acc-free-l a:hover { border-color: var(--signal); color: var(--signal); }
.acc-loading { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--ink-soft); padding: 48px 0; margin: 0; }
.acc-spin { width: 20px; height: 20px; border: 2px solid var(--line-strong); border-top-color: var(--signal); border-radius: 50%; animation: acc-spin 0.8s linear infinite; }
@keyframes acc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .acc-spin { animation-duration: 2.4s; } }

/* الصفحة الرئيسية */
.acc-hero { margin-top: 18px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); display: grid; gap: 10px; }
.acc-hero p { margin: 0; color: var(--ink-soft); line-height: 1.8; }

/* تنبيه: دخل الحساب من جهاز آخر */
.acc-notice {
    position: fixed; z-index: 2000; top: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%);
    width: min(520px, calc(100vw - 32px)); padding: 16px 18px; display: grid; gap: 10px;
    background: var(--bg-deep); border: 1px solid var(--signal); border-radius: var(--radius); box-shadow: var(--shadow);
}
.acc-notice[hidden] { display: none; }
.acc-notice p { margin: 0; line-height: 1.8; color: var(--ink-soft); }
.acc-notice b { color: var(--ink); }

@media (max-width: 1100px) {
    .nav-item.nav-acc { display: flex; }
    .nav-container { gap: 0; }
    .nav-acc .nav-acc-link { padding: 0 8px; }
}
@media (max-width: 560px) {
    .acc-card { padding: 18px 14px 14px; }
    .acc-actions .btn-action { flex: 1 1 100%; }
    .nav-acc .nav-acc-link span { max-width: 6em; }
}

/* =========================================================
   لوحة الإدارة (admin.html)
   ========================================================= */
.adm-body { background: var(--bg); min-height: 100vh; }
.adm-nav { justify-content: space-between; align-items: center; padding: 0 20px; gap: 12px; }
.adm-home { color: var(--ink); text-decoration: none; font-family: var(--font-display); font-size: 1.1rem; }
.adm-title { color: var(--signal); font-weight: 700; }
.adm-out { min-height: 36px; padding: 4px 14px; }
.adm-main { max-width: 980px; margin: 0 auto; padding: calc(var(--nav-h) + 24px) 16px 48px; display: grid; gap: 20px; }
.adm-sec { gap: 16px; }
.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.adm-stat { background: var(--raise); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px; }
.adm-stat-v { font-family: var(--font-display); font-size: 1.5rem; color: var(--signal); }
.adm-stat-k { color: var(--ink-muted); font-size: 0.9rem; }
.adm-search { display: flex; gap: 10px; }
.adm-search input { flex: 1; min-height: 46px; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--inset); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.adm-search input:focus { outline: 2px solid var(--signal); outline-offset: 1px; }
.adm-list { display: grid; gap: 12px; }
.adm-st { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 10px; background: var(--inset); }
.adm-st-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.adm-st-n { color: var(--ink); font-size: 1.05rem; }
.adm-st-p { color: var(--ink-soft); font-family: var(--font-mono); text-decoration: none; border-bottom: 1px dashed var(--line-strong); }
.adm-st-p:hover { color: #25D366; border-color: #25D366; }
.adm-st-m { margin: 0; color: var(--ink-muted); font-size: 0.88rem; }
.adm-tag { font-size: 0.82rem; padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 99px; color: var(--ink-soft); }
.adm-tag.ok { border-color: var(--ok); color: var(--ok); }
.adm-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-acts .btn-action { min-height: 38px; padding: 6px 14px; font-size: 0.92rem; }
.adm-acts .btn-action.is-armed, .adm-link.is-armed { background: var(--bad); border-color: var(--bad); color: #2b0606; }
.adm-form { display: grid; gap: 12px; border-top: 1px dashed var(--line-strong); padding-top: 12px; }
.adm-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.adm-done { display: grid; gap: 10px; border-top: 1px dashed var(--line-strong); padding-top: 12px; }
.adm-done p { margin: 0; color: var(--ink); }
.adm-done b { font-family: var(--font-mono); font-size: 1.2rem; color: var(--signal); letter-spacing: 0.06em; }
.adm-hist summary { cursor: pointer; color: var(--ink-soft); font-size: 0.92rem; }
/* تقرير وليّ الأمر في بطاقة الطالب (المدير يصنع الرابط ويرسله، 21 تشرين الثاني 2026) */
.adm-par { border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.adm-par > summary { cursor: pointer; color: var(--ink-soft); font-size: 0.92rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-par[open] > summary { margin-bottom: 10px; }
.adm-par[open] { display: grid; gap: 10px; }
.adm-par-ph { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-muted); }
.adm-par-form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.adm-par-form .acc-field { flex: 1 1 200px; margin: 0; }
.adm-par-form .btn-action { min-height: 42px; padding: 6px 14px; font-size: 0.92rem; }
.adm-par .acc-field input[readonly] { font-size: 0.82rem; letter-spacing: 0; }
.adm-par .acc-note { margin: 0; }
.adm-par .adm-par-wa { width: auto; }
.adm-hist ul { margin: 8px 0 0; padding-inline-start: 18px; display: grid; gap: 6px; color: var(--ink-soft); font-size: 0.9rem; }
.adm-hist li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.adm-hist li.is-off { color: var(--ink-muted); text-decoration: line-through; }
.adm-link { background: none; border: 1px solid var(--line-strong); color: var(--ink-soft); font: inherit; font-size: 0.85rem; padding: 2px 10px; border-radius: var(--radius); cursor: pointer; }
.adm-link.danger:hover { border-color: var(--bad); color: var(--bad); }
.adm-settings { display: grid; gap: 14px; }
.adm-free summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.adm-chs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 10px; }
.adm-ch { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 6px; margin: 0; }
.adm-ch legend { color: var(--ink-soft); font-size: 0.9rem; padding: 0 6px; }
.adm-ch .acc-check { font-size: 0.88rem; }
@media (max-width: 560px) {
    .adm-search { flex-direction: column; }
    .adm-acts .btn-action { flex: 1 1 100%; }
}
/* صفحات الحساب: مربع العنوان بلا صف «الفصل/الموضوع» */
.title-block.is-plain .tb-row, .title-block.is-plain .tb-ruler { display: none; }
.adm-top { grid-column: 1 / -1; }
.adm-top ol { margin: 6px 0 0; padding-inline-start: 20px; display: grid; gap: 4px; color: var(--ink-soft); font-size: 0.92rem; }
.adm-top .adm-link { color: var(--ink); }
.adm-warn { border-color: var(--bad); }
.adm-warn > .adm-stat-k, .adm-warn-t { color: var(--bad); }

/* =========================================================
   صفحة الفصل (#chapter/N) وقوانين الدرس
   ========================================================= */
.tb-chapter-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--line-strong); }
.tb-chapter-link:hover { color: var(--signal); border-bottom-color: var(--signal); }
.dropdown-item.dd-chapterpage .dd-label { color: var(--signal); font-weight: 700; }
.dr-chapterpage span { color: var(--signal); }

.chp-lead { color: var(--ink-soft); font-size: 1.05rem; line-height: 1.9; margin: 0 0 28px; }
.chp-sec { margin: 0 0 36px; }
.chp-h { font-family: var(--font-display); font-size: 1.35rem; color: var(--ink); margin: 0 0 14px; display: flex; align-items: baseline; gap: 10px; }
.chp-h small { font-family: var(--font-mono); font-size: 0.85rem; color: var(--signal); }

.chp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.chp-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; background: var(--sheet); color: var(--ink); text-decoration: none; position: relative; transition: background-color 0.15s; }
.chp-card::before { content: ""; position: absolute; top: -1px; right: -1px; left: -1px; height: 3px; background: var(--signal); }
.chp-card:hover { background: var(--hover); }
.chp-card-i { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--signal); color: var(--signal); font-size: 1.25rem; font-weight: 700; border-radius: var(--radius); }
.chp-card:hover .chp-card-i { background: var(--signal); color: var(--signal-ink); }
.chp-card-b { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chp-card-t { font-weight: 700; font-size: 1.08rem; }
.chp-card-m { color: var(--ink-muted); font-size: 0.88rem; line-height: 1.6; }
.chp-card.is-locked::after { content: none; } /* قفل واحد بجانب العنوان، لا قفل ثانٍ في زاوية البطاقة */
.chp-card.is-locked .chp-card-t::after { content: " 🔒"; font-size: 0.8em; }

.chp-topics { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); }
.chp-topic { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--raise); }
.chp-topic:first-child { border-top: 0; }
.chp-topic.is-sub { padding-right: 34px; }
.chp-topic-n { font-family: var(--font-mono); color: var(--ink-muted); font-size: 0.9rem; text-align: right; }
.chp-topic-t { color: var(--ink); font-weight: 600; line-height: 1.6; }
.chp-topic-t a { color: inherit; text-decoration: none; }
.chp-topic-t a:hover { color: var(--signal); }
.chp-topic-l { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chp-topic-l a, .chp-topic-l span { font-size: 0.82rem; padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 2px; color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.chp-topic-l a:hover { border-color: var(--signal); color: var(--signal); }
.chp-topic-l small { font-family: var(--font-mono); color: var(--ink-muted); margin-right: 3px; }
.chp-topic-l .is-soon { border-style: dashed; color: var(--ink-muted); }
.chp-topic-l a.is-locked::after, .chp-topic-t a.is-locked::after { content: " 🔒"; font-size: 0.8em; }
.chp-sims { margin-bottom: 0; }
@media (max-width: 700px) {
    .chp-topic { grid-template-columns: 44px 1fr; }
    .chp-topic-l { grid-column: 1 / -1; justify-content: flex-start; }
}

.lw-topic-more { margin: 26px 0 0; padding: 14px 18px; border: 1px dashed var(--line-strong); color: var(--ink-soft); line-height: 1.9; }
.lw-topic-more a { color: var(--signal); }

/* =========================================================
   التسجيل والدخول ظاهران للزائر: زرّان في الشريط العلوي، وزر أول في الواجهة
   ========================================================= */
.nav-acc.is-guest { align-items: center; gap: 8px; padding: 0 6px; }
.nav-cta { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius);
    font-weight: 700; font-size: 0.92rem; text-decoration: none; white-space: nowrap; transition: background-color 0.15s, color 0.15s; }
.nav-cta-reg { background: var(--signal); color: var(--signal-ink); box-shadow: 0 0 0 3px var(--signal-soft); }
.nav-cta-reg:hover { background: var(--signal-hover); }
.nav-cta-login { border: 1px solid var(--signal); color: var(--signal); }
.nav-cta-login:hover { background: var(--signal-soft); }
.nav-cta-s { display: none; }
@media (max-width: 560px) {
    .nav-cta { height: 34px; padding: 0 10px; font-size: 0.85rem; }
    .nav-cta-l { display: none; }
    .nav-cta-s { display: inline; }
    .nav-cta-login svg { display: none; }
}

.acc-hero.is-guest { margin: 18px 0 22px; }
.acc-hero-cta .btn-action.btn-secondary { border: 1px solid var(--signal); color: var(--signal); }
.acc-hero-cta .btn-action.btn-secondary:hover { background: var(--signal-soft); }
.acc-hero.is-guest p { margin: 12px 0 0; color: var(--ink-soft); }
.acc-hero-cta .btn-action.btn-primary { font-size: 1.08rem; padding: 14px 28px; box-shadow: 0 0 0 4px var(--signal-soft); }


/* =========================================================
   الشروط والأحكام: الصفحة، ومربع الموافقة في التسجيل، والنافذة، وتذييل حقوق الملكية
   ========================================================= */
.terms { max-width: 880px; color: var(--ink-soft); line-height: 2; }
.terms h2 { font-family: var(--font-display); color: var(--ink); font-size: 1.25rem; margin: 30px 0 8px; scroll-margin-top: calc(var(--nav-h) + 16px); }
.terms ul { margin: 0; padding-inline-start: 22px; }
.terms li { margin: 4px 0; }
.terms b { color: var(--ink); }
.terms a { color: var(--signal); }
.terms-meta { color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.85rem; }
.terms-copy { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 0.9rem; }

.acc-terms { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 4px; padding: 12px 14px; border: 1px solid var(--signal); background: var(--signal-soft); color: var(--ink-soft); line-height: 1.8; font-size: 0.95rem; cursor: pointer; border-radius: var(--radius); }
.acc-terms input { flex: none; width: 20px; height: 20px; margin-top: 4px; accent-color: var(--signal); cursor: pointer; }
.acc-terms a { color: var(--signal); font-weight: 700; }

.acc-modal { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px; background: rgba(2, 10, 22, 0.72); animation: fadeIn 0.2s ease-out; }
.acc-modal-box { width: min(880px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--line-strong); border-top: 3px solid var(--signal); box-shadow: var(--shadow); }
.acc-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.acc-modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }
.acc-modal-x { background: none; border: 0; color: var(--ink-muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.acc-modal-x:hover { color: var(--ink); }
.acc-modal-lead { margin: 0; padding: 12px 20px 0; color: var(--signal); font-weight: 700; }
.acc-modal-body { overflow-y: auto; padding: 4px 20px 16px; overscroll-behavior: contain; }
.acc-modal-body:focus { outline: none; }
.acc-modal-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.acc-modal-foot .acc-terms { margin-top: 0; }
body.acc-modal-open { overflow: hidden; }

.site-footer { padding: 26px 24px 30px; border-top: 1px solid var(--line); background: var(--bg-deep); text-align: center; color: var(--ink-muted); font-size: 0.88rem; line-height: 1.9; }
.site-footer p { margin: 0 auto 4px; max-width: 900px; }
.sf-copy b { color: var(--ink-soft); }
.sf-note { font-size: 0.8rem; }
.sf-links { display: flex; justify-content: center; gap: 18px; margin-top: 8px; }
.sf-links a { color: var(--signal); text-decoration: none; }
.sf-links a:hover { text-decoration: underline; }

/* =========================================================
   رسوم الواجهة: رسم لكل فصل يتبدّل (js/hero-art.js)
   ========================================================= */
.hero-art .ha-stage { display: block; color: inherit; text-decoration: none; border-radius: var(--radius); outline-offset: 6px; }
.hero-art .ha-stage svg { display: block; width: 100%; height: auto; overflow: visible; direction: ltr; animation: fadeIn 0.45s ease-out; }
.hero-art .ha-stage:hover .hd-box { stroke: var(--signal); }
.ha-cap { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.ha-num { font-family: var(--font-mono); color: var(--signal); font-size: 1.1rem; }
.ha-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ha-ch { color: var(--ink); font-size: 1rem; }
.ha-topic { color: var(--ink-muted); font-size: 0.88rem; }
.ha-open { flex: none; color: var(--signal); font-weight: 700; font-size: 0.9rem; text-decoration: none; border: 1px solid var(--signal); padding: 6px 12px; border-radius: var(--radius); }
.ha-open:hover { background: var(--signal); color: var(--signal-ink); }
.ha-dots { display: flex; gap: 4px; margin-top: 12px; direction: rtl; }
.ha-dot { flex: 1; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.68rem; }
.ha-dot::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--line-strong); transition: background-color 0.2s; }
.ha-dot span { position: relative; top: 7px; opacity: 0.6; }
.ha-dot:hover::before { background: var(--ink-muted); }
.ha-dot.on::before { background: var(--signal); }
.ha-dot.on span { color: var(--signal); opacity: 1; }
@media (max-width: 560px) { .ha-cap { flex-wrap: wrap; } .ha-open { width: 100%; text-align: center; } .ha-dot span { display: none; } .ha-dot { height: 10px; } }

/* عناصر الرسوم (نفس ألوان المخطط) */
.hd-arrowhead-neg { fill: var(--neg); }
.hd-coil { fill: none; stroke: var(--ink); stroke-width: 1.8; }
.hd-coil-back { fill: none; stroke: var(--ink-muted); stroke-width: 1.1; stroke-dasharray: 4 3; opacity: 0.7; }
.hd-mag-n { fill: color-mix(in srgb, var(--pos) 22%, transparent); stroke: var(--pos); stroke-width: 1.5; }
.hd-mag-s { fill: color-mix(in srgb, var(--neg) 22%, transparent); stroke: var(--neg); stroke-width: 1.5; }
.hd-big { fill: var(--ink); font-family: 'Times New Roman', serif; font-style: italic; font-size: 26px; font-weight: 700; }
.hd-pos-t { fill: var(--pos); } .hd-neg-t { fill: var(--neg); } .hd-signal-t { fill: var(--signal); }
.hd-needle { stroke: var(--signal); stroke-width: 2.2; stroke-linecap: round; }
.hd-curve { fill: none; stroke: var(--signal); stroke-width: 2; }
.hd-curve2 { fill: none; stroke: var(--neg); stroke-width: 1.6; stroke-dasharray: 6 4; }
.hd-curveb { fill: none; stroke: var(--neg); stroke-width: 2; }
.hd-dot { fill: var(--signal); }
.hd-stem { stroke: var(--signal); stroke-width: 1; opacity: 0.55; }
.hd-stem-b { stroke: var(--neg); stroke-width: 1; opacity: 0.55; }
.hd-wavefront { stroke: var(--signal); stroke-width: 1.6; }
.hd-barrier { fill: none; stroke: var(--ink); stroke-width: 5; }
.hd-arc { fill: none; stroke: var(--signal); stroke-width: 1.2; }
.hd-fringe-bar { fill: var(--signal); }
.hd-label { fill: var(--ink-muted); font-family: var(--font-body); font-size: 14px; }
.hd-photon { fill: none; stroke: var(--signal); stroke-width: 1.7; }
.hd-eline { fill: none; stroke: var(--neg); stroke-width: 1.5; }
.hd-eline-ink { fill: none; stroke: var(--ink-soft); stroke-width: 1.4; }
.hd-electron { fill: var(--neg); }
.hd-electron-ghost { fill: none; stroke: var(--neg); stroke-width: 1.5; stroke-dasharray: 3 2; }
.hd-hole { fill: none; stroke: var(--pos); stroke-width: 1.6; }
.hd-batt { stroke: var(--ink); stroke-width: 2.5; } .hd-batt-s { stroke-width: 5; }
.hd-diode { fill: var(--ink); }
.hd-orbit { fill: none; stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 5 4; }
.hd-nucleus { fill: color-mix(in srgb, var(--pos) 30%, transparent); stroke: var(--pos); stroke-width: 1.4; }
.hd-screen { fill: var(--screen); stroke: var(--line-strong); stroke-width: 1; }
.hd-tiny { fill: var(--ink-muted); font-family: var(--font-mono); font-size: 11px; }
.hd-proton { fill: color-mix(in srgb, var(--pos) 75%, var(--bg)); stroke: var(--bg); stroke-width: 1; }
.hd-neutron { fill: color-mix(in srgb, var(--ink-muted) 80%, var(--bg)); stroke: var(--bg); stroke-width: 1; }
.hd-burst { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linecap: round; }
.hd-formula .sub, .hd-var .sub { font-size: 0.7em; baseline-shift: sub; font-style: normal; }
.hd-var .sup { font-size: 0.65em; baseline-shift: super; font-style: normal; }

/* =========================================================
   المظهر: زر في الشريط العلوي يفتح لوحة صغيرة (ليلي/نهاري + ست لوحات ألوان) — js/theme.js
   ========================================================= */
.nav-theme-btn { background: none; border: 0; font: inherit; cursor: pointer; padding: 0 12px; }
.nav-theme-btn::after { display: none; }
.nav-theme-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-theme-btn[aria-expanded="true"] { color: var(--signal); }
.theme-pop {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 1200; width: 340px;
    padding: 14px; display: grid; gap: 8px;
    background: var(--bg-deep); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.theme-pop[hidden] { display: none; }
.tp-h { margin: 0; color: var(--ink-muted); font-size: 0.85rem; }
.tp-h + .tp-modes, .tp-h + .tp-pals { margin-bottom: 6px; }
.tp-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-mode, .tp-pal {
    font: inherit; color: var(--ink-soft); background: var(--inset); cursor: pointer;
    border: 1px solid var(--line-strong); border-radius: var(--radius); transition: border-color 0.15s, color 0.15s;
}
.tp-mode { min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tp-pals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-pal { min-height: 44px; padding: 6px 8px; display: flex; align-items: center; gap: 8px; text-align: start; font-size: 0.86rem; line-height: 1.3; white-space: nowrap; }
.tp-sw { flex: none; display: inline-flex; width: 30px; height: 22px; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-strong); }
.tp-sw i { flex: 1; }
.tp-mode:hover, .tp-pal:hover { color: var(--ink); border-color: var(--ink-muted); }
.tp-mode.on, .tp-pal.on { color: var(--ink); border-color: var(--signal); box-shadow: 0 0 0 2px var(--signal-soft); }
.tp-mode:focus-visible, .tp-pal:focus-visible, .nav-theme-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
@media (max-width: 1100px) {
    .nav-item.nav-theme { display: flex; }
    .nav-theme-btn { padding: 0 8px; }
    .nav-container .nav-theme { position: static; }
    .theme-pop { position: fixed; top: calc(var(--nav-h) + 6px); left: 12px; width: min(340px, calc(100vw - 24px)); }
}
@media (max-width: 360px) {
    .tp-pal { white-space: normal; }
}

/* لون KaTeX الذهبي المكتوب في المحتوى (\textcolor{#FFC53D}) يتبع لون اللوحة والمظهر */
.katex [style*="color:#FFC53D" i] { color: var(--signal) !important; }

/* الجوال الضيق: الشريط يتسع للرئيسية والمظهر وزرّي التسجيل والدخول وزر الفصول */
@media (max-width: 420px) {
    nav { padding: 0 8px; }
    .nav-home-l { display: none; }
    .nav-home .nav-link { padding: 0 8px; }
    .nav-theme-btn { padding: 0 6px; }
    .nav-toggle { padding: 0 10px; gap: 6px; }
}

/* =========================================================
   المساعد الذكي (js/chat.js): تبويب «اسأل المساعد»، وزر عائم، ولوحة دردشة لكل درس
   الحاسوب: لوحة جانبية (يُزاح لها المحتوى على الشاشات العريضة). الجوال: شاشة كاملة
   ========================================================= */
.st-tab.st-chat { font: inherit; font-weight: 700; cursor: pointer; background: none; border: 0; border-left: 1px solid var(--line);
    color: var(--signal); margin-inline-start: auto; }
.st-tab.st-chat svg { width: 18px; height: 18px; flex: none; }
.st-tab.st-chat:hover { background: var(--signal-soft); }
.st-tab.st-chat[aria-expanded="true"], body.chat-open .st-tab.st-chat { background: var(--signal-soft); }
.section-tabs:has(.st-chat) { flex-wrap: wrap; }

.chat-fab {
    position: fixed; z-index: 880; left: 18px; bottom: 18px;
    display: inline-flex; align-items: center; gap: 8px; height: 50px; padding: 0 18px 0 16px;
    font: inherit; font-weight: 700; color: var(--signal-ink); background: var(--signal); cursor: pointer;
    border: 0; border-radius: 999px; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28), 0 0 0 4px var(--signal-soft);
}
.chat-fab:hover { background: var(--signal-hover); }
.chat-fab[hidden] { display: none; }
.chat-fab:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.chat {
    position: fixed; z-index: 950; top: var(--nav-h); bottom: 0; left: 0; width: 420px; max-width: 100vw;
    display: flex; flex-direction: column;
    background: var(--bg-deep); border-right: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.chat[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-head .chat-ico { color: var(--signal); display: inline-flex; }
.chat-hd { flex: 1; min-width: 0; }
.chat-hd h2 { margin: 0; font-family: var(--font-display); font-size: 1.1rem; color: var(--ink); line-height: 1.3; }
.chat-topic { margin: 0; font-size: 0.85rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-clear, .chat-x { font: inherit; cursor: pointer; background: none; color: var(--ink-soft); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.chat-clear { font-size: 0.8rem; padding: 4px 8px; }
.chat-x { width: 34px; height: 34px; font-size: 1rem; }
.chat-clear:hover, .chat-x:hover { color: var(--ink); background: var(--hover); }
.chat-clear[hidden] { display: none; }
.chat-note { margin: 0; padding: 8px 14px; font-size: 0.8rem; line-height: 1.6; color: var(--ink-muted); border-bottom: 1px solid var(--line); background: var(--raise); }
.chat-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; }
.chat-msg.is-user { justify-content: flex-start; }
.chat-msg.is-assistant { justify-content: flex-end; }
.chat-b { max-width: 92%; padding: 10px 14px; border-radius: 12px; line-height: 1.85; font-size: 0.98rem; color: var(--ink); overflow-wrap: anywhere; }
.chat-msg.is-user .chat-b { background: var(--signal-soft); border: 1px solid rgba(var(--signal-rgb), 0.35); border-start-start-radius: 4px; }
.chat-msg.is-assistant .chat-b { background: var(--sheet); border: 1px solid var(--line); border-start-end-radius: 4px; }
.chat-msg.is-error .chat-b { border-color: var(--bad); }
.chat-b p { margin: 0 0 8px; }
.chat-b p:last-child { margin-bottom: 0; }
.chat-b ul, .chat-b ol { margin: 0 0 8px; padding-inline-start: 22px; }
.chat-b li { margin-bottom: 4px; }
.chat-b b { color: var(--ink); }
.chat-b code { font-family: var(--font-mono); font-size: 0.9em; background: var(--inset); padding: 0 4px; border-radius: 3px; }
.chat-b .katex-display { margin: 6px 0; overflow-x: auto; overflow-y: hidden; }
.chat-cut { color: var(--ink-muted); font-size: 0.85rem; }
.chat-again { font: inherit; font-size: 0.85rem; margin-top: 6px; padding: 4px 10px; cursor: pointer; color: var(--signal); background: none;
    border: 1px solid var(--signal); border-radius: var(--radius); }
.chat-state { margin: auto 0; text-align: center; display: grid; gap: 10px; justify-items: center; color: var(--ink-soft); line-height: 1.8; padding: 10px 6px; }
.chat-state > .chat-ico { color: var(--signal); }
.chat-state > .chat-ico svg { width: 34px; height: 34px; }
.chat-state p { margin: 0; }
.chat-sub { color: var(--ink-muted); font-size: 0.88rem; }
.chat-ideas { display: grid; gap: 8px; width: 100%; }
.chat-idea { font: inherit; font-size: 0.92rem; text-align: start; padding: 10px 12px; cursor: pointer; color: var(--ink); background: var(--sheet);
    border: 1px solid var(--line-strong); border-radius: 10px; }
.chat-idea:hover { border-color: var(--signal); background: var(--signal-soft); }
.chat-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-acts .btn-action { text-decoration: none; }
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-form[hidden] { display: none; }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; padding: 10px 12px; font: inherit; line-height: 1.6; color: var(--ink);
    background: var(--inset); border: 1px solid var(--line-strong); border-radius: 10px; }
.chat-form textarea:focus { outline: 2px solid var(--signal); outline-offset: 0; border-color: transparent; }
.chat-send { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    color: var(--signal-ink); background: var(--signal); border: 0; border-radius: 10px; }
.chat-send:disabled { opacity: 0.5; cursor: wait; }
/* صورة السؤال (23 تشرين الثاني 2026): زر الكاميرا، ومعاينة الصورة فوق الحقل، والصورة في فقاعة الطالب */
.chat-form { flex-wrap: wrap; }
.chat-form textarea { min-width: 0; }
.chat-attach { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    color: var(--signal); background: var(--inset); border: 1px solid var(--line-strong); border-radius: 10px; }
.chat-attach:hover { background: var(--signal-soft); }
.chat-pic { flex-basis: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; font-size: 0.85rem; line-height: 1.5;
    color: var(--ink-soft); background: var(--inset); border: 1px dashed var(--line-strong); border-radius: 10px; }
.chat-pic[hidden], .chat-pic img[hidden], .chat-pic-x[hidden] { display: none; }
.chat-pic img { flex: none; width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.chat-pic-t { flex: 1; }
.chat-pic-x { flex: none; width: 30px; height: 30px; cursor: pointer; font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--line-strong); border-radius: 50%; }
.chat-shot { display: block; max-width: 100%; max-height: 220px; margin-bottom: 6px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.chat-b .chat-shot-n { font-size: 0.85rem; color: var(--ink-soft); }
.chat.is-drop .chat-form { outline: 2px dashed var(--signal); outline-offset: -4px; }
.chat-foot { margin: 0; padding: 0 14px 10px; display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; color: var(--ink-muted); min-height: 1.6em; }
.chat-foot .is-out { color: var(--bad); }
.chat-count { font-family: var(--font-mono); }
.chat-dots { display: inline-flex; gap: 5px; padding: 4px 2px; }
.chat-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-muted); animation: chatDot 1.2s infinite ease-in-out; }
.chat-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .chat-dots i { animation: none; opacity: 0.7; } }

/* الشاشات العريضة: تُزاح الصفحة لكي لا تغطي اللوحة الدرس */
@media (min-width: 1200px) {
    body.chat-open { padding-left: 420px; }
    body.chat-open .tabs-float { left: 420px; }
}
/* الجوال والشاشات الأصغر: اللوحة شاشة كاملة فوق الشريط العلوي */
@media (max-width: 1199px) {
    .chat { top: 0; width: 100%; z-index: 1600; border: 0; }
    body.chat-lock { overflow: hidden; }
}
@media (max-width: 560px) {
    .section-tabs .st-tab.st-chat { flex: 1 1 100%; border-left: 0; border-top: 1px solid var(--line); justify-content: center; margin: 0; }
    .chat-fab { left: 12px; bottom: 12px; height: 48px; padding: 0 14px; }
    .chat-fab span { display: none; }
    .chat-fab { width: 52px; height: 52px; padding: 0; justify-content: center; }
    .chat-b { max-width: 96%; font-size: 0.96rem; }
}
@media print { .chat, .chat-fab, .st-chat { display: none !important; } }

/* لوحة الإدارة: المساعد الذكي (الإعدادات، والاستعمال، ومحادثات الطالب) */
.adm-chatset { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 10px; }
.adm-chatset legend { padding: 0 6px; font-weight: 700; color: var(--ink); }
.adm-chat-n { margin: 6px 0; color: var(--ink-soft); line-height: 1.9; }
.adm-chats { display: grid; gap: 8px; max-height: 480px; overflow-y: auto; padding: 4px; }
.adm-chat-m { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--raise); }
.adm-chat-m.is-user { border-right: 3px solid var(--signal); }
.adm-chat-h { display: block; font-size: 0.8rem; color: var(--ink-muted); margin-bottom: 4px; }
.adm-chat-t { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); font-size: 0.92rem; line-height: 1.7; }

/* =========================================================
   خطة المراجعة المركّزة قبل البكلوريا (js/review.js) والأسئلة الوزارية الأكثر تكراراً والامتحان الشامل
   ========================================================= */
.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; }

/* الصفحة الرئيسية: بطاقة الخطة بين الواجهة وفهرس الفصول */
.review-cta {
    max-width: 1180px; margin: 0 auto 56px; padding: 0 32px;
    display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
}
.rc-body { border-inline-start: 4px solid var(--signal); padding: 6px 20px 6px 0; }
.rc-eyebrow { font-size: 0.85rem; font-weight: 700; color: var(--signal); margin: 0 0 4px; }
.rc-title { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; color: var(--ink); margin: 0 0 8px; line-height: 1.4; }
.rc-text { color: var(--ink-soft); line-height: 1.85; margin: 0; max-width: 70ch; }
.rc-go { white-space: nowrap; }

/* القائمة الجانبية: رابط الخطة أعلى الفصول */
.dr-plan {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin: 0 16px 12px; padding: 12px 14px; text-decoration: none; font-weight: 700; color: var(--signal-ink);
    background: var(--signal); border-radius: var(--radius);
}
.dr-plan small { font-weight: 500; font-size: 0.8rem; opacity: 0.85; }

/* صفحة الخطة */
.rv { display: grid; gap: 22px; }
.rv-intro p { color: var(--ink-soft); line-height: 1.9; margin: 0 0 8px; }
.rv-what { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; color: var(--ink-soft); line-height: 1.85; }
.rv-what b { color: var(--ink); }
.rv-form { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--inset); padding: 18px 20px; display: grid; gap: 10px; }
.rv-fl { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.rv-fr { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rv-fr input[type="date"] {
    min-height: 46px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--sheet); color: var(--ink); font-family: var(--font-mono); font-size: 1rem; color-scheme: dark;
}
html[data-theme="light"] .rv-fr input[type="date"] { color-scheme: light; }
.rv-fr input[type="date"]:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.rv-hint { margin: 0; font-size: 0.9rem; color: var(--ink-muted); line-height: 1.7; }
.rv-err { margin: 0; color: var(--bad); font-weight: 600; }
.rv-err[hidden], .rv-msg[hidden], .rv-confirm[hidden] { display: none; }

.rv-sec { display: grid; gap: 10px; }
.rv-h { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--ink); margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.rv-h small { font-family: var(--font-body); font-size: 0.88rem; font-weight: 500; color: var(--ink-muted); }
.rv-lead { margin: 0; color: var(--ink-soft); line-height: 1.8; }

.rv-scores { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.rv-sc { background: var(--sheet); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-top: 3px solid var(--line-strong); }
.rv-sc.is-weak { border-top-color: var(--bad); }
.rv-sc.is-mid { border-top-color: var(--signal); }
.rv-sc.is-strong { border-top-color: var(--ok); }
.rv-scl { font-size: 0.9rem; color: var(--ink-soft); font-weight: 600; }
.rv-scv { display: flex; align-items: baseline; gap: 8px; }
.rv-scv b { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 500; color: var(--ink); }
.rv-scv small { font-size: 0.78rem; color: var(--ink-muted); }

.rv-head {
    display: grid; grid-template-columns: auto 1fr; gap: 14px 24px; align-items: center;
    border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--inset); padding: 18px 20px;
}
.rv-count { display: flex; align-items: center; gap: 12px; }
.rv-big b { font-family: var(--font-mono); font-size: 2.6rem; font-weight: 500; color: var(--signal); line-height: 1; }
.rv-cl { font-weight: 700; color: var(--ink); line-height: 1.5; }
.rv-cl small { font-weight: 500; color: var(--ink-muted); font-size: 0.88rem; }
.rv-prog { display: grid; gap: 6px; min-width: 0; }
.rv-pl { display: flex; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: 0.95rem; }
.rv-pl b { font-family: var(--font-mono); color: var(--ink); font-weight: 500; }
.rv-bar { height: 10px; border-radius: 6px; background: rgba(var(--signal-rgb), 0.14); overflow: hidden; }
.rv-bar > span { display: block; height: 100%; background: var(--ok); border-radius: 6px; transition: width 0.3s; }
.rv-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.rv-acts .btn-secondary { border-color: var(--line-strong); }
.rv-acts .rv-del { color: var(--bad); }
.rv-confirm, .rv-msg { grid-column: 1 / -1; margin: 0; }
.rv-confirm p { margin: 0 0 8px; color: var(--ink); font-weight: 600; }
.rv-cbtns { display: flex; flex-wrap: wrap; gap: 8px; }
.rv-cbtns .btn-action:first-child { background: var(--bad); color: #fff; border-color: var(--bad); }
.rv-cbtns .btn-secondary { border-color: var(--line-strong); }
.rv-msg { color: var(--ok); font-weight: 600; }
.rv-note { margin: 0; padding: 12px 16px; border: 1px solid rgba(var(--signal-rgb), 0.45); background: var(--signal-soft); border-radius: var(--radius); color: var(--ink); line-height: 1.85; }
.rv-note.is-good { border-color: rgba(var(--ok-rgb), 0.5); background: rgba(var(--ok-rgb), 0.1); }
.rv-late .rv-h { color: var(--bad); }

.rv-week { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--sheet); }
.rv-week + .rv-week { margin-top: 10px; }
.rv-wh { cursor: pointer; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-weight: 700; color: var(--ink); }
.rv-wh small { font-weight: 500; color: var(--ink-muted); font-size: 0.88rem; }
.rv-week[open] > .rv-wh { border-bottom: 1px solid var(--line); }
.rv-days { list-style: none; margin: 0; padding: 0; display: grid; }
.rv-week .rv-days > .rv-day + .rv-day { border-top: 1px solid var(--line); }
.rv-day { padding: 14px 16px; }
.rv-today .rv-day { border: 2px solid var(--signal); border-radius: var(--radius); background: var(--sheet); }
.rv-day.is-today { box-shadow: inset -4px 0 0 var(--signal); }
.rv-day.is-late { box-shadow: inset -4px 0 0 var(--bad); }
.rv-day.is-done .rv-dt { color: var(--ink-muted); }
.rv-dh { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rv-dn { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; background: var(--signal-soft); color: var(--signal); font-family: var(--font-mono); font-weight: 600; font-size: 0.9rem; }
.rv-day.is-done .rv-dn { background: rgba(var(--ok-rgb), 0.16); color: var(--ok); }
.rv-dd { color: var(--ink-soft); font-weight: 600; }
.rv-dtag { font-size: 0.78rem; font-weight: 700; padding: 1px 8px; border-radius: 2px; background: var(--signal); color: var(--signal-ink); }
.rv-dtag.late { background: var(--bad); color: #fff; }
.rv-dp { margin-inline-start: auto; font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-muted); }
.rv-dt { margin: 6px 0 8px; font-family: var(--font-display); font-size: 1.12rem; font-weight: 700; color: var(--ink); line-height: 1.6; }
.rv-dt small { font-family: var(--font-body); font-size: 0.85rem; color: var(--ink-muted); font-weight: 500; }
.rv-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rv-task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--raise); }
.rv-task.is-done { opacity: 0.72; }
.rv-task.is-done .rv-tt { text-decoration: line-through; text-decoration-color: var(--ok); text-decoration-thickness: 2px; }
.rv-check { flex-shrink: 0; display: inline-flex; padding-top: 2px; cursor: pointer; }
.rv-check input { width: 22px; height: 22px; accent-color: var(--ok); cursor: pointer; margin: 0; }
.rv-tb { flex: 1; min-width: 0; display: grid; gap: 3px; }
.rv-tt { font-weight: 700; color: var(--ink); line-height: 1.6; }
.rv-tc { display: inline-block; margin-inline-end: 6px; font-size: 0.8rem; font-weight: 600; color: var(--signal); }
.rv-tm { font-size: 0.92rem; color: var(--ink-soft); line-height: 1.75; }
.rv-tl { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 2px; }
.rv-tl a { color: var(--signal); font-weight: 700; text-decoration: none; border-bottom: 1px solid rgba(var(--signal-rgb), 0.45); line-height: 1.7; }
.rv-tl a:hover { border-bottom-color: var(--signal); }
.rv-why { margin: 0; padding-inline-start: 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 18px; color: var(--ink-soft); line-height: 1.8; }
.rv-why b { color: var(--ink); }

/* الأسئلة الوزارية الأكثر تكراراً */
.qa-badge.rq-freq { font-weight: 700; }
.qa-badge.rq-freq.hi { color: var(--signal-ink); background: var(--signal); border: 1px solid var(--signal); }
.qa-badge.rq-freq.mid { color: var(--signal); background: var(--signal-soft); border: 1px solid rgba(var(--signal-rgb), 0.5); }
.qa-badge.rq-freq.lo { color: var(--ink-muted); border: 1px solid var(--line-strong); }
.rq-years { margin: 6px 0 0; font-size: 0.82rem; color: var(--ink-muted); line-height: 1.7; }
.rq-from { margin: 10px 0 0; font-size: 0.88rem; color: var(--ink-muted); line-height: 1.7; }
.rq-from a { color: var(--signal); text-decoration: none; font-weight: 600; }
.rq-from a:hover { text-decoration: underline; }
.rq-part { margin: 12px 0 0; padding: 10px 14px; border: 1px dashed rgba(var(--signal-rgb), 0.55); border-radius: var(--radius); color: var(--ink-soft); line-height: 1.8; }
.rq-part[hidden] { display: none; }
.rq-all { background: none; border: 0; padding: 0; color: var(--signal); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* الامتحان الشامل: درجة كل فصل */
.ex-chs { max-width: none; width: 100%; }
.ex-chs th[scope="row"] { text-align: start; font-weight: 600; }
.ex-chs tr.is-weak td, .ex-chs tr.is-weak th { background: rgba(var(--bad-rgb), 0.1); }
.ex-chs td:last-child { text-align: start; }
.ex-chs .ex-link { margin-inline-end: 10px; }
.ex-wc { color: var(--ink-muted); font-weight: 500; }

/* مسار اللحاق (js/catchup.js): بطاقته في الرئيسية فوق بطاقة الخطة، وصفحته #catchup تستعمل أنماط صفحة الخطة */
.review-cta.cu-cta { margin-bottom: 30px; }
.cu-cta .rc-body { border-inline-start-color: var(--ok); }
.cu-cta .rc-eyebrow { color: var(--ok); }
.dr-plan.dr-catchup { background: transparent; color: var(--signal); border: 1px solid var(--signal); }
.dr-plan.dr-catchup[aria-current="page"], .dr-plan.dr-catchup.is-current { background: var(--signal-soft); }
.cu-fs { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.cu-fs[hidden] { display: none; }
.cu-fs + .cu-fs { border-top: 1px solid var(--line); padding-top: 14px; }
.cu-fs legend { padding: 0; margin-bottom: 10px; }
.cu-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.cu-opt {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; cursor: pointer;
    border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--sheet); line-height: 1.6; color: var(--ink-soft);
}
.cu-opt b { color: var(--ink); }
.cu-opt small { color: var(--ink-muted); }
.cu-opt input { flex-shrink: 0; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--signal); cursor: pointer; }
.cu-opt:has(input:checked) { border-color: var(--signal); background: var(--signal-soft); }
.cu-opt:has(input:focus-visible), .cu-pill:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.cu-opts > .rv-hint { grid-column: 1 / -1; }
.cu-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cu-pill { position: relative; cursor: pointer; }
.cu-pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cu-pill span {
    display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px; font-weight: 700;
    border: 1px solid var(--line-strong); border-radius: 22px; background: var(--sheet); color: var(--ink-soft);
}
.cu-pill input:checked + span { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.cu-count { grid-column: 1 / -1; }
.cu-end { font-weight: 700; color: var(--ink); line-height: 1.8; font-size: 1.05rem; }
.cu-end b { color: var(--signal); }
.cu-end.is-good { color: var(--ok); }
.cu-sum { grid-column: 1 / -1; margin: 0; color: var(--ink-soft); line-height: 1.8; font-size: 0.95rem; }
.cu-sum b { color: var(--ink); }
.cu-sum.is-good { color: var(--ok); font-weight: 600; }
.cu .rv-head { grid-template-columns: 1fr; }
.cu-dm { white-space: nowrap; }
.rv-tc.cu-now { color: var(--ok); }

/* امتحان الجمعة (js/weekly.js، 25 تشرين الثاني 2026): بطاقته في الرئيسية، وصفحته #weekly */
.wk-cta .rc-body { border-inline-start-color: var(--signal); }
.wk-cta .rc-eyebrow { color: var(--signal); }
.wk { display: grid; gap: 20px; }
.wk-intro p { color: var(--ink-soft); line-height: 1.9; margin: 0 0 8px; }
.wk-rules { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; color: var(--ink-soft); line-height: 1.85; }
.wk-rules b { color: var(--ink); }
.wk-card { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--inset); padding: 18px 20px; display: grid; gap: 10px; }
.wk-next { border-color: var(--signal); border-width: 2px; }
.wk-h { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--ink); margin: 0; }
.wk-when { margin: 0; color: var(--ink); line-height: 1.8; }
.wk-title { margin: 0; color: var(--ink-soft); font-weight: 600; }
.wk-state { margin: 0; color: var(--ink); font-weight: 600; line-height: 1.8; }
.wk-state.ok { color: var(--ok); }
.wk-state.live { color: var(--signal); }
.wk-state b, .wk-me b { font-family: var(--font-mono); font-weight: 600; }
.wk-note { margin: 0; color: var(--ink-muted); font-size: 0.92rem; line-height: 1.8; }
.wk-count { margin: 0; font-size: 1.1rem; color: var(--ink); }
.wk-count b { color: var(--signal); }
.wk-me { margin: 0; padding: 10px 14px; border-radius: var(--radius); background: var(--signal-soft); color: var(--ink); line-height: 1.8; }
.wk-table { width: 100%; max-width: none; }
.wk-table td:first-child { width: 4.5em; text-align: center; font-family: var(--font-mono); }
.wk-table tr.is-me td { background: var(--signal-soft); font-weight: 700; }
.wk-big { margin: 0; text-align: center; }
.wk-big b { font-family: var(--font-mono); font-size: 3rem; font-weight: 500; color: var(--signal); }
.wk-big small { font-family: var(--font-mono); color: var(--ink-muted); font-size: 1.2rem; }
.wk-sent { text-align: center; justify-items: center; }
.wk-area:empty { display: none; }
.wk-form { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.wk-draft { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.wk-preview > summary { cursor: pointer; font-weight: 700; color: var(--signal); padding: 6px 0; }
.wk-del { min-height: 36px; padding: 4px 12px; font-size: 0.88rem; }
.wk-review .ex { margin-top: 4px; }
.cu-rng { display: inline-block; margin-inline-start: 4px; padding: 0 8px; border-radius: 2px; background: var(--signal-soft); color: var(--signal); font-size: 0.88rem; font-weight: 700; white-space: nowrap; }

@media (max-width: 900px) {
    .review-cta { padding: 0 24px; margin-bottom: 44px; }
    .review-cta.cu-cta { margin-bottom: 26px; }
}
@media (max-width: 700px) {
    .review-cta { grid-template-columns: 1fr; padding: 0 16px; margin-bottom: 36px; gap: 14px; }
    .review-cta.cu-cta { margin-bottom: 24px; }
    .cu-opts { grid-template-columns: 1fr; }
    .rc-go { justify-self: start; }
    .rc-title { font-size: 1.3rem; }
    .rv-head { grid-template-columns: 1fr; padding: 14px 14px; }
    .rv-big b { font-size: 2.2rem; }
    .rv-day { padding: 12px 12px; }
    .rv-task { padding: 10px 10px; gap: 10px; }
    .rv-acts .btn-action { flex: 1 1 auto; }
}

/* =========================================================
   تقرير وليّ الأمر: بطاقة الرابط في «حسابي» (js/account.js) وصفحة التقرير #parent/<رمز> (js/parent.js)
   ========================================================= */
.acc-parent > p { margin: 0; color: var(--ink-soft); line-height: 1.85; }
.acc-parent .acc-note { color: var(--ink-muted); }
.acc-parent [data-parent-body] { display: grid; gap: 12px; }
.acc-parent .btn-secondary { border-color: var(--line-strong); }
.acc-parent .acc-field input { font-size: 0.85rem; letter-spacing: 0; }
.acc-danger { color: var(--bad); }
.acc-parent-more { border-top: 1px dashed var(--line); padding-top: 12px; }

.pr { display: grid; gap: 22px; max-width: 900px; margin: 0 auto; }
.pr-head { border: 1px solid var(--line-strong); border-inline-start: 5px solid var(--line-strong); border-radius: var(--radius); background: var(--inset); padding: 16px 18px; display: grid; gap: 6px; }
.pr-head.is-strong { border-inline-start-color: var(--ok); }
.pr-head.is-mid { border-inline-start-color: var(--signal); }
.pr-head.is-weak { border-inline-start-color: var(--bad); }
.pr-hello { margin: 0; color: var(--ink-muted); font-weight: 600; }
.pr-hello b { color: var(--ink); font-family: var(--font-display); font-size: 1.25rem; }
.pr-verdict { margin: 0; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--ink); line-height: 1.6; }
.pr-verdict span { display: block; font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; color: var(--ink-soft); }
.pr-meta { margin: 0; color: var(--ink-soft); line-height: 1.9; font-size: 0.95rem; }
.pr-sec { display: grid; gap: 12px; }
.pr-h { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--ink); margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pr-h small { font-family: var(--font-body); font-size: 0.9rem; font-weight: 500; color: var(--ink-muted); }
.pr-h3 { font-size: 1rem; font-weight: 700; color: var(--ink); margin: 4px 0 0; }
.pr-lead { margin: 0; color: var(--ink-soft); line-height: 1.85; }
.pr-days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pr-day { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--sheet); padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.pr-day.is-today { border-color: var(--signal); }
.pr-dw { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.pr-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 2px dashed var(--line-strong); color: #fff; font-weight: 700; font-size: 0.85rem; }
.pr-day.is-on .pr-dot { background: var(--ok); border: 2px solid var(--ok); }
.pr-dn { font-size: 0.75rem; color: var(--ink-muted); line-height: 1.4; }
.pr-stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.pr-stat { background: var(--sheet); padding: 10px 12px; display: flex; flex-direction: column-reverse; gap: 2px; }
.pr-stat dt { font-size: 0.88rem; color: var(--ink-soft); font-weight: 600; }
.pr-stat dd { margin: 0; display: grid; gap: 1px; }
.pr-stat dd b { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 500; color: var(--ink); line-height: 1.2; }
.pr-stat dd small { font-size: 0.78rem; color: var(--ink-muted); }
.pr-lessons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.pr-lessons li { display: flex; flex-direction: column; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.pr-lt { color: var(--ink); font-weight: 600; line-height: 1.6; }
.pr-lessons small { color: var(--ink-muted); font-size: 0.82rem; }
.pr-table { width: 100%; }
.pr-table th, .pr-table td { text-align: start; vertical-align: middle; }
.pr-chs th[scope="row"] { font-weight: 700; }
.pr-chs th[scope="row"] small { display: block; font-weight: 500; color: var(--ink-muted); font-size: 0.8rem; }
.pr-chs td small { color: var(--ink-muted); font-size: 0.8rem; }
.pr-bar { height: 8px; border-radius: 5px; background: rgba(var(--signal-rgb), 0.14); overflow: hidden; min-width: 90px; margin-bottom: 3px; }
.pr-bar > span { display: block; height: 100%; background: var(--ok); border-radius: 5px; }
.pr-bar.big { height: 12px; flex: 1; margin: 0; }
.pr-planbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ink-soft); }
.pr-grade { display: inline-block; padding: 1px 8px; border-radius: 2px; font-weight: 700; font-size: 0.85rem; border: 1px solid var(--line-strong); color: var(--ink-soft); }
.pr-grade.is-strong { color: var(--ok); border-color: rgba(var(--ok-rgb), 0.55); background: rgba(var(--ok-rgb), 0.1); }
.pr-grade.is-mid { color: var(--signal); border-color: rgba(var(--signal-rgb), 0.55); background: var(--signal-soft); }
.pr-grade.is-weak { color: var(--bad); border-color: rgba(var(--bad-rgb), 0.55); background: rgba(var(--bad-rgb), 0.1); }
.pr-notes ul { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; color: var(--ink); line-height: 1.85; }
.pr-foot { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 0.88rem; line-height: 1.8; }
@media (max-width: 560px) {
    .pr-days { gap: 3px; }
    .pr-day { padding: 6px 1px; }
    .pr-dw { font-size: 0.72rem; }
    .pr-dn { font-size: 0.66rem; }
    .pr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pr-verdict { font-size: 1.1rem; }
}

/* الشريط العلوي على الحاسوب للزائر: زرّا التسجيل والدخول مع الفصول التسعة لا يتسعان لعرض 1101–1500px،
   فكانت أطراف الشريط تُقصّ. هنا: «سجّل مجاناً» بدل «إنشاء حساب مجاني»، والرئيسية أيقونة فقط، ومسافات أضيق */
@media (min-width: 1101px) and (max-width: 1500px) {
    .nav-container:has(.nav-acc.is-guest) .nav-link { padding: 0 7px; }
    .nav-container:has(.nav-acc.is-guest) .nav-home-l { display: none; }
    .nav-acc.is-guest { gap: 6px; padding: 0 4px; }
    .nav-acc.is-guest .nav-cta { padding: 0 10px; }
    .nav-acc.is-guest .nav-cta-l { display: none; }
    .nav-acc.is-guest .nav-cta-s { display: inline; }
    .nav-acc.is-guest .nav-cta-login svg { display: none; }
}
@media (min-width: 1101px) and (max-width: 1260px) {
    .nav-container .nav-link { padding: 0 6px; font-size: 0.86rem; }
    .nav-container .nav-home-l { display: none; }
}

/* =========================================================
   «تحدّث مع الخبير» (js/expert.js): مكالمة صوتية مع الأستاذ محمد
   نافذة مربعة كشاشة مكالمة فيديو. الحاسوب: في وسط الشاشة. الجوال: شاشة كاملة
   ========================================================= */
.st-tab.st-expert { font: inherit; font-weight: 700; cursor: pointer; background: none; border: 0; border-left: 1px solid var(--line);
    color: var(--signal); margin-inline-start: auto; position: relative; }
.st-tab.st-expert svg { flex: none; }
.st-tab.st-expert:hover { background: var(--signal-soft); }
.st-tab.st-expert + .st-tab.st-chat { margin-inline-start: 0; }
.st-tab.st-expert > svg:first-child { animation: xpRingIcon 3.2s ease-in-out infinite; transform-origin: 50% 50%; }
.st-expert-lock { display: inline-flex; color: var(--ink-muted); font-style: normal; }
.st-tab.st-expert.is-locked > svg:first-child { animation: none; }
@keyframes xpRingIcon { 0%, 82%, 100% { transform: rotate(0); } 85% { transform: rotate(-14deg); } 88% { transform: rotate(12deg); } 91% { transform: rotate(-8deg); } 94% { transform: rotate(5deg); } }
.section-tabs:has(.st-expert) { flex-wrap: wrap; }

.xp { position: fixed; inset: 0; z-index: 1700; display: grid; place-items: center; padding: 16px;
    background: rgba(3, 10, 20, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.xp[hidden] { display: none; }
body.xp-open { overflow: hidden; }
.xp-card { width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; overflow: hidden;
    background: var(--bg-deep); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); animation: xpIn 0.28s ease-out; }
@keyframes xpIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

.xp-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.xp-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
    font-family: var(--font-body); font-weight: 700; font-size: 1.15rem; color: var(--signal-ink); background: var(--signal); }
.xp-who { flex: 1; min-width: 0; display: grid; line-height: 1.35; }
.xp-who b { font-family: var(--font-display); font-size: 1.05rem; }
.xp-status { font-size: 0.82rem; color: var(--ink-muted); min-height: 1.2em; }
.xp[data-state="listening"] .xp-status { color: var(--ok); }
.xp[data-state="speaking"] .xp-status, .xp[data-state="thinking"] .xp-status { color: var(--signal); }
.xp-time { font-family: var(--font-mono); font-size: 0.9rem; color: var(--ink-soft); }
.xp-x { width: 34px; height: 34px; flex: none; font: inherit; cursor: pointer; color: var(--ink-soft); background: none;
    border: 1px solid var(--line-strong); border-radius: 50%; }
.xp-x:hover { color: var(--ink); background: var(--hover); }

/* الشاشة واللوح معاً */
.xp-main { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
/* الشاشة: خلفية داكنة في المظهرين (كشاشة مكالمة) */
.xp-stage { position: relative; aspect-ratio: 4 / 3; min-height: 230px; flex: none; overflow: hidden; color: #F3F6FA;
    background:
        radial-gradient(circle at 50% 46%, rgba(var(--signal-rgb), 0.22), transparent 58%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 28px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 28px),
        linear-gradient(170deg, #14283E, #0A1626); }
.xp-live { position: absolute; top: 10px; right: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); }
.xp-live i { width: 8px; height: 8px; border-radius: 50%; background: #FF5A5F; animation: xpBlinkDot 1.4s infinite; }
.xp[data-state="ringing"] .xp-live i, .xp[data-state="ended"] .xp-live i, .xp[data-state="blocked"] .xp-live i { background: #8A97A8; animation: none; }
@keyframes xpBlinkDot { 50% { opacity: 0.25; } }
.xp-topic { position: absolute; top: 10px; left: 12px; z-index: 2; margin: 0; max-width: 55%; font-size: 0.75rem; padding: 3px 9px;
    border-radius: 999px; background: rgba(0, 0, 0, 0.35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-zaid { position: absolute; left: 50%; bottom: 0; height: 88%; width: auto; transform: translateX(-50%); overflow: visible; }

/* ألوان الشخصية */
.xp-shirt { fill: #2F6E9E; }
.xp-shirt-fold { stroke: rgba(0, 0, 0, 0.18); stroke-width: 2; }
.xp-pocket { fill: #285E88; }
.xp-pen { fill: rgb(var(--d-signal-rgb)); }
.xp-collar { fill: #F2EFE8; }
.xp-neck { fill: #D9A57C; }
.xp-skin { fill: #E8B88E; }
.xp-beard { fill: #3A2A22; opacity: 0.82; }
.xp-hair { fill: #2A1D17; }
.xp-cheek { fill: #E0806A; opacity: 0.22; }
.xp-brows path { fill: none; stroke: #2A1D17; stroke-width: 5; stroke-linecap: round; }
.xp-white { fill: #FFFFFF; }
.xp-pupils circle { fill: #2A1D17; }
.xp-pupils .xp-glint { fill: #FFFFFF; }
.xp-glasses circle { fill: rgba(255, 255, 255, 0.07); stroke: #1B2430; stroke-width: 3; }
.xp-glasses path { fill: none; stroke: #1B2430; stroke-width: 3; stroke-linecap: round; }
.xp-nose { fill: none; stroke: #B9805A; stroke-width: 2.5; stroke-linecap: round; }
.xp-moustache { fill: #2A1D17; }
.xp-mouth-closed { fill: none; stroke: #6B2F2A; stroke-width: 3; stroke-linecap: round; }
.xp-mouth-in { fill: #5A1F1C; }
.xp-teeth { fill: #FFFFFF; }
.xp-tongue { fill: #D86B6B; }
.xp-think circle, .xp-think ellipse { fill: rgba(255, 255, 255, 0.92); }
.xp-think .xp-cdot { fill: #3A4A5E; }

/* الحركة: تنفّس، ورمش، وكلام، واستماع، وتفكير */
.xp-zaid * { transform-box: fill-box; }
.xp-z-body, .xp-z-head { transform-origin: 50% 100%; }
.xp-z-body { animation: xpBreathe 4.2s ease-in-out infinite; }
.xp-z-head { animation: xpBreathe 4.2s ease-in-out infinite; }
@keyframes xpBreathe { 50% { transform: translateY(-1.6px); } }
.xp-eyes { transform-origin: 50% 50%; animation: xpBlink 4.6s infinite; }
@keyframes xpBlink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(0.08); } }
.xp-pupils { transition: transform 0.4s ease; }
.xp-brows { transition: transform 0.3s ease; }
.xp-mouth-open { opacity: 0; transform-origin: 50% 0; }
.xp.is-talking .xp-mouth-closed { opacity: 0; }
.xp.is-talking .xp-mouth-open { opacity: 1; animation: xpTalk 0.62s infinite; }
@keyframes xpTalk { 0% { transform: scaleY(0.35); } 18% { transform: scaleY(0.95); } 34% { transform: scaleY(0.5); } 52% { transform: scaleY(1); } 70% { transform: scaleY(0.3); } 86% { transform: scaleY(0.75); } 100% { transform: scaleY(0.35); } }
.xp.is-talking .xp-brows { transform: translateY(-2px); }
.xp[data-state="listening"] .xp-z-head { animation: xpNod 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes xpNod { 0%, 100% { transform: rotate(-3deg); } 30% { transform: rotate(-3deg) translateY(2px); } 50% { transform: rotate(-2deg); } 70% { transform: rotate(-3deg) translateY(2px); } }
.xp-think { opacity: 0; transition: opacity 0.25s; }
.xp[data-state="thinking"] .xp-think { opacity: 1; }
.xp[data-state="thinking"] .xp-pupils { transform: translate(3px, -3px); }
.xp[data-state="thinking"] .xp-brows { transform: translateY(-3px); }
.xp-think .xp-cdot { animation: chatDot 1.1s infinite ease-in-out; }
.xp-think .xp-cdot:nth-of-type(2) { animation-delay: 0.15s; }
.xp-think .xp-cdot:nth-of-type(3) { animation-delay: 0.3s; }
.xp[data-state="ringing"] .xp-zaid { opacity: 0.45; filter: blur(1.5px); transition: opacity 0.4s, filter 0.4s; }
.xp[data-state="ringing"] .xp-stage::after { content: 'جارٍ الاتصال بالأستاذ محمد…'; position: absolute; inset: auto 0 44% 0; text-align: center;
    font-weight: 700; font-size: 1rem; letter-spacing: 0; animation: xpBlinkDot 1.2s infinite; }

/* صورة الطالب الصغيرة (كمكالمة الفيديو) */
.xp-self { position: absolute; bottom: 12px; left: 12px; z-index: 2; width: 66px; height: 66px; border-radius: 12px; display: grid; place-items: center;
    align-content: center; gap: 0; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18); }
.xp-self-i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #0A1626; background: #CFE0F2; }
.xp-self small { font-size: 0.68rem; opacity: 0.85; }
.xp[data-state="listening"] .xp-self { border-color: var(--ok); box-shadow: 0 0 0 0 rgba(var(--ok-rgb), 0.6); animation: xpPulse 1.3s infinite; }
@keyframes xpPulse { 70% { box-shadow: 0 0 0 10px rgba(var(--ok-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--ok-rgb), 0); } }

/* الترجمة (كلام الخبير) */
.xp-sub { position: absolute; z-index: 2; right: 12px; left: 90px; bottom: 12px; margin: 0; padding: 7px 12px; border-radius: 10px;
    font-size: 1rem; line-height: 1.7; text-align: center; color: #FFFFFF; background: rgba(4, 10, 20, 0.72); max-height: 48%; overflow-y: auto; }
.xp-sub[hidden], .xp-sub:empty { display: none; }
.xp-sub.is-hint { font-size: 0.9rem; color: #DCE6F2; background: rgba(4, 10, 20, 0.6); }

/* نص المكالمة وشاشة المنع/النهاية فوق الشاشة */
.xp-over { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 18px; background: rgba(6, 14, 26, 0.84); }
.xp-over[hidden] { display: none; }
.xp-ov { max-width: 400px; text-align: center; display: grid; gap: 10px; line-height: 1.85; }
.xp-ov p { margin: 0; }
.xp-ov-h { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.xp-ov-s { font-size: 0.85rem; opacity: 0.8; }
.xp-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.xp-acts .btn-action { text-decoration: none; }
.xp-log { position: absolute; inset: 0; z-index: 5; overflow-y: auto; overscroll-behavior: contain; padding: 14px;
    background: rgba(6, 14, 26, 0.97); }
.xp-log[hidden] { display: none; }
.xp-log-in { display: grid; gap: 10px; }
.xp-lg { font-size: 0.92rem; line-height: 1.8; }
.xp-lg > b { display: block; font-size: 0.78rem; opacity: 0.7; }
.xp-lg.is-me > div { color: #CFE7FF; }
.xp-lg p { margin: 0 0 4px; }
.xp-lg-board { margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.07); }
.xp-lg-book { margin-top: 6px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(var(--d-signal-rgb), 0.5); background: rgba(var(--d-signal-rgb), 0.08); }
.xp-lg-book > b { display: block; color: rgb(var(--d-signal-rgb)); margin-bottom: 2px; }

/* ما يقوله الطالب (يُكتب وهو يتكلم) */
.xp-me { display: flex; align-items: flex-start; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--raise); }
.xp-me[hidden] { display: none; }
.xp-me-ico { color: var(--ink-muted); display: inline-flex; margin-top: 3px; }
.xp-me-ico svg { width: 18px; height: 18px; }
.xp-me.is-live .xp-me-ico { color: var(--ok); animation: xpBlinkDot 1.1s infinite; }
.xp-me-t { flex: 1; margin: 0; font-size: 0.95rem; line-height: 1.7; color: var(--ink-soft); max-height: 5.2em; overflow-y: auto; }
.xp-me.is-live .xp-me-t { color: var(--ink); }
.xp-again { font: inherit; font-size: 0.82rem; flex: none; padding: 3px 10px; cursor: pointer; color: var(--signal); background: none;
    border: 1px solid var(--signal); border-radius: 999px; }

/* اللوح وجواب الكتاب */
.xp-board { flex: 1 1 auto; min-height: 0; max-height: 34vh; overflow-y: auto; overscroll-behavior: contain; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px;
    border-bottom: 1px solid var(--line); background: var(--sheet); }
.xp-board-h { margin: 0; font-size: 0.78rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0; }
.xp-board[hidden] { display: none; }
.xp-lines { display: grid; gap: 4px; }
.xp-lines:empty { display: none; }
.xp-line { margin: 0; padding: 4px 10px; text-align: center; font-size: 1.02rem; line-height: 1.9; border-inline-start: 3px solid var(--signal); background: var(--inset);
    border-radius: 4px; overflow-x: auto; animation: xpWrite 0.35s ease-out; }
@keyframes xpWrite { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.xp-book { padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(var(--signal-rgb), 0.55); background: var(--signal-soft); }
.xp-book-h { margin: 0 0 4px; font-weight: 700; color: var(--signal); }
.xp-book-t { line-height: 1.95; font-size: 1rem; }
.xp-book-t p { margin: 0 0 6px; }
.xp-book-t p:last-child { margin-bottom: 0; }
.xp-book-t ol, .xp-book-t ul { margin: 0 0 6px; padding-inline-start: 22px; }
.xp-book-t .katex-display, .xp-line .katex-display { margin: 4px 0; overflow-x: auto; overflow-y: hidden; }

/* الكتابة */
.xp-type { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.xp-type[hidden] { display: none; }
.xp-type textarea { flex: 1; min-height: 42px; max-height: 120px; resize: none; padding: 9px 12px; font: inherit; line-height: 1.6; color: var(--ink);
    background: var(--inset); border: 1px solid var(--line-strong); border-radius: 10px; }
.xp-type textarea:focus { outline: 2px solid var(--signal); outline-offset: 0; border-color: transparent; }
.xp-send { flex: none; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    color: var(--signal-ink); background: var(--signal); border: 0; border-radius: 10px; }
.xp-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* أزرار المكالمة */
.xp-ctrl { display: flex; justify-content: center; align-items: flex-end; gap: 6px; padding: 10px 10px 6px; flex-wrap: nowrap; }
.xp-b { flex: 1 1 0; max-width: 84px; min-width: 0; display: grid; justify-items: center; gap: 4px; padding: 6px 2px; font: inherit; font-size: 0.74rem;
    font-weight: 600; cursor: pointer; color: var(--ink-soft); background: none; border: 0; border-radius: 12px; }
.xp-b svg { width: 46px; height: 46px; padding: 12px; border-radius: 50%; background: var(--raise); border: 1px solid var(--line-strong); color: var(--ink);
    box-sizing: border-box; transition: background 0.15s, transform 0.15s; }
.xp-b span { white-space: nowrap; }
.xp-b:hover:not(:disabled) svg { background: var(--hover); transform: translateY(-1px); }
.xp-b:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.xp-b:disabled { opacity: 0.42; cursor: not-allowed; }
.xp-b[aria-pressed="true"] svg { background: var(--signal-soft); border-color: var(--signal); color: var(--signal); }
.xp-mic svg { width: 54px; height: 54px; padding: 14px; color: var(--signal-ink); background: var(--signal); border-color: transparent; }
.xp-mic:hover:not(:disabled) svg { background: var(--signal-hover); }
.xp-mic.is-on svg { color: #FFFFFF; background: var(--ok); animation: xpPulse 1.3s infinite; }
.xp-end svg { color: #FFFFFF; background: #E5484D; border-color: transparent; }
.xp-end:hover:not(:disabled) svg { background: #C93A3F; }
.xp-foot { margin: 0; padding: 2px 14px 10px; display: grid; gap: 2px; text-align: center; font-size: 0.74rem; line-height: 1.6; color: var(--ink-muted); }
.xp-tip[hidden] { display: none; }
.xp-tip { color: var(--ink-soft); }
.xp-vname[hidden] { display: none; }
.xp-vname { color: var(--ink-soft); overflow-wrap: anywhere; }

/* حين يُكتب على اللوح: الحاسوب جنباً إلى جنب (الأستاذ يميناً واللوح يساراً)، والشاشات الأصغر: الأستاذ أصغر واللوح أكبر */
.xp.has-board .xp-card { width: min(1080px, 100%); }
.xp.has-board .xp-board { font-size: 1.04rem; }
@media (min-width: 900px) {
    .xp.has-board .xp-main { flex: none; flex-direction: row; height: min(60vh, 520px); }
    .xp.has-board .xp-stage { flex: 0 0 50%; aspect-ratio: auto; height: 100%; min-height: 0; }
    .xp.has-board .xp-board { flex: 1 1 0; height: 100%; max-height: none; border-bottom: 0; border-inline-start: 1px solid var(--line); padding: 14px 18px; }
    .xp.has-board .xp-book-t { font-size: 1.06rem; }
}
@media (max-width: 899px) {
    .xp.has-board .xp-card { height: calc(100dvh - 32px); }
    .xp.has-board .xp-stage { flex: none; aspect-ratio: auto; height: 32vh; min-height: 170px; }
    .xp.has-board .xp-board { flex: 1 1 auto; max-height: none; min-height: 24vh; }
}
.xp-left:empty { display: none; }
.xp-left { color: var(--ink-soft); font-weight: 600; }
.xp-left.is-out { color: var(--bad); }

@media (max-width: 640px) {
    .xp { padding: 0; }
    .xp-card { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
    .xp-stage { aspect-ratio: auto; flex: 1 1 auto; min-height: 200px; }
    .xp-board { flex: 0 1 auto; max-height: 30dvh; }
    .xp.has-board .xp-card { height: 100dvh; }
    .xp.has-board .xp-stage { height: 30dvh; min-height: 150px; }
    .xp-b { font-size: 0.68rem; }
    .xp-b svg { width: 42px; height: 42px; padding: 11px; }
    .xp-mic svg { width: 50px; height: 50px; padding: 13px; }
    .xp-self { width: 54px; height: 54px; }
    .xp-self-i { width: 28px; height: 28px; }
    .xp-sub { left: 76px; font-size: 0.95rem; }
}
@media (max-width: 560px) {
    .section-tabs .st-tab.st-expert { flex: 1 1 50%; border-left: 1px solid var(--line); border-top: 1px solid var(--line); justify-content: center; margin: 0; }
    .section-tabs .st-tab.st-expert + .st-tab.st-chat { flex: 1 1 50%; }
}
@media (prefers-reduced-motion: reduce) {
    .xp-z-body, .xp-z-head, .xp-eyes, .st-tab.st-expert > svg:first-child, .xp-live i, .xp-self, .xp-mic.is-on svg { animation: none !important; }
    .xp.is-talking .xp-mouth-open { animation: none; transform: scaleY(0.7); }
    .xp-card { animation: none; }
}
/* صورة الأستاذ الثابتة في دائرة: لـ«الدرس الحي» وحده (js/live.js، PG.expert.portrait) */
.xp-portrait { position: relative; z-index: 1; display: block; width: 100%; height: 100%; border-radius: 50%;
    background: radial-gradient(circle at 50% 38%, #4E7FA6, #24496B 72%); border: 3px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35); }
@media print { .xp, .st-expert { display: none !important; } }

/* =====================================================
   علامة التوقف (js/resume.js): بطاقة «أكمل من حيث توقفت» في الواجهة، وعلامة «هنا توقفت» في الصفحة،
   وشريط «انتقل إليه» حين يفتح الطالب صفحة له فيها موضع محفوظ (21 تشرين الثاني 2026)
   ===================================================== */
.rs-card {
    margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line-strong); border-inline-start: 4px solid var(--signal);
    border-radius: var(--radius); background: var(--inset); display: grid; gap: 8px;
}
.rs-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rs-k { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.rs-when { font-size: 0.88rem; color: var(--ink-muted); }
.rs-card p { margin: 0; line-height: 1.8; }
.rs-ch { font-size: 0.9rem; color: var(--ink-muted); }
.rs-where { color: var(--ink); font-weight: 600; }
.rs-sec {
    display: inline-block; margin-inline-end: 6px; padding: 0 8px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
    background: var(--signal-soft); color: var(--signal); border: 1px solid rgba(var(--signal-rgb), 0.45); vertical-align: 1px;
}
.rs-spot { color: var(--ink-soft); }
.rs-prog { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rs-bar { flex: 1 1 140px; max-width: 260px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rs-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--signal); }
.rs-pct { font-size: 0.86rem; color: var(--ink-muted); }
.rs-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.rs-back { background: none; border: 0; padding: 4px 0; color: var(--ink-soft); font: inherit; font-size: 0.95rem; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.rs-back:hover { color: var(--ink); }
.rs-next.is-locked::after { content: " 🔒"; }

/* «هنا توقفت آخر مرة»: فوق الفقرة نفسها، وتبقى حتى ينتقل الطالب إلى صفحة أخرى */
.rs-flag {
    display: block; width: fit-content; margin: 6px 0 8px; padding: 2px 12px; border-radius: 999px;
    background: var(--signal); color: var(--signal-ink); font-family: var(--font-body); font-size: 0.9rem; font-weight: 700; line-height: 1.8;
    box-shadow: 0 4px 14px rgba(var(--signal-rgb), 0.35);
}
li > .rs-flag { margin-top: 0; }
/* في عنصر قائمة: شارة صغيرة في أول السطر بعد الرقم، والنص يكمل بعدها */
.rs-flag.is-inline { display: inline-block; margin: 0; margin-inline-end: 8px; padding: 0 10px; font-size: 0.82rem; line-height: 1.7; vertical-align: 1px; box-shadow: none; }
.rs-here { animation: rs-here 6s ease-out 1; border-radius: var(--radius); }
@keyframes rs-here {
    0%, 55% { outline: 2px solid rgba(var(--signal-rgb), 0.75); outline-offset: 5px; }
    100% { outline: 2px solid rgba(var(--signal-rgb), 0); outline-offset: 5px; }
}

/* شريط «انتقل إليه» أسفل الشاشة */
.rs-pill {
    position: fixed; z-index: 1500; bottom: 18px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
    display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px;
    background: var(--bg-deep); color: var(--ink); border: 1px solid var(--line-strong); border-inline-start: 3px solid var(--signal);
    border-radius: var(--radius); box-shadow: var(--shadow); font-size: 0.95rem; line-height: 1.7; animation: rs-pill-in 0.25s ease-out;
}
.rs-pill-t { flex: 1 1 auto; min-width: 0; }
.rs-pill-t b { font-weight: 700; }
.rs-pill-go { flex-shrink: 0; padding: 6px 14px; border: 0; border-radius: var(--radius); background: var(--signal); color: var(--signal-ink); font: inherit; font-weight: 700; cursor: pointer; }
.rs-pill-go:hover { background: var(--signal-hover); }
.rs-pill-x { flex-shrink: 0; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--ink-muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.rs-pill-x:hover { background: var(--hover); color: var(--ink); }
@keyframes rs-pill-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 560px) {
    .rs-card { padding: 14px; }
    .rs-pill { bottom: 12px; flex-wrap: wrap; }
    .rs-pill-t { flex-basis: calc(100% - 44px); }
}
@media (prefers-reduced-motion: reduce) { .rs-here, .rs-pill { animation: none; } }
@media print { .rs-card, .rs-flag, .rs-pill { display: none !important; } }

/* =====================================================
   «جديد المنصة» (js/news.js): آخر التحديثات للطالب بعد الدخول، تختفي بزر «فهمت» (21 تشرين الثاني 2026)
   ===================================================== */
/* «جديد المنصة»: نافذة منبثقة (js/news.js) */
.nw-pop { position: fixed; inset: 0; z-index: 1800; display: grid; place-items: center; padding: 16px;
    background: rgba(3, 10, 20, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadeIn 0.2s ease-out; }
body.nw-lock { overflow: hidden; }
.nw-pop-card { width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; overflow: hidden;
    background: var(--sheet); color: var(--ink); border: 1px solid var(--line-strong); border-top: 3px solid var(--signal); border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); animation: xpIn 0.28s ease-out; }
.nw-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex: none; }
.nw-pop-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }
.nw-x { width: 34px; height: 34px; flex: none; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); background: none;
    border: 1px solid var(--line-strong); border-radius: 50%; font: inherit; font-size: 1rem; line-height: 1; }
.nw-x:hover { color: var(--ink); background: var(--hover); }
.nw-pop-body { padding: 14px 18px; overflow-y: auto; display: grid; gap: 12px; }
.nw-pop-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; flex: none; }
.nw-up { display: grid; gap: 6px; }
.nw-up + .nw-up { border-top: 1px dashed var(--line); padding-top: 10px; }
.nw-date { margin: 0; font-size: 0.85rem; color: var(--ink-muted); }
.nw-up ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nw-up li { display: flex; gap: 10px; align-items: baseline; color: var(--ink-soft); line-height: 1.8; }
.nw-i { flex-shrink: 0; width: 1.4em; text-align: center; }
.nw-link { color: var(--signal); font-weight: 700; text-decoration: none; white-space: nowrap; }
.nw-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.nw-more { margin: 0; font-size: 0.86rem; color: var(--ink-muted); }
.nw-again { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 5px 14px; border: 1px dashed var(--line-strong); border-radius: 999px;
    background: none; color: var(--ink-soft); font: inherit; font-size: 0.9rem; cursor: pointer; }
.nw-again:hover { border-color: var(--signal); color: var(--signal); }
@media (prefers-reduced-motion: reduce) { .nw-pop, .nw-pop-card { animation: none; } }
@media print { .nw-pop, .nw-again { display: none !important; } }

/* التحقق من أن المستخدم ليس برنامجاً آلياً (Cloudflare Turnstile): مساحة لا تظهر إلا إن احتاج الطالب إلى الضغط */
.acc-captcha:empty { display: none; }
.acc-captcha { display: flex; justify-content: center; min-height: 0; }
.acc-captcha iframe { max-width: 100%; }

/* العلامة المائية باسم الطالب (js/account.js): فوق المحتوى كله ومنه الرسوم والمحاكيات، ولا تمنع النقر */
.wm { position: absolute; inset: 0; z-index: 25; pointer-events: none; background-repeat: repeat; background-position: 0 0;
      -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.wm[hidden] { display: none; }

/* كشف مصدر التسريب في لوحة الإدارة (js/admin.js) */
.adm-leak { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.adm-leak-col { display: grid; gap: 10px; align-content: start; }
.adm-leak-t { margin: 0; font-size: 1rem; color: var(--ink); }
.adm-leak-pick { width: fit-content; cursor: pointer; }
.adm-leak-ctl { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.9rem; color: var(--ink-soft); }
.adm-leak-ctl label { display: flex; align-items: center; gap: 8px; }
.adm-leak-out { width: 100%; height: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #808080; }
.adm-leak-col textarea { width: 100%; min-height: 110px; resize: vertical; }

/* =========================================================
   «الدرس الحي مع الأستاذ زيد» (js/live.js، تجربة 23 تشرين الثاني 2026)
   اللوح «جزيرة» داكنة في المظهرين كالرسوم والمحاكيات (أضيف .lv-board إلى محددات الجزر أعلى الملف)
   ========================================================= */
/* بطاقة الدرس الحي أعلى صفحة الدرس */
.lv-entry { display: flex; align-items: center; gap: 12px 14px; flex-wrap: wrap; margin: 0 0 18px; padding: 12px 14px;
    border: 1px solid rgba(var(--signal-rgb), 0.55); border-radius: 14px;
    background: linear-gradient(135deg, rgba(var(--signal-rgb), 0.14), rgba(var(--signal-rgb), 0.04)); }
.lv-entry-av { width: 56px; height: 56px; flex: none; border-radius: 50%; }
.lv-entry-av .xp-portrait, .lv-av .xp-portrait { width: 100%; height: 100%; border-width: 2px; }
.lv-entry-t { flex: 1 1 220px; min-width: 0; display: grid; gap: 2px; line-height: 1.55; }
.lv-entry-t b { font-family: var(--font-display); font-size: 1.08rem; }
.lv-entry-t span { font-size: 0.92rem; color: var(--ink-soft); }
.lv-entry-go { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.lv-entry-go svg { width: 18px; height: 18px; }
@media (max-width: 600px) { .lv-entry-go { width: 100%; } }
.lv-pilot { display: inline-block; vertical-align: middle; margin-inline-start: 6px; padding: 0 8px; font-family: var(--font-body); font-size: 0.7rem;
    font-weight: 700; line-height: 1.7; color: var(--signal); border: 1px solid rgba(var(--signal-rgb), 0.6); border-radius: 999px; }

/* النافذة */
.lv { position: fixed; inset: 0; z-index: 1650; display: grid; place-items: center; padding: 12px;
    background: rgba(3, 10, 20, 0.66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.lv[hidden] { display: none; }
body.lv-open { overflow: hidden; }
.lv-card { width: min(880px, 100%); height: min(calc(100dvh - 24px), 860px); display: flex; flex-direction: column; overflow: hidden;
    background: var(--bg-deep); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); animation: xpIn 0.28s ease-out; }
@media (max-width: 600px) {
    .lv { padding: 0; }
    .lv-card { width: 100%; height: 100dvh; border-radius: 0; border: 0; }
}
.lv-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.lv-av { position: relative; width: 42px; height: 42px; flex: none; border-radius: 50%; }
.lv-av-ini { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; font-weight: 700; color: var(--signal-ink); background: var(--signal); }
.lv-halo { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(var(--signal-rgb), 0.7); opacity: 0; }
.lv.is-talking .lv-halo { animation: xpHalo 1.6s ease-out infinite; }
.lv-who { flex: 1; min-width: 0; display: grid; line-height: 1.4; }
.lv-who b { font-family: var(--font-display); font-size: 1rem; }
.lv-where { font-size: 0.8rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-x { width: 36px; height: 36px; flex: none; display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); background: none;
    border: 1px solid var(--line-strong); border-radius: 50%; }
.lv-x:hover { color: var(--ink); background: var(--hover); }

/* اللوح */
.lv-board { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
    color: var(--ink); background: var(--grid-fine), var(--screen); }
.lv-vis { flex: 0 1 auto; min-height: 0; padding: 8px 10px 0; display: flex; justify-content: center; }
.lv-vis[hidden] { display: none; }
.lv-vis svg { display: block; width: 100%; max-width: 640px; height: auto; max-height: min(46vh, 360px); }
.lv.lv-haschalk .lv-vis svg { max-height: min(38vh, 330px); }
/* البطاقة الطويلة لا تصغّر الرسم (29 ت2): الرسم بارتفاعه، واللوح تحته يتمرر */
.lv.lv-haschalk .lv-vis { flex-shrink: 0; }
/* بلا كتابة على اللوح: الرسم في وسط اللوح وأكبر */
.lv:not(.lv-haschalk):not(.lv-novis) .lv-board { justify-content: center; }
.lv:not(.lv-haschalk):not(.lv-novis) .lv-vis svg { max-height: min(56vh, 460px); }
.lv-read { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; padding: 4px 10px 6px;
    font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft); }
.lv-read[hidden] { display: none; }
.lv-chip { padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); white-space: nowrap; }
.lv-chip b { color: var(--ink); font-weight: 700; }
.lv-chip.lv-c-xl, .lv-chip.lv-c-xl b { color: var(--neg); }
.lv-chip.lv-c-xc, .lv-chip.lv-c-xc b { color: var(--pos); }
.lv-chip.lv-c-sig, .lv-chip.lv-c-sig b { color: var(--signal); }
.lv-chalk { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 6px;
    padding: 6px 14px 14px; border-top: 1px dashed var(--line); }
.lv-chalk[hidden] { display: none; }
.lv.lv-novis .lv-chalk { border-top: 0; padding-top: 14px; }
.lv-eq .katex-display { margin: 0.15em 0; overflow-x: auto; overflow-y: hidden; }
.lv.lv-novis .lv-eq .katex-display { font-size: 1.12em; }
.lv-new { animation: lvIn 0.5s ease-out both; }
@keyframes lvIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.lv-card-i { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); border-inline-start: 4px solid var(--ink-muted);
    background: rgba(255, 255, 255, 0.035); line-height: 1.75; font-size: 0.96rem; }
.lv-card-h { margin: 0 0 2px; font-weight: 700; font-size: 0.85rem; color: var(--ink-soft); }
.lv-k-exam { border-inline-start-color: var(--signal); }
.lv-k-exam .lv-card-h { color: var(--signal); }
.lv-k-warn { border-inline-start-color: var(--bad); }
.lv-k-key { border-inline-start-color: var(--neg); }
.lv-tbl { margin: 0; font-size: 0.88rem; }
.lv-tbl tbody tr { opacity: 0.12; transition: opacity 0.5s ease; }
.lv-tbl tbody tr.is-on { opacity: 1; }

/* السؤال والمساعدة والبداية والنهاية: فوق اللوح */
.lv-ask { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; overflow-y: auto; padding: 14px;
    background: rgba(4, 12, 24, 0.84); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.lv-ask[hidden] { display: none; }
.lv-ask-in { width: min(540px, 100%); padding: 14px 16px; border-radius: 14px; background: var(--sheet); border: 1px solid var(--line-strong);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); animation: lvIn 0.3s ease-out both; }
.lv-ask-k { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--signal); }
.lv-ask-q { margin: 0 0 10px; font-size: 1.04rem; line-height: 1.75; }
.lv-opts { display: grid; gap: 8px; }
.lv-opt { display: block; width: 100%; text-align: start; padding: 10px 12px; font: inherit; line-height: 1.6; cursor: pointer; color: var(--ink);
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-strong); border-radius: 10px; }
.lv-opt:hover:not(:disabled) { background: var(--hover); border-color: rgba(var(--signal-rgb), 0.7); }
.lv-opt:disabled { cursor: default; opacity: 0.55; }
.lv-opt small { display: block; font-size: 0.78rem; color: var(--ink-muted); }
.lv-opt.is-ok { opacity: 1; border: 2px solid var(--ok); background: rgba(var(--ok-rgb), 0.16); }
.lv-opt.is-ok::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.lv-opt.is-bad { opacity: 1; border: 2px solid var(--bad); background: rgba(var(--bad-rgb), 0.12); }
.lv-opt.is-bad::before { content: '✗ '; color: var(--bad); font-weight: 700; }
.lv-fb { margin: 10px 0 0; line-height: 1.75; }
.lv-fb.ok { color: var(--ok); }
.lv-ask-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.lv-ask-acts .btn-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.lv-ask-acts .btn-action svg { width: 18px; height: 18px; }
.lv-ask-acts.lv-col { flex-direction: column; }
.lv-ask-acts.lv-col .btn-action { width: 100%; }
.lv-start-t { margin: 0 0 8px; font-family: var(--font-display); font-size: 1.15rem; }
.lv-start-l { margin: 0; padding-inline-start: 2px; list-style: none; display: grid; gap: 4px; line-height: 1.7; color: var(--ink-soft); }
.lv-note { margin: 10px 0 0; font-size: 0.86rem; color: var(--ink-muted); }
.lv-end-s { margin: 0 0 4px; font-size: 1.02rem; }

/* المهمة: منزلق تحت الرسم */
.lv-task { flex: none; padding: 6px 14px 10px; border-top: 1px dashed var(--line); }
.lv-task[hidden] { display: none; }
.lv-task-l { display: grid; gap: 6px; font-weight: 700; color: var(--signal); }
.lv-task-l input { width: 100%; accent-color: var(--signal); min-height: 32px; }
.lv-task-acts { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.lv-task-st { font-size: 0.9rem; color: var(--ink-soft); }
.lv-task-st.ok { color: var(--ok); font-weight: 700; }
.lv.lv-tasking .lv-chalk { display: none; }

/* الترجمة والتقدم والأزرار */
.lv-say { flex: none; margin: 0; padding: 10px 16px; min-height: calc(3 * 1.7em + 20px); max-height: calc(5 * 1.7em + 20px); overflow-y: auto;
    font-size: 1.02rem; line-height: 1.7; border-top: 1px solid var(--line); background: var(--bg-deep); }
.lv-prog { flex: none; display: flex; gap: 3px; align-items: center; height: 16px; padding: 0 14px; }
.lv-seg { position: relative; height: 6px; padding: 0; cursor: pointer; border: 0; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.lv-seg i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: var(--signal); transition: width 0.4s ease; }
.lv-seg.is-cur { height: 9px; }
.lv-ctl { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px calc(8px + env(safe-area-inset-bottom)); }
.lv-media { display: flex; align-items: center; gap: 6px; }
.lv-b { width: 42px; height: 42px; display: grid; place-items: center; flex: none; cursor: pointer; font: inherit; font-weight: 700; font-size: 0.85rem;
    color: var(--ink); background: var(--raise); border: 1px solid var(--line-strong); border-radius: 50%; }
.lv-b:hover:not(:disabled) { background: var(--hover); }
.lv-b:disabled { opacity: 0.4; cursor: default; }
.lv-b.lv-play { width: 50px; height: 50px; color: var(--signal-ink); background: var(--signal); border-color: var(--signal); }
.lv-b.lv-play:hover:not(:disabled) { background: var(--signal-hover); }
.lv-b.is-off { color: var(--ink-muted); }
.lv-help { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 6px 14px; cursor: pointer;
    font: inherit; font-weight: 700; color: var(--signal); background: var(--signal-soft); border: 1px solid rgba(var(--signal-rgb), 0.6); border-radius: 999px; }
.lv-help:hover:not(:disabled) { background: rgba(var(--signal-rgb), 0.22); }
.lv-help:disabled { opacity: 0.45; cursor: default; }
@media (max-width: 420px) {
    .lv-ctl { gap: 6px; padding-inline: 8px; }
    .lv-media { gap: 4px; }
    .lv-b { width: 38px; height: 38px; }
    .lv-b.lv-play { width: 46px; height: 46px; }
    .lv-help { padding: 6px 10px; font-size: 0.9rem; }
    .lv-help-l { display: none; }
}

/* رسوم اللوح (SVG) */
.lv-vis svg text { font-family: var(--font-body); }
.lv-k { opacity: 0; transition: opacity 0.45s ease; }
.lv-k.is-on { opacity: 1; }
.lv-grid { stroke: var(--grid-major); stroke-width: 1; }
.lv-axis { stroke: var(--ink-muted); stroke-width: 1.3; }
.lv-tick { fill: var(--ink-muted); font-size: 10px; font-family: var(--font-mono) !important; }
.lv-alab { fill: var(--ink-soft); font-size: 11px; }
.lv-lab { fill: var(--ink); font-size: 12.5px; font-weight: 700; }
.lv-sub { font-size: 70%; }
.lv-c-xl { fill: var(--neg); } .lv-c-xc { fill: var(--pos); } .lv-c-sig { fill: var(--signal); }
.lv-xl { fill: none; stroke: var(--neg); stroke-width: 2.6; stroke-linecap: round; }
.lv-xc { fill: none; stroke: var(--pos); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.lv-cur { stroke: var(--ink-muted); stroke-width: 1.2; stroke-dasharray: 3 3; }
.lv-dot-xl { fill: var(--neg); } .lv-dot-xc { fill: var(--pos); }
.lv-cross { fill: rgba(var(--signal-rgb), 0.2); stroke: var(--signal); stroke-width: 2; }
.lv-k.is-on .lv-cross { animation: lvPulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes lvPulse { 50% { transform: scale(1.25); } }
.lv-zone-c { fill: rgba(255, 138, 128, 0.08); } .lv-zone-l { fill: rgba(124, 199, 255, 0.08); }
.lv-zt { fill: var(--ink-soft); font-size: 13px; font-weight: 700; }
.lv-c200 { fill: none; stroke: var(--signal); stroke-width: 2.6; stroke-linejoin: round; }
.lv-c500 { fill: none; stroke: var(--neg); stroke-width: 2.2; stroke-linejoin: round; }
.lv-c1000 { fill: none; stroke: var(--pos); stroke-width: 2.2; stroke-linejoin: round; }
.lv-c200-t { fill: var(--signal); } .lv-c500-t { fill: var(--neg); } .lv-c1000-t { fill: var(--pos); }
.lv-flow-base { fill: none; stroke: var(--ink-muted); stroke-width: 2; }
.lv-flow { fill: none; stroke: var(--signal); stroke-width: 3; stroke-dasharray: 6 14; stroke-linecap: round; }
.lv-gap { fill: var(--screen); }
.lv-src { fill: var(--screen); stroke: var(--ink); stroke-width: 2; }
.lv-src-w { fill: none; stroke: var(--signal); stroke-width: 2; }
.lv-part { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.lv-plate { stroke: var(--ink); stroke-width: 3; }
.lv-meter { fill: var(--screen); stroke: var(--ink); stroke-width: 2; }
.lv-scale { fill: none; stroke: var(--ink-muted); stroke-width: 1.5; }
.lv-needle { stroke: var(--signal); stroke-width: 2.4; stroke-linecap: round; }
.lv-pin { fill: var(--ink); }
.lv-mA { fill: var(--ink-muted); font-size: 10px; font-weight: 700; }
.lv-read-t { fill: var(--ink); font-size: 12px; font-family: var(--font-mono) !important; }
.lv-tune { fill: none; stroke: var(--signal); stroke-width: 2; opacity: 0.85; }
.lv-bar { fill: var(--line-strong); }
.lv-bar.is-tuned { fill: var(--signal); }
.lv-tower { fill: none; stroke: var(--ink-muted); stroke-width: 1.6; stroke-linejoin: round; }
.lv-st { fill: var(--ink-soft); font-size: 11px; }
.lv-on { fill: var(--signal); font-size: 11.5px; font-weight: 700; transition: opacity 0.3s ease; }
.lv-knob { fill: var(--sheet); stroke: var(--ink); stroke-width: 2; }
.lv-knob-i { stroke: var(--signal); stroke-width: 3; stroke-linecap: round; }
.lv-ground { stroke: var(--ink-muted); stroke-width: 1.5; }
.lv-frame { fill: none; stroke: var(--ink-soft); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.lv-rope { stroke: var(--ink-muted); stroke-width: 1.6; }
.lv-seat { fill: var(--signal); }
.lv-kid { fill: #E8B88E; }
.lv-kid-b { fill: none; stroke: #7CC7FF; stroke-width: 4; stroke-linecap: round; }
.lv-push path { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* المؤشر في الدرس الحي (23 تشرين الثاني 2026): حلقة تنبض وسهم عند الشيء الذي يذكره الأستاذ، والشيء نفسه يتوهج.
   لون كهرماني واحد في المظهرين (اللوح جزيرة داكنة دائماً)، غير ألوان الرسوم نفسها */
.lv-pt { pointer-events: none; }
.lv-pt-ring { fill: none; stroke: #FFC857; stroke-width: 2.6; }
.lv-pt-pulse { stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: lvPtPulse 1.3s ease-out infinite; }
@keyframes lvPtPulse { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.4); } }
.lv-pt-shaft { fill: none; stroke: #FFC857; stroke-width: 3.2; stroke-linecap: round; }
.lv-pt-head { fill: #FFC857; }
.lv-pt-bob { animation: lvPtBob 0.9s ease-in-out infinite; }
@keyframes lvPtBob { 50% { transform: translateY(-4px); } }
.lv-board .is-pt { filter: drop-shadow(0 0 2px #FFC857) drop-shadow(0 0 5px rgba(255, 200, 87, 0.7)); }
.lv-vname { opacity: 0.85; font-size: 0.8rem; overflow-wrap: anywhere; }
.lv-chip.is-pt { border-color: #FFC857; box-shadow: 0 0 0 1px #FFC857, 0 0 10px rgba(255, 200, 87, 0.45); animation: lvChipPt 1.3s ease-in-out infinite; }
@keyframes lvChipPt { 50% { box-shadow: 0 0 0 2px #FFC857, 0 0 14px rgba(255, 200, 87, 0.6); } }
@media (prefers-reduced-motion: reduce) { .lv-pt-pulse, .lv-pt-bob, .lv-chip.is-pt { animation: none; } }
@media (prefers-reduced-motion: reduce) {
    .lv-new, .lv-ask-in, .lv-card { animation: none; }
    .lv-k.is-on .lv-cross, .lv.is-talking .lv-halo { animation: none; }
}

/* =========================================================
   رسوم «الدرس الحي» للفصل الأول: المتسعات (js/live.js، 27 تشرين الثاني 2026)
   ========================================================= */
.lv-q { font-size: 13px; font-weight: 700; font-family: var(--font-mono) !important; transition: opacity 0.25s ease; }
.lv-qp, .lv-c-pos { fill: var(--pos); }
.lv-qn, .lv-c-neg { fill: var(--neg); }
.lv-cond { fill: rgba(190, 205, 222, 0.16); stroke: var(--ink-soft); stroke-width: 1.8; }
.lv-pl { fill: rgba(190, 205, 222, 0.42); }
.lv-glass { fill: rgba(124, 199, 255, 0.07); }
.lv-shine { fill: rgba(255, 255, 255, 0.16); }
.lv-stand { fill: var(--line-strong); }
.lv-field { stroke: var(--signal); stroke-width: 1.6; fill: none; }
.lv-arrf { fill: var(--signal); }
.lv-arrk { fill: var(--ink-soft); }
.lv-dim { stroke: var(--ink-soft); stroke-width: 1.2; }
.lv-wire { fill: none; stroke: var(--ink-muted); stroke-width: 2; stroke-linejoin: round; }
.lv-elec { fill: none; stroke: var(--neg); stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: 0.1 11; opacity: 0; transition: opacity 0.3s ease; }
.lv-batt { stroke: var(--ink); stroke-width: 2.6; }
.lv-batt-s { stroke-width: 5; }
.lv-sw { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.lv-diel { fill: rgba(var(--signal-rgb), 0.17); stroke: rgba(var(--signal-rgb), 0.55); stroke-width: 1; transition: opacity 0.3s ease; }
.lv-ion { fill: rgba(var(--signal-rgb), 0.16); opacity: 0; transition: opacity 0.2s ease; }
.lv-spark { fill: none; stroke: #FFF6D8; stroke-width: 2.6; stroke-linejoin: round; opacity: 0; filter: drop-shadow(0 0 3px #FFC857) drop-shadow(0 0 7px rgba(255, 200, 87, 0.8)); }
.lv-spark.is-on { animation: lvSpark 0.22s steps(2) infinite; }
@keyframes lvSpark { 50% { opacity: 0.35; } }
/* حركة مستمرة لرسوم البيانات (live.figs في السيناريو، data-on="key" يضيف is-run) */
.lv-anim-flow { stroke-dasharray: 6 12; }
.lv-anim-flow.is-run { animation: lvFlow 0.9s linear infinite; }
.lv-anim-flow.lv-rev.is-run { animation-direction: reverse; }
.lv-anim-spin { transform-box: fill-box; transform-origin: center; }
.lv-anim-spin.is-run { animation: lvSpin 2.4s linear infinite; }
.lv-anim-pulse.is-run { animation: lvPulseO 1.2s ease-in-out infinite; }
.lv-anim-blink.is-run { animation: lvSpark 0.5s steps(2) infinite; }
@keyframes lvFlow { to { stroke-dashoffset: -18; } }
@keyframes lvSpin { to { transform: rotate(360deg); } }
@keyframes lvPulseO { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .lv-anim-flow.is-run, .lv-anim-spin.is-run, .lv-anim-pulse.is-run, .lv-anim-blink.is-run { animation: none; } }
.lv-glow { fill: rgba(255, 236, 170, 0.85); opacity: 0; filter: blur(6px); transition: opacity 0.12s ease; }
.lv-lamp { fill: var(--screen); stroke: var(--ink); stroke-width: 2; }
.lv-lamp.is-lit { fill: #FFF3C4; }
.lv-fil { fill: none; stroke: var(--signal); stroke-width: 1.6; }
@media (prefers-reduced-motion: reduce) { .lv-spark.is-on { animation: none; } }

/* جداول المقارنة: جواب كل سؤال يبدأ بـ«قارن» أو «ما الفرق» جدول (طلب صاحب المنصة، 27 تشرين الثاني 2026).
   كل وجه مقارنة سطر عنوان بعرض الجدول (tr.cmp-k)، وتحته قيمة كل عمود؛ فيبقى للأعمدة عرض كافٍ على الجوال. */
.cmp-table tr.cmp-k th { background: var(--inset); font-weight: 700; color: var(--ink-soft); text-align: right; font-size: 0.92em; padding-top: 4px; padding-bottom: 4px; }
.cmp-table thead th { color: var(--ink); }
.cmp-table td, .cmp-table th { vertical-align: top; }
.nm-exa .table-wrap, .dv-ans .table-wrap, .ex-why-blk .table-wrap, .va-steps .table-wrap, .sg-try-a .table-wrap { margin: 6px 0; }
.ex-why-blk { margin-bottom: 4px; }
.cmp-table .katex { font-size: 1.04em; }
.nm-bqin { margin: 4px 0 8px; }
.nm-bqin > :last-child { margin-bottom: 0; }

/* جواب الصيغ الأخرى للسؤال في «سين جيم» */
.va-forms { border-top: 1px dashed var(--line-strong); padding-top: 10px; margin-top: 10px; }
.va-form + .va-form { margin-top: 10px; padding-top: 10px; border-top: 1px dotted var(--line); }
.va-fq { margin: 0 0 4px; color: var(--ink); }

/* =========================================================
   «رحلة الوزاري» (js/quest.js، 27 تشرين الثاني 2026): خريطة المهمات، والجاهزية، و«جاوبت صح / غلطت»، ولحظات الفرح
   ========================================================= */
body { --qz-gold: #FFC53D; --qz-gold-rgb: 255, 197, 61; }
html[data-theme="light"] body { --qz-gold: #C98A00; --qz-gold-rgb: 201, 138, 0; }

/* شريط التقدّم */
.qz-bar { display: block; height: 6px; border-radius: 6px; background: var(--inset); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.qz-bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--signal), var(--qz-gold)); transition: width 0.6s cubic-bezier(.2,.8,.2,1); }

/* حلقة الجاهزية */
.qz-ring { display: block; }
.qz-ring-bg { fill: none; stroke: var(--inset); }
.qz-ring-fg { fill: none; stroke: var(--signal); stroke-linecap: round; animation: qzRing 1.1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes qzRing { from { stroke-dashoffset: var(--qz-c); } }

/* «جاوبت صح / غلطت» تحت الجواب */
.qz-chk { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.qz-q { margin: 0 0 10px; font-size: 0.92rem; color: var(--ink-muted); }
.qz-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.qz-b {
    flex: 1 1 140px; min-height: 44px; padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
    font: inherit; font-weight: 700; font-size: 0.98rem; background: transparent; transition: background 0.15s ease, transform 0.1s ease;
}
.qz-b:active { transform: scale(0.97); }
.qz-yes { color: var(--ok); border: 1.5px solid rgba(var(--ok-rgb), 0.6); }
.qz-yes:hover, .qz-yes.picked { background: rgba(var(--ok-rgb), 0.14); }
.qz-no { color: var(--bad); border: 1.5px solid rgba(var(--bad-rgb), 0.55); }
.qz-no:hover, .qz-no.picked { background: rgba(var(--bad-rgb), 0.12); }
.qz-b.picked { box-shadow: 0 0 0 3px var(--hover); }
.qz-b:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.qz-msg { margin: 10px 0 0; font-size: 0.95rem; line-height: 1.8; min-height: 0; }
.qz-msg:empty { display: none; }
.qz-msg.ok { color: var(--ok); }
.qz-msg.bad { color: var(--ink-soft); }
.qz-msg b { color: var(--qz-gold); }
.qa-head[data-qz]::after { content: attr(data-qz); font-size: 0.76rem; line-height: 1.7; padding: 1px 8px; border-radius: 20px; font-weight: 700; margin-inline-start: auto; }
.qa-head[data-qzs="ok"]::after { color: var(--ok); background: rgba(var(--ok-rgb), 0.12); }
.qa-head[data-qzs="bad"]::after { color: var(--bad); background: rgba(var(--bad-rgb), 0.1); }
.qa-head[data-qzs="due"]::after { color: var(--signal); background: var(--signal-soft); }
.qa-item.qz-right { box-shadow: inset -3px 0 0 rgba(var(--ok-rgb), 0.7); }
.qa-item.qz-wrong { box-shadow: inset -3px 0 0 rgba(var(--bad-rgb), 0.6); }

/* شريط تقدّم الصفحة أعلى «سين جيم» والبنك والوزاري */
.qz-strip {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 14px;
    margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
    background: linear-gradient(90deg, var(--signal-soft), transparent 70%), var(--sheet);
}
.qz-strip-t { font-size: 0.95rem; color: var(--ink-soft); line-height: 1.8; }
.qz-strip-t b { color: var(--ink); }
.qz-strip .qz-bar { grid-column: 1 / -1; grid-row: 2; }
.qz-strip-a { grid-column: 2; grid-row: 1; color: var(--signal); font-weight: 700; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.qz-strip-a:hover { text-decoration: underline; }
.qz-due-n { color: var(--signal); font-weight: 700; }
.qz-stars { color: var(--qz-gold); letter-spacing: 1px; }
.qz-stars i, .qm-st i, .qm-sh-stars i { font-style: normal; color: var(--line-strong); }
@media (max-width: 560px) {
    .qz-strip { grid-template-columns: 1fr; }
    .qz-strip-a { grid-column: 1; grid-row: 3; }
}

/* لحظات الفرح: النقاط الطائرة، والرسائل، والقصاصات، ونافذة الإنجاز */
.qz-fly {
    position: fixed; z-index: 3000; transform: translate(-50%, 0); pointer-events: none;
    font-family: var(--font-mono); font-weight: 700; font-size: 1.15rem; color: var(--qz-gold);
    text-shadow: 0 1px 0 rgba(0,0,0,0.25); animation: qzFly 1.25s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes qzFly { 0% { opacity: 0; transform: translate(-50%, 6px) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -70px) scale(1); } }
.qz-fx { position: fixed; z-index: 2900; top: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.qz-toast {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px;
    background: var(--bg-deep); color: var(--ink); border: 1px solid rgba(var(--qz-gold-rgb), 0.55);
    box-shadow: var(--shadow), 0 0 0 4px rgba(var(--qz-gold-rgb), 0.12);
    font-size: 0.98rem; line-height: 1.7; opacity: 0; transform: translateY(-12px) scale(0.97); transition: opacity 0.3s ease, transform 0.35s cubic-bezier(.2,.8,.2,1);
}
.qz-toast.on { opacity: 1; transform: none; }
.qz-toast b { color: var(--qz-gold); }
.qz-toast-i { font-size: 1.5rem; flex: none; }
.qz-confetti { position: fixed; inset: 0; z-index: 3100; pointer-events: none; }
.qz-modal {
    position: fixed; inset: 0; z-index: 3050; display: grid; place-items: center; padding: 16px;
    background: rgba(3, 12, 24, 0.55); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.25s ease;
}
.qz-modal.on { opacity: 1; }
.qz-modal-in {
    width: min(100%, 420px); text-align: center; padding: 30px 22px 22px; border-radius: 14px;
    background: radial-gradient(circle at 50% 0, rgba(var(--qz-gold-rgb), 0.18), transparent 60%), var(--bg-deep);
    border: 1px solid rgba(var(--qz-gold-rgb), 0.45); box-shadow: var(--shadow);
    transform: translateY(14px) scale(0.96); transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
}
.qz-modal.on .qz-modal-in { transform: none; }
.qz-medal {
    width: 104px; height: 104px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.35), transparent 45%), linear-gradient(145deg, #FFD978, #E0A21B);
    box-shadow: 0 0 0 6px rgba(var(--qz-gold-rgb), 0.25), 0 10px 30px rgba(224, 162, 27, 0.35);
    animation: qzPop 0.6s cubic-bezier(.2,1.6,.4,1) both;
}
.qz-medal span { font-size: 3rem; line-height: 1; }
@keyframes qzPop { from { transform: scale(0.3) rotate(-20deg); opacity: 0; } }
.qz-mk { margin: 0; color: var(--qz-gold); font-weight: 700; font-size: 0.9rem; }
.qz-mt { margin: 4px 0 8px; font-family: var(--font-display); font-size: 1.6rem; line-height: 1.5; color: var(--ink); }
.qz-mx { margin: 0 0 18px; color: var(--ink-soft); line-height: 1.85; }
.qz-mx:has(+ .qz-mstat) { margin-bottom: 10px; }
.qz-mstat { margin: 0 0 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.qz-mstat span { padding: 4px 12px; border-radius: 999px; background: var(--inset); color: var(--ink-soft); font-size: 0.92rem; line-height: 1.7; }
.qz-mstat span:first-child { color: var(--ink); font-weight: 700; }
.qz-macts { display: grid; gap: 8px; }
.qz-macts .btn-action { width: 100%; justify-content: center; }
.qz-macts .btn-secondary { border: 1px solid var(--line-strong); }
@media (prefers-reduced-motion: reduce) { .qz-ring-fg, .qz-medal { animation: none; } .qz-bar > i { transition: none; } }

/* الشريط العلوي: الجاهزية والسلسلة */
.nav-quest-link { gap: 6px; font-family: var(--font-mono); font-size: 0.9rem; color: var(--ink); }
.nav-quest-link b { font-weight: 600; }
.nav-quest-link .qz-ring-fg { stroke: var(--signal); }
.nq-fire, .nq-xp { font-size: 0.85rem; color: var(--ink-soft); }
.nq-fire.cold { filter: grayscale(1); opacity: 0.65; }
@media (max-width: 1100px) {
    .nav-item.nav-quest { display: flex; }
    .nav-quest-link { padding: 0 8px; }
}
@media (max-width: 400px) { .nav-quest-link .nq-fire, .nav-quest-link .nq-xp { display: none; } }

/* الواجهة: بطاقة «رحلة الوزاري» */
.qh {
    display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ring main" "acts acts"; gap: 12px 16px; align-items: center;
    margin-top: 22px; padding: 16px; border-radius: 10px; border: 1px solid rgba(var(--signal-rgb), 0.45);
    background: linear-gradient(135deg, var(--signal-soft), transparent 65%), var(--sheet); box-shadow: 0 6px 22px rgba(0,0,0,0.08);
}
.qh-ring { grid-area: ring; position: relative; display: grid; place-items: center; text-decoration: none; color: var(--ink); }
.qh-ring > b { position: absolute; font-family: var(--font-mono); font-size: 1.25rem; }
.qh-ring > b small { font-size: 0.7em; }
.qh-main { grid-area: main; min-width: 0; }
.qh-k { margin: 0; color: var(--signal); font-weight: 700; font-size: 0.85rem; }
.qh-t { margin: 2px 0 4px; font-family: var(--font-display); font-size: 1.15rem; line-height: 1.6; color: var(--ink); }
.qh-t b { color: var(--signal); font-family: var(--font-mono); }
.qh-m { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.88rem; color: var(--ink-soft); }
.qh-m .cold { opacity: 0.75; }
.qh-day { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--ink-soft); }
.qh-dots { display: inline-flex; gap: 4px; }
.qh-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--inset); box-shadow: inset 0 0 0 1px var(--line-strong); }
.qh-dots i.on { background: var(--qz-gold); box-shadow: none; }
.qh-acts { grid-area: acts; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.qh-due { color: var(--signal); font-weight: 700; text-decoration: none; font-size: 0.95rem; }
.qh-due:hover { text-decoration: underline; }
@media (max-width: 760px) { .qh-acts .btn-action { width: 100%; } }

/* صفحة خريطة المهمات */
.qm { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 860px; margin-inline: auto; }
.qm > * { min-width: 0; }
.qm-card { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); }
.qm-h { margin: 0 0 10px; font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.qm-h small { font-family: var(--font-body); font-size: 0.85rem; font-weight: 400; color: var(--ink-muted); }
.qm-h small b { color: var(--qz-gold); }
.qm-sec { margin: 8px 0 -4px; font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.qm-sec small { font-family: var(--font-body); font-size: 0.88rem; font-weight: 400; color: var(--ink-muted); }

.qm-hero {
    position: relative; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center;
    background: radial-gradient(circle at 85% 0, rgba(var(--signal-rgb), 0.16), transparent 55%), var(--sheet);
    border-color: rgba(var(--signal-rgb), 0.4);
}
.qm-ring { position: relative; display: grid; place-items: center; }
.qm-ring .qz-ring-fg { stroke: var(--signal); }
.qm-ring-t { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.qm-ring-t b { font-family: var(--font-mono); font-size: 2rem; line-height: 1.1; color: var(--ink); }
.qm-ring-t b small { font-size: 0.6em; }
.qm-ring-t span { font-size: 0.72rem; color: var(--ink-muted); max-width: 80px; line-height: 1.4; }
.qm-me { min-width: 0; display: grid; gap: 6px; }
.qm-rank { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 1.25rem; color: var(--ink); }
.qm-ri { font-size: 1.6rem; }
.qm-xp, .qm-streak { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.qm-xp span { color: var(--ink-muted); }
.qm-streak { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.qm-streak .cold { opacity: 0.7; }
.qm-week { display: inline-flex; gap: 4px; }
.qm-week i { width: 16px; height: 16px; border-radius: 4px; background: var(--inset); box-shadow: inset 0 0 0 1px var(--line); font-style: normal; font-size: 10px; line-height: 16px; text-align: center; }
.qm-week i.on { background: linear-gradient(180deg, #FFB347, #FF6B35); box-shadow: none; }
.qm-week i.now { box-shadow: inset 0 0 0 1.5px var(--signal); }
.qm-week i.frz { background: rgba(124, 199, 255, 0.25); }
.qm-warn { margin: 0; font-size: 0.85rem; color: var(--signal); font-weight: 700; }
.qm-share-btn {
    position: absolute; top: 12px; left: 12px; padding: 4px 10px; border-radius: 20px; cursor: pointer;
    font: inherit; font-size: 0.82rem; color: var(--ink-soft); background: var(--inset); border: 1px solid var(--line);
}
.qm-share-btn:hover { color: var(--ink); border-color: var(--line-strong); }

.qm-due {
    display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink);
    border-color: rgba(var(--signal-rgb), 0.5); background: linear-gradient(90deg, var(--signal-soft), transparent), var(--sheet);
}
.qm-due:hover { background: var(--signal-soft); }
.qm-due > span:nth-child(2) { flex: 1; display: grid; }
.qm-due small { color: var(--ink-muted); font-size: 0.85rem; }
.qm-due-i { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; background: var(--signal); color: var(--signal-ink); font-weight: 700; }

.qm-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qm-tasks li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--inset); }
.qm-tasks li.done { opacity: 0.75; }
.qm-tasks li.done .qm-tt { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.qm-ti { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--line); }
.qm-tasks li.done .qm-ti { background: var(--ok); color: #fff; box-shadow: none; font-weight: 700; }
.qm-tt { flex: 1; min-width: 0; line-height: 1.7; font-size: 0.95rem; color: var(--ink); }
.qm-tt small { font-family: var(--font-mono); color: var(--ink-muted); }
.qm-go {
    flex: none; padding: 6px 14px; border-radius: 20px; text-decoration: none; font-weight: 700; font-size: 0.88rem;
    color: var(--signal-ink); background: var(--signal);
}
.qm-go:hover { background: var(--signal-hover); }
.qm-daily.done { border-color: rgba(var(--ok-rgb), 0.5); }

.qm-worlds { display: grid; gap: 10px; }
.qm-world { border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); overflow: hidden; }
.qm-world[open] { border-color: rgba(var(--signal-rgb), 0.45); }
.qm-world.won { border-color: rgba(var(--qz-gold-rgb), 0.6); }
.qm-world > summary {
    list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 12px; padding: 12px 14px;
}
.qm-world > summary::-webkit-details-marker { display: none; }
.qm-world > summary:hover { background: var(--hover); }
.qm-wn { font-family: var(--font-mono); font-size: 1.05rem; color: var(--signal); width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--signal-soft); }
.qm-wt { display: grid; min-width: 0; }
.qm-wt b { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; color: var(--ink); }
.qm-wl { font-size: 0.78rem; color: var(--ink-muted); }
.qm-wm { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 10px; font-size: 0.85rem; color: var(--ink-soft); font-family: var(--font-mono); }
.qm-badge { color: var(--qz-gold); }
.qm-world > summary .qz-bar { grid-column: 1 / -1; height: 4px; }

/* طريق المحطات */
.qm-path { position: relative; margin: 4px auto 12px; width: calc(100% - 16px); max-width: 560px; }
.qm-road { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.qm-road path { fill: none; stroke: var(--inset); stroke-width: 14; stroke-linecap: round; }
.qm-road path.qm-road-in { stroke: var(--line-strong); stroke-width: 2; stroke-dasharray: 2 8; }
.qm-node {
    position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -30px);
    width: 132px; display: grid; justify-items: center; gap: 2px; padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.qm-dot {
    width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
    font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600; color: var(--ink-muted);
    background: var(--sheet); border: 2px dashed var(--line-strong); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.qm-node:hover .qm-dot, .qm-node:focus-visible .qm-dot { transform: scale(1.08); }
.qm-node:focus-visible { outline: none; }
.qm-node:focus-visible .qm-dot { box-shadow: 0 0 0 3px var(--signal); }
.qm-node.on .qm-dot { border-style: solid; border-color: var(--signal); color: var(--ink); }
.qm-node.s1 .qm-dot { background: linear-gradient(160deg, var(--signal-soft), var(--sheet)); }
.qm-node.s2 .qm-dot { background: linear-gradient(160deg, rgba(var(--signal-rgb), 0.35), var(--sheet)); }
.qm-node.s3 .qm-dot { background: linear-gradient(160deg, #FFD978, #E0A21B); border-color: #E0A21B; color: #3A2600; box-shadow: 0 4px 14px rgba(224, 162, 27, 0.35); }
.qm-node.cur .qm-dot { box-shadow: 0 0 0 5px var(--signal-soft), 0 0 0 9px rgba(var(--signal-rgb), 0.12); animation: qzPulse 2s ease-in-out infinite; }
@keyframes qzPulse { 50% { box-shadow: 0 0 0 8px var(--signal-soft), 0 0 0 14px rgba(var(--signal-rgb), 0.06); } }
.qm-here {
    position: absolute; top: -26px; padding: 2px 10px; border-radius: 20px; white-space: nowrap;
    background: var(--signal); color: var(--signal-ink); font-size: 0.75rem; font-weight: 700;
}
.qm-here::after { content: ""; position: absolute; bottom: -5px; left: 50%; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--signal); }
.qm-st { color: var(--qz-gold); font-size: 0.95rem; letter-spacing: 1px; line-height: 1.2; padding: 1px 6px; border-radius: 10px; background: var(--sheet); }
.qm-nm { font-size: 0.82rem; line-height: 1.45; color: var(--ink-soft); text-align: center; padding: 1px 6px; border-radius: 6px; background: var(--sheet); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qm-boss .qm-dot { font-size: 1.6rem; border-style: solid; border-color: rgba(var(--qz-gold-rgb), 0.7); background: radial-gradient(circle, rgba(var(--qz-gold-rgb), 0.2), var(--sheet)); width: 68px; height: 68px; }
.qm-boss.on .qm-dot { border-color: var(--qz-gold); }
.qm-boss .qm-nm { font-weight: 700; color: var(--ink); }
.qm-boss.is-locked::after { content: none; }
.qm-boss.is-locked .qm-nm::after { content: " 🔒"; }
@media (prefers-reduced-motion: reduce) { .qm-node.cur .qm-dot { animation: none; } }

/* ورقة المحطة */
.qm-sheet { position: fixed; inset: 0; z-index: 2800; display: flex; align-items: flex-end; justify-content: center; background: rgba(3, 12, 24, 0.45); opacity: 0; transition: opacity 0.25s ease; }
.qm-sheet.on { opacity: 1; }
.qm-sheet-in {
    position: relative; width: min(100%, 560px); max-height: 86vh; overflow: auto; padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
    background: var(--bg-deep); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: var(--shadow);
    transform: translateY(40px); transition: transform 0.3s cubic-bezier(.2,.8,.2,1);
}
.qm-sheet.on .qm-sheet-in { transform: none; }
@media (min-width: 761px) { .qm-sheet { align-items: center; } .qm-sheet-in { border-radius: 14px; border-bottom: 1px solid var(--line); } }
.qm-sheet-x { position: absolute; top: 12px; left: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--inset); color: var(--ink); cursor: pointer; font-size: 1rem; }
.qm-sh-k { margin: 0; color: var(--signal); font-weight: 700; font-size: 0.85rem; }
.qm-sh-t { margin: 2px 0 2px; font-family: var(--font-display); font-size: 1.4rem; color: var(--ink); line-height: 1.5; padding-left: 40px; }
.qm-sh-stars { margin: 0 0 14px; font-size: 1.5rem; color: var(--qz-gold); letter-spacing: 3px; }
.qm-ms { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.qm-ms li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: var(--inset); }
.qm-msi { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem; background: var(--sheet); box-shadow: inset 0 0 0 1px var(--line); }
.qm-ms li.done .qm-msi { background: var(--ok); color: #fff; box-shadow: none; font-weight: 700; }
.qm-mst { flex: 1; min-width: 0; display: grid; gap: 3px; }
.qm-mst b { color: var(--ink); }
.qm-mst small { color: var(--ink-muted); font-size: 0.84rem; }
.qm-mst .qz-bar { height: 5px; }
.qm-hint { margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; border: 1px dashed rgba(var(--qz-gold-rgb), 0.6); color: var(--ink-soft); font-size: 0.92rem; line-height: 1.8; }

/* الرتب والمساعدة */
.qm-ranks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.qm-ranks li { display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border-radius: 8px; background: var(--inset); text-align: center; opacity: 0.6; }
.qm-ranks li span { font-size: 1.5rem; }
.qm-ranks li b { font-size: 0.8rem; line-height: 1.4; color: var(--ink); }
.qm-ranks li small { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-muted); }
.qm-ranks li.past { opacity: 0.9; }
.qm-ranks li.now { opacity: 1; background: var(--signal-soft); box-shadow: inset 0 0 0 1.5px var(--signal); }
@media (max-width: 560px) { .qm-ranks { grid-template-columns: repeat(5, 92px); overflow-x: auto; padding-bottom: 4px; } }
.qm-help > summary { cursor: pointer; margin: 0; list-style: none; }
/* «ترتيب الأسبوع» (المرحلة الثانية من «رحلة الوزاري»، 29 ت2 2026) */
.qm-bd { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qm-bd li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--inset); }
.qm-bd li b { font-family: var(--font-mono); text-align: center; color: var(--ink-muted); }
.qm-bd li:nth-child(1) b { color: #E0A800; } .qm-bd li:nth-child(2) b { color: #9AA7B4; } .qm-bd li:nth-child(3) b { color: #C27C3E; }
.qm-bd li.me { background: var(--signal-soft); box-shadow: inset 0 0 0 1.5px var(--signal); }
.qm-bd li small { color: var(--ink-muted); }
.qm-bd-xp { font-family: var(--font-mono); font-size: 0.9rem; color: var(--ink); white-space: nowrap; }
.qm-bd-me, .qm-bd-m { margin: 10px 0 0; color: var(--ink-soft); }
.qm-bd-m { margin-top: 0; }
.qm-help > summary::-webkit-details-marker { display: none; }
.qm-help ul { margin: 10px 0 0; padding-inline-start: 18px; display: grid; gap: 8px; color: var(--ink-soft); line-height: 1.85; }

/* «رجع لك» */
.qd-intro { margin-bottom: 22px; }
.qd-empty, .qd-done { text-align: center; padding: 26px 16px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--ink-soft); line-height: 1.9; }
.qd-done { margin-top: 18px; border-color: rgba(var(--ok-rgb), 0.6); }
.qd-big { font-size: 2.4rem; margin: 0; color: var(--ok); }
.dr-quest { border-color: rgba(var(--signal-rgb), 0.5); }
@media (max-width: 560px) {
    .qm-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .qm-me { justify-items: center; width: 100%; }
    .qm-xpbar { width: 100%; }
    .qm-streak { justify-content: center; }
    .qm-node { width: 112px; }
}

/* =========================================================
   «حلّ معي خطوة بخطوة» (js/guide.js، 27 تشرين الثاني 2026): المدرس الذي يمسك يد الطالب في المسائل
   ========================================================= */
.gd-entry { margin: 12px 0 10px; }
.gd-start {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 22px; cursor: pointer;
    font: inherit; font-weight: 700; color: var(--signal-ink); background: var(--signal); border: 0;
    box-shadow: 0 0 0 4px var(--signal-soft); transition: transform 0.1s ease, background 0.15s ease;
}
.gd-start:hover { background: var(--signal-hover); }
.gd-start:active { transform: scale(0.97); }
.gd-start small { font-weight: 400; opacity: 0.8; font-size: 0.82rem; }
.gd-start[aria-expanded="true"] { background: var(--inset); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--signal); }
.gd-ico { font-size: 1.1rem; }

.gd {
    margin: 0 0 14px; padding: 14px; border-radius: 12px; border: 1.5px solid rgba(var(--signal-rgb), 0.55);
    /* بارتفاع الشاشة على الأقل: بعد «الخطوة التالية» لا تظهر المسألة التالية تحت الصندوق (place في guide.js) */
    min-height: calc(100vh - var(--nav-h) - 24px); min-height: calc(100dvh - var(--nav-h) - 24px);
    background: linear-gradient(180deg, var(--signal-soft), transparent 140px), var(--sheet);
}
.gd-top { display: flex; align-items: flex-start; gap: 10px; }
.gd-tt { margin: 0; flex: 1; display: grid; gap: 2px; }
.gd-tt > b { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: 1.05rem; }
.gd-prog { font-size: 0.85rem; color: var(--ink-muted); }
.gd-close { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--inset); color: var(--ink); cursor: pointer; }
.gd-bar { margin: 10px 0 12px; }
.gd-trail { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.gd-trail li { padding: 2px 10px; border-radius: 16px; background: rgba(var(--ok-rgb), 0.12); color: var(--ink); font-size: 0.9rem; }
.gd-trail li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.gd-step { display: grid; gap: 10px; }
.gd-part { margin: 0; color: var(--signal); font-weight: 700; font-size: 0.9rem; }
.gd-h { margin: 0; color: var(--ink); line-height: 1.8; }
.gd-h:empty { display: none; }
.gd-q { margin: 0 0 8px; color: var(--ink-soft); font-weight: 700; font-size: 0.95rem; }
.gd-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.gd-o {
    min-height: 52px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 1rem; color: var(--ink);
    background: var(--sheet); border: 1.5px solid var(--line-strong); transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.gd-o:hover:not(:disabled) { border-color: var(--signal); background: var(--signal-soft); }
.gd-o:active:not(:disabled) { transform: scale(0.98); }
.gd-o.ok { border-color: var(--ok); background: rgba(var(--ok-rgb), 0.14); }
.gd-o.bad { border-color: var(--bad); background: rgba(var(--bad-rgb), 0.08); opacity: 0.75; text-decoration: line-through; text-decoration-color: rgba(var(--bad-rgb), 0.6); }
.gd-o:disabled { cursor: default; }
.gd-fb { margin: 8px 0 0; line-height: 1.85; font-size: 0.95rem; }
.gd-fb:empty { display: none; }
.gd-fb.ok { color: var(--ok); font-weight: 700; }
.gd-fb.bad { color: var(--ink); padding: 8px 12px; border-radius: 8px; background: rgba(var(--bad-rgb), 0.08); border-inline-start: 3px solid var(--bad); }
.gd-fb.warn { color: var(--ink-soft); padding: 8px 12px; border-radius: 8px; background: var(--signal-soft); }
.gd-why { padding: 10px 12px; border-radius: 8px; background: var(--inset); color: var(--ink-soft); line-height: 1.85; font-size: 0.95rem; }
.gd-why p { margin: 0; }
.gd-why-h { font-weight: 700; color: var(--ink); margin-bottom: 4px !important; }
.gd-words { margin-top: 6px !important; padding: 6px 10px; border-radius: 6px; background: var(--sheet); color: var(--ink); font-weight: 700; display: inline-block; }
.gd-in { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 1.15rem; }
.gd-note { margin: -2px 0 10px; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.85; }
.gd-box { position: relative; display: inline-flex; }
.gd-cap { position: absolute; top: 100%; inset-inline: 0; margin-top: 3px; text-align: center; font-size: 0.78rem; font-weight: 700; color: var(--ink-muted); white-space: nowrap; direction: rtl; }
.gd-in.has-cap { row-gap: 30px; padding-bottom: 22px; }
.gd-in .katex { font-size: 1.1em; }
.gd-v, .gd-x10 {
    font: inherit; font-family: var(--font-mono); font-size: 1.15rem; text-align: center; color: var(--ink);
    background: var(--bg-deep); border: 1.5px solid var(--line-strong); border-radius: 8px; padding: 8px 10px;
}
.gd-v { width: 8.5em; }
.gd-x10 { width: 4.5em; }
.gd-v:focus, .gd-x10:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.gd-v:disabled, .gd-x10:disabled { opacity: 0.7; }
/* الجوال: المعادلة ومربعاها في سطر واحد */
@media (max-width: 480px) {
    .gd-in { gap: 6px; font-size: 1.05rem; }
    .gd-v, .gd-x10 { padding: 8px 6px; font-size: 1.1rem; }
    .gd-v { width: 22vw; }
    .gd-x10 { width: 14vw; min-width: 3.2em; }
}
.gd-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.gd-acts .btn-action { min-height: 44px; padding: 8px 22px; }
.gd-lnk { background: none; border: 0; padding: 6px 2px; font: inherit; font-size: 0.92rem; color: var(--signal); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.gd-lnk:disabled { opacity: 0.5; cursor: default; }
.gd-hint.pulse { animation: gdPulse 1.2s ease-in-out 3; font-weight: 700; }
@keyframes gdPulse { 50% { transform: scale(1.08); } }
.gd-hintbox { margin-top: 10px; padding: 8px 12px; border-radius: 8px; border: 1px dashed rgba(var(--signal-rgb), 0.6); }
.gd-sol { padding: 6px 12px; border-radius: 8px; background: rgba(var(--ok-rgb), 0.08); border-inline-start: 3px solid var(--ok); overflow-x: auto; }
.gd-next { justify-self: start; margin-top: 4px; }
.gd-end { text-align: center; display: grid; gap: 6px; justify-items: center; padding: 8px 0; }
.gd-end-i { font-size: 2.6rem; margin: 0; }
.gd-end-t { margin: 0; font-family: var(--font-display); font-size: 1.35rem; color: var(--ink); }
.gd-stats { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; color: var(--ink-soft); font-size: 0.92rem; }
.gd-stats b { color: var(--ink); font-family: var(--font-mono); }
.gd-end-m { margin: 0; color: var(--ink-soft); line-height: 1.8; max-width: 40ch; }
@media (max-width: 560px) {
    .gd { padding: 12px 10px; }
    .gd-opts { grid-template-columns: 1fr; }
    .gd-start { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .gd-hint.pulse { animation: none; } }

/* =========================================================
   «العب وافهم» (js/play.js، 28 تشرين الثاني 2026): طبيب الفهم، وتحدَّ صاحبك، وغرفة الهروب
   ========================================================= */
.pl { display: grid; gap: 16px; }
.pl [hidden] { display: none !important; }
.pl .katex { white-space: nowrap; }   /* المعادلة القصيرة داخل السطر لا تنقسم (في السطر العربي تنقلب قطعها) */   /* عناصر لها display في هذا القسم تبقى مخفية بالسمة hidden */
.pl-lead { margin: 0; color: var(--ink-soft); line-height: 1.9; }
.pl-note { margin: 0; color: var(--ink-muted); font-size: 0.9rem; line-height: 1.8; }
.pl-h { margin: 8px 0 0; font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); }
.pl-h small { color: var(--ink-muted); font-weight: 400; font-family: var(--font-mono); font-size: 0.85rem; }
.pl-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pl-link { background: none; border: 0; padding: 0; font: inherit; color: var(--signal); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pl-mini { flex: none; font: inherit; font-size: 0.85rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer;
    border: 1.5px solid var(--signal); color: var(--signal); background: transparent; }
.pl-mini:hover { background: var(--signal); color: var(--signal-ink); }
.pl-chip { display: inline-block; padding: 2px 10px; margin: 2px 0; border-radius: 999px; background: rgba(var(--ok-rgb), 0.12); color: var(--ink); font-size: 0.85rem; }

/* البطاقات (صفحة الفصل والمدخل) */
.pl-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.pl-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 14px; text-decoration: none; color: var(--ink);
    background: var(--sheet); border: 1.5px solid var(--line-strong); position: relative; overflow: hidden; transition: transform 0.15s ease, border-color 0.15s ease; }
.pl-card::after { content: ""; position: absolute; inset: auto 0 0 0; height: 4px; background: var(--pl-c, var(--signal)); }
.pl-card:hover { border-color: var(--pl-c, var(--signal)); transform: translateY(-2px); }
.pl-card.is-doc { --pl-c: #2fb38a; }
.pl-card.is-duel { --pl-c: #e0794a; }
.pl-card.is-esc { --pl-c: #7a7ff0; }
.pl-card-i { flex: none; width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.6rem; border-radius: 12px;
    background: color-mix(in srgb, var(--pl-c, var(--signal)) 16%, transparent); }
.pl-card-b { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pl-card-t { font-weight: 800; font-size: 1.1rem; }
.pl-card-m { color: var(--ink-muted); font-size: 0.88rem; line-height: 1.7; }
.pl-card-s { margin-top: 4px; font-size: 0.82rem; font-weight: 700; color: var(--pl-c, var(--signal)); }

/* رأس كل لعبة */
.pl-hero { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 14px;
    background: linear-gradient(135deg, rgba(var(--signal-rgb), 0.16), transparent 70%), var(--sheet); border: 1px solid var(--line); }
.pl-hero.is-esc { background: linear-gradient(135deg, rgba(122, 127, 240, 0.22), transparent 70%), var(--sheet); }
.pl-hero.is-invite { border: 1.5px solid #e0794a; background: linear-gradient(135deg, rgba(224, 121, 74, 0.2), transparent 70%), var(--sheet); }
.pl-hero-i { flex: none; font-size: 2.2rem; line-height: 1; }
.pl-hero-t { margin: 0 0 4px; font-family: var(--font-display); font-size: 1.35rem; color: var(--ink); }
.pl-hero p { margin: 0; color: var(--ink-soft); line-height: 1.9; }
.pl-panel { display: grid; gap: 8px; padding: 16px 18px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line); border-inline-start: 4px solid var(--signal); }
.pl-panel > p { margin: 0; line-height: 1.85; color: var(--ink-soft); }
.pl-panel .btn-action { justify-self: start; margin-top: 4px; }
.pl-panel-t { font-weight: 800; color: var(--ink) !important; font-size: 1.05rem; }
.pl-panel.is-sick { border-inline-start-color: var(--bad); }
.pl-panel.is-due { border-inline-start-color: #e0a63a; }
.pl-panel.is-clean { border-inline-start-color: var(--ok); }

/* سؤال «الجواب ثم لماذا؟» */
.pl-tier { display: grid; gap: 10px; }
.pl-q { margin: 0; font-size: 1.08rem; font-weight: 700; line-height: 1.95; color: var(--ink); }
.pl-step { margin: 4px 0 0; font-size: 0.9rem; font-weight: 800; color: var(--signal); }
.pl-num { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-inline-end: 4px; border-radius: 50%; background: var(--signal); color: var(--signal-ink); font-family: var(--font-mono); font-size: 0.8rem; }
.pl-opts { display: grid; gap: 8px; }
.pl-o { text-align: start; min-height: 48px; padding: 10px 14px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 1rem; line-height: 1.75; color: var(--ink);
    background: var(--sheet); border: 1.5px solid var(--line-strong); transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease; }
.pl-o:hover:not(:disabled) { border-color: var(--signal); background: var(--signal-soft); }
.pl-o:active:not(:disabled) { transform: scale(0.99); }
.pl-o.on { border-color: var(--signal); background: var(--signal-soft); box-shadow: inset 0 0 0 1px var(--signal); font-weight: 700; }
.pl-o:disabled { cursor: default; }
.pl-o:disabled:not(.on) { opacity: 0.6; }
.pl-why { display: grid; gap: 8px; animation: pl-in 0.25s ease; }
@keyframes pl-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* شريط التقدّم والوقت */
.pl-runbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-weight: 700; color: var(--ink-soft); font-size: 0.92rem; }
.pl-bar { flex: 1 1 140px; height: 8px; border-radius: 99px; background: var(--inset); overflow: hidden; }
.pl-bar i { display: block; height: 100%; background: var(--signal); border-radius: inherit; transition: width 0.25s linear; }
.pl-bar.is-time i { background: #2fb38a; transition: width 0.2s linear; }
.pl-bar.is-time.is-low i { background: var(--bad); }
.pl-timer { font-family: var(--font-mono); color: var(--ink); }
.pl-score { font-family: var(--font-mono); color: var(--signal); }
.pl-qbox { min-height: 200px; }

/* ومضة النتيجة بعد كل سؤال في المبارزة */
.pl-duel { position: relative; }
.pl-flash { position: fixed; inset-inline: 0; margin-inline: auto; bottom: 28px; z-index: 60; width: max-content; max-width: calc(100% - 32px);
    display: flex; gap: 10px; align-items: center; padding: 12px 20px; border-radius: 999px; color: #fff; font-weight: 700; box-shadow: var(--shadow); animation: pl-pop 0.3s ease; }
.pl-flash b { font-family: var(--font-mono); font-size: 1.2rem; }
.pl-flash.ok { background: #1f9a6f; }
.pl-flash.half { background: #c98a1d; }
.pl-flash.bad { background: #c2453f; }
@keyframes pl-pop { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* المراجعة */
.pl-rev { display: grid; gap: 6px; padding: 14px 16px; border-radius: 12px; background: var(--sheet); border: 1px solid var(--line); border-inline-start: 4px solid var(--ok); }
.pl-rev.half { border-inline-start-color: #e0a63a; }
.pl-rev.bad { border-inline-start-color: var(--bad); }
.pl-rev-h { margin: 0; font-size: 0.88rem; color: var(--ink-muted); }
.pl-rev-m { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-inline-end: 6px; border-radius: 50%; font-weight: 800; color: #fff; background: var(--ok); font-size: 0.8rem; }
.pl-rev.half .pl-rev-m { background: #e0a63a; }
.pl-rev.bad .pl-rev-m { background: var(--bad); }
.pl-pts { float: inline-end; font-family: var(--font-mono); }
.pl-rev .pl-q { font-size: 1rem; }
.pl-rev-l { margin: 0; line-height: 1.85; }
.pl-rev-k { display: inline-block; min-width: 3.2em; font-size: 0.82rem; font-weight: 800; color: var(--ink-muted); }
.pl-rev-l.is-ok b { color: var(--ok); }
.pl-you { display: block; font-size: 0.88rem; color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(var(--bad-rgb), 0.5); }
.pl-rev-why { margin: 4px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--inset); color: var(--ink-soft); line-height: 1.85; font-size: 0.95rem; }
.pl-det { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; background: var(--raise); }
.pl-det > summary { cursor: pointer; padding: 10px 0; font-weight: 700; color: var(--signal); }
.pl-det[open] { display: grid; gap: 10px; padding-bottom: 14px; }

/* طبيب الفهم */
.pl-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-stats span { padding: 6px 12px; border-radius: 999px; background: var(--inset); color: var(--ink-soft); font-size: 0.88rem; }
.pl-stats b { font-family: var(--font-mono); color: var(--ink); }
.pl-vgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.pl-vt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--sheet); border: 1px solid var(--line); }
.pl-vi { flex: none; font-size: 1.5rem; line-height: 1; }
.pl-vb { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pl-vb b { font-size: 0.98rem; color: var(--ink); }
.pl-vb small { color: var(--ink-muted); font-size: 0.82rem; line-height: 1.6; }
.pl-vt.is-sick, .pl-vt.is-light { border-color: rgba(var(--bad-rgb), 0.5); background: rgba(var(--bad-rgb), 0.05); }
.pl-vt.is-light .pl-vi { opacity: 0.6; }
.pl-vt.is-immune { border-color: rgba(var(--ok-rgb), 0.55); background: rgba(var(--ok-rgb), 0.07); }
.pl-vt.is-cured { border-color: rgba(224, 166, 58, 0.6); }
.pl-vt.is-none .pl-vb b { color: var(--ink-soft); }
.pl-vt.is-sick .pl-vi { animation: pl-wob 2.4s ease-in-out infinite; }
@keyframes pl-wob { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.06); } 75% { transform: rotate(10deg); } }
.pl-foot { margin: 0; }
.pl-rx { display: grid; gap: 12px; }
.pl-rx-k { margin: 0; font-weight: 800; color: var(--signal); }
.pl-rx-big { margin: 0; font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); }
.pl-rx > p { margin: 0; color: var(--ink-soft); line-height: 1.85; }
.pl-rx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pl-rx-i { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid rgba(var(--bad-rgb), 0.45); background: rgba(var(--bad-rgb), 0.05); }
.pl-rx-ok { margin: 0; line-height: 2; color: var(--ink-soft); }
.pl-rx-ok > span:first-child { font-weight: 700; margin-inline-end: 4px; }
.pl-treat { display: grid; gap: 12px; }
.pl-back { justify-self: start; background: none; border: 0; padding: 4px 0; font: inherit; color: var(--ink-muted); cursor: pointer; }
.pl-back:hover { color: var(--signal); }
.pl-treat-t { margin: 0; font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); }
.pl-tc { padding: 12px 16px; border-radius: 12px; background: var(--sheet); border: 1px solid var(--line); }
.pl-tc > p:not(.pl-tc-k) { margin: 4px 0 0; line-height: 1.95; }
.pl-tc-k { margin: 0; font-size: 0.85rem; font-weight: 800; color: var(--ink-muted); }
.pl-tc.is-belief { border-inline-start: 4px solid var(--bad); }
.pl-tc.is-belief > p:not(.pl-tc-k) { text-decoration: line-through; text-decoration-color: rgba(var(--bad-rgb), 0.45); color: var(--ink-soft); }
.pl-tc.is-truth { border-inline-start: 4px solid var(--ok); background: rgba(var(--ok-rgb), 0.06); }
.pl-tc.is-ex { border-inline-start: 4px solid var(--signal); }
.pl-lab, .pl-confirm { display: grid; gap: 8px; padding: 14px 16px; border-radius: 12px; background: var(--raise); border: 1px dashed var(--line-strong); }
.pl-lab > p, .pl-confirm > p { margin: 0; line-height: 1.85; }
.pl-confirm .btn-action { justify-self: start; }
.pl-sim { min-height: 120px; }
.pl-cbox:empty { display: none; }
.pl-cbox { display: grid; gap: 10px; }
.pl-verdict { padding: 14px 16px; border-radius: 12px; }
.pl-verdict p { margin: 0; line-height: 1.85; }
.pl-verdict-t { font-weight: 800; font-size: 1.1rem; }
.pl-verdict.ok { background: rgba(var(--ok-rgb), 0.12); border: 1px solid rgba(var(--ok-rgb), 0.5); }
.pl-verdict.bad { background: rgba(var(--bad-rgb), 0.07); border: 1px solid rgba(var(--bad-rgb), 0.4); }

/* تحدَّ صاحبك */
.pl-score-big { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 8px 12px; padding: 18px; border-radius: 14px; background: var(--sheet); border: 1px solid var(--line); text-align: center; }
.pl-score-big b { font-family: var(--font-mono); font-size: 3rem; line-height: 1; color: var(--signal); }
.pl-score-big span { color: var(--ink-soft); font-size: 1.1rem; }
.pl-score-big small { flex-basis: 100%; color: var(--ink-muted); font-family: var(--font-mono); }
.pl-share { display: grid; gap: 8px; padding: 16px; border-radius: 14px; border: 1.5px solid #e0794a; background: rgba(224, 121, 74, 0.08); }
.pl-share-t { margin: 0; font-weight: 800; color: var(--ink); }
.pl-share-b { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-wa { background: #1f9a6f; border-color: #1f9a6f; color: #fff; }
.pl-wa:hover { background: #17805b; color: #fff; }
.pl-url { width: 100%; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--sheet); color: var(--ink-soft); font-family: var(--font-mono); font-size: 0.85rem; }
.pl-table { width: 100%; border-collapse: collapse; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pl-table th, .pl-table td { padding: 10px 12px; text-align: start; border-top: 1px solid var(--line); font-size: 0.95rem; }
.pl-table th { border-top: 0; background: var(--inset); color: var(--ink-muted); font-size: 0.82rem; }
.pl-table td:first-child, .pl-table td:last-child { font-family: var(--font-mono); white-space: nowrap; }
.pl-table td small { color: var(--ink-muted); font-size: 0.78rem; }
.pl-table tr.is-me td { background: var(--signal-soft); font-weight: 700; }
.pl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pl-list a { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--sheet); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pl-list a:hover { border-color: var(--signal); }
.pl-list-t { font-weight: 700; }
.pl-list-m { color: var(--ink-muted); font-size: 0.88rem; }

/* غرفة الهروب */
.pl-doors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; counter-reset: door; }
.pl-doors li { counter-increment: door; display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--sheet); border: 1px solid var(--line); font-size: 0.92rem; color: var(--ink-soft); }
.pl-doors li::before { content: counter(door); font-family: var(--font-mono); color: var(--ink-muted); font-size: 0.8rem; }
.pl-stars { color: #e0a63a; letter-spacing: 2px; font-size: 1.15rem; }
.pl-esc-top { position: sticky; top: calc(var(--nav-h) + 6px); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 12px; border-radius: 12px; background: var(--sheet); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pl-track { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.pl-track li { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--inset); filter: grayscale(1); opacity: 0.55; font-size: 1rem; }
.pl-track li.done { filter: none; opacity: 1; background: rgba(var(--ok-rgb), 0.18); }
.pl-track li.now { filter: none; opacity: 1; background: var(--signal-soft); box-shadow: inset 0 0 0 1.5px var(--signal); }
.pl-clock { font-family: var(--font-mono); color: var(--ink-soft); white-space: nowrap; }
.pl-clock b { color: var(--ink); font-size: 1.1rem; }
.pl-room { display: grid; gap: 12px; padding: 18px; border-radius: 14px; background: linear-gradient(180deg, rgba(122, 127, 240, 0.1), transparent 160px), var(--sheet); border: 1px solid var(--line); }
.pl-room-k { margin: 0; font-size: 0.85rem; font-weight: 800; color: #7a7ff0; }
.pl-room-t { margin: 0; font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); }
.pl-story { margin: 0; line-height: 2; color: var(--ink-soft); }
.pl-puzzle { display: grid; gap: 10px; }
.pl-puzzle.shake { animation: pl-shake 0.4s ease; }
@keyframes pl-shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
.pl-fb { margin: 0; line-height: 1.85; }
.pl-fb:empty { display: none; }
.pl-fb.bad { padding: 8px 12px; border-radius: 8px; background: rgba(var(--bad-rgb), 0.08); border-inline-start: 3px solid var(--bad); }
.pl-fb.bad small { color: var(--ink-muted); }
.pl-fb.warn { padding: 8px 12px; border-radius: 8px; background: var(--signal-soft); color: var(--ink-soft); }
.pl-win { display: grid; gap: 10px; padding: 14px 16px; border-radius: 12px; background: rgba(var(--ok-rgb), 0.12); border: 1px solid rgba(var(--ok-rgb), 0.5); animation: pl-in 0.3s ease; }
.pl-win-t { margin: 0; line-height: 1.95; font-weight: 700; color: var(--ink); }
.pl-win .btn-action { justify-self: start; }
.pl-notebook { display: grid; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.pl-hint-b { justify-self: start; font: inherit; font-size: 0.9rem; padding: 6px 12px; border-radius: 999px; cursor: pointer; background: transparent; color: var(--ink-soft); border: 1px solid var(--line-strong); }
.pl-hint-b small { color: var(--bad); font-family: var(--font-mono); }
.pl-hint-b:hover:not(:disabled) { border-color: var(--signal); color: var(--ink); }
.pl-hint-b:disabled { opacity: 0.55; cursor: default; }
.pl-hints { margin: 0; padding-inline-start: 1.4em; color: var(--ink-soft); line-height: 1.9; }
.pl-hints:empty { display: none; }
.pl-code { display: grid; gap: 6px; }
.pl-code-l { font-weight: 700; color: var(--ink-soft); font-size: 0.9rem; }
.pl-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pl-code-in { width: 8em; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--sheet); color: var(--ink); font: inherit; font-family: var(--font-mono); font-size: 1.3rem; letter-spacing: 3px; text-align: center; }
.pl-code-in:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.pl-unit { color: var(--ink-soft); }
.pl-capsvg { width: 100%; max-width: 300px; justify-self: center; }
.pl-capsvg .pl-plate { fill: var(--ink-soft); }
.pl-slab { transition: opacity 0.3s ease; }
.pl-slab.c-b, .pl-slab-b.c-b .sw { fill: #5aa9ff; background: #5aa9ff; }
.pl-slab.c-r, .pl-slab-b.c-r .sw { fill: #f06a6a; background: #f06a6a; }
.pl-slab.c-g, .pl-slab-b.c-g .sw { fill: #49c18f; background: #49c18f; }
.pl-slab-t { fill: #fff; font-family: var(--font-mono); font-size: 16px; font-weight: 700; text-anchor: middle; direction: ltr; }
.pl-meter { margin: 0; text-align: center; color: var(--ink-soft); line-height: 1.9; }
.pl-slabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pl-slab-b { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; cursor: pointer; font: inherit; color: var(--ink); background: var(--sheet); border: 1.5px solid var(--line-strong); }
.pl-slab-b:hover:not(:disabled) { border-color: var(--signal); }
.pl-slab-b:disabled { opacity: 0.55; cursor: default; }
.pl-slab-b .sw { width: 18px; height: 18px; border-radius: 4px; }
.pl-slide { display: grid; gap: 8px; }
.pl-slide .pl-top { transition: y 0.15s ease; }
.pl-lamp { fill: var(--inset); stroke: var(--line-strong); stroke-width: 2; transition: fill 0.3s ease; }
.pl-lamp.on { fill: #ffd34d; stroke: #e0a63a; filter: drop-shadow(0 0 10px #ffd34d); }
.pl-lamp-b { stroke: var(--ink-muted); stroke-width: 3; fill: none; }
.pl-slide-l { text-align: center; color: var(--ink-soft); }
.pl-range { width: 100%; accent-color: var(--signal); }
.pl-combo { display: grid; gap: 10px; }
.pl-combo-caps { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pl-cap { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; cursor: pointer; font: inherit; color: var(--ink-muted); background: var(--sheet); border: 1.5px dashed var(--line-strong); }
.pl-cap.on { color: var(--ink); border-style: solid; border-color: var(--signal); background: var(--signal-soft); font-weight: 700; }
.pl-cap-sym { font-family: var(--font-mono); letter-spacing: -2px; }
.pl-seg { display: flex; justify-content: center; gap: 0; }
.pl-seg-b { font: inherit; padding: 8px 16px; cursor: pointer; background: var(--sheet); color: var(--ink-soft); border: 1.5px solid var(--line-strong); }
.pl-seg-b:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
.pl-seg-b:last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; border-inline-start: 0; }
.pl-seg-b.on { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); font-weight: 700; }
.pl-combo-draw { display: grid; justify-items: center; }
.pl-circ { width: 100%; max-width: 320px; direction: ltr; }
.pl-circ .w, .pl-circ line { stroke: var(--ink-soft); stroke-width: 2; fill: none; }
.pl-circ .gap { fill: var(--sheet); stroke: none; }
.pl-circ circle { fill: var(--ink-soft); }
.pl-circ text { fill: var(--ink-muted); font-family: var(--font-mono); font-size: 11px; text-anchor: middle; paint-order: stroke; stroke: var(--raise); stroke-width: 4px; }
.pl-combo-eq { margin: 0; text-align: center; line-height: 2; min-height: 2em; }
.pl-combo .pl-go { justify-self: center; }
.pl-graphs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pl-graph { position: relative; padding: 6px; border-radius: 12px; cursor: pointer; background: var(--sheet); border: 1.5px solid var(--line-strong); }
.pl-graph:hover:not(:disabled) { border-color: var(--signal); }
.pl-graph.ok { border-color: var(--ok); background: rgba(var(--ok-rgb), 0.1); }
.pl-graph.bad { border-color: var(--bad); opacity: 0.55; }
.pl-graph-l { position: absolute; top: 6px; inset-inline-start: 10px; font-weight: 800; color: var(--ink-muted); }
.pl-gsvg { width: 100%; display: block; direction: ltr; }
.pl-gsvg .ax { stroke: var(--ink-muted); stroke-width: 1.5; fill: none; }
.pl-gsvg .cv { stroke: var(--signal); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pl-gsvg .lb { fill: var(--ink-muted); font-family: var(--font-body); font-size: 11px; text-anchor: middle; }
.pl-gsvg .lb.s { text-anchor: start; }
/* غرفة الهروب: ألغاز تتبدل (المقبض بزر، والمصابيح، والدوائر، والرسوم) */
.pl-slide .pl-go, .pl-lamps .pl-go { justify-self: center; }
.pl-val { font-family: var(--font-mono); }
.pl-stator { fill: var(--inset); stroke: var(--line-strong); stroke-width: 2; }
.pl-rotor { fill: rgba(122, 127, 240, 0.28); stroke: #7a7ff0; stroke-width: 2; transition: transform 0.2s ease; }
.pl-overlap { fill: rgba(255, 196, 60, 0.55); }
.pl-axis { fill: var(--ink-soft); }
.pl-sg { fill: var(--ink-soft); font-family: var(--font-mono); font-size: 14px; font-weight: 700; text-anchor: middle; }
.pl-lamps { display: grid; gap: 10px; }
.pl-lamps-l { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pl-lampb { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; font: inherit; line-height: 1.8; text-align: start; color: var(--ink-soft); background: var(--sheet); border: 1.5px solid var(--line-strong); }
.pl-lampb:hover:not(:disabled) { border-color: var(--signal); }
.pl-lampb:disabled { cursor: default; }
.pl-bulb { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--inset); border: 2px solid var(--line-strong); transition: background 0.25s ease, box-shadow 0.25s ease; }
.pl-lampb.on { color: var(--ink); border-color: #e0a63a; background: rgba(255, 211, 77, 0.12); }
.pl-lampb.on .pl-bulb { background: #ffd34d; border-color: #e0a63a; box-shadow: 0 0 12px #ffd34d; }
.pl-fixes { padding: 10px 12px; border-radius: 10px; background: var(--sheet); border: 1px solid var(--line); }
.pl-fixes-h { margin: 0 0 6px; font-weight: 700; color: var(--ink-soft); font-size: 0.92rem; }
.pl-fixes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.pl-fixes li { display: grid; gap: 2px; line-height: 1.85; }
.pl-fixes .x { color: var(--ink-muted); text-decoration: line-through; text-decoration-color: rgba(var(--bad-rgb), 0.6); }
.pl-fixes .v { color: var(--ink); }
.pl-circ-b { display: grid; gap: 4px; justify-items: center; padding-top: 26px; }
.pl-circ-b .pl-circ { max-width: 100%; }
.pl-circ-v { min-height: 1.6em; font-size: 0.92rem; color: var(--ink-soft); }
.pl-fig { display: grid; justify-items: center; gap: 2px; }
.pl-fig-svg svg { width: 100%; max-width: 360px; height: auto; display: block; }
.pl-fig .pl-note, .pl-circs + .pl-note { margin: 0; text-align: center; }
.pl-circ text.s { text-anchor: start; }
.pl-circ text.e { text-anchor: end; }
.pl-circ line.thk { stroke-width: 4; }
.pl-circ circle.lmp { fill: var(--sheet); stroke: var(--ink-soft); stroke-width: 2; }
.pl-circ .res { fill: var(--sheet); stroke: var(--ink-soft); stroke-width: 2; }
.pl-dc { max-width: 340px; }
.pl-endstats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pl-endstats li { padding: 6px 12px; border-radius: 999px; background: var(--inset); color: var(--ink-soft); font-size: 0.9rem; }
.pl-endstats b { font-family: var(--font-mono); color: var(--ink); }
.dr-play { --dr-c: #7a7ff0; }
@media (max-width: 480px) {
    .pl-hero { padding: 14px; }
    .pl-hero-i { font-size: 1.8rem; }
    .pl-room { padding: 14px; }
    .pl-track li { width: 28px; height: 28px; font-size: 0.9rem; }
    .pl-table th, .pl-table td { padding: 8px 6px; font-size: 0.88rem; }
    .pl-score-big b { font-size: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .pl-vt.is-sick .pl-vi, .pl-why, .pl-flash, .pl-win { animation: none; }
    .pl-rotor, .pl-bulb { transition: none; }
}
