:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #182232;
  --muted: #5f6d7c;
  --brand: #1d4ed8;
  --brand2: #0f766e;
  --soft: #eaf1ff;
  --soft2: #ecfdf5;
  --line: #dbe4ef;
  --danger: #b42318;
  --ok: #177245;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  direction: rtl;
  background: linear-gradient(180deg, var(--bg) 0%, #eef8f5 100%);
  color: var(--ink);
  line-height: 1.9;
}

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

.container {
  width: min(1120px, 92%);
  margin: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--brand);
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: white;
  display: grid;
  place-items: center;
  font-family: Arial, sans-serif;
  font-weight: 800;
}

.navlinks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.navlinks a {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand);
  font-size: 14px;
}

.hero {
  padding: 58px 0 36px;
}

.hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #edf4ff 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px;
  box-shadow: 0 18px 50px rgba(29, 78, 216, 0.12);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
}

h1 {
  font-size: clamp(32px, 5vw, 54px);
  margin: 16px 0 12px;
  line-height: 1.45;
}

h2 {
  font-size: clamp(24px, 3vw, 34px);
  margin: 34px 0 12px;
  color: #1e3a8a;
}

h3 {
  font-size: 22px;
  margin: 18px 0 10px;
  color: var(--brand);
}

p {
  font-size: 18px;
  margin: 0 0 12px;
}

.lead {
  font-size: 21px;
  color: var(--muted);
}

.hero-img,
.topic-visual {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  display: grid;
  place-items: center;
  padding: 24px;
}

.hero-img {
  min-height: 260px;
}

.hero-img img,
.topic-visual img {
  max-width: 100%;
  height: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin: 28px 0 50px;
}

.card,
.content,
.sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.05);
}

.card {
  border-radius: 24px;
  padding: 22px;
  transition: 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(29, 78, 216, 0.14);
}

.topic-num {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-family: Arial, sans-serif;
  font-weight: 800;
  margin-bottom: 12px;
}

.card h2 {
  font-size: 22px;
  margin: 0 0 8px;
}

.card p {
  font-size: 16px;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.btn.secondary {
  background: var(--soft);
  color: var(--brand);
  border: 1px solid var(--line);
}

.topic-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  margin: 28px 0 50px;
}

.sidebar {
  position: sticky;
  top: 82px;
  align-self: start;
  border-radius: 22px;
  padding: 18px;
}

.sidebar a {
  display: block;
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 15px;
}

.sidebar a:hover {
  background: var(--soft);
  color: var(--brand);
}

.content {
  border-radius: 28px;
  padding: 30px;
}

.topic-head {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
  margin-bottom: 20px;
}

.topic-visual {
  background: var(--soft);
}

.info-box,
.key-box,
.quiz-box,
.example-box,
.warning-box {
  border-radius: 22px;
  padding: 20px;
  margin: 22px 0;
  border: 1px solid var(--line);
}

.info-box,
.example-box {
  background: #f8fbff;
}

.key-box {
  background: var(--soft2);
}

.quiz-box {
  background: #f4fbf6;
}

.warning-box {
  background: #fff7ed;
}

ul,
ol {
  padding-right: 24px;
  margin-top: 8px;
}

li {
  margin: 8px 0;
  font-size: 17px;
}

.section {
  padding: 10px 0 4px;
  border-bottom: 1px dashed #dbe5ee;
}

.section:last-child {
  border-bottom: 0;
}

.flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.flow div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  font-weight: 800;
}

.quiz-question {
  margin: 18px 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.quiz-options {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.option {
  width: 100%;
  text-align: right;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
}

.option.correct {
  border-color: var(--ok);
  background: #ecfdf3;
  color: var(--ok);
}

.option.wrong {
  border-color: var(--danger);
  background: #fff1f0;
  color: var(--danger);
}

.feedback {
  font-weight: 700;
  margin-top: 8px;
  min-height: 28px;
}

.footer {
  margin-top: 50px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}

.progress {
  height: 8px;
  background: #e1eaf2;
  border-radius: 999px;
  overflow: hidden;
  margin: 18px 0 0;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  width: 0%;
}

.nextprev {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.note {
  background: #fff7e9;
  border: 1px solid #efd7ad;
  border-radius: 18px;
  padding: 16px;
  margin: 18px 0;
}

@media (max-width: 900px) {
  .hero-card,
  .topic-head,
  .topic-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .grid,
  .flow {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .grid,
  .flow {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .content {
    padding: 22px;
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .navlinks a {
    font-size: 13px;
  }

  p {
    font-size: 16px;
  }

  .lead {
    font-size: 18px;
  }
}
