:root{--ink:#f0e2c1;--gold:#d8b77b;--dim:#b9b3a5;--green:#152b26;--book:#eddbb6;--body-font:23px;--pad:clamp(24px,4vw,58px)}*{box-sizing:border-box}html,body,#app{height:100%;margin:0}body{background:#101b1a;color:var(--ink);font-family:Manrope,Arial,sans-serif;overflow:hidden}button,select,input{font:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--gold);outline-offset:3px}button:disabled{opacity:.35;cursor:default}.app{min-height:100dvh;position:relative;isolation:isolate;overflow:hidden}.backdrop{position:absolute;inset:-4%;z-index:-3;background-position:center;background-size:cover;filter:saturate(.88) brightness(.65);animation:drift 32s ease-in-out infinite alternate;transition:opacity .6s}.veil{position:absolute;inset:0;z-index:-2;background:linear-gradient(90deg,rgba(7,20,19,.87),rgba(13,26,28,.35) 54%,rgba(7,20,19,.78)),linear-gradient(0deg,rgba(5,17,16,.85),transparent 42%,rgba(6,19,18,.34))}.particles{position:absolute;inset:0;pointer-events:none;z-index:-1;overflow:hidden}.spark{position:absolute;border-radius:50%;background:#ffdfa0;opacity:.48;box-shadow:0 0 16px #ffdfa0;animation:float var(--d) linear infinite;left:var(--x);top:105%;width:var(--s);height:var(--s)}.no-fx .spark{display:none}.no-fx .backdrop{animation:none}.topbar{height:78px;padding:0 clamp(18px,4vw,70px);display:flex;align-items:center;justify-content:space-between;gap:16px}.brand{font-family:'Cormorant Garamond',serif;color:var(--gold);font-size:29px;letter-spacing:.1em;background:none;border:0}.toplinks{display:flex;gap:12px}.glass{background:rgba(13,29,28,.66);border:1px solid rgba(222,187,123,.31);color:#f2e1ba;border-radius:8px;padding:10px 15px;transition:background .2s}.glass:hover{background:rgba(199,159,91,.2)}.goldbtn{border:1px solid #edd2a0;background:linear-gradient(135deg,#efdbb1,#b98d49);border-radius:5px;padding:15px 25px;color:#21302b;font-weight:800;box-shadow:0 9px 35px #0007}.ghostbtn{color:var(--ink);background:transparent;border:1px solid #d8ba7f90;border-radius:5px;padding:14px 22px}.hero{min-height:calc(100dvh - 78px);display:flex;align-items:center;padding:5vh clamp(24px,10vw,160px) 13vh}.hero-content{max-width:760px;animation:appear .75s ease both}.eyebrow{font-size:12px;letter-spacing:.36em;text-transform:uppercase;color:#e0bb7f}.hero h1{font:600 clamp(70px,9vw,145px)/.85 'Cormorant Garamond',serif;margin:25px 0 12px;text-shadow:0 7px 35px #000b}.hero h2{font:500 clamp(28px,3.1vw,48px)/1.05 'Cormorant Garamond',serif;letter-spacing:.01em;margin:18px 0 28px;color:#f3dcae}.hero p{font:500 20px/1.65 'Cormorant Garamond',serif;color:#e5d6b9}.hero-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:32px}.bottom-note{position:absolute;bottom:32px;left:clamp(24px,10vw,160px);font-size:11px;letter-spacing:.15em;color:#b5af9f}.reader-shell{display:flex;height:calc(100dvh - 78px);max-width:1500px;margin:auto;padding:8px 32px 122px;gap:24px}.left-nav{width:240px;min-width:240px;display:flex;flex-direction:column;justify-content:center;gap:12px;color:#e5d4ad}.nav-title{font:500 25px 'Cormorant Garamond',serif;color:var(--gold)}.nav-sub{font:12px/1.7 Manrope,sans-serif;color:#c3b79f;margin-bottom:15px}.chapter-link{display:flex;text-align:left;gap:12px;align-items:baseline;border:0;border-left:2px solid transparent;background:transparent;padding:10px 8px;color:#c5bca9;font:500 16px/1.45 'Cormorant Garamond',serif}.chapter-link span{color:var(--gold)}.chapter-link.active{border-color:#e0bc7d;color:#ffe6b4;background:#bd9a6130}.book-area{min-width:0;flex:1;display:flex;align-items:center;justify-content:center;position:relative}.book{position:relative;width:min(100%,960px);height:100%;min-height:0;display:flex;flex-direction:column;padding:clamp(20px,4.5vh,52px) var(--pad) clamp(15px,2vh,25px);border-radius:7px 15px 15px 7px;background:linear-gradient(95deg,#bca879 0%,#e6d2a9 2%,#f1e4c7 8%,#eddfc0 47%,#e6d2aa 95%,#bdaa7b 100%);border:1px solid #ddc68f;box-shadow:inset 9px 0 14px #705e3b30,inset -8px 0 15px #664e2833,0 28px 70px #000a;color:#4b3b2a;overflow:hidden;transform-origin:left center}.book:before{content:'';position:absolute;inset:11px;border:1px solid #a58f6650;pointer-events:none}.book.turn-next{animation:pageNext .28s ease}.book.turn-prev{animation:pagePrev .28s ease}.book-title{font:600 clamp(15px,2vh,21px) 'Cormorant Garamond',serif;text-align:center;color:#967044;text-transform:uppercase;letter-spacing:.09em;margin-bottom:clamp(10px,2vh,25px)}.book-heading{text-align:center;font:600 clamp(25px,3vh,38px)/1.07 'Cormorant Garamond',serif;margin:0 0 16px}.page-content{flex:1;min-height:0;overflow:hidden;font:500 var(--body-font)/1.42 'Cormorant Garamond',Georgia,serif;letter-spacing:.004em;text-align:justify;hyphens:auto}.page-content p{margin:0 0 .72em;text-indent:1.3em}.page-content p:first-child{text-indent:0}.cue{border-radius:3px;cursor:pointer;transition:background .18s,color .18s}.cue:hover{background:#e3c98990}.cue.active{background:#d2a44c77;box-shadow:0 0 0 3px #d2a44c26}.page-foot{height:29px;display:flex;justify-content:space-between;align-items:end;font:12px Manrope,sans-serif;color:#8e795c;letter-spacing:.1em}.page-controls{position:absolute;bottom:11px;right:20px;left:20px;display:flex;justify-content:space-between;pointer-events:none}.page-controls button{pointer-events:auto;border-radius:50%;width:40px;height:40px;padding:0;background:#233c35e8;border:1px solid #cba76b8f;color:#ffe1a8;font-size:23px}.player{position:absolute;bottom:15px;left:50%;transform:translateX(-50%);z-index:5;width:min(990px,calc(100% - 40px));min-height:89px;padding:12px 18px;background:#10231feF;border:1px solid #bc985d77;border-radius:14px;box-shadow:0 10px 38px #000a;backdrop-filter:blur(16px)}.player-main{display:flex;align-items:center;gap:12px}.play{height:44px;width:44px;border-radius:50%;background:#c9a36d;color:#142722;border:0;font-size:19px;flex:none}.iconbtn{border:0;background:transparent;color:#f0d5a6;font-size:18px;min-width:32px;height:34px;padding:4px}.timeline{flex:1;min-width:40px;accent-color:#d9b77e;cursor:pointer}.time{color:#c8bb9f;font:11px Manrope,sans-serif;white-space:nowrap;font-variant-numeric:tabular-nums}.player-secondary{display:flex;gap:14px;justify-content:flex-end;align-items:center;padding:7px 2px 0;font-size:11px;color:#c7baa3}.player select,.settings select{background:#19322b;color:#e8d4ab;border:1px solid #967b52;border-radius:5px;padding:4px}.player label{display:flex;align-items:center;gap:5px}.volume{width:68px;accent-color:#d9b77e}.drawer{position:fixed;z-index:20;top:0;right:0;height:100dvh;width:min(370px,100vw);background:#152923;border-left:1px solid #93764c;box-shadow:-20px 0 80px #0008;padding:34px 27px;overflow:auto;animation:slide .25s ease}.drawer h3{font:600 35px 'Cormorant Garamond',serif;color:#f1d49e;margin:10px 0 20px}.drawer h4{font:500 20px 'Cormorant Garamond',serif;color:#d7bc8a}.drawer .chapter-link{width:100%;font-size:20px}.settings{display:grid;gap:16px}.settings label{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:13px}.settings input[type=checkbox]{accent-color:#bb9758;width:18px;height:18px}.settings input[type=range]{accent-color:#d8b77b;width:110px}.close-drawer{float:right}.readersmall{display:none}.boot{height:100dvh;display:grid;place-content:center;font:60px 'Cormorant Garamond',serif}.boot span{color:var(--gold);text-align:center}@keyframes drift{to{transform:scale(1.09) translate(-1.5%,1%)}}@keyframes float{to{transform:translateY(-120vh) translateX(30px);opacity:0}}@keyframes appear{from{opacity:0;transform:translateY(22px)}to{opacity:1;transform:translateY(0)}}@keyframes slide{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes pageNext{50%{transform:perspective(1100px) rotateY(-4deg);filter:brightness(.9)}}@keyframes pagePrev{50%{transform:perspective(1100px) rotateY(4deg);filter:brightness(.9)}}@media(max-width:1050px){.left-nav{display:none}.reader-shell{padding:5px 14px 120px}.readersmall{display:block}.book{width:min(100%,780px)}}@media(max-width:600px){.topbar{height:57px;padding:0 14px}.brand{font-size:23px}.toplinks{gap:6px}.glass{padding:8px 10px;font-size:12px}.hero{min-height:calc(100dvh - 57px);padding:12vh 25px}.hero h1{font-size:78px}.hero h2{font-size:30px}.hero p{font-size:17px}.hero-actions button{font-size:13px}.bottom-note{left:25px}.reader-shell{height:calc(100dvh - 57px);padding:2px 5px 139px}.book{padding:20px 22px 10px;border-radius:3px 9px 9px 3px}.book:before{inset:6px}.book-title{font-size:14px;margin-bottom:10px}.book-heading{font-size:27px;margin-bottom:9px}.page-content{line-height:1.33}.page-foot{font-size:10px}.page-controls{left:8px;right:8px;bottom:5px}.page-controls button{width:35px;height:35px}.player{bottom:7px;width:calc(100% - 10px);padding:8px 9px;border-radius:10px}.player-main{gap:4px}.player-secondary{gap:8px;flex-wrap:wrap;justify-content:center}.time{font-size:9px}.volume{width:42px}.iconbtn{font-size:15px;min-width:28px}.play{width:37px;height:37px}.player select{font-size:11px}.player-secondary label{font-size:10px}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Pencil illustrations follow the text flow, without any paper rectangle. */
.story-figure{margin:.45em auto .65em;text-align:center;break-inside:avoid;line-height:0;text-indent:0}
.story-illustration{display:block;width:auto;max-width:90%;height:auto;max-height:clamp(135px,26vh,210px);margin:0 auto;object-fit:contain;mix-blend-mode:multiply}
@media(max-width:600px){.story-illustration{max-height:clamp(120px,21vh,180px);max-width:96%}}


/* Real paper leaf turn: old page pivots over the newly laid-out page. */
.book{perspective:1500px;isolation:isolate;}
.book.turn-next,.book.turn-prev{animation:none}
.flipping-sheet{position:absolute;z-index:8;inset:0;pointer-events:none;
 transform-style:preserve-3d;backface-visibility:hidden;
 background:linear-gradient(95deg,#bca879 0%,#e6d2a9 2%,#f1e4c7 8%,#eddfc0 47%,#e6d2aa 95%,#bdaa7b 100%);
 box-shadow:inset 9px 0 14px #705e3b30,0 3px 13px #49382050;overflow:hidden}
.flipping-sheet-content{position:absolute;top:0;bottom:0;left:0;right:0;
 padding:clamp(20px,4.5vh,52px) var(--pad) clamp(15px,2vh,25px);
 display:flex;flex-direction:column;justify-content:center;}
.flipping-sheet-content .page-content{flex:1}
.flipping-forward{transform-origin:left center;animation:paper-flip-forward .58s cubic-bezier(.29,.05,.22,1) both}
.flipping-back{transform-origin:right center;animation:paper-flip-back .58s cubic-bezier(.29,.05,.22,1) both}
.flipping-sheet:after{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,transparent 30%,#52381955);opacity:0;animation:paper-shading .58s ease-in-out both}
@keyframes paper-flip-forward{0%{transform:rotateY(0deg);opacity:1}76%{opacity:1}100%{transform:rotateY(-92deg);opacity:0}}
@keyframes paper-flip-back{0%{transform:rotateY(0deg);opacity:1}76%{opacity:1}100%{transform:rotateY(92deg);opacity:0}}
@keyframes paper-shading{0%,100%{opacity:0}50%{opacity:.65}}
@media(max-width:600px){.flipping-sheet-content{padding:20px 22px 10px}}
@media(prefers-reduced-motion:reduce){.flipping-sheet{display:none}}

/* Allow vertical page gestures while treating horizontal swipes as book navigation. */
#book{touch-action:pan-y}


/* Text wraps a sepia engraving, which remains in the natural reading flow.
   Intrinsic width/height on img reserves height before the image downloads. */
.page-content{display:flow-root}
.story-figure{float:right;width:42%;max-width:275px;margin:.15em 0 .5em 1em;line-height:0;break-inside:avoid;clear:none}
.story-illustration{display:block;width:100%;height:auto;max-width:none;max-height:none;object-fit:contain;mix-blend-mode:multiply}
@media(max-width:600px){
 .story-figure{width:46%;max-width:210px;margin:.15em 0 .45em .55em}
 .story-illustration{max-width:none;max-height:none}
}
