/* ============================================================
   农业碳汇与无人机巡田减排核算技术行业观察 · 白皮书
   单屏翻书式阅读器样式（独立子站，无外部依赖）
   ============================================================ */
:root {
  --paper: #f8f4e8;
  --paper-2: #f1ead8;
  --ink: #2b332c;
  --ink-2: #5a665c;
  --ink-3: #8d988e;
  --green: #1e6b40;
  --green-deep: #14532d;
  --green-soft: #e9f2ea;
  --gold: #c9a25e;
  --orange: #c2410c;
  --line: #ddd4bd;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", SimSun, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: #dfe8e0;
  overflow: hidden;
  background:
    radial-gradient(1100px 640px at 78% -12%, rgba(46,110,74,.35), transparent 60%),
    radial-gradient(900px 600px at -8% 110%, rgba(34,84,58,.28), transparent 60%),
    linear-gradient(165deg, #0b130e, #0e1a12 55%, #091009);
}

/* ---------- 布局骨架：顶栏 + 书台 + 底栏，全部在一屏内 ---------- */
/* svh（小视口高度）：手机地址栏收起/展开时高度恒定，避免整书跳动 */
.stage { height: 100vh; height: 100svh; display: flex; flex-direction: column; }

.topbar {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.tb-brand { font-family: var(--serif); font-size: 15px; font-weight: 700; color: #eef4ec; white-space: nowrap; }
.tb-brand span { font-size: 12px; color: #86a98f; font-weight: 400; margin-left: 8px; letter-spacing: .08em; }
.tb-ch { flex: 1; text-align: center; font-size: 12.5px; letter-spacing: .18em; color: #9db8a4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-actions { display: flex; gap: 8px; }
.tb-btn {
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06);
  color: #e8efe6; padding: 5px 13px; border-radius: 16px; font-size: 12.5px;
  cursor: pointer; text-decoration: none; transition: .18s; font-family: inherit; white-space: nowrap;
}
.tb-btn:hover { background: rgba(46,139,87,.55); border-color: rgba(127,224,167,.4); }

.scene {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  perspective: 2800px;
}

.botbar {
  flex: none; display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 10px 18px 14px;
}
.pg-btn {
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.05);
  color: #cfe0d2; font-size: 12.5px; padding: 6px 14px; border-radius: 16px; cursor: pointer; transition: .18s; font-family: inherit;
}
.pg-btn:hover { background: rgba(46,139,87,.55); }
.pg-btn[disabled] { opacity: .3; pointer-events: none; }
.pg-ind { font-family: Georgia, serif; font-size: 13px; color: #b9cdbc; min-width: 92px; text-align: center; letter-spacing: .06em; }
.progress { width: min(380px, 34vw); height: 3px; background: rgba(255,255,255,.13); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2e8b57, #7fe0a7); transition: width .45s; }

/* ---------- 书体 ---------- */
.book {
  position: relative; width: calc(var(--pw) * 2); height: var(--ph);
  transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3,.7,.25,1);
}
.book.single { width: var(--pw); }
.book.pos-start { transform: translateX(calc(var(--pw) / -2)); }
.book.pos-end   { transform: translateX(calc(var(--pw) / 2)); }
.book.no-anim, .book.no-anim .sheet { transition: none !important; }

.sheet {
  position: absolute; top: 0; right: 0; width: var(--pw); height: var(--ph);
  transform-style: preserve-3d; transform-origin: left center;
  transition: transform .85s cubic-bezier(.3,.7,.3,1);
}
.book.single .sheet { right: auto; left: 0; }
.sheet.flipped { transform: rotateY(-180deg); }
.sheet.gone { visibility: hidden; }

.page {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.55), transparent 50%),
    repeating-linear-gradient(0deg, rgba(120,100,60,.028) 0 1px, transparent 1px 3px),
    var(--paper);
  color: var(--ink);
  box-shadow: 0 22px 44px rgba(0,0,0,.42);
  border-radius: 0 7px 7px 0;
}
.page.front { box-shadow: inset 26px 0 30px -26px rgba(74,56,20,.42), 0 22px 44px rgba(0,0,0,.42); }
.page.back {
  transform: rotateY(180deg); border-radius: 7px 0 0 7px;
  box-shadow: inset -26px 0 30px -26px rgba(74,56,20,.42), 0 22px 44px rgba(0,0,0,.42);
}

/* ---------- 页内版式（em 随页面高度自动缩放：页高 = 52em） ---------- */
.page-inner {
  position: absolute; inset: 0; padding: 2.4em 2.8em 2.75em;
  overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.page-inner::-webkit-scrollbar { display: none; }

.pageno {
  position: absolute; bottom: 1.05em; right: 2.7em; z-index: 2;
  font-family: Georgia, serif; font-size: .72em; color: var(--ink-3); letter-spacing: .1em;
}
.page.back .pageno { right: auto; left: 2.7em; }
.runfoot {
  position: absolute; bottom: 1.12em; left: 2.8em; z-index: 2;
  font-size: .56em; letter-spacing: .22em; color: #adb3a0; white-space: nowrap;
}
.page.back .runfoot { left: auto; right: 2.8em; }

.eyebrow {
  display: flex; align-items: center; gap: .9em;
  font-size: .68em; font-weight: 700; letter-spacing: .24em; color: var(--green);
  text-transform: uppercase; margin-bottom: 1em;
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to right, var(--line), transparent); }
.ptitle { font-family: var(--serif); font-size: 1.58em; font-weight: 700; line-height: 1.32; color: var(--ink); margin-bottom: .45em; }
.psub { font-size: .9em; color: var(--ink-2); line-height: 1.6; margin-bottom: 1.1em; }
h3.sec { font-family: var(--serif); font-size: 1.06em; color: var(--green-deep); margin: 1.05em 0 .5em; }
h3.sec:first-child { margin-top: .2em; }
h3.sec small { font-family: Georgia, serif; font-size: .78em; color: var(--gold); margin-right: .5em; letter-spacing: .05em; }
.page p { font-size: .94em; line-height: 1.68; text-align: justify; margin-bottom: .75em; }
.page ul.plain { list-style: none; margin: .15em 0 .85em; }
.page ul.plain li { position: relative; padding-left: 1.35em; font-size: .9em; line-height: 1.62; margin-bottom: .4em; text-align: justify; }
.page ul.plain li::before { content: "◆"; position: absolute; left: .1em; top: 0; font-size: .66em; line-height: 2.4; color: var(--green); }
.page b { color: var(--green-deep); }
.page .oc { color: var(--orange); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9em; margin: 1em 0 .4em; }
.kpis.k3 { grid-template-columns: repeat(3, 1fr); }
.kpi { background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: .6em; padding: .85em .8em .75em; }
.kpi .n { font-family: Georgia, serif; font-size: 1.32em; font-weight: 700; color: var(--green-deep); white-space: nowrap; }
.kpi .n small { font-size: .5em; margin-left: .15em; }
.kpi .l { font-size: .66em; color: var(--ink-2); line-height: 1.5; margin-top: .35em; }

.tbl { width: 100%; border-collapse: collapse; font-size: .72em; margin: .35em 0 .9em; background: rgba(255,255,255,.5); }
.tbl caption { caption-side: top; text-align: left; font-size: .95em; color: var(--ink-2); padding-bottom: .4em; }
.tbl th { background: var(--green-deep); color: #f2ecda; font-weight: 600; padding: .42em .55em; text-align: left; white-space: nowrap; }
.tbl td { padding: .34em .55em; border-bottom: 1px solid var(--line); color: var(--ink); line-height: 1.45; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-family: Georgia, serif; white-space: nowrap; }

.flow { display: flex; align-items: stretch; gap: .45em; margin: .6em 0 1em; }
.flow .fb {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--green-soft); border: 1px solid #cfe3d6; color: var(--green-deep);
  border-radius: .5em; padding: .5em .4em; font-size: .7em; font-weight: 600; line-height: 1.45;
}
.flow .fa { align-self: center; color: var(--gold); font-size: .85em; flex: none; }
.flow.warn .fb { background: #f9ece2; border-color: #ecd6c4; color: #8a4a1d; }

.note {
  background: var(--green-soft); border-left: 3px solid var(--green);
  border-radius: .45em; padding: .75em .95em; font-size: .82em; line-height: 1.62; color: #1d4a30; margin: .8em 0;
}
.note.warn { background: #fbf2e6; border-left-color: var(--orange); color: #7c4a12; }
.note .nt { font-weight: 700; letter-spacing: .1em; margin-right: .4em; }

.chips { display: flex; flex-wrap: wrap; gap: .45em; margin: .4em 0 .8em; }
.chip { background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: 2em; padding: .28em .85em; font-size: .74em; font-weight: 600; color: var(--green-deep); }
.chip.warm { color: #8a4a1d; border-color: #e8d3bd; background: #fbf4ea; }

.vs { display: grid; grid-template-columns: 1fr 1fr; gap: .7em; margin: .55em 0 .85em; }
.vs > div { border-radius: .55em; padding: .7em .85em; font-size: .8em; line-height: 1.6; }
.vs .v1 { background: #faf0ea; border: 1px solid #ecccc0; color: #6b3a20; }
.vs .v2 { background: var(--green-soft); border: 1px solid #cfe3d6; color: #1d4a30; }
.vs b { display: block; margin-bottom: .2em; }

.formula {
  font-family: Georgia, "Times New Roman", serif; text-align: center;
  background: #f1ebd8; border: 1px dashed var(--gold); color: #4a3d1e;
  border-radius: .5em; padding: .68em .7em; font-size: .86em; line-height: 1.6; margin: .55em 0;
}
.formula + .formula { margin-top: -.25em; }

.quote {
  font-family: var(--serif); text-align: center; color: var(--green-deep);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: .95em 1.4em; margin: 1em 0; font-size: 1em; line-height: 1.8;
}

.bars { margin: .5em 0 .6em; }
.bars.tight .brow { margin-bottom: .22em; font-size: .68em; }
.bars.tight .brow .btrack { height: .8em; }
p.tiny { font-size: .72em !important; line-height: 1.55; color: var(--ink-2); margin-top: -.2em; }
.dense h3.sec { margin: .68em 0 .38em; }
.dense .kpis { margin: .6em 0 .3em; }
.dense .vs { margin: .4em 0 .55em; }
.dense .note, .dense .vs > div { font-size: .76em; }
.brow { display: flex; align-items: center; gap: .6em; margin-bottom: .4em; font-size: .72em; }
.brow .bl { flex: none; width: 9.8em; text-align: right; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .btrack { flex: 1; height: .95em; background: #eee7d2; border-radius: .5em; overflow: hidden; }
.brow .bfill { display: block; height: 100%; border-radius: .5em; background: linear-gradient(90deg, #1e6b40, #43a06e); }
.brow .bfill.neg { background: linear-gradient(90deg, #d08460, #c2410c); }
.brow .bv { flex: none; width: 4.6em; font-family: Georgia, serif; color: var(--green-deep); }
.brow .bv.neg { color: var(--orange); }

.twocol { column-count: 2; column-gap: 1.8em; }
.gterm { break-inside: avoid; margin-bottom: .8em; }
.gterm .gt { font-weight: 700; color: var(--green-deep); font-size: .88em; }
.gterm .gd { font-size: .76em; color: var(--ink-2); line-height: 1.55; }

.faq { margin-bottom: .85em; break-inside: avoid; }
.faq .fq { font-weight: 700; font-size: .88em; color: var(--ink); margin-bottom: .2em; }
.faq .fq::before { content: "Q "; font-family: Georgia; color: var(--gold); }
.faq .fa2 { font-size: .8em; color: var(--ink-2); line-height: 1.6; text-align: justify; }

/* 封面 / 封底 */
.page.cover, .page.back-cover {
  background:
    radial-gradient(130% 100% at 80% -10%, rgba(58,142,94,.5), transparent 55%),
    linear-gradient(158deg, #0f3a22, #0b2b19 58%, #10381f);
  color: #eef3ea; border-radius: 0 8px 8px 0;
}
.page.back .cover, .page.back.back-cover { border-radius: 8px 0 0 8px; }
.cover-frame { position: absolute; inset: 1.5em; border: 1px solid rgba(201,162,94,.55); border-radius: .45em; display: flex; flex-direction: column; padding: 2.2em 1.8em; }
.c-eyebrow { text-align: center; color: var(--gold); font-size: .72em; letter-spacing: .5em; text-indent: .5em; }
.c-title { font-family: var(--serif); font-weight: 700; text-align: center; font-size: 1.92em; line-height: 1.62; color: #f8f3e2; margin: auto 0; padding: 0 .4em; }
.c-en { text-align: center; font-size: .62em; letter-spacing: .12em; color: #9db8a6; line-height: 1.8; margin-bottom: auto; }
.c-meta { text-align: center; font-size: .72em; color: #bccfbd; line-height: 2; }
.c-hint { text-align: center; font-size: .64em; color: #9db8a6; line-height: 1.9; margin-top: .9em; letter-spacing: .06em; }
.c-org { text-align: center; font-size: .78em; color: var(--gold); line-height: 1.9; margin-top: .9em; }
.c-rule { width: 4.5em; height: 1px; background: var(--gold); opacity: .7; margin: 1em auto; }
.back-cover .c-slogan { font-family: var(--serif); text-align: center; font-size: 1.35em; line-height: 1.9; color: #f2ecd9; margin: auto 0; }
.back-cover .c-fine { text-align: center; font-size: .62em; color: #8fa895; line-height: 2; }

/* 翻页热区与箭头 */
.hitzone { position: absolute; top: 0; bottom: 0; width: 20%; z-index: 60; cursor: pointer; }
.hz-l { left: 0; } .hz-r { right: 0; }
.arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 70;
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,16,11,.55); border: 1px solid rgba(255,255,255,.18);
  color: #dfe8e0; font-size: 20px; line-height: 1; cursor: pointer; transition: .2s;
  backdrop-filter: blur(4px); font-family: Georgia, serif;
}
.arrow:hover { background: var(--green-deep); border-color: rgba(127,224,167,.5); }
.arrow.prev { left: 14px; } .arrow.next { right: 14px; }
.arrow[disabled] { opacity: .22; pointer-events: none; }

/* 目录浮层 */
.toc-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4,10,6,.66); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: .25s;
}
.toc-mask.open { opacity: 1; visibility: visible; }
.toc-panel {
  width: min(580px, 92vw); max-height: 84vh; overflow: auto;
  background: var(--paper); border-radius: 14px; padding: 26px 32px 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55); color: var(--ink);
}
.toc-panel h3 { font-family: var(--serif); font-size: 21px; color: var(--green-deep); margin-bottom: 10px; letter-spacing: .2em; }
.toc-panel h3 small { font-size: 12px; color: var(--gold); letter-spacing: .25em; margin-left: 8px; }
.toc-item {
  display: flex; align-items: baseline; gap: 10px; padding: 10px 6px;
  border-bottom: 1px dashed var(--line); cursor: pointer; font-size: 14.5px; border-radius: 6px;
}
.toc-item:hover { background: #efe8d3; }
.toc-item .tp { margin-left: auto; font-family: Georgia, serif; color: var(--ink-3); font-size: 13px; }
.toc-item .td { flex: 1; font-size: 12.5px; color: var(--ink-2); }
.toc-item .tt { font-weight: 700; color: var(--green-deep); white-space: nowrap; }
.toc-tip { margin-top: 14px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.toc-tip b { color: var(--green-deep); }
.toc-close {
  margin-top: 12px; width: 100%; padding: 9px 0; border: 1px solid var(--line);
  background: #fff; border-radius: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.toc-close:hover { background: var(--green-soft); color: var(--green-deep); }

/* ============ 手机竖屏优化 ============ */
/* 1) 时间线年份着色（行内排布，不增加行高） */
.timeline .tly { font-family: Georgia, serif; font-weight: 700; color: var(--gold); margin-right: .55em; }
.chart { width: 100%; height: auto; display: block; }

/* 2) 触控与滚动稳定：内滚不穿透、无双击缩放延迟 */
html { -webkit-text-size-adjust: 100%; }
.page-inner { overscroll-behavior: contain; }
.tb-btn, .pg-btn, .arrow, .hitzone, .toc-item, .toc-close { touch-action: manipulation; }

/* 3) 单页模式：极简双层翻页（任何时刻 DOM 最多两页，杜绝重叠/闪屏） */
.spage { position: absolute; inset: 0; }
.spage.pg-out { animation: pgOut .3s ease both; z-index: 2; }
.spage.pg-in  { animation: pgIn  .3s ease both; z-index: 2; }
@keyframes pgOut { to { opacity: 0; transform: translateX(-7%); } }
@keyframes pgIn  { from { opacity: 0; transform: translateX(7%); } }
body.single-mode .scene { perspective: none; }
body.single-mode .book { transform: none; }   /* 双保险：书位类残留也不会偏移 */
body.single-mode .page { box-shadow: 0 8px 20px rgba(0,0,0,.32); }
body.single-mode .page.front { box-shadow: inset -12px 0 20px -20px rgba(74,56,20,.38), 0 8px 20px rgba(0,0,0,.32); }

/* 4) 单页模式版式：放大页边距利用率 */
body.single-mode .page-inner { padding: 2.2em 1.4em 2.7em; }
body.single-mode .pageno { right: 1.2em; }
body.single-mode .runfoot { left: 1.4em; }
body.single-mode .eyebrow { letter-spacing: .14em; font-size: .64em; }
body.single-mode .ptitle { font-size: 1.5em; }
body.single-mode .arrow { width: 38px; height: 38px; }

/* 5) 手机断点（与 JS 的 880 阈值一致） */
@media (max-width: 880px) {
  .tb-brand span { display: none; }
  .tb-ch { display: none; }
  .pg-ind { min-width: 64px; }
  .progress { width: 24vw; }
  .hitzone { width: 24%; }
  .arrow.prev { left: 6px; } .arrow.next { right: 6px; }
  .book.single .toc-item .td { display: none; }
  .book.single .toc-item .tt { font-size: 13.5px; }
}

/* 6) 窄手机（≤560px）：多列组件改单列/双列，保证每行字数够读 */
@media (max-width: 560px) {
  .kpis, .kpis.k3 { grid-template-columns: repeat(2, 1fr); gap: .6em; }
  .kpi .n { font-size: 1.22em; }
  .twocol { column-count: 1; }
  .flow { flex-direction: column; gap: .45em; }
  .flow .fa { display: none; }
  .flow .fb { padding: .55em .7em; font-size: .78em; }
  .vs { grid-template-columns: 1fr; }
  .bars .bl { width: 7.4em; font-size: .62em; }
  .tbl { font-size: .8em; }
  .tbl th { white-space: normal; }
  .tbl td { word-break: break-word; }
  .quote { font-size: .95em; padding: .8em .9em; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .botbar { padding: 8px 10px 10px; gap: 10px; }
  .tb-brand { font-size: 13px; }
  .tb-btn { padding: 5px 10px; font-size: 12px; }
  .pg-btn { padding: 6px 11px; font-size: 12px; }
  .pg-ind { font-size: 12px; min-width: 58px; }
  .formula { font-size: .8em; }
  .chips .chip { font-size: .7em; }
  .cover-frame { padding: 1.6em 1.1em; }
  .c-title { font-size: 1.62em; }
}
@media (prefers-reduced-motion: reduce) {
  .book, .sheet, .progress i, .spage { transition: none !important; animation: none !important; }
}
