/* ===== الهيدر المشترك ديال الموقع =====
   كيتزاد ف أي صفحة بـ <div id="site-header"></div>.
   الألوان كلها من assets/theme.css، إذن الوضع الفاتح كيخدم بوحدو. */

/* ===== البار واقفة بحق: fixed ماشي sticky =====

   sticky كيتكسر بسهولة — يكفي شي جد عندو overflow ولا
   transform (حركة الدخول ديال الصفحة مثلا) باش يرجع البار
   كتمشي مع السكرول. fixed ماعندوش هاد المشكل، بشرط أن البار
   تكون ولد مباشر ديال <body> — وهادشي كيديرو site-header.js.

   --site-header-h: الـJS كيقيسو بالضبط ملي يرسم البار، ولكن
   القيمة هنا خاصها تكون قريبة من الحقيقة *قبل* ما يوصل الـJS.
   إلا كانت بعيدة (72 والحقيقة 92)، المحتوى كينقز لتحت ملي
   يوصل الرقم الصحيح. الأرقام مقيسة، ماشي مخمّنة. */
:root { --site-header-h: 92px; }

@media (max-width: 1000px) { :root { --site-header-h: 122px; } }
@media (max-width: 1000px) and (pointer: coarse) { :root { --site-header-h: 134px; } }

.site-header {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 60;
    padding: 12px var(--gutter);
    background: color-mix(in srgb, var(--ink) 86%, transparent);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

/* البار خارجة من التدفق — خاص المحتوى ما يدخلش تحتيها.

   هاد الملف كيتحمّل غير ف الصفحات اللي فيهم البار، إذن
   ماخاصناش نستناو شي class من الـJS. بلا هادشي، الصفحة
   كتبان أول 200ms بلا بار وبلا فراغ، ومن بعد كلشي كينقز
   92px لتحت — وهادا هو "الرعشة" اللي كتبان ف كل برْكة. */
body { padding-top: var(--site-header-h); }

/* رابط داخلي (#…) ماخاصوش يوقف تحت البار */
:target { scroll-margin-top: calc(var(--site-header-h) + 12px); }


/* ===== الانتقال بين الأقسام: البار ما كتغيبش =====

   Lesen ← Hören هوما جوج صفحات مختلفين، إذن المتصفح كيهدم
   الصفحة القديمة والبار معاها وكيعاود يبنيها. مهما دار
   الـCSS، البار كتغمض فداك الوقت.

   View Transitions ديال المتصفح كتحل هادشي: كياخد صورة ديال
   البار قبل ما يمشي، وكيربطها بالبار ديال الصفحة الجديدة
   (بنفس view-transition-name). النتيجة: البار كتبقى واقفة
   فبلاصتها والمحتوى برك هو اللي كيتبدل.

   Chrome/Edge 126+ و Safari 18+ كيدعموها. Firefox ما زال —
   تما كلشي كيبقى خدام بحال قبل، غير بلا هاد النعومة. */
/* غير ف PC: ف التيليفون (خصوصا iPhone قديم) الانتقال كياخد صورة
   ديال الصفحة كاملة قبل وبعد — كيتقل. تما التبديل كيكون نيشان. */
@media (pointer: fine) {
    @view-transition { navigation: auto; }
}

.site-header { view-transition-name: de-bar; }
.site-level-wrap { view-transition-name: de-level; }

/* المحتوى (root) كيخرج لفوق وكيدخل من تحت. البار عندها اسم
   ديالها، إذن ماشي جزء من root — ما كتشاركش فهاد الحركة
   وكتبقى واقفة فبلاصتها. المؤشر الأحمر كيزلق بوحدو من Lesen
   ل Hören حيت المتصفح كيربط الجوج بنفس الاسم. */
/* بلا حركة: المحتوى كيتبدل ف اللحظة والبار واقفة (ماشي fade/slide —
   كانت كتبان بحال إلا الصفحة كتعاود تتحمل) */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
}
@keyframes de-vt-out { to   { opacity: 0; transform: translateY(-7px); } }
@keyframes de-vt-in  { from { opacity: 0; transform: translateY(9px);  } }

/* التيليفون: ماكاينش انتقال بين الصفحات. لقطة الصفحة + المزج كيزيدو
   300–600 ms على تيليفون بطيء، والصفحة الجاية كتبان دغيا بلاه. */
@media (max-width: 820px), (pointer: coarse) {
    @view-transition { navigation: none; }
}

/* البار: بدل ما تغمض وتشعل، كتدوز بنعومة قصيرة */
::view-transition-old(de-bar),
::view-transition-new(de-bar) { animation-duration: .14s; }

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) { animation: none !important; }
}

.site-header-inner {
    /* الصفحة الرئيسية RTL والباقي LTR. بلا هادشي الهيدر
       كينقلب فوحدة وكيبقى فالأخرى — كنثبتوه باش يكون نفسو
       فكل بلاصة. النصوص العربية داخلو كتبقى كتتقرا مزيان. */
    direction: ltr;

    max-width: var(--shell);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    border-radius: 18px;
    border: 1px solid var(--line-gold);
    background: var(--surface);
    box-shadow: var(--shadow);
}

/* ---- العلامة ---- */
.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    flex: 0 0 auto;
}
.site-brand img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
}
.site-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.site-brand-name { font-weight: 900; font-size: 16px; }
.site-brand-name span { color: var(--accent-text); }
.site-brand-sub {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    color: var(--muted);
    text-transform: uppercase;
}

/* ---- التنقل ---- */
.site-nav {
    display: flex;
    gap: 2px;
    margin: 0 auto;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    overflow-x: auto;
    scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
    /* بلا هادي الروابط كيتقلصو ملي ما يسعهمش العرض،
       والكلمات كيلتصقو ف بعضياتهم («LesenHörenSchreiben»).
       الحاوية عندها overflow-x: auto — إذن خاصهم يحتافظو
       بعرضهم وتزلق هي. بان المشكل ملي زدنا Ultra Premium:
       سبع روابط ماعادش كيدخلو ف 390px. */
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    transition: color .15s ease, background .15s ease;
}
.site-nav a:hover { color: var(--text); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.site-nav a.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--ink);
}

/* ---- الأزرار على اليمين ---- */
/* margin-inline-start: auto كيدفعهم لليمين ديما — حتى ملي
   كيهبطو لسطر ثاني. بلاه كانو كيوقفو على ليسار ملي البار
   كتلف (زدنا Ultra Premium فالتنقل، ف البار ولات كتلف
   على شاشات أعرض من قبل). */
.site-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-inline-start: auto;
}

.site-btn {
    /* الزر فيه <span>تسجيل </span>الدخول. الحاوية LTR، ف
       الـspan كان كيتحط على ليسار والباقي على اليمين —
       والنتيجة كتقرا «الدخول تسجيل». rtl كترجع الترتيب
       للي كيتقرا بيه العربية. */
    direction: rtl;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.site-btn:hover { border-color: var(--gold); color: var(--accent-text); }
.site-btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    border-color: transparent;
    color: var(--ink);
}
.site-btn-primary:hover { color: var(--ink); filter: brightness(1.06); }
.site-btn-icon { width: 40px; padding: 0; }

.site-user {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 0 12px 0 6px;
    border-radius: 999px;
    border: 1px solid var(--line);
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
}
.site-user:hover { border-color: var(--gold); }
.site-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--ink);
    font-weight: 900;
    font-size: 13px;
}
.site-premium {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .4px;
    background: color-mix(in srgb, var(--gold) 20%, transparent);
    color: var(--accent-text);
    border: 1px solid var(--line-gold);
}

[hidden] { display: none !important; }

/* ---- التيليفون ---- */
@media (max-width: 1000px) {
    .site-header-inner { flex-wrap: wrap; }
    .site-nav { order: 3; width: 100%; margin: 4px 0 0; justify-content: flex-start; }
    .site-actions { margin-inline-start: auto; }
}
/* من 1000px لتحت البار كتولي سطرين. كانت هاد القواعد كتبدا
   غير من 560px — النتيجة: بين 561 و1000 (tablet، تيليفون
   مقلوب) البار كانت 152px واقفين فوق الشاشة. */
@media (max-width: 1000px) {
    .site-header { padding: 8px 10px; }
    .site-brand-sub { display: none; }
    .site-brand img { width: 34px; height: 34px; }
    .site-nav a { padding: 0 13px; font-size: 13px; min-height: 38px; }
    .site-btn { padding: 0 12px; font-size: 12.5px; }
    .site-btn-label-long { display: none; }
}

/* ===== ما يخرجش على عرض الشاشة =====
   min() باش ما نكسروش عرض الحاوية (--shell) فالشاشات
   الكبيرة: بـ 100% وحدها الهيدر كان كيتمدّ من الطرف
   للطرف على PC. */
.site-header { max-width: 100%; box-sizing: border-box; }
.site-header-inner { max-width: min(var(--shell), 100%); box-sizing: border-box; }
.site-header-inner { flex-wrap: wrap; min-width: 0; }
.site-brand { min-width: 0; }
.site-brand-name { white-space: nowrap; }
.site-nav { max-width: 100%; min-width: 0; }
.site-actions { min-width: 0; flex-wrap: wrap; }

/* ===== البار ف التيليفون =====
   ولات fixed وكتبقى واقفة ديما، إذن كل بيكسل زائد فيها هو
   بيكسل ناقص من المحتوى. كنخليوها ف سطرين: (العلامة +
   الحساب) فوق، والتنقل تحت. */
@media (max-width: 1000px) {
    .site-header { padding: 6px 10px; }
    .site-header-inner { gap: 6px; padding: 6px 8px; }
    .site-brand-name { font-size: 14px; }
    .site-btn { min-height: 38px; padding: 0 11px; font-size: 12px; }
    .site-btn-icon { width: 38px; }
    .site-user { font-size: 12px; padding: 0 10px 0 5px; }
    .site-user-name { max-width: 9ch; }
    .site-nav { padding: 3px; }
    /* العلامة كتصغر قبل ما الأزرار تنزل لسطر ديالها */
    .site-brand { flex: 0 1 auto; overflow: hidden; }
    .site-brand-name { overflow: hidden; text-overflow: ellipsis; }
}

/* شاشة صغيرة بزاف (320px): الاسم + الزرين ما كيدخلوش ف سطر،
   وكيولّيو تلات سطورة. كنخليو غير الشعار. */
@media (max-width: 380px) {
    .site-brand-text { display: none; }
    .site-user-name { max-width: 7ch; }
}

/* ===== مبدّل المستوى (Telc B1 / Telc B2) ===== */
/* المبدّل خرج من البار (البار ولات fixed وخاصها تبقى خفيفة).
   دابا هو شريط عادي تحتها وكيمشي مع السكرول. */
.site-level-wrap {
    direction: ltr;
    display: flex;
    justify-content: center;
    margin: 12px auto 0;
    padding: 0 var(--gutter);
}
/* جوا الصفحة: تحت العنوان وفوق التبويبات */
.lesen-head-row + .site-level-wrap { margin: 20px auto 6px; padding: 0; }
.site-level-wrap[hidden] { display: none; }
.site-level {
    display: inline-flex;
    gap: 4px;
    padding: 5px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
}
.site-level a {
    min-height: 38px;
    padding: 0 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--muted);
    font-weight: 800;
    font-size: 13.5px;
}
.site-level a:hover { color: var(--text); }
.site-level a.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--ink);
}
@media (max-width: 560px) {
    .site-level a { padding: 0 18px; font-size: 13px; }
}

/* ===== حجم اللمس =====
   على الشاشات ديال اللمس (تيليفون/تابليت)، كل زر فالهيدر
   خاصو على الأقل 44px باش يتنقر بالصبع بلا ما تخطئ.
   على PC بالفأر ماكاينش هاد المشكل. */
@media (pointer: coarse) {
    .site-brand { min-height: 44px; }
    .site-nav a,
    .site-level a,
    .site-btn,
    .site-user { min-height: 44px; }
    .site-btn-icon { width: 44px; }
}

/* حتى ف الشاشات الصغار ماكنقصوش تحت 44 فاللمس */
@media (max-width: 560px) and (pointer: coarse) {
    .site-btn { min-height: 44px; padding: 0 13px; }
    .site-btn-icon { width: 44px; padding: 0; }
    .site-nav a { min-height: 44px; }
}

/* ===== قائمة الحساب =====

   الزر ديال المستعمل كان غير رابط. ولا زر كيحل قائمة فيها
   تبديل الاسم وتسجيل الخروج. */
.site-account { position: relative; display: inline-flex; }

.site-user {
    background: transparent;
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.site-account.is-open .site-user {
    border-color: var(--gold);
    background: color-mix(in srgb, var(--gold) 10%, transparent);
}
.site-user-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.site-user-caret {
    width: 8px;
    height: 8px;
    margin-inline-start: 1px;
    border-inline-end: 2px solid currentColor;
    border-block-end: 2px solid currentColor;
    border-radius: 1px;
    opacity: .55;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .18s ease;
}
.site-account.is-open .site-user-caret { transform: rotate(225deg) translateY(-2px); }

.site-menu {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    /* الصفحة LTR والقائمة RTL — الخاصيات المنطقية كيتقلبو
       عليها، إذن كنستعملو right ديال بصح. */
    right: 0;
    z-index: 60;
    min-width: 250px;
    padding: 7px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--card, var(--bg));
    box-shadow: 0 18px 44px rgba(0, 0, 0, .22);
    direction: rtl;
    text-align: start;
    animation: site-menu-in .16s ease;
}
@keyframes site-menu-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .site-menu { animation: none; }
    .site-user-caret { transition: none; }
}

.site-menu-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px 12px;
    border-block-end: 1px solid var(--line);
    margin-block-end: 6px;
}
.site-avatar-lg { width: 38px; height: 38px; font-size: 16px; flex: 0 0 auto; }
.site-menu-who { display: grid; gap: 2px; min-width: 0; }
.site-menu-who strong { font-size: 13.5px; }
.site-menu-who span {
    font-size: 11.5px;
    opacity: .65;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    text-align: start;
}

.site-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}
.site-menu-item:hover,
.site-menu-item.is-open { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.site-menu-item:disabled { opacity: .55; cursor: default; }
.site-menu-icon { width: 17px; height: 17px; flex: 0 0 auto; opacity: .8; }

.site-menu-up { color: var(--accent-text); }
.site-menu-out { color: #e05252; }
.site-menu-out:hover { background: color-mix(in srgb, #e05252 12%, transparent); }

.site-menu-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 4px 10px 8px;
}
.site-menu-input {
    min-height: 38px;
    padding: 0 11px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    min-width: 0;
}
.site-menu-input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.site-menu-save {
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    font-size: 12.5px;
    cursor: pointer;
}
.site-menu-save:disabled { opacity: .6; cursor: default; }
.site-menu-note { grid-column: 1 / -1; margin: 2px 0 0; font-size: 11.5px; opacity: .8; }
.site-menu-note.is-bad { color: #e05252; opacity: 1; }

@media (max-width: 560px) {
    .site-menu { min-width: 0; width: min(280px, calc(100vw - 28px)); }
    .site-user-name { max-width: 9ch; }
    .site-menu-item { min-height: 44px; }
}

/* ===== الانتقال بين الأقسام (Lesen ↔ Hören ↔ …) =====

   اللي خاصو يوقع: البار ديال فوق ما يتحركش ولا يغمض — غير
   المحتوى اللي تحتيه هو اللي يتبدل، والمؤشر الحمر يزلق
   للتبويب الجديد.

   جربنا Cross-document View Transitions (اللي المفروض
   المتصفح يديرها بوحدو): الصفحة القديمة كتبدا الانتقال ديما،
   ولكن الجديدة كتلغيه ف 3 مرات من 4 حيت الصفحات ديالنا
   تقيلة وكتاخد وقت باش تترسم. يعني شي مرة كتبان الحركة وشي
   مرة لا — وهادشي خايب من والو.

   إذن كنديروها احنا: نفس الحركة عند كلشي. والصفحة الجاية
   كتوجد قبل (prerender ف site-header.js) باش ملي نمشيو ليها
   تكون ديجا مرسومة — والبار ما يغمضش. */

/* ---- المؤشر ديال التبويب ---- */
.site-nav { position: relative; }
.site-nav a { position: relative; z-index: 1; }

/* ملي كاين المؤشر، خلفية الرابط النشيط كتمشي ليه */
.site-nav.has-pill a.active { background: transparent; }

.site-nav-pill {
    position: absolute;
    z-index: 0;
    inset-block-start: 0;
    inset-inline-start: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    box-shadow: 0 4px 14px color-mix(in srgb, var(--gold) 32%, transparent);
    pointer-events: none;
    transition: transform .3s cubic-bezier(.34, 1.2, .5, 1),
                width .3s cubic-bezier(.34, 1.2, .5, 1);
}
/* أول رسمة ما تزلقش — كتوقف مباشرة تحت النشيط */
.site-nav-pill.is-first { transition: none; }

/* ---- المحتوى: كيخرج وكيدخل ----

   الهيدر ماشي داخل فهاد الحركة — كيبقى واقف.
   الدخول مكتوب فالـCSS نيت باش يبدا مع أول رسمة. */
/* موقفة: المحتوى كيبان ف اللحظة (الحركة كانت كتبان بحال actualiser) */
body > *:not(#site-header):not(.site-header):not(script):not(style),
html.de-leaving body > *:not(#site-header):not(.site-header):not(script):not(style) {
    animation: none;
}

/* المتصفح كيدعم View Transitions؟ إذن هو اللي كيدير الحركة،
   وهادي كتوقف — وإلا المحتوى كيغمض مرتين. site-header.js
   كيزيد .de-vt دغيا (سكريبت عادي فوق الصفحة)، قبل ما يتلوّن
   المحتوى ديال تحت. */
html.de-vt body > *:not(#site-header):not(.site-header):not(script):not(style),
html.de-vt.de-leaving body > *:not(#site-header):not(.site-header):not(script):not(style) {
    animation: none;
}

@keyframes de-page-in  { from { opacity: 0; transform: translateY(9px); } }
@keyframes de-page-out { to   { opacity: 0; transform: translateY(-7px); } }

/* المتصفحات اللي ماعندهاش View Transitions (Safari ف iPhone…) كيعتمدو على
   هاد الحركة: 340 ms ف التيليفون المحتوى كيبقى شفاف قبل ما يبان. */
@media (max-width: 820px), (pointer: coarse) {
    body > *:not(#site-header):not(.site-header):not(script):not(style) { animation-duration: .12s; }
}

@media (prefers-reduced-motion: reduce) {
    .site-nav-pill { transition: none; }
    body > *:not(#site-header):not(.site-header):not(script):not(style),
    html.de-leaving body > *:not(#site-header):not(.site-header):not(script):not(style) {
        animation: none;
    }
}

/* =====================================================
   v2 — لمسة نهائية على البار
   ===================================================== */
.site-header {
    background: color-mix(in srgb, var(--paper, #faf9f7) 78%, transparent);
    padding-top: 14px;
}
.site-header-inner {
    border: 1px solid rgba(18, 29, 24,.08);
    box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, var(--shadow-lg, 0 18px 40px -16px rgba(18, 29, 24,.2));
    background: rgba(255,255,255,.92);
}
.site-brand-name { letter-spacing: -.01em; }
.site-brand img { box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(214,178,94,.35); }
.site-nav { background: #f3f2ef; border-color: rgba(18, 29, 24,.06); }
.site-nav a { transition: color .18s var(--ease, ease), background .18s var(--ease, ease); }
.site-nav a.active,
.site-level a.active,
.site-nav-pill {
    background: var(--grad-brand, linear-gradient(135deg, #53ebab, #26cf88 45%, #1ca66c)) !important;
    color: var(--on-brand);
    box-shadow: var(--shadow-brand, 0 10px 26px -8px rgba(214,178,94,.55));
}
.site-nav.has-pill a.active { background: transparent !important; box-shadow: none; color: var(--on-brand); }
.site-level { background: rgba(255,255,255,.9); box-shadow: var(--shadow); }

/* التيليفون: الأقسام كيزلقو أفقياً.

   قبل كانو كيتقاسمو العرض (flex: 1 1 auto) — كانت خدامة
   بستة. ملي زدنا Ultra Premium ولاو سبعة، و"Ultra Premium"
   بوحدها طويلة: النتيجة كانت «LesenHörenSchreiben» ملتصقين
   وماتقراوش.

   دابا كل واحد كياخد العرض ديالو والشريط كيزلق. */
@media (max-width: 560px) {
    .site-nav { display: flex; gap: 1px; }
    .site-nav a {
        flex: 0 0 auto;
        justify-content: center;
        padding: 0 10px;
        font-size: 12px;
        letter-spacing: -.01em;
    }
}
@media (max-width: 380px) {
    .site-nav a { font-size: 11px; padding: 0 8px; letter-spacing: -.02em; }
}

/* =====================================================
   v3 — بار أزرق ليلي
   =====================================================
   البار ولات داكنة: كتبان كهوية واضحة فوق أي صفحة، والأقسام
   كيبانو بالأبيض، والقسم النشيط بالأحمر ديال العلامة.
   القائمة ديال الحساب (.site-menu) كتبقى بيضا — ماتدخلش هنا. */
.site-header { background: transparent; }
.site-header-inner {
    position: relative;
    border: 1px solid rgba(255,255,255,.08);
    background: var(--grad-navy, linear-gradient(135deg, var(--navy-2), var(--navy) 55%, #12563a));
    box-shadow: 0 18px 40px -18px rgba(9, 44, 29,.65), inset 0 1px 0 rgba(255,255,255,.08);
    color: #fff;
}
/* خيط رقيق بألوان العلم تحت البار */
.site-header-inner::after {
    content: "";
    position: absolute;
    inset-inline: 22px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #111 0 33.33%, var(--brand) 33.33% 66.66%, var(--sun, #ffb703) 66.66% 100%);
    opacity: .9;
    pointer-events: none;
}
.site-brand { color: #fff; }
.site-brand-name span { color: var(--brand-light, #4eeba9); }
.site-brand-sub { color: rgba(255,255,255,.62); }
.site-brand img { box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 0 4px rgba(214,178,94,.55); }

.site-nav {
    background: rgba(255,255,255,.07);
    border-color: rgba(255,255,255,.10);
}
.site-nav a { color: rgba(255,255,255,.78); }
.site-nav a:hover { color: #fff; background: rgba(255,255,255,.10); }
.site-nav a.active { color: var(--on-brand); }

.site-header-inner .site-actions a.site-btn:not(.site-btn-primary) {
    color: #fff;
    border-color: rgba(255,255,255,.38);
    background: rgba(255,255,255,.06);
}
.site-header-inner .site-actions a.site-btn:not(.site-btn-primary):hover {
    color: var(--navy, var(--navy));
    background: var(--surface);
    border-color: #fff;
}
.site-btn-primary {
    background: var(--grad-brand) !important;
    color: var(--on-brand) !important;
    box-shadow: var(--shadow-brand);
}
.site-account > .site-user {
    color: #fff;
    border-color: rgba(255,255,255,.22);
    background: rgba(255,255,255,.08);
}
.site-account > .site-user:hover { border-color: rgba(255,255,255,.55); }
.site-account > .site-user .site-premium {
    background: var(--sun, #ffb703);
    color: #1b1400;
    border-color: transparent;
}

/* شريط المستوى B1/B2 تحت البار */
.site-level {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: var(--shadow);
}
.site-level a { color: var(--muted); }
.site-level a:hover { color: var(--navy, var(--navy)); }

/* v5: الطبقة الداكنة v4 مسدودة (@media not all) — كتبقى هنا إلا بغينا نرجعوها */
@media not all {
/* =====================================================
   v4 — بار أسود وذهبي
   ===================================================== */
.site-header-inner {
    background: linear-gradient(145deg, rgba(32,32,39,.96), rgba(16,16,20,.96));
    border: 1px solid rgba(214,178,94,.22);
    box-shadow: 0 18px 44px -20px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.05);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.site-header-inner::after {
    background: linear-gradient(90deg, transparent, #a8863a 20%, #f0d58c 50%, #a8863a 80%, transparent);
    height: 1px;
    opacity: .8;
}
.site-brand-name span { color: var(--accent-text); }
.site-brand img { box-shadow: 0 0 0 2px rgba(214,178,94,.6), 0 0 18px -4px rgba(214,178,94,.5); }
.site-nav { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.07); }
.site-nav a { color: rgba(236,231,220,.72); }
.site-nav a:hover { color: #fff; background: rgba(214,178,94,.10); }
.site-nav a.active,
.site-nav.has-pill a.active { color: var(--on-brand) !important; }
.site-nav a.active,
.site-level a.active,
.site-nav-pill {
    background: var(--grad-brand) !important;
    box-shadow: var(--shadow-brand) !important;
}
.site-level a.active { color: var(--on-brand) !important; }
.site-header-inner .site-actions a.site-btn:not(.site-btn-primary) {
    color: #ece7dc;
    border-color: rgba(214,178,94,.4);
    background: transparent;
}
.site-header-inner .site-actions a.site-btn:not(.site-btn-primary):hover {
    color: var(--on-brand);
    background: var(--brand);
    border-color: var(--brand);
}
.site-btn-primary { color: var(--on-brand) !important; }
.site-avatar { background: var(--grad-brand); color: var(--on-brand); }
.site-account > .site-user .site-premium { background: var(--grad-brand); color: var(--on-brand); }
.site-level {
    background: rgba(22,22,27,.9);
    border-color: rgba(214,178,94,.2);
    box-shadow: var(--shadow);
}
.site-level a { color: var(--muted); }
.site-level a:hover { color: var(--text); }
/* قائمة الحساب */
.site-menu { background: var(--surface); border-color: var(--line-gold); color: var(--text); box-shadow: var(--shadow-lg); }

}
/* ===== الجرس: الجديد فالموقع ===== */
.site-news-wrap { position: relative; display: inline-flex; }
.site-bell { position: relative; color: var(--muted); }
.site-bell.has-news { color: var(--accent-text); border-color: var(--line-gold, var(--gold)); }
.site-news-wrap.is-open .site-bell { border-color: var(--gold); color: var(--accent-text); }
.site-bell-dot {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #1fd186;
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.site-bell-dot[hidden] { display: none; }
.site-news {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    right: 0;
    z-index: 61;
    width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 560px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--card, var(--bg));
    box-shadow: 0 18px 44px rgba(0, 0, 0, .22);
    direction: rtl;
    text-align: start;
    font-family: "Cairo", system-ui, sans-serif;
    animation: site-menu-in .16s ease;
}
.site-news[hidden] { display: none; }
.site-news-head { padding: 4px 6px 10px; border-block-end: 1px solid var(--line); margin-block-end: 8px; font-size: 14.5px; }
.site-news-empty { margin: 14px 6px; color: var(--muted); font-size: 13px; }
.site-news-list { display: grid; gap: 8px; }
.site-news-item {
    position: relative;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--text) 3%, transparent);
}
.site-news-item.is-new { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.site-news-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.site-news-title { font-size: 13.5px; line-height: 1.5; }
.site-news-date { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.site-news-body { margin: 5px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); white-space: pre-line; }
.site-news-link { display: inline-block; margin-top: 6px; font-size: 12.5px; font-weight: 800; color: var(--accent-text); text-decoration: none; }
.site-news-del {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.site-news-del:hover { background: color-mix(in srgb, #1fd186 15%, transparent); color: #1fd186; }
.site-news-item:has(.site-news-del) .site-news-top { padding-left: 24px; }
.site-news-form { display: grid; gap: 7px; padding: 10px; margin-bottom: 10px; border-radius: 12px; border: 1px dashed var(--gold); }
.site-news-form-label { font-size: 12.5px; font-weight: 800; color: var(--accent-text); }
.site-news-text { resize: vertical; min-height: 64px; font-family: inherit; }
@media (max-width: 560px) {
    /* فالتيليفون: اللوحة كتاخد عرض الشاشة تحت الهيدر */
    .site-news-wrap { position: static; }
    .site-news { position: fixed; top: calc(var(--site-header-h, 110px) + 4px); left: 12px; right: 12px; width: auto; }
    .site-bell { width: 36px; min-height: 36px; }
}
.site-bell { padding: 0 !important; }
.site-bell svg { width: 19px !important; height: 19px !important; flex: 0 0 auto; }

/* ===== v5: الجرس وزر الوضع — بيض، غلاظ وكبار شوية باش يبانو ===== */
.site-header .site-bell,
.site-header .site-theme {
    width: 44px;
    min-height: 44px;
    padding: 0 !important;
    color: #fff !important;
    border: 1.5px solid rgba(255,255,255,.55) !important;
    background: rgba(255,255,255,.08) !important;
}
.site-header .site-bell svg,
.site-header .site-theme svg {
    width: 23px !important;
    height: 23px !important;
    stroke-width: 2.7;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.25));
}
.site-header .site-bell:hover,
.site-header .site-theme:hover,
.site-header .site-news-wrap.is-open .site-bell {
    color: var(--on-brand) !important;
    background: var(--brand) !important;
    border-color: var(--brand) !important;
}
.site-header .site-bell.has-news { border-color: var(--brand) !important; }
@media (max-width: 560px) {
    .site-header .site-bell,
    .site-header .site-theme { width: 34px; min-height: 34px; border-radius: 10px; }
    .site-header .site-bell svg,
    .site-header .site-theme svg { width: 19px !important; height: 19px !important; }
    .site-header .site-actions { gap: 5px; }
}
/* التيليفون: العلامة كتصغر (…) بلا ما الأزرار ينزلو لسطر زايد */
@media (max-width: 1000px) {
    .site-header .site-brand { flex: 1 1 0; min-width: 0; }
    .site-header .site-brand-name { overflow: hidden; text-overflow: ellipsis; }
    .site-header .site-actions { flex: 0 0 auto; flex-wrap: nowrap; }
}

/* ===== Ultra Premium فالبار =====

   خاصو يبان مختلف على الأقسام ديال التمارين — هادا عرض
   ماشي جزء من الامتحان. ذهبي خفيف، وماكيتقلبش ملي يكون
   هو النشيط حيت الـpill كيمشي عليه بحال الباقي. */

.site-nav a.site-nav-gold {
    color: var(--gold);
    font-weight: 800;
}
/* بلا نجمة وبلا حركة: لمعة ذهبية كتدوز على الكتابة كل شوية
   (الزر ماكيتحركش) — كتجبد العين بلا ما تقلق. */
.site-nav a.site-nav-gold:not(.active) {
    background: linear-gradient(100deg, #ffce00 0%, #ffce00 42%, #ffffff 50%, #ffce00 58%, #ffce00 100%);
    background-size: 250% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: de-shine 3.2s ease-in-out infinite;
    text-shadow: none;
}
@keyframes de-shine {
    0%, 55% { background-position: 100% 0; }
    85%, 100% { background-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .site-nav a.site-nav-gold:not(.active) { animation: none; }
}
/* التيليفون: background-position ماكيتحركش ف الـGPU، كل رسمة (60 ف الثانية)
   كتعاود ترسم الكتابة. قياس: 5.6٪ من المعالج ف الراحة على تيليفون بطيء،
   وكتبطئ التبديل والسكرول. بلاها هنا — الذهبي كيبقى ثابت. */
@media (max-width: 820px), (pointer: coarse) {
    .site-nav a.site-nav-gold:not(.active) { animation: none; }
}
.site-nav a.site-nav-gold:hover { color: var(--gold-dark, #c79a2e); }
.site-nav a.site-nav-gold.active { color: var(--on-brand, #fff); }

/* التيليفون: blur ديال البار الثابت كيتقل السكرول بزاف — بلاه */
@media (max-width: 1000px) and (pointer: coarse) {
    .site-header, .site-header-inner { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}

/* ===== التيليفون: التبديل بين الأقسام نيشان، بلا حركة =====

   ف iPhone SE وأمثالو، الـfade ديال المحتوى كيبان تقيل. الصفحة
   كتبان مباشرة، والبار ديجا ف نفس البلاصة. */
@media (pointer: coarse) {
    body > *:not(#site-header):not(.site-header):not(script):not(style),
    html.de-leaving body > *:not(#site-header):not(.site-header):not(script):not(style) {
        animation: none !important;
    }
    /* اللمعة ديال Ultra كتبدا من بعد ما تتحل الصفحة، ماشي معاها */
    .site-nav a.site-nav-gold:not(.active) { animation-delay: 1.2s; }
}

/* ===== زر Bewerbung (ملف) حدا الجرس ===== */
.site-docs { position: relative; display: inline-grid; place-items: center; text-decoration: none; }
.site-docs-dot {
    position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%;
    background: var(--flag-gold, #f2b705); box-shadow: 0 0 0 2px var(--brand-deep, #117f51);
    animation: site-docs-ping 2s ease-out infinite;
}
.site-docs.is-here .site-docs-dot { display: none; }
@keyframes site-docs-ping {
    0% { box-shadow: 0 0 0 2px var(--brand-deep, #117f51), 0 0 0 2px rgba(242,183,5,.7); }
    80%, 100% { box-shadow: 0 0 0 2px var(--brand-deep, #117f51), 0 0 0 9px rgba(242,183,5,0); }
}
@media (prefers-reduced-motion: reduce) { .site-docs-dot { animation: none; } }
/* نفس الحجم والشكل ديال الجرس وزر الوضع */
.site-header .site-docs {
    width: 44px; min-height: 44px; padding: 0 !important; color: #fff !important;
    border: 1.5px solid rgba(255,255,255,.55) !important; background: rgba(255,255,255,.08) !important;
}
.site-header .site-docs svg { width: 23px; height: 23px; stroke-width: 2.7; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.site-header .site-docs:hover,
.site-header .site-docs.is-here { color: var(--on-brand) !important; background: var(--brand) !important; border-color: var(--brand) !important; }
@media (max-width: 560px) {
    .site-header .site-docs { width: 34px; min-height: 34px; border-radius: 10px; }
    .site-header .site-docs svg { width: 19px; height: 19px; }
    .site-docs-dot { top: 4px; right: 4px; }
}
/* التيليفون الصغير: 5 أزرار + الاسم ما كيدخلوش — كنخليو غير الشعار
   بدل اسم مقطوع ("Deutsc…") */
@media (max-width: 440px) {
    .site-header .site-brand-text { display: none; }
    .site-header .site-brand { flex: 0 0 auto; }
}
/* ست روابط فالتنقل (زدنا «اختبر نفسك»): ف PC متوسط (1001–1500px)
   كنصغرو الحشو شوية باش الأزرار ديال اليمين يبقاو ف نفس السطر */
@media (min-width: 1001px) and (max-width: 1500px) {
    .site-nav a { padding: 0 12px; font-size: 13.5px; }
    .site-header-inner { gap: 10px; }
}
@media (min-width: 1001px) and (max-width: 1200px) {
    .site-brand-sub { display: none; }
    .site-btn-label-long { display: none; }
}

/* ===== Ultra Premium: زر بوحدو حدا التنقل ===== */
.site-navrow { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 auto; }
.site-header .site-navrow .site-nav { margin: 0; min-width: 0; }
.site-ultra {
    position: relative; overflow: hidden; flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 16px;
    border-radius: 999px; text-decoration: none; white-space: nowrap;
    font-weight: 900; font-size: 13.5px; color: #3a1500;
    background: linear-gradient(135deg, #ffe07a, #f2b705);
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 10px 22px -12px rgba(242,183,5,.95);
    transition: transform .15s ease, filter .15s ease;
}
.site-ultra:hover { transform: translateY(-1px); filter: brightness(1.05); }
.site-ultra.active { box-shadow: 0 0 0 3px rgba(255,255,255,.55), 0 10px 22px -12px rgba(242,183,5,.95); }
.site-ultra::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent);
    animation: site-ultra-shine 3.6s ease-in-out infinite;
}
@keyframes site-ultra-shine { 0%, 60% { left: -60%; } 90%, 100% { left: 130%; } }
.site-ultra-short { display: none; }
@media (max-width: 1000px) {
    .site-header .site-navrow { order: 3; width: 100%; margin: 4px 0 0; }
    .site-header .site-navrow .site-nav { order: 0; width: auto; flex: 1 1 auto; margin: 0; }
    .site-ultra { min-height: 38px; padding: 0 12px; font-size: 12.5px; }
}
@media (max-width: 560px) {
    .site-ultra-long { display: none; }
    .site-ultra-short { display: inline; }
}
/* التيليفون: الروابط الخمسة كانو مقطوعين («Sprech…» و«اختبر نفسك» مخبية)
   حيت زر Premium كان واكل العرض. دابا Premium دائرة ذهبية فيها التاج،
   والروابط كيتقاسمو العرض اللي بقى — گاعهم باينين بلا ما يزلقو. */
@media (max-width: 560px) {
    .site-ultra { width: 44px; min-width: 44px; padding: 0; justify-content: center; border-radius: 50%; }
    .site-ultra svg { width: 20px; height: 20px; }
    .site-ultra .site-ultra-short { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .site-header .site-navrow { gap: 6px; }
    .site-header .site-nav { overflow-x: auto; scrollbar-width: none; }
    .site-header .site-nav a { flex: 1 1 auto; padding: 0 4px; font-size: 12px; letter-spacing: -.01em; }
}
@media (max-width: 380px) {
    .site-header .site-nav a { padding: 0 3px; font-size: 11px; letter-spacing: -.02em; }
}
@media (pointer: coarse) { .site-ultra { min-height: 44px; } }
@media (pointer: coarse) { .site-ultra::after { animation-delay: 1.2s; } }
@media (prefers-reduced-motion: reduce) { .site-ultra::after { animation: none; } }

/* ===== مجموعة الواتساب: زر أخضر حدا الحساب (نفس حجم الجرس) ===== */
.site-header .site-wa {
    display: inline-grid; place-items: center; text-decoration: none;
    width: 44px; min-height: 44px; padding: 0 !important; color: #fff !important;
    border: 1.5px solid #25d366 !important; background: #25d366 !important;
    box-shadow: 0 6px 16px -8px rgba(37, 211, 102, .8);
}
.site-header .site-wa svg { width: 23px; height: 23px; }
.site-header .site-wa:hover { background: #1ebe5a !important; border-color: #1ebe5a !important; }
@media (max-width: 560px) {
    .site-header .site-wa { width: 34px; min-height: 34px; border-radius: 10px; }
    .site-header .site-wa svg { width: 19px; height: 19px; }
}
/* زر الواتساب زاد بلاصة: ف التيليفون الصغير الاسم كيغبر (الحرف
   الأول والشارة باقيين) باش الحساب مايخرجش من الشاشة. */
@media (max-width: 420px) {
    .site-header .site-account .site-user-name { display: none; }
}

/* ===== مشكل ف الأنترنت: ما قدرناش نتأكدو من الحساب ===== */
.site-net {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 2147481000;
    width: min(560px, calc(100% - 24px));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    direction: rtl;
    background: #fff4e5;
    color: #7a3e00;
    border: 1px solid #f5b46b;
    box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .45);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.6;
}
.site-net span { flex: 1 1 auto; }
.site-net button {
    flex: 0 0 auto;
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    background: #c25e00;
    color: #fff;
}
.site-net .site-net-x { background: transparent; color: inherit; padding: 6px 8px; }
:root[data-theme="dark"] .site-net { background: #3a2410; color: #ffd8a8; border-color: #8a5a20; }
body.has-lesen-bar .site-net { bottom: calc(92px + env(safe-area-inset-bottom)); }
