:root {
  color-scheme: light;
  --primary: #1d4ed8;
  --primary-soft: #dbeafe;
  --accent: #c2410c;
  --accent-soft: #ffedd5;
  --ink: #172033;
  --muted: #526079;
  --line: #d7dfeb;
  --surface: #ffffff;
  --canvas: #f6f8fc;
  --success: #166534;
  --success-soft: #dcfce7;
  --warning: #854d0e;
  --warning-soft: #fef9c3;
  --radius: 18px;
  --shadow: 0 12px 34px rgba(30, 64, 175, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.68;
}

button,
textarea,
input {
  font: inherit;
}

a {
  color: var(--primary);
  text-underline-offset: 0.16em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid #f97316;
  outline-offset: 3px;
}

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 5px;
  background: #e5eaf2;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  transition: width 120ms ease-out;
}

.topbar {
  width: min(100% - 32px, 980px);
  margin: 20px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  text-decoration: none;
}

.reading-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-button,
.action-button,
.answer-button {
  min-height: 44px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.control-button {
  min-width: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.control-button:hover {
  background: var(--primary-soft);
  border-color: #93c5fd;
}

.lesson-shell {
  width: min(100% - 32px, 820px);
  margin: 18px auto 80px;
}

.lesson-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 6vw, 54px);
  border: 1px solid #c7d7f3;
  border-radius: 26px;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 58%, #fff7ed 100%);
  box-shadow: var(--shadow);
}

.lesson-hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -90px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.1);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.18;
  letter-spacing: -0.025em;
}

h1 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(2rem, 7vw, 3.65rem);
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

h3 {
  margin: 0 0 10px;
  font-size: 1.16rem;
}

.outcome {
  max-width: 690px;
  margin: 20px 0 0;
  color: #334155;
  font-size: 1.08em;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.meta-chip {
  padding: 6px 11px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #1e3a8a;
  font-size: 0.83rem;
  font-weight: 750;
}

.section-card {
  margin-top: 22px;
  padding: clamp(22px, 5vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 22px rgba(15, 23, 42, 0.04);
}

.section-number {
  display: inline-grid;
  width: 34px;
  height: 34px;
  margin-bottom: 15px;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 850;
}

.callout {
  margin: 20px 0 0;
  padding: 18px 20px;
  border-left: 5px solid var(--primary);
  border-radius: 0 12px 12px 0;
  background: #eff6ff;
}

.callout.warning {
  border-left-color: #ca8a04;
  background: var(--warning-soft);
  color: #713f12;
}

.analogy {
  border: 1px solid #fed7aa;
  background: #fff7ed;
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
  padding: 0;
  list-style: none;
}

.flow li {
  position: relative;
  min-height: 102px;
  padding: 14px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.35;
}

.flow strong {
  display: block;
  margin-bottom: 5px;
  color: var(--primary);
}

.comparison {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.comparison th,
.comparison td {
  padding: 13px 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.comparison th {
  background: #edf4ff;
}

.practice-box {
  padding: 20px;
  border: 1px dashed #93c5fd;
  border-radius: 14px;
  background: #f8fbff;
}

.question {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.question:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.question label {
  display: block;
  margin-bottom: 9px;
  font-weight: 800;
}

.recall-input {
  width: 100%;
  min-height: 94px;
  padding: 13px 14px;
  resize: vertical;
  border: 1px solid #aebbd0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.recall-input:focus {
  border-color: var(--primary);
}

.answer-button,
.action-button {
  margin-top: 11px;
  padding: 10px 17px;
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-weight: 800;
}

.answer-button:hover {
  background: var(--primary-soft);
}

.action-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.action-button:hover {
  background: #9a3412;
}

.model-answer {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--success-soft);
  color: #14532d;
}

.model-answer[hidden] {
  display: none;
}

.recap-list li + li,
.source-list li + li {
  margin-top: 9px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  list-style: none;
}

.review-grid label {
  display: block;
  height: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.review-grid input {
  width: 18px;
  height: 18px;
  margin-right: 6px;
  accent-color: var(--primary);
}

.review-date {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.88rem;
}

.completion-panel {
  text-align: center;
}

.completion-status {
  min-height: 28px;
  margin-top: 12px;
  color: var(--success);
  font-weight: 800;
}

.source-list {
  padding-left: 22px;
  overflow-wrap: anywhere;
}

.fine-print {
  color: var(--muted);
  font-size: 0.86rem;
}

body.text-large {
  font-size: 19px;
}

body.text-larger {
  font-size: 21px;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
  }

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

  .flow li {
    min-height: auto;
    text-align: left;
  }

  .comparison {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 460px) {
  body {
    font-size: 16.5px;
  }

  .topbar,
  .lesson-shell {
    width: min(100% - 20px, 820px);
  }

  .topbar {
    flex-direction: column;
  }

  .lesson-hero,
  .section-card {
    border-radius: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .reading-progress,
  .topbar,
  .action-button,
  .answer-button {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .lesson-shell {
    width: 100%;
    margin: 0;
  }

  .lesson-hero,
  .section-card {
    box-shadow: none;
    break-inside: avoid;
  }

  .model-answer[hidden] {
    display: block;
  }
}

