:root {
  --ink: #1a1714;
  --ink-soft: #2c2620;
  --paper: #f4efe4;
  --paper-deep: #e8dfcc;
  --jade: #3d6b5a;
  --jade-bright: #4f8a72;
  --cinnabar: #8b3a2f;
  --gold: #b0894a;
  --mute: #6b6358;
  --line: rgba(44, 38, 32, 0.12);
  --shadow: 0 18px 50px rgba(26, 23, 20, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(176, 137, 74, 0.12), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(61, 107, 90, 0.1), transparent 50%),
    var(--paper);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
}

.veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  opacity: 0.07;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

header.hero {
  text-align: center;
  padding: 3.5rem 0 2.5rem;
}

.seal {
  display: inline-block;
  border: 2px solid var(--cinnabar);
  color: var(--cinnabar);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", serif;
  font-size: 1.65rem;
  letter-spacing: 0.2em;
  padding: 0.35rem 0.7rem 0.2rem;
  margin-bottom: 1.4rem;
}

.kicker {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--mute);
  margin-bottom: 1rem;
}

h1 {
  font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.55rem);
  line-height: 1.35;
  max-width: 18ch;
  margin: 0 auto 1.25rem;
}

.source {
  color: var(--mute);
  font-size: 0.95rem;
}

button {
  font-family: inherit;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink-soft);
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

button:hover,
button[aria-pressed="true"] {
  background: #fff;
  border-color: rgba(61, 107, 90, 0.35);
  transform: translateY(-1px);
}

nav.toc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.7rem;
  margin: 0.5rem 0 2.4rem;
}

nav.toc a {
  text-decoration: none;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  font-size: 0.92rem;
}

section.card {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.6rem 1.5rem 1.7rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(18px);
  animation: rise 0.7s ease forwards;
}

section.card:nth-of-type(2) { animation-delay: 0.05s; }
section.card:nth-of-type(3) { animation-delay: 0.1s; }
section.card:nth-of-type(4) { animation-delay: 0.15s; }
section.card:nth-of-type(5) { animation-delay: 0.2s; }
section.card:nth-of-type(6) { animation-delay: 0.25s; }
section.card:nth-of-type(7) { animation-delay: 0.3s; }
section.card:nth-of-type(8) { animation-delay: 0.35s; }

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

h2 {
  font-weight: 400;
  font-size: 1.45rem;
  margin-bottom: 0.85rem;
  color: var(--jade);
}

h3 {
  font-weight: 400;
  font-size: 1.12rem;
  margin: 1.15rem 0 0.45rem;
}

p + p {
  margin-top: 0.85rem;
}

.verse {
  display: grid;
  gap: 1rem;
  text-align: center;
  padding: 0.4rem 0 0.2rem;
}

.chinese {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", serif;
  font-size: clamp(2rem, 6vw, 3.3rem);
  letter-spacing: 0.18em;
  line-height: 1.4;
}

.chars {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin: 0.4rem 0 0.2rem;
}

.char {
  min-width: 4.6rem;
  background: var(--paper-deep);
  border-radius: 12px;
  padding: 0.7rem 0.45rem 0.6rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.char:hover,
.char.is-active {
  transform: translateY(-3px);
  border-color: rgba(61, 107, 90, 0.4);
  background: #fff;
}

.char b {
  display: block;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", serif;
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1;
}

.char span {
  display: block;
  font-size: 0.72rem;
  color: var(--mute);
  margin-top: 0.3rem;
}

.char-note {
  min-height: 4.6rem;
  margin-top: 0.9rem;
  padding: 0.95rem 1rem;
  border-left: 3px solid var(--gold);
  background: rgba(232, 223, 204, 0.45);
  color: var(--ink-soft);
}

.layers {
  display: grid;
  gap: 0.75rem;
}

.layer {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.4);
}

.layer button.toggle {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0.9rem 1rem;
  font-size: 1rem;
}

.layer .panel {
  display: none;
  padding: 0 1rem 1rem;
  color: var(--ink-soft);
}

.layer.is-open .panel {
  display: block;
}

ul, ol {
  padding-left: 1.2rem;
  margin-top: 0.6rem;
}

li + li {
  margin-top: 0.4rem;
}

blockquote {
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--cinnabar);
  background: rgba(139, 58, 47, 0.06);
  font-style: italic;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.6rem;
  font-size: 0.95rem;
}

.page-nav a {
  color: var(--jade);
  text-decoration: none;
}

.page-nav .spacer {
  flex: 1;
}

footer {
  text-align: center;
  color: var(--mute);
  font-size: 0.88rem;
  margin-top: 2rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
