/* ═══════════════════════════════════════════════════════════════════
   مسارات الماهر — نظام التصميم
   هوية بوابة القبول والتسجيل: كحلي ‎#202649 وذهبي ‎#d8b078 على أرضٍ دافئة،
   وخطّ «ثمانية». نسقٌ فاتحٌ واحد — لا يتبع نسق المتصفّح، كالبوابة.
   الذهبيّ لمسار الحفظ، والأزرق الهادئ لمسار التثبيت: يُعرف كلٌّ بلونه.
   ═══════════════════════════════════════════════════════════════════ */

@font-face { font-family: Thmanyah; font-weight: 500; font-display: swap;
  src: url("/assets/fonts/thmanyah-500.woff2") format("woff2"); }
@font-face { font-family: Thmanyah; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/thmanyah-700.woff2") format("woff2"); }

:root {
  --navy: #202649; --navy-800: #262d56; --navy-900: #161b38;
  --gold: #d8b078; --gold-600: #8a5f28; --gold-100: #f6eedb; --gold-50: #fbf6ec;
  --blue: #93a6c9; --blue-600: #4f6390; --blue-100: #e7ecf6; --blue-50: #f3f6fb;

  --bg: #f6f2ea; --surface: #ffffff; --surface-2: #f3efe4;
  --ink: #1e2445; --ink-2: #3a4063; --muted: #666b82;
  --line: #e6dfd0; --line-2: #d6cbb3;

  --ok: #1e7d3c; --ok-100: #e7f4ec;
  --no: #b3372f; --no-100: #fbeceb;

  --r-xl: 22px; --r-lg: 16px; --r-md: 12px; --r-sm: 8px;
  --shadow: 0 1px 2px rgba(32,38,73,.05), 0 12px 32px -18px rgba(32,38,73,.30);
  --shadow-lg: 0 2px 4px rgba(32,38,73,.06), 0 24px 48px -24px rgba(32,38,73,.38);
  --measure: 40rem;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Thmanyah, "SF Arabic", "Geeza Pro", Tahoma, sans-serif;
  font-weight: 500; font-size: 18px; line-height: 1.85;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
@media (min-width: 720px) { body { font-size: 18.5px; } }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.35; text-wrap: balance; color: var(--ink); }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: var(--gold-600); text-decoration: underline; text-decoration-color: var(--gold);
  text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
a:hover { color: var(--ink); }
b, strong { font-weight: 700; color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold-600); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────────── الشريط العلوي ───────────── */
.top {
  position: sticky; top: 0; z-index: 30; background: rgba(246,242,234,.92);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1120px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 30px; height: auto; flex: none; }
.brand b { font-size: 1.02rem; white-space: nowrap; }
.brand span { font-size: .78rem; color: var(--muted); display: block; line-height: 1.3; white-space: nowrap; }
.top .crumb { margin-inline-start: auto; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.top .crumb a { color: var(--ink-2); text-decoration: none; border: 1px solid var(--line-2);
  border-radius: 999px; padding: 6px 15px; background: var(--surface);
  display: inline-flex; align-items: center; min-height: 40px; }   /* هدفُ لمسٍ يكفي الإصبع */
.top .crumb a:hover { border-color: var(--navy); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 18px; }

/* ───────────── الصفحة الأولى ───────────── */
.hero { position: relative; overflow: hidden; background: var(--navy);
  color: #fff; border-radius: 0 0 var(--r-xl) var(--r-xl); }
.hero::before {                      /* نقشُ الخاتم الثماني بالذهبي الخافت */
  content: ""; position: absolute; inset: 0; opacity: .10;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23d8b078' stroke-width='1.2'%3E%3Crect x='21' y='21' width='30' height='30'/%3E%3Crect x='21' y='21' width='30' height='30' transform='rotate(45 36 36)'/%3E%3Ccircle cx='36' cy='36' r='6'/%3E%3Cpath d='M0 36h15M57 36h15M36 0v15M36 57v15'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 72px 72px;
}
.hero-in { position: relative; max-width: 880px; margin: 0 auto; padding: 44px 22px 58px; text-align: center; }
.hero img.mark { width: 58px; height: auto; margin-bottom: 14px; filter: drop-shadow(0 6px 18px rgba(0,0,0,.25)); }
.hero .kicker { color: var(--gold); font-size: .86rem; letter-spacing: .06em; }
.hero h1 { color: #fff; font-size: clamp(2.1rem, 7vw, 3.3rem); margin: 6px 0 12px; }
.hero p { color: #d9dcea; max-width: 34rem; margin: 0 auto; font-size: 1.04rem; }

.choices { max-width: 960px; margin: -34px auto 0; padding: 0 18px 24px; position: relative;
  display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .choices { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
.choice {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 22px 22px 20px; box-shadow: var(--shadow); position: relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.choice:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gold); color: var(--ink); }
.choice .ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: var(--gold-100); color: var(--gold-600); }
.choice.c2 .ico { background: var(--navy); color: var(--gold); }
.choice.c3 .ico { background: var(--blue-100); color: var(--blue-600); }
.choice .ico svg { width: 28px; height: 28px; }
.choice .who { font-size: .84rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.choice .who i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); color: #fff; font-size: .72rem; font-weight: 700; }
.choice h2 { font-size: 1.42rem; }
.choice p { color: var(--ink-2); font-size: .95rem; margin: 0; line-height: 1.75; }
.choice ul { margin: 2px 0 0; padding: 0; list-style: none; font-size: .88rem; color: var(--muted); }
.choice ul li { padding-inline-start: 18px; position: relative; line-height: 1.8; }
.choice ul li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .8em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.choice .go { margin-top: auto; padding-top: 8px; font-weight: 700; color: var(--navy); font-size: .95rem;
  display: flex; align-items: center; gap: 8px; }
.choice .go::after { content: "←"; transition: transform .18s ease; }
.choice:hover .go::after { transform: translateX(-4px); }

.home-note { max-width: 960px; margin: 10px auto 60px; padding: 0 18px; text-align: center;
  color: var(--muted); font-size: .9rem; }

/* ───────────── صفحة المسار (فهرس الدروس) ───────────── */
.path-head { padding: 34px 0 10px; }
.path-head .kicker { color: var(--gold-600); font-size: .86rem; }
.path-head h1 { font-size: clamp(1.9rem, 6vw, 2.7rem); margin: 4px 0 10px; }
.path-head p { color: var(--ink-2); max-width: var(--measure); font-size: 1.04rem; }
.lessons { list-style: none; margin: 22px 0 60px; padding: 0; display: grid; gap: 10px; max-width: 46rem; }
.lessons a { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 14px;
  text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 16px; transition: border-color .15s, transform .15s; }
.lessons a:hover { border-color: var(--gold); transform: translateX(-2px); }
.lessons .n { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-100); color: var(--gold-600); font-weight: 700; }
.lessons a.done .n { background: var(--navy); color: #fff; }
.lessons .t { font-weight: 700; line-height: 1.45; }
.lessons .d { display: block; font-weight: 500; font-size: .86rem; color: var(--muted); line-height: 1.6; }
.lessons .m { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.start-btn { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; padding: 13px 24px;
  border-radius: 999px; background: var(--navy); color: #fff; text-decoration: none; font-weight: 700; }
.start-btn:hover { background: var(--navy-900); color: #fff; }
.start-btn::after { content: "←"; }

/* ───────────── صفحة الدرس ───────────── */
.lesson { max-width: 46rem; margin: 0 auto; padding: 0 18px 40px; }
.progress { display: flex; gap: 4px; margin: 18px 0 6px; }
.progress a { flex: 1; height: 6px; border-radius: 6px; background: var(--line); }
.progress a.done { background: var(--gold); }
.progress a.here { background: var(--navy); }
.lmeta { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: .84rem; color: var(--muted); margin-bottom: 22px; }
.lhead .tags { display: flex; gap: 6px; margin-bottom: 4px; }
.lhead .ln { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-600); font-size: .9rem; font-weight: 700; }
.lhead h1 { font-size: clamp(1.8rem, 6.4vw, 2.5rem); margin: 6px 0 14px; letter-spacing: -.01em; }
.learn { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 18px; margin: 0 0 26px; font-size: .95rem; }
.learn b { display: block; color: var(--gold-600); font-size: .84rem; margin-bottom: 4px; }
.learn ul { margin: 0; padding-inline-start: 1.2em; }
.learn li { margin: 2px 0; }

.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 1.32rem; margin-top: 1.9em; padding-bottom: 6px; border-bottom: 2px solid var(--gold); display: inline-block; }
.prose h3 { font-size: 1.1rem; margin-top: 1.5em; color: var(--gold-600); }
.prose ul, .prose ol { padding-inline-start: 1.3em; margin: 0; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--gold-600); font-weight: 700; }

.hl { background: linear-gradient(transparent 58%, var(--gold-100) 58%); padding: 0 2px; font-weight: 700; color: var(--ink); }
.big { font-size: 1.12em; font-weight: 700; color: var(--gold-600); }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 10px; border-radius: 999px; vertical-align: 2px; }
.tag.h { background: var(--gold-100); color: var(--gold-600); }
.tag.t { background: var(--blue-100); color: var(--blue-600); }

/* القاعدة: جملةٌ واحدة في إطارٍ ذهبي — من وقف عندها أخذ أهمّ ما في الدرس */
.rule { border: 2px solid var(--gold); background: var(--gold-50); border-radius: var(--r-lg);
  padding: 14px 18px; margin: 0 0 26px; font-weight: 700; font-size: 1.08rem; line-height: 1.75; color: var(--ink); }
.rule::before { content: "القاعدة"; display: block; font-size: .78rem; color: var(--gold-600); margin-bottom: 2px; }
.rule > div + div { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--gold); }
.rule .tag { margin-inline-end: 6px; }

/* انتبه: الخطأ الشائع ثم صوابه — تفنيدُ الخطأ صراحةً أثبتُ من شرح الصواب وحده */
.watch { margin-top: 28px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.watch > b { display: block; background: var(--surface-2); padding: 8px 16px; font-size: .9rem; color: var(--no); }
.watch p { margin: 0; padding: 10px 16px 10px; display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.watch p + p { border-top: 1px solid var(--line); }
.watch p::before { font-weight: 700; }
.watch p.x::before { content: "✗"; color: var(--no); }
.watch p.v::before { content: "✓"; color: var(--ok); }

/* تذكّر: سطرٌ يبقى في الذهن */
.remember { margin-top: 14px; background: var(--navy); color: #eceef6; border-radius: var(--r-lg);
  padding: 13px 18px; font-weight: 700; line-height: 1.75; }
.remember::before { content: "تذكّر"; display: block; font-size: .78rem; color: var(--gold); font-weight: 700; }
.remember > div + div { margin-top: 4px; }

/* ما يخصّ المسار الآخر: سطرٌ ظاهر يذكر الفرق، فلا تُخفى قاعدة */
[data-o] { display: none; }
html[data-track="hifz"] [data-o="tath"], html[data-track="tath"] [data-o="hifz"] { display: block; }
.other { font-size: .92rem; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line-2);
  border-radius: var(--r-md); padding: 8px 14px; }
.other::before { content: "↔ "; color: var(--gold-600); font-weight: 700; }

/* تعريفُ المصطلح قبل استعماله */
.terms { display: grid; gap: 8px; }
.terms div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; }
.terms dt { font-weight: 700; color: var(--ink); }
.terms dd { margin: 0; color: var(--ink-2); font-size: .96rem; }

/* قائمتان متقابلتان: «تجتاز إذا اجتمعت» و«لا تجتاز إذا وقع واحد» */
.twolists { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .twolists { grid-template-columns: 1fr 1fr; } }
.twolists > div { border-radius: var(--r-lg); padding: 14px 16px; border: 1px solid; }
.twolists .yes { background: var(--ok-100); border-color: #b9dcc5; }
.twolists .no { background: var(--no-100); border-color: #efcdca; }
.twolists b { display: block; margin-bottom: 6px; }
.twolists .yes b { color: var(--ok); } .twolists .no b { color: var(--no); }
.twolists ul { margin: 0; padding: 0; list-style: none; }
.twolists li { position: relative; padding-inline-start: 26px; margin: 5px 0; line-height: 1.65; }
.twolists li::before { position: absolute; inset-inline-start: 0; font-weight: 700; }
.twolists .yes li::before { content: "✓"; color: var(--ok); }
.twolists .no li::before { content: "✗"; color: var(--no); }
.twolists .join { font-size: .84rem; color: var(--muted); margin-top: 6px; }

/* أسبوعُ التسميع: سبعةُ أيامٍ وجلستان */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week span { text-align: center; border-radius: 8px; padding: 6px 0; font-weight: 700; font-size: .84rem;
  background: var(--surface); border: 1px solid var(--line); line-height: 1.35; }
.week span small { display: block; font-weight: 500; font-size: .66rem; color: var(--muted); }
.week span.a { background: var(--gold-100); border-color: var(--gold); }
.week span.b { background: var(--blue-100); border-color: var(--blue); }
.weekcap { display: grid; grid-template-columns: 4fr 3fr; gap: 4px; margin-top: 4px; font-size: .8rem; text-align: center; }
.weekcap span { border-radius: 8px; padding: 4px; }
.weekcap .a { background: var(--gold); color: #1e2340; font-weight: 700; }
.weekcap .b { background: var(--blue); color: #1e2340; font-weight: 700; }

/* بطاقاتٌ وتنبيهات */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.note { border-inline-start: 4px solid var(--gold); background: var(--gold-50); border-radius: var(--r-md);
  padding: 14px 18px; font-size: .98rem; }
.note > b:first-child { color: var(--gold-600); }
.warn { border-inline-start-color: var(--no); background: var(--no-100); }
.warn > b:first-child { color: var(--no); }
.ok { border-inline-start-color: var(--ok); background: var(--ok-100); }
.ok > b:first-child { color: var(--ok); }

/* مقارنة المسارين جنبًا إلى جنب */
.compare { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 600px) { .compare { grid-template-columns: 1fr 1fr; } }
.side { border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.side > header { padding: 10px 16px; font-weight: 700; }
.side.h > header { background: var(--gold); color: #1e2340; }
.side.t > header { background: var(--blue); color: #1e2340; }
.side .body { padding: 14px 16px; font-size: .96rem; }
.side .body .k { font-size: 1.9rem; font-weight: 700; line-height: 1.2; display: block; color: var(--ink); }
.side .body .ks { font-size: .86rem; color: var(--muted); }
.side dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.side dt { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.side dd { margin: 0; }

/* أرقامٌ كبيرة تُحفظ بالعين */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.stat .v { font-size: 1.85rem; font-weight: 700; line-height: 1.15; color: var(--navy); display: block; }
.stat .l { font-size: .86rem; color: var(--muted); line-height: 1.5; display: block; }
.stat.h { border-top: 4px solid var(--gold); }
.stat.t { border-top: 4px solid var(--blue); }

/* خطواتٌ مرقّمة بخطٍّ يصلها */
.flow { list-style: none; margin: 0; padding: 0; position: relative; }
.flow::before { content: ""; position: absolute; top: 20px; bottom: 20px; inset-inline-start: 19px;
  width: 2px; background: var(--line-2); }
.flow > li { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding: 8px 0; }
.flow .fn { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
  background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700;
  box-shadow: 0 0 0 5px var(--bg); }
.flow .fc { padding-top: 5px; }
.flow .fc b { display: block; font-size: 1.05rem; }
.flow .fc span { display: block; color: var(--ink-2); font-size: .95rem; line-height: 1.75; }
.flow .fc em { display: inline-block; font-style: normal; font-size: .8rem; font-weight: 700;
  background: var(--blue-100); color: var(--blue-600); border-radius: 999px; padding: 0 10px; margin-top: 4px; }
.flow > li.key .fn { background: var(--gold); color: var(--navy); }

/* رحلة: محطّاتٌ تلتفّ */
.journey { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; counter-reset: st; }
.stop { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.stop i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-style: normal;
  background: var(--gold); color: var(--navy); font-size: .74rem; font-weight: 700; margin-bottom: 6px; }
.stop b { display: block; font-size: .96rem; line-height: 1.45; }
.stop span { display: block; font-size: .8rem; color: var(--muted); line-height: 1.55; margin-top: 2px; }
.stop.key { background: var(--navy); border-color: var(--navy); }
.stop.key b { color: #fff; } .stop.key span { color: #cfd3e4; }
.stop.fin { background: var(--ok-100); border-color: var(--ok); }
.stop.fin b { color: var(--ok); }

/* شريط الأوجه: نافذة الربط تُرى لا تُتخيَّل */
.win { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 14px 12px; }
.win + .win { margin-top: 10px; }
.win .wh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.win .wh b { font-size: 1rem; }
.win .wh span { font-size: .88rem; color: var(--ink-2); }
.cells { display: flex; flex-wrap: wrap; gap: 3px; }
.cells i { width: 27px; height: 27px; border-radius: 6px; display: grid; place-items: center; font-style: normal;
  font-size: .64rem; font-weight: 700; font-variant-numeric: tabular-nums;
  border: 1px solid #ece7db; background: #fff; color: #cbc5b6; }
.cells i.r { background: var(--gold); border-color: var(--gold-600); color: #1e2340; }
.cells i.n { background: var(--navy); border-color: var(--navy); color: #fff; }
.cells i.d { background: var(--surface-2); border: 1px dashed var(--line-2); color: var(--muted); }
.cells i.t { background: var(--blue-100); border-color: var(--blue); color: var(--blue-600); }
.cells i.h { background: var(--gold-100); border-color: var(--gold); color: var(--gold-600); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .84rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* أجزاءٌ مرقّمة بترتيب العمل */
.juzstrip { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
@media (max-width: 420px) { .juzstrip { grid-template-columns: repeat(6, 1fr); } }
.juzstrip span { border-radius: 8px; padding: 4px 0 5px; text-align: center; font-weight: 700; font-size: .86rem;
  border: 1px solid var(--line); background: var(--surface); line-height: 1.2; }
.juzstrip span small { display: block; font-size: .64rem; font-weight: 500; color: var(--muted); }
.juzstrip span.t { background: var(--blue-100); border-color: var(--blue); color: var(--blue-600); }
.juzstrip span.h { background: var(--gold-100); border-color: var(--gold); color: var(--gold-600); }
.order { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.order span { padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: .86rem; border: 1px solid var(--line); background: var(--surface); }
.order span.t { background: var(--blue-100); border-color: var(--blue); color: var(--blue-600); }
.order span.h { background: var(--gold-100); border-color: var(--gold); color: var(--gold-600); }
.order em { font-style: normal; color: var(--muted); font-size: .86rem; }

/* شريط المصحف: من أين تبدأ */
.mushaf { display: flex; gap: 8px; flex-wrap: wrap; }
.mseg { flex: 1 1 220px; border-radius: var(--r-md); padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); }
.mseg.h { background: var(--gold-100); border-color: var(--gold); }
.mseg.t { background: var(--blue-100); border-color: var(--blue); }
.mseg i { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--navy); color: #fff; font-style: normal; font-size: .74rem; font-weight: 700; margin-inline-end: 6px; }
.mseg b { font-size: 1rem; }
.mseg span { display: block; font-size: .84rem; color: var(--muted); margin-top: 2px; }

/* مثالٌ محلول */
.worked { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.worked > header { background: var(--surface-2); padding: 9px 16px; font-weight: 700; font-size: .92rem; color: var(--gold-600); }
.worked .wb { padding: 14px 16px; }
.eq { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 700; font-size: 1.02rem; }
.eq span { background: var(--surface-2); border-radius: 8px; padding: 2px 10px; }
.eq .res { background: var(--ok-100); color: var(--ok); }
.eq .res.no { background: var(--no-100); color: var(--no); }

/* الخلاصة وسؤال التثبّت */
.summary { margin-top: 30px; background: var(--navy); color: #fff; border-radius: var(--r-lg); padding: 18px 20px 16px; }
.summary b.h { color: var(--gold); display: block; margin-bottom: 6px; font-size: .92rem; }
.summary ul { margin: 0; padding-inline-start: 1.2em; }
.summary li { margin: 4px 0; color: #eceef6; }
.summary li::marker { color: var(--gold); }
.summary strong, .summary b:not(.h) { color: #fff; }
.check { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.check .q { font-weight: 700; }
.check .q::before { content: "سؤالٌ للتثبّت"; display: block; font-size: .8rem; color: var(--gold-600); margin-bottom: 2px; }
.check details { margin-top: 8px; }
.check summary { cursor: pointer; color: var(--navy); font-weight: 700; font-size: .92rem; list-style: none; }
.check summary::-webkit-details-marker { display: none; }
.check summary::before { content: "＋ "; color: var(--gold-600); }
.check details[open] summary::before { content: "－ "; }
.check details p { margin: 8px 0 0; color: var(--ink-2); }

/* التنقّل بين الدروس */
.lnav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 30px; }
.lnav a { display: block; text-decoration: none; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-lg); padding: 12px 16px; color: var(--ink); }
.lnav a:hover { border-color: var(--gold); }
.lnav a small { display: block; font-size: .78rem; color: var(--muted); }
.lnav a b { display: block; font-size: .98rem; line-height: 1.45; }
.lnav a.next { background: var(--navy); border-color: var(--navy); text-align: left; grid-column: 2; }
.lnav a.next small { color: #c4c9dd; } .lnav a.next b { color: #fff; }
.lnav a.prev { grid-column: 1; }

/* مسارُك: شارةٌ ظاهرة دائمًا، وتغييره بنقرة */
.trackbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); }
.trackbar .cur { font-weight: 700; color: var(--ink); }
.trackbar a { font-size: .84rem; }
.pick { display: grid; gap: 10px; }
@media (min-width: 640px) { .pick { grid-template-columns: repeat(3, 1fr); } }
.pick a { display: block; text-decoration: none; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.pick a:hover { border-color: var(--gold); }
.pick a b { display: block; font-size: 1.06rem; }
.pick a span { display: block; font-size: .88rem; color: var(--muted); line-height: 1.65; margin-top: 2px; }
.pick a.on { border-color: var(--navy); box-shadow: 0 0 0 3px var(--gold-100); }
.pick a.on b::after { content: "  ✓"; color: var(--gold-600); }

/* ما يخصّ مسارًا: يُخفى الآخرُ إن اختار الطالب مساره، ويظهر الاثنان لمن جمعهما */
html[data-track="hifz"] [data-t="tath"], html[data-track="tath"] [data-t="hifz"] { display: none !important; }
/* بطاقةُ المسار الواحدة تمتدّ على العرض كلّه بدل نصفه */
html[data-track="hifz"] .compare, html[data-track="tath"] .compare { grid-template-columns: 1fr; }

/* الجداول */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: right; padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.6; }
thead th { background: var(--navy); color: #fff; font-weight: 700; font-size: .82rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: #faf8f3; }
td.d { font-weight: 700; color: var(--navy); text-align: center; white-space: nowrap; }
td.p { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
td .s { display: block; font-size: .78rem; color: var(--muted); }
tr.ts td { background: var(--gold-50) !important; }
tr.ts td.tsm { color: var(--gold-600); font-weight: 700; }
tr.fin td { background: var(--ok-100) !important; font-weight: 700; color: var(--ok); }
.muted { color: var(--muted); }

/* الخريطة الذهنية: جذعٌ يمينًا وأغصانٌ بطول كلامها */
.mm { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 20px 18px; box-shadow: var(--shadow); }
.mm-root { display: inline-block; border-radius: 999px; padding: 9px 22px; font-weight: 700; font-size: 1.2rem; }
.mm.h .mm-root { background: var(--gold); color: #1e2340; }
.mm.t .mm-root { background: var(--blue); color: #1e2340; }
.mm-from { font-size: .86rem; color: var(--muted); margin-inline-start: 8px; }
.mm-b { list-style: none; margin: 16px 0 0; padding: 0; position: relative; }
.mm-b::before { content: ""; position: absolute; top: 20px; bottom: 20px; inset-inline-start: 18px; width: 2px; background: var(--line-2); }
.mm-b li { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; padding: 7px 0; }
.mm-b li::after { content: ""; position: absolute; inset-inline-start: 38px; top: 26px; width: 14px; height: 2px; background: var(--line-2); }
.mm-n { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--navy); color: #fff; position: relative; z-index: 1; box-shadow: 0 0 0 5px var(--surface); }
.mm-c { justify-self: start; width: fit-content; max-width: 100%; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 11px 15px; background: var(--surface-2); }
.mm-c b { display: block; font-size: 1.04rem; }
.mm-c p { margin: 3px 0 0; font-size: .94rem; color: var(--ink-2); line-height: 1.7; }
.mm-c .v { font-weight: 700; color: var(--gold-600); }
.mm.t .mm-c .v { color: var(--blue-600); }
.mm-seq { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.mm-seq span { background: var(--surface); border: 1px solid var(--gold); border-radius: 999px; padding: 2px 11px; font-size: .84rem; font-weight: 700; }
.mm.t .mm-seq span { border-color: var(--blue); }
.mm-foot { margin-top: 14px; border-radius: var(--r-md); background: var(--navy); color: #eceef6; padding: 13px 16px; font-size: .92rem; line-height: 1.8; }
.mm-foot b { color: var(--gold); }

/* ───────────── أدوات الطالب الحالي ───────────── */
.tool { max-width: 58rem; margin: 0 auto; padding: 0 18px 60px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel > h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.panel > h2 i { font-style: normal; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); color: #fff; font-size: .84rem; flex: none; }
.panel > .hint { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }
.seg3 { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .seg3 { grid-template-columns: repeat(3, 1fr); } }
.seg3 button { font: inherit; text-align: start; cursor: pointer; background: var(--surface); color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--r-lg); padding: 11px 14px; line-height: 1.5; }
.seg3 button b { display: block; font-size: 1.02rem; }
.seg3 button span { display: block; font-size: .84rem; color: var(--muted); }
.seg3 button[aria-pressed="true"] { border-color: var(--navy); background: var(--gold-50); box-shadow: 0 0 0 3px var(--gold-100); }
.fields { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .fields { grid-template-columns: repeat(2, 1fr); } }
.field label { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.field .fh { display: block; font-size: .82rem; color: var(--muted); margin-top: 4px; min-height: 1.3em; }
.field input::placeholder { direction: rtl; text-align: right; color: #a3a7b8; font-weight: 500; }
.field input { text-align: right; font: inherit; font-weight: 700; font-size: 1.1rem; width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-md); background: #fff; color: var(--ink);
  font-variant-numeric: tabular-nums; }
.field input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(32,38,73,.12); }
.field input[aria-invalid="true"] { border-color: var(--no); }
.jgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
@media (max-width: 460px) { .jgrid { grid-template-columns: repeat(6, 1fr); } }
.jgrid button { font: inherit; font-weight: 700; font-size: .9rem; padding: 8px 0; cursor: pointer; border-radius: var(--r-sm);
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.jgrid button[aria-pressed="true"] { background: var(--blue-100); border-color: var(--blue-600); color: var(--blue-600); }
.results { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .results { grid-template-columns: repeat(2, 1fr); } }
.res { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; background: var(--surface); }
.res .rl { font-size: .84rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.res .rl::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--rc, var(--line-2)); }
.res .rv { font-size: 1.5rem; font-weight: 700; line-height: 1.3; margin-top: 2px; color: var(--navy); }
.res .rp { font-weight: 700; font-size: 1.02rem; margin-top: 2px; }
.res .why { font-size: .84rem; color: var(--muted); margin-top: 6px; line-height: 1.65; }
.res.new { --rc: var(--navy); }
.res.rabt { --rc: var(--gold); }
.res.rev { --rc: var(--line-2); }
.res.rep { --rc: var(--blue); }
.bar { height: 10px; border-radius: 10px; background: var(--surface-2); overflow: hidden; margin: 8px 0 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-600)); border-radius: 10px; }
.empty { text-align: center; color: var(--muted); padding: 18px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); font-size: .95rem; }

/* التذييل */
.foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 18px 34px; text-align: center;
  font-size: .84rem; color: var(--muted); }
.foot a { color: var(--ink-2); }
.foot-in { max-width: 64rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 12px 24px; flex-wrap: wrap; text-align: start; }
.ft-rights { margin: 0; order: 2; }
.ft-credit { position: relative; order: -1; }
#ft-credit-btn { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 2px;
  cursor: pointer; font: inherit; color: var(--ink-2); }
.ft-credit-label { font-size: 12.5px; opacity: .8; padding-inline-end: 10px; border-inline-end: 1px solid var(--line-2); line-height: 1.2; }
.ft-sig { display: block; height: 46px; width: auto; transition: filter .2s, transform .2s; }
#ft-credit-btn:hover .ft-sig, #ft-credit-btn[aria-expanded="true"] .ft-sig { filter: drop-shadow(0 0 6px rgba(216,176,120,.6)); transform: translateY(-1px); }
.ft-card { position: absolute; bottom: calc(100% + 10px); inset-inline-start: 0; width: max-content; max-width: calc(100vw - 32px);
  background: #fffdf8; color: var(--ink); border: 1px solid var(--gold); border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 18px 50px rgba(32,38,73,.28); z-index: 5; text-align: start; }
.ft-card[hidden] { display: none; }
.ft-card-role { display: block; font-size: 12px; color: var(--gold-600); margin-bottom: 4px; }
.ft-card strong { display: block; font-size: 16.5px; line-height: 1.5; }
.ft-card a { display: inline-block; margin-top: 6px; font-size: 14px; text-decoration: none; border-bottom: 1px dashed var(--gold-600); color: var(--ink); }
@media (max-width: 560px) { .foot-in { flex-direction: column; align-items: flex-start; } }

/* الطباعة: درسٌ نظيفٌ على ورقة */
@media print {
  .top, .lnav, .progress, .trackbar, .check details summary, .foot, .no-print { display: none !important; }
  body { background: #fff; font-size: 11.5pt; }
  .summary { background: #fff; color: var(--ink); border: 1.5px solid var(--navy); }
  .summary li, .summary strong { color: var(--ink); }
  .check details { display: block; } .check details > * { display: block; }
  .card, .worked, .win, .side, .mm, .stat { break-inside: avoid; box-shadow: none; }
  thead { display: table-header-group; } tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
