/* =====================================================
   ۱. متغیرها و تنظیمات پایه
   ===================================================== */
:root {
  --ink: #0b1220;            /* سرمه‌ای تیره (پس‌زمینه هدر، هیرو، فوتر) */
  --ink-2: #111a2e;
  --brand: #6366f1;          /* بنفش-آبی اصلی */
  --brand-2: #14b8a6;        /* سبزآبی ثانویه */
  --bg: #f6f7fb;             /* پس‌زمینه بخش‌های روشن */
  --white: #ffffff;
  --text: #1b2438;
  --muted: #667085;
  --line: #e6e8f0;
  --radius: 20px;
  --grad: linear-gradient(135deg, #6366f1, #14b8a6);
  --shadow: 0 18px 45px rgba(30, 41, 90, 0.12);
}

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

html {
  scroll-behavior: smooth;    /* اسکرول نرم هنگام کلیک روی لینک‌ها */
  scroll-padding-top: 80px;   /* جلوگیری از پنهان شدن عنوان زیر هدر ثابت */
}

body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

.container { width: min(1140px, 92%); margin: 0 auto; }
.container.narrow { width: min(820px, 92%); }

/* آیکن‌های SVG */
.ico {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* =====================================================
   ۲. دکمه‌ها
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .25s, box-shadow .25s, background .25s;
}
.btn:hover { transform: translateY(-3px); }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 12px 30px rgba(99, 102, 241, .45);
}
.btn-primary:hover { box-shadow: 0 16px 38px rgba(99, 102, 241, .6); }

.btn-ghost {
  color: #e5e9f5;
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .05);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }

.btn-glow {
  background: var(--grad);
  color: #fff;
  padding: 9px 22px;
  font-size: .95rem;
}

.btn-white { background: #fff; color: var(--brand); }

/* =====================================================
   ۳. هدر
   ===================================================== */
.site-header {
  position: sticky;               /* هدر هنگام اسکرول بالای صفحه می‌ماند */
  top: 0;
  z-index: 100;
  background: rgba(11, 18, 32, .94);
  backdrop-filter: blur(14px);    /* حالت شیشه‌ای */
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  transition: box-shadow .3s, background .3s;
}
/* کلاس scrolled را جاوااسکریپت اضافه می‌کند */
.site-header.scrolled {
  background: rgba(11, 18, 32, .92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 0;
}

.logo { display: flex; align-items: center; gap: 10px; color: #fff; }
.logo-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  background: var(--grad);
  border-radius: 12px;
  font-weight: 800;
  font-size: 1rem;
  font-family: "Segoe UI", Arial, sans-serif;
}
.logo-text { font-size: 1.3rem; font-weight: 800; }

.nav { display: flex; gap: 6px; margin-inline-start: auto; }
.nav a {
  color: #b9c2d9;
  font-weight: 500;
  font-size: .95rem;
  padding: 6px 14px;
  border-radius: 10px;
  transition: color .2s, background .2s;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }

/* دکمه همبرگری و چک‌باکس منوی موبایل (در دسکتاپ مخفی) */
.menu-toggle, .burger { display: none; }

/* =====================================================
   ۴. بخش اصلی (Hero)
   ===================================================== */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 100px 0 120px;
  border-radius: 0 0 48px 48px;
  /* دو درخشش رنگی روی زمینه تیره */
  background:
    radial-gradient(55% 60% at 85% 10%, rgba(99, 102, 241, .38), transparent 60%),
    radial-gradient(45% 50% at 8% 95%, rgba(20, 184, 166, .28), transparent 60%),
    var(--ink);
}
/* الگوی شبکه‌ای محو در پس‌زمینه */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 50px;
  align-items: center;
}

.pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 18px;
  border-radius: 50px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: .9rem;
  color: #d5dcf0;
}
.dot {
  width: 9px; height: 9px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70%  { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero h1 {
  font-size: 3.1rem;
  font-weight: 800;
  line-height: 1.55;
  margin: 22px 0 18px;
}
/* متن گرادیانی */
.grad {
  background: linear-gradient(90deg, #a5b4fc, #5eead4);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.lead { color: #aab4cd; font-size: 1.1rem; max-width: 520px; }

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 32px; }

.hero-stats {
  display: flex; gap: 38px;
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, .1);
}
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.7rem; font-weight: 800; line-height: 1.3; }
.hero-stats span { color: #94a0bd; font-size: .9rem; }

/* ----- پنجره کد ----- */
.hero-visual { position: relative; }

.code-card {
  direction: ltr;                     /* کد همیشه چپ‌به‌راست */
  background: #0f1830;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .5);
  overflow: hidden;
  transform: perspective(900px) rotateY(-6deg) rotateX(3deg);
  transition: transform .5s;
}
.code-card:hover { transform: perspective(900px) rotateY(0) rotateX(0); }

.code-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px;
  background: #16213a;
}
.code-bar i { width: 12px; height: 12px; border-radius: 50%; background: #ef4444; }
.code-bar i:nth-child(2) { background: #f59e0b; }
.code-bar i:nth-child(3) { background: #22c55e; }
.code-bar span { margin-left: auto; color: #7d8aa8; font-size: .85rem; font-family: Consolas, monospace; }

.code-card pre {
  padding: 24px 26px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 1rem;
  line-height: 2;
  color: #dbe3f7;
}
.c-cmt { color: #6b7a99; }
.c-key { color: #c4a8ff; }
.c-fn  { color: #67e8f9; }
.c-str { color: #86efac; }
.c-num { color: #fbbf77; }
.c-var { color: #f9a8d4; }

/* ----- کارت‌های شناور ----- */
.chip {
  position: absolute;
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .95);
  color: var(--text);
  font-size: .9rem;
  font-weight: 700;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  animation: float 5s ease-in-out infinite;
}
.chip-1 { top: -22px; right: -14px; }
.chip-2 { bottom: -22px; left: -14px; animation-delay: 2s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* =====================================================
   ۵. بخش‌های عمومی و عنوان‌ها
   ===================================================== */
.section { padding: 100px 0; }
.section-white { background: var(--white); }

.section-head { text-align: center; max-width: 620px; margin: 0 auto 56px; }
.eyebrow {
  display: inline-block;
  color: var(--brand);
  background: rgba(99, 102, 241, .1);
  padding: 4px 16px;
  border-radius: 50px;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 14px;
}
.section-head h2 { font-size: 2.1rem; font-weight: 800; line-height: 1.6; }
.section-head p { color: var(--muted); margin-top: 8px; }

/* =====================================================
   ۶. ویژگی‌ها
   ===================================================== */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

.feature {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 28px;
  transition: transform .3s, box-shadow .3s, border-color .3s;
}
.feature:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow);
  border-color: rgba(99, 102, 241, .35);
}
.feature-icon {
  display: grid; place-items: center;
  width: 58px; height: 58px;
  background: var(--grad);
  color: #fff;
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 10px 24px rgba(99, 102, 241, .35);
}
.feature-icon .ico { width: 28px; height: 28px; }
.feature h3 { font-size: 1.15rem; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .95rem; }

/* =====================================================
   ۷. مسیر یادگیری (تایم‌لاین)
   ===================================================== */
.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}
/* خط اتصال بین دایره‌ها */
.steps::before {
  content: "";
  position: absolute;
  top: 30px; right: 12%; left: 12%;
  border-top: 2px dashed #c9cff0;
}
.step { position: relative; }
.step-num {
  position: relative;
  display: grid; place-items: center;
  width: 62px; height: 62px;
  margin: 0 auto 18px;
  background: var(--grad);
  color: #fff;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 800;
  border: 5px solid var(--white);
  box-shadow: 0 10px 26px rgba(99, 102, 241, .4);
}
.step h3 { font-size: 1.1rem; }
.step p { color: var(--muted); font-size: .92rem; }

/* =====================================================
   ۸. کارت دوره‌ها
   ===================================================== */
.courses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }

.course {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .3s, box-shadow .3s;
}
.course:hover { transform: translateY(-8px); box-shadow: var(--shadow); }

/* تصویر کاور با گرادیان (بدون نیاز به فایل عکس) */
.course-thumb {
  height: 170px;
  display: grid; place-items: center;
  color: rgba(255, 255, 255, .95);
  font-family: Consolas, monospace;
  font-size: 3.4rem;
  font-weight: 700;
  direction: ltr;
  transition: transform .5s;
}
.course:hover .course-thumb span { transform: scale(1.15); }
.course-thumb span { transition: transform .4s; }
.t1 { background: linear-gradient(135deg, #6366f1, #22d3ee); }
.t2 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.t3 { background: linear-gradient(135deg, #10b981, #3b82f6); }

.course-body { padding: 24px 26px 28px; }
.course-tags { display: flex; gap: 8px; margin-bottom: 12px; }
.tag {
  font-size: .78rem; font-weight: 700;
  padding: 2px 12px;
  border-radius: 50px;
  background: #eef0fb; color: var(--brand);
}
.tag-green { background: #dcfce7; color: #15803d; }
.tag-amber { background: #fef3c7; color: #b45309; }
.tag-red   { background: #fee2e2; color: #b91c1c; }

.course h3 { font-size: 1.2rem; margin-bottom: 4px; }
.course p { color: var(--muted); font-size: .93rem; }
.course-meta {
  display: flex; gap: 20px;
  margin: 16px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: .9rem;
}
.link-arrow { color: var(--brand); font-weight: 700; }
.link-arrow span { display: inline-block; transition: transform .25s; }
.link-arrow:hover span { transform: translateX(-6px); }

/* =====================================================
   ۹. نوار آمار
   ===================================================== */
.stats-band {
  background: linear-gradient(135deg, #1e1b4b, #0f3d3e);
  color: #fff;
  padding: 70px 0;
}
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; text-align: center; }
.stat strong { display: block; font-size: 2.8rem; font-weight: 800; line-height: 1.4; }
.stat > span { color: #b4c0dd; }

/* =====================================================
   ۱۰. سؤالات متداول (آکاردئون)
   ===================================================== */
.faq { display: grid; gap: 14px; }
.faq details {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 24px;
  transition: border-color .3s, box-shadow .3s;
}
.faq details[open] { border-color: rgba(99, 102, 241, .4); box-shadow: var(--shadow); }
.faq summary {
  list-style: none;                 /* حذف فلش پیش‌فرض مرورگر */
  cursor: pointer;
  padding: 20px 0;
  font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {             /* علامت + که هنگام باز شدن می‌چرخد */
  content: "+";
  font-size: 1.6rem;
  color: var(--brand);
  transition: transform .3s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { color: var(--muted); padding-bottom: 20px; }

/* =====================================================
   ۱۱. بخش دعوت به اقدام
   ===================================================== */
.cta-wrap { padding: 0 0 100px; }
.cta {
  text-align: center;
  color: #fff;
  background: var(--grad);
  border-radius: 32px;
  padding: 70px 24px;
  position: relative;
  overflow: hidden;
}
.cta::before {                      /* دایره تزئینی */
  content: "";
  position: absolute;
  width: 380px; height: 380px;
  top: -190px; left: -120px;
  background: rgba(255, 255, 255, .14);
  border-radius: 50%;
}
.cta h2 { position: relative; font-size: 2.2rem; font-weight: 800; }
.cta p { position: relative; margin: 10px 0 28px; opacity: .92; }
.cta .btn { position: relative; }

/* =====================================================
   ۱۲. فوتر
   ===================================================== */
.site-footer { background: var(--ink); color: #aab4cd; padding-top: 70px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 40px;
  padding-bottom: 50px;
}
.footer-brand p { margin-top: 16px; font-size: .93rem; max-width: 340px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; font-size: .93rem; }
.footer-col h4 { color: #fff; margin-bottom: 6px; font-size: 1.05rem; }
.footer-col a { transition: color .2s, transform .2s; }
.footer-col a:hover { color: #fff; transform: translateX(-4px); }
.to-top { color: #a5b4fc; margin-top: 6px; }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 20px 0;
  text-align: center;
  font-size: .9rem;
}

/* =====================================================
   ۱۳. انیمیشن ظاهر شدن هنگام اسکرول
   (کلاس js را جاوااسکریپت اضافه می‌کند؛ اگر JS کار نکند، محتوا همیشه دیده می‌شود)
   ===================================================== */
.js .reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity .7s ease, transform .7s ease;
  transition-delay: var(--d, 0s);
}
.js .reveal.show { opacity: 1; transform: none; }

/* احترام به کاربرانی که انیمیشن را در سیستم‌شان خاموش کرده‌اند */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* =====================================================
   ۱۴. واکنش‌گرایی (تبلت و موبایل)
   ===================================================== */
@media (max-width: 1000px) {
  .features, .courses { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 2.5rem; }
}

@media (max-width: 800px) {
  .hero { padding: 70px 0 90px; border-radius: 0 0 32px 32px; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { max-width: 460px; margin: 0 auto; }
  .code-card { transform: none; }
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 40px; }
  .steps::before { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); row-gap: 36px; }

  /* منوی موبایل */
  .burger {
    display: flex; flex-direction: column; gap: 5px;
    margin-inline-start: auto;
    cursor: pointer; padding: 6px;
  }
  .burger span { width: 24px; height: 2.5px; background: #fff; border-radius: 3px; }

  .nav {
    display: none;
    position: absolute;
    top: 100%; right: 0; left: 0;
    flex-direction: column;
    gap: 2px;
    padding: 14px 4%;
    background: var(--ink-2);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }
  .nav a { padding: 12px 14px; }
  .menu-toggle:checked ~ .nav { display: flex; }
}

@media (max-width: 560px) {
  .section { padding: 70px 0; }
  .features, .courses, .footer-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .hero-stats { gap: 22px; }
  .section-head h2 { font-size: 1.7rem; }
  .cta h2 { font-size: 1.7rem; }
  .chip-1 { right: 0; }
  .chip-2 { left: 0; }
}

/* =====================================================
   ۱۵. هدر: بخش ورود و خروج
   (نمایش یکی از دو حالت با کلاس logged-in روی تگ html کنترل می‌شود)
   ===================================================== */
.nav { align-items: center; }
.nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .1); }

/* دکمه‌های داخل منو: رنگ و اندازه خودشان را نگه دارند (قاعده .nav a قوی‌تر است) */
.nav a.btn { padding: 7px 18px; border-radius: 12px; }
.nav a.btn-glow, .nav a.btn-glow:hover { color: #fff; background: var(--grad); }
.nav a.btn-ghost { color: #e5e9f5; }
.nav a.btn-ghost:hover { background: rgba(255, 255, 255, .14); color: #fff; }

.auth-box { display: flex; align-items: center; margin-inline-start: 10px; }
.auth-in, .auth-out { display: flex; align-items: center; gap: 10px; }
.auth-in { display: none; }                           /* پیش‌فرض: کسی وارد نشده */
html.logged-in .auth-in { display: flex; }            /* وارد شده: نام و خروج */
html.logged-in .auth-out { display: none; }           /* وارد شده: ورود و ثبت‌نام پنهان */

.user-chip {
  color: #e5e9f5;
  font-size: .92rem;
  background: rgba(255, 255, 255, .08);
  padding: 4px 16px;
  border-radius: 50px;
  white-space: nowrap;
}

.btn-sm { padding: 7px 18px; font-size: .9rem; border-radius: 12px; }
.btn-light { background: #eef0fb; color: var(--brand); }
.btn-light:hover { background: #e1e5f8; }
.btn-outline-white { color: #fff; border-color: rgba(255, 255, 255, .6); }
.btn-outline-white:hover { background: rgba(255, 255, 255, .15); }
.btn-block { width: 100%; justify-content: center; }
.cta .btn + .btn { margin-inline-start: 10px; }

.hidden { display: none !important; }

/* =====================================================
   ۱۶. بالای صفحه‌های داخلی (Page Hero) و مسیر صفحه
   ===================================================== */
.page-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 70px 0 80px;
  border-radius: 0 0 40px 40px;
  background:
    radial-gradient(50% 70% at 90% 0%, rgba(99, 102, 241, .38), transparent 60%),
    radial-gradient(40% 60% at 5% 100%, rgba(20, 184, 166, .28), transparent 60%),
    var(--ink);
}
.page-hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.page-hero .container { position: relative; }
.page-hero h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.5; }
.page-hero p { color: #aab4cd; max-width: 620px; margin-top: 8px; }

.crumbs { display: flex; gap: 10px; color: #94a0bd; font-size: .9rem; margin-bottom: 14px; }
.crumbs a:hover { color: #fff; }

.meta-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.meta-chips span {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  padding: 4px 16px;
  border-radius: 50px;
  font-size: .88rem;
  color: #d5dcf0;
}

.section-tight { padding: 70px 0 100px; }

.info-card {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  margin-top: 40px;
  padding: 30px 34px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.info-card h3 { font-size: 1.2rem; }
.info-card p { color: var(--muted); }

/* =====================================================
   ۱۷. صفحه دوره: لیست درس‌ها و تب‌ها (فقط با CSS)
   هر درس یک دکمه رادیویی مخفی دارد؛ درس انتخاب‌شده نمایش داده می‌شود.
   ===================================================== */
.lesson-tabs {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 28px;
  align-items: start;
}
.lesson-tabs > input { display: none; }

.lesson-list {
  position: sticky; top: 90px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.lesson-list h3 { font-size: .95rem; color: var(--muted); padding: 6px 10px 8px; }
.lesson-list label {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 500;
  line-height: 1.7;
  transition: background .25s, color .25s;
}
.lesson-list label:hover { background: #f1f2fb; }
.lesson-list label b {
  display: grid; place-items: center; flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #eef0fb; color: var(--brand);
  font-size: .85rem;
}

/* همه درس‌ها پنهان، فقط درس انتخاب‌شده دیده می‌شود */
.lesson-panels { min-width: 0; }   /* اجازه می‌دهد کد بلند اسکرول شود و صفحه را عریض نکند */
.lesson-panel { display: none; }

#t1:checked ~ .lesson-panels #p1,
#t2:checked ~ .lesson-panels #p2,
#t3:checked ~ .lesson-panels #p3,
#t4:checked ~ .lesson-panels #p4 {
  display: block;
  animation: fadeIn .5s;
}

/* برچسب درس فعال رنگی می‌شود */
#t1:checked ~ .lesson-list label[for="t1"],
#t2:checked ~ .lesson-list label[for="t2"],
#t3:checked ~ .lesson-list label[for="t3"],
#t4:checked ~ .lesson-list label[for="t4"] {
  background: var(--grad);
  color: #fff;
}
#t1:checked ~ .lesson-list label[for="t1"] b,
#t2:checked ~ .lesson-list label[for="t2"] b,
#t3:checked ~ .lesson-list label[for="t3"] b,
#t4:checked ~ .lesson-list label[for="t4"] b {
  background: rgba(255, 255, 255, .25);
  color: #fff;
}

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

.lesson-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.lesson-card h2 { font-size: 1.5rem; margin: 24px 0 8px; }
.lesson-card > p { color: var(--muted); }

/* ویدیو با نسبت ۱۶ به ۹ */
.video-box {
  position: relative;
  padding-bottom: 56.25%; height: 0;
  border-radius: 14px; overflow: hidden;
  background: #0f172a;
}
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.points { display: grid; gap: 8px; margin-top: 16px; }
.points li { position: relative; padding-inline-start: 28px; }
.points li::before {
  content: "✓";
  position: absolute; inset-inline-start: 0;
  color: #10b981; font-weight: 800;
}

.code-block {
  direction: ltr; text-align: left;
  margin-top: 18px;
  padding: 18px 20px;
  background: #0f1830;
  color: #dbe3f7;
  border-radius: 14px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: .95rem;
  line-height: 1.9;
}

.tip {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #fff8e1;
  border: 1px solid #fde8a6;
  color: #7a5b00;
}

.lesson-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

/* =====================================================
   ۱۸. صفحه ورود و ثبت‌نام
   ===================================================== */
.auth-page {
  display: grid; place-items: center;
  padding: 70px 0;
  background:
    radial-gradient(45% 50% at 85% 10%, rgba(99, 102, 241, .16), transparent 60%),
    radial-gradient(40% 50% at 10% 90%, rgba(20, 184, 166, .16), transparent 60%),
    var(--bg);
}
.auth-card {
  display: grid; grid-template-columns: 1fr 1fr;
  width: min(940px, 92%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(30, 41, 90, .18);
}
.auth-side {
  display: flex; flex-direction: column; justify-content: center;
  padding: 50px 40px;
  color: #fff;
  background:
    radial-gradient(70% 60% at 100% 0%, rgba(99, 102, 241, .55), transparent 65%),
    radial-gradient(60% 60% at 0% 100%, rgba(20, 184, 166, .45), transparent 65%),
    var(--ink);
}
.auth-side h2 { font-size: 1.7rem; font-weight: 800; line-height: 1.6; margin-bottom: 10px; }
.auth-side p { color: #b4bfd8; }
.auth-side ul { margin-top: 24px; display: grid; gap: 10px; color: #d5dcf0; }
.auth-side li::before { content: "✓"; color: #5eead4; font-weight: 800; margin-inline-end: 10px; }

.auth-form { padding: 50px 44px; }
.auth-form h1 { font-size: 1.8rem; font-weight: 800; }
.auth-form .sub { color: var(--muted); margin: 4px 0 26px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #f9fafe;
  font-family: inherit; font-size: 1rem; color: var(--text);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .15);
}
/* اعتبارسنجی بصری با CSS: بعد از شروع تایپ، قرمز یا سبز می‌شود */
.field input:not(:placeholder-shown):invalid { border-color: #ef4444; }
.field input:not(:placeholder-shown):valid { border-color: #10b981; }
.field input[dir="ltr"] { text-align: left; }
.field small { display: block; margin-top: 4px; color: var(--muted); font-size: .82rem; }

.form-msg { margin-bottom: 14px; padding: 10px 14px; border-radius: 12px; font-size: .92rem; }
.form-msg:empty { display: none; }
.form-msg.error { background: #fee2e2; color: #b91c1c; }
.form-msg.success { background: #dcfce7; color: #166534; }

.switch-link { text-align: center; margin-top: 20px; color: var(--muted); }
.switch-link a { color: var(--brand); font-weight: 700; }

/* =====================================================
   ۱۹. صفحه آزمون
   ===================================================== */
/* آزمون برای همه نمایش داده می‌شود (ورود الزامی نیست) */

.quiz-card, .lock-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 40px;
  box-shadow: var(--shadow);
}
.lock-card { text-align: center; }
.lock-card .big, .quiz-intro .big { font-size: 3.2rem; line-height: 1.4; }
.lock-card h2, .quiz-intro h2 { font-size: 1.5rem; margin: 6px 0; }
.lock-card p, .quiz-intro p { color: var(--muted); }
.lock-actions, .result-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.quiz-intro { text-align: center; }
.quiz-facts { display: flex; justify-content: center; gap: 36px; flex-wrap: wrap; margin: 24px 0 8px; }
.quiz-facts div { display: flex; flex-direction: column; }
.quiz-facts strong { font-size: 1.7rem; color: var(--brand); line-height: 1.4; }
.quiz-facts span { color: var(--muted); font-size: .9rem; }
.best-score {
  display: inline-block;
  margin: 18px 0 24px;
  padding: 6px 18px;
  border-radius: 50px;
  background: #eef0fb; color: var(--brand);
  font-weight: 700; font-size: .92rem;
}

.progress { height: 10px; background: #eef0fb; border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--grad); transition: width .4s; }
.quiz-count { color: var(--muted); font-size: .9rem; margin: 10px 0 18px; }
.q-title { font-size: 1.25rem; font-weight: 700; line-height: 1.8; }

#questionCode { margin: 14px 0 0; }

.options { display: grid; gap: 12px; margin: 22px 0; }
.option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 14px;
  font-family: inherit; font-size: 1rem; color: var(--text);
  text-align: start;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}
.option:hover:not(:disabled) { border-color: var(--brand); background: #eef0fb; transform: translateX(-4px); }
.option:disabled { cursor: default; }
.option b {
  display: grid; place-items: center; flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #e1e5f8; color: var(--brand);
  font-size: .9rem;
}
.option.correct { background: #dcfce7; border-color: #22c55e; }
.option.wrong { background: #fee2e2; border-color: #ef4444; }

.explain {
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #eef2ff; color: #3730a3;
}

/* دایره نتیجه: با conic-gradient و متغیر --p (درصد) پر می‌شود */
.quiz-result { text-align: center; }
.ring {
  --p: 0;
  display: grid; place-items: center;
  width: 170px; height: 170px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), #e6e8f0 0);
}
.ring span {
  display: grid; place-items: center;
  width: 136px; height: 136px;
  border-radius: 50%;
  background: #fff;
  font-size: 2.2rem; font-weight: 800; color: var(--brand);
}
.quiz-result h2 { font-size: 1.5rem; }
.quiz-result p { color: var(--muted); }

/* =====================================================
   ۲۰. واکنش‌گرایی بخش‌های جدید
   ===================================================== */
@media (max-width: 900px) {
  .lesson-tabs { grid-template-columns: 1fr; }
  .lesson-list { position: static; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

@media (max-width: 800px) {
  .nav { align-items: stretch; }
  .auth-box { margin: 10px 0 0; }
  .nav .auth-in, .nav .auth-out { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .page-hero { padding: 50px 0 60px; border-radius: 0 0 28px 28px; }
  .page-hero h1 { font-size: 1.9rem; }
  .quiz-card, .lock-card { padding: 26px 20px; }
  .auth-form { padding: 36px 24px; }
  .lesson-card { padding: 18px; }
  .cta .btn + .btn { margin: 10px 0 0; }
}
