:root {
  --paper: #ffffff;
  --paper-2: #fff7f4;
  --ink: #342c2b;
  --muted: #847673;
  --sage: #d9a198;
  --sage-dark: #b95243;
  --coral: #e56f61;
  --terracotta: #c95447;
  --gold: #f1b6aa;
  --blue: #d88678;
  --coral-soft: #fff0ed;
  --coral-pale: #fff8f6;
  --line: rgba(190, 85, 70, .14);
  --page-pad: clamp(22px, 7vw, 42px);
  --body-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  color: var(--ink);
  background: #f3f0ef;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }

.app {
  position: relative;
  width: min(100%, 560px);
  height: 100%;
  margin: auto;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 60px rgba(86, 60, 55, .12);
}
.ambient { position: absolute; border-radius: 50%; filter: blur(1px); pointer-events: none; opacity: .7; }
.ambient-a { width: 230px; height: 230px; top: -125px; right: -105px; background: #ffe1db; }
.ambient-b { width: 180px; height: 180px; bottom: 40px; left: -140px; background: #fff0ed; }

.topbar {
  position: absolute;
  z-index: 10;
  top: 0; left: 0; right: 0;
  height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 18px 0;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
}
.brand-mini { font-size: 10px; letter-spacing: .16em; text-align: center; color: var(--terracotta); font-weight: 700; }
.icon-button, .text-button, .close-button, .nav-button {
  border: 0; background: transparent; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.icon-button { display: grid; gap: 4px; padding: 11px; }
.icon-button span { width: 18px; height: 1.5px; background: currentColor; border-radius: 2px; }
.text-button { font-family: Georgia, serif; font-weight: 700; font-size: 16px; }

.book {
  position: absolute;
  inset: calc(58px + env(safe-area-inset-top)) 0 calc(72px + env(safe-area-inset-bottom));
  perspective: 1400px;
}
.page {
  position: absolute;
  inset: 0 14px;
  display: flex;
  flex-direction: column;
  padding: var(--page-pad);
  overflow: hidden;
  border: 1px solid rgba(76, 94, 84, .08);
  border-radius: 28px 28px 20px 20px;
  background: var(--paper);
  box-shadow: 0 18px 45px rgba(110, 73, 66, .08);
  transform-origin: left center;
  transition: transform .48s cubic-bezier(.22,.75,.18,1), opacity .34s ease;
  will-change: transform, opacity;
}
.page.before { transform: translateX(-16%) rotateY(-18deg) scale(.96); opacity: 0; pointer-events: none; }
.page.after { transform: translateX(16%) rotateY(18deg) scale(.96); opacity: 0; pointer-events: none; }
.page.active { transform: none; opacity: 1; z-index: 2; }
.page-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding-bottom: 14px;
}
.page-scroll::-webkit-scrollbar { display: none; }

.eyebrow {
  display: inline-flex; width: fit-content; margin: 0 0 13px; padding: 5px 10px;
  color: var(--terracotta); background: var(--coral-soft); border-radius: 999px;
  font-size: 10px; letter-spacing: .13em; font-weight: 750;
}
h1, h2, h3 { font-family: "Songti SC", "Noto Serif SC", Georgia, serif; font-weight: 650; margin: 0; }
.section-title { font-size: clamp(27px, 8vw, 39px); line-height: 1.22; letter-spacing: -.02em; margin-bottom: 24px; }
.section-title::after { content: ""; display: block; width: 42px; height: 4px; margin-top: 15px; background: var(--coral); border-radius: 4px; }
.body-copy { font-size: var(--body-size); line-height: 1.9; color: #514442; }
.body-copy p { margin: 0 0 1.42em; }
.body-copy .blessing-line,
.body-copy p:has(+ .signature) { margin-bottom: .12em; }
.body-copy .signature { margin-top: 0; }
.body-copy strong, .body-copy .lead { color: var(--sage-dark); font-weight: 700; }
.highlight-line {
  padding: 15px 17px;
  margin: 18px 0 20px;
  color: var(--terracotta);
  background: linear-gradient(145deg, #fff7f4, #fff0ed);
  border: 1px solid rgba(229, 111, 97, .22);
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(180, 82, 68, .06);
  font-weight: 750;
}
.citation {
  margin: 10px 0 0;
  color: #988c89;
  font-size: .74em;
  line-height: 1.58;
  letter-spacing: .01em;
}
.guide-step {
  margin: 0 0 14px;
  padding: 15px 16px;
  border-radius: 16px;
  background: var(--coral-pale);
  box-shadow: inset 0 0 0 1px var(--line);
}
.guide-step-title {
  margin-bottom: 8px;
  color: var(--terracotta);
  font-weight: 850;
  line-height: 1.45;
}
.guide-step p {
  margin: 0;
  color: #665653;
  line-height: 1.75;
}
.minor-title {
  margin: 1.25em 0 .55em;
  padding-left: 12px;
  border-left: 3px solid var(--coral);
  color: var(--terracotta);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 1.02em;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: .02em;
}
.section-title + .body-copy .minor-title:first-child,
.body-copy > .minor-title:first-child { margin-top: 0; }
.body-copy .quote {
  padding: 18px 19px; margin: 20px 0;
  border-left: 3px solid var(--gold);
  background: var(--coral-pale);
  border-radius: 0 16px 16px 0;
  font-family: "Songti SC", serif;
}
.body-copy .duration {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; margin: 5px 0 15px;
  color: var(--terracotta); background: var(--coral-soft); border-radius: 999px; font-size: .88em; font-weight: 650;
}
.body-copy .numbered {
  margin: 0 0 18px; padding: 15px 16px;
  border-radius: 16px; background: var(--coral-pale);
  box-shadow: inset 0 0 0 1px var(--line);
}

.cover { justify-content: space-between; align-items: center; padding-top: 26px; background: #fff; text-align: center; }
.cover .cover-brand { width: 100%; font-size: 11px; letter-spacing: .16em; color: var(--terracotta); font-weight: 700; text-align: center; }
.cover-art { width: 100%; height: min(39vh, 340px); margin: 3px 0 10px; flex: 0 1 auto; }
.cover-art svg, .chapter-art svg { width: 100%; height: 100%; display: block; }
.cover-title-block { width: 100%; text-align: center; }
.cover h1 { font-size: clamp(38px, 11.5vw, 56px); line-height: 1.06; letter-spacing: -.04em; }
.cover h1 .title-line { display: block; color: var(--ink); }
.cover h1 small { display: block; margin-top: 14px; color: var(--terracotta); font-size: .33em; line-height: 1.45; letter-spacing: .06em; font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; font-weight: 750; }
.cover .tagline { margin: 17px 0 0; color: var(--terracotta); letter-spacing: .08em; font-size: 13px; }
.cover .cover-bottom { width: 100%; display: flex; justify-content: center; align-items: center; gap: 16px; }
.cover .promise { max-width: none; font-family: "Songti SC", serif; font-size: 16px; line-height: 1.6; white-space: nowrap; }
.breath-mark { width: 54px; height: 54px; border: 1px solid var(--coral); border-radius: 50%; display:grid; place-items:center; animation: breathe 5s ease-in-out infinite; }
.breath-mark::after { content:""; width: 12px; height: 12px; background: var(--coral); border-radius: 50%; }
@keyframes breathe { 50% { transform: scale(1.12); opacity:.7; } }

.chapter-page { justify-content: space-between; background: linear-gradient(145deg, #df685a, #c95246); color: #fff; }
.chapter-page .eyebrow { color: #b74a3f; background: rgba(255,255,255,.9); }
.chapter-page .section-title { font-size: clamp(36px, 11vw, 54px); max-width: 360px; }
.chapter-page .section-title::after { background: #ffd9d2; }
.chapter-page p { color: rgba(255,255,255,.76); line-height: 1.7; max-width: 320px; }
.chapter-art { height: 42%; min-height: 190px; }

.welcome-sign { margin-top: 26px; color: var(--terracotta); font-family: "Songti SC", serif; }
.toc-grid { display: grid; gap: 10px; }
.toc-item {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center;
  padding: 14px 13px; border: 0; text-align: left; color: var(--ink);
  border-radius: 15px; background: var(--coral-pale); cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
}
.toc-num { color: var(--coral); font-family: Georgia, serif; font-size: 13px; white-space: nowrap; }
.toc-arrow { color: var(--coral); }

.bottombar {
  position: absolute; z-index: 10; left: 0; right: 0; bottom: 0;
  height: calc(72px + env(safe-area-inset-bottom));
  padding: 7px 19px env(safe-area-inset-bottom);
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 14px;
}
.nav-button { width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 50%; font-size: 21px; background: #fff; color: var(--terracotta); }
.nav-button.primary { color: white; background: var(--coral); border-color: transparent; box-shadow: 0 7px 18px rgba(229,111,97,.28); }
.nav-button:disabled { opacity: .28; }
.progress-wrap { display: flex; flex-direction: column; gap: 7px; align-items: center; }
.progress-track { width: 100%; height: 3px; border-radius: 3px; background: #f4dcd7; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--coral); transition: width .35s ease; }
#pageIndicator { color: var(--muted); font-size: 10px; letter-spacing: .08em; }

.drawer {
  position: absolute; z-index: 30; inset: 0 10% 0 0;
  padding: calc(25px + env(safe-area-inset-top)) 22px calc(20px + env(safe-area-inset-bottom));
  background: #fff; transform: translateX(-104%); transition: transform .32s ease;
  box-shadow: 18px 0 50px rgba(29,42,36,.2); display:flex; flex-direction:column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.drawer-head small { color: var(--terracotta); letter-spacing:.12em; font-size:9px; }
.drawer-head h2 { margin-top:5px; font-size:28px; }
.close-button { font-size: 31px; font-weight: 200; }
.drawer-list { overflow-y: auto; display: grid; gap: 6px; }
.drawer-link { border:0; padding: 11px 12px; border-radius: 12px; background: transparent; text-align:left; color:var(--ink); cursor:pointer; }
.drawer-link.active { background:var(--coral-soft); color:var(--terracotta); font-weight:700; }
.drawer-link small { display:block; margin-bottom:2px; color:var(--coral); }
.drawer-tip { color:var(--muted); font-size:11px; text-align:center; margin:12px 0 0; }
.scrim { position:absolute; z-index:20; inset:0; background:rgba(24,34,30,.38); opacity:0; pointer-events:none; transition:opacity .3s; }
.scrim.show { opacity:1; pointer-events:auto; }

/* 内容可视化：完整保留文字，只改变阅读组织 */
.visual-stack { display: grid; gap: 12px; }
.visual-card {
  position: relative; padding: 16px 16px 16px 18px;
  border: 1px solid var(--line); border-radius: 17px; background: var(--coral-pale);
}
.visual-card::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px;
  border-radius: 0 4px 4px 0; background: var(--coral);
}
.visual-card-title { margin-bottom: 7px; color: var(--ink); font-size: .96em; line-height: 1.55; font-weight: 750; }
.visual-card-body { color: #665653; font-size: .91em; line-height: 1.75; }
.visual-card-body p { margin: 0 0 .7em; }
.visual-card-body p:last-child { margin-bottom: 0; }
.visual-card-body .highlight-line {
  margin: 10px 0 12px;
  padding: 12px 14px;
  font-size: 1em;
}
.visual-card-body .citation { font-size: .78em; }
.visual-card-body .guide-step { margin-bottom: 10px; background: #fff; }

.attitude-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.attitude-card {
  padding: 14px; min-height: 130px; border-radius: 16px;
  border: 1px solid var(--line); background: linear-gradient(145deg, #fff, #fff5f2);
}
.attitude-num { color: var(--coral); font-size: 10px; letter-spacing: .1em; font-weight: 800; }
.attitude-name { margin: 5px 0 6px; color: var(--ink); font-weight: 750; }
.attitude-desc { color: #756460; font-size: .78em; line-height: 1.65; }

.practice-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: #fff; }
.practice-panel-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--coral-soft); color: var(--terracotta); font-weight: 750;
}
.practice-panel-icon { display:grid; place-items:center; width: 40px; height:40px; border-radius:12px; color:#fff; background:var(--coral); font-size:20px; }
.practice-panel .visual-content { padding: 16px; }

.timeline { position: relative; display: grid; gap: 0; padding-left: 28px; }
.timeline::before { content:""; position:absolute; left:8px; top:12px; bottom:12px; width:2px; background:#f2cec7; }
.timeline-item { position:relative; padding: 0 0 20px; color:#5d4d4a; line-height:1.78; }
.timeline-item::before { content:""; position:absolute; left:-25px; top:8px; width:10px; height:10px; border-radius:50%; background:var(--coral); box-shadow:0 0 0 5px var(--coral-soft); }
.timeline-label { display:block; margin-bottom:4px; color:var(--terracotta); font-size:.82em; font-weight:800; }

.book-card { display:flex; gap:13px; padding:15px; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:0 6px 18px rgba(161,79,67,.06); }
.book-spine { width:7px; border-radius:6px; background:var(--coral); flex:0 0 auto; }
.book-card-title { color:var(--ink); font-weight:750; }
.book-card-desc { margin-top:7px; color:#6f5d59; font-size:.86em; line-height:1.7; }
.book-category { margin: 17px 0 4px; color:var(--terracotta); font-size:.78em; letter-spacing:.12em; font-weight:800; }

.qr-card {
  display: grid;
  grid-template-columns: 1fr 118px;
  gap: 16px;
  align-items: center;
  margin: 24px 0 6px;
  padding: 17px;
  border: 1px solid rgba(229, 111, 97, .24);
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, .9), transparent 34%),
    linear-gradient(145deg, #fff8f6, #fff0ed);
  box-shadow: 0 12px 28px rgba(180, 82, 68, .1);
}
.qr-card-copy { min-width: 0; }
.qr-card .qr-kicker {
  margin: 0 0 6px;
  color: var(--coral);
  font-size: .72em;
  font-weight: 850;
  letter-spacing: .14em;
}
.qr-card h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 1.24em;
  line-height: 1.3;
}
.qr-card p {
  margin: 0;
  color: #6b5a56;
  font-size: .9em;
  line-height: 1.72;
}
.qr-image {
  width: 118px;
  height: 118px;
  display: block;
  padding: 8px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(99, 65, 58, .12);
}

.end-page {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  text-align: center;
}
.end-page .section-title { text-align: center; }
.end-page .section-title::after { margin-left: auto; margin-right: auto; }
.end-page .body-copy { width: 100%; }
.end-page .breath-mark { margin: 22px auto; }
.end-qr-strip {
  display: block;
  width: min(100%, 360px);
  height: auto;
  margin: 14px auto 0;
  border-radius: 16px;
}

@media (min-width: 700px) {
  body { padding: 20px 0; }
  .app { height: calc(100% - 40px); border-radius: 30px; }
}
@media (max-width: 430px) {
  .qr-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .qr-image { width: 132px; height: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
