/* ═══════════════════════════════════════════════════════════════════════════
   خارطة الوصول — سمة «الخريطة الزرقاء»
   فاتحة نهارًا بأزرق الإعلانات الرقمية (#2563eb) وسماوي (#06b6d4)، داكنة ليلًا.
   كل لون يمرّ عبر متغيّر — الوضع الليلي يعيد تعريف المتغيّرات لا القواعد.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --color-bg: #f7faff;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #e8f0fe;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-soft: rgba(37, 99, 235, .12);
    --color-accent: #06b6d4;
    --color-accent-soft: rgba(6, 182, 212, .12);

    --color-text: #1e293b;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;

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

    --editor-bg: #1e1e2e;
    --editor-fg: #e2e8f0;

    --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(30, 64, 175, .08);
}

body.dark-mode {
    --color-bg: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-tertiary: #263449;
    --color-text: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #7c8aa5;
    --color-border: #334155;
    --color-primary: #60a5fa;
    --color-primary-hover: #93c5fd;
    --color-primary-soft: rgba(96, 165, 250, .18);
    --color-accent: #22d3ee;
    --color-accent-soft: rgba(34, 211, 238, .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;
}

/* ─────────────────────────────────────────────────────────────────────────────
   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(37, 99, 235, .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, #2563eb, #06b6d4);
    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(37, 99, 235, .6);
    transition: transform .2s, box-shadow .2s;
}

.landing__cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px -8px rgba(37, 99, 235, .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: #93c5fd;
    top: -140px;
    right: -120px;
}

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

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

/* ─────────────────────────────────────────────────────────────────────────────
   COVER — HTML/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, #1e3a8a, #172554 55%, #0f1d3f);
    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(255, 255, 255, .22), transparent 60%),
        linear-gradient(155deg, #3b82f6 0%, #2563eb 50%, #0e7490 100%);
    box-shadow:
        0 22px 45px -12px rgba(30, 58, 138, .5),
        0 3px 10px rgba(15, 23, 42, .18),
        inset 0 0 0 1px rgba(255, 255, 255, .18);
    padding: .9rem 1rem;
    display: flex;
    flex-direction: column;
    color: #fff;
}

/* شبكة خريطة خفيفة */
.cover__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .12) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: radial-gradient(120% 80% at 50% 40%, #000, transparent 75%);
    -webkit-mask-image: radial-gradient(120% 80% at 50% 40%, #000, transparent 75%);
    pointer-events: none;
}

.cover__sheen {
    position: absolute;
    top: -60%;
    left: -70%;
    width: 55%;
    height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), 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__map {
    width: 100%;
    height: auto;
    margin: .2rem 0 auto;
    position: relative;
    z-index: 1;
    overflow: visible;
}

.cover__route {
    fill: none;
    stroke: rgba(255, 255, 255, .9);
    stroke-width: 2.2;
    stroke-dasharray: 6 5;
    stroke-linecap: round;
    animation: cover-route 3s linear infinite;
}

@keyframes cover-route {
    to { stroke-dashoffset: -22; }
}

.cover__pin {
    fill: #fbbf24;
    stroke: #fff;
    stroke-width: 2;
    animation: cover-pin 2.4s ease-in-out infinite;
}

.cover__pin--2 { animation-delay: .8s; fill: #f472b6; }
.cover__pin--3 { animation-delay: 1.6s; fill: #34d399; }

@keyframes cover-pin {
    0%, 100% { r: 6; }
    50% { r: 8; }
}

.cover__lbl {
    fill: rgba(255, 255, 255, .95);
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 700;
    text-anchor: middle;
}

.cover__title {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 .35rem;
    text-shadow: 0 2px 12px rgba(15, 30, 80, .35);
    position: relative;
    z-index: 1;
}

.cover__tag {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    padding: .2rem .6rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .14);
    direction: ltr;
    position: relative;
    z-index: 1;
}

.cover__shadow {
    position: absolute;
    bottom: -16px;
    left: 8%;
    width: 84%;
    height: 22px;
    border-radius: 50%;
    background: rgba(30, 58, 138, .35);
    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;
}

.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;
}

.page pre span {
    unicode-bidi: isolate;
}

.page img {
    max-width: 100%;
    border-radius: var(--radius-md);
    display: block;
    margin: 1.25rem auto;
}

/* ─────────────────────────────────────────────────────────────────────────────
   صناديق ومكوّنات الكتاب
   ───────────────────────────────────────────────────────────────────────────── */
.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;
}

.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;
}

/* المثلث الذهبي — ثلاث ركائز بخطوط بينها */
.tri {
    position: relative;
    max-width: 460px;
    margin: 1.5rem auto;
    padding-top: .5rem;
}

.tri__node {
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: .7rem .9rem;
    text-align: center;
    width: 46%;
    box-shadow: var(--shadow-soft);
    position: relative;
    z-index: 1;
}

.tri__node strong {
    display: block;
    color: var(--color-primary);
}

.tri__node small {
    color: var(--color-text-secondary);
    font-size: .8rem;
}

.tri__top {
    margin: 0 auto 2.2rem;
}

.tri__row {
    display: flex;
    justify-content: space-between;
}

.tri__row .tri__node:nth-child(2) {
    border-color: var(--color-accent);
}

.tri__row .tri__node:nth-child(2) strong {
    color: var(--color-accent);
}

.tri__lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.tri__lines line {
    stroke: var(--color-border);
    stroke-width: 2;
    stroke-dasharray: 5 4;
}

.tri__center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -30%);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 800;
    font-size: .85rem;
    padding: .3rem .8rem;
    border-radius: 999px;
    z-index: 1;
}

/* الهيكل الهرمي — ثلاث طبقات تضيق */
.pyr {
    display: grid;
    gap: .5rem;
    max-width: 560px;
    margin: 1.5rem auto;
}

.pyr__lvl {
    color: #fff;
    border-radius: var(--radius-md);
    padding: .9rem 1rem;
    text-align: center;
    margin: 0 auto;
    box-shadow: var(--shadow-soft);
}

.pyr__lvl strong {
    display: block;
    color: #fff;
    font-size: 1.05rem;
}

.pyr__lvl span {
    font-size: .88rem;
    opacity: .92;
}

.pyr__lvl--1 { width: 100%; background: #1d4ed8; }
.pyr__lvl--2 { width: 88%; background: #0284c7; }
.pyr__lvl--3 { width: 76%; background: #0d9488; }

.pyr__arrow {
    text-align: center;
    color: var(--color-text-muted);
    font-size: .8rem;
}

/* سلّم الوعي */
.aw {
    display: grid;
    gap: .5rem;
    margin: 1.25rem 0;
}

.aw__row {
    display: flex;
    gap: .8rem;
    align-items: flex-start;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: .75rem .9rem;
}

.aw__n {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .9rem;
}

.aw__t {
    font-size: .92rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.aw__t b {
    display: block;
    color: var(--color-text);
}

/* خط زمني */
.timeline {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: .4rem 1rem;
    margin: 1.25rem 0;
    font-size: .92rem;
    align-items: center;
}

.timeline__t {
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--color-text-muted);
    text-align: left;
    direction: ltr;
}

.timeline__e {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-right: 4px solid var(--color-accent);
    border-radius: var(--radius-sm);
    padding: .5rem .8rem;
}

.timeline__e--warn { border-right-color: var(--color-warning); }
.timeline__e--bad { border-right-color: var(--color-error); }
.timeline__e--ok { border-right-color: var(--color-success); }

/* عشرة أخطاء */
.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;
}

/* جدول تقرير وهمي مشروح */
.report {
    direction: ltr;
    font-family: var(--font-mono);
    font-size: .8rem;
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.report th,
.report td {
    padding: .5rem .6rem;
    border: 1px solid var(--color-border);
    text-align: right;
    white-space: nowrap;
}

.report th {
    background: var(--color-bg-tertiary);
    font-weight: 700;
}

.report td.bad { color: var(--color-error); font-weight: 700; }
.report td.ok { color: var(--color-success); font-weight: 700; }
.report tr.dim td { opacity: .55; }

.report-notes {
    counter-reset: n;
    margin: .5rem 0 1.25rem;
    padding: 0;
    list-style: none;
    display: grid;
    gap: .4rem;
}

.report-notes li {
    counter-increment: n;
    font-size: .9rem;
    padding-right: 2rem;
    position: relative;
    color: var(--color-text-secondary);
}

.report-notes li::before {
    content: counter(n);
    position: absolute;
    right: 0;
    top: .15rem;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: .72rem;
    display: grid;
    place-items: center;
    font-weight: 800;
}

/* نتائج الحاسبات (نمط كتاب التسعير) */
.calc__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .6rem;
    align-items: center;
    padding: .45rem 0;
    border-bottom: 1px dashed var(--color-border);
    font-size: .88rem;
}

.calc__row:last-child { border-bottom: none; }
.calc__row b { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

.calc__big {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    margin: .2rem 0 .8rem;
    flex-wrap: wrap;
}

.calc__big span {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    direction: ltr;
    unicode-bidi: isolate;
}

.calc__big small {
    font-size: .82rem;
    color: var(--color-text-muted);
}

.calc__warn {
    margin-top: .7rem;
    padding: .65rem .8rem;
    border-radius: 9px;
    background: rgba(245, 158, 11, .12);
    border: 1px solid rgba(245, 158, 11, .35);
    font-size: .85rem;
    line-height: 1.75;
}

.calc__bad {
    margin-top: .7rem;
    padding: .65rem .8rem;
    border-radius: 9px;
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .3);
    font-size: .85rem;
    line-height: 1.75;
}

.calc__ok {
    margin-top: .7rem;
    padding: .65rem .8rem;
    border-radius: 9px;
    background: rgba(16, 185, 129, .1);
    border: 1px solid rgba(16, 185, 129, .3);
    font-size: .85rem;
    line-height: 1.75;
}

.calc__formula {
    font-family: var(--font-mono);
    font-size: .8rem;
    direction: ltr;
    text-align: left;
    background: var(--color-bg-tertiary);
    border-radius: 6px;
    padding: .4rem .7rem;
    margin: .5rem 0;
    color: var(--color-text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   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.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;
}

.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.5rem; }
    .topbar__title { max-width: 32vw; font-size: .85rem; }
    .timeline { grid-template-columns: 64px 1fr; }
    .tri__node { width: 48%; padding: .5rem .5rem; font-size: .9rem; }
}

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

/* مخطط: صندوق برأس وجسم SVG (نمط dg من كتاب البراند) */
.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: 560px; margin: 0 auto; }
.dg__cap { padding: 0 1rem 1rem; margin: 0; font-size: .82rem; color: var(--color-text-muted); text-align: center; }
body.dark-mode .dg svg text { fill: #e2e8f0; }
