/* ═══════════════════════════════════════════════
   نبراس قطر — نظام التصميم الجديد v2
   الهوية العنّابية القطرية بروح عصرية
   ═══════════════════════════════════════════════ */

:root {
  --maroon: #8D1B3D;
  --maroon-light: #A8234A;
  --maroon-dark: #6B1430;
  --maroon-deep: #42091D;
  --gold: #C9A84C;
  --gold-light: #E9D9A8;
  --gold-dark: #A8863A;

  --bg: #FBF7F5;
  --bg-soft: #F6EFF0;
  --card: #FFFFFF;
  --ink: #241419;
  --muted: #8B767D;
  --line: #EFE3E6;

  --success: #1E8E5A;
  --success-bg: #E7F6EE;
  --danger: #C73E5A;

  --radius: 20px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --shadow: 0 4px 24px rgba(141, 27, 61, 0.08);
  --shadow-hover: 0 14px 44px rgba(141, 27, 61, 0.16);
  --shadow-gold: 0 8px 30px rgba(201, 168, 76, 0.25);

  --font-head: 'Cairo', sans-serif;
  --font-body: 'Tajawal', sans-serif;

  --nav-h: 72px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  direction: rtl;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { font-family: var(--font-head); line-height: 1.35; }

img { max-width: 100%; display: block; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--maroon); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: #D9BEC7; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--maroon-light); }

/* ═══════════ التنقل العلوي ═══════════ */
.nav {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  background: rgba(66, 9, 29, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(201, 168, 76, 0.18);
  transition: background 0.3s ease;
}

.nav.on-light {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.3rem;
  color: #fff;
}
.nav.on-light .nav-brand { color: var(--maroon); }

.brand-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.brand-icon img { height: 46px; width: auto; display: block; }
.brand-icon svg { width: 22px; height: 22px; }
.brand-gold { color: var(--gold-dark); }
.nav:not(.on-light):not(.nav-v3) .brand-gold { color: var(--gold-light); }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 26px);
}

.nav-links a {
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 4px;
  position: relative;
  transition: color 0.2s;
}
.nav.on-light .nav-links a { color: var(--ink); }

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 2px; right: 0;
  width: 0; height: 3px;
  border-radius: 3px;
  background: var(--gold);
  transition: width 0.25s ease;
}
.nav-links a:hover { color: var(--gold-light); }
.nav.on-light .nav-links a:hover { color: var(--maroon); }
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--gold-light); }
.nav.on-light .nav-links a.active { color: var(--maroon); }

.nav-cta {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--maroon-deep) !important;
  font-weight: 800 !important;
  padding: 9px 20px !important;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(201, 168, 76, 0.45); }
.nav-cta::after { display: none !important; }
.nav-cta svg { width: 17px; height: 17px; }

.nav-burger {
  display: none;
  width: 42px; height: 42px;
  border-radius: 12px;
  place-items: center;
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.nav.on-light .nav-burger { color: var(--maroon); background: var(--bg-soft); }
.nav-burger svg { width: 24px; height: 24px; }

@media (max-width: 860px) {
  .nav-burger { display: grid; }
  .nav-links {
    position: fixed;
    top: var(--nav-h); right: 0; left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(66, 9, 29, 0.98);
    backdrop-filter: blur(20px);
    padding: 12px 20px 20px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 14px 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .nav-links a::after { display: none; }
  .nav-cta { margin-top: 12px; justify-content: center; }
  /* الصفحات الفاتحة: القائمة بخلفية بيضاء ونص واضح */
  .nav.on-light .nav-links {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(141, 27, 61, 0.12);
  }
  .nav.on-light .nav-links a { color: var(--ink); border-bottom-color: var(--line); }
  .nav.on-light .nav-links a:hover { color: var(--maroon); }
  .nav.on-light .nav-links a.active { color: var(--maroon); }
}

/* ═══════════ الواجهة الرئيسية (Hero) ═══════════ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 20px 80px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(201, 168, 76, 0.22), transparent 60%),
    radial-gradient(700px 480px at 8% 108%, rgba(168, 35, 74, 0.55), transparent 62%),
    linear-gradient(160deg, var(--maroon-deep) 0%, var(--maroon) 55%, var(--maroon-dark) 100%);
  overflow: hidden;
  color: #fff;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  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%3Cpath d='M36 6l7 23 23 7-23 7-7 23-7-23-23-7 23-7z' fill='none' stroke='%23C9A84C' stroke-opacity='0.10'/%3E%3C/svg%3E");
  background-size: 72px 72px;
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(201, 168, 76, 0.14);
  border: 1px solid rgba(201, 168, 76, 0.45);
  color: var(--gold-light);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 26px;
}
.hero-badge svg { width: 15px; height: 15px; }

.hero h1 {
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  font-weight: 900;
  margin-bottom: 18px;
  letter-spacing: -0.5px;
}
.hero h1 .gold {
  background: linear-gradient(120deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  color: rgba(255, 255, 255, 0.82);
  max-width: 620px;
  margin: 0 auto 38px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 56px;
}

/* الأزرار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  padding: 15px 30px;
  border-radius: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn:active { transform: scale(0.97); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--maroon-deep);
  box-shadow: var(--shadow-gold);
}
.btn-gold:hover { transform: translateY(-3px); box-shadow: 0 14px 38px rgba(201,168,76,0.4); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-3px); }

.btn-primary {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  box-shadow: 0 8px 26px rgba(141, 27, 61, 0.3);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(141, 27, 61, 0.4); }

.btn-success {
  background: linear-gradient(135deg, #22A567, #177A49);
  color: #fff;
  box-shadow: 0 8px 26px rgba(30, 142, 90, 0.3);
}
.btn-success:hover { transform: translateY(-3px); }

.btn-outline {
  background: transparent;
  color: var(--maroon);
  border: 1.5px solid var(--maroon);
}
.btn-outline:hover { background: var(--maroon); color: #fff; }

.btn-sm { padding: 10px 20px; font-size: 0.9rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* بطاقات البوابات */
.hero-portals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 340px));
  gap: 20px;
  justify-content: center;
  width: 100%;
  max-width: 760px;
}

.portal-card {
  position: relative;
  display: block;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 34px 28px;
  text-align: center;
  color: #fff;
  transition: transform 0.3s ease, background 0.3s, border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
}
.portal-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.portal-card:hover {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.portal-card:hover::before { opacity: 1; }

.portal-card .p-icon {
  width: 76px; height: 76px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(201,168,76,0.25), rgba(201,168,76,0.08));
  border: 1px solid rgba(201, 168, 76, 0.35);
}
.portal-card .p-icon svg { width: 38px; height: 38px; color: var(--gold-light); }

.portal-card h3 { font-size: 1.35rem; font-weight: 800; margin-bottom: 10px; }
.portal-card p { font-size: 0.95rem; color: rgba(255,255,255,0.72); }

.hero-strip {
  margin-top: 60px;
  display: flex;
  gap: clamp(20px, 5vw, 56px);
  flex-wrap: wrap;
  justify-content: center;
}
.hero-strip .strip-item {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.92rem;
}
.hero-strip svg { width: 18px; height: 18px; color: var(--gold); }

/* ═══════════ أقسام الصفحة ═══════════ */
.section {
  padding: clamp(60px, 9vw, 110px) clamp(16px, 5vw, 60px);
  max-width: 1200px;
  margin: 0 auto;
}

.section-head { text-align: center; margin-bottom: clamp(36px, 6vw, 60px); }

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--gold-dark);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.88rem;
  background: #FBF3DF;
  border: 1px solid var(--gold-light);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.section-kicker svg { width: 14px; height: 14px; }

.section-head h2 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 900;
  color: var(--maroon-deep);
  margin-bottom: 12px;
}
.section-head p { color: var(--muted); font-size: 1.08rem; max-width: 560px; margin: 0 auto; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 26px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
  position: relative;
  overflow: hidden;
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--gold-light);
}
.feature-card .f-icon {
  width: 58px; height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #F9EDF1, #F3E2E8);
  color: var(--maroon);
  margin-bottom: 18px;
  transition: transform 0.3s;
}
.feature-card:hover .f-icon { transform: scale(1.08) rotate(-4deg); }
.feature-card .f-icon svg { width: 28px; height: 28px; }
.feature-card h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; color: var(--ink); }
.feature-card p { font-size: 0.95rem; color: var(--muted); }

.feature-card.soon { opacity: 0.85; }
.f-tag {
  position: absolute;
  top: 18px; left: 18px;
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: #FBF3DF;
  color: var(--gold-dark);
  border: 1px solid var(--gold-light);
}
.f-tag.new { background: var(--success-bg); color: var(--success); border-color: #BDE5CF; }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}
.step {
  text-align: center;
  padding: 34px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.step-num {
  width: 54px; height: 54px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.3rem;
  box-shadow: 0 8px 20px rgba(141,27,61,0.28);
}
.step h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 0.93rem; }

.cta-band {
  position: relative;
  border-radius: var(--radius-lg);
  padding: clamp(44px, 7vw, 80px) clamp(24px, 6vw, 70px);
  background:
    radial-gradient(600px 300px at 90% 0%, rgba(201,168,76,0.2), transparent 60%),
    linear-gradient(140deg, var(--maroon-deep), var(--maroon) 60%, var(--maroon-dark));
  color: #fff;
  text-align: center;
  overflow: hidden;
}
.cta-band h2 { font-size: clamp(1.6rem, 3.8vw, 2.4rem); font-weight: 900; margin-bottom: 14px; }
.cta-band p { color: rgba(255,255,255,0.78); margin-bottom: 30px; font-size: 1.05rem; }

/* ═══════════ التذييل ═══════════ */
.footer {
  background: var(--maroon-deep);
  color: rgba(255, 255, 255, 0.7);
  padding: 46px clamp(16px, 5vw, 60px) 30px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-head); font-weight: 900; font-size: 1.15rem; }
.footer-brand .brand-icon { width: 34px; height: 34px; border-radius: 10px; }
.footer-brand .brand-icon img { height: 34px; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { font-family: var(--font-head); font-weight: 700; font-size: 0.92rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--gold-light); }
.footer-copy {
  max-width: 1200px;
  margin: 26px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ═══════════ صفحات الأدوات ═══════════ */
.tool-page {
  min-height: 100vh;
  padding-top: var(--nav-h);
  background:
    radial-gradient(700px 320px at 100% 0%, rgba(201,168,76,0.07), transparent 60%),
    var(--bg);
}

.tool-hero {
  background:
    radial-gradient(500px 240px at 85% 0%, rgba(201,168,76,0.18), transparent 60%),
    linear-gradient(150deg, var(--maroon-deep), var(--maroon) 70%, var(--maroon-dark));
  color: #fff;
  padding: 44px clamp(16px, 5vw, 60px) 96px;
  position: relative;
  overflow: hidden;
}
.tool-hero::before {
  content: '';
  position: absolute; inset: 0;
  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%3Cpath d='M36 6l7 23 23 7-23 7-7 23-7-23-23-7 23-7z' fill='none' stroke='%23C9A84C' stroke-opacity='0.08'/%3E%3C/svg%3E");
  background-size: 72px 72px;
}
.tool-hero-inner { max-width: 900px; margin: 0 auto; position: relative; }
.tool-hero h1 { font-size: clamp(1.5rem, 3.6vw, 2.2rem); font-weight: 900; margin-bottom: 8px; }
.tool-hero p { color: rgba(255,255,255,0.78); font-size: 1rem; }

.tool-body {
  max-width: 900px;
  margin: -60px auto 0;
  padding: 0 clamp(14px, 3vw, 24px) 80px;
  position: relative;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 38px);
  margin-bottom: 24px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--maroon-deep);
  margin-bottom: 6px;
}
.panel-title .pt-icon {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #F9EDF1, #F3E2E8);
  color: var(--maroon);
  flex-shrink: 0;
}
.panel-title .pt-icon svg { width: 22px; height: 22px; }
.panel-sub { color: var(--muted); font-size: 0.93rem; margin-bottom: 20px; }

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  margin-bottom: 24px;
}
.role-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px;
  border-radius: 12px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  color: var(--muted);
  transition: all 0.25s ease;
}
/* بطاقات الوضع: اشرح لي الدرس / اختبرني */
.mode-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 12px;
  font-family: var(--font-head);
  text-decoration: none;
  color: var(--muted);
  border: 2px solid transparent;
  transition: all 0.25s ease;
  cursor: pointer;
}
.mode-card svg { width: 26px; height: 26px; flex-shrink: 0; }
.mode-card b { display: block; font-size: 1.02rem; font-weight: 800; }
.mode-card small { display: block; font-size: 0.76rem; font-weight: 600; opacity: 0.75; margin-top: 2px; line-height: 1.5; }
.mode-card.active { background: var(--maroon); color: #fff; box-shadow: 0 6px 16px rgba(141, 27, 61, 0.25); cursor: default; }
.mode-card:not(.active):hover { border-color: var(--maroon-light); color: var(--maroon); background: #FCF3F5; }
.role-mini-switch {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  transition: all 0.2s;
}
.role-mini-switch:hover { color: var(--maroon); background: #FCF3F5; }
.role-mini-switch svg { width: 15px; height: 15px; }

.role-switch button svg { width: 20px; height: 20px; }
.role-switch button.active {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  box-shadow: 0 6px 18px rgba(141, 27, 61, 0.3);
}

.stage-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.stage-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
  transition: all 0.2s ease;
}
.stage-pill svg { width: 24px; height: 24px; color: var(--muted); transition: color 0.2s; }
.stage-pill small { font-weight: 500; font-size: 0.72rem; color: var(--muted); font-family: var(--font-body); }
.stage-pill:hover { border-color: var(--maroon-light); transform: translateY(-2px); }
.stage-pill.active {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  border-color: var(--maroon);
  color: #fff;
  box-shadow: 0 8px 22px rgba(141, 27, 61, 0.3);
}
.stage-pill.active svg, .stage-pill.active small { color: rgba(255,255,255,0.85); }

.upload-zone {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 12px;
  border-radius: 16px;
  border: 2px dashed #DCC3CC;
  background: var(--bg);
  color: var(--maroon);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.92rem;
  transition: all 0.2s ease;
}
.upload-btn svg { width: 28px; height: 28px; color: var(--maroon-light); }
.upload-btn:hover { border-color: var(--maroon); background: #FCF3F5; transform: translateY(-2px); }

@media (max-width: 560px) { .upload-zone { grid-template-columns: 1fr; } }

.img-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.img-thumb {
  position: relative;
  width: 86px; height: 86px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--line);
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb button {
  position: absolute;
  top: 4px; left: 4px;
  width: 22px; height: 22px;
  border-radius: 8px;
  background: rgba(36, 20, 25, 0.75);
  color: #fff;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #BDE5CF;
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.file-chip svg { width: 16px; height: 16px; }
.file-chip button { color: var(--danger); display: grid; place-items: center; }

.text-input {
  width: 100%;
  min-height: 130px;
  padding: 16px 18px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.8;
}
.text-input:focus {
  outline: none;
  border-color: var(--maroon-light);
  box-shadow: 0 0 0 4px rgba(141, 27, 61, 0.08);
  background: #fff;
}
.text-input::placeholder { color: #B9A6AC; }

.seg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.seg-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--maroon);
}
.seg-label svg { width: 17px; height: 17px; }
.seg {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  flex-wrap: wrap;
}
.seg button {
  padding: 8px 16px;
  border-radius: 9px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  transition: all 0.2s;
}
.seg button.active {
  background: var(--maroon);
  color: #fff;
  box-shadow: 0 3px 10px rgba(141, 27, 61, 0.25);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
@media (max-width: 520px) { .action-row { grid-template-columns: 1fr; } }
.action-hint {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.loading-box {
  display: none;
  text-align: center;
  padding: 44px 20px;
}
.loading-box.show { display: block; }
.loader-ring {
  width: 58px; height: 58px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--maroon);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box p { color: var(--muted); font-family: var(--font-head); font-weight: 700; }
.loading-dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

.results { display: none; }
.results.show { display: block; }

.result-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 22px;
  overflow-x: auto;
}
.result-tabs button {
  flex: 1;
  white-space: nowrap;
  padding: 11px 16px;
  border-radius: 10px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s;
}
.result-tabs button svg { width: 17px; height: 17px; }
.result-tabs button.active {
  background: var(--card);
  color: var(--maroon);
  box-shadow: 0 3px 12px rgba(141, 27, 61, 0.12);
}

.result-pane { display: none; }
.result-pane.active { display: block; animation: fadeUp 0.4s ease; }

.md-content {
  font-size: 1.02rem;
  line-height: 1.95;
  color: var(--ink);
}
.md-content h2 {
  font-size: 1.35rem;
  color: var(--maroon-deep);
  margin: 26px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold-light);
}
.md-content h3 { font-size: 1.15rem; color: var(--maroon); margin: 20px 0 10px; }
.md-content p { margin: 12px 0; }
.md-content ul, .md-content ol { margin: 12px 0; padding-right: 26px; }
.md-content li { margin: 6px 0; }
.md-content strong { color: var(--maroon-dark); font-weight: 800; }
.md-content blockquote {
  background: #FBF3DF;
  border-right: 4px solid var(--gold);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0;
  color: #6B5416;
}
.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.94rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(141,27,61,0.07);
}
.md-content th {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  padding: 12px 14px;
  font-family: var(--font-head);
  text-align: right;
}
.md-content td { padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.md-content tr:nth-child(even) td { background: var(--bg-soft); }
.md-content code {
  background: var(--bg-soft);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.9em;
  color: var(--maroon-dark);
}
.md-content hr { border: none; border-top: 2px dashed var(--line); margin: 24px 0; }
.md-content img { border-radius: 14px; margin: 16px auto; box-shadow: var(--shadow); max-height: 420px; }
.md-content .edu-img { text-align: center; margin: 20px 0; }
.md-content .edu-img figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }

.result-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  transition: all 0.2s;
}
.tool-chip svg { width: 16px; height: 16px; color: var(--maroon); }
.tool-chip:hover { border-color: var(--maroon); color: var(--maroon); transform: translateY(-1px); }

.chat-box {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 22px;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  padding: 14px 18px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.98rem;
}
.chat-head svg { width: 19px; height: 19px; }
.chat-messages {
  max-height: 380px;
  overflow-y: auto;
  padding: 18px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.8;
  animation: fadeUp 0.3s ease;
  white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-start;
  background: var(--maroon);
  color: #fff;
  border-bottom-left-radius: 4px;
}
.chat-msg.bot {
  align-self: flex-end;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(141,27,61,0.06);
}
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.chat-input-row input {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.chat-input-row input:focus { outline: none; border-color: var(--maroon-light); }
.chat-input-row button {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.chat-input-row button:hover { transform: scale(1.06); }
.chat-input-row button svg { width: 20px; height: 20px; }

/* ─── الاختبار التفاعلي ─── */
.quiz-q {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.quiz-q .q-num {
  display: inline-block;
  background: var(--bg-soft);
  color: var(--maroon);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.quiz-q h4 { font-size: 1.08rem; font-weight: 800; margin-bottom: 16px; line-height: 1.7; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: var(--bg);
  font-size: 0.97rem;
  font-family: var(--font-body);
  transition: all 0.2s;
  width: 100%;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--maroon-light); background: #FCF3F5; }
.quiz-opt .opt-letter {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: #fff;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--maroon);
  flex-shrink: 0;
}
.quiz-opt.picked { border-color: var(--maroon); background: #FCF3F5; }
.quiz-opt.picked .opt-letter { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.quiz-opt.correct { border-color: var(--success); background: var(--success-bg); }
.quiz-opt.correct .opt-letter { background: var(--success); color: #fff; border-color: var(--success); }
.quiz-opt.wrong { border-color: var(--danger); background: #FDEEF1; }
.quiz-opt.wrong .opt-letter { background: var(--danger); color: #fff; border-color: var(--danger); }
.quiz-explain {
  margin-top: 14px;
  padding: 12px 16px;
  background: #FBF3DF;
  border-radius: 12px;
  font-size: 0.9rem;
  color: #6B5416;
  border-right: 3px solid var(--gold);
}

/* أسئلة الإجابة القصيرة */
.quiz-short-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  background: var(--card);
  transition: border-color 0.2s;
}
.quiz-short-input:focus { outline: none; border-color: var(--maroon); }
.quiz-short-input:disabled { background: #F7F3F0; color: var(--muted); }
.model-answer-box {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--success-bg);
  border: 1.5px solid var(--success);
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1E6B3C;
  line-height: 1.7;
}
.self-mark-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
}
.self-mark {
  padding: 9px 18px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--card);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}
.self-mark.btn-yes { border-color: var(--success); color: #1E6B3C; }
.self-mark.btn-yes:hover:not(:disabled) { background: var(--success-bg); }
.self-mark.btn-no { border-color: var(--danger); color: var(--danger); }
.self-mark.btn-no:hover:not(:disabled) { background: #FDEEF1; }
.self-mark:disabled { opacity: 0.55; cursor: default; }
.quiz-q.short-correct { border-color: var(--success); }
.quiz-q.short-wrong { border-color: var(--danger); }

.quiz-score { text-align: center; padding: 40px 24px; }
.score-circle {
  width: 150px; height: 150px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--maroon) var(--deg, 0deg), var(--line) 0);
  position: relative;
}
.score-circle::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #fff;
}
.score-circle .score-val {
  position: relative;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 2.1rem;
  color: var(--maroon-deep);
}
.quiz-score h3 { font-size: 1.4rem; font-weight: 900; color: var(--maroon-deep); margin-bottom: 8px; }
.quiz-score p { color: var(--muted); margin-bottom: 24px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  font-size: 0.94rem;
  margin-bottom: 18px;
}
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.alert-info { background: #EAF1FD; color: #1D4FA3; border: 1px solid #C7DAF8; }
.alert-warn { background: #FBF3DF; color: #6B5416; border: 1px solid var(--gold-light); }
.alert-error { background: #FDEEF1; color: var(--danger); border: 1px solid #F3C2CE; }

.toast {
  position: fixed;
  bottom: 26px;
  right: 50%;
  transform: translateX(50%) translateY(80px);
  background: var(--maroon-deep);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 13px 26px;
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.3);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  z-index: 300;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(50%) translateY(0); }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,0.75);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 18px;
  transition: color 0.2s;
  position: relative;
}
.back-link:hover { color: var(--gold-light); }
.back-link svg { width: 17px; height: 17px; }

.usage-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 5px 14px;
  border-radius: 999px;
}
.usage-pill svg { width: 13px; height: 13px; }

/* ═══════════════════════════════════════════════
   الواجهة v3 — الطراز الفاتح (برج نبراس)
   ═══════════════════════════════════════════════ */

:root {
  --cream: #FAF5EE;
  --cream-dark: #F1E9DD;
  --sand: #E8DCCB;
}

.landing-v3 { background: var(--cream); overflow-x: hidden; }

/* ─── التنقل الفاتح ─── */
.nav-v3 {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 48px);
  background: rgba(250, 245, 238, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(141, 27, 61, 0.08);
}
.nav-v3 .nav-brand { color: var(--maroon); }
.nav-v3 .nav-links a { color: var(--ink); }
.nav-v3 .nav-links a:hover { color: var(--maroon); }
.nav-v3 .nav-burger { background: var(--maroon); color: #fff; border-radius: 12px; }
.nav-v3 .nav-links {
  /* نفس سلوك الجوال من .nav لكن بخلفية كريمية */
}
@media (max-width: 860px) {
  .nav-v3 .nav-links { background: rgba(250, 245, 238, 0.98); }
  .nav-v3 .nav-links a { border-bottom-color: rgba(141,27,61,0.08); }
}

/* ─── الواجهة المنقسمة ─── */
.hero-v3 {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  align-items: center;
  gap: clamp(20px, 4vw, 60px);
  max-width: 1240px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 30px) clamp(20px, 5vw, 60px) 60px;
  position: relative;
  overflow: hidden;
}

/* زخرفة خلفية خفيفة */
.hero-v3::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cpath d='M45 8l9 28 28 9-28 9-9 28-9-28-28-9 28-9z' fill='none' stroke='%238D1B3D' stroke-opacity='0.05'/%3E%3C/svg%3E");
  background-size: 90px 90px;
  pointer-events: none;
  mask-image: linear-gradient(to left, black 30%, transparent 75%);
  -webkit-mask-image: linear-gradient(to left, black 30%, transparent 75%);
}

.hero-v3-text { position: relative; text-align: right; }

.hero-v3 .hero-badge-v3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--sand);
  color: var(--maroon);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(141,27,61,0.06);
}
.hero-v3 .hero-badge-v3 svg { width: 14px; height: 14px; color: var(--gold-dark); }

.hero-v3 h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 18px;
  line-height: 1.2;
}
.hero-v3 h1 .maroon-word { color: var(--maroon); }
.hero-v3 h1 .gold-word {
  background: linear-gradient(120deg, var(--gold-dark), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-v3 .lead-v3 {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: #7A6A62;
  max-width: 480px;
  margin-bottom: 34px;
  line-height: 1.9;
}

.btn-maroon-solid {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  box-shadow: 0 10px 30px rgba(141, 27, 61, 0.28);
  border-radius: 999px;
  padding: 15px 34px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}
.btn-maroon-solid svg { width: 18px; height: 18px; }
.btn-maroon-solid:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(141, 27, 61, 0.36); }

/* جانب الصورة */
.hero-v3-art {
  position: relative;
  display: grid;
  place-items: center;
}
.hero-v3-art .art-halo {
  position: absolute;
  width: min(38vw, 560px);
  height: min(38vw, 560px);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(201,168,76,0.18), transparent 70%),
    var(--cream-dark);
  z-index: 0;
}
.hero-v3-art img {
  position: relative;
  z-index: 1;
  max-height: min(66vh, 560px);
  width: auto;
  filter: drop-shadow(0 30px 40px rgba(141, 27, 61, 0.18));
  animation: floatY 5.5s ease-in-out infinite;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

/* الجوال: نفس التقسيمة (برج يسار + نص يمين) مثل التصميم — بدون تكديس */
@media (max-width: 640px) {
  .hero-v3 {
    grid-template-columns: 0.95fr 1.05fr;
    gap: 10px;
    min-height: auto;
    padding: calc(var(--nav-h) + 20px) 16px 44px;
  }
  .hero-v3 h1 { font-size: clamp(1.6rem, 7.8vw, 2.6rem); margin-bottom: 12px; }
  .hero-v3 .hero-badge-v3 { font-size: 0.68rem; padding: 6px 12px; gap: 6px; margin-bottom: 14px; }
  .hero-v3 .hero-badge-v3 svg { width: 11px; height: 11px; }
  .hero-v3 .lead-v3 { font-size: 0.82rem; line-height: 1.75; margin-bottom: 22px; }
  .btn-maroon-solid { padding: 11px 20px; font-size: 0.85rem; gap: 8px; }
  .btn-maroon-solid svg { width: 15px; height: 15px; }
  .hero-v3-art img { max-height: 44vh; width: 100%; }
  .hero-v3-art .art-halo { width: 62vw; height: 62vw; left: 50%; }
}

/* ─── فاصل الأقسام ─── */
.divider-v3 {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 60px);
}
.divider-v3::before, .divider-v3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sand), transparent);
}
.divider-v3 span {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  color: var(--maroon-deep);
  white-space: nowrap;
}

/* ─── بطاقات طالب/معلم ─── */
.role-cards-v3 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 900px;
  margin: 36px auto 0;
  padding: 0 clamp(20px, 5vw, 60px);
}
.role-card-v3 {
  background: #fff;
  border: 1px solid #EFE6DA;
  border-radius: 26px;
  padding: 34px 30px 96px;
  text-align: center;
  box-shadow: 0 6px 26px rgba(141, 27, 61, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
  position: relative;
}
.role-card-v3:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 50px rgba(141, 27, 61, 0.14);
  border-color: var(--gold-light);
}
.role-card-v3 img {
  height: 130px;
  width: auto;
  margin: 0 auto 18px;
  filter: drop-shadow(0 12px 18px rgba(141,27,61,0.12));
  transition: transform 0.3s;
}
.role-card-v3:hover img { transform: scale(1.06) rotate(-2deg); }
.role-card-v3 h3 { font-size: 1.35rem; font-weight: 900; color: var(--ink); margin-bottom: 4px; }
.role-card-v3 .role-sub { font-family: var(--font-head); font-weight: 700; color: #A08A80; font-size: 0.95rem; margin-bottom: 10px; }
.role-card-v3 p { color: #8B7A72; font-size: 0.93rem; margin-bottom: 0; }
.role-card-v3 .role-arrow {
  position: absolute;
  left: 26px;
  bottom: 26px;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--maroon);
  color: #fff;
  display: grid;
  place-items: center;
  transition: transform 0.25s, background 0.25s;
}
.role-card-v3:hover .role-arrow { transform: translateX(-6px); background: var(--gold-dark); }
.role-card-v3 .role-arrow svg { width: 22px; height: 22px; }

/* الجوال: بطاقتان جنب بعض بشكل مضغوط مثل التصميم */
@media (max-width: 640px) {
  .role-cards-v3 { gap: 12px; padding: 0 16px; margin-top: 28px; }
  .role-card-v3 { padding: 22px 12px 70px; border-radius: 20px; }
  .role-card-v3 img { height: 84px; margin-bottom: 12px; }
  .role-card-v3 h3 { font-size: 1.05rem; }
  .role-card-v3 .role-sub { font-size: 0.78rem; margin-bottom: 8px; }
  .role-card-v3 p { font-size: 0.75rem; line-height: 1.7; }
  .role-card-v3 .role-arrow { width: 36px; height: 36px; left: 14px; bottom: 14px; }
  .role-card-v3 .role-arrow svg { width: 17px; height: 17px; }
}

/* ─── مميزات نبراس ─── */
.feat-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1000px;
  margin: 36px auto 0;
  padding: 0 clamp(20px, 5vw, 60px);
}
.feat-mini {
  background: #fff;
  border: 1px solid #EFE6DA;
  border-radius: 20px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 4px 18px rgba(141, 27, 61, 0.05);
  transition: transform 0.25s, box-shadow 0.25s;
}
.feat-mini:hover { transform: translateY(-5px); box-shadow: 0 14px 34px rgba(141,27,61,0.1); }
.feat-mini .fm-icon {
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  color: var(--maroon);
}
.feat-mini .fm-icon svg { width: 38px; height: 38px; }
.feat-mini h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 6px; }
.feat-mini p { font-size: 0.88rem; color: #8B7A72; }

/* الجوال: ثلاث بطاقات جنب بعض مثل التصميم */
@media (max-width: 640px) {
  .feat-mini-grid { gap: 10px; padding: 0 16px; margin-top: 28px; }
  .feat-mini { padding: 18px 8px; border-radius: 16px; }
  .feat-mini .fm-icon svg { width: 28px; height: 28px; }
  .feat-mini h3 { font-size: 0.82rem; }
  .feat-mini p { font-size: 0.68rem; line-height: 1.7; }
}

/* ─── شريط CTA بأفق قطر ─── */
.cta-skyline {
  position: relative;
  max-width: 1100px;
  margin: clamp(56px, 8vw, 90px) auto 0;
  border-radius: 28px;
  background:
    radial-gradient(700px 300px at 15% 110%, rgba(201,168,76,0.15), transparent 60%),
    linear-gradient(140deg, var(--maroon-deep), var(--maroon-dark) 60%, var(--maroon));
  color: #fff;
  padding: clamp(40px, 6vw, 64px) clamp(24px, 6vw, 64px);
  overflow: hidden;
  text-align: right;
  margin-right: clamp(16px, 5vw, 60px);
  margin-left: clamp(16px, 5vw, 60px);
}
.cta-skyline .skyline-img {
  position: absolute;
  bottom: -8px;
  left: 0;
  width: min(52%, 520px);
  opacity: 0.9;
  pointer-events: none;
  mask-image: linear-gradient(to top, black 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, black 55%, transparent 100%);
}
.cta-skyline .cta-skyline-text {
  position: relative;
  z-index: 2;
  width: 52%;
  margin-right: 0;
}
.cta-skyline h2 {
  font-size: clamp(1.5rem, 3.6vw, 2.3rem);
  font-weight: 900;
  margin-bottom: 12px;
}
.cta-skyline p {
  color: rgba(255,255,255,0.75);
  margin-bottom: 28px;
  font-size: 1rem;
  line-height: 1.9;
}
.cta-skyline .btn { position: relative; display: inline-flex; align-items: center; gap: 10px; }
.cta-skyline .btn svg { width: 17px; height: 17px; }

@media (max-width: 640px) {
  .cta-skyline { padding: 32px 22px; }
  .cta-skyline .cta-skyline-text { width: 56%; }
  .cta-skyline h2 { font-size: 1.2rem; }
  .cta-skyline p { font-size: 0.78rem; margin-bottom: 20px; }
  .cta-skyline .btn { padding: 10px 20px; font-size: 0.82rem; }
}
@media (max-width: 420px) {
  .cta-skyline { text-align: center; }
  .cta-skyline .cta-skyline-text { width: 100%; }
  .cta-skyline .skyline-img { width: 100%; opacity: 0.25; }
}

/* ─── تذييل v3 ─── */
.footer-v3 {
  margin-top: clamp(56px, 8vw, 90px);
  border-top: 1px solid var(--sand);
  padding: 34px clamp(20px, 5vw, 60px) 26px;
}
.footer-v3 .f-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.footer-v3 .f-links {
  display: flex;
  gap: clamp(16px, 3.5vw, 32px);
  flex-wrap: wrap;
}
.footer-v3 .f-links a {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.92rem;
  color: #7A6A62;
  transition: color 0.2s;
}
.footer-v3 .f-links a:hover { color: var(--maroon); }
.footer-v3 .f-social {
  display: flex;
  align-items: center;
  gap: 18px;
}
.footer-v3 .f-social a {
  color: var(--maroon);
  display: grid;
  place-items: center;
  transition: color 0.2s, transform 0.2s;
}
.footer-v3 .f-social a:hover { color: var(--gold-dark); transform: translateY(-3px); }
.footer-v3 .f-social svg { width: 20px; height: 20px; }
.footer-v3 .f-copy { font-size: 0.83rem; color: #A7978E; text-align: center; }
@media (max-width: 640px) {
  .footer-v3 .f-row { flex-direction: column; justify-content: center; }
}

/* ═══════ الصور التعليمية داخل الشرح ═══════ */
.edu-image-card {
  margin: 24px 0;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}
.edu-image-card img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  background: linear-gradient(180deg, #FFFFFF, #FDFAF7);
  padding: 10px;
  cursor: zoom-in;
  opacity: 0;
  transition: opacity 0.5s;
}
.edu-image-card img.loaded { opacity: 1; }
.edu-image-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1.5px solid var(--line);
  background: var(--bg-soft);
}
.edu-image-card .edu-cap { font-size: 0.84rem; font-weight: 700; color: var(--ink); }
.edu-image-card .edu-src {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--muted);
  transition: color 0.2s;
}
.edu-image-card .edu-src:hover { color: var(--maroon); }
.edu-image-card .edu-src svg { width: 12px; height: 12px; }

/* هيكل التحميل المتلألئ */
.edu-image-loading { padding: 14px; }
.edu-shimmer {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, #FFFFFF 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: eduShimmer 1.4s infinite;
}
@keyframes eduShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.edu-image-loading span { display: block; text-align: center; font-size: 0.78rem; color: var(--muted); margin-top: 10px; }

/* مكبّر الصورة (لايت بوكس) */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(36, 20, 25, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  cursor: zoom-out;
  backdrop-filter: blur(5px);
}
.img-lightbox img {
  max-width: 94vw;
  max-height: 86vh;
  width: auto;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.img-lightbox .lb-close {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}
.img-lightbox .lb-close:hover { background: rgba(255, 255, 255, 0.3); }
.img-lightbox .lb-close svg { width: 20px; height: 20px; }

/* ═══════ صفحة الطباعة (تصدير PDF) ═══════ */
.print-sheet { display: none; }

@media print {
  @page { size: A4; margin: 15mm 13mm; }
  body.printing > *:not(.print-sheet) { display: none !important; }
  body.printing { background: #fff !important; }
  body.printing .print-sheet {
    display: block !important;
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
    color: #241419;
    line-height: 1.8;
  }
  .print-sheet .print-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 3px solid #8D1B3D;
    margin-bottom: 6px;
  }
  .print-sheet .print-header img { width: 46px; height: 46px; object-fit: contain; }
  .print-sheet .print-header strong { display: block; font-family: 'Cairo', sans-serif; font-size: 15pt; color: #8D1B3D; }
  .print-sheet .print-header span { font-size: 9pt; color: #8B767D; }
  .print-sheet .print-title {
    font-family: 'Cairo', sans-serif;
    font-size: 17pt;
    font-weight: 800;
    color: #241419;
    margin: 14px 0 18px;
    padding: 10px 16px;
    background: #F6EFF0;
    border-right: 5px solid #C9A84C;
    border-radius: 8px;
  }
  .print-sheet .export-h1 {
    font-family: 'Cairo', sans-serif;
    font-size: 14pt;
    color: #8D1B3D;
    border-bottom: 2px solid #C9A84C;
    padding-bottom: 6px;
    margin: 26px 0 12px;
    break-after: avoid;
  }
  .print-sheet .md-content h2, .print-sheet .md-content h3 { break-after: avoid; }
  .print-sheet .md-content img, .print-sheet .edu-image-card, .print-sheet table, .print-sheet blockquote { break-inside: avoid; }
  .print-sheet .edu-image-card { box-shadow: none; }
  .print-sheet .edu-image-loading { display: none; }
  .print-sheet .print-footer {
    margin-top: 30px;
    padding-top: 10px;
    border-top: 1.5px solid #EFE3E6;
    text-align: center;
    font-size: 9pt;
    color: #8B767D;
  }
}

/* ═══════ زر «شاركنا رأيك» العائم + نافذة التقييم ═══════ */
.feedback-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 900;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-light));
  color: #fff;
  border-radius: 50px;
  padding: 13px 22px;
  font-family: var(--font-head);
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 24px rgba(141, 27, 61, 0.4);
  transition: all 0.3s ease;
}
.feedback-fab svg { width: 18px; height: 18px; }
.feedback-fab:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(141, 27, 61, 0.55); }

.feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(36, 20, 25, 0.55);
  backdrop-filter: blur(3px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.feedback-overlay.open { display: flex; }

.feedback-modal {
  background: #fff;
  border-radius: 24px;
  padding: 32px 28px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: fbPop 0.25s ease;
}
@keyframes fbPop { from { transform: scale(0.92) translateY(14px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.feedback-modal h3 { font-size: 1.35rem; font-weight: 800; color: var(--maroon); margin-bottom: 6px; text-align: center; }
.feedback-modal .fb-sub { color: var(--muted); font-size: 0.88rem; text-align: center; margin-bottom: 20px; }
.feedback-modal .fb-close {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: all 0.2s;
}
.feedback-modal .fb-close:hover { background: var(--line); }
.feedback-modal .fb-close svg { width: 16px; height: 16px; }

/* النجوم */
.stars-row { display: flex; justify-content: center; flex-direction: row-reverse; gap: 6px; margin-bottom: 18px; }
.stars-row input { display: none; }
.stars-row label { font-size: 2rem; color: #DDD2D6; cursor: pointer; transition: transform 0.15s, color 0.15s; line-height: 1; }
.stars-row label:hover { transform: scale(1.15); }
.stars-row label:hover,
.stars-row label:hover ~ label,
.stars-row input:checked ~ label { color: var(--gold); }

.feedback-modal textarea,
.feedback-modal input[type="text"],
.feedback-modal input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  direction: rtl;
  text-align: right;
  margin-bottom: 10px;
  background: #FDFBFA;
  color: var(--ink);
  transition: border-color 0.2s;
}
.feedback-modal textarea:focus,
.feedback-modal input:focus { outline: none; border-color: var(--maroon); }
.feedback-modal textarea { min-height: 110px; resize: vertical; }
.fb-email-hint { font-size: 0.8rem; color: var(--muted); margin: -2px 0 14px; line-height: 1.6; text-align: right; }

.feedback-submit {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-light));
  color: #fff;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 800;
  transition: all 0.2s;
}
.feedback-submit:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(141, 27, 61, 0.35); }
.feedback-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.feedback-success { text-align: center; padding: 20px 0; }
.feedback-success .fb-check { font-size: 3rem; margin-bottom: 10px; }
.feedback-success h4 { color: var(--maroon); font-size: 1.3rem; margin-bottom: 8px; }
.feedback-success p { color: var(--muted); font-size: 0.92rem; }

/* ═══════ توقيع المطوّر ═══════ */
.sig-wrap { text-align: center; padding: 14px 0 4px; }
.sig-wrap img { height: 52px; margin: 0 auto; opacity: 0.5; filter: brightness(0) saturate(100%) invert(21%) sepia(46%) saturate(1200%) hue-rotate(315deg); }
.footer .sig-wrap img { filter: brightness(0) invert(1); opacity: 0.45; }
@media print { .feedback-fab, .feedback-overlay { display: none !important; } }

/* ═══════ هيكل تحميل التبويبات (العرض التدريجي) ═══════ */
.pane-skeleton { padding: 18px 4px; }
.pane-skeleton .sk-line {
  height: 14px;
  border-radius: 7px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, #FFFFFF 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: eduShimmer 1.4s infinite;
}
.pane-skeleton .sk-line.w60 { width: 60%; }
.pane-skeleton .sk-line.w85 { width: 85%; }
.pane-skeleton .sk-line.w45 { width: 45%; }
.pane-skeleton .sk-label { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 18px; }

/* بطاقة الرسم التعليمي المولّد — ملصق عمودي يستحق مساحة أكبر */
.edu-diagram-card img { max-height: 560px; background: #FFFFFF; }
.edu-diagram-card .edu-src { color: var(--gold-dark, #A8863A); font-weight: 700; }

/* معادلات KaTeX داخل الشرح — الرياضيات دائماً LTR حتى داخل صفحة عربية */
.md-content .katex { font-size: 1.06em; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.md-content .katex-display { margin: 16px 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; direction: ltr; unicode-bidi: isolate; }
