:root {
  --canvas: #F3EEE4;
  --surface: #FFFAF3;
  --surface-inset: #EAE3D6;
  --hairline: #DDD4C6;
  --ink-band: #1A1714;
  --ink: #1F1B16;
  --on-ink: #F3EEE4;
  --stone: #4C453C;
  --seal: #8E3D32;
  --seal-soft: #F0E0DA;
  --wash-tao: #E5EDE2;
  --wash-sunzi: #EFE6D8;
  --wash-yijing: #E7E3EE;
  --body: #3A342C;
  --muted: #6F675C;
  --on-dark: #F3EEE4;
  --on-dark-soft: #C4BDB2;
  --error: #A33B32;
  --success: #4F6F50;
  --focus: #4C453C;
  --font-serif: Literata, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --font-sans: "Source Sans 3", ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-zh: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "Hiragino Mincho ProN", serif;
  --font-zh-ui: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", var(--font-sans);
  --measure: 38rem;
  --page: 70rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--stone); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
}
.wordmark {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--stone);
  text-decoration: none;
}
.site-nav a.is-active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.trial-pill { font-size: 13px; color: var(--muted); }

#app { min-height: calc(100vh - 64px - 220px); }
.page { width: min(var(--measure), calc(100% - 32px)); margin: 0 auto; padding: 48px 0 96px; }
.page-wide { width: min(var(--page), calc(100% - 32px)); }

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0;
}
h1 { font-size: clamp(2rem, 4vw, 2.5rem); line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 16px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 16px; }
h3 { font-size: 1.2rem; line-height: 1.35; margin: 0 0 8px; }
.lede { font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.65; max-width: 40rem; }
.eyebrow {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.muted, .meta, .credit, .source-credit, .lock-note, .ref-source, .ref-meta { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  background: none;
}
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { color: var(--on-ink); opacity: 0.92; }
.btn-secondary { border-color: var(--stone); color: var(--stone); background: transparent; }
.hero-actions, .lesson-nav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.lesson-nav { justify-content: space-between; margin-top: 48px; }

section { margin: 80px 0 0; }
.hero { margin-top: 24px; }

.book-grid, .catalog-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.book-grid { grid-template-columns: repeat(3, 1fr); }
.book-card, .catalog-item, .lesson-teaser {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 20px 22px;
}
.book-card.wash-tao, .catalog-item.wash-tao, .lesson-teaser.wash-tao { background: var(--wash-tao); }
.book-card.wash-sunzi, .catalog-item.wash-sunzi, .lesson-teaser.wash-sunzi { background: var(--wash-sunzi); }
.book-card.wash-yijing, .catalog-item.wash-yijing, .lesson-teaser.wash-yijing { background: var(--wash-yijing); }
.book-card h3 span { display: block; font-family: var(--font-serif); font-weight: 500; color: var(--stone); font-size: 1rem; margin-top: 4px; }
.book-card h3 { font-family: var(--font-zh); }

.price-list { padding-left: 1.2rem; }
.notice-pay { font-weight: 600; color: var(--ink); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 24px 0; }
.book-chip {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--stone);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  min-height: 44px;
  padding: 8px 2px;
  cursor: pointer;
}
.book-chip.is-active { color: var(--ink); border-bottom-color: var(--ink); }

.catalog-list { grid-template-columns: 1fr 1fr; }
.catalog-item { position: relative; }
.catalog-item h3 a { color: var(--ink); text-decoration: none; }
.catalog-item.is-locked { opacity: 0.85; }
.today-mark, .fav-mark {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--seal);
  background: var(--seal-soft);
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: 6px;
  vertical-align: middle;
}
.zh-inline { font-family: var(--font-zh); font-size: 1.1rem; line-height: 1.6; color: var(--ink); }

.lesson-tools { margin: 16px 0 32px; }
.bookmark {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--stone);
  border-radius: 8px;
  background: transparent;
  color: var(--stone);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.bookmark.is-on { border-color: var(--seal); color: var(--seal); background: var(--seal-soft); }

.source-block {
  background: var(--surface-inset);
  border-radius: 12px;
  padding: 28px 24px;
  margin: 0 0 48px;
}
.source-text {
  font-family: var(--font-zh);
  font-size: 1.85rem;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 0 0 16px;
}
.pinyin {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0;
}

.word-list {
  list-style: none;
  padding: 0;
  margin: 0 0 48px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.word-list li {
  background: var(--surface-inset);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.w-zh { font-family: var(--font-zh); font-size: 1.25rem; color: var(--ink); }
.w-py { font-family: var(--font-sans); font-size: 13px; color: var(--muted); }
.w-en { font-family: var(--font-sans); font-size: 14px; line-height: 1.45; color: var(--body); }

.translation p, .usage p, .lede, .lesson .meta {
  font-family: var(--font-serif);
}
.translation p, .usage p {
  font-size: 18px;
  line-height: 1.65;
}
.usage {
  background: var(--surface-inset);
  border-radius: 12px;
  padding: 24px;
  margin: 48px 0;
}
.credit, .source-credit, .ref-source { font-size: 13px; line-height: 1.5; }
.ref-block {
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}
.ref-block summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--stone); }
.ref-text { margin: 12px 0; font-family: var(--font-serif); }

.early-form label { display: block; margin: 24px 0 8px; font-weight: 500; }
.early-form input {
  width: 100%;
  max-width: 28rem;
  height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
}
.early-form input[aria-invalid="true"] { border-color: var(--error); }
.form-error { color: var(--error); margin: 8px 0; }
.form-ok { color: var(--success); margin: 8px 0; }

.site-footer {
  background: var(--ink-band);
  color: var(--on-dark-soft);
  padding: 40px 24px 48px;
}
.footer-inner { width: min(var(--page), 100%); margin: 0 auto; }
.disclaimer {
  color: #DDD6CC;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
  max-width: 40rem;
}
.copyright { font-size: 13px; margin: 0 0 24px; }
.reviewer-panel { border-top: 1px solid #3A342C; padding-top: 20px; }
.reviewer-panel label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.reviewer-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 8px; }
.reviewer-controls input[type="range"] { width: min(240px, 100%); }
.reviewer-panel button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--on-dark-soft);
  background: transparent;
  color: var(--on-dark);
  padding: 0 14px;
  font-family: var(--font-sans);
  cursor: pointer;
}

@media (max-width: 1023px) {
  .book-grid, .catalog-list { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .site-header { height: auto; min-height: 64px; padding: 10px 16px; flex-direction: column; align-items: stretch; gap: 4px; }
  .site-nav { justify-content: flex-start; gap: 16px; }
  .source-text { font-size: 1.6rem; }
  h1, .hero h1 { font-size: 2rem; }
  .word-list { grid-template-columns: 1fr; }
  .btn-primary, .btn-secondary { width: 100%; }
  .hero-actions .btn, .lesson-nav .btn { width: auto; flex: 1 1 140px; }
  section { margin-top: 64px; }
}
