:root {
  --bg: #0a1020;
  --bg2: #0d1426;
  --card: #111a2e;
  --card2: #152037;
  --line: #1f2b45;
  --line2: #2a3858;
  --text: #e8ebf2;
  --muted: #94a0b8;
  --gold: #f5a524;
  --gold2: #ffc24d;
  --gold-soft: rgba(245, 165, 36, .12);
  --gold-line: rgba(245, 165, 36, .38);
  --green: #34d399;
  --purple: #a78bfa;
  --blue: #38bdf8;
  --red: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --read-size: 18px;
  --bar-h: 64px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f4ee;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #faf7f0;
  --line: #e7e1d3;
  --line2: #d9d0bd;
  --text: #1c2233;
  --muted: #5d6679;
  --gold: #b7750b;
  --gold2: #d08a12;
  --gold-soft: rgba(183, 117, 11, .09);
  --gold-line: rgba(183, 117, 11, .35);
  --green: #0f9f6e;
  --purple: #7c3aed;
  --blue: #0284c7;
  --red: #d64545;
  --shadow: 0 8px 24px rgba(60, 50, 20, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 130px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Readex Pro", system-ui, sans-serif; line-height: 1.7; -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.c-green { color: var(--green) !important; } .c-purple { color: var(--purple) !important; } .c-blue { color: var(--blue) !important; }

#progress { position: fixed; top: 0; right: 0; height: 3px; width: 0; background: var(--gold); z-index: 70; transition: width .1s; }

/* ===== الرأس ===== */
header.top {
  position: sticky; top: 0; z-index: 50; height: var(--bar-h); background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top .row { display: flex; align-items: center; gap: 12px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; min-width: 0; }
.brand .logo { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--gold); }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1.3; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; height: 40px; width: min(420px, 40vw); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; }

/* ===== أزرار ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; white-space: nowrap; transition: .15s;
}
.btn:hover { border-color: var(--gold-line); }
.btn.gold { background: var(--gold); color: #1b1300; border-color: var(--gold); font-weight: 600; }
.btn.gold:hover { background: var(--gold2); }
.btn.gold-o { border-color: var(--gold-line); color: var(--gold); background: var(--gold-soft); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: var(--red); }
.btn.ok, .btn.done { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.btn.on { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); }
.icon-btn { width: 38px; padding: 0; justify-content: center; }
.icon-mini { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); }
.icon-mini:hover { border-color: var(--line); color: var(--text); }
.icon-mini.on { color: var(--gold); }
.icon-mini.on svg { fill: var(--gold); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 12px; border-radius: 8px; background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); font-weight: 500; }

/* ===== البطل ===== */
.hero {
  margin: 22px 0 26px; padding: 30px 32px; border-radius: 22px; border: 1px solid var(--line);
  background: radial-gradient(800px 300px at 90% -20%, var(--gold-soft), transparent 60%), linear-gradient(180deg, var(--card2), var(--card));
  box-shadow: var(--shadow);
}
.hero h1 { font-size: clamp(24px, 3.4vw, 38px); line-height: 1.35; margin: 14px 0 8px; }
.hero p { color: var(--muted); margin: 0; max-width: 900px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 22px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat b { display: block; font-size: 22px; color: var(--gold); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

/* ===== الرئيسية ===== */
.course { margin: 34px 0; }
.course-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.course-head h2 { margin: 0; font-size: 22px; }
.course-head p { margin: 0; color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.lcard { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); transition: transform .15s, border-color .15s; }
.lcard:hover { transform: translateY(-3px); border-color: var(--gold-line); }
.lcard h3 { margin: 0; font-size: 17px; line-height: 1.5; }
.lcard p { margin: 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.resume { font-size: 13px; color: var(--gold); font-weight: 600; }
.badge-read { color: var(--green); } .badge-new { color: var(--gold); }
.empty-box { text-align: center; color: var(--muted); padding: 50px 20px; background: var(--card); border: 1px dashed var(--line2); border-radius: 18px; margin: 10px 0 40px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty-box b { color: var(--text); font-size: 18px; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin-top: 16px; }
.crumbs a:hover { color: var(--gold); }

/* ===== شريط المحاضرة الثابت ===== */
.lecture-bar {
  position: sticky; top: var(--bar-h); z-index: 40; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 -16px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.ref-book { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.ref-book span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.ref-book svg { color: var(--gold); flex: none; }
.fontctl { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.fontctl .lbl { font-size: 12.5px; color: var(--muted); padding: 0 6px; }
.fbtn { border: 0; background: transparent; height: 28px; min-width: 34px; border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 12px; }
.fbtn.big { font-size: 15px; }
.fbtn:hover { background: var(--gold); color: #1b1300; }
.fontctl .pct { min-width: 44px; text-align: center; font-size: 12.5px; color: var(--gold); font-weight: 600; }
.study-btn { border-color: color-mix(in srgb, var(--purple) 50%, transparent); color: var(--purple); background: color-mix(in srgb, var(--purple) 10%, transparent); font-weight: 600; }
.toc-toggle { display: none; }

/* ===== التخطيط: الفهرس يميناً والشرح يساراً ===== */
.layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 60px; }
body.focus .layout { grid-template-columns: minmax(0, 860px); justify-content: center; }
body.focus aside.toc { display: none; }

aside.toc { position: sticky; top: calc(var(--bar-h) + 70px); max-height: calc(100vh - var(--bar-h) - 86px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; scrollbar-width: thin; }
.toc h4 { margin: 0 0 10px; font-size: 14.5px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.toc h4 span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.toc h4 svg { color: var(--gold); }
.toc h4 .muted { font-size: 12px; font-weight: 400; letter-spacing: 1px; }
.toc-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.toc-progress .bar { flex: 1; height: 6px; background: var(--bg2); border-radius: 6px; overflow: hidden; }
.toc-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width .3s; }
.toc-part { font-size: 12px; color: var(--gold); font-weight: 600; margin: 12px 4px 6px; padding-top: 10px; border-top: 1px dashed var(--line2); }
.toc-part:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.toc nav a { display: flex; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; margin-bottom: 4px; align-items: center; }
.toc nav a .n { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; background: var(--bg2); border: 1px solid var(--line); }
.toc nav a .t { display: flex; flex-direction: column; min-width: 0; }
.toc nav a b { font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.toc nav a small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc nav a:hover { background: var(--card2); }
.toc nav a.active { background: var(--gold-soft); border-color: var(--gold-line); }
.toc nav a.active .n { background: var(--gold); color: #1b1300; border-color: var(--gold); }
.toc nav a.active small { color: var(--gold); }
.toc nav a.done .n { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); font-size: 0; }
.toc nav a.done .n::after { content: "✓"; font-size: 13px; }
.toc nav a.done.active .n { color: #1b1300; }
.toc-tools { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.tool { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; cursor: pointer; font-size: 13.5px; font-weight: 600; border: 1px solid var(--line); background: var(--bg2); text-align: start; }
.tool em { font-style: normal; font-size: 11.5px; padding: 1px 8px; border-radius: 6px; background: var(--card2); color: var(--muted); }
.tool.purple { border-color: color-mix(in srgb, var(--purple) 45%, transparent); background: color-mix(in srgb, var(--purple) 10%, transparent); color: var(--purple); }
.tool.purple em { background: color-mix(in srgb, var(--purple) 25%, transparent); color: var(--purple); }
.tool.gold { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold); }
.tool.gold em { background: color-mix(in srgb, var(--gold) 25%, transparent); color: var(--gold); }
.tool.green { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: color-mix(in srgb, var(--green) 8%, transparent); color: var(--green); }
.tool.green em { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.tool:hover { filter: brightness(1.15); }
.bm-box:not(:empty) { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.bm-box h5 { margin: 0 0 6px; font-size: 13px; }
.bm-box a { display: block; font-size: 13px; padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.bm-box a:hover { background: var(--card2); color: var(--text); }

/* ===== المحتوى ===== */
.reader { min-width: 0; }
.part-banner {
  margin: 6px 0 18px; padding: 18px 22px; border-radius: 16px; border: 1px solid var(--gold-line);
  background: linear-gradient(90deg, var(--gold-soft), transparent);
}
.part-banner span { font-size: 12.5px; color: var(--gold); font-weight: 600; }
.part-banner h2 { margin: 2px 0 0; font-size: clamp(18px, 2.4vw, 23px); }
.section { background: var(--card); border: 1px solid var(--line); border-radius: 20px; margin-bottom: 22px; overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.section.active { border-color: var(--gold-line); box-shadow: 0 0 0 1px var(--gold-soft), var(--shadow); }
.section.plain { background: transparent; border: 0; }
.sec-head { padding: 20px 24px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--card2), var(--card)); }
.sec-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-meta .num { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-line); }
.section.active .sec-meta .num { background: var(--gold); color: #1b1300; }
.mins { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.sec-tools { display: inline-flex; gap: 6px; }
.sec-tools .btn svg { width: 14px; height: 14px; }
.sec-head h2 { margin: 12px 0 4px; font-size: clamp(19px, 2.4vw, 25px); line-height: 1.5; }
.sec-desc { margin: 0; color: var(--muted); font-size: 14.5px; }
.sec-body { padding: 20px 24px 6px; }

/* بطاقات الفقرات */
.pcard { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 20px 6px; margin-bottom: 14px; scroll-margin-top: 140px; }
.pcard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.pnum { font-size: 11.5px; letter-spacing: 1px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; font-weight: 600; }
.pcard-head h3 { margin: 0; font-size: calc(var(--read-size) - 1px); line-height: 1.5; color: var(--gold); flex: 1; }
.pcard-tools { display: inline-flex; gap: 2px; }

.prose { font-size: var(--read-size); line-height: 2; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { padding-inline-start: 24px; margin: 6px 0 12px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--gold); font-weight: 700; }
.prose strong { color: var(--gold); font-weight: 600; }
.prose blockquote { margin: 14px 0; padding: 12px 16px; border-radius: 12px; background: var(--gold-soft); border-inline-start: 4px solid var(--gold); }
.prose blockquote p { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 12px 0 16px; font-size: .88em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line2); padding: 8px 12px; text-align: start; vertical-align: top; }
.prose th { background: var(--gold-soft); color: var(--gold); font-weight: 600; white-space: nowrap; }
.prose tr:nth-child(even) td { background: color-mix(in srgb, var(--card2) 50%, transparent); }
.prose img { max-width: 100%; border-radius: 12px; }
.prose code { background: var(--card2); padding: 2px 6px; border-radius: 6px; font-size: .85em; }
mark { background: var(--gold); color: #1b1300; border-radius: 3px; padding: 0 2px; }

/* القاعدة الذهبية — صندوق بارز */
.golden {
  display: flex; gap: 14px; align-items: flex-start; margin: 14px 0 16px; padding: 16px 18px; border-radius: 16px;
  background: linear-gradient(135deg, #f5a524 0%, #ffcb5c 100%); color: #1b1300;
  box-shadow: 0 8px 24px rgba(245, 165, 36, .22); position: relative; overflow: hidden;
}
.golden::after { content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.golden-ic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #1b1300; color: #ffcb5c; }
.golden-lbl { font-size: 12.5px; font-weight: 700; letter-spacing: .3px; opacity: .8; }
.golden-tx { font-size: calc(var(--read-size) - 1px); font-weight: 600; line-height: 1.85; position: relative; z-index: 1; }
.golden-tx strong { color: #000; }
.note-box { display: flex; gap: 10px; margin: 12px 0 16px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--blue) 9%, transparent); border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent); font-size: calc(var(--read-size) - 3px); line-height: 1.9; }
.note-box b { color: var(--blue); }
.note-ic { color: var(--blue); padding-top: 3px; }

/* المفاهيم */
.concepts-h { display: flex; align-items: center; gap: 8px; color: var(--gold); font-weight: 600; font-size: 14.5px; margin: 20px 0 10px; }
.concepts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.concept { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; transition: border-color .15s; }
.concept:hover { border-color: var(--gold-line); }
.concept b { color: var(--gold); font-size: 14.5px; }
.concept p { margin: 6px 0 0; font-size: calc(var(--read-size) - 4px); line-height: 1.85; color: var(--text); opacity: .92; }

/* نقاط المذاكرة */
.points { margin: 18px 0 14px; border: 1px solid var(--line2); border-radius: 14px; background: var(--bg2); overflow: hidden; }
.points summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 600; font-size: 14.5px; }
.points summary::-webkit-details-marker { display: none; }
.points .ck { color: var(--green); display: grid; }
.points .chev { margin-inline-start: auto; width: 9px; height: 9px; border-inline-end: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: .2s; }
.points[open] .chev { transform: rotate(-135deg); }
.points ul { margin: 0; padding: 4px 34px 16px 16px; border-top: 1px solid var(--line); }
.points li { margin: 8px 0; font-size: calc(var(--read-size) - 3px); line-height: 1.85; }
.points li::marker { color: var(--gold); }
.mark-read { display: flex; justify-content: flex-end; padding: 4px 24px 18px; }
.lecture-nav { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }

/* ===== مركز المذاكرة ===== */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(3, 6, 14, .72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: min(980px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line2); border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); overflow: hidden; }
.modal-head, .modal-tabs, .modal-foot { flex: none; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head small { color: var(--muted); font-size: 12.5px; }
.modal-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--gold-soft); border: 1px solid var(--gold-line); flex: none; }
.icon-mini.x { font-size: 16px; }
.modal-tabs { display: flex; gap: 8px; padding: 12px 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.modal-tabs button { flex: none; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 7px 14px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.modal-tabs button.on { background: var(--gold); color: #1b1300; box-shadow: 0 6px 16px rgba(245, 165, 36, .3); }
.modal-body { padding: 22px; overflow: auto; flex: 1; }
.modal-foot { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; }
.fc-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); max-width: 620px; margin: 0 auto 12px; }
.gold-t { color: var(--gold); font-weight: 600; }
.fc { max-width: 620px; margin: 0 auto; min-height: 270px; display: flex; flex-direction: column; border: 1px solid var(--line2); border-radius: 18px; background: var(--bg2); padding: 18px 22px; cursor: pointer; transition: border-color .2s, transform .2s; }
.fc:hover { border-color: var(--gold-line); }
.fc.flipped { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.fc-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; }
.fc-row.foot { border-top: 1px solid var(--line); padding-top: 12px; }
.fc-main { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 16px 0; gap: 8px; }
.fc-main small { font-size: 11.5px; letter-spacing: 3px; color: var(--muted); }
.fc-main small.g { color: var(--green); }
.fc-q { font-size: 21px; font-weight: 700; line-height: 1.7; }
.fc-a { font-size: 17px; line-height: 1.9; color: color-mix(in srgb, var(--green) 70%, var(--text)); }
.fc-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; max-width: 620px; margin: 16px auto 0; }
.fc-extra { display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.qbar { flex: 0 0 45%; height: 6px; border-radius: 6px; background: var(--bg2); overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--gold); }
.q-card { max-width: 680px; margin: 0 auto; }
.q-card h4 { font-size: 19px; line-height: 1.7; margin: 0 0 14px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; margin: 8px 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg2); cursor: pointer; font-size: 15px; line-height: 1.7; }
.opt .ol { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--card2); font-weight: 700; color: var(--gold); }
.opt:hover:not(:disabled) { border-color: var(--gold-line); }
.opt.right { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.explain { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: 14.5px; line-height: 1.8; }
.explain.ok { background: color-mix(in srgb, var(--green) 10%, transparent); } .explain.ok b { color: var(--green); }
.explain.no { background: color-mix(in srgb, var(--red) 10%, transparent); } .explain.no b { color: var(--red); }
.quiz-end { text-align: center; max-width: 680px; margin: 0 auto; }
.score-ring { --p: 0; width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--bg2) 0); }
.score-ring b { width: 94px; height: 94px; border-radius: 50%; display: grid; place-items: center; background: var(--card); font-size: 24px; color: var(--gold); }
.review { text-align: start; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.rv { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; display: flex; flex-direction: column; }
.rv.ok { border-color: color-mix(in srgb, var(--green) 40%, transparent); } .rv.no { border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.rv span { color: var(--muted); font-size: 13px; }
/* الخريطة المفاهيمية */
.mindmap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.mm-root { padding: 14px 26px; border-radius: 16px; background: var(--gold); color: #1b1300; font-weight: 700; font-size: 17px; text-align: center; box-shadow: 0 10px 30px rgba(245, 165, 36, .3); position: relative; }
.mm-root::after { content: ""; position: absolute; bottom: -19px; left: 50%; width: 2px; height: 18px; background: var(--gold-line); }
.mm-group { width: 100%; border: 1px dashed var(--line2); border-radius: 18px; padding: 14px; }
.mm-part { text-align: center; color: var(--gold); font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.mm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.mm-node { text-align: start; background: var(--bg2); border: 1px solid var(--line2); border-top: 3px solid var(--gold); border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.mm-node:hover { border-color: var(--gold-line); transform: translateY(-2px); transition: .15s; }
.mm-h { display: flex; align-items: center; gap: 8px; }
.mm-h .num { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; background: var(--gold-soft); color: var(--gold); font-weight: 700; }
.mm-h b { font-size: 14px; line-height: 1.5; }
.mm-node ul { margin: 8px 0 0; padding-inline-start: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.mm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.mm-tags span { font-size: 11px; padding: 1px 8px; border-radius: 6px; background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
/* الملخص */
.sum-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.summary { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; line-height: 1.9; }
.sum-head { border-bottom: 2px solid var(--gold); padding-bottom: 10px; margin-bottom: 10px; }
.sum-head small { color: var(--gold); }
.sum-head h2 { margin: 4px 0; font-size: 21px; }
.sum-part { color: var(--gold); margin: 22px 0 6px; font-size: 16px; }
.sum-sec { margin: 14px 0; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.sum-sec h4 { margin: 0 0 4px; font-size: 15.5px; display: flex; gap: 8px; align-items: center; }
.sum-sec h4 .num { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; background: var(--gold); color: #1b1300; flex: none; }
.sum-sec p { margin: 0 0 4px; font-size: 13.5px; }
.sum-sec ul { margin: 4px 0; padding-inline-start: 22px; font-size: 14px; }
.sum-rule { font-size: 13.5px; background: var(--gold-soft); border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.sum-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sum-table th, .sum-table td { border: 1px solid var(--line2); padding: 6px 10px; text-align: start; vertical-align: top; }
.sum-table th { background: var(--gold-soft); color: var(--gold); }
.sum-table td:first-child { font-weight: 600; white-space: nowrap; }

/* ===== التذييل ونوافذ صغيرة ===== */
footer.foot { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: 13px; }
footer.foot .row { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--gold); color: #1b1300; padding: 10px 18px; border-radius: 10px; font-weight: 600; transition: .25s; z-index: 99; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.social { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sbtn { display: inline-flex; align-items: center; gap: 6px; height: 38px; min-width: 38px; justify-content: center; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 13.5px; transition: .15s; }
.sbtn.wa { color: #25d366; } .sbtn.tg { color: #2aabee; }
.sbtn.wa:hover { background: #25d366; color: #fff; border-color: #25d366; }
.sbtn.tg:hover { background: #2aabee; color: #fff; border-color: #2aabee; }
footer .sbtn span { color: var(--text); } footer .sbtn:hover span { color: #fff; }
.float-social { display: none; }
.share-pop { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 45; min-width: 170px; background: var(--card2); border: 1px solid var(--line2); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.share-pop a, .share-pop button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; font-size: 14px; text-align: start; width: 100%; }
.share-pop a:hover, .share-pop button:hover { background: var(--bg2); }
.share-pop .wa svg { color: #25d366; } .share-pop .tg svg { color: #2aabee; } .share-pop button svg { color: var(--gold); }

/* ===== الجوال ===== */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  aside.toc { display: none; position: fixed; inset: calc(var(--bar-h) + 56px) 12px auto 12px; max-height: calc(100vh - var(--bar-h) - 72px); z-index: 45; box-shadow: var(--shadow); }
  aside.toc.open { display: block; }
  .toc-toggle { display: inline-flex; }
  .ref-book { display: none; }
}
@media (max-width: 720px) {
  :root { --bar-h: 58px; }
  .search { width: auto; flex: 1; min-width: 0; }
  .top .spacer { display: none; }
  .brand { font-size: 15px; }
  .brand .logo { width: 34px; height: 34px; }
  .hide-sm { display: none !important; }
  .hero { padding: 20px; border-radius: 18px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 18px; }
  .lecture-bar { gap: 6px; flex-wrap: nowrap; }
  .lecture-bar .btn.sm { padding: 0 8px; }
  .fontctl .lbl { display: none; }
  .study-btn { padding: 0 8px; }
  .sec-head { padding: 16px; }
  .sec-tools { width: 100%; justify-content: flex-end; }
  .sec-body { padding: 14px 12px 4px; }
  .pcard { padding: 12px 14px 4px; }
  .prose { font-size: calc(var(--read-size) - 1px); }
  .golden { padding: 14px; gap: 10px; }
  .golden-ic { width: 36px; height: 36px; }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; height: 100%; border-radius: 0; }
  .modal-head { padding: 14px; } .modal-head small { display: none; }
  .modal-body { padding: 14px; }
  .fc-q { font-size: 18px; }
  .float-social { display: flex; flex-direction: column; gap: 10px; position: fixed; bottom: 18px; left: 16px; z-index: 44; }
  .float-social .sbtn { width: 48px; height: 48px; border-radius: 50%; box-shadow: var(--shadow); padding: 0; border: 0; color: #fff; }
  .float-social .sbtn svg { width: 24px; height: 24px; }
  .float-social .sbtn.wa { background: #25d366; } .float-social .sbtn.tg { background: #2aabee; }
  body.modal-open .float-social { display: none; }
}

/* ===== الطباعة ===== */
@media print {
  :root, :root[data-theme] { --bg: #fff; --bg2: #fff; --card: #fff; --card2: #f7f3ea; --line: #ddd; --line2: #ccc; --text: #111; --muted: #555; --gold: #9a6400; --gold-soft: #faf3e3; --gold-line: #e2c995; color-scheme: light; }
  body { background: #fff !important; color: #111; }
  header.top, aside.toc, .sec-tools, .pcard-tools, .mark-read, #progress, footer, .lecture-bar, .float-social, .share-pop, .toast, .crumbs, .hero-actions, .lecture-nav, .modal, .stats { display: none !important; }
  .layout { display: block; }
  .hero { box-shadow: none; background: #fff; border: 0; border-bottom: 2px solid var(--gold); border-radius: 0; padding: 0 0 10px; margin: 0 0 14px; }
  .section, .section.active { border: 0; box-shadow: none; border-radius: 0; margin-bottom: 8px; }
  .sec-head { background: none; padding: 8px 0; break-after: avoid; }
  .sec-body { padding: 6px 0; }
  .pcard { border: 0; padding: 0; background: none; break-inside: auto; }
  .prose { font-size: 12.5pt; line-height: 1.85; }
  .golden { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
  .concept, .points, .note-box { break-inside: avoid; }
  .points ul { display: block !important; }
  body.print-summary > *:not(.modal) { display: none !important; }
  body.print-summary * { visibility: hidden; }
  body.print-summary .modal { display: block !important; position: absolute; inset: 0; background: none; padding: 0; }
  body.print-summary .modal-card { box-shadow: none; border: 0; max-height: none; overflow: visible; }
  body.print-summary .modal-body { overflow: visible; padding: 0; }
  body.print-summary #sumPrint, body.print-summary #sumPrint * { visibility: visible; }
  body.print-summary #sumPrint { position: absolute; top: 0; left: 0; right: 0; border: 0; padding: 0; background: #fff; }
  body.print-summary .modal-head, body.print-summary .modal-tabs, body.print-summary .modal-foot, body.print-summary .sum-actions { display: none; }
  @page { margin: 15mm; }
}

/* ===== التوقيع ===== */
.sig-ar { font-family: Arial, "Arial Unicode MS", Tahoma, "Readex Pro", sans-serif; font-weight: 700; color: var(--gold); }
.sig-en { font-family: "Great Vibes", "Segoe Script", cursive; color: var(--text); direction: ltr; unicode-bidi: isolate; }
.by-top { display: flex; align-items: center; gap: 10px; padding-inline-start: 14px; border-inline-start: 1px solid var(--line2); line-height: 1.2; white-space: nowrap; }
.by-top .sig-ar { font-size: 15px; }
.by-top .sig-en { font-size: 22px; opacity: .85; }
.by-top .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gold-line); }
.foot-sig { display: flex; align-items: center; gap: 12px; }
.foot-sig .mono { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, #ffd57a, #f5a524 55%, #c98208); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--gold-line); }
.foot-sig .mono span { font-family: Arial, Tahoma, sans-serif; font-weight: 700; font-size: 20px; color: #1b1300; }
.foot-sig .names { display: flex; align-items: center; gap: 10px; }
.foot-sig .sig-ar { font-size: 17px; }
.foot-sig .sig-en { font-size: 24px; }
.foot-sig .sep { color: var(--line2); }
.foot-sig small { display: block; color: var(--muted); font-size: 12px; }
.foot-sig small a:hover { color: var(--gold); }
.foot-end { display: inline-flex; align-items: center; gap: 10px; }
.admin-link { opacity: .45; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; }
.admin-link:hover { opacity: 1; color: var(--gold); background: var(--card); }
.seal { text-align: center; padding: 28px 20px 24px; margin: 6px 0 22px; border: 1px solid var(--line); border-radius: 20px; background: radial-gradient(500px 160px at 50% 0%, var(--gold-soft), transparent 70%), var(--card); }
.seal .orn { display: flex; align-items: center; gap: 14px; justify-content: center; color: var(--gold); }
.seal .orn::before, .seal .orn::after { content: ""; height: 1px; width: 110px; background: linear-gradient(90deg, transparent, var(--gold-line)); }
.seal .orn::after { transform: scaleX(-1); }
.seal .sig-ar { font-size: 30px; margin-top: 10px; line-height: 1.4; }
.seal .sig-en { font-size: 40px; opacity: .85; line-height: 1.3; }
.seal p { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
@media print { .by-top, .foot-sig .mono { display: none !important; } .seal { display: block !important; border: 0; background: none; break-inside: avoid; } }
