.lecture-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  padding-top: var(--lecture-header-offset, 120px);
  box-sizing: border-box;
}

.lecture-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 6vw;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel-2);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.lecture-topbar > .brand-lockup {
  order: 1;
  flex: 0 0 auto;
  padding-right: 0;
  margin-right: 0;
  border-right: none;
}

.lecture-topbar .brand-logo {
  height: 26px;
  max-height: 26px;
  max-width: 120px;
}

.lecture-topbar .topbar-search {
  order: 2;
  flex: 1 1 0%;
  width: auto;
  max-width: none;
  min-width: 0;
}

.lecture-topbar .theme-toggle,
.lecture-topbar-actions {
  order: 3;
  flex: 0 0 auto;
  margin-left: 0;
}

.lecture-topbar-left {
  order: 4;
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: nowrap;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.lecture-footer {
  margin-top: auto;
  padding: 22px 6vw 36px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel-2);
  font-family: var(--mono);
}

.lecture-back {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.lecture-back:hover {
  border-color: var(--blue);
  color: var(--ink);
}

.lecture-crumb {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.lecture-crumb a {
  color: var(--ink-dim);
  text-decoration: none;
}

.lecture-crumb a:hover {
  color: var(--blue);
}

.lecture-crumb span {
  margin: 0 6px;
}

.lecture-main {
  flex: 1;
  width: 100%;
  max-width: none;
  padding: 36px 6vw 80px;
  box-sizing: border-box;
}

.lecture-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.lecture-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  border: 1px solid var(--grid-line-strong);
  padding: 4px 9px;
  border-radius: 2px;
}

.lecture-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.lecture-subtitle {
  color: var(--ink-dim);
  font-size: 15px;
  max-width: none;
  margin: 0 0 28px;
}

.lecture-body {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel);
  padding: 28px 32px;
  width: 100%;
  box-sizing: border-box;
}

.lecture-body h2 {
  font-family: var(--display);
  font-size: 22px;
  margin: 32px 0 14px;
  color: var(--ink);
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.lecture-body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.lecture-body h3 {
  font-family: var(--display);
  font-size: 17px;
  margin: 22px 0 10px;
  color: var(--ink);
}

.lecture-body h4 {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 18px 0 8px;
  color: var(--blue);
}

.lecture-body p {
  color: var(--ink-dim);
  font-size: 15.5px;
  line-height: 1.75;
  margin: 0 0 14px;
}

.lecture-body ul,
.lecture-body ol {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--ink-dim);
  font-size: 15.5px;
  line-height: 1.7;
}

.lecture-body li {
  margin-bottom: 6px;
}

.lecture-body li::marker {
  color: var(--blue);
}

.lecture-body strong,
.lecture-body b {
  color: var(--ink);
  font-weight: 600;
}

.lecture-body hr,
.lesson-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 36px 0;
}

.lesson-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  border: 1px solid var(--grid-line-strong);
  padding: 5px 10px;
  border-radius: 3px;
  margin-bottom: 20px;
}

.module-intro {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel-2);
  margin-bottom: 28px;
}

.module-intro h2 {
  font-family: var(--display);
  font-size: 18px;
  margin: 0 0 10px;
  color: var(--ink);
  border: none;
  padding: 0;
}

.module-intro p:last-child {
  margin-bottom: 0;
}

.callout {
  border-radius: 6px;
  padding: 16px 18px;
  margin: 20px 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.callout-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px;
  font-weight: 600;
}

.callout p,
.callout li {
  color: var(--ink-dim);
}

.callout p:last-child,
.callout ul:last-child {
  margin-bottom: 0;
}

.callout-why {
  background: var(--amber-soft);
  border-left-color: var(--amber);
}
.callout-why .callout-title { color: var(--amber); }

.callout-trainer {
  background: rgba(160, 120, 220, 0.1);
  border-left-color: #a078dc;
}
.callout-trainer .callout-title { color: #a078dc; }
html[data-theme="light"] .callout-trainer {
  background: rgba(107, 70, 193, 0.08);
}
html[data-theme="light"] .callout-trainer .callout-title { color: #6b46c1; }
html[data-theme="light"] .callout {
  background: rgba(15, 23, 42, 0.02);
}

.callout-mistake {
  background: rgba(232, 100, 100, 0.1);
  border-left-color: #e86464;
}
.callout-mistake .callout-title { color: #e86464; }

.callout-remember {
  background: rgba(120, 140, 160, 0.12);
  border-left-color: var(--ink-faint);
}
.callout-remember .callout-title { color: var(--ink); }

.callout-definition {
  background: var(--blue-soft);
  border-left-color: var(--blue);
}
.callout-definition .callout-title { color: var(--blue); }

.callout-example {
  background: rgba(80, 190, 120, 0.1);
  border-left-color: #50be78;
}
.callout-example .callout-title { color: #50be78; }

.objectives-box {
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px 20px;
  margin: 20px 0;
}

.objectives-box h2,
.objectives-box h3 {
  margin-top: 0;
  border: none;
  padding: 0;
}

.timeline-era {
  margin: 18px 0;
  padding-left: 16px;
  border-left: 2px solid var(--grid-line-strong);
}

.timeline-era h3 {
  margin-top: 0;
}

.misconception {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel-2);
}

.misconception strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
  font-size: 14px;
}

.misconception p {
  margin: 0;
  font-size: 14px;
}

.knowledge-check ol {
  counter-reset: question;
  list-style: none;
  padding-left: 0;
}

.knowledge-check li {
  counter-increment: question;
  padding: 12px 14px 12px 42px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-panel-2);
  position: relative;
}

.knowledge-check li::before {
  content: counter(question);
  position: absolute;
  left: 12px;
  top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--blue);
  font-weight: 600;
}

/* ---------- Interactive lesson quiz ---------- */
.lecture-quiz {
  margin: 32px 0 28px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel-2);
}

.lecture-quiz-header h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: var(--ink);
  border: none;
  padding: 0;
}

.lecture-quiz-intro {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--ink-dim);
}

.lecture-quiz-form {
  margin: 0;
}

.lecture-quiz-question {
  margin: 0 0 18px;
  padding: 0;
  border: none;
  min-width: 0;
}

.lecture-quiz-question legend {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  margin-bottom: 10px;
  padding: 0;
}

.lecture-quiz-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.lecture-quiz-options {
  display: grid;
  gap: 8px;
}

.lecture-quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lecture-quiz-option:hover {
  border-color: var(--blue);
}

.lecture-quiz-option input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--brand);
}

.lecture-quiz-option-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-dim);
}

.lecture-quiz-option.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.lecture-quiz-option.is-correct {
  border-color: #059669;
  background: rgba(5, 150, 105, 0.12);
}

.lecture-quiz-option.is-correct .lecture-quiz-option-text {
  color: var(--ink);
}

.lecture-quiz-option.is-incorrect {
  border-color: #e86464;
  background: rgba(232, 100, 100, 0.1);
}

.lecture-quiz-option.is-muted {
  opacity: 0.72;
}

.lecture-quiz-explanation {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.lecture-quiz-explanation.is-correct {
  background: rgba(5, 150, 105, 0.1);
  color: var(--ink);
  border-left: 3px solid #059669;
}

.lecture-quiz-explanation.is-incorrect {
  background: rgba(232, 100, 100, 0.08);
  color: var(--ink);
  border-left: 3px solid #e86464;
}

.lecture-quiz-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 8px;
  padding-top: 6px;
}

.lecture-quiz-submit,
.lecture-quiz-retry {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #ffffff;
  transition: opacity 0.15s ease;
}

.lecture-quiz-submit:hover,
.lecture-quiz-retry:hover {
  opacity: 0.9;
}

.lecture-quiz-retry {
  background: transparent;
  color: var(--brand);
}

.lecture-quiz-score {
  font-size: 14px;
  color: var(--ink-dim);
}

.lecture-quiz-score strong {
  color: var(--brand);
}

@media (max-width: 600px) {
  .lecture-quiz {
    padding: 16px 14px;
  }
}

@media print {
  .lecture-quiz {
    display: none !important;
  }
}

.key-takeaways {
  border: 1px solid var(--amber-line);
  background: var(--amber-soft);
  border-radius: 6px;
  padding: 18px 20px;
  margin-top: 24px;
}

.key-takeaways h2,
.key-takeaways h3 {
  margin-top: 0;
  color: var(--amber);
  border: none;
  padding: 0;
}

.key-takeaways ul {
  margin-bottom: 0;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}

.compare-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: var(--bg-panel-2);
}

.compare-card h4 {
  margin-top: 0;
}

.lecture-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.lecture-table th,
.lecture-table td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.lecture-table th {
  background: var(--bg-panel-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.lecture-table tbody tr:nth-child(even) {
  background: var(--bg-panel-2);
}

.recap-inline {
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  border-radius: 0 6px 6px 0;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 14px;
  color: var(--ink-dim);
}

.recap-inline strong {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 6px;
}

.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0 18px;
}

.pros-cons > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  background: var(--bg-panel-2);
}

.pros-cons h4 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pros-cons-advantages h4 { color: #50be78; }
.pros-cons-limitations h4 { color: #e86464; }

.lecture-figure-wide {
  max-width: 960px;
}

.lecture-figure-wide img {
  max-width: 960px;
}

.lecture-figure {
  margin: 20px auto 28px;
  width: 100%;
  max-width: 720px;
}

.lecture-figure img {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-panel-2);
}

.lecture-figure figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.lecture-zoomable {
  cursor: zoom-in;
}

.lecture-figure.lecture-zoomable {
  position: relative;
}

.lecture-figure.lecture-zoomable::after {
  content: 'Click to enlarge';
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(14, 26, 43, 0.82);
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

html[data-theme="light"] .lecture-figure.lecture-zoomable::after {
  background: rgba(255, 255, 255, 0.92);
}

.lecture-figure.lecture-zoomable:hover::after,
.lecture-figure.lecture-zoomable:focus-within::after {
  opacity: 1;
}

.lecture-figure.lecture-zoomable img,
.lecture-figure.lecture-zoomable svg,
img.lecture-zoomable {
  cursor: zoom-in;
}

body.lecture-lightbox-open {
  overflow: hidden;
}

.lecture-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.lecture-image-lightbox[hidden] {
  display: none !important;
}

.lecture-image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 18, 0.88);
  backdrop-filter: blur(4px);
}

.lecture-image-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel-2);
  color: var(--ink);
  cursor: pointer;
}

.lecture-image-lightbox-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.lecture-image-lightbox-close:hover,
.lecture-image-lightbox-close:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
  outline: none;
}

.lecture-image-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 1200px);
  max-height: calc(100vh - 48px);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lecture-image-lightbox-media {
  overflow: auto;
  max-height: calc(100vh - 120px);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.lecture-image-lightbox-media img,
.lecture-image-lightbox-media svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  margin: 0 auto;
}

.lecture-image-lightbox-caption {
  margin: 0;
  padding: 0 8px;
  font-size: 13px;
  color: var(--ink-dim);
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.lecture-image-lightbox-caption[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .lecture-figure.lecture-zoomable::after {
    opacity: 1;
    top: auto;
    bottom: 10px;
    right: 10px;
  }

  .lecture-image-lightbox {
    padding: 12px 8px;
  }

  .lecture-image-lightbox-close {
    top: 10px;
    right: 10px;
  }
}

.timeline-flow {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 2;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px 24px;
  background: var(--bg-panel-2);
  margin: 16px 0;
  text-align: center;
}

.timeline-flow .arrow {
  color: var(--blue);
  display: block;
  line-height: 1.4;
}

.era-section {
  margin: 28px 0;
  padding-top: 8px;
}

.era-section > h3 {
  font-family: var(--display);
  font-size: 18px;
  color: var(--ink);
  margin: 0 0 14px;
}

@media (max-width: 640px) {
  .pros-cons,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .lecture-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.lecture-placeholder {
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 20px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.lecture-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.lecture-nav a {
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 4px;
  max-width: 48%;
}

.lecture-nav a:hover {
  border-color: var(--blue);
  color: var(--ink);
}

.lecture-nav a strong {
  display: block;
  color: var(--blue);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.lecture-nav .nav-next {
  text-align: right;
  margin-left: auto;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.module-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.module-card:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.module-card-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--blue);
  margin-bottom: 8px;
}

.module-card-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  margin-bottom: 8px;
}

.module-card-count {
  font-size: 12px;
  color: var(--ink-faint);
}

.topic-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 20px;
  margin-top: 20px;
  list-style: none;
  padding: 0;
}

.topic-list li a {
  display: block;
  font-size: 13.5px;
  color: var(--ink-dim);
  text-decoration: none;
  padding: 6px 0 6px 14px;
  position: relative;
  border-radius: 3px;
}

.topic-list li a::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--blue);
  font-weight: 700;
}

.topic-list li a:hover {
  color: var(--ink);
  background: var(--blue-soft);
}

.term-link {
  color: inherit;
  text-decoration: none;
}

.term-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--blue);
}

.vol-head-link {
  color: inherit;
  text-decoration: none;
}

.vol-head-link:hover .vol-title {
  color: var(--blue);
}

.mod-title-link {
  color: inherit;
  text-decoration: none;
}

.mod-title-link:hover {
  color: var(--blue);
}

.volume-nav {
  margin-top: 28px;
}

.domain-warning,
.freshness-note {
  border-radius: 6px;
  padding: 14px 16px;
  margin: 0 0 20px;
  border: 1px solid var(--amber-line);
  background: var(--amber-soft);
}

.domain-warning {
  border-color: rgba(255, 120, 100, 0.45);
  background: rgba(255, 100, 90, 0.1);
}

.domain-warning .notice-title,
.freshness-note .notice-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 6px;
}

.domain-warning .notice-title {
  color: #ff8a7a;
}

.domain-warning p,
.freshness-note p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-dim);
}

.site-disclaimer {
  margin: 36px 0 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-faint);
}

@media (max-width: 600px) {
  .lecture-main {
    padding: 24px 5vw 60px;
  }

  .lecture-body {
    padding: 20px;
  }

  .lecture-nav a {
    max-width: 100%;
  }
}

/* ---------- Responsive topbar (all lecture / volume pages) ---------- */
@media (max-width: 860px) {
  .lecture-topbar {
    gap: 8px 10px;
    padding: 10px 4vw 12px;
  }

  .lecture-topbar .brand-logo {
    height: 24px;
    max-height: 24px;
    max-width: 110px;
  }
}

@media (max-width: 600px) {
  .lecture-topbar-left {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .lecture-topbar .brand-badge {
    font-size: 8px;
    padding: 3px 7px;
  }

  .lecture-topbar .brand-logo {
    height: 22px;
    max-width: 96px;
  }

  .lecture-back {
    font-size: 10px;
    padding: 7px 10px;
  }

  .lecture-title {
    font-size: clamp(22px, 7vw, 28px);
  }

  .lecture-footer.brand-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 4vw 28px;
  }
}

/* ---------- PDF download control ---------- */
.lecture-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pdf-download-btn {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  background: var(--brand);
  color: var(--brand-fg);
  border: 1px solid var(--brand);
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pdf-download-btn:hover {
  background: #047857;
  border-color: #047857;
}

.pdf-download-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.pdf-download-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pdf-print-header,
.pdf-print-footer {
  display: none;
}

@media (max-width: 480px) {
  .pdf-download-btn {
    width: 36px;
    height: 36px;
  }

  .pdf-download-btn svg {
    width: 16px;
    height: 16px;
  }

  .lecture-topbar-actions .theme-toggle {
    width: 36px;
    height: 36px;
  }
}

/* ---------- Print / Save as PDF ---------- */
@media print {
  @page {
    margin: 14mm 12mm 16mm;
  }

  html,
  body {
    background: #ffffff !important;
    color: #111827 !important;
    overflow: visible !important;
    max-width: none !important;
  }

  body.lecture-page {
    display: block;
    padding-top: 0 !important;
  }

  .lecture-topbar,
  .lecture-nav,
  .lecture-footer.brand-footer,
  .theme-toggle,
  .pdf-download-btn,
  .lecture-topbar-actions,
  .lp-menu-toggle {
    display: none !important;
  }

  .pdf-print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 12px;
    margin: 0 0 18px;
    border-bottom: 2px solid #059669;
  }

  .pdf-print-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .pdf-print-brand img {
    height: 28px;
    width: auto;
  }

  .pdf-print-badge {
    font-family: var(--mono), monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: #059669;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 999px;
  }

  .pdf-print-heading {
    text-align: right;
    min-width: 0;
  }

  .pdf-print-title {
    font-family: var(--display), sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.3;
  }

  .pdf-print-meta {
    font-family: var(--mono), monospace;
    font-size: 10px;
    color: #475569;
    margin: 4px 0 0;
  }

  .pdf-print-footer {
    display: block !important;
    margin-top: 28px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    font-family: var(--mono), monospace;
    font-size: 10px;
    line-height: 1.5;
    color: #64748b;
  }

  .lecture-main {
    padding: 0 !important;
    max-width: none !important;
  }

  .lecture-meta,
  .lecture-subtitle,
  .lecture-tag,
  .lesson-badge {
    color: #475569 !important;
  }

  .lecture-title {
    color: #111827 !important;
    margin-top: 0;
  }

  .lecture-body {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .lecture-body,
  .lecture-body p,
  .lecture-body li,
  .callout,
  .callout p,
  .callout li,
  .freshness-note p,
  .domain-warning p,
  .objectives-box,
  .key-takeaways {
    color: #1e293b !important;
  }

  .lecture-body h2,
  .lecture-body h3,
  .lecture-body strong,
  .lecture-body b,
  .callout-title,
  .notice-title {
    color: #0f172a !important;
  }

  .callout,
  .objectives-box,
  .key-takeaways,
  .freshness-note,
  .domain-warning {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .lecture-body h2,
  .lecture-body h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  pre,
  code,
  .lecture-table,
  table {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  pre,
  code {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
  }

  a {
    color: #047857 !important;
    text-decoration: none !important;
  }

  .site-disclaimer {
    color: #64748b !important;
  }
}
