.progress-bar {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 100;
  height: 4px;
  width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
}

.chapter-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: end;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 86px 0 42px;
}

.chapter-content {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 24%, transparent), color-mix(in srgb, var(--brand-2) 18%, transparent)),
    var(--surface);
  padding: clamp(28px, 5vw, 56px);
  box-shadow: var(--shadow);
}

.chapter-content h1 {
  margin-bottom: 18px;
  font-size: clamp(3rem, 7vw, 6.2rem);
}

.hero-description {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.16rem;
  line-height: 1.75;
}

.chapter-stats {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.chapter-stats div {
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 18px;
}

.chapter-stats strong,
.chapter-stats span { display: block; }
.chapter-stats strong { color: var(--accent); font-size: 1.6rem; }
.chapter-stats span { color: var(--muted); }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 34px;
  color: var(--muted);
}

.breadcrumb a { color: var(--brand-2); font-weight: 800; }

.notes-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 30px;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

.toc {
  position: sticky;
  top: 104px;
  align-self: start;
  display: grid;
  gap: 6px;
  max-height: calc(100svh - 128px);
  overflow: auto;
  padding: 16px;
}

.toc h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.toc a {
  border-radius: var(--radius);
  color: var(--muted);
  padding: 9px 10px;
}

.toc a:hover,
.toc a.active {
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  color: var(--text);
}

.notes-article {
  min-width: 0;
}

.note-section {
  padding: 0 0 74px;
}

.note-section h2 {
  margin-bottom: 22px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.content-card,
.definition-box,
.table-wrap,
.summary-box,
.quiz-container {
  padding: clamp(20px, 3vw, 30px);
}

.content-card p,
.definition-box p,
.tip-box p,
.exam-box p,
.faq-answer p {
  color: var(--muted);
  line-height: 1.75;
}

.info-box,
.exam-box,
.tip-box {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  padding: 18px;
}

.tip-box.neet { border-left-color: var(--brand-2); }
.danger { border-left: 5px solid var(--danger); }

.notes-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

.notes-table th,
.notes-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px;
  text-align: left;
  vertical-align: top;
}

.notes-table th {
  background: color-mix(in srgb, var(--brand) 22%, var(--surface));
}

.notes-table td:first-child {
  color: var(--text);
  font-weight: 800;
}

.concept-grid,
.organism-grid,
.two-column,
.pdf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.organism-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pdf-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.concept-card,
.organism-card,
.pdf-card {
  padding: 22px;
}

.concept-card h3,
.organism-card h3,
.pdf-card h3 {
  margin-bottom: 10px;
  font-size: 1.25rem;
}

.concept-card p,
.organism-card p,
.pdf-card p {
  color: var(--muted);
  line-height: 1.65;
}

.pdf-card span {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.pdf-card .button {
  margin-top: 10px;
}

.organism-card img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: contain;
  margin-bottom: 16px;
  cursor: zoom-in;
}

.organism-card img.zoom { transform: scale(1.35); }

.check-list {
  display: grid;
  gap: 12px;
  list-style: none;
  padding-left: 0;
}

.check-list li {
  position: relative;
  padding-left: 28px;
}

.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--brand);
  font-weight: 900;
}

.faq {
  display: grid;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 18px;
  text-align: left;
  font-weight: 800;
}

.faq-answer {
  display: none;
  padding: 0 18px 18px;
}

.faq-item.open .faq-answer { display: block; }

.quiz-container { margin-top: 24px; }
#quiz-progress { color: var(--brand); font-weight: 900; margin-bottom: 16px; }
#question { font-size: 1.35rem; }

.options {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.option {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  padding: 16px;
  text-align: left;
}

.option:hover { border-color: var(--brand-2); }
.option.correct { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
.option.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 18%, var(--surface)); }
.option.disabled { pointer-events: none; opacity: 0.86; }

.feedback {
  display: none;
  border-radius: var(--radius);
  padding: 16px;
  line-height: 1.7;
}

.feedback.correct,
.feedback.wrong { display: block; }
.feedback.correct { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.feedback.wrong { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }

.quiz-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

#scoreBoard {
  margin-top: 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
  text-align: center;
  font-weight: 900;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 30px 0 70px;
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .chapter-hero,
  .notes-layout { grid-template-columns: 1fr; }
  .toc {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    max-height: none;
  }
  .organism-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .chapter-hero,
  .notes-layout,
  .breadcrumb { width: min(100% - 24px, var(--max)); }
  .concept-grid,
  .organism-grid,
  .two-column,
  .pdf-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
  .quiz-buttons,
  .chapter-nav { flex-direction: column; }
}

@media print {
  .topbar,
  .toc,
  .hero-actions,
  .quiz-container,
  .chapter-nav,
  .back-to-top,
  .progress-bar { display: none !important; }
  body { background: #fff; color: #000; }
  .chapter-hero,
  .notes-layout { display: block; width: 100%; }
  .glass,
  .chapter-content {
    border: 1px solid #ddd;
    box-shadow: none;
    background: #fff;
  }
}