/* =====================================================================
   موقع المشايخ — نظام التصميم (الطراز الفاخر)
   أخضر زمردي داكن، وذهب، وورق كريمي للقراءة. خطوط محمَّلة من الموقع نفسه.
   لا أنماط مضمَّنة في الصفحات: كل شيء هنا، احترامًا لسياسة المحتوى الصارمة.
   ===================================================================== */

@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Amiri"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/amiri-arabic-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Amiri"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/amiri-arabic-700-normal.woff2") format("woff2"); }

:root {
  --bg-0: #0a1f1e; --bg-1: #0f2f2d; --bg-2: #15403c; --bg-3: #1b4d48;
  --gold: #d4af37; --gold-l: #f1d98a; --gold-d: #9a7a26; --gold-rgb: 212, 175, 55;
  --cream: #f6efdd; --cream-2: #e3dcc8; --mist: #b8c8c2;
  --paper: #f8f4ec; --paper-2: #efe8da; --card: #fffdf8;
  --ink: #1f1b17; --ink-2: #4a433b; --muted: #7a7064; --line: #e4dccd; --line-2: #d2c7b2;
  --maroon: #6e1d2b; --green: #1f6b55; --green-soft: #e1f0ea; --red: #9b2222; --red-soft: #f9e4e4; --amber: #7a4b00; --amber-soft: #fbf0d9;
  --glass: linear-gradient(160deg, rgba(255,255,255,.085), rgba(255,255,255,.03));
  --glass-border: rgba(var(--gold-rgb), .32);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.55);
  --shadow-gold: 0 0 0 1px rgba(var(--gold-rgb), .35), 0 14px 40px -14px rgba(var(--gold-rgb), .35);
  --r: 18px; --r-sm: 11px;
  --font-ui: "Plex Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-heading: "Amiri", "Plex Arabic", serif;
  --w: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  color: var(--cream); font-family: var(--font-ui); line-height: 1.9;
  background: var(--bg-1);
  background-image:
    radial-gradient(1100px 520px at 85% -5%, rgba(var(--gold-rgb), .16), transparent 60%),
    radial-gradient(900px 500px at 10% 20%, rgba(43, 120, 105, .35), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 45%, var(--bg-0) 100%);
  background-attachment: fixed;
}
body::before { content: ""; position: fixed; inset: 0; background: url("/img/pattern.svg") center / 120px 120px repeat; opacity: .06; pointer-events: none; z-index: 0; }
body > * { position: relative; z-index: 1; }
a { color: var(--gold-l); text-decoration: none; }
a:hover { color: #fff; }
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.3; margin: 0 0 .6rem; font-weight: 700; color: var(--gold-l); }
h1 { font-size: clamp(1.9rem, 2.6vw + 1rem, 2.8rem); }
h2 { font-size: clamp(1.35rem, 1.1vw + 1rem, 1.75rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 .9rem; }
.muted { color: var(--mist); }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }
.ic { width: 1.1em; height: 1.1em; vertical-align: -.18em; flex: none; }
:focus-visible { outline: 3px solid rgba(var(--gold-rgb), .7); outline-offset: 2px; border-radius: 6px; }
.gold-text { background: linear-gradient(180deg, #fff1c1 0%, var(--gold) 45%, #b8902a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mt0 { margin-top: 0 !important; } .mt1 { margin-top: 1rem; } .mth { margin-top: .5rem; } .mb0 { margin-bottom: 0; } .pt0 { padding-top: 0 !important; } .center { text-align: center; } .small { font-size: .9rem; }

/* ---------- الشريط العلوي ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(10, 31, 30, .72); backdrop-filter: saturate(1.3) blur(12px); border-bottom: 1px solid rgba(var(--gold-rgb), .28); }
.topbar .wrap { max-width: var(--w); margin: 0 auto; padding: .6rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--gold-l); font-family: var(--font-heading); font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.brand small { display: block; font-family: var(--font-ui); font-size: .72rem; color: var(--mist); font-weight: 500; }
.brand-mark { width: 38px; height: 38px; color: var(--gold); filter: drop-shadow(0 0 10px rgba(var(--gold-rgb), .55)); }
.nav { display: flex; align-items: center; gap: .3rem; }
.nav a, .nav .linklike { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .95rem; border-radius: 999px; color: var(--cream-2); font-weight: 500; font-size: .95rem; background: transparent; border: 1px solid transparent; font-family: inherit; cursor: pointer; }
.nav a:hover, .nav .linklike:hover { background: rgba(255,255,255,.07); color: #fff; border-color: rgba(var(--gold-rgb), .25); }
.nav .primary-link { background: linear-gradient(135deg, var(--gold-l), var(--gold) 55%, var(--gold-d)); color: #1d1606; font-weight: 700; box-shadow: 0 6px 18px -8px rgba(var(--gold-rgb), .8); }
.nav .primary-link:hover { color: #000; filter: brightness(1.05); }
.inline { display: inline; margin: 0; }

/* ---------- الهيكل ---------- */
main { flex: 1; }
.container { max-width: var(--w); margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.narrow { max-width: 780px; }
.section { margin: 2.5rem 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: .6rem; }
.section-head h2 .ic { color: var(--gold); }
.section-head .more { color: var(--gold-l); font-size: .92rem; display: inline-flex; align-items: center; gap: .3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: .5rem 0 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--mist); margin: .2rem 0 0; }
.crumbs { color: var(--mist); font-size: .9rem; margin: 0 0 .6rem; display: flex; gap: .45rem; flex-wrap: wrap; }
.crumbs a { color: var(--mist); } .crumbs a:hover { color: var(--gold-l); }
.ornament { display: flex; align-items: center; justify-content: center; gap: .6rem; color: var(--gold); margin: .6rem auto 1.4rem; }
.ornament span { display: block; width: 90px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament span:last-child { background: linear-gradient(270deg, transparent, var(--gold)); }

footer.site { border-top: 1px solid rgba(var(--gold-rgb), .25); background: rgba(5, 18, 17, .55); margin-top: auto; }
footer.site .wrap { max-width: var(--w); margin: 0 auto; padding: 2rem 1.25rem; display: grid; gap: 1.5rem; grid-template-columns: 1.4fr 1fr 1fr; color: var(--mist); font-size: .92rem; }
footer.site h3 { font-size: 1.05rem; margin-bottom: .4rem; }
footer.site a { color: var(--cream-2); } footer.site a:hover { color: var(--gold-l); }
footer.site ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
footer.site .copy { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.08); padding-top: 1rem; font-size: .85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* ---------- البطل ---------- */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 2.5rem; align-items: center; padding: 2.5rem 0 1.5rem; }
.hero .eyebrow { color: var(--gold); font-weight: 600; font-size: .95rem; display: inline-flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.hero h1 { font-size: clamp(2.4rem, 4vw + 1rem, 4rem); line-height: 1.15; margin-bottom: .6rem; }
.hero .lead { color: var(--cream-2); font-size: 1.12rem; max-width: 560px; margin-bottom: 1.4rem; }
.hero .cta { display: flex; flex-wrap: wrap; gap: .8rem; }
.hero-art { position: relative; border-radius: 26px; overflow: hidden; box-shadow: var(--shadow-gold), var(--shadow); border: 1px solid rgba(var(--gold-rgb), .45); aspect-ratio: 16 / 9; background: var(--bg-2); }
.hero-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-art::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 6px rgba(255,255,255,.06), inset 0 0 80px rgba(0,0,0,.25); border-radius: inherit; pointer-events: none; }

/* ---------- الأزرار ---------- */
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .62rem 1.25rem; border-radius: 999px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; line-height: 1.4; white-space: nowrap; transition: transform .08s ease, filter .15s ease, background .15s ease, border-color .15s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-gold { background: linear-gradient(135deg, var(--gold-l) 0%, var(--gold) 55%, var(--gold-d) 100%); color: #1d1606; box-shadow: 0 8px 22px -10px rgba(var(--gold-rgb), .9); }
.btn-primary:hover, .btn-gold:hover { filter: brightness(1.07); color: #000; }
.btn-secondary { background: rgba(255,255,255,.04); color: var(--gold-l); border-color: rgba(var(--gold-rgb), .55); }
.btn-secondary:hover { background: rgba(var(--gold-rgb), .12); color: #fff; }
.btn-ghost { background: transparent; color: var(--cream-2); border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,.07); color: #fff; }
.btn-danger { background: rgba(155, 34, 34, .12); color: #ffb3b3; border-color: rgba(255, 120, 120, .4); }
.btn-danger:hover { background: rgba(155, 34, 34, .3); color: #fff; }
.btn-danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm { padding: .32rem .8rem; font-size: .86rem; }
.btn-icon { padding: .32rem .5rem; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0; }
.row-actions { display: inline-flex; gap: .3rem; align-items: center; flex-wrap: wrap; }

/* ---------- البطاقات الزجاجية ---------- */
.card, .glass { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.35rem 1.5rem; backdrop-filter: blur(8px); }
.card + .card { margin-top: 1rem; }
.card h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.stats { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 1.5rem 0; }
.stat { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 1rem 1.1rem; text-align: center; box-shadow: var(--shadow); }
.stat .ic { color: var(--gold); width: 1.6rem; height: 1.6rem; margin-bottom: .2rem; }
.stat .n { font-family: var(--font-heading); font-size: 2.1rem; line-height: 1.1; font-weight: 700; }
.stat .l { color: var(--mist); font-size: .9rem; }

.sheikh-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .45rem; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 1.5rem 1.25rem 1.25rem; box-shadow: var(--shadow); color: var(--cream); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; position: relative; overflow: hidden; }
.sheikh-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 90px; background: url("/img/arch-door.jpg") center 30% / cover; opacity: .18; mask-image: linear-gradient(180deg, #000, transparent); -webkit-mask-image: linear-gradient(180deg, #000, transparent); }
.sheikh-card > * { position: relative; }
.sheikh-card:hover { transform: translateY(-4px); border-color: rgba(var(--gold-rgb), .7); box-shadow: var(--shadow-gold), var(--shadow); color: var(--cream); }
.sheikh-card .name { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: var(--gold-l); }
.sheikh-card .bio { color: var(--cream-2); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sheikh-card .meta { color: var(--mist); font-size: .88rem; display: flex; gap: 1rem; margin-top: .4rem; }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, #2b6b5e, var(--bg-1)); color: var(--gold-l); font-family: var(--font-heading); font-size: 1.7rem; font-weight: 700; flex: none; box-shadow: 0 0 0 3px var(--bg-1), 0 0 0 5px var(--gold), 0 8px 24px -8px rgba(var(--gold-rgb), .7); }
.avatar.lg { width: 104px; height: 104px; font-size: 2.6rem; }

/* بلاطات التصنيفات */
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.2rem .8rem 1rem; border-radius: var(--r); background: linear-gradient(170deg, rgba(255,255,255,.1), rgba(255,255,255,.02)); border: 1px solid var(--glass-border); color: var(--cream); text-align: center; font-weight: 600; box-shadow: var(--shadow); transition: transform .2s ease, border-color .2s ease; }
.tile:hover { transform: translateY(-4px); border-color: var(--gold); color: #fff; }
.tile .ic { width: 2.1rem; height: 2.1rem; color: var(--gold); filter: drop-shadow(0 4px 10px rgba(var(--gold-rgb), .45)); }
.tile .c { color: var(--mist); font-size: .82rem; font-weight: 500; }

/* الدرس المميز */
.feature { display: grid; grid-template-columns: 1.35fr 1fr; border-radius: 24px; overflow: hidden; border: 1px solid var(--glass-border); box-shadow: var(--shadow-gold), var(--shadow); background: var(--glass); }
.feature .media { position: relative; min-height: 280px; background: url("/img/arches.jpg") center / cover; display: block; }
.feature .media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature .media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.45)); }
.feature .play { position: absolute; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, var(--gold) 60%, var(--gold-d)); display: grid; place-items: center; color: #1d1606; box-shadow: 0 0 0 10px rgba(var(--gold-rgb), .25), 0 10px 30px rgba(0,0,0,.4); z-index: 2; }
.feature .play .ic { width: 2rem; height: 2rem; }
.feature .body { padding: 1.6rem 1.6rem 1.4rem; display: flex; flex-direction: column; gap: .4rem; }
.feature .body h2 { font-size: 1.7rem; margin: .2rem 0; }
.feature .body .who { color: var(--mist); }
.feature .body .desc { color: var(--cream-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.feature .body .actions { margin-top: auto; }

/* رف السلاسل (كتب) */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.2rem 1rem; padding: 0 .5rem 1.2rem; position: relative; }
.shelf::after { content: ""; position: absolute; inset: auto -1rem 0; height: 14px; border-radius: 8px; background: linear-gradient(180deg, #e8dcc3, #b89d6b 55%, #7d6540); box-shadow: 0 10px 20px -8px rgba(0,0,0,.6); }
.book { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; aspect-ratio: 3 / 4.2; border-radius: 6px 12px 12px 6px; padding: 1rem .8rem; color: var(--gold-l); position: relative; box-shadow: -6px 0 0 -2px rgba(0,0,0,.35), 0 14px 24px -12px rgba(0,0,0,.7); transform-origin: bottom center; transition: transform .25s ease; }
.book::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(var(--gold-rgb), .55); border-radius: 4px 8px 8px 4px; pointer-events: none; }
.book::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 10px; background: linear-gradient(90deg, rgba(0,0,0,.35), transparent); border-radius: 6px 0 0 6px; }
.book:hover { transform: translateY(-8px) rotate(-1.5deg); color: #fff; }
.book .t { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; line-height: 1.4; }
.book .a { font-size: .78rem; color: var(--cream-2); margin-top: .35rem; }
.book .n { position: absolute; bottom: .7rem; font-size: .75rem; color: var(--mist); }
.book.c0 { background: linear-gradient(160deg, #1f5f52, #0f3a32); }
.book.c1 { background: linear-gradient(160deg, #7a2432, #4a131c); }
.book.c2 { background: linear-gradient(160deg, #2a4a7a, #15284a); }
.book.c3 { background: linear-gradient(160deg, #7a5a24, #4a3612); }
.book.c4 { background: linear-gradient(160deg, #4a2a6a, #2a1540); }
.book.c5 { background: linear-gradient(160deg, #2f6b6b, #173838); }

/* ---------- صفحة الشيخ والدروس ---------- */
.profile-head { display: flex; gap: 1.5rem; align-items: center; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 1.6rem 1.8rem; box-shadow: var(--shadow); margin-bottom: 1.4rem; position: relative; overflow: hidden; }
.profile-head::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: url("/img/arches.jpg") center / cover; opacity: .22; mask-image: linear-gradient(270deg, transparent, #000); -webkit-mask-image: linear-gradient(270deg, transparent, #000); }
.profile-head > * { position: relative; }
.profile-head h1 { margin: 0; font-size: clamp(1.8rem, 2.6vw + 1rem, 2.6rem); }
.profile-head .bio { color: var(--cream-2); margin: .3rem 0 0; max-width: 640px; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; padding: .18rem .7rem; border-radius: 999px; background: rgba(var(--gold-rgb), .14); color: var(--gold-l); border: 1px solid rgba(var(--gold-rgb), .4); white-space: nowrap; }
.chip.green { background: rgba(31, 107, 85, .35); color: #cfeee0; border-color: rgba(120, 200, 170, .4); }
.chip.maroon { background: rgba(110, 29, 43, .4); color: #ffd7dc; border-color: rgba(255, 150, 160, .4); }
.chip.gray { background: rgba(255,255,255,.07); color: var(--cream-2); border-color: rgba(255,255,255,.15); }
.series-card { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 1.2rem; overflow: hidden; }
.series-card .head { padding: 1.1rem 1.4rem; border-bottom: 1px solid rgba(var(--gold-rgb), .22); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; align-items: center; background: linear-gradient(90deg, rgba(var(--gold-rgb), .08), transparent); }
.series-card .head h2 { margin: 0; display: flex; align-items: center; gap: .6rem; }
.series-card .head h2 .ic { color: var(--gold); }
.series-card .desc { padding: .9rem 1.4rem 0; color: var(--cream-2); }
.lesson-list { list-style: none; margin: 0; padding: .3rem 0; }
.lesson-list li { border-bottom: 1px solid rgba(255,255,255,.07); }
.lesson-list li:last-child { border-bottom: 0; }
.lesson-list li a { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.4rem; color: var(--cream); }
.lesson-list li a:hover { background: rgba(var(--gold-rgb), .08); color: #fff; }
.lesson-list .num { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: linear-gradient(135deg, var(--gold-l), var(--gold-d)); color: #1d1606; display: grid; place-items: center; font-weight: 700; font-size: .92rem; flex: none; box-shadow: 0 4px 12px -4px rgba(var(--gold-rgb), .8); }
.lesson-list .t { flex: 1; font-weight: 500; font-size: 1.02rem; }
.lesson-list time { color: var(--mist); font-size: .85rem; white-space: nowrap; }
.article { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); box-shadow: var(--shadow); padding: 2rem 2rem 1.6rem; }
.article h1 { font-size: clamp(1.7rem, 2.2vw + 1rem, 2.4rem); }
.article .meta { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; color: var(--mist); font-size: .92rem; margin-bottom: 1.2rem; align-items: center; }
.prose { font-size: 1.1rem; line-height: 2.05; color: var(--cream); }
.prose p { margin: 0 0 1rem; }
.yt-card { display: block; position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--glass-border); margin: 1.2rem 0; aspect-ratio: 16 / 9; background: var(--bg-0) url("/img/arches.jpg") center / cover; box-shadow: var(--shadow); }
.yt-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-card .ov { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; background: linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,.55)); color: #fff; }
.yt-card .play { width: 76px; height: 76px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, var(--gold) 60%, var(--gold-d)); display: grid; place-items: center; color: #1d1606; box-shadow: 0 0 0 10px rgba(var(--gold-rgb), .25), 0 10px 30px rgba(0,0,0,.4); transition: transform .2s ease; }
.yt-card:hover .play { transform: scale(1.06); }
.yt-card .play .ic { width: 2rem; height: 2rem; }
.yt-card .t { font-weight: 600; text-shadow: 0 2px 10px rgba(0,0,0,.6); }

/* بطاقات الدروس الأخيرة */
.lesson-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.lesson-card { display: flex; flex-direction: column; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); overflow: hidden; color: var(--cream); box-shadow: var(--shadow); transition: transform .2s ease, border-color .2s ease; }
.lesson-card:hover { transform: translateY(-4px); border-color: var(--gold); color: #fff; }
.lesson-card .thumb { aspect-ratio: 16 / 9; background: var(--bg-0) url("/img/arches.jpg") center / cover; position: relative; }
.lesson-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lesson-card .thumb .ic { position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; color: #fff; filter: drop-shadow(0 2px 8px rgba(0,0,0,.7)); }
.lesson-card .b { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .25rem; }
.lesson-card .t { font-weight: 600; font-size: 1.02rem; line-height: 1.5; }
.lesson-card .s { color: var(--mist); font-size: .86rem; }

/* ---------- الورق الفاتح: لوحات التحكم ---------- */
.paper { color: var(--ink); }
.paper h1, .paper h2, .paper h3 { color: var(--maroon); }
.paper a { color: var(--maroon); } .paper a:hover { color: #000; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--gold); }
.paper .muted, .paper .sub, .paper .crumbs, .paper .crumbs a { color: var(--muted); }
.paper .card { background: var(--card); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(60,40,20,.06); backdrop-filter: none; color: var(--ink); }
.paper .stat { background: var(--card); border-color: var(--line); color: var(--ink); box-shadow: 0 1px 2px rgba(60,40,20,.06); }
.paper .stat .n { color: var(--maroon); } .paper .stat .l { color: var(--muted); }
.paper .btn-secondary { background: #fff; color: var(--maroon); border-color: var(--line-2); }
.paper .btn-secondary:hover { border-color: var(--maroon); background: #fff; color: var(--maroon); }
.paper .btn-ghost { color: var(--ink-2); } .paper .btn-ghost:hover { background: var(--paper-2); color: var(--ink); }
.paper .btn-danger { background: #fff; color: var(--red); border-color: #e7c3c3; } .paper .btn-danger:hover { background: var(--red-soft); color: var(--red); }
.paper .btn-danger.solid { background: var(--red); color: #fff; }
.paper .chip { background: var(--amber-soft); color: var(--amber); border-color: #ecd9a9; }
.paper .chip.green { background: var(--green-soft); color: var(--green); border-color: #c3dfd2; }
.paper .chip.maroon { background: #f6e9eb; color: var(--maroon); border-color: #ead0d4; }
.paper .chip.gray { background: var(--paper-2); color: var(--muted); border-color: var(--line); }
.paper .profile-head { background: var(--card); border-color: var(--line); color: var(--ink); box-shadow: 0 1px 2px rgba(60,40,20,.06); }
.paper .profile-head::before { opacity: .12; }
.paper .profile-head .bio { color: var(--ink-2); }
.paper .avatar { background: linear-gradient(135deg, var(--maroon), #8f3344); color: #fff; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--gold); }
.paper .lesson-list li a { color: var(--ink); } .paper .lesson-list li a:hover { background: #fff8ea; }
.paper .series-card { background: var(--card); border-color: var(--line); box-shadow: 0 1px 2px rgba(60,40,20,.06); }
.paper .series-card .desc { color: var(--ink-2); }
.paper .hint { color: var(--muted); }

/* النماذج */
.form { display: grid; gap: 1.05rem; }
.form .field { display: grid; gap: .35rem; }
.field > .lbl { font-weight: 600; font-size: .95rem; }
.hint { color: var(--mist); font-size: .86rem; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select { font: inherit; width: 100%; padding: .62rem .85rem; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(var(--gold-rgb), .25); }
textarea { resize: vertical; min-height: 6rem; }
input.tiny { width: 5.5rem; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.auth-card { max-width: 460px; margin: 3rem auto; }
.auth-card .card { padding: 2.2rem 2rem; }
.auth-card h1 { text-align: center; }
.auth-card .lead { text-align: center; color: var(--cream-2); margin-bottom: 1.4rem; }
.auth-card .field > .lbl { color: var(--cream-2); }
.auth-foot { text-align: center; margin: 1rem 0 0; }

/* الرسائل والشارات */
.flash, .alert { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--r-sm); border: 1px solid; margin: 0 0 1.1rem; font-size: .95rem; }
.flash.ok, .alert.ok { background: rgba(31,107,85,.35); border-color: rgba(120,200,170,.45); color: #d9f2e6; }
.flash.warn, .alert.warn { background: rgba(122,75,0,.35); border-color: rgba(240,200,120,.45); color: #ffe6b3; }
.paper .flash.ok, .paper .alert.ok { background: var(--green-soft); border-color: #c3dfd2; color: var(--green); }
.paper .flash.warn, .paper .alert.warn { background: var(--amber-soft); border-color: #ecd9a9; color: var(--amber); }
.error, .alert.error { background: rgba(155,34,34,.3); border: 1px solid rgba(255,140,140,.45); color: #ffd6d6; padding: .85rem 1rem; border-radius: var(--r-sm); margin: 0 0 1rem; }
.paper .error { background: var(--red-soft); border-color: #e7c3c3; color: var(--red); }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .12rem .62rem; border-radius: 999px; background: var(--paper-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--red-soft); color: var(--red); }
.badge.gold { background: var(--amber-soft); color: var(--amber); }

/* الجداول */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; margin: .5rem 0 1.5rem; color: var(--ink); box-shadow: 0 1px 2px rgba(60,40,20,.06); }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: .75rem .95rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
table.list th { background: var(--paper-2); color: var(--ink-2); font-weight: 600; font-size: .88rem; white-space: nowrap; }
table.list tbody tr:hover { background: #fff8ea; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.inactive td { color: var(--muted); }
table.list a { color: var(--maroon); }
td.nowrap, th.nowrap { white-space: nowrap; }
td.right { text-align: end; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .85rem; }

/* لوحات التحكم */
.dash { max-width: var(--w); margin: 0 auto; padding: 1.25rem 1.25rem 3rem; display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; align-items: start; }
.side { position: sticky; top: 76px; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); padding: .8rem; box-shadow: var(--shadow); }
.side .who { display: flex; align-items: center; gap: .7rem; padding: .5rem .5rem .9rem; border-bottom: 1px solid rgba(var(--gold-rgb), .25); margin-bottom: .5rem; }
.side .who .avatar { width: 42px; height: 42px; font-size: 1.15rem; box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px var(--gold); }
.side .who .n { font-weight: 600; line-height: 1.3; color: var(--cream); }
.side .who .r { color: var(--mist); font-size: .82rem; }
.side nav { display: grid; gap: .15rem; }
.side nav a { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: var(--r-sm); color: var(--cream-2); font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav a.active { background: linear-gradient(135deg, rgba(var(--gold-rgb), .28), rgba(var(--gold-rgb), .12)); color: var(--gold-l); border: 1px solid rgba(var(--gold-rgb), .35); }
.side nav .sep { height: 1px; background: rgba(var(--gold-rgb), .22); margin: .45rem .3rem; }
.dash-main { min-width: 0; background: var(--paper); border-radius: var(--r); padding: 1.5rem 1.6rem 2rem; border: 1px solid rgba(var(--gold-rgb), .35); box-shadow: var(--shadow); }
.empty { text-align: center; padding: 2.4rem 1rem; color: var(--muted); background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty .ic { width: 2.4rem; height: 2.4rem; color: var(--gold); margin-bottom: .4rem; }
.empty p { margin: 0 0 .9rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.linkbox { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; direction: ltr; text-align: left; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .85rem 1rem; word-break: break-all; color: var(--ink); }
.note-sm { margin-top: 1.5rem; font-size: .9rem; }

/* ---------- الاستجابة ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 1.5rem; }
  .hero .lead { margin-inline: auto; }
  .hero .cta { justify-content: center; }
  .feature { grid-template-columns: 1fr; }
  footer.site .wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .side { position: static; }
  .side .who { display: none; }
  .side nav { display: flex; overflow-x: auto; gap: .25rem; padding-bottom: .1rem; }
  .side nav a { white-space: nowrap; }
  .side nav .sep { display: none; }
}
@media (max-width: 600px) {
  .topbar .wrap { padding: .5rem .85rem; }
  .brand { font-size: 1.25rem; } .brand small { display: none; } .brand-mark { width: 30px; height: 30px; }
  .nav a span.txt { display: none; }
  .container, .dash { padding-inline: .85rem; }
  .card, .article { padding: 1.15rem 1rem; }
  .dash-main { padding: 1.1rem .9rem 1.5rem; }
  .profile-head { flex-direction: column; text-align: center; }
  .profile-head::before { width: 100%; inset: 0; mask-image: linear-gradient(180deg, #000, transparent); -webkit-mask-image: linear-gradient(180deg, #000, transparent); }
  footer.site .wrap { grid-template-columns: 1fr; }
  table.list th, table.list td { padding: .55rem .6rem; font-size: .92rem; }
  .shelf { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, footer.site, .side, .actions, .row-actions, .btn { display: none !important; }
  body { background: #fff; color: #000; } body::before { display: none; }
  .article, .card { border: 0; box-shadow: none; background: #fff; color: #000; }
  h1, h2, h3 { color: #000; }
}

/* ---------- المرحلة الثالثة: المشغّل والرفع والتسجيل ---------- */
.player { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 1rem 1.2rem; box-shadow: var(--shadow); margin: 1.2rem 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .7rem; }
.paper .player { background: var(--card); border-color: var(--line); box-shadow: 0 1px 2px rgba(60,40,20,.06); }
.player audio { width: 100%; }
.player .controls, .player [data-seek], .player .pfoot .speeds { display: none; }
.player.enhanced audio { display: none; }
.player.enhanced .controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .8rem; }
.player.enhanced [data-seek] { display: block; }
.player.enhanced .pfoot .speeds { display: inline-flex; }
.pbtn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(var(--gold-rgb), .5); background: rgba(255,255,255,.05); color: var(--gold-l); display: grid; place-items: center; cursor: pointer; font: inherit; }
.pbtn:hover { background: rgba(var(--gold-rgb), .15); }
.pbtn .ic { width: 1.4rem; height: 1.4rem; }
.pbtn.big { width: 66px; height: 66px; background: linear-gradient(135deg, var(--gold-l), var(--gold) 55%, var(--gold-d)); color: #1d1606; border: 0; box-shadow: 0 8px 22px -10px rgba(var(--gold-rgb), .9); }
.pbtn.big .ic { width: 1.8rem; height: 1.8rem; }
.pbtn.big .ic-pause { display: none; }
.player.playing .pbtn.big .ic-play { display: none; }
.player.playing .pbtn.big .ic-pause { display: block; }
.paper .pbtn { color: var(--maroon); border-color: var(--line-2); background: #fff; }
.player .time { font-variant-numeric: tabular-nums; color: var(--mist); min-width: 7.5rem; text-align: center; }
.paper .player .time { color: var(--muted); }
.player [data-seek] { width: 100%; min-width: 0; margin-inline: 0; box-sizing: border-box; accent-color: var(--gold); height: 6px; cursor: pointer; }
.player .pfoot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; }
.speeds { gap: .3rem; }
.speeds button { font: inherit; font-size: .85rem; padding: .2rem .6rem; border-radius: 999px; border: 1px solid rgba(var(--gold-rgb), .4); background: transparent; color: var(--cream-2); cursor: pointer; }
.speeds button.on { background: var(--gold); color: #1d1606; border-color: var(--gold); font-weight: 700; }
.paper .speeds button { color: var(--ink-2); border-color: var(--line-2); }
.upload { display: grid; gap: .6rem; }
.upload form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.file-pick { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem 1rem; border: 1px dashed var(--line-2); border-radius: var(--r-sm); background: #fff; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick:hover { border-color: var(--gold); color: var(--maroon); }
.bar { height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar .fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-l), var(--gold-d)); transition: width .2s ease; }
.hint.err { color: var(--red); }
.recorder { display: grid; gap: .6rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper-2); }
.recorder .rrow { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.recorder .rtimer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--maroon); min-width: 4rem; }
.recorder audio { width: 100%; }
.media-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; color: var(--muted); font-size: .9rem; align-items: center; }

/* ---------- المرحلة الرابعة: التفريغ والمراجعة والنص ---------- */
.tx { font-family: var(--font-heading); font-size: 1.28rem; line-height: 2.15; color: var(--cream); }
.tx p { margin: 0 0 1.1rem; text-align: justify; }
.tx .tm { display: inline-block; font-family: var(--font-ui); font-size: .72rem; color: var(--mist); background: rgba(255,255,255,.06); border: 1px solid rgba(var(--gold-rgb), .25); border-radius: 999px; padding: 0 .5rem; margin-inline-end: .5rem; vertical-align: middle; cursor: pointer; font-variant-numeric: tabular-nums; }
.tx .tm:hover { color: var(--gold-l); border-color: var(--gold); }
.tx .w { cursor: pointer; border-radius: 3px; }
.tx .w:hover { background: rgba(var(--gold-rgb), .14); }
.tx .q { color: #9fe3c6; }
.tx .h { color: #e8d8a6; }
.tx .b { color: #fff; font-weight: 700; }
.tx .ref { font-family: var(--font-ui); font-size: .72rem; color: var(--mist); margin-inline: .15rem .3rem; vertical-align: super; }
.tx-section { margin-top: 1.5rem; }
.tx-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; }
.tx-head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.tx-note { color: var(--mist); font-size: .85rem; border-top: 1px solid rgba(var(--gold-rgb), .2); padding-top: .8rem; margin-top: .5rem; }
.paper .tx { color: var(--ink); }
.paper .tx .tm { color: var(--muted); background: var(--paper-2); border-color: var(--line); }
.paper .tx .q { color: #1f6b55; }
.paper .tx .h { color: #7a5a24; }
.paper .tx .b { color: #000; }
.paper .tx .ref { color: var(--muted); }

/* المراجعة */
.tr-card { position: relative; }
.rv-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1rem; }
.rv-stats { color: var(--ink-2); font-size: .95rem; }
.rv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.rv-count { color: var(--muted); font-size: .9rem; min-width: 8rem; text-align: center; }
.rv-save { font-size: .85rem; color: var(--muted); }
.rv-save.dirty { color: var(--amber); } .rv-save.ok { color: var(--green); } .rv-save.err { color: var(--red); }
.rv-legend { font-size: .86rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; margin: .6rem 0 .2rem; }
.lg { display: inline-block; padding: 0 .5rem; border-radius: 4px; font-weight: 600; }
.lg.low, .rv-body .w.low { background: #fff1a8; color: #4a3a00; border-bottom: 2px solid #e2b400; }
.lg.fix, .rv-body .w.fix { background: #e9dcff; color: #3c1f6e; border-bottom: 2px solid #8a5ad6; }
/* تصحيح الذكاء الاصطناعي في لفظ حديث: لون وحده ليراجعه الشيخ */
.lg.fixh, .rv-body .w.fixh { background: #ffe1dc; color: #7a1c12; border-bottom: 2px solid #d9482f; }
.rv-body .w.edit { background: #d9f3e2; color: #0f4a2e; border-bottom: 2px solid #3f8f4f; }
.lg.dup, .rv-body .w.dup { border-bottom: 2px dotted #b45309; box-shadow: inset 0 -3px 0 #ffe4c4; }
.lg.q { color: #1f6b55; } .lg.h { color: #7a5a24; } .lg.b { color: #000; font-family: var(--font-heading); }
.rv-body { margin-top: .8rem; max-height: 70vh; overflow: auto; padding: .4rem .6rem .4rem 0; border-top: 1px solid var(--line); }
.rv-body .w.cur { outline: 2px solid var(--maroon); outline-offset: 1px; background: #fff; }
.rp { padding: .5rem 0 .2rem; border-bottom: 1px dashed var(--line); }
.rp:last-child { border-bottom: 0; }
.rp-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.rp-acts { display: inline-flex; gap: .2rem; opacity: .55; }
.rp:hover .rp-acts { opacity: 1; }
.rt { margin: .2rem 0 .6rem !important; }
/* عناوين الموضوعات في المراجعة: المعتمد، والمقترح من التقسيم الذكي (ينتظر قرار الشيخ)، وشريط المقترحات */
.rp-topic, .rp-sug, .rp-topic-edit { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: .15rem 0 .35rem; font-family: var(--font-ui); }
.rp-topic-t { font-weight: 700; color: var(--maroon); font-size: 1.05rem; padding-inline-start: .5rem; border-inline-start: 3px solid var(--maroon); }
.rp-sug { background: #fff8e6; border: 1px dashed #d9a520; border-radius: var(--r-sm); padding: .3rem .6rem; }
.rp-sug-l { font-size: .85rem; color: #8a6100; }
.rp-sug-t { font-weight: 700; color: #4a3a00; font-size: 1.02rem; flex: 1 1 12rem; }
.rp-topic-edit input { flex: 1 1 16rem; font-family: var(--font-heading); font-size: 1.05rem; }
.rv-sugbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .7rem 0 0; padding: .5rem .8rem; background: #fff8e6; border: 1px solid #f0d58a; border-radius: var(--r-sm); font-size: .92rem; color: #4a3a00; font-family: var(--font-ui); }
.rv-sugbar-t { flex: 1 1 16rem; }
.rv-sugbar[hidden] { display: none !important; }
/* شريط مراجعة الذكاء الاصطناعي، والتحرير متوقف في أثنائها */
.rv-aibar { background: #eef5fc; border-color: #a9c8e8; color: #12355b; }
.rv-hadbar { background: #fff0ed; border-color: #f0b3a8; color: #7a1c12; }
.rv-busy [data-rv-body], .rv-busy [data-rv-tools] { pointer-events: none; opacity: .55; }
.lg.sug { background: #fff8e6; color: #8a6100; border: 1px dashed #d9a520; }
.rv-ta { font-family: var(--font-heading); font-size: 1.15rem; line-height: 1.9; width: 100%; }
.rv-editor { position: sticky; bottom: .5rem; margin-top: .8rem; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .7rem .9rem; box-shadow: 0 10px 30px -10px rgba(0,0,0,.35); display: grid; gap: .45rem; z-index: 5; }
.rv-row { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.rv-row input { flex: 1 1 14rem; font-family: var(--font-heading); font-size: 1.15rem; }
.rv-foot { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.tr-wait .bar { margin-top: .8rem; }
.bar .fill.indeterminate { width: 35%; animation: slide 1.6s ease-in-out infinite alternate; }
@keyframes slide { from { margin-inline-start: 0; } to { margin-inline-start: 65%; } }
details.card summary { cursor: pointer; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary strong { display: inline-flex; align-items: center; gap: .4rem; }
details.card[open] summary { margin-bottom: .6rem; }
@media (max-width: 600px) {
  .tx { font-size: 1.12rem; line-height: 2; }
  .rv-body { max-height: none; }
}
@media print {
  .tx .tm, .tx-head .hint, .player { display: none !important; }
  .tx { color: #000; font-size: 13pt; line-height: 1.9; }
  .tx .q { color: #0a4a3a; } .tx .h { color: #4a3610; }
}
/* المرحلة 4ب: التفريغ من يوتيوب */
.yt-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .75rem 0; }
.yt-form input[type=url] { flex: 1 1 260px; min-width: 0; }
.yt-studio { margin-top: .75rem; }
.yt-studio summary { cursor: pointer; color: var(--maroon); font-weight: 600; }
.yt-studio ol { margin: .5rem 1.25rem 0 0; line-height: 1.9; }

/* ===== المرحلة الخامسة: القوالب (ورقة كتاب داخل الموقع) ===== */
:root { --read-scale: 1; }
.rd-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: flex-end; margin: .75rem 0; }
.rd-group { display: inline-flex; gap: .25rem; }
.tpl { --tp-main: #7a1f2b; --tp-accent: #9c7a2e; --tp-ink: #1e1a17; --tp-paper: #fffdf8; --tp-paper2: #f6efe0;
  background: var(--tp-paper); color: var(--tp-ink); border: 1px solid rgba(0,0,0,.08); border-radius: 10px; padding: 1.5rem 1.6rem 1.2rem; margin: 1rem 0;
  box-shadow: 0 10px 40px rgba(0,0,0,.25); position: relative; }
.tpl::before { content: ""; position: absolute; inset: .55rem; border: 2px solid var(--tp-accent); border-radius: 6px; pointer-events: none; opacity: .75; }
.tpl::after { content: ""; position: absolute; inset: .85rem; border: 1px solid var(--tp-accent); border-radius: 4px; pointer-events: none; opacity: .45; }
.theme-anabi { --tp-main: #7a1f2b; --tp-accent: #9c7a2e; --tp-paper: #fffdf8; }
.theme-zumurrudi { --tp-main: #0f5b4a; --tp-accent: #a78a3c; --tp-paper: #fdfcf7; }
.theme-kuhli { --tp-main: #1f3a5f; --tp-accent: #8e7a3a; --tp-paper: #fbfcfd; }
.tpl-khutba { --tp-paper: #fbf5e6; }
.tpl-head { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; font-family: var(--font-ui); font-size: .85rem; color: var(--tp-main); border-bottom: 1px solid var(--tp-accent); padding-bottom: .4rem; margin-bottom: 1rem; }
.tpl-head .sn { font-weight: 700; }
.tpl-body { position: relative; z-index: 1; font-family: var(--font-heading); font-size: calc(1.22rem * var(--read-scale)); line-height: 2.1; }
.tpl-foot { position: relative; z-index: 1; text-align: center; font-family: var(--font-ui); font-size: .78rem; color: var(--tp-main); border-top: 1px solid var(--tp-accent); padding-top: .4rem; margin-top: 1rem; }
.tpl h1, .tpl h2, .tpl h3 { color: var(--tp-main); font-family: var(--font-heading); }
.tpl h1 { font-size: calc(1.9rem * var(--read-scale)); text-align: center; margin: .2rem 0 .4rem; }
.tpl .tp { margin: 0 0 1rem; text-align: justify; }
.tpl-matn .tp { text-indent: 1.4em; }
.tpl-matn .tp.li, .tpl .tp:has(> .tm:first-child) { text-indent: 0; }
.tpl .tp.li { padding-inline-start: 1.6em; position: relative; text-indent: 0; }
.tpl .tp.li::before { content: "❖"; position: absolute; inset-inline-start: 0; color: var(--tp-accent); }
/* عنوان بند معلَّم: سطر وحده، غامق بلون القالب، وشرحه في الفقرة التي تليه */
.tpl .tp.li-head { font-weight: 700; color: var(--tp-main); margin-bottom: .15rem; }
.tpl .tm { display: inline-block; font-family: var(--font-ui); font-size: .68rem; color: var(--tp-accent); border: 1px solid var(--tp-accent); border-radius: 999px; padding: 0 .45rem; margin-inline-end: .45rem; vertical-align: middle; cursor: pointer; font-variant-numeric: tabular-nums; opacity: .85; }
.tpl .tm:hover { opacity: 1; background: var(--tp-paper2); }
.tpl .w { cursor: pointer; border-radius: 3px; }
.tpl .w:hover { background: rgba(0,0,0,.06); }
.tpl .q { color: var(--tp-main); font-weight: 700; }
.tpl .h { color: var(--tp-accent); font-weight: 600; }
.tpl .b { color: var(--tp-main); font-weight: 700; }
.tpl .fx { color: var(--tp-accent); }
.tpl .ref { font-family: var(--font-ui); font-size: .68rem; color: #777; margin-inline: .15rem .3rem; vertical-align: super; }
.tpl .lbl { font-weight: 700; }
.tpl .lbl-matn { color: var(--tp-main); }
.tpl .lbl-matn::before { content: "❖ "; color: var(--tp-accent); }
.tpl .lbl-sharh { color: var(--tp-ink); }
.tpl-khutba .tp { text-indent: 0; }
.tpl-khutba .tp.li::before { content: "◆"; }
/* الكتاب */
.book-cover { text-align: center; padding: 4rem 1rem 3rem; }
.book-cover h1 { font-size: calc(2.4rem * var(--read-scale)); margin: 0 0 1rem; }
.book-cover .by { font-size: calc(1.3rem * var(--read-scale)); color: var(--tp-ink); }
.book-cover .orn { color: var(--tp-accent); font-size: 1.6rem; margin: 1.2rem 0; }
.book-basmala { text-align: center; font-size: calc(2rem * var(--read-scale)); color: var(--tp-main); padding: 3rem 0; }
.book-toc ol { margin: 0; padding-inline-start: 1.4em; line-height: 2.2; }
.book-toc a { color: var(--tp-ink); text-decoration: none; }
.book-toc a:hover { color: var(--tp-main); }
.book-ch { break-before: page; page-break-before: always; }
.book-ch h2 { text-align: center; border-bottom: 2px solid var(--tp-accent); padding-bottom: .4rem; margin: 0 0 1.2rem; font-size: calc(1.6rem * var(--read-scale)); }
.tpl-part { margin: 1.5rem 0; }
/* الطباعة: الورقة وحدها */
@page { size: A4; margin: 18mm 16mm 20mm; }
@media print {
  body { background: #fff !important; color: #000; }
  .site-header, .site-footer, .side, .rd-bar, .crumbs, .meta, .yt-card, .player, .btn, .tx-note, .tx-head .hint, .print-hide, nav, .flash, .actions { display: none !important; }
  .article, .paper, main, .content { max-width: none !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; background: #fff !important; }
  .tpl { box-shadow: none; border: none; border-radius: 0; margin: 0; padding: 0 .4rem; background: #fff !important; color: #000; }
  .tpl::before, .tpl::after { display: none; }
  .tpl-body { font-size: 13.5pt; line-height: 1.95; }
  .tpl .tm, .tpl .ref { display: none; }
  .tpl .w:hover { background: none; }
  .tpl-head { position: fixed; top: 0; left: 0; right: 0; background: #fff; padding: 0 0 .2rem; margin: 0; font-size: 9.5pt; }
  .tpl-body { margin-top: 1.2rem; }
  .tpl-foot { display: none; }
  .book-cover, .book-basmala, .book-toc { break-after: page; page-break-after: always; }
  a[href]::after { content: none !important; }
}
.tpl-swatches { display: flex; gap: .6rem; flex-wrap: wrap; margin: .25rem 0 1rem; font-size: .85rem; }
.tpl-swatches .sw { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .5rem; border-radius: 999px; background: var(--tp-paper, #fff); color: var(--tp-main, #333); border: 1px solid var(--tp-accent, #ccc); }
.tpl-swatches .sw i { width: .8rem; height: .8rem; border-radius: 50%; background: var(--tp-main); display: inline-block; }
.yt-embed { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; border: 1px solid var(--glass-border); margin: 1.2rem 0 .4rem; background: #000; box-shadow: var(--shadow); }
.yt-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-out { text-align: center; font-size: .85rem; margin: 0 0 1rem; }
/* المنبر: سطر النسبة تحت عنوان الدرس، والصفحة البسيطة */
.source-note { color: var(--gold-l); font-family: var(--font-ui); font-size: .95rem; margin: -.4rem 0 .8rem; display: flex; align-items: center; gap: .4rem; }
.landing { text-align: center; padding: 3rem 1rem; }
.landing h1 { font-size: 2.4rem; margin: .6rem 0; }
.landing .lead { font-size: 1.15rem; }
.landing .cta { margin: 1.5rem 0; }

/* صفحات ثابتة (عن الموقع، الخصوصية) */
.article.static { padding-bottom: 2rem; }
.article.static .ornament { margin-bottom: .5rem; }
.article.static h1 { margin-bottom: .4rem; }
.article.static .lead { color: var(--cream-2); font-size: 1.1rem; margin-bottom: 1.4rem; }
.article.static section { margin-top: 1.4rem; }
.article.static h2 { font-size: 1.25rem; color: var(--gold); margin-bottom: .5rem; }
.article.static p { line-height: 1.95; margin-bottom: .6rem; }
.article.static .cta { margin-top: 1.8rem; }

/* ===== المرحلة السابعة: البحث، وعناوين الموضوعات، والمقطع المشارَك ===== */
.nav-search { display: inline-flex; align-items: center; gap: .35rem; }
.search-box { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .8rem 0 1.2rem; }
.search-box input[type=search] { flex: 1 1 260px; min-width: 0; font-size: 1.05rem; padding: .7rem 1rem; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.06); color: var(--cream); }
.search-box input[type=search]::placeholder { color: var(--mist); opacity: .85; }
.search-box input[type=search]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.search-box.compact { margin: 0; flex: 1 1 280px; }
.search-box.compact input[type=search] { font-size: .95rem; padding: .5rem .9rem; }
.search-section .search-box { margin-top: .2rem; }
.lesson-foot { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; margin-top: 1rem; }
.sr-sum { color: var(--cream-2); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.sr-list { display: grid; gap: 1rem; margin: 1rem 0 5rem; }
.sr-lesson { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.sr-lesson h2 { font-size: 1.2rem; margin: 0 0 .3rem; }
.sr-lesson h2 a { color: var(--gold-l); text-decoration: none; }
.sr-lesson h2 a:hover { text-decoration: underline; }
.sr-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; color: var(--mist); font-size: .88rem; margin-bottom: .5rem; }
.sr-hits { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.sr-hits li { display: flex; gap: .7rem; align-items: flex-start; border-top: 1px dashed rgba(var(--gold-rgb), .2); padding-top: .55rem; }
.sr-hits li:first-child { border-top: 0; padding-top: 0; }
.sr-play, .sr-time { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .3rem; font-family: var(--font-ui); font-size: .8rem; font-variant-numeric: tabular-nums; border-radius: 999px; padding: .25rem .65rem; border: 1px solid rgba(var(--gold-rgb), .45); color: var(--gold-l); background: rgba(var(--gold-rgb), .1); }
.sr-play { cursor: pointer; }
.sr-play:hover, .sr-play.on { background: var(--gold); color: #1d1607; }
.sr-play .ic { width: .9rem; height: .9rem; }
.sr-text { flex: 1 1 auto; min-width: 0; }
.sr-topic { color: var(--gold-l); font-size: .85rem; font-family: var(--font-ui); margin-bottom: .15rem; display: flex; align-items: center; gap: .3rem; }
.sr-snip { display: block; font-family: var(--font-heading); font-size: 1.12rem; line-height: 1.95; color: var(--cream); text-decoration: none; }
.sr-snip:hover { color: #fff; }
.sr-snip mark, .tpl .w.mk { background: rgba(var(--gold-rgb), .35); color: inherit; border-radius: 3px; padding: 0 .1em; }
.sr-refs { color: var(--mist); font-size: .82rem; font-family: var(--font-ui); }
.sr-more { margin: .6rem 0 0; font-size: .88rem; color: var(--mist); }
.sr-player { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: flex; gap: .7rem; align-items: center; justify-content: center; flex-wrap: wrap; padding: .6rem 1rem; background: rgba(10,31,30,.96); border-top: 1px solid var(--glass-border); box-shadow: 0 -8px 24px rgba(0,0,0,.35); }
.sr-player audio { display: none; }
.sr-now { color: var(--cream); font-size: .9rem; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* موضوعات الدرس فوق النص */
.topics-box { font-family: var(--font-ui); font-size: .95rem; line-height: 1.7; background: rgba(255,255,255,.05); border: 1px solid var(--glass-border); border-radius: var(--r-sm); padding: .8rem 1rem; margin: .6rem 0 .2rem; }
.topics-box h3 { margin: 0 0 .4rem; font-size: 1rem; color: var(--gold-l); display: flex; align-items: center; gap: .35rem; }
.topics-box ol { margin: 0; padding-inline-start: 1.4rem; display: grid; gap: .2rem; }
.topics-box a { color: var(--cream); text-decoration: none; }
.topics-box a:hover { color: var(--gold-l); text-decoration: underline; }
.topics-box .tm { margin-inline-start: .5rem; }
/* عنوان الموضوع داخل الورقة */
.tpl h3.topic { font-size: calc(1.3rem * var(--read-scale)); margin: 1.4rem 0 .5rem; padding-inline-start: .6rem; border-inline-start: 4px solid var(--tp-accent); line-height: 1.6; scroll-margin-top: 1rem; }
.tpl .tp, .tpl h3.topic, .tpl .w.mk { scroll-margin-top: 30vh; }
.tpl .w.mk { background: rgba(156, 122, 46, .28); }
/* المقطع المشارَك */
.excerpt { margin: 1rem 0 1.2rem; padding: 1rem 1.2rem; border-radius: var(--r); background: linear-gradient(160deg, rgba(var(--gold-rgb), .16), rgba(255,255,255,.04)); border: 1px solid rgba(var(--gold-rgb), .5); box-shadow: var(--shadow-gold); }
.ex-label { color: var(--gold-l); font-family: var(--font-ui); font-size: .85rem; display: flex; align-items: center; gap: .35rem; margin-bottom: .4rem; }
.excerpt blockquote { margin: 0 0 .7rem; font-family: var(--font-heading); font-size: 1.25rem; line-height: 2; color: #fff; }
.excerpt blockquote::before { content: "«"; color: var(--gold); } .excerpt blockquote::after { content: "»"; color: var(--gold); }
.ex-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
/* شريط المشاركة أسفل الصفحة */
.share-bar { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 2rem); padding: .55rem .8rem; border-radius: 999px; background: rgba(10,31,30,.97); border: 1px solid var(--gold); box-shadow: 0 12px 30px rgba(0,0,0,.45); font-family: var(--font-ui); }
.share-bar .sb-info, .share-bar .sb-msg { color: var(--cream-2); font-size: .85rem; padding-inline: .3rem; }
.share-bar .sb-msg { color: #bdf0d6; }
.share-bar .sb-close { min-width: 2rem; }
/* فهرس الموضوعات آخر الكتاب */
.topic-index { margin: 0; padding-inline-start: 1.4em; line-height: 2.1; }
.topic-index > li > a { font-weight: 700; color: var(--tp-main); text-decoration: none; }
.topic-index ol { margin: .1rem 0 .5rem; padding-inline-start: 1.6em; list-style: disc; }
.topic-index ol a { color: var(--tp-ink); text-decoration: none; }
.topic-index a:hover { text-decoration: underline; }
@media (max-width: 600px) {
  .share-bar { border-radius: var(--r-sm); bottom: .5rem; }
  .sr-hits li { flex-direction: column; gap: .3rem; }
}
@media print {
  .share-bar, .sr-player, .excerpt, .lesson-foot, .search-box, .nav-search { display: none !important; }
  .topics-box { border: 1px solid #999; background: #fff; color: #000; }
  .topics-box a { color: #000; }
  .topics-box .tm { display: none !important; }
  .tpl .w.mk { background: none; }
  .tpl h3.topic { break-after: avoid; page-break-after: avoid; }
  .book-index { break-before: page; page-break-before: always; }
}
.share-bar[hidden], .sr-player[hidden] { display: none !important; }

/* ---------- الملخص وأسئلة المراجعة ---------- */
.st-card h3 { margin: 1.2rem 0 .5rem; font-size: 1.05rem; }
.st-msg { min-height: 1.2em; margin: .4rem 0; color: var(--mist); font-size: .92rem; }
.st-msg.err { color: var(--red); }
.st-row { display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .5rem; }
.st-row textarea, .st-q textarea, .st-q input[type=text] { width: 100%; min-width: 0; font: inherit; }
.st-q { border: 1px solid rgba(255,255,255,.14); border-radius: var(--r-sm); padding: .8rem; margin: 0 0 .8rem; min-width: 0; }
.st-q legend { padding: 0 .4rem; color: var(--mist); font-size: .86rem; }
.st-opts { display: grid; gap: .4rem; margin: .5rem 0; }
.st-opt { display: flex; gap: .5rem; align-items: center; }
.st-opt input[type=radio] { flex: none; width: 1.1rem; height: 1.1rem; }
.st-foot { margin-top: 1.2rem; }
.study { margin-top: 2rem; }
.study-box { border: 1px solid rgba(255,255,255,.14); border-radius: var(--r-sm); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.study-box h2 { margin-top: 0; font-size: 1.2rem; }
.study-sum, .study-qs { padding-inline-start: 1.4rem; margin: 0; }
.study-sum li { margin-bottom: .6rem; line-height: 1.9; }
.study-q { margin-bottom: 1.3rem; position: relative; }
.study-q .q { margin: 0 0 .5rem; font-weight: 600; }
.study-q .opts { display: grid; gap: .4rem; }
.study-q .opts input { position: absolute; opacity: 0; pointer-events: none; }
.study-q .opts label { display: block; border: 1px solid rgba(255,255,255,.18); border-radius: var(--r-sm); padding: .5rem .8rem; cursor: pointer; }
.study-q .opts label:hover { border-color: rgba(255,255,255,.4); }
.study-q .opts input:focus-visible + label { outline: 2px solid var(--gold, #d8b25c); outline-offset: 2px; }
.study-q .opts input:checked + label.ok { background: rgba(31,107,85,.45); border-color: rgba(120,200,170,.7); }
.study-q .opts input:checked + label.ok::after { content: ' ✓ صواب'; font-weight: 600; }
.study-q .opts input:checked + label.no { background: rgba(140,40,40,.4); border-color: rgba(230,130,130,.7); }
.study-q .opts input:checked + label.no::after { content: ' ✗ خطأ'; font-weight: 600; }
.study-q .why { display: none; margin: .6rem 0 0; color: var(--mist); font-size: .95rem; }
.study-q:has(input:checked) .why { display: block; }
/* عدد في شارة بجانب العنوان (بدل الأقواس التي تنقلب في العنوان العربي) */
h1 .chip, h2 .chip { vertical-align: middle; font-family: var(--font-ui); font-weight: 500; margin-inline-start: .35rem; }

/* ---------- شريط مشاركة الدرس ---------- */
.lesson-share { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .8rem 0 1rem; }
.lesson-share .lbl { display: inline-flex; align-items: center; gap: .35rem; color: var(--mist); font-size: .9rem; margin-inline-end: .2rem; }
