:root {
  --paper: #fffdf6;
  --canvas: #e8e2d6;
  --ink: #17272d;
  --muted: #52646a;
  --line: #c8bdab;
  --teal: #0e6b66;
  --teal-soft: #dcefeb;
  --amber: #f2bd45;
  --orange: #bd5928;
  --shadow: 6px 6px 0 rgba(23, 39, 45, .12);
}

* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); scroll-behavior: smooth; }
body {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 28px;
  width: min(1280px, calc(100% - 36px));
  margin: 24px auto 72px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 17px;
  line-height: 1.78;
}
body > *:not(nav#TOC) { grid-column: 2; min-width: 0; }

header {
  padding: 40px clamp(24px, 5vw, 64px);
  background: var(--ink);
  color: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
header h1 { margin: 0; font-size: clamp(32px, 5vw, 58px); line-height: 1.12; letter-spacing: -.04em; }

nav#TOC {
  grid-column: 1;
  grid-row: 1 / span 999;
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px 20px 22px;
  background: rgba(255, 253, 246, .96);
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 rgba(23, 39, 45, .1);
}
nav#TOC::before { content: "30 讲目录"; display: block; margin-bottom: 12px; color: var(--orange); font: 900 18px/1.2 "PingFang SC", sans-serif; }
nav#TOC ul { margin: 0; padding-left: 18px; }
nav#TOC li { margin: 5px 0; line-height: 1.35; }
nav#TOC a { color: var(--ink); font: 650 13px/1.35 "PingFang SC", sans-serif; text-decoration: none; }
nav#TOC a:hover { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }

body > p, body > ul, body > ol, body > table, body > blockquote, body > h2, body > h3 {
  margin-left: 0;
  margin-right: 0;
}
body > p, body > ul, body > ol, body > table, body > blockquote, body > h3 {
  padding-left: clamp(20px, 4vw, 48px);
  padding-right: clamp(20px, 4vw, 48px);
}

h2 {
  margin-top: 38px;
  margin-bottom: 6px;
  padding: 17px 22px;
  background: var(--teal-soft);
  border: 2px solid var(--ink);
  border-left: 10px solid var(--amber);
  border-radius: 13px;
  box-shadow: 4px 4px 0 rgba(23, 39, 45, .08);
  font: 900 clamp(24px, 3vw, 34px)/1.3 "PingFang SC", "Microsoft YaHei", sans-serif;
  scroll-margin-top: 20px;
}
h3 { margin-top: 24px; margin-bottom: 4px; color: var(--teal); font: 900 20px/1.4 "PingFang SC", sans-serif; }
p { margin-top: 9px; margin-bottom: 9px; }
strong { color: #102c32; }
a { color: var(--teal); text-underline-offset: 3px; }

p > img {
  display: block;
  width: 100%;
  height: auto;
  margin: 18px auto 24px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
  background: var(--paper);
}

blockquote {
  margin-top: 18px;
  margin-bottom: 22px;
  padding-top: 14px;
  padding-bottom: 14px;
  background: #fff3ca;
  border-left: 6px solid var(--amber);
  border-radius: 8px;
  color: #4c421f;
}

table {
  width: calc(100% - clamp(40px, 8vw, 96px));
  margin-top: 16px;
  margin-bottom: 24px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
th, td { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--ink); color: white; text-align: left; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { border-right: 0; }

code { padding: .12em .35em; background: #eee7d9; border-radius: 4px; font-size: .9em; }
li { margin: 5px 0; }

@media (max-width: 900px) {
  body { display: block; width: min(100% - 20px, 760px); margin: 10px auto 64px; font-size: 16px; }
  nav#TOC { position: static; max-height: none; margin: 14px 0 24px; }
  header { padding: 28px 22px; }
  body > p, body > ul, body > ol, body > table, body > blockquote, body > h3 { padding-left: 12px; padding-right: 12px; }
  table { display: block; width: calc(100% - 24px); overflow-x: auto; }
  h2 { font-size: 23px; }
  p > img { border-radius: 11px; box-shadow: 4px 4px 0 rgba(23, 39, 45, .1); }
}

@media print {
  html { background: white; }
  body { display: block; width: 100%; margin: 0; color: black; }
  nav#TOC { position: static; max-height: none; box-shadow: none; }
  header, h2, p > img, table { break-inside: avoid; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
