/* ============================================
   「我的菜谱」活页书 · 预览样式（.cb- 前缀）
   确认后并入正式样式；纯 CSS 3D，无第三方库
   ============================================ */
.cb-hidden { display: none !important; }

/* 桌面与书 */
.cb-stage {
  min-height: calc(100vh - 60px); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px 12px 60px;
  background: radial-gradient(120% 90% at 50% 0%, #f8f0e0, #efe2ca);
}
.cb-book {
  position: relative; width: min(940px, 96vw); aspect-ratio: 16 / 10.5;
  perspective: 2600px; cursor: pointer;
}
.cb-book::before { /* 书在桌上的投影 */
  content: ''; position: absolute; left: 4%; right: 4%; bottom: -16px; height: 30px;
  background: radial-gradient(50% 100% at 50% 0%, rgba(80, 55, 25, .32), transparent 72%);
  filter: blur(5px);
}

/* 书脊：圆弧凹陷 + 金属圆环 */
.cb-spine {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 58px; transform: translateX(-50%);
  z-index: 390; pointer-events: none;
  background: linear-gradient(90deg,
    rgba(90, 60, 30, 0) 0%, rgba(90, 60, 30, .18) 40%,
    rgba(55, 36, 16, .34) 50%, rgba(90, 60, 30, .18) 60%, rgba(90, 60, 30, 0) 100%);
}
.cb-rings {
  position: absolute; left: 50%; top: 5%; bottom: 5%; width: 30px; transform: translateX(-50%);
  z-index: 400; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
}
.cb-ring {
  width: 24px; height: 24px; border-radius: 50%;
  border: 4px solid #c8c8d0;
  border-top-color: #eeeef4; border-left-color: #dddde6;
  box-shadow: 0 2px 4px rgba(60, 40, 20, .35), inset 0 1px 2px rgba(255, 255, 255, .6);
  background: transparent;
}

/* 活页（翻页器）：一整页翻转，落地干净不重叠 */
.cb-leaf {
  position: absolute; left: 50.4%; top: 1.5%; bottom: 1.5%; width: 48.5%;
  transform-style: preserve-3d; transform-origin: left center;
  transition: transform .72s cubic-bezier(.45, .05, .45, .95);
  will-change: transform; backface-visibility: hidden;
}
.cb-leaf.turned { transform: rotateY(-180deg); }
.cb-leaf.no-anim { transition: none !important; }
.cb-leaf.flipping { z-index: 1000 !important; }
.cb-pg { position: absolute; inset: 0; }

/* 明暗：用预置渐变层的 opacity 动画（合成器直驱，不触发重排/重栅格化），交界处亮度连续 */
.cb-shd { position: absolute; inset: 0; background: #2f1d0c; opacity: 0; pointer-events: none; }
.cb-book.flipping-fwd .cb-face.pr .cb-shd { animation: cb-shd-f .72s ease both; }
.cb-book.flipping-fwd .cb-face.pl .cb-shd { animation: cb-shd-b .72s ease both; }
.cb-book.flipping-back .cb-face.pl .cb-shd { animation: cb-shd-f .72s ease both; }
.cb-book.flipping-back .cb-face.pr .cb-shd { animation: cb-shd-b .72s ease both; }
@keyframes cb-shd-f { 0% { opacity: 0; } 50% { opacity: .24; } 100% { opacity: .24; } }
@keyframes cb-shd-b { 0% { opacity: .24; } 60% { opacity: .1; } 100% { opacity: 0; } }

/* 翻页时在下方页面扫过的投影 */
.cb-sweep {
  position: absolute; top: 1.5%; bottom: 1.5%; width: 48.5%; z-index: 390;
  pointer-events: none; opacity: 0;
}
.cb-sweep.l { left: 1.1%; border-radius: 12px 4px 4px 12px; background: linear-gradient(90deg, transparent 35%, rgba(80, 55, 25, .3)); }
.cb-sweep.r { left: 50.4%; border-radius: 4px 12px 12px 4px; background: linear-gradient(270deg, transparent 35%, rgba(80, 55, 25, .3)); }
.cb-book.flipping-fwd .cb-sweep.l { animation: cb-sweep .72s ease; }
.cb-book.flipping-back .cb-sweep.r { animation: cb-sweep .72s ease; }
@keyframes cb-sweep { 0% { opacity: 0; } 45% { opacity: 1; } 100% { opacity: 0; } }

/* 静态左右页 */
.cb-page {
  position: absolute; top: 1.5%; bottom: 1.5%; width: 48.5%; z-index: 2;
  background: #fffdf6; box-shadow: 0 3px 12px rgba(80, 55, 25, .16); overflow: hidden;
}
.cb-left { left: 1.1%; border-radius: 12px 4px 4px 12px; }
.cb-right { left: 50.4%; border-radius: 4px 12px 12px 4px; }
.cb-page::before { /* 打孔 */
  content: ''; position: absolute; top: 5%; bottom: 5%; width: 14px; z-index: 3; pointer-events: none;
  background-image: radial-gradient(circle at center, rgba(96, 72, 40, .38) 3.2px, rgba(70, 50, 25, .18) 4px, transparent 4.6px);
  background-size: 100% calc(100% / 8);
}
.cb-left::before { right: -7px; }
.cb-right::before { left: -7px; }
.cb-left::after { /* 纸纹 + 靠书脊弧度阴影 */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    linear-gradient(270deg, rgba(90, 60, 30, .13), transparent 14%),
    repeating-linear-gradient(0deg, rgba(150, 120, 80, .025) 0 1px, transparent 1px 3px);
}
.cb-right::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(90, 60, 30, .13), transparent 14%),
    repeating-linear-gradient(0deg, rgba(150, 120, 80, .025) 0 1px, transparent 1px 3px);
}

.cb-face {
  position: absolute; inset: 0; overflow: hidden; will-change: transform;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: #fffdf6;
  box-shadow: 0 3px 12px rgba(80, 55, 25, .16);
  outline: 1px solid transparent;   /* 3D 旋转时的边缘抗锯齿 */
}
.cb-face.pr { border-radius: 4px 12px 12px 4px; transform: translateZ(.3px); }   /* 右页：向前 0.3px 防共面 */
.cb-face.pl {
  border-radius: 12px 4px 4px 12px;
  transform: rotateY(180deg) translateZ(.3px);
}  /* 左页（背面）：同向 +0.3px，翻转后仍在前层 */
/* 纸纹 + 靠书脊的弧度阴影 */
.cb-face::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: repeating-linear-gradient(0deg, rgba(150, 120, 80, .025) 0 1px, transparent 1px 3px);
}
.cb-face.pr::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 14%; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(90, 60, 30, .13), transparent);
}
.cb-face.pl::before {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 14%; z-index: 1; pointer-events: none;
  background: linear-gradient(270deg, rgba(90, 60, 30, .13), transparent);
}
/* 打孔：挂在活页上，翻转后自动转到书脊侧 */
.cb-holes {
  position: absolute; top: 5%; bottom: 5%; width: 14px; left: -7px; z-index: 5; pointer-events: none;
  background-image: radial-gradient(circle at center, rgba(96, 72, 40, .38) 3.2px, rgba(70, 50, 25, .18) 4px, transparent 4.6px);
  background-size: 100% calc(100% / 8);
}

/* 封面（内容包在 .cb-cover-bg 里，跟随 .pg 裁切） */
.cb-cover-bg {
  position: absolute; inset: 0;
  background: linear-gradient(150deg, var(--cb-bg1, #e6d3a8), var(--cb-bg2, #cfb47e));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18), inset -14px 0 24px rgba(80, 50, 20, .18), 0 6px 18px rgba(80, 55, 25, .28);
}
.cb-cover-inner-content { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 3; }
.cb-cover-title {
  font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(24px, 4.4vw, 40px); letter-spacing: 4px; color: var(--cb-accent, #7a5c33);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35); text-align: center; padding: 0 8%;
}
.cb-cover-sub { font-size: 14px; color: var(--cb-accent, #7a5c33); opacity: .8; letter-spacing: 2px; }
.cb-cover-deco { font-size: 34px; letter-spacing: 8px; filter: drop-shadow(0 2px 3px rgba(80, 50, 20, .25)); }
.cb-cover-frame { position: absolute; inset: 12px; border: 2px solid var(--cb-accent, #7a5c33); border-radius: 8px; opacity: .45; pointer-events: none; }
.cb-cover-edit {
  position: absolute; right: 14px; bottom: 14px; z-index: 5;
  border: 0; background: rgba(255, 255, 255, .55); color: var(--cb-accent, #7a5c33);
  width: 38px; height: 38px; border-radius: 50%; font-size: 17px; cursor: pointer; transition: .15s;
}
.cb-cover-edit:hover { transform: translateY(-2px) rotate(-6deg); background: rgba(255, 255, 255, .8); }

/* 封里（搜索页） */
.cb-cover-inner-page { padding: 9% 9% 6% 12%; display: flex; flex-direction: column; gap: 12px; height: 100%; box-sizing: border-box; }
.cb-inner-title { font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 21px; letter-spacing: 2px; color: #7a5c33; }
.cb-stat { font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif; color: #a3927a; font-size: 14px; letter-spacing: 1px; }
.cb-search-hint { font-size: 12.5px; color: #b3a48c; line-height: 1.7; }

/* 目录页 */
.cb-toc { padding: 7% 8% 5% 13%; display: flex; flex-direction: column; height: 100%; box-sizing: border-box; overflow: hidden; }
.cb-toc-title {
  font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif;
  text-align: center; font-size: 24px; letter-spacing: 10px; color: #7a5c33; margin-bottom: 10px;
}
.cb-toc-cat {
  font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14.5px; color: var(--primary-dark, #15803d); margin: 9px 0 4px; letter-spacing: 1px;
}
.cb-toc-cat em { font-style: normal; color: #b3a48c; font-size: 12px; margin-left: 6px; }
.cb-toc-item {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  border: 0; background: none; padding: 4.5px 6px; border-radius: 7px;
  font-size: 14.5px; color: #57534e; cursor: pointer; transition: .12s; text-align: left;
}
.cb-toc-item:hover { background: #f6efdd; }
.cb-toc-item .cb-toc-name { font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif; flex-shrink: 0; }
.cb-toc-item i { flex: 1; border-bottom: 1.5px dotted #d9cbb2; transform: translateY(-3px); }
.cb-toc-item b { color: #b3a48c; font-weight: 600; font-size: 12.5px; flex-shrink: 0; }
.cb-toc-item.hit { background: #fff3c2; }
.cb-toc-item.dim { opacity: .28; }

/* 菜品页 */
.cb-dish-photo-page { padding: 7% 8% 5% 13%; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cb-photo-wrap { position: relative; width: 86%; background: #fff; padding: 10px 10px 30px; border-radius: 4px; box-shadow: 0 4px 14px rgba(80, 55, 25, .2); transform: rotate(-1.2deg); }
.cb-photo {
  height: clamp(160px, 26vw, 300px); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; font-size: clamp(56px, 9vw, 96px);
  transition: .2s;
}
.cb-photo.swap { transform: scale(.94); opacity: .4; }
.cb-tape { position: absolute; width: 74px; height: 20px; background: linear-gradient(100deg, rgba(255, 210, 130, .5), rgba(255, 228, 170, .34) 48%, rgba(255, 210, 130, .48)); box-shadow: 0 1px 3px rgba(107, 78, 40, .14); z-index: 2; }
.cb-tape.tl { left: -20px; top: -8px; transform: rotate(-38deg); clip-path: polygon(2.5% 8%, 97% 0, 100% 90%, 97.5% 100%, 2% 94%, 0 12%); }
.cb-tape.tr { right: -20px; top: -8px; transform: rotate(38deg); clip-path: polygon(2.5% 8%, 97% 0, 100% 90%, 97.5% 100%, 2% 94%, 0 12%); }
.cb-dots { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; gap: 6px; }
.cb-dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; background: #ddd3c4; cursor: pointer; padding: 0; transition: .15s; }
.cb-dots button.on { background: var(--orange, #f59e0b); transform: scale(1.25); }
.cb-photo-cap { margin-top: 10px; font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif; color: #b3a48c; font-size: 13px; letter-spacing: 1px; }

.cb-dish-text-page { padding: 6.5% 10% 4.5% 13%; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; }
.cb-dish-name { font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: clamp(19px, 2.6vw, 26px); letter-spacing: 1.5px; color: #57534e; }
.cb-dish-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 7px 0 10px; }
.cb-dish-meta .cb-stars { color: var(--orange, #f59e0b); font-size: 13px; letter-spacing: 1px; }
.cb-sec-title { font-size: 12.5px; color: #b3a48c; letter-spacing: 2px; margin: 4px 0 6px; }
.cb-steps { list-style: none; counter-reset: cbstep; overflow: hidden; }
.cb-steps li {
  counter-increment: cbstep; position: relative; padding: 3.5px 0 3.5px 30px;
  font-size: 13.5px; line-height: 1.55; color: #57534e;
}
.cb-steps li::before {
  content: counter(cbstep); position: absolute; left: 0; top: 4px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--primary, #16a34a); color: #fff;
  font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.cb-notes {
  background: #fdf6d8; color: #7a6a45; font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13.5px; line-height: 1.7; padding: 10px 14px 10px 16px;
  clip-path: polygon(13px 0, 100% 0, 100% 100%, 0 100%, 0 13px); position: relative;
}
.cb-notes::before { content: ''; position: absolute; left: 0; top: 0; width: 13px; height: 13px; background: linear-gradient(135deg, transparent 49%, #e3d193 51%); }
.cb-dish-foot {
  margin-top: auto; padding-top: 8px; border-top: 1.5px dashed #e8dcc4;
  font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #b3a48c; font-size: 12.5px; letter-spacing: 1.5px; display: flex; justify-content: space-between;
}

/* 末页 / 封底板 */
.cb-theend { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 8px; }
.cb-theend b { font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 24px; letter-spacing: 6px; color: #7a5c33; }
.cb-theend span { font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif; color: #b3a48c; font-size: 13px; letter-spacing: 2px; }
.cb-backboard {
  position: absolute; left: 50.4%; top: 1.5%; bottom: 1.5%; width: 48.5%; z-index: 1;
  background: linear-gradient(150deg, #d9c49a, #c3a874); border-radius: 4px 12px 12px 4px;
  box-shadow: inset -10px 0 20px rgba(80, 50, 20, .22);
}

/* 书签 & 分类侧签 */
.cb-ribbon {
  position: absolute; top: -16px; right: 22%; z-index: 450;
  border: 0; cursor: pointer; padding: 7px 16px 9px; font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, #e05d3d, #c8452a);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  box-shadow: 0 3px 8px rgba(180, 60, 30, .35); transition: .15s;
  font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: 1px;
}
.cb-ribbon:hover { transform: translateY(-3px); }
.cb-tabs { position: absolute; right: -12px; top: 14%; z-index: 450; display: flex; flex-direction: column; gap: 6px; }
.cb-tab {
  border: 0; cursor: pointer; writing-mode: vertical-lr; letter-spacing: 3px;
  padding: 12px 5px; font-size: 12px; color: #fff; border-radius: 0 6px 6px 0;
  box-shadow: 2px 2px 6px rgba(80, 55, 25, .25); transition: .15s;
  font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.cb-tab:hover { transform: translateX(3px); }

/* 封面色卡 */
.cb-swatches { display: flex; gap: 10px; }
.cb-swatch { width: 52px; height: 52px; border-radius: 12px; border: 3px solid transparent; cursor: pointer; box-shadow: 0 2px 6px rgba(80, 55, 25, .2); transition: .15s; }
.cb-swatch:hover { transform: translateY(-2px); }
.cb-swatch.on { border-color: var(--primary, #16a34a); transform: scale(1.06); }

/* 封里：编辑封面入口（比只藏在封面右下角的小按钮更易发现） */
.cb-cover-edit-inner {
  margin-top: auto; align-self: flex-start;
  border: 1.5px dashed #d9cbb2; background: rgba(255, 255, 255, .6);
  color: #7a5c33; font-family: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13.5px; padding: 7px 16px; border-radius: 999px; cursor: pointer; transition: .15s;
}
.cb-cover-edit-inner:hover { background: #fff; border-color: var(--orange, #f59e0b); transform: translateY(-1px); }

@media (prefers-reduced-motion: reduce) {
  .cb-leaf { transition: none !important; }
}
@media (max-width: 760px) {
  .cb-book { width: 96vw; }
  .cb-rings { width: 18px; }
  .cb-ring { width: 16px; height: 16px; border-width: 3px; }
}
