:root {
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --ink: #18211e;
  --muted: #5b6863;
  --line: #d7d0c2;
  --green: #0f6655;
  --green-soft: #dcece5;
  --blue: #285d82;
  --blue-soft: #e1ecf4;
  --amber: #9a5812;
  --amber-soft: #f5e7ce;
  --red: #8f3631;
  --red-soft: #f4dfdc;
  --shadow: 0 16px 45px rgba(36, 43, 39, 0.09);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.75;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(15, 102, 85, 0.07), transparent 28rem),
    var(--paper);
}

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

a:hover {
  color: var(--green);
}

.page {
  width: min(1040px, calc(100% - 32px));
  margin: 28px auto 80px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.hero {
  padding: clamp(28px, 6vw, 68px);
  border: 1px solid rgba(15, 102, 85, 0.18);
  border-radius: 28px;
  background: linear-gradient(135deg, #fffdf8 0%, #edf4ed 100%);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 16ch;
  margin: 0;
  font-family: ui-serif, "Songti SC", STSong, Georgia, serif;
  font-size: clamp(2.35rem, 7vw, 5.2rem);
  font-weight: 730;
}

.subtitle {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.22rem);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.pill {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 0.86rem;
}

main {
  margin-top: 26px;
}

.section {
  margin: 22px 0;
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.section > :first-child {
  margin-top: 0;
}

.section > :last-child {
  margin-bottom: 0;
}

h2 {
  margin-top: 0;
  font-family: ui-serif, "Songti SC", STSong, Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.55rem);
}

h3 {
  margin-top: 1.8em;
  font-size: 1.25rem;
}

p,
li {
  max-width: 74ch;
}

.lead {
  font-size: 1.12rem;
}

.grid-2,
.grid-3,
.grid-5,
.card-grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card,
.stage,
.lens-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.card h3,
.stage h3,
.lens-item h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}

.card p,
.stage p,
.lens-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

a.card {
  color: var(--ink);
  text-decoration: none;
  transition: border-color 140ms ease, transform 140ms ease;
}

a.card:hover,
a.card:focus-visible {
  border-color: var(--green);
  color: var(--ink);
  transform: translateY(-2px);
  outline: 2px solid rgba(15, 102, 85, 0.12);
}

.course-number {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 650;
}

.status::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.status.pending {
  color: var(--muted);
}

.diagram {
  margin: 24px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8f6f0;
  overflow-x: auto;
}

.flow {
  display: flex;
  align-items: stretch;
  min-width: 760px;
}

.flow-node {
  display: grid;
  flex: 1 1 0;
  min-height: 100px;
  padding: 14px;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.flow-node strong {
  display: block;
  margin-bottom: 3px;
}

.flow-node small {
  color: var(--muted);
}

.flow-node.sensor {
  border-color: #a9c3d5;
  background: var(--blue-soft);
}

.flow-node.learned {
  border-color: #a5c5b9;
  background: var(--green-soft);
}

.flow-node.output {
  border-color: #d9bd8e;
  background: var(--amber-soft);
}

.arrow {
  display: grid;
  flex: 0 0 36px;
  place-content: center;
  color: var(--muted);
  font-size: 1.35rem;
}

.caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.spectrum {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.spectrum > div {
  min-height: 190px;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.spectrum > div:last-child {
  border-right: 0;
}

.spectrum .narrow {
  background: var(--green-soft);
}

.spectrum .modern {
  background: var(--blue-soft);
}

.spectrum .modular {
  background: var(--amber-soft);
}

.spectrum h3 {
  margin-top: 0;
}

.callout {
  margin: 22px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--green);
  border-radius: 0 12px 12px 0;
  background: var(--green-soft);
}

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

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

.callout p {
  margin: 0;
}

.term {
  padding: 0.06em 0.28em;
  border-radius: 0.28em;
  background: var(--blue-soft);
  color: #163f5b;
  font-weight: 650;
}

.formula {
  margin: 20px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #202925;
  color: #f8f5ee;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.78rem, 2vw, 0.96rem);
  overflow-x: auto;
}

.table-wrap {
  margin: 22px 0;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

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

th {
  background: #f0ede6;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

details {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 680;
}

details > div {
  padding: 0 16px 16px;
}

.quiz {
  margin: 24px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfaf6;
}

.quiz h3 {
  margin-top: 0;
}

.options {
  display: grid;
  gap: 9px;
  margin: 14px 0;
}

.option {
  padding: 11px 14px;
  border: 1px solid #bfc7c3;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.option:hover,
.option:focus-visible {
  border-color: var(--green);
  outline: 2px solid rgba(15, 102, 85, 0.14);
}

.option.correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.option.incorrect {
  border-color: var(--red);
  background: var(--red-soft);
}

.feedback {
  display: none;
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--blue-soft);
}

.feedback.visible {
  display: block;
}

.teachback {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.saved-note {
  min-height: 1.5em;
  color: var(--green);
  font-size: 0.88rem;
}

.source-list li {
  margin-bottom: 12px;
}

.source-list span {
  display: block;
  color: var(--muted);
  font-size: 0.91rem;
}

.footer {
  padding: 24px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 760px) {
  .grid-2,
  .grid-3,
  .grid-5,
  .spectrum {
    grid-template-columns: 1fr;
  }

  .spectrum > div {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .spectrum > div:last-child {
    border-bottom: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .page {
    width: min(100% - 20px, 1040px);
    margin-top: 10px;
  }
}

@media print {
  :root {
    background: #fff;
  }

  body {
    background: #fff;
  }

  .page {
    width: 100%;
    margin: 0;
  }

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

  .quiz button,
  .saved-note {
    display: none;
  }

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