/* ═══════════════════════════════════════════════════════════════════════════
   React Native — سمة «الشاشة الزرقاء»
   فاتحة نهارًا بسماوي React (#0891b2) على كحلي، وداكنة ليلًا.
   كل لون يمرّ عبر متغيّر — الوضع الليلي يعيد تعريف المتغيّرات لا القواعد.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --color-bg: #f6fbfd;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #e4f4f9;

    --color-primary: #0891b2;
    --color-primary-hover: #0e7490;
    --color-primary-soft: rgba(8, 145, 178, .12);
    --color-accent: #f59e0b;
    --color-accent-soft: rgba(245, 158, 11, .12);

    --color-text: #0f2027;
    --color-text-secondary: #3d5560;
    --color-text-muted: #8ba3ad;

    --color-border: #cfe8f0;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    --editor-bg: #20232a;
    --editor-fg: #e2e8f0;
    --console-bg: #0b1220;
    --console-fg: #d1fae5;

    --font-sans: 'Cairo', system-ui, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;

    --radius-sm: 0.4rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --topbar-height: 64px;
    --nav-footer-height: 76px;
    --shadow-soft: 0 4px 20px -2px rgba(8, 90, 120, .1);
}

body.dark-mode {
    --color-bg: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-tertiary: #22384a;
    --color-text: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #7c8aa5;
    --color-border: #334155;
    --color-primary: #61dafb;
    --color-primary-hover: #93e6fc;
    --color-primary-soft: rgba(97, 218, 251, .16);
    --color-accent: #fbbf24;
    --color-accent-soft: rgba(251, 191, 36, .12);
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, .35);
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    transition: background-color .3s, color .3s;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

kbd {
    font-family: var(--font-mono);
    font-size: .8em;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: .05rem .35rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LANDING
   ───────────────────────────────────────────────────────────────────────────── */
.landing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 2rem 1rem 3rem;
    position: relative;
    overflow: hidden;
}

.landing__container {
    text-align: center;
    z-index: 10;
    max-width: 660px;
    width: 100%;
}

.landing__badge {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border: 1px solid rgba(142, 68, 173, .3);
    padding: .45rem 1rem;
    border-radius: 99px;
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 1.75rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.landing__title {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: .75rem;
    color: var(--color-text);
}

.landing__subtitle {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    margin-bottom: 2.25rem;
}

.landing__cta {
    background: linear-gradient(135deg, #8e44ad, #14b8a6);
    color: #fff;
    padding: .95rem 2.4rem;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: var(--radius-xl);
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    box-shadow: 0 10px 25px -8px rgba(142, 68, 173, .6);
    transition: transform .2s, box-shadow .2s;
}

.landing__cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px -8px rgba(142, 68, 173, .7);
}

.landing__stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 2.25rem;
    padding: 1.25rem 1.5rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.stat__number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1.1;
}

.stat__label {
    font-size: .85rem;
    color: var(--color-text-secondary);
}

.landing__continue {
    margin-top: 1.25rem;
}

.btn-link {
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .95rem;
    padding: .4rem .8rem;
    border-radius: var(--radius-md);
}

.btn-link:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text);
}

.landing__decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .3;
}

.blob--1 {
    width: 420px;
    height: 420px;
    background: #d8b4fe;
    top: -140px;
    right: -120px;
}

.blob--2 {
    width: 360px;
    height: 360px;
    background: #99f6e4;
    bottom: -140px;
    left: -100px;
}

body.dark-mode .blob {
    opacity: .14;
}

/* ─────────────────────────────────────────────────────────────────────────────
   COVER — CSS خالص: جوال على وجه الكتاب، وفيه تطبيق يعمل
   ───────────────────────────────────────────────────────────────────────────── */
.landing__cover { margin: 0 auto 1.75rem; display: flex; flex-direction: column; align-items: center; gap: .9rem; }

.cover { --cover-w: 210px; --cover-h: 285px; position: relative; width: var(--cover-w); height: var(--cover-h); perspective: 1100px; }

.cover__book {
    position: relative; width: 100%; height: 100%;
    transform: rotateY(16deg) rotateX(4deg);
    transform-style: preserve-3d;
    transition: transform .7s cubic-bezier(.22, 1, .36, 1);
}

.cover:hover .cover__book { transform: rotateY(0deg) rotateX(0deg) translateY(-6px); }

.cover__spine {
    position: absolute; top: 0; right: -13px; width: 14px; height: 100%;
    border-radius: 0 5px 5px 0;
    background: linear-gradient(180deg, #0e7490, #155e75 55%, #0c4a5e);
    box-shadow: inset 3px 0 6px rgba(0, 0, 0, .35);
}

.cover__face {
    position: relative; width: 100%; height: 100%; overflow: hidden;
    border-radius: 12px 4px 4px 12px;
    background:
        radial-gradient(120% 90% at 15% 0%, rgba(97, 218, 251, .28), transparent 60%),
        linear-gradient(160deg, #20232a 0%, #16323d 55%, #0c4a5e 100%);
    box-shadow:
        0 22px 45px -12px rgba(8, 60, 80, .55),
        0 3px 10px rgba(15, 23, 42, .18),
        inset 0 0 0 1px rgba(97, 218, 251, .2);
    padding: .85rem .9rem;
    display: flex; flex-direction: column; color: #fff;
}

/* توهّج سماوي خلف الجوال */
.cover__glow {
    position: absolute; inset: -20% -10% auto; height: 70%;
    background: radial-gradient(closest-side, rgba(97, 218, 251, .35), transparent 70%);
    pointer-events: none;
}

.cover__sheen {
    position: absolute; top: -60%; left: -70%; width: 55%; height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .25), transparent);
    transform: rotate(18deg);
    animation: cover-sheen 7s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cover-sheen { 0%, 62% { left: -70%; } 88%, 100% { left: 130%; } }

/* الجوال */
.cover__phone {
    position: relative; z-index: 1;
    width: 96px; height: 150px; margin: .15rem auto auto;
    border-radius: 14px;
    background: #0f172a;
    box-shadow: 0 0 0 2px #61dafb55, 0 10px 22px -8px rgba(0, 0, 0, .7);
    padding: 8px 6px 6px;
    overflow: hidden;
}

.cover__notch {
    position: absolute; top: 3px; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 2px; background: #334155;
}

.cover__app { display: flex; flex-direction: column; gap: 4px; height: 100%; position: relative; }

.cover__bar { height: 8px; width: 60%; border-radius: 3px; background: #61dafb; margin-bottom: 2px; }

.cover__row {
    display: flex; align-items: center; gap: 4px;
    background: #1e293b; border-radius: 5px; padding: 4px;
}

.cover__row i { width: 9px; height: 9px; border-radius: 2px; background: #38bdf8; flex: none; }
.cover__row b { height: 4px; border-radius: 2px; background: #475569; flex: 1; }

.cover__row--new { animation: cover-add 3.4s ease-in-out infinite; }

@keyframes cover-add {
    0%, 55% { opacity: 0; transform: translateY(6px); }
    70%, 100% { opacity: 1; transform: none; }
}

.cover__fab {
    position: absolute; bottom: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #f59e0b; color: #20232a;
    display: grid; place-items: center;
    font-weight: 800; font-size: 13px; line-height: 1;
    animation: cover-tap 3.4s ease-in-out infinite;
}

@keyframes cover-tap {
    0%, 45%, 60%, 100% { transform: scale(1); }
    52% { transform: scale(.82); }
}

.cover__title {
    font-size: 1.5rem; font-weight: 800; line-height: 1.15;
    margin: .5rem 0 .3rem; direction: ltr; text-align: left;
    letter-spacing: -.02em; color: #61dafb;
    text-shadow: 0 2px 14px rgba(97, 218, 251, .35);
    position: relative; z-index: 1;
}

.cover__tag {
    align-self: flex-start;
    font-family: var(--font-mono); font-size: .58rem; font-weight: 700;
    letter-spacing: .12em; padding: .18rem .5rem; border-radius: 999px;
    border: 1px solid rgba(97, 218, 251, .45);
    background: rgba(97, 218, 251, .1); color: #a5eefd;
    direction: ltr; position: relative; z-index: 1;
}

.cover__shadow {
    position: absolute; bottom: -16px; left: 8%; width: 84%; height: 22px;
    border-radius: 50%; background: rgba(8, 60, 80, .4); filter: blur(13px);
    transition: transform .7s cubic-bezier(.22, 1, .36, 1), opacity .7s;
}

.cover:hover .cover__shadow { transform: scale(.92); opacity: .75; }

.cover__note { font-size: .78rem; color: var(--color-text-muted); display: flex; align-items: center; gap: .4rem; }
.cover__note i { color: var(--color-primary); }

/* ─────────────────────────────────────────────────────────────────────────────
   READER
   ───────────────────────────────────────────────────────────────────────────── */
.reader {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    background: var(--color-bg-secondary);
    flex-shrink: 0;
}

.topbar__right,
.topbar__left {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.topbar__title {
    font-weight: 700;
    font-size: .95rem;
    color: var(--color-text);
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar__btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background .2s, color .2s;
}

.topbar__btn:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-primary);
}

.topbar__center {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: .85rem;
    color: var(--color-text-secondary);
    background: var(--color-bg-tertiary);
    padding: .25rem .75rem;
    border-radius: 6px;
}

.progress-bar {
    height: 3px;
    background: var(--color-border);
    flex-shrink: 0;
}

.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transition: width .4s ease;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1rem calc(var(--nav-footer-height) + 2rem);
}

.page {
    max-width: 860px;
    margin: 0 auto;
    animation: page-in .35s ease;
}

@keyframes page-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   TYPOGRAPHY
   ───────────────────────────────────────────────────────────────────────────── */
.page h1 {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 1rem;
}

.page h2 {
    font-size: 1.7rem;
    font-weight: 800;
    margin: 2rem 0 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--color-border);
}

.page h2:first-child {
    margin-top: 0;
}

.page h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 1.5rem 0 .6rem;
    color: var(--color-primary);
}

.page h4 {
    font-size: 1.05rem;
    margin: 1rem 0 .4rem;
}

.page p {
    font-size: 1.05rem;
    margin-bottom: 1.1rem;
    color: var(--color-text-secondary);
}

.page ul,
.page ol {
    margin: 1rem 0 1.25rem;
    padding-right: 1.5rem;
    color: var(--color-text-secondary);
}

.page li {
    margin-bottom: .5rem;
}

.page strong {
    color: var(--color-text);
}

.page code {
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
    padding: .15rem .4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: .88em;
    unicode-bidi: isolate;
    direction: ltr;
    display: inline-block;
}

.page pre {
    background: var(--editor-bg);
    color: var(--editor-fg);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin: 1rem 0 1.25rem;
    overflow-x: auto;
    font-size: .88rem;
    line-height: 1.65;
}

.page pre,
.page pre code {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
    white-space: pre;
}

.page pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
    display: inline;
}

.page pre span { unicode-bidi: isolate; }
.page pre .k { color: #c4b5fd; }
.page pre .s { color: #86efac; }
.page pre .n { color: #fdba74; }
.page pre .c { color: #94a3b8; font-style: italic; }
.page pre .f { color: #93c5fd; }
.page pre .x { color: #f87171; }
.page pre .c2 { color: #61dafb; }   /* أسماء مكوّنات React */
.page pre .a { color: #fbbf24; }   /* الخصائص */

/* ─────────────────────────────────────────────────────────────────────────────
   صناديق ومكوّنات الكتاب
   ───────────────────────────────────────────────────────────────────────────── */
.info-box,
.warning-box,
.success-box,
.tip-box,
.highlight-box {
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    border-right: 4px solid;
    background: var(--color-bg-secondary);
    box-shadow: var(--shadow-soft);
}

.info-box { border-color: var(--color-accent); }
.warning-box { border-color: var(--color-error); }
.success-box { border-color: var(--color-success); }
.tip-box,
.highlight-box { border-color: var(--color-primary); }

.info-box h4,
.success-box h4,
.highlight-box h4 { margin-top: 0; }

.info-box p:last-child,
.tip-box p:last-child,
.success-box p:last-child,
.warning-box p:last-child,
.highlight-box p:last-child { margin-bottom: 0; }

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    font-weight: 700;
    color: var(--color-accent);
    background: var(--color-accent-soft);
    padding: .3rem .8rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.level-badge--build {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.foryou {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.25rem 0 1.5rem;
}

.foryou__col {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
}

.foryou__col h4 {
    margin: 0 0 .6rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.foryou__col--yes h4 { color: var(--color-success); }
.foryou__col--no h4 { color: var(--color-text-muted); }
.foryou__col ul { margin: 0; padding-right: 1.1rem; }
.foryou__col li { font-size: .95rem; }

/* مخطط: صندوق برأس وجسم SVG */
.dg { margin: 1.75rem 0; border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-bg-secondary); overflow: hidden; }
.dg__head { display: flex; align-items: center; gap: .55rem; padding: .65rem 1rem; background: var(--color-bg-tertiary); border-bottom: 1px solid var(--color-border); font-size: .88rem; font-weight: 700; }
.dg__head i { color: var(--color-primary); }
.dg__body { padding: 1.1rem; }
.dg svg { width: 100%; height: auto; display: block; max-width: 520px; margin: 0 auto; }
.dg__cap { padding: 0 1rem 1rem; margin: 0; font-size: .82rem; color: var(--color-text-muted); text-align: center; }
.dg .lbl { font-family: 'Cairo', sans-serif; font-weight: 700; fill: var(--color-text); }
.dg .sub { font-family: 'Cairo', sans-serif; fill: var(--color-text-secondary); }

/* عشرة أخطاء */
.mst { background: var(--color-bg-secondary); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin: .6rem 0; overflow: hidden; }
.mst__h { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; font-weight: 700; background: var(--color-bg-tertiary); }
.mst__n { width: 26px; height: 26px; border-radius: 50%; background: var(--color-primary); color: #fff; display: grid; place-items: center; font-size: .8rem; flex: none; }
.mst__b { padding: .6rem .9rem .75rem; font-size: .92rem; color: var(--color-text-secondary); line-height: 1.75; }

/* جدول القرار — علامات */
.dec-yes { color: var(--color-success); font-weight: 800; }
.dec-mid { color: var(--color-warning); font-weight: 800; }
.dec-no { color: var(--color-error); font-weight: 800; }

/* ─────────────────────────────────────────────────────────────────────────────
   CODE PLAYGROUND — المحرّر واللوحة والكونسول
   ───────────────────────────────────────────────────────────────────────────── */
.code-playground {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin: 1.5rem 0 0;
    background: var(--color-bg-secondary);
    padding: .9rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.playground-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
}

.playground-title {
    font-family: var(--font-mono);
    font-size: .85rem;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    direction: ltr;
}

.playground-title i { color: var(--color-primary); }

.playground-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.run-btn {
    background: var(--color-success);
    color: #fff;
    padding: .45rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    transition: filter .2s;
}

.run-btn:hover { filter: brightness(1.08); }

.reset-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.reset-btn:hover {
    color: var(--color-error);
    border-color: var(--color-error);
}

.playground-grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: .75rem;
    height: 460px;
}

.playground-grid--tall { height: 560px; }

.editor-wrapper,
.preview-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.editor-label {
    font-size: .78rem;
    margin-bottom: .4rem;
    color: var(--color-text-muted);
}

.code-editor {
    flex: 1;
    background: var(--editor-bg);
    color: var(--editor-fg);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: .9rem 1rem;
    font-family: var(--font-mono);
    font-size: .84rem;
    line-height: 1.55;
    resize: none;
    outline: none;
    direction: ltr;
    text-align: left;
    tab-size: 4;
}

.code-editor:focus { border-color: var(--color-primary); }

@media (max-width: 768px) {
    .playground-grid,
    .playground-grid--tall {
        grid-template-columns: 1fr;
        height: 720px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   NAV FOOTER
   ───────────────────────────────────────────────────────────────────────────── */
.nav-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-bg-secondary);
    height: var(--nav-footer-height);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 50;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    font-weight: 600;
    transition: all .2s;
}

.nav-btn:disabled { opacity: .4; cursor: default; }
.nav-btn:not(:disabled):hover { border-color: var(--color-primary); color: var(--color-primary); }

.nav-btn--next {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.nav-btn--next:not(:disabled):hover { background: var(--color-primary-hover); color: #fff; }

.nav-dots {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 40vw;
}

.nav-dot {
    width: 7px;
    height: 7px;
    background: var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    transition: transform .2s, background .2s;
}

.nav-dot.done { background: var(--color-success); }
.nav-dot.active { background: var(--color-primary); transform: scale(1.4); }

@media (max-width: 600px) {
    .nav-dots { display: none; }
    .nav-btn span { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SIDE MENU
   ───────────────────────────────────────────────────────────────────────────── */
.side-menu {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    max-width: 90vw;
    height: 100%;
    background: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border);
    z-index: 200;
    transition: right .3s ease;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.side-menu.open { right: 0; }

.side-menu__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--color-border);
}

.side-menu__header h3 { font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }

.side-menu__close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
}

.side-menu__close:hover { background: var(--color-bg-tertiary); }
.side-menu__nav { overflow-y: auto; flex: 1; }

.toc-item {
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .92rem;
    transition: background .15s;
}

.toc-item > i:first-child { color: var(--color-text-muted); width: 1rem; text-align: center; font-size: .8rem; }
.toc-item span { flex: 1; }
.toc-item:hover { background: var(--color-bg-tertiary); color: var(--color-text); }
.toc-item.active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 700; }

.toc-done { color: var(--color-success); opacity: 0; transition: opacity .2s; }
.toc-done.on { opacity: 1; }

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: .3s;
}

.overlay.visible { opacity: 1; pointer-events: auto; }

/* ─────────────────────────────────────────────────────────────────────────────
   شاشة المحتوى المقفل
   ───────────────────────────────────────────────────────────────────────────── */
.locked { text-align: center; padding: 4rem 1.5rem; max-width: 520px; margin: 0 auto; }
.locked i { font-size: 2.5rem; color: var(--color-primary); opacity: .55; margin-bottom: 1.25rem; display: block; }
.locked h3 { font-size: 1.35rem; margin-bottom: .75rem; color: var(--color-text); }
.locked p { color: var(--color-text-secondary); line-height: 1.9; }

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE & MOTION
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .landing__title { font-size: 1.9rem; }
    .landing__stats { gap: 1.25rem; padding: 1rem; }
    .stat__number { font-size: 1.5rem; }
    .foryou { grid-template-columns: 1fr; }
    .page h1 { font-size: 1.7rem; }
    .page h2 { font-size: 1.35rem; }
    .cover { --cover-w: 170px; --cover-h: 230px; }
    .cover__title { font-size: 1.2rem; }
    .cover__phone { width: 80px; height: 122px; }
    .topbar__title { max-width: 32vw; font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
    .cover__sheen, .cover__row--new, .cover__fab, .page { animation: none !important; }
    .cover__book, .cover__shadow, .progress-bar__fill { transition: none !important; }
}
