/* User manual book viewer (/manual) — see public/assets/manual-viewer.js. */
.manual-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.manual-title { margin: 0 0 .2rem; font-size: 1.25rem; }
.manual-pick { display: flex; flex-direction: column; gap: .25rem; min-width: 240px; }
.manual-pick select { padding: .45rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font: inherit; }

.book { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.book:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.book-bar { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.book-chapters { flex: 1 1 220px; max-width: 420px; min-width: 0; padding: .4rem .55rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font: inherit; }
.book-nav { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.book-count { font-variant-numeric: tabular-nums; min-width: 9.5em; text-align: center; font-size: .9rem; color: var(--muted); }
.book .flip-x { transform: scaleX(-1); }

/* The table the book lies on: warm wood, like the Vuli splash. */
.book-stage { background: #2B1A12; background-image: radial-gradient(ellipse at 50% 30%, #3d261a 0%, #2B1A12 70%); padding: 1.25rem 1rem; display: flex; justify-content: center; outline: none; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.book:fullscreen .book-stage { flex: 1; align-items: center; }
.book-stage:focus-visible { box-shadow: inset 0 0 0 3px var(--accent); }
.book-spread { position: relative; display: flex; perspective: 2400px; }
.book-page { width: var(--pw); height: var(--ph); background: #fff; position: relative; overflow: hidden; }
.book-page canvas, .leaf-face canvas { width: 100%; height: 100%; display: block; }
.book-page.empty { background: transparent; }
.two-up .book-page.left { box-shadow: -6px 10px 24px rgba(0, 0, 0, .35); border-radius: 4px 0 0 4px; }
.two-up .book-page.right { box-shadow: 6px 10px 24px rgba(0, 0, 0, .35); border-radius: 0 4px 4px 0; }
.two-up .book-page.empty { box-shadow: none; }
/* The fold in the middle of the book. */
.two-up .book-page.left:not(.empty)::after, .two-up .book-page.right:not(.empty)::after { content: ""; position: absolute; top: 0; bottom: 0; width: 28px; pointer-events: none; }
.two-up .book-page.left:not(.empty)::after { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, .14), transparent); }
.two-up .book-page.right:not(.empty)::after { left: 0; background: linear-gradient(to right, rgba(0, 0, 0, .14), transparent); }
.book-page.single { box-shadow: 0 10px 24px rgba(0, 0, 0, .35); border-radius: 4px; }

/* Page turn: a leaf the size of one page, hinged on the spine. */
.book-leaf { position: absolute; top: 0; width: var(--pw); height: var(--ph); transform-style: preserve-3d; transition: transform .7s cubic-bezier(.645, .045, .355, 1); z-index: 3; }
.book-leaf.from-right { left: var(--pw); transform-origin: left center; }
.book-leaf.from-left { left: 0; transform-origin: right center; }
.book-leaf.from-right.turned { transform: rotateY(-180deg); }
.book-leaf.from-left.turned { transform: rotateY(180deg); }
.leaf-face { position: absolute; inset: 0; background: #fff; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; box-shadow: 0 8px 26px rgba(0, 0, 0, .3); }
.leaf-face.back { transform: rotateY(180deg); }

/* Phone: the next page slides in. */
.book-page.incoming { position: absolute; inset: 0; transition: transform .35s cubic-bezier(.23, 1, .32, 1), opacity .35s; opacity: 0; }
.book-page.incoming.from-right { transform: translateX(40%); }
.book-page.incoming.from-left { transform: translateX(-40%); }
.book-page.incoming.in { transform: none; opacity: 1; }

.book-help { margin: 0; padding: .55rem .9rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.book-copy { white-space: nowrap; }
.book-error { color: #FFF4E0; padding: 2rem 1rem; text-align: center; }
.book-error a { color: #F4A261; }

@media (max-width: 640px) {
    .book-bar { gap: .5rem; }
    .book-chapters { flex-basis: 100%; max-width: none; order: 2; }
    .book-nav { margin-left: 0; flex: 1; justify-content: space-between; }
    #book-full { display: none; }
    .book-stage { padding: .75rem .5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .book-leaf, .book-page.incoming { transition: none; }
}
