:root {
  --bg: #f5e4a7;
  --paper: #f7f3e6;
  --ink: #1f2937;
  --muted: #5f6368;
  --line: rgba(48, 74, 102, 0.22);
  --accent: #1f6f8b;
  --accent-2: #c78f3e;
  --shadow: 14px 14px 0 rgba(199, 143, 62, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px),
    var(--bg);
  background-size: 44px 44px, 44px 44px, auto;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 16px 28px;
  background: rgba(247, 243, 230, 0.94);
  border-bottom: 1px solid rgba(31, 111, 139, 0.18);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: inline-flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  background: #f7e7a2;
  font-size: 28px;
  font-weight: 700;
}
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { font-size: 24px; }
.brand-copy small { font-size: 14px; color: var(--muted); }

.site-nav { display: flex; gap: 12px; flex-wrap: wrap; }
.nav-link {
  padding: 12px 18px;
  border: 2px solid rgba(31, 41, 55, 0.18);
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  font-weight: 700;
}
.nav-link.is-active { background: var(--ink); color: white; }

.page-shell { width: min(1420px, calc(100vw - 36px)); margin: 0 auto; padding: 30px 0 48px; }
.site-footer { width: min(1420px, calc(100vw - 36px)); margin: 0 auto; padding: 0 0 40px; color: var(--muted); }

.hero, .section, .detail-grid, .page-hero {
  margin-bottom: 28px;
}

.hero, .page-hero, .panel, .section {
  background: rgba(247, 243, 230, 0.92);
  border: 2px solid rgba(34, 61, 85, 0.22);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr minmax(280px, 360px);
  gap: 28px;
  padding: 34px;
}

.hero-image img { width: 100%; height: 100%; object-fit: contain; background: #efe7cb; padding: 18px; border: 1px solid rgba(31, 41, 55, 0.12); }
.eyebrow { margin: 0 0 8px; color: #9d4a20; font-weight: 700; font-size: 14px; }
h1 { margin: 0; font-size: clamp(38px, 5vw, 64px); line-height: 1.05; }
h2 { margin: 0 0 12px; font-size: 24px; }
h3 { margin: 0 0 10px; font-size: 20px; }
p { margin: 0; line-height: 1.7; }
.hero-text { margin-top: 16px; max-width: 820px; font-size: 20px; color: #314656; }
.stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.stats span {
  min-width: 110px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 41, 55, 0.15);
  background: rgba(255,255,255,0.55);
}
.stats strong { display: block; font-size: 28px; }
.stats small { color: var(--muted); }

.section { padding: 28px; }
.section-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.crumb { margin-bottom: 10px; color: var(--muted); font-size: 14px; }

.chapter-grid, .concept-grid, .plate-grid, .route-grid, .source-grid, .concept-summary-grid {
  display: grid;
  gap: 16px;
}

.chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.concept-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.plate-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plate-grid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.route-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.concept-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.chapter-card, .principle-card, .plate-card, .route-item, .source-item-deep, .concept-summary-card, .path-card {
  display: block;
  padding: 16px;
  border: 1px solid rgba(31, 41, 55, 0.14);
  background: rgba(255,255,255,0.46);
}

.path-card { font-weight: 700; }
.path-card.is-static, .concept-summary-card.is-static { cursor: default; }
.card-copy { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); }

.thumb-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  margin-bottom: 14px;
  padding: 10px;
  background: #efe7cb;
  border: 1px solid rgba(31, 41, 55, 0.12);
}
.thumb-frame.compact { aspect-ratio: 16 / 10; }
.thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-btn {
  padding: 10px 14px;
  border: 1px solid rgba(31, 41, 55, 0.2);
  background: rgba(255,255,255,0.7);
  border-radius: 999px;
  font-weight: 700;
}
.filter-btn.active { background: #e6f1f5; color: var(--accent); border-color: rgba(31, 111, 139, 0.35); }

.page-hero { padding: 26px 28px; }
.learning-path { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 18px; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 20px;
}

.panel { padding: 22px; }
.detail-panel, .viewer-panel { display: flex; flex-direction: column; gap: 16px; }
.reading-card {
  padding: 18px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  background: rgba(255,255,255,0.52);
}

.clean-list { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.clean-list.ordered { padding-left: 24px; }

.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.thumbs button {
  padding: 0;
  border: 1px solid rgba(31, 41, 55, 0.12);
  background: rgba(255,255,255,0.62);
}
.thumbs img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  object-position: center;
  background: #efe7cb;
}

.viewer-main img, .plate-full {
  width: 100%;
  background: #f7f3e6;
  border: 1px solid rgba(31, 41, 55, 0.12);
}

.answer-toggle {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(31, 41, 55, 0.18);
  background: white;
  font-weight: 700;
}
.answer-body { margin-top: 16px; padding-top: 14px; border-top: 1px dashed rgba(31, 41, 55, 0.18); }
.answer-body.is-open { display: block; }

.group-head { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
.glossary-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,0.55);
}
.glossary-table th, .glossary-table td {
  padding: 14px 12px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  text-align: left;
  vertical-align: top;
}

@media (max-width: 1100px) {
  .hero, .detail-grid, .chapter-grid, .plate-grid, .concept-summary-grid, .route-grid, .source-grid, .concept-grid {
    grid-template-columns: 1fr;
  }
  .site-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 780px) {
  .page-shell, .site-footer { width: calc(100vw - 24px); }
  .site-header { padding: 14px 12px; }
  .hero, .section, .page-hero, .panel { padding: 18px; }
  h1 { font-size: 34px; }
  .hero-text { font-size: 18px; }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
