/* Adapted spine lighting from the project's heyzine_dynamic.html template.
   PageFlip owns page transforms and moving shadows; do not override them. */
.book-paper{isolation:isolate;border:0;box-shadow:inset 0 -1px 0 #0002;cursor:grab}
.book-paper:active{cursor:grabbing}
.book-paper::after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;pointer-events:none}
/* Curved paper: pages bend down into the binding (shadow deepening towards
   the spine, a soft highlight on the crest of the curve) and fall away
   slightly at the outer edge. Hard covers keep their own rules below. */
.book-paper[class~="--left"]::after{background:linear-gradient(to right,#0000000f 0,transparent 3.5%),linear-gradient(to right,transparent 66%,#00000006 76%,#ffffff1a 84%,#ffffff0d 87%,#0000000d 91%,#0000002b 95.5%,#0000004d 98.5%,#00000073 100%);box-shadow:inset -1px 0 0 #0006}
.book-paper[class~="--right"]::after{background:linear-gradient(to left,#0000000f 0,transparent 3.5%),linear-gradient(to left,transparent 66%,#00000006 76%,#ffffff1a 84%,#ffffff0d 87%,#0000000d 91%,#0000002b 95.5%,#0000004d 98.5%,#00000073 100%);box-shadow:inset 1px 0 0 #0006}
.book-board{box-shadow:inset 0 0 0 1px #0004,inset 0 -3px 0 #0003}
.book-board[class~="--right"]::after{background:linear-gradient(to right,#0005 0,#ffffff20 1%,#00000012 2%,transparent 5%);box-shadow:inset 2px 0 0 #ffffff20}
.book-board[class~="--left"]::after{background:linear-gradient(to left,#0005 0,#ffffff20 1%,#00000012 2%,transparent 5%);box-shadow:inset -2px 0 0 #ffffff20}

.book-idle[hidden]{display:none!important}
.book-idle{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;display:grid;place-items:center;padding:20px;background:#172e3055}
.book-idle-panel{max-width:360px;padding:24px;text-align:center;background:#f8faf5;color:#375744;border:1px solid #cbd5c9;border-radius:12px;box-shadow:0 12px 40px #172e3033;font:14px/1.5 system-ui,sans-serif}
.book-idle-panel p{margin:0 0 16px}
.book-idle-panel button{border:1px solid #cbd5c9;background:#f8faf5;color:#375744;padding:10px 16px;border-radius:7px;font:inherit;cursor:pointer}

/* Page links (TOC entries, cross references): invisible until hovered. */
.book-links{position:absolute;top:0;right:0;bottom:0;left:0;z-index:3;pointer-events:none}
.book-link{position:absolute;display:block;pointer-events:auto;border-radius:4px;cursor:pointer;-webkit-tap-highlight-color:rgba(255,196,0,.35)}
.book-link:hover,.book-link:focus-visible{background:rgba(255,196,0,.22);box-shadow:0 0 0 1px rgba(214,150,0,.55);outline:none}

/* Reader bookmarks: a red ribbon on marked pages + the bookmarks list. */
.book-ribbon{position:absolute;top:0;right:9%;z-index:4;width:22px;height:46px;background:linear-gradient(90deg,#b3121a,#e5252a 45%,#c21820);box-shadow:0 2px 6px rgba(0,0,0,.35);pointer-events:none;clip-path:polygon(0 0,100% 0,100% 100%,50% 78%,0 100%)}
[class~="--left"] .book-ribbon{right:auto;left:9%}
.book-marks{position:fixed;left:50%;bottom:92px;transform:translateX(-50%);z-index:2100;width:320px;max-width:calc(100vw - 24px);max-height:60vh;overflow:auto;padding:12px;border-radius:14px;background:#fffdf8;color:#1c1917;border:1px solid #e4ded0;box-shadow:0 18px 50px rgba(0,0,0,.28);font:14px/1.4 system-ui,sans-serif}
.book-marks-title{margin:2px 4px 8px;font-weight:800;font-size:13px;letter-spacing:.04em;text-transform:uppercase;color:#78716c}
.book-marks-empty{margin:4px;color:#57534e}
.book-mark{display:flex;align-items:center;gap:6px;margin-top:6px}
.book-mark-go{flex:1;display:flex;align-items:center;gap:10px;padding:6px;border:1px solid #efe9dc;border-radius:10px;background:#fff;cursor:pointer;text-align:left;font:inherit;color:inherit}
.book-mark-go:hover,.book-mark-go:focus-visible{background:#fff4e5;outline:none;border-color:#e5252a}
.book-mark-go img{width:34px;height:46px;object-fit:cover;border-radius:3px;box-shadow:0 1px 4px rgba(0,0,0,.2);background:#fff}
.book-mark-remove{width:32px;height:32px;border:1px solid #efe9dc;border-radius:999px;background:#fff;cursor:pointer;font-size:18px;line-height:1;color:#78716c}
.book-mark-remove:hover{color:#b3121a;border-color:#e5252a}
.book-note-stack{position:absolute;top:10%;right:0;z-index:5;display:flex;flex-direction:column;align-items:flex-end;gap:10px;pointer-events:none}
[class~="--left"] .book-note-stack{right:auto;left:0;align-items:flex-start}
.book-note-tab{--tab:#fde68a;position:relative;width:30px;height:36px;padding:0;border:0;border-radius:12px 0 0 12px;background:var(--tab);color:#1c1917;font:700 13px/1 system-ui,sans-serif;cursor:pointer;pointer-events:auto;box-shadow:-2px 2px 5px rgba(0,0,0,.18);transition:width .15s}
.book-note-tab::before,.book-note-tab::after{content:"";position:absolute;right:0;width:10px;height:10px;pointer-events:none}
.book-note-tab::before{top:-10px;background:radial-gradient(circle at 0 0,transparent 9.5px,var(--tab) 10px)}
.book-note-tab::after{bottom:-10px;background:radial-gradient(circle at 0 100%,transparent 9.5px,var(--tab) 10px)}
[class~="--left"] .book-note-tab{border-radius:0 12px 12px 0;box-shadow:2px 2px 5px rgba(0,0,0,.18)}
[class~="--left"] .book-note-tab::before,[class~="--left"] .book-note-tab::after{right:auto;left:0}
[class~="--left"] .book-note-tab::before{background:radial-gradient(circle at 100% 0,transparent 9.5px,var(--tab) 10px)}
[class~="--left"] .book-note-tab::after{background:radial-gradient(circle at 100% 100%,transparent 9.5px,var(--tab) 10px)}
.book-note-tab:hover,.book-note-tab:focus-visible,.book-note-tab.is-open{width:38px;outline:none}
.book-note-add{--tab:rgba(255,255,255,.88);color:#78716c;font-size:15px;opacity:.75}
.book-note-add:hover{opacity:1}
.book-note-card{position:fixed;z-index:2100;display:flex;flex-direction:column;min-width:220px;min-height:130px;max-width:calc(100vw - 24px);max-height:calc(100vh - 24px);overflow:hidden;padding:12px 14px;border-radius:14px;border-left:8px solid var(--tab,#fde68a);background:#fffdf8;color:#1c1917;box-shadow:0 18px 50px rgba(0,0,0,.28);font:14px/1.45 system-ui,sans-serif;box-sizing:border-box}
.book-note-card-title{margin:0 0 6px;font-size:11px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:#78716c}
.book-note-card-text{flex:1 1 auto;min-height:0;white-space:pre-wrap;overflow-wrap:anywhere;overflow:auto;max-height:45vh}
.book-note-card[style*="height"] .book-note-card-text{max-height:none}
.book-note-card .book-note-actions{flex:none}
.book-note-grip{position:absolute;right:2px;bottom:2px;width:22px;height:22px;cursor:nwse-resize;touch-action:none;border-radius:0 0 12px 0;background:linear-gradient(135deg,transparent 50%,rgba(28,25,23,.28) 50%,rgba(28,25,23,.28) 58%,transparent 58%,transparent 70%,rgba(28,25,23,.28) 70%,rgba(28,25,23,.28) 78%,transparent 78%)}
.book-note-grip:hover{background-color:rgba(28,25,23,.06)}
.book-note-editor{width:400px}
.book-note-editor textarea{display:block;width:100%;min-height:130px;margin:0;padding:10px;border:1px solid #d6cfbf;border-radius:10px;background:#fffbeb;color:#1c1917;font:14px/1.5 system-ui,sans-serif;resize:vertical;box-sizing:border-box}
.book-note-editor textarea:focus{outline:2px solid #e5252a;outline-offset:1px}
.book-note-status{margin:6px 2px 0;font-size:11px;color:#78716c}
.book-note-actions{display:flex;justify-content:space-between;gap:8px;margin-top:10px}
.book-note-actions button{padding:8px 16px;border-radius:999px;font:600 13px system-ui,sans-serif;cursor:pointer}
.book-note-done{border:1px solid #1a3c34;background:#1a3c34;color:#fff}
.book-note-delete{border:1px solid #efe9dc;background:#fff;color:#b3121a}
/* Notes list: the whole note, wrapped; the list scrolls down, never sideways. */
.book-note-list{overflow-x:hidden}
.book-note-list .book-mark{align-items:flex-start}
.book-note-list .book-mark-go{min-width:0}
.book-note-row{flex-direction:column;align-items:flex-start;gap:2px}
.book-note-row span{color:#57534e;font-size:12.5px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;max-width:100%}
@media (max-height:520px){.book-note-editor,.book-note-list{top:8px;bottom:auto;max-height:calc(100vh - 70px);max-height:calc(100dvh - 70px)}.book-note-editor textarea{min-height:64px;height:64px;resize:none}.book-note-actions{margin-top:6px}.book-note-actions button{padding:6px 14px}}
.book-highlights{position:absolute;top:0;right:0;bottom:0;left:0;z-index:3;pointer-events:none}
.book-hl{position:absolute;border-radius:2px;opacity:.5;mix-blend-mode:multiply}
.book-hl.is-preview{opacity:.35}
.book-hl.is-selected{opacity:.7;outline:2px solid #1c1917;outline-offset:1px}
/* Read aloud: a speaker cursor (click a word to read from there) and the words being read. */
body.is-reading .page,body.is-reading .pdf-page{cursor:pointer;cursor:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20fill%3D%22none%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%209h3l5-4v14l-5-4H4z%22%20stroke%3D%22%23fff%22%20stroke-width%3D%225%22%2F%3E%3Cpath%20d%3D%22M16%208.5a5%205%200%200%201%200%207M18.8%206a8.5%208.5%200%200%201%200%2012%22%20stroke%3D%22%23fff%22%20stroke-width%3D%225%22%2F%3E%3Cpath%20d%3D%22M4%209h3l5-4v14l-5-4H4z%22%20fill%3D%22%231a73e8%22%20stroke%3D%22%231c1917%22%20stroke-width%3D%221.8%22%2F%3E%3Cpath%20d%3D%22M16%208.5a5%205%200%200%201%200%207M18.8%206a8.5%208.5%200%200%201%200%2012%22%20stroke%3D%22%231c1917%22%20stroke-width%3D%221.8%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 4 12,pointer}
.book-reading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:4;pointer-events:none}
.book-reading span{position:absolute;border-radius:3px;background:rgba(26,115,232,.14);box-shadow:inset 0 -2px 0 #1a73e8}
body.is-highlighting .page,body.is-highlighting .pdf-page{cursor:text;cursor:var(--hl-cursor,text)}
body.is-highlighting .book-note-stack{pointer-events:none;opacity:.25}
/* Links (e.g. a table of contents) can be highlighted too: inert while highlighting. */
body.is-highlighting .book-link{pointer-events:none}
/* A note just made from a highlight: shown in full and pulsing. */
.book-note-stack.has-new{opacity:1!important}
.book-note-tab.is-new{animation:book-note-new .6s ease-in-out 3}
@keyframes book-note-new{50%{transform:scale(1.3);box-shadow:0 0 0 4px rgba(211,29,36,.35)}}
@media (prefers-reduced-motion:reduce){.book-note-tab.is-new{animation:none;outline:3px solid #d31d24}}
.book-hl-bar{position:fixed;left:10px;top:50%;transform:translateY(-50%);z-index:2100;display:flex;flex-direction:column;align-items:center;gap:8px;max-height:calc(100vh - 20px);padding:10px 8px;border-radius:18px;background:#fffdf8;border:1px solid #e4ded0;box-shadow:0 12px 34px rgba(0,0,0,.28);font:13px/1.2 system-ui,sans-serif;color:#1c1917}
.book-hl-bar[hidden]{display:none}
.book-hl-swatch{width:30px;height:30px;padding:0;border:2px solid #fff;border-radius:999px;box-shadow:0 0 0 1px rgba(0,0,0,.22);cursor:pointer}
.book-hl-swatch[aria-pressed="true"]{box-shadow:0 0 0 3px #1c1917}
.book-hl-hint{display:none}
.book-hl-delete,.book-hl-done{padding:6px 10px;border-radius:999px;font:600 12px system-ui,sans-serif;cursor:pointer}
.book-hl-delete{border:1px solid #efe9dc;background:#fff;color:#b3121a}
.book-hl-delete[hidden]{display:none}
.book-hl-done{border:1px solid #1a3c34;background:#1a3c34;color:#fff}
.book-hl-tools{display:flex;flex-direction:column;gap:6px;padding-bottom:8px;border-bottom:1px solid #efe9dc}
.book-hl-brush,.book-hl-pen,.book-hl-eraser,.book-hl-summary,.book-hl-translate{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:1px solid #d6cfbf;border-radius:12px;background:#fff;color:#57534e;cursor:pointer}
.book-hl-icon{display:block;width:20px;height:20px;pointer-events:none}
.book-hl-brush[aria-pressed="true"]{color:#1c1917;background:var(--hl-color,#ffd43b);border-color:#1c1917;box-shadow:0 0 0 2px #1c1917}
.book-hl-eraser[aria-pressed="true"]{color:#b3121a;background:#fde2e2;border-color:#b3121a;box-shadow:0 0 0 2px #b3121a}
.book-hl-translate[aria-pressed="true"]{color:#0c4a6e;background:#e0f2fe;border-color:#0369a1;box-shadow:0 0 0 2px #0369a1}
.book-hl-summary[aria-pressed="true"]{color:#4c1d95;background:#ede9fe;border-color:#6d28d9;box-shadow:0 0 0 2px #6d28d9}
#highlight .book-hl-icon{width:16px;height:16px;margin:-2px 0}
.book-hl.is-eraser{background:rgba(179,18,26,.08);border:2px dashed #b3121a;opacity:1;mix-blend-mode:normal}
body.is-erasing .page,body.is-erasing .pdf-page{cursor:crosshair;cursor:var(--hl-cursor,crosshair)}
#highlight.is-on{background:#ffd43b;border-color:#e0b100}
#speak.is-on{background:#1a3c34;border-color:#1a3c34;color:#fff}
#speak[hidden]{display:none}
@media (max-height:360px){.book-hl-bar{gap:5px;padding:6px}.book-hl-swatch{width:24px;height:24px}}
/* Popup above the highlighter button (placed by JS). */
.book-hl-bar.is-popup{flex-direction:row;flex-wrap:wrap;justify-content:center;right:auto;bottom:auto;transform:none;max-width:calc(100vw - 16px);max-height:none;padding:8px 10px;gap:8px;border-radius:16px}
.book-hl-bar.is-popup::after{content:"";position:absolute;left:var(--hl-arrow,50%);bottom:-7px;width:12px;height:12px;margin-left:-6px;background:#fffdf8;border-right:1px solid #e4ded0;border-bottom:1px solid #e4ded0;transform:rotate(45deg)}
.book-hl-bar.is-popup.is-below::after{bottom:auto;top:-7px;transform:rotate(225deg)}
.book-hl-bar.is-popup .book-hl-tools{flex-direction:row;padding:0 8px 0 0;border-bottom:0;border-right:1px solid #efe9dc}
.book-hl-bar.is-popup .book-hl-brush,.book-hl-bar.is-popup .book-hl-eraser,.book-hl-bar.is-popup .book-hl-pen,.book-hl-bar.is-popup .book-hl-summary,.book-hl-bar.is-popup .book-hl-translate{width:32px;height:32px;border-radius:10px}
.book-hl-bar.is-popup .book-hl-icon{width:18px;height:18px}
.book-hl-bar.is-popup .book-hl-swatch{width:26px;height:26px}
.book-note-download{display:block;width:100%;margin-top:10px;padding:9px;border:1px dashed #d6cfbf;border-radius:10px;background:#fff;font:600 13px system-ui,sans-serif;color:#1a3c34;cursor:pointer}
.book-mark-state{margin-left:auto;padding:3px 9px;border-radius:999px;font-size:12px;font-weight:700;color:#57534e;background:#f5f0e6;white-space:nowrap}
.book-mark-pick.is-marked{border-color:#e5252a;background:#fff4e5}
.book-mark-pick.is-marked .book-mark-state{color:#fff;background:#d31d24}

/* Closed book centred; slides smoothly to the open spread (see centerCover). */
.book-shift{transition:transform 1.6s cubic-bezier(.37,0,.63,1);will-change:transform}
.book-shift-instant{transition:none}
@media (prefers-reduced-motion:reduce){.book-shift{transition:none}}

/* Curved cover turn (FlipbookCurl): strips chained in 3D, shaded by angle. */
.book-shift{position:relative}
.book-back-blank{background:linear-gradient(135deg,#f7f3ea,#ebe4d6)!important}
.cover-curl{position:absolute;z-index:60;pointer-events:none;transform-style:preserve-3d;-webkit-transform-style:preserve-3d}
.cover-curl-strip{position:absolute;top:0;transform-origin:0 50%;transform-style:preserve-3d;-webkit-transform-style:preserve-3d}
.cover-curl-face{position:absolute;top:0;left:0;width:100%;height:100%;background-repeat:no-repeat;backface-visibility:hidden;-webkit-backface-visibility:hidden;background-color:#fff}
.cover-curl-back{transform:rotateY(180deg)}
.cover-curl-shade{position:absolute;top:0;right:0;bottom:0;left:0}
.curl-hidden{visibility:hidden!important}


/* Podcast player (FlipbookPodcast): transcript with the line being spoken. */
.book-podcast{width:380px;max-height:62vh;display:flex;flex-direction:column;padding:10px 12px}
.book-podcast-head{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.book-podcast-head .book-marks-title{flex:1;margin:0}
.book-podcast-play{padding:7px 14px;border:0;border-radius:999px;background:#1a3c34;color:#fff;font:700 12.5px system-ui,sans-serif;cursor:pointer}
.book-podcast-close{width:30px;height:30px;padding:0;border:1px solid #e4ded0;border-radius:999px;background:#fff;color:#57534e;cursor:pointer}
.book-podcast-lines{list-style:none;margin:0;padding:0;overflow:auto;display:flex;flex-direction:column;gap:6px}
.book-podcast-line{padding:8px 10px;border-radius:12px;background:#fff;border:1px solid #efe9dc;font-size:13px;line-height:1.5;cursor:pointer;overflow-wrap:anywhere}
.book-podcast-line b{display:block;font-size:11px;letter-spacing:.04em;text-transform:uppercase;margin-bottom:2px}
.book-podcast-line.is-a b{color:#c2255c}
.book-podcast-line.is-b b{color:#1864ab}
.book-podcast-line:hover{border-color:#d6cfbf;background:#fffaf2}
.book-podcast-line.is-now{background:#eef6ec;border-color:#1a3c34;box-shadow:inset 3px 0 0 #1a3c34}
#podcast.is-on{background:#1a3c34;border-color:#1a3c34;color:#fff}
#podcast[hidden]{display:none}

/* Translation panel (FlipbookTranslate): beside the book, bottom sheet on phones. */
.book-translate{position:fixed;right:12px;top:64px;bottom:96px;z-index:2100;width:360px;max-width:calc(100vw - 24px);display:flex;flex-direction:column;padding:10px 12px;border-radius:14px;background:#fffdf8;color:#1c1917;border:1px solid #e4ded0;box-shadow:0 18px 50px rgba(0,0,0,.28);font:14px/1.6 system-ui,sans-serif}
.book-translate-head{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.book-translate-head .book-marks-title{flex:1;margin:0}
.book-translate-head select{padding:5px 8px;border:1px solid #d6cfbf;border-radius:8px;background:#fff;font:600 12px system-ui,sans-serif}
.book-translate-head select[hidden]{display:none}
.book-translate-body{overflow:auto;padding-right:4px}
.book-translate-body p{margin:0 0 10px;overflow-wrap:anywhere}
.book-translate-body .book-translate-page{margin:4px 0 6px;font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:#78716c}
#translate.is-on{background:#1a3c34;border-color:#1a3c34;color:#fff}
#translate[hidden]{display:none}
@media (max-width:640px){.book-translate{left:12px;right:12px;top:auto;bottom:86px;width:auto;max-height:50vh}}

/* Summary panel (FlipbookSummary): shares the translation panel's look. */
.book-summary .book-translate-body ul{margin:0 0 12px;padding-left:20px}
.book-summary .book-translate-body li{margin:0 0 6px}
#summary.is-on{background:#1a3c34;border-color:#1a3c34;color:#fff}
#summary[hidden]{display:none}
/* "🌐 Translate" (whole book): on a translated edition "· ID" in bold, button tinted. */
#edition[hidden]{display:none}
#edition{font-weight:700;letter-spacing:.02em;white-space:nowrap}
#edition span.is-current{font-weight:900}
/* Translating: a progress bar filling the button from the left. */
#edition.is-busy{background-image:linear-gradient(90deg,rgba(45,140,100,.32) var(--edition-progress,0%),transparent var(--edition-progress,0%));font-variant-numeric:tabular-nums}
#edition.is-translated{background:#e9e4ff}
/* Pages are pictures: no browser selection (the blue wash over a whole page on
   double-click / Ctrl+A / long press) and no image dragging. Note fields stay editable. */
.book-paper,.book-paper img,.cover-curl,.stf__parent{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
.book-paper img{-webkit-user-drag:none;user-drag:none}
.book-paper ::selection,.book-paper::selection,.book-paper img::selection{background:transparent}
.book-paper textarea,.book-paper input,.book-paper [contenteditable="true"]{-webkit-user-select:text;user-select:text}

/* Marker drawings: an SVG over the page (page units 0..1), strokes keep their width when zoomed. */
.book-ink{position:absolute;top:0;left:0;width:100%;height:100%;z-index:4;pointer-events:none;overflow:visible}
.book-ink path{fill:none;stroke-width:3px;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.book-hl-pen[aria-pressed="true"]{color:#fff;background:var(--hl-color,#1971c2);border-color:var(--hl-color,#1971c2);box-shadow:0 0 0 2px var(--hl-color,#1971c2)}
