body[data-route="preview"]{background:radial-gradient(ellipse at 50% 40%,#F4EBDD,#E4D6C2 80%)}
.pv{min-height:100vh;display:flex;flex-direction:column;align-items:center;padding:18px 12px 30px}
.pv-top{width:100%;max-width:1100px;display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.pv-top a{font-weight:700;color:var(--plum)}
.pv-stage{display:flex;align-items:center;gap:14px;width:100%;justify-content:center;flex:1}
.pv-arrow{width:48px;height:48px;border-radius:50%;border:0;background:var(--plum);color:#fff;font-size:26px;cursor:pointer;flex:none;box-shadow:0 4px 10px rgba(0,0,0,.25)}
.pv-arrow[disabled]{opacity:.3;cursor:default}
.pv-viewport{padding:30px 34px;overflow:visible}
.pv-book3d{--W:437px;--H:620px;position:relative;width:calc(var(--W) * 2);height:var(--H);perspective:2600px;perspective-origin:50% 40%;user-select:none;-webkit-user-select:none;touch-action:pan-y;cursor:grab}
.pv-b3{position:absolute;inset:0;transform-style:preserve-3d;transition:transform .8s cubic-bezier(.5,0,.2,1);direction:ltr}
.pv-b3.closed{transform:translateX(calc(var(--W) * -0.5))}
.pv-b3.rtl.closed{transform:translateX(calc(var(--W) * 0.5))}
/* resting halves */
.pv-half{position:absolute;top:0;width:var(--W);height:var(--H)}
.pv-half.left{left:0}.pv-half.right{left:var(--W)}
.pv-half.off{visibility:hidden}
.pv-half .board{position:absolute;top:-6px;bottom:-6px;background:#4A1F3D;box-shadow:0 14px 30px rgba(40,20,10,.35),0 3px 6px rgba(0,0,0,.3);z-index:-2}
.pv-half.right .board{left:-2px;right:calc(-1 * var(--t) - 7px);border-radius:0 5px 5px 0}
.pv-half.left .board{right:-2px;left:calc(-1 * var(--t) - 7px);border-radius:5px 0 0 5px}
/* the page block: many thin sheets seen from the edge */
.pv-half .edge{position:absolute;top:2px;bottom:2px;width:var(--t);z-index:-1;background:repeating-linear-gradient(90deg,#fffdf8 0 1px,#d8cfbf 1px 2px)}
.pv-half.right .edge{left:100%;border-radius:0 2px 2px 0;box-shadow:inset 6px 0 6px -4px rgba(0,0,0,.25)}
.pv-half.left .edge{right:100%;border-radius:2px 0 0 2px;box-shadow:inset -6px 0 6px -4px rgba(0,0,0,.25)}
.pv-half.off .board,.pv-half.off .edge{visibility:hidden}
/* faces */
.pv-face{position:absolute;inset:0;overflow:hidden;background:#FDF9F1}
.pv-face.blank{background:#FBF8F2}
.pv-face>.pg{border-radius:0;box-shadow:none}
.pv-face .gut{position:absolute;top:0;bottom:0;width:15%;pointer-events:none;z-index:6}
.pv-face.right .gut{left:0;background:linear-gradient(90deg,rgba(0,0,0,.28),rgba(0,0,0,.08) 35%,transparent)}
.pv-face.left .gut{right:0;background:linear-gradient(270deg,rgba(0,0,0,.28),rgba(0,0,0,.08) 35%,transparent)}
.pv-face.is-cover .gut{width:5%}
.pv-face .sh{position:absolute;inset:0;background:#000;opacity:0;pointer-events:none;z-index:7}
.pv-face.is-cover{box-shadow:inset 0 0 0 1px rgba(0,0,0,.2)}
/* turning leaf: one continuous sheet folded along a moving line (see leaf.js) */
.pv-leaf{position:absolute;top:0;z-index:10;pointer-events:none}
.pv-leaf .cu-stage{position:absolute;top:0}
.pv-leaf .cu-clip,.pv-leaf .cu-flapout{position:absolute;left:0;top:0;width:100%;height:100%}
.pv-leaf .cu-flapt{position:absolute;left:0;top:0;width:0;height:0;transform-origin:0 0;will-change:transform}
.pv-leaf .cu-sh{position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;will-change:transform}
.cast{position:absolute;top:0;bottom:0;pointer-events:none;opacity:0;z-index:5;width:0}
.cast.cr{left:0;background:linear-gradient(90deg,rgba(0,0,0,.6),rgba(0,0,0,.15) 55%,transparent)}
.cast.cl{right:0;background:linear-gradient(270deg,rgba(0,0,0,.6),rgba(0,0,0,.15) 55%,transparent)}
.pv-cnt{margin-top:8px;color:var(--ink-soft);font-size:15px;font-weight:700}
.pv-hint{margin-top:4px;color:#9a8e7e;font-size:13px}
@media (max-width:760px){
  .pv-stage{flex-wrap:wrap;gap:10px}
  .pv-viewport{order:0;padding:16px 18px;width:100%;display:flex;justify-content:center}
  .pv-arrow{order:1}
  .pv-stage{direction:ltr}
  .pv-arrow.L{order:1}.pv-arrow.R{order:2}
}
body[data-route="preview"]{overflow-x:hidden}
.pv{overflow-x:clip}

/* direction picker (preview top bar) */
.pv-top .dirp{display:flex;gap:6px}
.pv-stage.ltr{direction:ltr}
/* Mobile review 5: explicit toolbar rows, compact stage, room for board edges. */
@media(max-width:760px){
 .pv{min-height:100dvh;justify-content:flex-start;padding:14px 12px 24px}
 .pv-top{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:center;margin-bottom:20px}
 .pv-top>a{font-size:14px}
 .pv-top>a:last-child{text-align:left;grid-column:2;grid-row:1}
 .pv-top>div{grid-column:1 / -1;grid-row:2;justify-self:stretch}
 .pv-top .dirp{justify-content:center}
 .pv-top .dirp button{min-height:44px}
 .pv-stage{flex:none;gap:16px;align-content:flex-start}
 .pv-viewport{padding:16px 24px 20px}
 .pv-cnt{margin-top:20px}
 .pv-hint{font-size:12px;text-align:center;margin-top:6px}
}

/* Phone preview: one page at a time, swipe to turn, pinch to enlarge. */
@media(max-width:760px){
 .ps{display:flex;justify-content:center;width:100%}
 .ps-view{overflow:visible;max-width:100%;touch-action:none;padding:14px 0 34px}
 .ps-view.zoomed{overflow:auto;padding:14px 34px 34px;touch-action:pan-x pan-y}
 .ps-box.turning .pv-face{box-shadow:none}
 .ps-box{position:relative;flex:none;background:#FDF9F1;border-radius:0;overflow:hidden;transition:transform .17s ease,opacity .17s ease;z-index:3}
 .ps-box .pv-face{position:relative;inset:auto;width:100%;height:100%;box-shadow:none}
 .ps-box .pv-face .gut{display:none}
 .ps-box .pv-face>.pg{border-radius:0}
 .ps-box.out-next{transform:translateX(-14%) scale(.97);opacity:.35}
 .ps-box.out-prev{transform:translateX(14%) scale(.97);opacity:.35}
 .ps-box.in-next{transform:translateX(10%);opacity:.5}
 .ps-box.in-prev{transform:translateX(-10%);opacity:.5}
}

/* Arrow looks. The glyph is an SVG chevron; style picked with data-arrow on <html> (a default). */
.pv-arrow svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;display:block;margin:auto}
:root:not([data-arrow]) .pv-arrow,:root[data-arrow=a] .pv-arrow{background:#fff;color:var(--plum);border:2px solid var(--plum);box-shadow:0 2px 6px rgba(60,40,20,.15);width:52px;height:52px}
:root[data-arrow=b] .pv-arrow{background:var(--lilac);color:var(--plum);border:0;border-radius:14px;width:84px;height:48px;box-shadow:none}
:root[data-arrow=c] .pv-arrow{background:transparent;color:var(--plum);border:0;box-shadow:none;width:64px;height:56px}
:root[data-arrow=c] .pv-arrow svg{width:38px;height:38px;stroke-width:3.2}

/* preview search */
.pv-sbtn{border:1.5px solid var(--plum-2);border-radius:999px;background:#fff;color:var(--plum);font-weight:700;padding:8px 18px;min-height:40px}
.pv-search{width:100%;max-width:440px;margin:6px auto 0;background:#fff;border:1.5px solid var(--plum-2);border-radius:8px;padding:12px;box-shadow:0 10px 24px rgba(0,0,0,.18);position:relative;z-index:30}
.pv-search[hidden]{display:none}

@media(max-width:760px){.pv-sbtn{grid-column:1/-1;grid-row:2;justify-self:center}.pv-search{box-sizing:border-box;min-width:0}}

/* Phone on its side: the open spread fits the short screen, arrows beside the book. */
@media (orientation:landscape) and (max-height:520px){
 .pv{padding:6px 10px 6px;min-height:0}
 .pv-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:2px;gap:10px}
 .pv-top>a{font-size:13px}
 .pv-top>div{grid-column:auto;grid-row:auto}
 .pv-sbtn{grid-column:auto;grid-row:auto;min-height:32px;padding:4px 16px}
 .pv-stage{flex-wrap:nowrap;gap:8px;align-content:center}
 .pv-viewport{order:0;width:auto;padding:8px 26px 10px}
 .pv-arrow{width:40px;height:40px;font-size:22px}
 .pv-arrow.L{order:-1}.pv-arrow.R{order:2}
 .pv-cnt{margin-top:0;font-size:13px}
 .pv-hint{display:none}
 .pv-viewport.zoomed{overflow:auto;max-width:calc(100vw - 130px);max-height:calc(100vh - 90px);touch-action:pan-x pan-y}
}

/* Phone book, a half of the open book: the spine side is not a binding but the rest of the book continuing off-screen
   (turned-pages stack, then the cover board, bleeding past the screen edge). The fore-edge side shows the unturned-pages stack.
   Resting page and stacks are flat: no inner shade, no curve. Only the turning leaves carry the turn shade. */
@media(max-width:760px){
  .ps-book{width:max-content;position:relative;flex:none;margin:0 26px 0 34px;zoom:var(--psz,1);--st:12px;--sp:6px}
 .ps-book.edge-l{margin:0 34px 0 26px}
 .ps-cover{position:absolute;inset:-8px calc(-8px - var(--st)) -8px -260px;border-radius:0 8px 8px 0;background:linear-gradient(135deg,#e9a9c3,#a7b7e6);box-shadow:inset 0 0 0 1px rgba(255,255,255,.35),0 18px 22px -8px rgba(50,30,20,.45),0 4px 6px rgba(50,30,20,.3)}
 .ps-book.edge-l .ps-cover{inset:-8px -260px -8px calc(-8px - var(--st));border-radius:8px 0 0 8px}
 .ps-hinge,.ps-stack2{display:none}
 .ps-prev{position:absolute;top:0;left:calc(-100% - 2px);overflow:hidden;background:#FBF8F2;z-index:3;pointer-events:none}
 .ps-book.edge-l .ps-prev{left:calc(100% + 2px)}
 .ps-prev .pv-face{position:relative;inset:auto;width:100%;height:100%;box-shadow:none}
 .ps-prev .pv-face .gut,.ps-prev .pv-face .sh{display:none}
 .ps-prev .pv-face>.pg{border-radius:0}
 .ps-stack,.ps-stack2{position:absolute;top:3px;bottom:3px;z-index:2;transition:width .3s,left .3s,right .3s}
 .ps-stack{z-index:4;width:var(--st)}
.ps-book.edge-r .ps-stack{left:auto;right:calc(-1 * var(--st));background:repeating-linear-gradient(90deg,#fffdf7 0 1px,#cfc5b2 1px 3px);border-radius:0 2px 2px 0}
 .ps-stack2{left:calc(-1 * var(--sp));width:var(--sp);background:repeating-linear-gradient(270deg,#fffdf7 0 1px,#cfc5b2 1px 3px)}
 .ps-book.edge-l .ps-stack{right:auto;left:calc(-1 * var(--st));background:repeating-linear-gradient(270deg,#fffdf7 0 1px,#cfc5b2 1px 3px);border-radius:2px 0 0 2px}
 .ps-book.rtl .ps-stack2{left:auto;right:calc(-1 * var(--sp));background:repeating-linear-gradient(90deg,#fffdf7 0 1px,#cfc5b2 1px 3px);border-radius:0}
}

.pv-face.flat .gut,.pv-face.flat .sh{display:none}
