/* Transparent, oversized leather book with the original adventure cast. */
.enchanted-book-art{width:100%;transform:none;filter:drop-shadow(0 5px 4px #001c3277)}
.enchanted-book-art>img{display:block;width:100%;height:auto;object-fit:contain}
.topbar .rules-book-button{width:88px;min-width:64px;padding:0;background:none;border:0;box-shadow:none}
.topbar .rules-book-button .enchanted-book-art{width:100%;transform:none}
.account-art:has(.account-rulebook){position:relative;justify-content:flex-start;min-height:550px;padding:30px 20px}
.account-art .world-account-caption{position:relative;z-index:3;margin:0 auto 14px;text-align:center;padding:0;max-width:370px}
.account-art .world-account-caption h2{font-size:clamp(22px,2.4vw,30px);text-shadow:0 2px 6px #00392b}
.account-rulebook{position:relative;z-index:4;display:block;border:0;background:none;padding:0;margin:auto auto 8px;width:min(88%,330px);cursor:pointer;transition:transform .2s;filter:drop-shadow(0 12px 13px #00291c77)}
.account-rulebook:hover{transform:translateY(-4px) rotate(-1deg)}
.account-rulebook:focus-visible{outline:3px solid #ffe39d;outline-offset:8px;border-radius:18px}
/* The book remains over the current location, never inside an opaque modal panel. */
#modal.storybook-opening{width:min(96vw,850px);max-width:96vw;max-height:96dvh;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important;overflow:visible;outline:none}
#modal.storybook-opening::backdrop{background:#032a3540;backdrop-filter:blur(1px)}
#modal.storybook-opening .dialog-top{position:absolute;inset:0 0 auto;z-index:10;border:0;padding:0;margin:0;justify-content:flex-end}
#modal.storybook-opening .dialog-top h2{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
#modal.storybook-opening .close{width:44px;height:44px;border:1px solid #eaca83;background:#174b3c;color:#fff4c6;border-radius:50%;font-size:29px;box-shadow:0 3px 0 #082c24}
.storybook-stage{width:min(69vw,420px,58dvh);aspect-ratio:1170/1344;margin:auto;perspective:1400px;animation:storybook-fly-in 1380ms cubic-bezier(.32,.05,.27,1) both}
.storybook-ensemble{position:relative;width:100%;height:100%;transform-style:preserve-3d;filter:drop-shadow(0 18px 14px #001e3277)}
.storybook-base{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
.storybook-paper,.storybook-turning-leaf,.storybook-moving-cover{position:absolute;left:27%;top:27.4%;width:58.5%;height:66.8%;border-radius:1% 3% 3% 1%;transform-origin:0 50%}
.storybook-paper{z-index:2;box-sizing:border-box;border:2px solid #996b30;background:repeating-linear-gradient(90deg,#0000 0 97%,#a5875144 98% 100%),linear-gradient(95deg,#947440,#e6cd94 8%,#fff1c7 24%,#f5dfaf 88%,#d9b579);box-shadow:2px 2px 0 #d9bf8b,4px 4px 0 #9f7a46;padding:13% 4%;text-align:center;color:#57452d;display:flex;flex-direction:column;align-items:center;gap:6%;overflow:hidden}
.storybook-paper-ornament{font:700 clamp(22px,6vw,42px) Georgia;line-height:.8;color:#987138}
.storybook-paper-heading{font:700 clamp(12px,3vw,24px)/1.2 'Fraunces',Georgia,serif}
.storybook-paper i{display:block;width:90%;height:2px;background:#aa865c66}
.storybook-paper i:nth-last-of-type(2){width:75%}.storybook-paper-seal{font-size:clamp(26px,7vw,48px);color:#ac8534;margin-top:5%}
.storybook-moving-cover{z-index:4;transform-style:preserve-3d;animation:storybook-cover-turn 920ms 130ms cubic-bezier(.38,.05,.2,1) both}
.storybook-cover-front,.storybook-cover-back{position:absolute;inset:0;backface-visibility:hidden;border-radius:inherit}
.storybook-cover-front{background:url('/assets/rulebook/character-book.png') 65.06% 82.53%/170.94% 149.70%;box-shadow:2px 0 3px #26170ca0}
.storybook-cover-back{transform:rotateY(180deg);background:linear-gradient(90deg,#69401e,#ac7840 10%,#c2965b 90%,#704522);border:3px solid #604221;box-shadow:inset 0 0 0 7px #c4a16e,inset 0 0 16px #3c2417}
.storybook-turning-leaf{z-index:3;background:linear-gradient(90deg,#b89b65,#f9eac3 12%,#fff3d3 90%,#dfc393);border:1px solid #a78a55;box-shadow:1px 1px 3px #63432055;display:grid;place-items:center;animation:storybook-leaf-turn 740ms 320ms cubic-bezier(.42,.05,.27,1) both;backface-visibility:visible;transform-style:preserve-3d}
.storybook-turning-leaf span{color:#a98548;font-size:50px;opacity:.6}
@keyframes storybook-cover-turn{0%,12%{transform:rotateY(0)}100%{transform:rotateY(-154deg)}}
@keyframes storybook-leaf-turn{0%,15%{transform:rotateY(0) skewY(0)}45%{transform:rotateY(-62deg) skewY(-3deg)}100%{transform:rotateY(-148deg) skewY(0)}}
@keyframes storybook-fly-in{0%{transform:scale(.94) translateY(10px);opacity:0}12%,65%{transform:scale(1) translateY(0);opacity:1;filter:blur(0)}85%{opacity:1}100%{transform:scale(3.5) translateX(-9%);opacity:0;filter:blur(8px)}}
#modal.storybook-rules-arrival{animation:storybook-read-in 220ms ease-out both}
@keyframes storybook-read-in{from{transform:scale(.97);opacity:0;filter:blur(2px)}to{transform:scale(1);opacity:1;filter:none}}
@media(max-width:650px){.topbar .rules-book-button{width:65px;min-width:65px}.account-art:has(.account-rulebook){min-height:330px;padding:20px 16px 12px}.account-art .world-account-caption{margin-bottom:8px}.account-art .world-account-caption h2{font-size:21px;max-width:280px}.account-rulebook{width:195px;margin:0 auto}.storybook-stage{width:min(76vw,50dvh)}}
@media(prefers-reduced-motion:reduce){.account-rulebook{transition:none}.account-rulebook:hover{transform:none}.storybook-stage,.storybook-moving-cover,.storybook-turning-leaf,.storybook-cast,#modal.storybook-rules-arrival{animation:none}}

/* The cast gives the book a gentle nudge; no detached hand or stretching sleeve. */
.storybook-base{clip-path:inset(27.4% 0 0)}
.storybook-cast{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;clip-path:inset(0 0 72.6%);transform-origin:65% 28%;animation:storybook-cast-lean 650ms ease-in-out both}
@keyframes storybook-cast-lean{0%,100%{transform:none}35%{transform:translateY(1px) rotate(-1.3deg)}70%{transform:translateY(-1px) rotate(.4deg)}}
@media(prefers-reduced-motion:reduce){.storybook-cast{animation:none}}
