/* ==========================================================================
   情满巴黎诗文选 · 电子书 —— 阅读器界面与书架
   ========================================================================== */

:root {
  --bg: #f5efe3;
  --bg-2: #ece3d1;
  --panel: rgba(253, 251, 246, 0.94);
  --line: rgba(122, 96, 58, 0.22);
  --txt: #3a3128;
  --txt-2: #8a7a64;
  --gold: #a3762e;
  --gold-2: #7d5c20;
  --paper: #fdfbf6;
  --ink: #33291b;
  --sans: "PingFang SC", "Microsoft YaHei", "微软雅黑", "Hiragino Sans GB",
          "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong",
           "SimSun", "宋体", serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
}

/* ================================================================ 阅读器 */
body.reader {
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #faf4e8 0%, #f1e8d6 52%, #e6dabf 100%);
}

/* ------------------------------------------------------------ 顶栏 */
.ui-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(253,251,246,.95), rgba(253,251,246,.72));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 60;
}
.ui-home {
  flex: none;
  color: var(--txt-2);
  text-decoration: none;
  font-size: 13px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: .18s;
}
.ui-home:hover { color: var(--gold); border-color: var(--gold-2); }
.ui-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 14px;
  color: var(--txt-2);
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ui-title b {
  color: var(--txt);
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: .1em;
  margin-left: 6px;
}
.ui-tools { flex: none; display: flex; gap: 6px; }
.ui-tools button, .ui-bottom button, .arrow {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--txt-2);
  background: rgba(255,255,255,.55);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 11px;
  cursor: pointer;
  transition: .18s;
  white-space: nowrap;
}
.ui-tools button:hover, .ui-bottom button:hover, .arrow:hover {
  color: #fffaf0;
  background: var(--gold);
  border-color: var(--gold);
}
.ui-tools button.on {
  color: #fffaf0;
  background: var(--gold);
  border-color: var(--gold);
}

/* ------------------------------------------------------------ 舞台 */
.stage {
  position: fixed;
  top: 54px; bottom: 58px; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  touch-action: pan-y;
}
.bookbox { position: relative; flex: none; }
.book {
  position: relative;
  width: 1800px;
  height: 1273px;
  transform-origin: top left;
}
.book.single { width: 900px; }
/* perspective 仅在翻页动画期间（.flip3d）启用：
   静止书页若常驻 3D 上下文，zoom 缩放下左右页会因 3D 层光栅化路径不同
   而出现大小/清晰度不一致。空闲态全部平面化，文字渲染完全一致。 */
.book.noanim .sheet { transition: none !important; }

.sheet {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transition: transform .78s cubic-bezier(.46, .04, .28, 1);
}
/* 静止表象（平面）：已翻过的书帖整体平移到左半边，内容不镜像 */
.sheet.flipped { transform: translateX(-100%); }
.sheet.anim { z-index: 9000 !important; }
.face {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fdfbf6;
}
.face.back { transform: none; }
/* 平面表象：正背面绝对定位叠放，按翻转状态切换可见面 */
.sheet:not(.flipped) .face.back { visibility: hidden; }
.sheet.flipped .face.front { visibility: hidden; }

/* 翻页动画期间的 3D 表象：与旧版完全一致 */
.book.flip3d { perspective: 2600px; perspective-origin: 50% 50%; }
.book.flip3d .sheet { transform-style: preserve-3d; will-change: transform; }
.book.flip3d .sheet.flipped { transform: rotateY(-180deg); }
.book.flip3d .sheet .face { visibility: visible; }
.book.flip3d .face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.book.flip3d .face.back { transform: rotateY(180deg); }
.face .page { transform-origin: top left; }

/* 书脊与书封底衬 */
.book-base {
  position: absolute;
  top: -14px; bottom: -14px;
  left: 200px; right: 200px;
  background: linear-gradient(90deg, #cbb896, #e6dcc4 50%, #cbb896);
  border-radius: 6px;
  box-shadow: 0 34px 80px rgba(90, 70, 40, .38);
  z-index: 0;
}

/* 单页模式：滑动 */
.book.single .page-slot { position: absolute; inset: 0; }
.book.single .page-slot.slide-in-r { animation: slideR .34s ease-out; }
.book.single .page-slot.slide-in-l { animation: slideL .34s ease-out; }
@keyframes slideR { from { transform: translateX(46px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes slideL { from { transform: translateX(-46px); opacity: .3; } to { transform: none; opacity: 1; } }

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 92px;
  font-size: 26px;
  line-height: 1;
  color: var(--txt-2);
  background: rgba(253,251,246,.8);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .18s;
  opacity: .55;
}
.arrow.prev { left: 10px; }
.arrow.next { right: 10px; }
.stage:hover .arrow { opacity: 1; }
.arrow:hover { color: #fffaf0; background: var(--gold); }

/* ------------------------------------------------------------ 底栏 */
.ui-bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(0deg, rgba(253,251,246,.96), rgba(253,251,246,.7));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  z-index: 60;
}
.sliderwrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
input[type=range] {
  flex: 1;
  min-width: 60px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(122,96,58,.18);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--paper);
  cursor: pointer;
}
.pglabel {
  flex: none;
  font-size: 12.5px;
  color: var(--txt-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  min-width: 122px;
  text-align: right;
}
.pglabel b { color: var(--txt); }

/* ------------------------------------------------------------ 抽屉 */
.drawer {
  position: fixed;
  top: 54px;
  right: 0;
  bottom: 58px;
  width: 380px;
  max-width: 92vw;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--line);
  transform: translateX(102%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }
.dw-tabs {
  flex: none;
  display: flex;
  border-bottom: 1px solid var(--line);
}
.dw-tabs button {
  flex: 1;
  padding: 13px 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--txt-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: .18s;
}
.dw-tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
.dw-body { flex: 1; overflow: auto; padding: 12px 14px 24px; }
.dw-body::-webkit-scrollbar { width: 8px; }
.dw-body::-webkit-scrollbar-thumb { background: rgba(163,118,46,.28); border-radius: 4px; }
.dw-filter {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 12px;
  background: rgba(255,255,255,.6);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--txt);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
}
.dw-filter:focus { border-color: var(--gold-2); }
.toc-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: .14s;
  border-bottom: 1px solid rgba(220,205,175,.07);
}
.toc-row:hover { background: rgba(163,118,46,.09); }
.toc-row.cur { background: rgba(163,118,46,.16); }
.toc-row .tr-no {
  flex: none; width: 30px;
  font-size: 11.5px; color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}
.toc-row .tr-t {
  flex: 1; font-size: 13.5px; line-height: 1.5; color: var(--txt);
  font-family: var(--serif);
}
.toc-row .tr-p {
  flex: none; font-size: 11.5px; color: var(--txt-2);
  font-variant-numeric: tabular-nums;
}
.toc-vol {
  margin: 18px 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--gold-2);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: .08em;
}
.toc-vol:first-child { margin-top: 4px; }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 900 / 1273;
  overflow: hidden;
  border-radius: 3px;
  background: #fdfbf6;
  border: 1px solid rgba(122,96,58,.25);
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(90,70,40,.22);
}
.thumb.cur { outline: 2px solid var(--gold); outline-offset: 1px; }
.thumb > .tinner {
  position: absolute;
  top: 0; left: 0;
  width: 900px;
  height: 1273px;
  transform-origin: top left;
  pointer-events: none;
}
.thumb > .tno {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  text-align: center;
  font-size: 9px;
  color: #6d6558;
  background: rgba(253,251,246,.9);
  padding: 1px 0;
}
.thumb-filler { font-size: 11px; color: var(--txt-2); text-align: center; padding: 16px 0; }

/* ------------------------------------------------------------ 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(253,251,246,.97);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: 0 6px 22px rgba(90,70,40,.22);
  opacity: 0;
  pointer-events: none;
  transition: .26s;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ================================================================ 书架 */
body.shelf {
  background: #f6f1e6;
  color: var(--txt);
  overflow-x: hidden;
}
.shelf-hero {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.shelf-hero .hero-bg {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center 40%;
  filter: blur(22px) saturate(.8) brightness(.9) sepia(.25);
  transform: scale(1.06);
}
.shelf-hero .hero-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 70% at 50% 45%, rgba(250,245,234,.5), #f6f1e6 78%);
}
.hero-inner {
  position: relative;
  text-align: center;
  padding: 92px 26px 80px;
  max-width: 860px;
}
.hero-series {
  font-size: 13px;
  letter-spacing: .68em;
  color: var(--gold-2);
  text-indent: .68em;
}
.hero-title {
  font-family: var(--serif);
  font-size: 62px;
  font-weight: 700;
  letter-spacing: .16em;
  text-indent: .16em;
  color: var(--ink);
  margin: 22px 0 0;
  line-height: 1.2;
}
.hero-rule { width: 76px; height: 1px; background: var(--gold-2); margin: 26px auto; }
.hero-sub { font-size: 17px; color: var(--txt-2); letter-spacing: .22em; }
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 58px;
  margin: 44px 0 34px;
  flex-wrap: wrap;
}
.hero-stats div { text-align: center; }
.hero-stats b {
  display: block;
  font-family: var(--serif);
  font-size: 34px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: .04em;
}
.hero-stats span { font-size: 12.5px; color: var(--txt-2); letter-spacing: .22em; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block;
  font-size: 14px;
  letter-spacing: .1em;
  padding: 12px 26px;
  border-radius: 4px;
  text-decoration: none;
  transition: .2s;
  border: 1px solid var(--gold-2);
  color: var(--gold-2);
}
.btn:hover { background: var(--gold); color: #fffaf0; border-color: var(--gold); }
.btn.ghost { border-color: var(--line); color: var(--txt-2); }
.btn.ghost:hover { background: rgba(163,118,46,.12); color: var(--gold-2); border-color: var(--gold-2); }

.shelf-sec { max-width: 1240px; margin: 0 auto; padding: 66px 26px; }
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 34px;
}
.sec-head h2 {
  font-family: var(--serif);
  font-size: 25px;
  letter-spacing: .12em;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}
.sec-head span { font-size: 12.5px; color: var(--txt-2); letter-spacing: .18em; }

.vol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 30px 26px;
}
.vol-card { text-decoration: none; color: inherit; display: block; }
.vol-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 900 / 1273;
  border-radius: 3px;
  overflow: hidden;
  background: #e8e0cf;
  box-shadow: 0 14px 34px rgba(90,70,40,.3);
  transition: transform .32s cubic-bezier(.4,0,.2,1), box-shadow .32s;
}
.vol-card:hover .vol-cover {
  transform: translateY(-7px);
  box-shadow: 0 24px 48px rgba(90,70,40,.38);
}
.vol-cover .vc-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 42%;
}
.vol-cover .vc-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(253,250,244,.95) 0%, rgba(253,250,244,.8) 22%,
      rgba(253,250,244,.16) 46%, rgba(20,16,10,.34) 100%);
}
.vol-cover .vc-txt {
  position: absolute;
  left: 12%; right: 12%;
  top: 8%;
  text-align: center;
  color: #241d13;
}
.vol-cover .vc-cn {
  font-size: 10px;
  letter-spacing: .42em;
  text-indent: .42em;
  color: #8a7a5c;
}
.vol-cover .vc-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  margin-top: 8px;
  white-space: nowrap;
}
.vol-cover .vc-cnt {
  position: absolute;
  left: 0; right: 0; bottom: 10px;
  text-align: center;
  font-size: 11px;
  letter-spacing: .14em;
  color: rgba(255,255,255,.94);
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.vol-meta { margin-top: 14px; }
.vol-meta .vm-name {
  font-family: var(--serif);
  font-size: 16.5px;
  letter-spacing: .08em;
  color: var(--ink);
}
.vol-meta .vm-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--txt-2);
  letter-spacing: .06em;
}
.vol-meta .vm-links { margin-top: 10px; display: flex; gap: 8px; }
.vol-meta .vm-links a {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--txt-2);
  text-decoration: none;
  transition: .18s;
}
.vol-meta .vm-links a:hover { color: #fffaf0; background: var(--gold); border-color: var(--gold); }

.about-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 46px; }
.about-cols h3 {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--gold-2);
  letter-spacing: .12em;
  margin: 0 0 14px;
}
.about-cols p {
  font-size: 14px;
  line-height: 2;
  color: #5d5346;
  margin: 0 0 14px;
  text-align: justify;
}
.about-cols ul { margin: 0; padding-left: 18px; }
.about-cols li { font-size: 14px; line-height: 2; color: #5d5346; }

.shelf-foot {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 40px 26px 56px;
  font-size: 12.5px;
  color: #9a8e7a;
  letter-spacing: .1em;
  line-height: 2.1;
}
.shelf-foot a { color: var(--gold-2); text-decoration: none; }
.shelf-foot a:hover { text-decoration: underline; }

/* ================================================================ 滚动版 */
body.scroll { background: #f2ece1; color: #2c2a26; }
.sc-pgnum {
  font-size: 12px;
  color: #a9a094;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  white-space: nowrap;
}
.sc-btn {
  font-family: var(--sans);
  font-size: 13px;
  color: #7a6a50;
  background: #fff;
  border: 1px solid #e0d8c8;
  border-radius: 4px;
  padding: 7px 12px;
  cursor: pointer;
  transition: .18s;
}
.sc-btn:hover { background: #efe8db; }
body.scroll .drawer { top: 54px; bottom: 0; background: rgba(253,251,246,.97); border-left: 1px solid rgba(122,96,58,.22); }
body.scroll #scpanel { overflow: auto; padding: 14px; }
.sc-head {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  height: 54px;
  background: rgba(253,251,246,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #e0d8c8;
}
.sc-head a {
  color: #7a6a50;
  text-decoration: none;
  font-size: 13px;
  padding: 7px 12px;
  border: 1px solid #e0d8c8;
  border-radius: 4px;
}
.sc-head a:hover { background: #efe8db; }
.sc-head .sc-title {
  flex: 1;
  text-align: center;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: .1em;
  color: #3a3128;
}
.sc-progress {
  position: fixed;
  top: 54px; left: 0;
  height: 2px;
  background: var(--gold-2);
  width: 0;
  z-index: 51;
  transition: width .1s linear;
}
.sc-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 34px 0 90px;
}
.sc-page {
  position: relative;
  margin: 0 auto 30px;
  box-shadow: 0 8px 30px rgba(90,70,40,.16);
  border: 1px solid #e6dfd2;
  background: #fdfbf6;
  overflow: hidden;
}
.sc-page .page { transform-origin: top left; }
.sc-num {
  text-align: center;
  font-size: 12px;
  color: #a9a094;
  letter-spacing: .16em;
  margin: -14px 0 34px;
}
.sc-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sc-top button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #d8cfbd;
  background: rgba(253,251,246,.95);
  color: #7a6a50;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(90,70,40,.18);
  transition: .18s;
}
.sc-top button:hover { background: var(--gold); color: #fffaf0; }

/* ================================================================ 总目录页 */
.cat-wrap { column-count: 1; }
.cat-vol {
  margin: 34px 0 12px;
  padding: 10px 0 10px 14px;
  border-left: 3px solid var(--gold-2);
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: .1em;
  color: var(--ink);
}
.cat-vol:first-child { margin-top: 0; }
.cat-vol span {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--txt-2);
  margin-left: 14px;
  letter-spacing: .1em;
}
.cat-list { list-style: none; margin: 0 0 8px; padding: 0; }
.cat-list li { border-bottom: 1px solid rgba(122,96,58,.12); }
.cat-list a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 10px;
  text-decoration: none;
  border-radius: 4px;
  transition: .14s;
}
.cat-list a:hover { background: rgba(163,118,46,.09); }
.cl-no {
  flex: none; width: 34px;
  font-size: 11.5px; color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}
.cl-t {
  flex: 1; min-width: 0;
  font-family: var(--serif);
  font-size: 14px; color: var(--txt);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cl-d {
  flex: none; width: 92px;
  font-size: 11.5px; color: #9a8e7a;
  font-variant-numeric: tabular-nums;
}
.cl-p {
  flex: none; width: 118px; text-align: right;
  font-size: 11.5px; color: #9a8e7a;
}
@media (min-width: 900px) { .cat-wrap { column-count: 2; column-gap: 44px; } }
.cat-vol, .cat-list { break-inside: avoid-column; }

@media (max-width: 860px) {
  .ui-title { font-size: 12px; }
  .ui-title b { font-size: 14px; }
  .ui-tools button { padding: 7px 8px; font-size: 12px; }
  .arrow { display: none; }
  .pglabel { min-width: 88px; font-size: 11.5px; }
  .hero-title { font-size: 40px; }
  .hero-stats { gap: 30px; }
  .about-cols { grid-template-columns: 1fr; gap: 30px; }
  .drawer { width: 100%; }
  .thumb-grid { grid-template-columns: repeat(3, 1fr); }
  .sc-wrap { padding: 20px 8px 70px; }
}
