/* The portrait story grows to the viewport height; its original aspect ratio is
   retained and the ambient surround fills any exposed side area. */
.sl .st{width:min(122vw,calc(100svh*.5625));aspect-ratio:864/1536;height:auto}
#s0 .st{width:min(122vw,calc(100svh*720/1280));aspect-ratio:720/1280;height:auto;--w:720}
#s2 .st{width:min(125vw,calc(100svh*768/1344));aspect-ratio:768/1344;height:auto;--w:768}
#s3 .st{width:min(122vw,calc(100svh*899/1750));aspect-ratio:899/1750;height:auto;--w:899}

/* Poster and clip occupy exactly the same 9:16 canvas. The first decoded
   moving frame dissolves over its pixel-matched still, so no black/shutter frame. */
#gift-frame{z-index:1}
.scene-video{z-index:2;object-fit:contain;pointer-events:none;background:#0b0824;opacity:0;transition:opacity 130ms ease-out}
.scene-video.is-playing{opacity:1}
#gift-hit{left:30%;top:49.5%;width:33%;height:18%;z-index:4;clip-path:none;border:0;border-radius:12%;background:transparent}
#gift-hit:focus-visible,#gift-card-hit:focus-visible{outline:2px solid #ffe3a3;outline-offset:3px;box-shadow:0 0 24px #ffd77caa}
#gift-card-hit{position:absolute;z-index:5;left:29%;top:42.5%;width:34%;height:28%;padding:0;border:0;border-radius:8%;background:transparent;cursor:pointer;touch-action:manipulation}
#gift-card-hit:active{background:#f2d38a14}
@media(prefers-reduced-motion:reduce){.scene-video{transition:none}}

/* Show every part of the supplied card without warping or cropping it; the
   softly blurred full-screen surround fills the remaining viewport area. */
#greeting-card-dialog{position:fixed;inset:0;width:100vw;height:100svh;max-width:none;max-height:none;margin:0;padding:0;overflow:hidden;border:0;background:transparent;place-items:center;isolation:isolate}
#greeting-card-dialog[open]{display:grid}
#greeting-card-dialog::before{content:"";position:absolute;inset:-5%;z-index:-1;background-image:var(--card-backdrop);background-position:center;background-size:cover;filter:blur(24px) brightness(.45);transform:scale(1.05);pointer-events:none}
#greeting-card-dialog::backdrop{background:#08041976;backdrop-filter:blur(8px)}
.greeting-card-art{position:relative;z-index:1;width:min(100vw,calc(100svh*900/1277));height:min(100svh,calc(100vw*1277/900));aspect-ratio:900/1277;flex:none}
#greeting-card-image{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:fill}
.card-close{position:fixed;top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));z-index:5}
#light-cake.artwork-button{position:absolute;z-index:4;left:24%;top:63.5%;width:53%;height:10%;min-width:44px;min-height:44px;padding:0;border:0;border-radius:999px;background:transparent;box-shadow:none;color:transparent;cursor:pointer;touch-action:manipulation}
#light-cake:focus-visible{outline:3px solid #fff1b5;outline-offset:3px;box-shadow:0 0 22px #ffd175a6}
#greeting-card-dialog[open] .greeting-card-art{animation:greeting-card-appear .22s ease-out both}
@keyframes greeting-card-appear{from{opacity:.65;transform:scale(.985)}to{opacity:1;transform:scale(1)}}
@media(prefers-reduced-motion:reduce){#greeting-card-dialog[open] .greeting-card-art{animation:none}}

/* Cake, book and final controls. */
.mic-only{width:60px;height:60px;min-width:48px;min-height:48px;border:1px solid #d6b780a6;border-radius:50%;background:linear-gradient(135deg,#3b1c58ec,#190c35ec);color:#f8e4bc;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 0 22px #b763cc45;flex-shrink:0}
.mic-only svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.mic-only.listening{border-color:#ffeeae;box-shadow:0 0 0 5px #dfc79420,0 0 28px #eeb78e66}
.mic-only:disabled{opacity:.8;cursor:default}
#s2 .cake-controls{bottom:9%;left:9%;right:9%;min-height:0;gap:12px;background:none;border:0;border-radius:0;box-shadow:none;padding:0}
#s2 .mic-meter{max-width:180px}
#s3 .book-hit{inset:0;width:100%;height:100%;border-radius:0;clip-path:polygon(7% 48%,35% 51%,70% 44%,79% 63%,44% 68%,18% 64%);touch-action:manipulation}
#s3 .book-hit:focus-visible{outline:none;filter:drop-shadow(0 0 8px #e9c57d);background:#e9c57d15}
#reading-scene{pointer-events:none}
#magic-resting{inset:0;display:flex;justify-content:center;align-items:center;padding:0;margin:0;transform:none}
#magic-resting[hidden]{display:none}
#magic-resting .mic-only{width:68px;height:68px}
#mw{display:none!important}
.sl.on{animation:chapter-in .35s both}

/* The exact existing dua is visible on the scroll as soon as its scene opens. */
.dua-canvas{background:var(--bg) center/100% 100% no-repeat}
.dua-content{position:absolute;left:15%;right:15%;top:26%;bottom:24%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:clamp(5px,1.5cqw,14px);overflow:hidden;padding:2.5% 3%;text-align:center;color:#513829}
#dua-arabic,#dua-english{width:100%;max-height:100%;margin:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#a67e3b77 transparent}
#dua-arabic{font:400 clamp(18px,4.6cqw,26px)/1.8 'Noto Naskh Arabic','Amiri',serif;color:#513829;unicode-bidi:plaintext}
#dua-english{font:500 clamp(17px,4.1cqw,23px)/1.55 var(--serif);color:#513829}
.dua-controls{display:flex;flex-direction:column;align-items:center;gap:4px;flex:none}
.dua-controls .text-button{min-height:40px;color:#67442d;font-size:clamp(13px,3.2cqw,17px)}
.dua-controls .action{min-width:150px;min-height:44px;border-color:#a67e3b;background:linear-gradient(#fff5df,#e9d6af);color:#523628;box-shadow:0 2px 12px #76532433;font-size:clamp(14px,3.4cqw,18px)}
.dua-fallback .dua-content{background:#f6e8d4f2;border:1px solid #a67e3b;border-radius:18px;padding:5%;box-shadow:0 5px 28px #170e1d88}

.navigation-error{position:fixed;z-index:40;bottom:48px;left:50%;transform:translateX(-50%);width:min(88vw,360px);padding:12px 16px;border:1px solid #e9c57d88;border-radius:14px;background:#1b103bf2;color:var(--cream);text-align:center;font:400 13px/1.5 var(--sans);box-shadow:0 8px 30px #0006}

@media(max-height:650px){.card-close{width:36px;height:36px}.dua-content{top:23%;bottom:20%;gap:4px}#dua-arabic{font-size:clamp(16px,4.2cqw,21px);line-height:1.55}.dua-controls .action{min-height:38px}}
@media(max-width:360px){.dua-content{left:14%;right:14%;padding:2% 2%}#dua-arabic{font-size:17px;line-height:1.6}.dua-controls .text-button{min-height:34px}.dua-controls .action{min-height:40px}}
