/* Collection premium: mystery card backs for squishies still to find (collection-premium.js sets data-cb by card shape) */
html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered,html #modal[open]:has(.book-grid) .book-page>.book-toy.undiscovered:nth-child(n){background:#efe4f7 url('./assets/collection/card-back.webp') center/100% 100% no-repeat!important;border-color:#fff!important;box-shadow:0 5px 12px #6f569033,inset 0 0 0 1px #e9cf9f66!important;overflow:hidden}
html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered:before{content:''!important;inset:0 auto 0 -150%!important;width:150%!important;height:auto!important;background:linear-gradient(115deg,transparent 30%,#ffffff8c 46%,#fff4fb3d 52%,transparent 66%) 0 0/100% 100% no-repeat!important;z-index:2;pointer-events:none;transform:translateX(0);will-change:auto}
html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered:nth-child(2n):before{animation-delay:-2.2s}
html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered:nth-child(3n):before{animation-delay:-4.1s}
html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered:after,html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered .book-q{display:none!important}
html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered .toy,html #modal[open]:has(.book-grid) .book-page>.book-toy.undiscovered:nth-child(n) .toy{filter:brightness(0) invert(.7) sepia(.6) hue-rotate(215deg) saturate(1.9) opacity(.5) drop-shadow(0 -1.5px 0 #7d63a8aa) drop-shadow(0 2px 0 #ffffff)!important}
html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered .book-art{translate:0 -7%;scale:.86}
@keyframes cp-shine{0%,55%{transform:translateX(0)}100%{transform:translateX(170%)}}
/* shine + holo only run on the page in view, and pause while a finger drags the pages */
html #modal[open]:has(.book-grid) .book-grid.paged .book-page.cp-on .book-toy.undiscovered:before,html #modal[open]:has(.book-grid) .book-grid:not(.paged) .book-toy.undiscovered:before{animation:cp-shine 6.5s ease-in-out infinite}
html #modal[open]:has(.book-grid) .book-grid.sq-rail-dragging .book-toy:before,html #modal[open]:has(.book-grid) .book-grid.sq-rail-dragging .cp-holo{animation-play-state:paused!important}
@media (prefers-reduced-motion:reduce){html #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered:before{animation:none!important}}
body.calm-mode #modal[open]:has(.book-grid) .book-grid .book-toy.undiscovered:before{animation:none!important}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy.undiscovered:nth-child(n){background-image:url('./assets/collection/card-back-tall.webp')!important}
html #modal[open]:has(.book-grid) .book-grid:is([data-cb=square],[data-cb=wide]) .book-toy.undiscovered:nth-child(n){background-image:url('./assets/collection/card-back-square.webp')!important}
/* Header: one clean progress pill with a ring, no stray stars */
html #modal[open]:has(.book-grid) .modal-top h2:before,html #modal[open]:has(.book-grid) .modal-top h2:after{display:none!important}
html #modal[open]:has(.book-grid) .book-count{flex-direction:row!important;align-items:center;gap:9px!important;flex:0 0 auto!important;width:max-content!important;max-width:none!important;padding:4px 16px 4px 4px;border:2px solid #fff;border-radius:40px;background:#fffaf3;box-shadow:0 3px 8px #765c6b26}
html #modal[open]:has(.book-grid) .book-count:before{content:'★';flex:none;width:38px;height:38px;display:grid;place-items:center;border-radius:50%;color:#ffc93c;font-size:19px;line-height:1;text-shadow:0 1px 0 #d99a1a;background:radial-gradient(closest-side,#fffaf3 74%,transparent 76%),conic-gradient(#ae70f5 calc(var(--cp,0)*1%),#8ce6db calc(var(--cp,0)*1%) calc(var(--cp,0)*1% + .01%),#ece4f3 0)}
html #modal[open]:has(.book-grid) .book-count b{padding:0!important;border:0!important;background:none!important;box-shadow:none!important}
html #modal[open]:has(.book-grid) .book-count i{display:none!important}
/* Shelf: toys you own + one glowing "next to find" spot */
html #modal[open]:has(.book-grid) .book-shelf-row{justify-content:flex-start!important}
html #modal[open]:has(.book-grid) .book-shelf-spot{flex:0 0 calc((100% - 32px)/9)!important}
html #modal[open]:has(.book-grid) .book-shelf-spot.mystery~.book-shelf-spot.mystery{display:none!important}
html #modal[open]:has(.book-grid) .book-shelf-spot.mystery .toy{filter:brightness(0) invert(1) opacity(.9) drop-shadow(0 0 5px #c7a2ff) drop-shadow(0 0 12px #e3cdff)!important;animation:cp-next 2.4s ease-in-out infinite}
html #modal[open]:has(.book-grid) .book-shelf-spot.mystery i{color:#a77be0!important;text-shadow:none!important}
@keyframes cp-next{0%,100%{opacity:.75}50%{opacity:1}}
@media(max-width:600px){html #modal[open]:has(.book-grid) .book-shelf-spot{flex-basis:calc((100% - 20px)/6)!important}}
/* Filter rail: even chips, soft fade where it scrolls */
html #modal[open]:has(.book-grid) .book-tab{min-width:94px;justify-content:center}
html #modal[open]:has(.book-grid) .book-filters{--fl:0px;--fr:34px;-webkit-mask-image:linear-gradient(90deg,transparent 0,#000 var(--fl),#000 calc(100% - var(--fr)),transparent);mask-image:linear-gradient(90deg,transparent 0,#000 var(--fl),#000 calc(100% - var(--fr)),transparent)}
html #modal[open]:has(.book-grid) .book-filters[data-l]{--fl:34px}
html #modal[open]:has(.book-grid) .book-filters[data-end]{--fr:0px}
@media (prefers-reduced-motion:reduce){html #modal[open]:has(.book-grid) .book-shelf-spot.mystery .toy{animation:none}}
@media(max-width:400px){html #modal[open]:has(.book-grid) .book-label strong{word-break:keep-all!important;overflow-wrap:normal!important;hyphens:none!important;font-size:min(1em,3.4vw)!important}}
/* Motion: press tilt, page-turn entrance, new-toy card flip */
html #modal[open]:has(.book-grid) .book-grid .book-toy{transition:transform .22s cubic-bezier(.2,.8,.3,1.2)}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-press{transform:perspective(600px) rotateX(var(--tx,0deg)) rotateY(var(--ty,0deg)) scale(.96);transition-duration:.12s}
html #modal[open]:has(.book-grid) .book-toy.cp-flipping{overflow:hidden}
html #modal[open]:has(.book-grid) .book-toy .cp-back{position:absolute;inset:0;z-index:5;border-radius:inherit;background:#efe4f7 url('./assets/collection/card-back.webp') center/100% 100% no-repeat;pointer-events:none}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy .cp-back{background-image:url('./assets/collection/card-back-tall.webp')}
html #modal[open]:has(.book-grid) .book-grid:is([data-cb=square],[data-cb=wide]) .book-toy .cp-back{background-image:url('./assets/collection/card-back-square.webp')}
html #modal[open]:has(.book-grid) .book-toy .cp-spark{position:absolute;z-index:6;left:50%;top:42%;width:14px;height:14px;margin:-7px;pointer-events:none;color:#ffd34d;font-size:16px;line-height:14px;text-align:center;text-shadow:0 0 6px #fff}
/* Owned card fronts: foil frame per rarity (collection-premium.js adds .cp-front + .cp-holo) */
html #modal[open]:has(.book-grid) .book-grid .book-toy.discovered.cp-front{display:block!important;padding:0!important;overflow:hidden;border-color:#fff!important;background:#fff6e4 var(--cf) center/100% 100% no-repeat!important;box-shadow:0 6px 14px #8a5d2a33,inset 0 0 0 1px #f3d68a88!important}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front.rarity-common{--cf:url('./assets/collection/front-common.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy.cp-front.rarity-common{--cf:url('./assets/collection/front-common-tall.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=square] .book-toy.cp-front.rarity-common{--cf:url('./assets/collection/front-common-square.webp')}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front.rarity-uncommon{--cf:url('./assets/collection/front-uncommon.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy.cp-front.rarity-uncommon{--cf:url('./assets/collection/front-uncommon-tall.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=square] .book-toy.cp-front.rarity-uncommon{--cf:url('./assets/collection/front-uncommon-square.webp')}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front.rarity-rare{--cf:url('./assets/collection/front-rare.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy.cp-front.rarity-rare{--cf:url('./assets/collection/front-rare-tall.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=square] .book-toy.cp-front.rarity-rare{--cf:url('./assets/collection/front-rare-square.webp')}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front.rarity-ultra{--cf:url('./assets/collection/front-ultra.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy.cp-front.rarity-ultra{--cf:url('./assets/collection/front-ultra-tall.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=square] .book-toy.cp-front.rarity-ultra{--cf:url('./assets/collection/front-ultra-square.webp')}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front.rarity-legendary{--cf:url('./assets/collection/front-legendary.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy.cp-front.rarity-legendary{--cf:url('./assets/collection/front-legendary-tall.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=square] .book-toy.cp-front.rarity-legendary{--cf:url('./assets/collection/front-legendary-square.webp')}
/* window + plate positions per shape (square is the default above) */
html #modal[open]:has(.book-grid) .book-grid:not([data-cb=square]) .book-toy.cp-front .book-art{left:17%!important;width:66%!important;top:10%!important;height:64%!important}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy.cp-front .book-art{top:12%!important;height:60%!important}
html #modal[open]:has(.book-grid) .book-grid:not([data-cb=square]) .book-toy.cp-front .book-label{top:83%!important;height:10%!important}
html #modal[open]:has(.book-grid) .book-grid[data-cb=tall] .book-toy.cp-front .book-label{top:83.5%!important;height:9%!important}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front.rarity-legendary .book-label strong{color:#4a2a7a}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front .book-art{position:absolute!important;left:19%!important;width:62%!important;top:9%!important;height:62%!important;z-index:2}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front .book-art>.toy{width:min(92cqw,92cqh)!important;height:min(92cqw,92cqh)!important}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front .book-label{position:absolute!important;left:9%!important;right:9%!important;top:80.5%!important;height:12%!important;bottom:auto!important;z-index:3;margin:0!important;padding:0 4px!important;justify-content:center}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front .book-label strong{color:#6b3f12;font-size:clamp(11px,1.5vw,17px);line-height:1.05;text-align:center}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front .book-dots{display:none!important}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front .book-new{z-index:4}
html #modal[open]:has(.book-grid) .book-toy .cp-holo{position:absolute;inset:-60%;z-index:1;pointer-events:none;opacity:.55;background:linear-gradient(115deg,transparent 36%,#ffffffcc 45%,#ffd1f099 48%,#c6f1ff99 51%,#fff7c299 54%,transparent 63%);transform:translate(calc(var(--gx,0)*.6%),calc(var(--gy,0)*.6%));transition:transform .25s ease-out}
html #modal[open]:has(.book-grid) .book-grid.paged:not([data-tilt]) .book-page.cp-on .book-toy .cp-holo,html #modal[open]:has(.book-grid) .book-grid:not(.paged):not([data-tilt]) .book-toy .cp-holo{animation:cp-drift 7s ease-in-out infinite alternate}
@keyframes cp-drift{0%{transform:translate(-18%,-12%)}100%{transform:translate(18%,12%)}}
@media (prefers-reduced-motion:reduce){html #modal[open]:has(.book-grid) .book-toy .cp-holo{animation:none!important}}
body.calm-mode #modal[open]:has(.book-grid) .book-toy .cp-holo{animation:none!important}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front{container-type:inline-size}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front .book-label strong{font-size:clamp(10px,8.6cqw,18px)!important}
html #modal[open]:has(.book-grid) .book-grid[data-cb=wide] .book-toy.cp-front.rarity-common{--cf:url('./assets/collection/front-common-wide.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=wide] .book-toy.cp-front.rarity-uncommon{--cf:url('./assets/collection/front-uncommon-wide.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=wide] .book-toy.cp-front.rarity-rare{--cf:url('./assets/collection/front-rare-wide.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=wide] .book-toy.cp-front.rarity-ultra{--cf:url('./assets/collection/front-ultra-wide.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=wide] .book-toy.cp-front.rarity-legendary{--cf:url('./assets/collection/front-legendary-wide.webp')}
html #modal[open]:has(.book-grid) .book-grid[data-cb=wide] .book-toy.cp-front .book-art{left:25%!important;width:50%!important;top:10%!important;height:58%!important}
html #modal[open]:has(.book-grid) .book-grid[data-cb=wide] .book-toy.cp-front .book-label{top:77.5%!important;height:11.5%!important}
html #modal[open]:has(.book-grid) .book-grid[data-cb=wide] .book-toy.cp-front .book-label strong{font-size:clamp(10px,6.4cqw,16px)!important}
html #modal[open]:has(.book-grid) .book-grid .book-toy.cp-front .book-label strong{padding:0!important;margin:0!important;line-height:1.05!important;min-height:0!important;height:auto!important}
