[hidden]{display:none!important}
body{background:#0a1423}.wrap{max-width:1180px;padding:12px clamp(8px,2vw,26px) 28px}.header{align-items:center;flex-wrap:nowrap;padding:0 8px}.header h1{margin:0;font-size:clamp(1.85rem,3.4vw,3rem)}.byline{margin:2px 0 8px}.edition{margin:0}
.book-area{background:#000}.stage-bg,.backdrop{background-image:url(room.webp)}.stage-shade{background:linear-gradient(90deg,#060b2140,#09101d0d,#060b2140)}
.deck{padding:6px clamp(6px,2vw,24px);background:#0b1524f5;border-bottom:1px solid #aa895c}.primary,.toolbar-actions,.choices,#transport,#soundline{display:flex;align-items:center;justify-content:center;gap:8px}
.primary{--w:clamp(95px,19vw,235px)}.primary button{width:var(--w);height:clamp(44px,4.25vw,52px);max-width:none}.primary .plate{display:flex;align-items:center;justify-content:center;gap:.28em;padding:0 4px;border:3px double #d5aa63;border-radius:8px;background:linear-gradient(165deg,#212639,#091020 67%);color:#ffe9b7;font:bold clamp(.82rem,1.7vw,1.6rem) Georgia,serif;cursor:pointer}.plate::before{content:'';height:82%;aspect-ratio:1.25;border-radius:4px;background:url(play-music.webp) 51% 17% / 220% auto}.plate.full::before{background-image:url(full-screen.webp);background-size:360%;background-position:50% 37%}
.toolbar-actions{gap:8px}.toolbar-actions .image-btn{min-height:38px;width:104px}.toolbar-actions .enlarge{width:136px}
.drawer+.drawer{margin-top:3px}.bar{width:100%;display:flex;align-items:center;gap:12px;background:#101c2c;border:1px solid #a48756;border-radius:6px;padding:4px 12px;color:#f3e6d1;font:600 .87rem Georgia,serif;text-align:left;cursor:pointer}.bar strong{margin-left:auto;color:#ebc381;font-weight:normal}.bar::after{content:'';width:6px;height:6px;border:solid #e8bb72;border-width:0 1.5px 1.5px 0;transform:rotate(45deg);margin-top:-3px}.bar[aria-expanded=true]::after{transform:rotate(225deg)}
.choices,#transport{padding:5px;flex-wrap:wrap}.choices button,#transport button,#retry{border:1px solid #987e57;border-radius:6px;color:#f5e4c7;background:#172337;min-height:36px;padding:3px 12px;cursor:pointer}.choices button[aria-pressed=true]{color:#151b26;background:#e6c383}.choices label,#transport label,#clock{font-size:.84rem}#seek{max-width:38vw;accent-color:#e3b975}
#canvas{position:relative;display:grid;place-items:center;touch-action:pan-y pinch-zoom;overflow:auto;min-width:0}
#paper{position:relative;display:flex;justify-content:center;max-width:100%;gap:4px;cursor:zoom-in}
#paper img{display:block;object-fit:contain;max-width:100%;width:auto;height:auto;max-height:clamp(280px,calc(100svh - 285px),1000px);box-shadow:0 3px 16px #0007}
#paper.pair img{max-width:calc(50% - 2px)}
#music{width:100%;height:min(65svh,720px);object-fit:contain;background:black}
#canvas.turn #paper::after{content:'';position:absolute;pointer-events:none;inset:0 0 0 auto;width:18%;background:linear-gradient(105deg,transparent 25%,#0004 70%,#fff8 86%,transparent);transform-origin:right;animation:turn .48s ease-out both}
@keyframes turn{from{opacity:.8;transform:scaleX(1)}to{opacity:0;transform:scaleX(0)}}
.reader-footer{min-height:44px;padding:4px 12px}.page-controls{gap:5px}.status{min-width:60px}#soundline{padding:5px;background:#101a29;font-size:.82rem;color:#edd6af}#retry{min-height:32px}
.black .stage-bg,.black .stage-shade,body:has(.black) .backdrop,body:has(.black) .wash{visibility:hidden}body:has(.black),.black #canvas{background:#000}
.book-area.immersive{position:fixed;inset:0;z-index:20;width:100%;height:100dvh;max-width:none;max-height:none;border:0;border-radius:0}
.immersive #canvas{position:absolute;inset:0}.immersive #paper img{max-height:100dvh}.immersive #music{height:100dvh}.immersive .chrome{position:absolute;z-index:2;left:0;right:0}.immersive .deck{top:0}.immersive .reader-footer{bottom:32px}.immersive #soundline{bottom:0;min-height:32px}
.immersive.idle .chrome{opacity:0;pointer-events:none}.book-area.zoomed #canvas{display:block;max-height:85svh;touch-action:pan-x pan-y pinch-zoom}.book-area.zoomed #paper{width:max-content;max-width:none;margin:auto;cursor:zoom-out}.book-area.zoomed #paper img{max-width:none;max-height:none;width:min(150vw,1500px)}.immersive.zoomed #canvas{max-height:none}.mood-dialog{z-index:3}
@media(max-width:660px){.wrap{padding:6px 4px 20px}.header h1{font-size:1.85rem}.header .edition{font-size:.7rem}.byline{font-size:.8rem}.primary{gap:4px;--w:min(31%,150px)}.primary .plate{height:clamp(26px,6.9vw,35px);font-size:clamp(.72rem,2.9vw,1rem);border-width:2px}.primary button{min-height:44px}.primary .plate{min-height:0;position:relative}.primary .plate::after{content:'';position:absolute;inset:-7px 0}.toolbar-actions .image-btn{min-height:44px;width:24%}.toolbar-actions .enlarge{width:31%}.bar{min-height:36px}.reader-footer{flex-wrap:wrap;justify-content:center;gap:4px}.page-jump,.nav-mini{min-height:44px}.page-dotname{display:none}.reader-footer .page-strip{display:flex;gap:2px}.page-jump{padding:3px;min-width:28px}.reader-footer .page-controls{margin-right:auto}#paper img{max-height:calc(100svh - 245px)}.choices button,#retry,#begin{min-height:44px}.primary .plate::before{max-width:27%}.deck{padding:2px 4px 4px}}
@media(orientation:landscape) and (max-height:540px){.header{display:none}.wrap{padding:1px}.deck{padding:2px 8px;display:grid;grid-template-columns:1fr 1fr;gap:3px}.deck .primary,.deck .toolbar-actions{min-width:0}.primary{--w:30%}.primary .plate{font-size:.85rem;height:29px}.primary button{height:32px}.toolbar-actions .image-btn{min-height:32px}.drawer+.drawer{margin:0}.deck #transport{grid-column:1/-1}#paper img{max-height:calc(100svh - 130px)}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

@media(max-width:660px) and (orientation:portrait){.primary .plate{height:auto;aspect-ratio:1139/252}.primary .plate::before{height:auto;width:20%;aspect-ratio:1.25}}

#ambient{display:flex;align-items:center;gap:6px}#ambient input{accent-color:#dcbd86}#ambientSeek{width:clamp(65px,16vw,230px)}#volume{width:clamp(38px,6vw,80px)}#mute{background:transparent;color:#f5e3c7;border:1px solid #836e51;border-radius:5px;padding:3px 7px;cursor:pointer}#soundline{flex-wrap:wrap}#message:empty{display:none}
@media(max-width:660px){#soundline{gap:5px;padding:3px}#ambient{gap:3px}#mute,#ambient input{min-height:32px}}

/* Keep page gestures inside the artwork and let vertical scrolling pass through. */
#canvas,html:has(#canvas:hover){overscroll-behavior-x:contain}
.immersive.idle .chrome,.immersive.idle .stage-bg{transition:opacity .36s ease}
.immersive.idle,.immersive.idle #paper{cursor:none}
@media(prefers-reduced-motion:reduce){.immersive .chrome,.immersive .stage-bg{transition:none}}

#readerWelcome { box-sizing:border-box; width:min(29rem,92vw); max-height:86dvh; overflow:auto; padding:clamp(1.2rem,4vw,2rem); color:#fff2dc; background:#161d2d; border:1px solid #c5a371; border-radius:.75rem; }
#readerWelcome::backdrop { background:rgb(6 10 19 / .76); }
#readerWelcome h2 { margin:0; font:normal 2rem Georgia,serif; }
#readerWelcome p { line-height:1.5; }
.welcome-actions { display:flex; flex-wrap:wrap; gap:.6rem; }
.welcome-actions button { min-height:44px; padding:.55rem .9rem; font:inherit; cursor:pointer; background:#f2d49c; color:#182034; border:1px solid #cfb382; border-radius:.4rem; }
#welcomeRead { background:transparent; color:#fff2dc; }

.book-area:not(.controls-open) :is(.deck,#soundline,.page-strip) { display:none; }
.book-area .reader-footer { justify-content:center; gap:6px; padding:4px; }
.reader-footer .page-controls { margin:0; }
.mobile-action { display:block; background:#152437; color:#ffe8bc; border:1px solid #ab895e; border-radius:7px; padding:0 10px; min-height:44px; font:inherit; cursor:pointer; }
.mobile-action[aria-expanded=true] { background:#ead1a3; color:#111c2b; }
.book-area:not(.zoomed) #canvas { height:calc(100svh - 9rem); min-height:10rem; }
.book-area:not(.zoomed) #paper { width:100%; height:100%; align-items:center; min-height:0; }
.book-area:not(.zoomed) #paper img { width:100%; height:100%; max-height:100%; object-fit:contain; }
.story-art #music { position:absolute; inset:0; width:1px; height:1px; opacity:0; pointer-events:none; }
.story-art #paper { cursor:default; }
.book-area.immersive:not(.zoomed) #canvas { height:100%; }
.immersive:not(.controls-open) .reader-footer { bottom:env(safe-area-inset-bottom,0px); }
.controls-open .deck { max-height:50svh; overflow:auto; }
@media (orientation:landscape) and (max-height:540px) and (max-width:960px) {
  .book-area:not(.zoomed) #canvas { height:calc(100svh - 4rem); }
}

#mobileControls { width:clamp(84px,24vw,108px); min-height:44px; padding:0; border:0; background:transparent; }
#mobileControls img { display:block; width:100%; height:auto; }
#mobileControls[aria-expanded=true] img { filter:brightness(1.2); }
.book-area .stage-bg { opacity:.16; }
.backdrop { opacity:.025; }
@media (prefers-reduced-motion:no-preference) {
  .stage-bg,.backdrop { transition:opacity .36s ease; }
}

#openingSoundPrompt { position:absolute; z-index:1; top:12px; left:50%; transform:translateX(-50%); min-height:44px; padding:0 14px; color:#ffe8bc; background:#101c2c; border:1px solid #ab895e; border-radius:7px; cursor:pointer; }
