/* ═══════════════════════════════════════════════════════════════════════════
   أساسيات تطوير الألعاب — سمة «الأركيد»
   فاتحة نهارًا ببنفسجي (#8e44ad) وتركوازي (#14b8a6)، داكنة ليلًا.
   كل لون يمرّ عبر متغيّر — الوضع الليلي يعيد تعريف المتغيّرات لا القواعد.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --color-bg: #fbf7fd;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #f1e7f7;

    --color-primary: #8e44ad;
    --color-primary-hover: #7d3c98;
    --color-primary-soft: rgba(142, 68, 173, .13);
    --color-accent: #14b8a6;
    --color-accent-soft: rgba(20, 184, 166, .12);

    --color-text: #1f1530;
    --color-text-secondary: #4b3f5c;
    --color-text-muted: #9a8fa8;

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

    --editor-bg: #1e1e2e;
    --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(90, 40, 120, .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: #c084fc;
    --color-primary-hover: #d8b4fe;
    --color-primary-soft: rgba(192, 132, 252, .18);
    --color-accent: #2dd4bf;
    --color-accent-soft: rgba(45, 212, 191, .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, #5b2c6f, #4a235a 55%, #35193f);
    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, #a569bd 0%, #8e44ad 50%, #5b2c6f 100%);
    box-shadow:
        0 22px 45px -12px rgba(75, 30, 100, .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, .1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .1) 1px, transparent 1px);
    background-size: 14px 14px;
    mask-image: radial-gradient(120% 80% at 50% 100%, #000, transparent 75%);
    -webkit-mask-image: radial-gradient(120% 80% at 50% 100%, #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__screen {
    position: relative;
    height: 88px;
    border-radius: 8px;
    background: #0b1220;
    box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .5), inset 0 0 0 2px #1e293b;
    overflow: hidden;
    z-index: 1;
}

.cover__score {
    position: absolute;
    top: 6px;
    left: 8px;
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: .1em;
    color: #fde68a;
    direction: ltr;
}

.cover__ground {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 10px;
    background: repeating-linear-gradient(90deg, #334155 0 8px, #1e293b 8px 16px);
}

.cover__player {
    position: absolute;
    bottom: 10px;
    left: 24px;
    width: 16px;
    height: 16px;
    background: #2dd4bf;
    border-radius: 2px;
    animation: cover-jump 1.6s ease-in-out infinite;
}

@keyframes cover-jump {
    0%, 40%, 100% { transform: translateY(0); }
    65% { transform: translateY(-26px); }
}

.cover__enemy {
    position: absolute;
    bottom: 10px;
    right: -14px;
    width: 12px;
    height: 12px;
    background: #f87171;
    animation: cover-enemy 1.6s linear infinite;
}

@keyframes cover-enemy {
    from { transform: translateX(0); }
    to { transform: translateX(-190px); }
}

/* أزرار الاتجاه */
.cover__pad {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .55rem .35rem .2rem;
    margin-bottom: auto;
    position: relative;
    z-index: 1;
}

.cover__dpad {
    position: relative;
    width: 34px;
    height: 34px;
}

.cover__dpad i {
    position: absolute;
    width: 11px;
    height: 11px;
    background: rgba(255, 255, 255, .85);
    border-radius: 2px;
}

.cover__dpad i:nth-child(1) { top: 0; left: 11.5px; }
.cover__dpad i:nth-child(2) { top: 11.5px; left: 0; }
.cover__dpad i:nth-child(3) { top: 11.5px; right: 0; }
.cover__dpad i:nth-child(4) { bottom: 0; left: 11.5px; }

.cover__btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f472b6;
    box-shadow: 0 3px 0 #be185d;
    animation: cover-press 1.6s ease-in-out infinite;
}

@keyframes cover-press {
    0%, 55%, 100% { transform: translateY(0); box-shadow: 0 3px 0 #be185d; }
    62% { transform: translateY(3px); box-shadow: 0 0 0 #be185d; }
}

.cover__title {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 .35rem;
    text-shadow: 0 2px 12px rgba(50, 10, 70, .35);
    position: relative;
    z-index: 1;
}

.cover__tag {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .1em;
    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(75, 30, 100, .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;
    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; }

/* ─────────────────────────────────────────────────────────────────────────────
   صناديق ومكوّنات الكتاب
   ───────────────────────────────────────────────────────────────────────────── */
.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.15rem; }
    .cover__screen { height: 66px; }
    .topbar__title { max-width: 32vw; font-size: .85rem; }
}

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